0.14.2 • Published 4 years ago

@ucd-lib/fin-node-api v0.14.2

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Classes

Members

Functions

FinApi

Kind: global class

new FinApi()

FIN API class

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

RDF_FORMATS : Object

JSON_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

Kind: global variable

FILE_EXTENSIONS : Object

.json: application/ld+json .nt: application/n-triples .xml: application/rdf+xml .n3: text/n3 .txt: text/plain .ttl: text/turtle

Kind: global variable

GET_JSON_ACCEPT : Object

Optional Accept HTTP header values for GET request of Content-Type=application/ld+json

Kind: global variable

GET_PREFER : Object

Optional Prefer HTTP header values for GET request

Kind: global variable

PUT_PEFER : Object

Optional Prefer HTTP header values for PUT request. Allows replacing the properties of a container without having to provide all of the server-managed triples.

Kind: global variable

acl : class

set of functions for interacting with fin webac.

Kind: global variable

service : class

set of functions for interacting with fin services.

Kind: global variable

transform : Object

util functions for turtle, json-ld and sparql transforms

Kind: global variable

setConfig(params)

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.

Kind: global function

ParamDescription
paramskey/value pairs to set
params.hostFIN host ex. http://mydams.org
params.fcBasePathFedora base path (default: /fcrepo/rest)
params.jwtJWT Token
params.refreshTokenrefresh token to use if JWT expires
params.usernameusername to use with refreshToken or password if JWT expires
params.passwordpassword to use if JWT expires
params.transactionTokencustom transaction token

getConfig() ⇒ Object

return config object

Kind: global function

isSuccess(response) ⇒ Boolean

Given a HTTP response see if response is in 200 range

Kind: global function

ParamTypeDescription
responseObjectHTTP response object

get(options) ⇒ Promise

Retrieve the content of the resource

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObjectarguments
options.pathStringresource path
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath

head(options) ⇒ Promise

Retrieve HTTP headers of the resource

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObjectarguments
options.pathStringresource path
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath

post(options) ⇒ Promise

Create new resources within a LDP container

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObjectarguments
options.pathStringresource path
options.headersObjectresource headers, key/value pairs
options.fileObject(optional) path to file to upload
options.contentObject(optional) content to upload
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath
options.transactionTokenString(optional) override config.transactionToken

put(options) ⇒ Promise

Create a resource with a specified path, or replace the triples associated with a resource with the triples provided in the request body.

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObjectarguments
options.pathStringresource path
options.headersObjectresource headers, key/value pairs
options.fileObject(optional) path to file to upload
options.contentObject(optional) content to upload
options.partialObject(optional) only partial update happening, sets Prefer header to handling=lenient; received="minimal"
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath
options.transactionTokenString(optional) override config.transactionToken

patch(options) ⇒ Promise

Sparql base update

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObjectarguments
options.pathStringresource path
options.headersObjectresource headers, key/value pairs
options.fileObject(optional) path to file to upload
options.contentObject(optional) content to upload
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath
options.transactionTokenString(optional) override config.transactionToken

delete(options) ⇒ Promise

Delete a resource

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObjectarguments
options.pathStringresource path
options.permanentBooleanremove /fcr:tombstone as well
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath
options.transactionTokenString(optional) override config.transactionToken

copy(options) ⇒ Promise

Copy a resource (and its subtree) to a new location

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObjectarguments
options.pathStringresource path
options.destinationBooleanpath to copy resource to
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath
options.transactionTokenString(optional) override config.transactionToken

move(options) ⇒ Promise

Move a resource (and its subtree) to a new location

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObjectarguments
options.pathStringresource path
options.destinationBooleanpath to move resource to
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath
options.transactionTokenString(optional) override config.transactionToken

startTransaction(options) ⇒ Promise

Start a new transaction, returns transation token.

Kind: global function
Returns: Promise - {response, body, authenticated, transactionToken}

ParamTypeDescription
optionsObjectarguments
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath

commitTransaction(options) ⇒ Promise

Commit transation

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObjectarguments
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath
options.transactionTokenString(optional) override config.transactionToken

rollbackTransaction(options) ⇒ Promise

Rollback transation

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObjectarguments
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath
options.transactionTokenString(optional) override config.transactionToken

getVersions(options) ⇒ Promise

Get a current version

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObject
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath

getVersion(options) ⇒ Promise

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObject
options.versionNameStringversion to get
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath

createVersion(options) ⇒ Promise

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObject
options.versionNameStringversion to create
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath

revertToVersion(options) ⇒ Promise

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObject
options.versionNameStringversion name to revert to
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath

deleteVersion(options) ⇒ Promise

Kind: global function
Returns: Promise - {response, body, authenticated}

ParamTypeDescription
optionsObject
options.versionNameStringversion to delete
options.headersObjectresource headers, key/value pairs
options.hostString(optional) override config.host
options.fcBasePathString(optional) override config.fcBasePath

parseLinkHeader(link) ⇒ Object

helper for parsing HTTP link header. many utils for this do not assume multiple rel's of the same value which fedora returns.

Kind: global function

ParamTypeDescription
linkStringHTTP link header
0.14.2

4 years ago

0.14.1

4 years ago

0.14.0

4 years ago

0.13.0

5 years ago

0.12.2

5 years ago

0.12.1

5 years ago

0.12.0

5 years ago

0.11.11

6 years ago

0.11.10

6 years ago

0.11.9

6 years ago

0.11.8

6 years ago

0.11.7

6 years ago

0.11.6

6 years ago

0.11.5

6 years ago

0.11.4

6 years ago

0.11.3

6 years ago

0.11.2

6 years ago

0.11.1

6 years ago

0.11.0

6 years ago

0.10.15

6 years ago

0.10.14

6 years ago

0.10.13

6 years ago

0.10.12

6 years ago

0.10.11

6 years ago

0.10.10

6 years ago

0.10.9

6 years ago

0.10.8

6 years ago

0.10.7

6 years ago

0.10.6

6 years ago

0.10.5

6 years ago

0.10.4

6 years ago

0.10.3

6 years ago

0.10.2

6 years ago

0.10.1

6 years ago

0.10.0

6 years ago

0.9.9

6 years ago

0.9.8

6 years ago

0.9.7

7 years ago

0.9.6

7 years ago

0.9.5

7 years ago

0.9.4

7 years ago

0.9.3

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.4

7 years ago

0.8.3

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.7

7 years ago

0.6.6

7 years ago

0.6.5

7 years ago

0.6.4

7 years ago

0.6.3

7 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.14

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.2.11

7 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.6

7 years ago

0.0.5

8 years ago