@haddowg/json-api-client 1.22.0 → 1.24.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 +12 -0
- package/dist/ajv.d.cts +1 -1
- package/dist/ajv.d.mts +1 -1
- package/dist/index.cjs +62 -27
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +62 -27
- package/dist/index.mjs.map +1 -1
- package/dist/{validate-Rgo7Zm0U.d.cts → validate-9lr5GAdA.d.cts} +57 -12
- package/dist/validate-9lr5GAdA.d.cts.map +1 -0
- package/dist/{validate-Rgo7Zm0U.d.mts → validate-9lr5GAdA.d.mts} +57 -12
- package/dist/validate-9lr5GAdA.d.mts.map +1 -0
- package/package.json +1 -1
- package/dist/validate-Rgo7Zm0U.d.cts.map +0 -1
- package/dist/validate-Rgo7Zm0U.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -108,6 +108,18 @@ tracks.$page.kind
|
|
|
108
108
|
const linkage = await client.albums.id('1').rel('tracks').get()
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+
### A singleton
|
|
112
|
+
|
|
113
|
+
A singleton type serves each caller one resource at a path with no id (`/inbox`). Its accessor is
|
|
114
|
+
a handle on that resource, with no `list`, `create`, `id()` or `delete`. The update body needs the
|
|
115
|
+
resource's id, so the input carries it:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
const inbox = await client.inboxes.get() // GET /inbox
|
|
119
|
+
await client.inboxes.update({ id: inbox.id, seenUpTo: new Date().toISOString() }) // PATCH /inbox
|
|
120
|
+
const owner = await client.inboxes.owner.related() // GET /inbox/owner
|
|
121
|
+
```
|
|
122
|
+
|
|
111
123
|
### Pivot data on a many-to-many edge
|
|
112
124
|
|
|
113
125
|
Each member of a `belongsToMany` to-many carries its per-edge pivot under `$pivot` (typed sugar
|
package/dist/ajv.d.cts
CHANGED
package/dist/ajv.d.mts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1683,16 +1683,17 @@ function actionsAccessor(ctx, type, scope, vars) {
|
|
|
1683
1683
|
return out;
|
|
1684
1684
|
}
|
|
1685
1685
|
/**
|
|
1686
|
-
* Build the relationship accessor for `client.<type>.id(id).<rel
|
|
1686
|
+
* Build the relationship accessor for `client.<type>.id(id).<rel>`, or a singleton's
|
|
1687
|
+
* `client.<type>.<rel>` with no `id` in `vars`: reads
|
|
1687
1688
|
* (`.get()` linkage / `.related()` collection) plus mutations — to-many `.add` (POST) /
|
|
1688
1689
|
* `.remove` (DELETE) / `.replace` (PATCH) and to-one `.set` (PATCH). Every mutation posts
|
|
1689
1690
|
* a `{ data: <linkage> }` body to `fetchRelationship` and materialises the response as
|
|
1690
1691
|
* linkage (or `undefined`/`void` for a `204`). The cardinality is read off the descriptor
|
|
1691
1692
|
* so the linkage is coerced correctly; the static types gate which verb is callable.
|
|
1692
1693
|
*/
|
|
1693
|
-
function relationshipAccessor(ctx, type,
|
|
1694
|
+
function relationshipAccessor(ctx, type, owner, rel) {
|
|
1694
1695
|
const vars = {
|
|
1695
|
-
|
|
1696
|
+
...owner,
|
|
1696
1697
|
rel
|
|
1697
1698
|
};
|
|
1698
1699
|
const relation = ctx.descriptor[type]?.relations[rel];
|
|
@@ -1738,39 +1739,72 @@ const HANDLE_RESERVED = /* @__PURE__ */ new Set([
|
|
|
1738
1739
|
"actions",
|
|
1739
1740
|
"then"
|
|
1740
1741
|
]);
|
|
1742
|
+
/**
|
|
1743
|
+
* Run a type's update. `vars` fill its path (`{ id }`, or nothing for a singleton) and `id` is
|
|
1744
|
+
* the one the body carries.
|
|
1745
|
+
*/
|
|
1746
|
+
function runUpdate(ctx, type, vars, id, patch, opts) {
|
|
1747
|
+
return runWrite(ctx, {
|
|
1748
|
+
type,
|
|
1749
|
+
operation: "update",
|
|
1750
|
+
vars,
|
|
1751
|
+
method: "PATCH",
|
|
1752
|
+
body: toDocument(ctx.descriptor, type, patch, { id }),
|
|
1753
|
+
query: writeQuery(opts),
|
|
1754
|
+
remap: (error) => withRemappedPaths(error, ctx.descriptor, type),
|
|
1755
|
+
accepted: ctx.descriptor[type]?.accepted?.update,
|
|
1756
|
+
wait: waitOptions(opts?.wait)
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Wrap a handle's verbs in a Proxy resolving each relation not shadowed by a reserved member to
|
|
1761
|
+
* its relationship accessor, addressed by `vars`.
|
|
1762
|
+
*/
|
|
1763
|
+
function withRelations(ctx, type, vars, base) {
|
|
1764
|
+
const relations = ctx.descriptor[type]?.relations ?? {};
|
|
1765
|
+
return new Proxy(base, { get(target, prop, receiver) {
|
|
1766
|
+
if (typeof prop === "string" && !HANDLE_RESERVED.has(prop) && prop in relations) return relationshipAccessor(ctx, type, vars, prop);
|
|
1767
|
+
return Reflect.get(target, prop, receiver);
|
|
1768
|
+
} });
|
|
1769
|
+
}
|
|
1741
1770
|
/** Build the id-scoped resource handle (a Proxy resolving relation accessors by name). */
|
|
1742
1771
|
function resourceHandle(ctx, type, id) {
|
|
1743
|
-
const
|
|
1744
|
-
|
|
1772
|
+
const vars = { id };
|
|
1773
|
+
return withRelations(ctx, type, vars, {
|
|
1745
1774
|
type,
|
|
1746
1775
|
id,
|
|
1747
|
-
get: (query) => run(ctx, type, "fetchOne",
|
|
1748
|
-
update: (patch, opts) =>
|
|
1749
|
-
type,
|
|
1750
|
-
operation: "update",
|
|
1751
|
-
vars: { id },
|
|
1752
|
-
method: "PATCH",
|
|
1753
|
-
body: toDocument(ctx.descriptor, type, patch, { id }),
|
|
1754
|
-
query: writeQuery(opts),
|
|
1755
|
-
remap: (error) => withRemappedPaths(error, ctx.descriptor, type),
|
|
1756
|
-
accepted: ctx.descriptor[type]?.accepted?.update,
|
|
1757
|
-
wait: waitOptions(opts?.wait)
|
|
1758
|
-
}),
|
|
1776
|
+
get: (query) => run(ctx, type, "fetchOne", vars, query),
|
|
1777
|
+
update: (patch, opts) => runUpdate(ctx, type, vars, id, patch, opts),
|
|
1759
1778
|
delete: () => runWrite(ctx, {
|
|
1760
1779
|
type,
|
|
1761
1780
|
operation: "delete",
|
|
1762
|
-
vars
|
|
1781
|
+
vars,
|
|
1763
1782
|
method: "DELETE",
|
|
1764
1783
|
body: void 0,
|
|
1765
1784
|
remap: (error) => withRemappedPaths(error, ctx.descriptor, type)
|
|
1766
1785
|
}),
|
|
1767
|
-
rel: (name) => relationshipAccessor(ctx, type,
|
|
1768
|
-
actions: actionsAccessor(ctx, type, "resource",
|
|
1769
|
-
};
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1786
|
+
rel: (name) => relationshipAccessor(ctx, type, vars, name),
|
|
1787
|
+
actions: actionsAccessor(ctx, type, "resource", vars)
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
/**
|
|
1791
|
+
* Build the accessor of a singleton type (`client.inboxes`): a handle on the caller's one
|
|
1792
|
+
* resource, whose paths carry no id. Its update takes the resource's `id` in the input, since
|
|
1793
|
+
* the server reads it from the body.
|
|
1794
|
+
*/
|
|
1795
|
+
function singletonAccessor(ctx, type) {
|
|
1796
|
+
const vars = {};
|
|
1797
|
+
return withRelations(ctx, type, vars, {
|
|
1798
|
+
type,
|
|
1799
|
+
get: (query) => run(ctx, type, "fetchOne", vars, query),
|
|
1800
|
+
update: (input, opts) => {
|
|
1801
|
+
const { id, ...patch } = input;
|
|
1802
|
+
if (typeof id !== "string" || id === "") return Promise.reject(/* @__PURE__ */ new Error(`Updating the "${type}" singleton needs its id in the input, such as the id of the resource its get() read.`));
|
|
1803
|
+
return runUpdate(ctx, type, vars, id, patch, opts);
|
|
1804
|
+
},
|
|
1805
|
+
rel: (name) => relationshipAccessor(ctx, type, vars, name),
|
|
1806
|
+
actions: actionsAccessor(ctx, type, "resource", vars)
|
|
1807
|
+
});
|
|
1774
1808
|
}
|
|
1775
1809
|
/** Build the collection-scoped accessor for one wire type (`client.albums`). */
|
|
1776
1810
|
function typeAccessor(ctx, type) {
|
|
@@ -1794,7 +1828,8 @@ function typeAccessor(ctx, type) {
|
|
|
1794
1828
|
}
|
|
1795
1829
|
/**
|
|
1796
1830
|
* Build a descriptor-driven read client. Generic at runtime (a Proxy over the descriptor),
|
|
1797
|
-
* not per-type codegen: `client.<type>` yields a {@link TypeAccessor},
|
|
1831
|
+
* not per-type codegen: `client.<type>` yields a {@link TypeAccessor}, or a
|
|
1832
|
+
* {@link SingletonAccessor} for a singleton type, `.id(id)` a handle,
|
|
1798
1833
|
* and a handle's relation accessors drive the relationship/related endpoints. Navigation
|
|
1799
1834
|
* (`$next()`/`$prev()`, related links) is wired through `materialise`'s `navigate` seam,
|
|
1800
1835
|
* which resolves the server's link against `baseUrl`, executes it and re-materialises.
|
|
@@ -1836,7 +1871,7 @@ function createClient(descriptor, options) {
|
|
|
1836
1871
|
if (typeof prop !== "string" || !(prop in descriptor)) return;
|
|
1837
1872
|
let accessor = accessors.get(prop);
|
|
1838
1873
|
if (accessor === void 0) {
|
|
1839
|
-
accessor = typeAccessor(ctx, prop);
|
|
1874
|
+
accessor = descriptor[prop]?.singleton === true ? singletonAccessor(ctx, prop) : typeAccessor(ctx, prop);
|
|
1840
1875
|
accessors.set(prop, accessor);
|
|
1841
1876
|
}
|
|
1842
1877
|
return accessor;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as IdentifierMember, $n as
|
|
1
|
+
import { $ as IdentifierMember, $n as ActionInput, $t as readActionLocation, A as AcceptedOf, An as materialise, Ar as StrategyDescriptor, At as ResourceCountToken, B as CountedRelationName, Bn as PageParams, Bt as TypedReadQuery, C as createClient, Cn as LinkObject, Cr as RelatedQueryOperation, Ct as RelationName, D as TransportResponse, Dn as RelationView, Dr as ResourceDescriptor, Dt as RelationSortQuery, E as TransportRequest, En as RelationArrayEnvelope, Er as ResourceCountOperation, Et as RelationReadQuery, F as BinaryResponseType, Fn as Page, Ft as SingletonUpdateInput, G as DefaultWriteAttributes, Gn as Accepted, Gt as WaitOptions, H as CreateMethod, Hn as ResolvedPaginator, Ht as TypedRelationReadQuery, I as Client, In as PageKeys, It as SortQuery, J as FieldSelectionMap, Jn as isAccepted, Jt as WithLinks, K as EdgeMembers, Kn as PollOptions, Kt as WaitValue, L as Collection, Ln as PageLinks, Lt as SortToken, M as ActionsAccessor, Mn as relatedPaginatorKind, Mt as ResourceObjectView, N as AtomicResultOf, Nn as CANONICAL_PAGE_KEYS, Nt as SingleReadQuery, O as fetchTransport, On as ResourceEnvelope, Or as ResourceExamples, Ot as RelationshipAccessor, P as BinaryBody, Pn as ExactPageParams, Pt as SingletonAccessor, Q as HydratedMember, Qn as ActionDescriptor, Qt as isActionLocation, R as CountAccessor, Rn as PageMeta, Rt as TypeAccessor, S as HeadersInit, Sn as Link, Sr as RelatedQueryDescriptor, St as RelationFilterQuery, T as TransportRawBody, Tn as NavigateOptions, Tr as RelationMutations, Tt as RelationPaginator, U as DefaultActionTypes, Un as TypedPage, Ut as UpdateInput, V as CreateInput, Vn as PageParamsOf, Vt as TypedRelatedReadQuery, W as DefaultAttributes, Wn as resolvePaginator, Wt as UpdateMethod, X as FilterKey, Xn as AcceptedDescriptor, Xt as WriteResult, Y as FieldsMap, Yn as parseRetryAfter, Yt as WriteOptions, Z as FilterQuery, Zn as AcceptedOperation, Zt as ActionLocation, _ as executeRaw, _n as mediaType, _r as PaginatorRole, _t as RelatedQueryEntry, a as Validator, an as AtomicRef, ar as AtomicDescriptor, at as LinkageRef, b as ClientOptions, bn as Edge, br as RawMediaKind, bt as RelatedReadRelatedQuery, c as resolveValidator, cn as AtomicUpdateHandle, cr as CountableDescriptor, ct as LooseRelatedQuery, d as ExecutedResponse, dn as ATOMIC_EXT, dr as InputMediaKind, dt as PivotInput, en as AtomicCreateHandle, er as ActionLocationDescriptor, et as IncludePath, f as JsonApiContext, fn as ATOMIC_MEDIA_TYPE, fr as MediaExamples, ft as ReadResult, g as execute, gn as ResourceIdentifier, gr as PaginatorKind, gt as RelatedQuery, h as ReadQuery, hn as MediaTypeParams, hr as PaginatorDescriptor, ht as RelatedIncludedType, i as ValidationOption, in as AtomicRecorder, ir as ApiExamples, it as IsSingleton, j as ActionCallOptions, jn as relatedPaginator, jr as isPolymorphic, jt as ResourceHandle, k as AcceptedJob, kn as ResourceLinks, kr as SortFamilyDescriptor, kt as ResourceAccessors, l as validateDocument, ln as AtomicUpdateInput, lr as FilterFamilyDescriptor, lt as LooseRelatedQueryEntry, m as RawResponseType, mn as LocalIdentifier, mr as OperationExamples, mt as RelatedIncludedResource, n as SchemaMap, nn as AtomicDeleteHandle, nr as ActionScope, nt as IncludedResource, o as WireResource, on as AtomicResult, or as Cardinality, ot as ListFilterMember, p as JsonApiRequest, pn as JSON_API_MEDIA_TYPE, pr as MenuDescriptor, pt as ReadableRelationName, q as ErrorCodeOf, qn as PollTimeoutError, qt as WaitedWriteResult, r as ValidationConfig, rn as AtomicHandle, rr as ApiDescriptor, rt as IncludedType, s as assertJsonApiDocument, sn as AtomicResults, sr as ClientIdPolicy, st as ListPageParams, t as ResolvedValidator, tn as AtomicCreateInput, tr as ActionOutput, tt as IncludedRelations, u as Document, un as runAtomic, ur as InputMedia, ut as MemberName, v as executeResponse, vn as ArrayEnvelope, vr as PaginatorStrategy, vt as RelatedQueryParam, w as JsonApiTransport, wn as MaterialiseContext, wr as RelationDescriptor, wt as RelationPageParams, x as HANDLE_RESERVED, xn as EdgeEnvelope, xr as RawOutputMedia, xt as RelationCollection, y as serializeQuery, yn as DocumentEnvelope, yr as PivotDescriptor, yt as RelatedQueryRelation, z as CountToken, zn as PageOf, zt as TypeName } from "./validate-9lr5GAdA.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors.d.ts
|
|
4
4
|
/**
|
|
@@ -253,5 +253,5 @@ declare function withRemappedRelationshipPaths(error: JsonApiError, rel: string,
|
|
|
253
253
|
*/
|
|
254
254
|
declare function withRemappedAtomicPaths(error: JsonApiError, descriptor: ApiDescriptor, typeForOp: (opIndex: number) => string | undefined): JsonApiError;
|
|
255
255
|
//#endregion
|
|
256
|
-
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, JSON_API_MEDIA_TYPE, JsonApiContext, JsonApiError, JsonApiErrorObject, JsonApiRequest, JsonApiTransport, Link, LinkObject, LinkageRef, ListPageParams, 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, 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, materialise, mediaType, parseRetryAfter, readActionLocation, relatedPaginator, relatedPaginatorKind, remapPointer, remapRelationshipPointer, resolvePaginator, resolveValidator, runAtomic, serializeQuery, toDocument, toRelationshipDocument, validateDocument, withRemappedAtomicPaths, withRemappedPaths, withRemappedRelationshipPaths };
|
|
256
|
+
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, 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, materialise, mediaType, parseRetryAfter, readActionLocation, relatedPaginator, relatedPaginatorKind, remapPointer, remapRelationshipPointer, resolvePaginator, resolveValidator, runAtomic, serializeQuery, toDocument, toRelationshipDocument, validateDocument, withRemappedAtomicPaths, withRemappedPaths, withRemappedRelationshipPaths };
|
|
257
257
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as IdentifierMember, $n as
|
|
1
|
+
import { $ as IdentifierMember, $n as ActionInput, $t as readActionLocation, A as AcceptedOf, An as materialise, Ar as StrategyDescriptor, At as ResourceCountToken, B as CountedRelationName, Bn as PageParams, Bt as TypedReadQuery, C as createClient, Cn as LinkObject, Cr as RelatedQueryOperation, Ct as RelationName, D as TransportResponse, Dn as RelationView, Dr as ResourceDescriptor, Dt as RelationSortQuery, E as TransportRequest, En as RelationArrayEnvelope, Er as ResourceCountOperation, Et as RelationReadQuery, F as BinaryResponseType, Fn as Page, Ft as SingletonUpdateInput, G as DefaultWriteAttributes, Gn as Accepted, Gt as WaitOptions, H as CreateMethod, Hn as ResolvedPaginator, Ht as TypedRelationReadQuery, I as Client, In as PageKeys, It as SortQuery, J as FieldSelectionMap, Jn as isAccepted, Jt as WithLinks, K as EdgeMembers, Kn as PollOptions, Kt as WaitValue, L as Collection, Ln as PageLinks, Lt as SortToken, M as ActionsAccessor, Mn as relatedPaginatorKind, Mt as ResourceObjectView, N as AtomicResultOf, Nn as CANONICAL_PAGE_KEYS, Nt as SingleReadQuery, O as fetchTransport, On as ResourceEnvelope, Or as ResourceExamples, Ot as RelationshipAccessor, P as BinaryBody, Pn as ExactPageParams, Pt as SingletonAccessor, Q as HydratedMember, Qn as ActionDescriptor, Qt as isActionLocation, R as CountAccessor, Rn as PageMeta, Rt as TypeAccessor, S as HeadersInit, Sn as Link, Sr as RelatedQueryDescriptor, St as RelationFilterQuery, T as TransportRawBody, Tn as NavigateOptions, Tr as RelationMutations, Tt as RelationPaginator, U as DefaultActionTypes, Un as TypedPage, Ut as UpdateInput, V as CreateInput, Vn as PageParamsOf, Vt as TypedRelatedReadQuery, W as DefaultAttributes, Wn as resolvePaginator, Wt as UpdateMethod, X as FilterKey, Xn as AcceptedDescriptor, Xt as WriteResult, Y as FieldsMap, Yn as parseRetryAfter, Yt as WriteOptions, Z as FilterQuery, Zn as AcceptedOperation, Zt as ActionLocation, _ as executeRaw, _n as mediaType, _r as PaginatorRole, _t as RelatedQueryEntry, a as Validator, an as AtomicRef, ar as AtomicDescriptor, at as LinkageRef, b as ClientOptions, bn as Edge, br as RawMediaKind, bt as RelatedReadRelatedQuery, c as resolveValidator, cn as AtomicUpdateHandle, cr as CountableDescriptor, ct as LooseRelatedQuery, d as ExecutedResponse, dn as ATOMIC_EXT, dr as InputMediaKind, dt as PivotInput, en as AtomicCreateHandle, er as ActionLocationDescriptor, et as IncludePath, f as JsonApiContext, fn as ATOMIC_MEDIA_TYPE, fr as MediaExamples, ft as ReadResult, g as execute, gn as ResourceIdentifier, gr as PaginatorKind, gt as RelatedQuery, h as ReadQuery, hn as MediaTypeParams, hr as PaginatorDescriptor, ht as RelatedIncludedType, i as ValidationOption, in as AtomicRecorder, ir as ApiExamples, it as IsSingleton, j as ActionCallOptions, jn as relatedPaginator, jr as isPolymorphic, jt as ResourceHandle, k as AcceptedJob, kn as ResourceLinks, kr as SortFamilyDescriptor, kt as ResourceAccessors, l as validateDocument, ln as AtomicUpdateInput, lr as FilterFamilyDescriptor, lt as LooseRelatedQueryEntry, m as RawResponseType, mn as LocalIdentifier, mr as OperationExamples, mt as RelatedIncludedResource, n as SchemaMap, nn as AtomicDeleteHandle, nr as ActionScope, nt as IncludedResource, o as WireResource, on as AtomicResult, or as Cardinality, ot as ListFilterMember, p as JsonApiRequest, pn as JSON_API_MEDIA_TYPE, pr as MenuDescriptor, pt as ReadableRelationName, q as ErrorCodeOf, qn as PollTimeoutError, qt as WaitedWriteResult, r as ValidationConfig, rn as AtomicHandle, rr as ApiDescriptor, rt as IncludedType, s as assertJsonApiDocument, sn as AtomicResults, sr as ClientIdPolicy, st as ListPageParams, t as ResolvedValidator, tn as AtomicCreateInput, tr as ActionOutput, tt as IncludedRelations, u as Document, un as runAtomic, ur as InputMedia, ut as MemberName, v as executeResponse, vn as ArrayEnvelope, vr as PaginatorStrategy, vt as RelatedQueryParam, w as JsonApiTransport, wn as MaterialiseContext, wr as RelationDescriptor, wt as RelationPageParams, x as HANDLE_RESERVED, xn as EdgeEnvelope, xr as RawOutputMedia, xt as RelationCollection, y as serializeQuery, yn as DocumentEnvelope, yr as PivotDescriptor, yt as RelatedQueryRelation, z as CountToken, zn as PageOf, zt as TypeName } from "./validate-9lr5GAdA.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/errors.d.ts
|
|
4
4
|
/**
|
|
@@ -253,5 +253,5 @@ declare function withRemappedRelationshipPaths(error: JsonApiError, rel: string,
|
|
|
253
253
|
*/
|
|
254
254
|
declare function withRemappedAtomicPaths(error: JsonApiError, descriptor: ApiDescriptor, typeForOp: (opIndex: number) => string | undefined): JsonApiError;
|
|
255
255
|
//#endregion
|
|
256
|
-
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, JSON_API_MEDIA_TYPE, JsonApiContext, JsonApiError, JsonApiErrorObject, JsonApiRequest, JsonApiTransport, Link, LinkObject, LinkageRef, ListPageParams, 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, 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, materialise, mediaType, parseRetryAfter, readActionLocation, relatedPaginator, relatedPaginatorKind, remapPointer, remapRelationshipPointer, resolvePaginator, resolveValidator, runAtomic, serializeQuery, toDocument, toRelationshipDocument, validateDocument, withRemappedAtomicPaths, withRemappedPaths, withRemappedRelationshipPaths };
|
|
256
|
+
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, 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, materialise, mediaType, parseRetryAfter, readActionLocation, relatedPaginator, relatedPaginatorKind, remapPointer, remapRelationshipPointer, resolvePaginator, resolveValidator, runAtomic, serializeQuery, toDocument, toRelationshipDocument, validateDocument, withRemappedAtomicPaths, withRemappedPaths, withRemappedRelationshipPaths };
|
|
257
257
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1682,16 +1682,17 @@ function actionsAccessor(ctx, type, scope, vars) {
|
|
|
1682
1682
|
return out;
|
|
1683
1683
|
}
|
|
1684
1684
|
/**
|
|
1685
|
-
* Build the relationship accessor for `client.<type>.id(id).<rel
|
|
1685
|
+
* Build the relationship accessor for `client.<type>.id(id).<rel>`, or a singleton's
|
|
1686
|
+
* `client.<type>.<rel>` with no `id` in `vars`: reads
|
|
1686
1687
|
* (`.get()` linkage / `.related()` collection) plus mutations — to-many `.add` (POST) /
|
|
1687
1688
|
* `.remove` (DELETE) / `.replace` (PATCH) and to-one `.set` (PATCH). Every mutation posts
|
|
1688
1689
|
* a `{ data: <linkage> }` body to `fetchRelationship` and materialises the response as
|
|
1689
1690
|
* linkage (or `undefined`/`void` for a `204`). The cardinality is read off the descriptor
|
|
1690
1691
|
* so the linkage is coerced correctly; the static types gate which verb is callable.
|
|
1691
1692
|
*/
|
|
1692
|
-
function relationshipAccessor(ctx, type,
|
|
1693
|
+
function relationshipAccessor(ctx, type, owner, rel) {
|
|
1693
1694
|
const vars = {
|
|
1694
|
-
|
|
1695
|
+
...owner,
|
|
1695
1696
|
rel
|
|
1696
1697
|
};
|
|
1697
1698
|
const relation = ctx.descriptor[type]?.relations[rel];
|
|
@@ -1737,39 +1738,72 @@ const HANDLE_RESERVED = /* @__PURE__ */ new Set([
|
|
|
1737
1738
|
"actions",
|
|
1738
1739
|
"then"
|
|
1739
1740
|
]);
|
|
1741
|
+
/**
|
|
1742
|
+
* Run a type's update. `vars` fill its path (`{ id }`, or nothing for a singleton) and `id` is
|
|
1743
|
+
* the one the body carries.
|
|
1744
|
+
*/
|
|
1745
|
+
function runUpdate(ctx, type, vars, id, patch, opts) {
|
|
1746
|
+
return runWrite(ctx, {
|
|
1747
|
+
type,
|
|
1748
|
+
operation: "update",
|
|
1749
|
+
vars,
|
|
1750
|
+
method: "PATCH",
|
|
1751
|
+
body: toDocument(ctx.descriptor, type, patch, { id }),
|
|
1752
|
+
query: writeQuery(opts),
|
|
1753
|
+
remap: (error) => withRemappedPaths(error, ctx.descriptor, type),
|
|
1754
|
+
accepted: ctx.descriptor[type]?.accepted?.update,
|
|
1755
|
+
wait: waitOptions(opts?.wait)
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Wrap a handle's verbs in a Proxy resolving each relation not shadowed by a reserved member to
|
|
1760
|
+
* its relationship accessor, addressed by `vars`.
|
|
1761
|
+
*/
|
|
1762
|
+
function withRelations(ctx, type, vars, base) {
|
|
1763
|
+
const relations = ctx.descriptor[type]?.relations ?? {};
|
|
1764
|
+
return new Proxy(base, { get(target, prop, receiver) {
|
|
1765
|
+
if (typeof prop === "string" && !HANDLE_RESERVED.has(prop) && prop in relations) return relationshipAccessor(ctx, type, vars, prop);
|
|
1766
|
+
return Reflect.get(target, prop, receiver);
|
|
1767
|
+
} });
|
|
1768
|
+
}
|
|
1740
1769
|
/** Build the id-scoped resource handle (a Proxy resolving relation accessors by name). */
|
|
1741
1770
|
function resourceHandle(ctx, type, id) {
|
|
1742
|
-
const
|
|
1743
|
-
|
|
1771
|
+
const vars = { id };
|
|
1772
|
+
return withRelations(ctx, type, vars, {
|
|
1744
1773
|
type,
|
|
1745
1774
|
id,
|
|
1746
|
-
get: (query) => run(ctx, type, "fetchOne",
|
|
1747
|
-
update: (patch, opts) =>
|
|
1748
|
-
type,
|
|
1749
|
-
operation: "update",
|
|
1750
|
-
vars: { id },
|
|
1751
|
-
method: "PATCH",
|
|
1752
|
-
body: toDocument(ctx.descriptor, type, patch, { id }),
|
|
1753
|
-
query: writeQuery(opts),
|
|
1754
|
-
remap: (error) => withRemappedPaths(error, ctx.descriptor, type),
|
|
1755
|
-
accepted: ctx.descriptor[type]?.accepted?.update,
|
|
1756
|
-
wait: waitOptions(opts?.wait)
|
|
1757
|
-
}),
|
|
1775
|
+
get: (query) => run(ctx, type, "fetchOne", vars, query),
|
|
1776
|
+
update: (patch, opts) => runUpdate(ctx, type, vars, id, patch, opts),
|
|
1758
1777
|
delete: () => runWrite(ctx, {
|
|
1759
1778
|
type,
|
|
1760
1779
|
operation: "delete",
|
|
1761
|
-
vars
|
|
1780
|
+
vars,
|
|
1762
1781
|
method: "DELETE",
|
|
1763
1782
|
body: void 0,
|
|
1764
1783
|
remap: (error) => withRemappedPaths(error, ctx.descriptor, type)
|
|
1765
1784
|
}),
|
|
1766
|
-
rel: (name) => relationshipAccessor(ctx, type,
|
|
1767
|
-
actions: actionsAccessor(ctx, type, "resource",
|
|
1768
|
-
};
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1785
|
+
rel: (name) => relationshipAccessor(ctx, type, vars, name),
|
|
1786
|
+
actions: actionsAccessor(ctx, type, "resource", vars)
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* Build the accessor of a singleton type (`client.inboxes`): a handle on the caller's one
|
|
1791
|
+
* resource, whose paths carry no id. Its update takes the resource's `id` in the input, since
|
|
1792
|
+
* the server reads it from the body.
|
|
1793
|
+
*/
|
|
1794
|
+
function singletonAccessor(ctx, type) {
|
|
1795
|
+
const vars = {};
|
|
1796
|
+
return withRelations(ctx, type, vars, {
|
|
1797
|
+
type,
|
|
1798
|
+
get: (query) => run(ctx, type, "fetchOne", vars, query),
|
|
1799
|
+
update: (input, opts) => {
|
|
1800
|
+
const { id, ...patch } = input;
|
|
1801
|
+
if (typeof id !== "string" || id === "") return Promise.reject(/* @__PURE__ */ new Error(`Updating the "${type}" singleton needs its id in the input, such as the id of the resource its get() read.`));
|
|
1802
|
+
return runUpdate(ctx, type, vars, id, patch, opts);
|
|
1803
|
+
},
|
|
1804
|
+
rel: (name) => relationshipAccessor(ctx, type, vars, name),
|
|
1805
|
+
actions: actionsAccessor(ctx, type, "resource", vars)
|
|
1806
|
+
});
|
|
1773
1807
|
}
|
|
1774
1808
|
/** Build the collection-scoped accessor for one wire type (`client.albums`). */
|
|
1775
1809
|
function typeAccessor(ctx, type) {
|
|
@@ -1793,7 +1827,8 @@ function typeAccessor(ctx, type) {
|
|
|
1793
1827
|
}
|
|
1794
1828
|
/**
|
|
1795
1829
|
* Build a descriptor-driven read client. Generic at runtime (a Proxy over the descriptor),
|
|
1796
|
-
* not per-type codegen: `client.<type>` yields a {@link TypeAccessor},
|
|
1830
|
+
* not per-type codegen: `client.<type>` yields a {@link TypeAccessor}, or a
|
|
1831
|
+
* {@link SingletonAccessor} for a singleton type, `.id(id)` a handle,
|
|
1797
1832
|
* and a handle's relation accessors drive the relationship/related endpoints. Navigation
|
|
1798
1833
|
* (`$next()`/`$prev()`, related links) is wired through `materialise`'s `navigate` seam,
|
|
1799
1834
|
* which resolves the server's link against `baseUrl`, executes it and re-materialises.
|
|
@@ -1835,7 +1870,7 @@ function createClient(descriptor, options) {
|
|
|
1835
1870
|
if (typeof prop !== "string" || !(prop in descriptor)) return;
|
|
1836
1871
|
let accessor = accessors.get(prop);
|
|
1837
1872
|
if (accessor === void 0) {
|
|
1838
|
-
accessor = typeAccessor(ctx, prop);
|
|
1873
|
+
accessor = descriptor[prop]?.singleton === true ? singletonAccessor(ctx, prop) : typeAccessor(ctx, prop);
|
|
1839
1874
|
accessors.set(prop, accessor);
|
|
1840
1875
|
}
|
|
1841
1876
|
return accessor;
|