Parameters:
| Name |
Type |
Attributes |
Description |
options |
object
|
<optional>
|
Options for the SysMetaService
Properties
| Name |
Type |
Attributes |
Description |
baseUrl |
string
|
|
Base URL for the DataONE endpoint |
clientConfig |
DataONEHttpClient#DataONEHttpClientOptions
|
<optional>
|
DataONEHttpClient configuration |
storageConfig |
PersistentStorage#PersistentStorageOptions
|
<optional>
|
Storage configuration |
persistPrivate |
boolean
|
<optional>
|
Allow caching private datas |
defaultAuth |
boolean
|
<optional>
|
Default auth behavior |
getToken |
function
|
<optional>
|
Override token resolver function |
getUserName |
function
|
<optional>
|
Optional function to get the
current user name, used for caching keys. |
|
- Source:
Methods
clearCache() → {Promise.<void>}
Clear the cache for the current user scope.
- Inherited From:
- Source:
Returns:
Promise resolving when the cache is cleared.
-
Type
-
Promise.<void>
download(pid, optionsopt) → {Promise.<SysMeta>}
Fetch SysMeta for a PID. Returns the raw sysmeta response text.
Parameters:
| Name |
Type |
Attributes |
Description |
pid |
string
|
|
The PID of the object to fetch SysMeta for. |
options |
object
|
<optional>
|
Options passed to
DataONEService#download |
- Overrides:
- Source:
Returns:
The SysMeta object for the requested PID. Raw
XML can be found in the `fetchedXmlString` property.
-
Type
-
Promise.<SysMeta>
getCached(key) → {Promise.<*>}
Get a cached value scoped by the current user.
Parameters:
| Name |
Type |
Description |
key |
string
|
Cache key. |
- Inherited From:
- Source:
Returns:
Promise resolving to the cached value.
-
Type
-
Promise.<*>
Get a PersistentStorage instance automatically scoped by the logged in
user, using the configuration options provided to the constructor.
- Inherited From:
- Source:
Returns:
Storage instance.
-
Type
-
PersistentStorage
getToken() → {Promise.<string>}
Resolve an auth token from MetacatUI when available.
- Inherited From:
- Source:
Returns:
Promise resolving to an auth token.
-
Type
-
Promise.<string>
getUserName() → {Promise.<(string|null)>}
Resolve the current username from the MetacatUI app user model.
- Inherited From:
- Source:
Returns:
Promise resolving to the username, or
null if unavailable.
-
Type
-
Promise.<(string|null)>
invalidate(pid) → {Promise.<void>}
Remove a cached SysMeta record for a PID.
Parameters:
| Name |
Type |
Description |
pid |
string
|
PID to invalidate. |
- Source:
Returns:
Promise resolving when invalidation completes.
-
Type
-
Promise.<void>
isCached(key) → {Promise.<boolean>}
Check whether a value exists in the cache for the current user scope.
Parameters:
| Name |
Type |
Description |
key |
string
|
Cache key. |
- Inherited From:
- Source:
Returns:
Promise resolving to whether the value is
cached.
-
Type
-
Promise.<boolean>
removeCached(key) → {Promise.<void>}
Remove a cached value for the current user scope.
Parameters:
| Name |
Type |
Description |
key |
string
|
Cache key. |
- Inherited From:
- Source:
Returns:
Promise resolving when removal completes.
-
Type
-
Promise.<void>
Send a request via the DataONEHttpClient.
Parameters:
| Name |
Type |
Attributes |
Description |
options |
object
|
<optional>
|
Request options passed to
DataONEHttpClient#request, plus auth controls.
Properties
| Name |
Type |
Attributes |
Description |
path |
string
|
|
Path relative to baseUrl. |
auth |
boolean
|
<optional>
|
Whether to resolve a token automatically. |
|
- Inherited From:
- Source:
Returns:
Promise resolving to the
response.
-
Type
-
Promise.<DataONEHttpResponse>
resolveToken(authopt) → {Promise.<(string|null)>}
Determine the token to use, if any, for a request.
Parameters:
| Name |
Type |
Attributes |
Description |
auth |
boolean
|
<optional>
|
Whether to use authentication for this request.
If set to false, no token will be used. If true, getToken() will be
called. When undefined, defaultAuth is used. |
- Inherited From:
- Source:
Returns:
Promise resolving to the token, or null
if no auth.
-
Type
-
Promise.<(string|null)>
scopeKey() → {Promise.<string>}
If user is logged in, get a key based on their username; otherwise,
return a "public" scope key.
- Inherited From:
- Source:
Returns:
Promise resolving to the scope key.
-
Type
-
Promise.<string>
setCached(key, value, optionsopt) → {Promise.<*>}
Store a value in the cache for the current user scope.
Parameters:
| Name |
Type |
Attributes |
Description |
key |
string
|
|
Cache key. |
value |
*
|
|
Value to store. |
options |
object
|
<optional>
|
Cache scope options.
Properties
| Name |
Type |
Attributes |
Description |
ttlMs |
number
|
null
|
<optional>
|
Override cache TTL in ms. |
|
- Inherited From:
- Source:
Returns:
Promise resolving to the stored value.
-
Type
-
Promise.<*>
shouldUseCache() → {Promise.<boolean>}
Determine whether caching is allowed for the current user scope.
- Inherited From:
- Source:
Returns:
Promise resolving to whether caching is
allowed.
-
Type
-
Promise.<boolean>
upload(sysMetaXml, optionsopt) → {Promise.<DataONEHttpResponse>}
Upload SysMeta XML to the service.
Parameters:
| Name |
Type |
Attributes |
Description |
sysMetaXml |
string
|
|
SysMeta XML string. |
options |
object
|
<optional>
|
Options passed to DataONEService#upload. |
- Overrides:
- Source:
Returns:
Promise resolving to the upload response.
-
Type
-
Promise.<DataONEHttpResponse>