0.9.1 • Published 19 hours ago

@blackglory/store-js v0.9.1

Weekly downloads
346
License
MIT
Repository
github
Last release
19 hours ago

store-js

Install

npm install --save @blackglory/store-js
# or
yarn add @blackglory/store-js

API

StoreClient

new StoreClient({
  server: string
, token?: string
, basicAuth?: {
    username: string
  , password: string
  }
, keepalive?: boolean
, timeout?: number
})
interface IStoreClientRequestOptions {
  signal?: AbortSignal
  token?: string
  keepalive?: boolean
  timeout?: number | false
}

interface IStoreClientRequestOptionsWithRevision extends IStoreClientRequestOptions {
  revision?: string
}

interface IStoreClientRequestOptionsWithoutToken {
  signal?: AbortSignal
  keepalive?: boolean
  timeout?: number | false
}

set

StoreClient#set(
  namespace: string
, id: string
, payload: string
, options?: IStoreClientRequestOptionsWithRevision
): Promise<void>

setJSON

StoreClient#setJSON(
  namespace: string
, id: string
, payload: Json
, options?: IStoreClientRequestOptionsWithRevision
): Promise<void>

setCSV

StoreClient#setJSON<T extends object>(
  namespace: string
, id: string
, payload: T[]
, options?: IStoreClientRequestOptionsWithRevision
): Promise<void>

has

StoreClient#has(
  namespace: string
, id: string
, options?: IStoreClientRequestOptionsWithRevision
): Promise<boolean>

get

StoreClient#get(
  namespace: string
, id: string
, options?: IStoreClientRequestOptionsWithRevision
): Promise<{
  revision: string
  payload: string
} | undefined>

getJSON

StoreClient#getJSON(
  namespace: string
, id: string
, options?: IStoreClientRequestOptionsWithRevision
): Promise<{
  revision: string
  payload: Json
} | undefined>

getCSV

StoreClient#getCSV<T extends object>(
  namespace: string
, id: string
, options?: IStoreClientRequestOptionsWithRevision
): Promise<{
  revision: string
  payload: T[]
} | undefined>

del

StoreClient#del(
  namespace: string
, id: string
, options?: IStoreClientRequestOptionsWithRevision
): Promise<void>

clear

StoreClient#clear(
  namespace: string
, options?: IStoreClientRequestOptions
): Promise<void>

getAllItemIds

StoreClient#getAllItemIds(
  namespace: string
, options?: IStoreClientRequestOptions
): Promise<bigint[]>

getAllNamespaces

StoreClient#getAllNamespaces(
  options?: IStoreClientRequestOptionsWithoutToken
): Promise<string[]>

stats

StoreClient#stats(
  namespace: string
, options?: IStoreClientRequestOptionsWithoutToken
): Promise<<{
  namespace: string
  items: number
}>

StoreManager

new StoreManager({
  server: string
, adminPassword: string
, keepalive?: boolean
, timeout?: number
})
interface IStoreManagerRequestOptions {
  signal?: AbortSignal
  keepalive?: boolean
  timeout?: number | false
}

JsonSchema

getNamespaces
StoreManager#JsonSchema.getNamespaces(
  options?: IStoreManagerRequestOptions
): Promise<string[]>
get
StoreManager#JsonSchema.get(namespace: string, options?: IStoreManagerRequestOptions): Promise<Json>
set
StoreManager#JsonSchema.set(
  namespace: string
, schema: Json
, options?: IStoreManagerRequestOptions
): Promise<void>
remove
StoreManager#JsonSchema.remove(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<void>

RevisionPolicy

getNamespaces
StoreManager#RevisionPolicy.getNamespaces(
  options?: IStoreManagerRequestOptions
): Promise<string[]>
get
StoreManager#RevisionPolicy.get(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<{
  updateRevisionRequired: boolean | null
  deleteRevisionRequired: boolean | null
}>
setUpdateRevisionRequired
StoreManager#RevisionPolicy.setUpdateRevisionRequired(
  namespace: string
, val: boolean
, options?: IStoreManagerRequestOptions
): Promise<void>
removeUpdateRevisionRequired
StoreManager#RevisionPolicy.removeUpdateRevisionRequired(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<void>
setDeleteRevisionRequired
StoreManager#RevisionPolicy.setDeleteRevisionRequired(
  namespace: string
, val: boolean
, options?: IStoreManagerRequestOptions
): Promise<void>
removeDeleteRevisionRequired
StoreManager#RevisionPolicy.removeDeleteRevisionRequired(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<void>

Blacklist

getNamespaces
StoreManager#Blacklist.getNamespaces(
  options?: IStoreManagerRequestOptions
): Promise<string[]>
add
StoreManager#Blacklist.add(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<void>
remove
StoreManager#Blacklist.remove(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<void>

Whitelist

getNamespaces
StoreManager#Whitelist.getNamespaces(
  options?: IStoreManagerRequestOptions
): Promise<string[]>
add
StoreManager#Whitelist.add(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<void>
remove
StoreManager#Whitelist.remove(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<void>

TokenPolicy

getNamespaces
StoreManager#TokenPolicy.getNamespaces(
  options?: IStoreManagerRequestOptions
): Promise<string[]>
get
StoreManager#TokenPolicy.get(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<{
  writeTokenRequired: boolean | null
  readTokenRequired: boolean | null
  deleteTokenRequired: boolean | null
}>
setWriteTokenRequired
StoreManager#TokenPolicy.setWriteTokenRequired(
  namespace: string
, val: boolean
, options?: IStoreManagerRequestOptions
): Promise<void>
removeWriteTokenRequired
StoreManager#TokenPolicy.removeWriteTokenRequired(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<void>
setReadTokenRequired
StoreManager#TokenPolicy.setReadTokenRequired(
  namespace: string
, val: boolean
, options?: IStoreManagerRequestOptions
): Promise<void>
removeReadTokenRequired
StoreManager#TokenPolicy.removeReadTokenRequired(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<void>
setDeleteTokenRequired
StoreManager#TokenPolicy.setDeleteTokenRequired(
  namespace: string
, val: boolean
, options?: IStoreManagerRequestOptions
): Promise<void>
removeDeleteTokenRequired
StoreManager#TokenPolicy.removeDeleteTokenRequired(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<void>

Token

getNamespaces
StoreManager#Token.getNamespaces(options?: IStoreManagerRequestOptions): Promise<string[]>
getTokens
StoreManager#Token.getTokens(
  namespace: string
, options?: IStoreManagerRequestOptions
): Promise<Array<{
  token: string
  write: boolean
  read: boolean
  delete: boolean
}>>
addWriteToken
StoreManager#Token.addWriteToken(
  namespace: string
, token: string
, options?: IStoreManagerRequestOptions
): Promise<void>
removeWriteToken
StoreManager#Token.removeWriteToken(
  namespace: string
, token: string
, options?: IStoreManagerRequestOptions
): Promise<void>
addReadToken
StoreManager#Token.addReadToken(
  namespace: string
, token: string
, options?: IStoreManagerRequestOptions
): Promise<void>
removeReadToken
StoreManager#Token.removeReadToken(
  namespace: string
, token: string
, options?: IStoreManagerRequestOptions
): Promise<void>
addDeleteToken
StoreManager#Token.addDeleteToken(
  namespace: string
, token: string
, options?: IStoreManagerRequestOptions
): Promise<void>
removeDeleteToken
StoreManager#Token.removeDeleteToken(
  namespace: string
, token: string
, options?: IStoreManagerRequestOptions
): Promise<void>
0.9.1

19 hours ago

0.9.0

2 months ago

0.8.3

2 months ago

0.8.1

5 months ago

0.8.0

5 months ago

0.8.2

5 months ago

0.7.4

6 months ago

0.7.3

6 months ago

0.7.2

6 months ago

0.7.1

6 months ago

0.7.0

6 months ago

0.6.9

6 months ago

0.6.8

6 months ago

0.6.7

7 months ago

0.6.6

7 months ago

0.6.5

7 months ago

0.6.4

7 months ago

0.6.3

7 months ago

0.6.2

7 months ago

0.6.1

7 months ago

0.6.0

8 months ago

0.5.4

8 months ago

0.5.3

8 months ago

0.5.2

8 months ago

0.5.1

8 months ago

0.4.11

8 months ago

0.5.0

8 months ago

0.4.10

8 months ago

0.4.9

8 months ago

0.4.8

8 months ago

0.4.7

8 months ago

0.4.6

8 months ago

0.4.5

9 months ago

0.4.4

9 months ago

0.4.3

9 months ago

0.4.2

9 months ago

0.4.1

9 months ago

0.4.0

9 months ago

0.3.7

9 months ago

0.3.6

9 months ago

0.3.5

9 months ago

0.3.4

9 months ago

0.3.3

9 months ago

0.3.2

9 months ago

0.3.1

9 months ago

0.3.0

9 months ago

0.2.2

9 months ago

0.2.1

9 months ago

0.2.0

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago