Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ozone-typescript-client

Package Overview
Dependencies
Maintainers
6
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ozone-typescript-client

[![NPM version][npm-image]][npm-url] # ozone-typescript-client

  • 5.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
763
decreased by-42.37%
Maintainers
6
Weekly downloads
 
Created
Source

NPM version

ozone-typescript-client

ozone-typescript-client is a typescript module that manage connection and communication to ozone.

Interface

export interface OzoneClient extends StateMachine<ClientState> {

		/* Get the client config */
		readonly config: ClientConfiguration

		/* Get the current Authentication if available */
		readonly authInfo?: AuthInfo

		/* Get the last failed login call if any */
		readonly lastFailedLogin?: Response<AuthInfo>

		/*
			Convenience props for getting the status of the client.
		*/
		readonly isAuthenticated: boolean
		readonly isConnected: boolean

		/*
			Start the client. To be called once
		*/
		start(): Promise<void>

		/*
			The array of filters to apply to all HTTP calls
			BEFORE this OzoneClient's own internal filters.
			This array can be modified at any time to add/remove filters
		 */
		readonly preFilters: InstalledFilter[]

		/*
			The array of filters to apply to all HTTP calls
			AFTER this OzoneClient's own internal filters.
			This array can be modified at any time to add/remove filters
		 */
		readonly postFilters: InstalledFilter[]

		/*
			Update the WS URL.
			The client will attempt to connect automatically to the new URL.
		*/
		updateWSURL(url: string): void

		/*
			Update the Ozone credentials.
			The client will attempt to login automatically.
		*/
		updateCredentials(ozoneCredentials: OzoneCredentials): void

		/*
			Stop the client. To be called once
		*/
		stop(): Promise<void>

		/*
			Perform a low-level call
			All calls towards Ozone or other Microservices secured by Ozone should use those calls
		*/
		callForResponse<T>(request: Request): Promise<Response<T>>

		call<T>(request: Request): Promise<T>

		/*
			Register a message listener.

			@param messageType The type of message to register for
			@param callBack The callBack that will be called
		*/
		onMessage<M extends Message>(messageType: string, callBack: (message: M) => void): ListenerRegistration

		onAnyMessage(callBack: (message: Message) => void): ListenerRegistration

		/*
			Send a message
		*/
		send(message: Message): void

		// BEGIN HIGH LEVEL CALLS

		/*
			Get a client for working with items of the given type
		*/
		itemClient<T extends Item>(typeIdentifier: string): ItemClient<T>

		/*
			Insert the current Ozone session ID in the given URL ("/dsid=...).
			This call
			Throws an error if there is no session available.
			The given string may or may not contain the host part.
			Example input strings :
			"/rest/v3/blob"
			"https://taktik.io/rest/v2/media/view/org.taktik.filetype.original/123"
		*/
		insertSessionIdInURL(url: string): string
	}

Usage

import { OzoneClient } from 'ozone-typescript-client'
import UserCredentials = OzoneClient.UserCredentials
import OzoneCredentials = OzoneClient.OzoneCredentials
import ClientConfiguration = OzoneClient.ClientConfiguration
import newOzoneClient = OzoneClient.newOzoneClient

let client: OzoneClient.OzoneClient
async function init() {
const credentials = new UserCredentials('ozoneUser', 'ozonePassword')
		const config: ClientConfiguration = {
			ozoneURL: `http://my.ozone.domain/ozone`,
			ozoneCredentials: credentials
		}
		client = newOzoneClient(config)
		await client.start()
}

Install

$ npm install --save ozone-typescript-client

FAQs

Package last updated on 26 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc