NodeJS API for interacting with the FIN Fedora instance
npm install @ucd-lib/fin-node-apiObjectJSON_LD: application/ld+json
N_TRIPLES: application/n-triples
RDF_XML: application/rdf+xml
SPARQL_UPDATE: application/sparql-update
N3: text/n3
PLAIN: text/plain
TURTLE: text/turtle
Object.json: application/ld+json
.nt: application/n-triples
.xml: application/rdf+xml
.n3: text/n3
.txt: text/plain
.ttl: text/turtle
ObjectOptional Accept HTTP header values for GET request of Content-Type=application/ld+json
ObjectOptional Prefer HTTP header values for GET request
ObjectOptional Prefer HTTP header values for PUT request.
Allows replacing the properties of a container without having to provide all of the server-managed triples.
classset of functions for interacting with fin webac.
classset of functions for interacting with fin services.
Objectutil functions for turtle, json-ld and sparql transforms
Set the API config
To make authenticated requests you should supply either a username/refreshToken or
username/password combo. Then if a JWT doesn't exist or is expired, the request
function will fetch a new JWT before the request is made.
Objectreturn config object
BooleanGiven a HTTP response see if response is in 200 range
PromiseRetrieve the content of the resource
PromiseRetrieve HTTP headers of the resource
PromiseCreate new resources within a LDP container
PromiseCreate a resource with a specified path, or replace the triples associated
with a resource with the triples provided in the request body.
PromiseSparql base update
PromiseDelete a resource
PromiseCopy a resource (and its subtree) to a new location
PromiseMove a resource (and its subtree) to a new location
PromiseStart a new transaction, returns transation token.
PromiseCommit transation
PromiseRollback transation
PromiseGet a current version
PromisePromisePromisePromiseObjecthelper for parsing HTTP link header. many utils for this
do not assume multiple rel's of the same value which fedora returns.
Many classes return a promise with a object that looks like {response, body, authenticated}
where
- response: HTTP response object
- body: HTTP body contents
- authenticated: boolean flag if a JWT token was sent along with the request
ObjectObjectObjectObjectObjectclassclassObjectTo make authenticated requests you should supply either a username/refreshToken or
username/password combo. Then if a JWT doesn't exist or is expired, the request
function will fetch a new JWT before the request is made.
Kind: global function
| Param | Description |
| --- | --- |
| params | key/value pairs to set |
| params.host | FIN host ex. http://mydams.org |
| params.fcBasePath | Fedora base path (default: /fcrepo/rest) |
| params.jwt | JWT Token |
| params.refreshToken | refresh token to use if JWT expires |
| params.username | username to use with refreshToken or password if JWT expires |
| params.password | password to use if JWT expires |
| params.transactionToken | custom transaction token |
ObjectBooleanKind: global function
| Param | Type | Description |
| --- | --- | --- |
| response | Object | HTTP response object |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.path | String | resource path |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.path | String | resource path |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.path | String | resource path |
| options.headers | Object | resource headers, key/value pairs |
| options.file | Object | (optional) path to file to upload |
| options.content | Object | (optional) content to upload |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
| options.transactionToken | String | (optional) override config.transactionToken |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.path | String | resource path |
| options.headers | Object | resource headers, key/value pairs |
| options.file | Object | (optional) path to file to upload |
| options.content | Object | (optional) content to upload |
| options.partial | Object | (optional) only partial update happening, sets Prefer header to handling=lenient; received="minimal" |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
| options.transactionToken | String | (optional) override config.transactionToken |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.path | String | resource path |
| options.headers | Object | resource headers, key/value pairs |
| options.file | Object | (optional) path to file to upload |
| options.content | Object | (optional) content to upload |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
| options.transactionToken | String | (optional) override config.transactionToken |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.path | String | resource path |
| options.permanent | Boolean | remove /fcr:tombstone as well |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
| options.transactionToken | String | (optional) override config.transactionToken |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.path | String | resource path |
| options.destination | Boolean | path to copy resource to |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
| options.transactionToken | String | (optional) override config.transactionToken |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.path | String | resource path |
| options.destination | Boolean | path to move resource to |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
| options.transactionToken | String | (optional) override config.transactionToken |
PromiseKind: global function
Returns: Promise - {response, body, authenticated, transactionToken}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
| options.transactionToken | String | (optional) override config.transactionToken |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | arguments |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
| options.transactionToken | String | (optional) override config.transactionToken |
PromiseKind: global function
Returns: Promise - {response, body, authenticated}
| Param | Type | Description |
| --- | --- | --- |
| options | Object | |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
PromisePromise - {response, body, authenticated} | Param | Type | Description |
| --- | --- | --- |
| options | Object | |
| options.versionName | String | version to get |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
PromisePromise - {response, body, authenticated} | Param | Type | Description |
| --- | --- | --- |
| options | Object | |
| options.versionName | String | version to create |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
PromisePromise - {response, body, authenticated} | Param | Type | Description |
| --- | --- | --- |
| options | Object | |
| options.versionName | String | version name to revert to |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
PromisePromise - {response, body, authenticated} | Param | Type | Description |
| --- | --- | --- |
| options | Object | |
| options.versionName | String | version to delete |
| options.headers | Object | resource headers, key/value pairs |
| options.host | String | (optional) override config.host |
| options.fcBasePath | String | (optional) override config.fcBasePath |
ObjectKind: global function
| Param | Type | Description |
| --- | --- | --- |
| link | String | HTTP link header |