0.4.4 • Published 9 days ago

@blackglory/pubsub-js v0.4.4

Weekly downloads
146
License
MIT
Repository
github
Last release
9 days ago

pubsub-js

Install

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

API

PubSubClient

new PubSubClient{
  server: string
, token?: string
, keepalive?: boolean
, heartbeat?: IHeartbeatOptions
, timeout?: number
})
interface IPubSubClientRequestOptions {
  signal?: AbortSignal
  token?: string
  keepalive?: boolean
  timeout?: number | false
}
interface IPubSubClientObserveOptions {
  token?: string
  heartbeat?: IHeartbeatOptions
}
interface IHeartbeatOptions {
  timeout: number
}

publish

PubSubClient#publish(
  namespace: string
, val: string
, options?: IPubSubClientRequestOptions
): Promise<void>

publishJSON

PubSubClient#publishJSON(
  namespace: string
, val: Json
, options?: IPubSubClientRequestOptions
): Promise<void>

subscribe

PubSubClient#subscribe(
  namespace: string
, options?: IPubSubClientObserveOptions
): Observable<string>

subscribeJSON

PubSubClient#subscribeJSON(
  namespace: string
, options?: IPubSubClientObserveOptions
): Observable<Json>

PubSubManager

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

JsonSchema

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

RevisionPolicy

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

Blacklist

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

Whitelist

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

TokenPolicy

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

Token

getNamespaces
PubSubManager#Token.getNamespaces(
  options?: IPubSubManagerRequestOptions
): Promise<string[]>
getTokens
PubSubManager#Token.getTokens(
  namespace: string
, options?: IPubSubManagerRequestOptions
): Promise<Array<{
  token: string
  write: boolean
  read: boolean
}>>
addWriteToken
PubSubManager#Token.addWriteToken(
  namespace: string
, token: string
, options?: IPubSubManagerRequestOptions
): Promise<void>
removeWriteToken
PubSubManager#Token.removeWriteToken(
  namespace: string
, token: string
, options?: IPubSubManagerRequestOptions
): Promise<void>
addReadToken
PubSubManager#Token.addReadToken(
  namespace: string
, token: string
, options?: IPubSubManagerRequestOptions
): Promise<void>
removeReadToken
PubSubManager#Token.removeReadToken(
  namespace: string
, token: string
, options?: IPubSubManagerRequestOptions
): Promise<void>
0.4.4

9 days ago

0.4.3

11 days ago

0.4.2

12 days ago

0.4.1

3 months ago

0.4.0

5 months ago

0.3.6

5 months ago

0.3.5

5 months ago

0.3.7

5 months ago

0.3.4

6 months ago

0.3.3

6 months ago

0.3.2

6 months ago

0.3.1

6 months ago

0.3.0

7 months ago

0.2.23

7 months ago

0.2.22

7 months ago

0.2.21

7 months ago

0.2.20

7 months ago

0.2.19

7 months ago

0.2.18

7 months ago

0.2.17

7 months ago

0.2.16

7 months ago

0.2.15

7 months ago

0.2.14

8 months ago

0.2.13

8 months ago

0.2.12

8 months ago

0.2.11

8 months ago

0.2.10

8 months ago

0.2.9

9 months ago

0.2.8

9 months ago

0.2.7

9 months ago

0.2.6

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.2.3

10 months ago

0.2.2

10 months ago

0.2.1

10 months ago

0.2.0

10 months ago

0.1.0

10 months ago