Comparing version 1.3.1 to 1.4.0
# Changelog | ||
## 1.4.0 | ||
### Minor Changes | ||
- ad302ea: `apiDocumentation` property should return actual dereferenced representations (fixes #259) | ||
## 1.3.1 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "alcaeus", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"description": "Hydra Core hypermedia-aware client library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
/// <reference types="rdfjs__namespace" /> | ||
import type { DatasetCore, Term, Literal, BlankNode, NamedNode } from '@rdfjs/types'; | ||
import type { Constructor, RdfResource, ResourceIdentifier } from '@tpluscode/rdfine'; | ||
import type { Resource, SupportedProperty } from '@rdfine/hydra'; | ||
import type { ApiDocumentation, Resource, SupportedProperty } from '@rdfine/hydra'; | ||
import { GraphPointer } from 'clownface'; | ||
@@ -44,2 +44,3 @@ import type { HydraClient } from '../../alcaeus'; | ||
readonly operations: RuntimeOperation[]; | ||
readonly apiDocumentation: ApiDocumentation<DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>> | undefined; | ||
getLinks(includeMissing?: boolean): { | ||
@@ -54,3 +55,2 @@ resources: any[]; | ||
getCollections(filter?: MemberAssertionPattern | undefined): import("@rdfine/hydra").Collection<Resource<DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>>, DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>>[]; | ||
apiDocumentation: import("@rdfine/hydra").ApiDocumentation<DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>> | undefined; | ||
collection: import("@rdfine/hydra").Collection<Resource<DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>>, DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>>[]; | ||
@@ -60,5 +60,3 @@ first: Resource<DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>> | undefined; | ||
last: Resource<DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>> | undefined; | ||
next: Resource<DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>> | undefined; /** | ||
* Gets the operations which can be performed on this resource | ||
*/ | ||
next: Resource<DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>> | undefined; | ||
operation: import("@rdfine/hydra").Operation<DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>>[]; | ||
@@ -65,0 +63,0 @@ previous: Resource<DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>> | undefined; |
@@ -9,2 +9,3 @@ "use strict"; | ||
const term_map_1 = __importDefault(require("@rdf-esm/term-map")); | ||
const data_model_1 = require("@rdf-esm/data-model"); | ||
const rdf_literal_1 = __importDefault(require("rdf-literal")); | ||
@@ -65,2 +66,15 @@ const Operation_1 = require("../Operation"); | ||
} | ||
get apiDocumentation() { | ||
var _a; | ||
const client = alcaeus(); | ||
const id = this.pointer.out(rdf_ns_builders_1.hydra.apiDocumentation).value || ((_a = client.resources.get(this.pointer)) === null || _a === void 0 ? void 0 : _a.response.apiDocumentationLink); | ||
if (id) { | ||
const idNode = data_model_1.namedNode(id); | ||
const representation = client.apiDocumentations.find(apiDoc => { var _a; return (_a = apiDoc.root) === null || _a === void 0 ? void 0 : _a.equals(idNode); }); | ||
if (representation === null || representation === void 0 ? void 0 : representation.root) { | ||
return representation.root; | ||
} | ||
} | ||
return undefined; | ||
} | ||
getLinks(includeMissing = false) { | ||
@@ -67,0 +81,0 @@ return this.getProperties({ termTypes: ['NamedNode'] }) |
import type { DatasetCore, NamedNode, BaseQuad } from 'rdf-js'; | ||
import type { Resource } from '@rdfine/hydra'; | ||
import type { RdfResource } from '@tpluscode/rdfine'; | ||
import type { RdfResource, ResourceIdentifier } from '@tpluscode/rdfine'; | ||
import type { ResourceFactory } from '@tpluscode/rdfine/lib/ResourceFactory'; | ||
import type { RdfResourceCore } from '@tpluscode/rdfine/RdfResource'; | ||
import { GraphPointer } from 'clownface'; | ||
import type { DatasetIndexed } from 'rdf-dataset-indexed/dataset'; | ||
@@ -17,3 +18,3 @@ import type { HydraResponse } from './alcaeus'; | ||
factory: ResourceFactory<D, RdfResource<D>>; | ||
get<T extends RdfResourceCore<any> = Resource<D>>(uri: NamedNode): Required<HydraResponse<D, T>> | undefined; | ||
get<T extends RdfResourceCore<any> = Resource<D>>(idOrPointer: NamedNode | GraphPointer): Required<HydraResponse<D, T>> | undefined; | ||
set(uri: NamedNode, entry: ResourceStoreEntry<D>): Promise<void>; | ||
@@ -40,3 +41,3 @@ clone(): ResourceStore<D>; | ||
clone(): ResourceStore<D>; | ||
get<T extends RdfResourceCore<D>>(graph: NamedNode): Required<HydraResponse<D, T>> | undefined; | ||
get<T extends RdfResourceCore<D>>(idOrPointer: NamedNode | GraphPointer<ResourceIdentifier, D>): Required<HydraResponse<D, T>> | undefined; | ||
set(graph: NamedNode, { response, dataset, rootResource }: ResourceStoreEntry<D>): Promise<void>; | ||
@@ -43,0 +44,0 @@ } |
@@ -28,4 +28,13 @@ "use strict"; | ||
} | ||
get(graph) { | ||
const node = clownface_1.default({ dataset: this.dataset, graph }); | ||
get(idOrPointer) { | ||
let graph; | ||
let node; | ||
if ('termType' in idOrPointer) { | ||
graph = idOrPointer; | ||
node = clownface_1.default({ dataset: this.dataset, graph }); | ||
} | ||
else { | ||
graph = idOrPointer._context[0].graph; | ||
node = idOrPointer; | ||
} | ||
const response = this.responses.get(graph); | ||
@@ -32,0 +41,0 @@ if (!response) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
385359
4586