Socket
Socket
Sign inDemoInstall

ozone-typescript-client

Package Overview
Dependencies
25
Maintainers
8
Versions
149
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.3 to 6.0.4

4

dist/src/ozoneClient/clientState.d.ts

@@ -1,4 +0,2 @@

import { fsm } from 'typescript-state-machine';
import State = fsm.State;
import Transitions = fsm.Transitions;
import { State, Transitions } from 'typescript-state-machine';
export declare class ClientState extends State {

@@ -5,0 +3,0 @@ }

@@ -1,3 +0,2 @@

import { fsm } from 'typescript-state-machine';
var State = fsm.State;
import { State } from 'typescript-state-machine';
export class ClientState extends State {

@@ -4,0 +3,0 @@ }

@@ -1,4 +0,2 @@

import { fsm } from 'typescript-state-machine';
import StateMachine = fsm.StateMachine;
import ListenerRegistration = fsm.ListenerRegistration;
import { StateMachine, ListenerRegistration } from 'typescript-state-machine';
import { httpclient } from 'typescript-http-client';

@@ -5,0 +3,0 @@ import Response = httpclient.Response;

@@ -1,3 +0,2 @@

import { fsm } from 'typescript-state-machine';
import ListenerRegistration = fsm.ListenerRegistration;
import { StateMachineImpl, ListenerRegistration } from 'typescript-state-machine';
import { httpclient } from 'typescript-http-client';

@@ -15,3 +14,2 @@ import Response = httpclient.Response;

import { OzoneClient, OzoneCredentials, AuthInfo, ClientConfiguration } from './ozoneClient';
import StateMachineImpl = fsm.StateMachineImpl;
import Filter = httpclient.Filter;

@@ -18,0 +16,0 @@ import { TaskClient } from '../taskClient/taskClient';

@@ -19,5 +19,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
import { fsm } from 'typescript-state-machine';
import { AssumeStateIsNot, AssumeStateIs, StateMachineImpl } from 'typescript-state-machine';
import { httpclient } from 'typescript-http-client';
import SockJS from 'sockjs-client';
var Response = httpclient.Response;
var Request = httpclient.Request;

@@ -31,5 +32,2 @@ import { states, validTransitions } from './clientState';

import { Cache } from '../cache/cache';
var AssumeStateIsNot = fsm.AssumeStateIsNot;
var AssumeStateIs = fsm.AssumeStateIs;
var StateMachineImpl = fsm.StateMachineImpl;
var newHttpClient = httpclient.newHttpClient;

@@ -206,2 +204,3 @@ var FilterCollection = httpclient.FilterCollection;

login() {
var _a, _b, _c, _d, _e;
return __awaiter(this, void 0, void 0, function* () {

@@ -212,6 +211,6 @@ // Destroy any existing WS

this._authInfo = undefined;
this.log.debug('Authenticating');
this.log.debug(`this.config.ozoneURL ${this.config.ozoneURL}`);
(_a = this.log) === null || _a === void 0 ? void 0 : _a.debug('Authenticating');
(_b = this.log) === null || _b === void 0 ? void 0 : _b.debug(`this.config.ozoneURL ${this.config.ozoneURL}`);
this._authInfo = yield this.config.ozoneCredentials.authenticate(this.config.ozoneURL);
this.log.debug(`Authenticated with authInfo : ${JSON.stringify(this._authInfo)}`);
(_c = this.log) === null || _c === void 0 ? void 0 : _c.debug(`Authenticated with authInfo : ${JSON.stringify(this._authInfo)}`);
this._lastFailedLogin = undefined;

@@ -222,11 +221,15 @@ this._lastSessionCheck = Date.now();

catch (e) {
// TODO AB What if e is not a Response?
const response = e;
this.log.debug(`Authentication error : code ${response.status}`);
this._lastFailedLogin = e;
if (response.status >= 400 && response.status < 500) {
// Invalid credentials
this.setState(states.AUTHENTICATION_ERROR);
if (e instanceof Response) {
(_d = this.log) === null || _d === void 0 ? void 0 : _d.debug(`Authentication error : code ${e.status}`);
this._lastFailedLogin = e;
if (e.status >= 400 && e.status < 500) {
// Invalid credentials
this.setState(states.AUTHENTICATION_ERROR);
}
else {
this.setState(states.NETWORK_OR_SERVER_ERROR);
}
}
else {
(_e = this.log) === null || _e === void 0 ? void 0 : _e.warn('Authentication error', e);
this.setState(states.NETWORK_OR_SERVER_ERROR);

@@ -239,4 +242,5 @@ }

logout() {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
this.log.debug('stopping');
(_a = this.log) === null || _a === void 0 ? void 0 : _a.debug('stopping');
// Destroy any existing WS

@@ -256,11 +260,15 @@ this.destroyWs();

catch (e) {
// TODO AB What if e is not a Response?
const response = e;
this.log.debug(`Authentication error : code ${response.status}`);
this._lastFailedLogin = e;
if (response.status >= 400 && response.status < 500) {
// Invalid credentials
this.setState(states.STOPPED);
if (e instanceof Response) {
(_b = this.log) === null || _b === void 0 ? void 0 : _b.debug(`Logout error : code ${e.status}`);
this._lastFailedLogin = e;
if (e.status >= 400 && e.status < 500) {
// Invalid credentials
this.setState(states.STOPPED);
}
else {
this.setState(states.NETWORK_OR_SERVER_ERROR);
}
}
else {
(_c = this.log) === null || _c === void 0 ? void 0 : _c.warn('Logout error', e);
this.setState(states.NETWORK_OR_SERVER_ERROR);

@@ -292,5 +300,6 @@ }

connect() {
var _a;
// Destroy any existing WS
this.destroyWs();
this.log.info(`Connecting to ${this._config.webSocketsURL}`);
(_a = this.log) === null || _a === void 0 ? void 0 : _a.info(`Connecting to ${this._config.webSocketsURL}`);
return new Promise((resolve, reject) => {

@@ -340,5 +349,6 @@ /* FIXME AB Something is wrong here. The promise resolve or reject method should always be called but it is not the case */

ws.onopen = () => {
var _a;
let mustResolve = this._state === states.WS_CONNECTING;
try {
this.log.info(`Connected to ${this._config.webSocketsURL}`);
(_a = this.log) === null || _a === void 0 ? void 0 : _a.info(`Connected to ${this._config.webSocketsURL}`);
this.setState(states.WS_CONNECTED);

@@ -403,2 +413,3 @@ }

this._reAuthTimeout = window.setTimeout(() => (() => __awaiter(this, void 0, void 0, function* () {
var _a;
try {

@@ -415,3 +426,3 @@ if (this.canGoToState(states.AUTHENTICATING)) {

catch (e) {
this.log.info('login failed : ' + e);
(_a = this.log) === null || _a === void 0 ? void 0 : _a.info('login failed : ' + e);
}

@@ -429,5 +440,6 @@ }))(), this.nextReAuthRetryInterval());

installWSPingKeepAlive() {
var _a;
if (this._wsKeepAliveTimer) {
// should not happen
this.log.warn('wsKeepAliveTimer defined when it should not be');
(_a = this.log) === null || _a === void 0 ? void 0 : _a.warn('wsKeepAliveTimer defined when it should not be');
clearTimeout(this._wsKeepAliveTimer);

@@ -447,2 +459,3 @@ }

wsKeepAlive() {
var _a;
if (!this._ws) {

@@ -455,3 +468,3 @@ return;

if (this._ws.readyState === this._ws.CONNECTING || this._ws.readyState === this._ws.OPEN) {
this.log.warn('Ping timeout, closing connection');
(_a = this.log) === null || _a === void 0 ? void 0 : _a.warn('Ping timeout, closing connection');
OzoneClientImpl.terminateWSConnectionForcefully(this._ws);

@@ -458,0 +471,0 @@ }

{
"name": "ozone-typescript-client",
"version": "6.0.3",
"version": "6.0.4",
"description": "",

@@ -33,3 +33,3 @@ "main": "dist/src/index.js",

"typescript-http-client": "0.10.1",
"typescript-state-machine": "0.9.5"
"typescript-state-machine": "0.9.6"
},

@@ -39,3 +39,3 @@ "devDependencies": {

},
"gitHead": "63cf07815ea2c032870e5c1498d06ebe7ff113ba"
"gitHead": "30ec557cc07557685a96df7a468a7c09c781972d"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc