@elevated-libs/cuss2
Advanced tools
Comparing version 2.2.4 to 2.3.0
@@ -1,2 +0,2 @@ | ||
import { CUSSDataTypes, DeviceTypes, EnvironmentComponent, MediaTypes } from "@elevated-libs/cuss2-typescript-models"; | ||
import { CUSSDataTypes, DeviceTypes, EnvironmentComponent, MediaTypes } from "cuss2-typescript-models"; | ||
export { EnvironmentComponent, MediaTypes }; | ||
@@ -3,0 +3,0 @@ export declare class ComponentInterrogation { |
@@ -1,2 +0,2 @@ | ||
import { ComponentTypes, CUSSDataTypes, DeviceTypes, MediaTypes } from "@elevated-libs/cuss2-typescript-models"; | ||
import { ComponentTypes, CUSSDataTypes, DeviceTypes, MediaTypes } from "cuss2-typescript-models"; | ||
export { MediaTypes }; | ||
@@ -3,0 +3,0 @@ const dsTypesHas = (charac0, type) => { |
@@ -19,5 +19,6 @@ /** | ||
* @param {string} baseURL - url of the CUSS Platform | ||
* @param {string} tokenURL - The url of the CUSS Oauth Server | ||
* @param {string} deviceID - The GUID for the device connecting to the CUSS 2 platform | ||
* @param {string} client_id - The client_id of the CUSS 2 platform | ||
* @param {string} client_secret - The client_secret of the CUSS 2 platform | ||
* @param {string} tokenURL - The url of the CUSS Oauth Server | ||
* @returns {Promise<Connection>} - The connection object | ||
@@ -28,4 +29,4 @@ * @example | ||
*/ | ||
static connect(baseURL: string, client_id: string, client_secret: string, tokenURL: string): Promise<Connection>; | ||
constructor(baseURL: any, client_id: any, client_secret: any, options?: {}); | ||
static connect(baseURL: string, tokenURL: string, deviceID: string, client_id: string, client_secret: string): Promise<Connection>; | ||
constructor(baseURL: any, tokenURL: any, deviceID: any, client_id: any, client_secret: any); | ||
_auth: { | ||
@@ -42,2 +43,3 @@ url: any; | ||
access_token: string; | ||
deviceID: any; | ||
_connect(): Promise<any>; | ||
@@ -44,0 +46,0 @@ send(data: any): any; |
@@ -22,3 +22,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
export class Connection extends EventEmitter { | ||
constructor(baseURL, client_id, client_secret, options = {}) { | ||
constructor(baseURL, tokenURL, deviceID, client_id, client_secret) { | ||
super(); | ||
@@ -28,3 +28,4 @@ this.pingInterval = 0; | ||
this.access_token = ''; | ||
this.pingInterval = options.pingInterval || this.pingInterval; | ||
this.deviceID = deviceID; | ||
this.setMaxListeners(0); | ||
const endOfHostname = baseURL.indexOf('?'); | ||
@@ -38,7 +39,7 @@ if (endOfHostname > -1) { | ||
this._baseURL = baseURL; | ||
let tokenURL = options.tokenURL; | ||
if (!tokenURL) { | ||
tokenURL = baseURL + '/oauth/token'; | ||
let _tokenURL = tokenURL; | ||
if (!_tokenURL) { | ||
_tokenURL = baseURL + '/oauth/token'; | ||
} | ||
this._auth = { url: tokenURL, client_id, client_secret }; | ||
this._auth = { url: _tokenURL, client_id, client_secret }; | ||
let protocol = /^https/.test(baseURL) ? "wss" : "ws"; | ||
@@ -76,5 +77,6 @@ this._socketURL = protocol + baseURL.replace(/^https?/, '') + '/platform/subscribe'; | ||
* @param {string} baseURL - url of the CUSS Platform | ||
* @param {string} tokenURL - The url of the CUSS Oauth Server | ||
* @param {string} deviceID - The GUID for the device connecting to the CUSS 2 platform | ||
* @param {string} client_id - The client_id of the CUSS 2 platform | ||
* @param {string} client_secret - The client_secret of the CUSS 2 platform | ||
* @param {string} tokenURL - The url of the CUSS Oauth Server | ||
* @returns {Promise<Connection>} - The connection object | ||
@@ -85,5 +87,5 @@ * @example | ||
*/ | ||
static connect(baseURL, client_id, client_secret, tokenURL) { | ||
static connect(baseURL, tokenURL, deviceID, client_id, client_secret) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const connection = new Connection(baseURL, client_id, client_secret, tokenURL); | ||
const connection = new Connection(baseURL, tokenURL, deviceID, client_id, client_secret); | ||
let delay = .5; | ||
@@ -162,2 +164,5 @@ function go() { | ||
} | ||
if (data instanceof ApplicationData && !data.meta.deviceID) { | ||
data.meta.deviceID = this.deviceID; | ||
} | ||
data = JSON.stringify(data); | ||
@@ -169,2 +174,6 @@ return this._socket.send(data); | ||
applicationData.meta.oauthToken = this.access_token; | ||
if ((applicationData.meta.deviceID == null || applicationData.meta.deviceID == "00000000-0000-0000-0000-000000000000") | ||
&& this.deviceID != null) { | ||
applicationData.meta.deviceID = this.deviceID; | ||
} | ||
const promise = this.waitFor(reqId); | ||
@@ -171,0 +180,0 @@ this._socket.send(JSON.stringify(applicationData)); |
import { BehaviorSubject, Subject } from "rxjs"; | ||
import { Connection } from "./connection.js"; | ||
import { StateChange } from "./models/stateChange.js"; | ||
import { ApplicationStateCodes } from '@elevated-libs/cuss2-typescript-models'; | ||
import { ApplicationStateCodes } from 'cuss2-typescript-models'; | ||
import { Announcement, BarcodeReader, Component, DocumentReader, Keypad, CardReader, BagTagPrinter, BoardingPassPrinter, Illumination, Headset, FaceReader, Scale, Camera } from "./models/component.js"; | ||
import { ApplicationActivation, ComponentList, DataRecordList, EnvironmentLevel, PlatformData, ApplicationStateCodes as AppState, ApplicationStateChangeReasonCodes as ChangeReason } from "@elevated-libs/cuss2-typescript-models"; | ||
import { ApplicationActivation, ComponentList, DataRecordList, EnvironmentLevel, PlatformData, ApplicationStateCodes as AppState, ApplicationStateChangeReasonCodes as ChangeReason } from "cuss2-typescript-models"; | ||
export { ApplicationStateCodes, DataRecordList }; | ||
@@ -109,12 +109,13 @@ /** | ||
* @method connect - Connect to the cuss platform. | ||
* @param {string} url - The url of the CUSS 2 platform | ||
* @param {string} wss - The WebSocket URL for CUSS 2 platform | ||
* @param {string} oauth - The URL for the Oauth2 server | ||
* @param {string} deviceID - The GUID for the device connecting to the CUSS 2 platform | ||
* @param {string} client_id - The client_id of the CUSS 2 platform | ||
* @param {string} client_secret - The client_secret of the CUSS 2 platform | ||
* @param {Object} [options={}] - An object of options passed in for the connection | ||
* @returns {Promise<Cuss2>} A promise that resolves to a Cuss2 object | ||
* @example | ||
* const connect = await Cuss2.connect('url', 'client_id', 'client_secret', "options"); | ||
* const connect = await Cuss2.connect('url', 'oauth', '00000000-0000-0000-0000-000000000000', 'client_id', 'client_secret'); | ||
* | ||
*/ | ||
static connect(url: string, client_id: string, client_secret: string, options?: any): Promise<Cuss2>; | ||
static connect(wss: string, oauth: string, deviceID: string, client_id: string, client_secret: string): Promise<Cuss2>; | ||
static _get(cuss2: Cuss2, parts: String[]): any; | ||
@@ -368,4 +369,4 @@ static log: (level: string, action: string, data?: any) => void; | ||
export { Connection } from "./connection.js"; | ||
export * from "@elevated-libs/cuss2-typescript-models"; | ||
export * from "cuss2-typescript-models"; | ||
export * from "./helper.js"; | ||
export * from "./componentInterrogation.js"; |
@@ -22,7 +22,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { ComponentInterrogation } from "./componentInterrogation.js"; | ||
import { ApplicationActivationExecutionModeEnum, ApplicationStateCodes } from '@elevated-libs/cuss2-typescript-models'; | ||
import { ApplicationActivationExecutionModeEnum, ApplicationStateCodes } from 'cuss2-typescript-models'; | ||
import { Announcement, BarcodeReader, Component, Dispenser, DocumentReader, Feeder, Keypad, CardReader, BagTagPrinter, BoardingPassPrinter, Illumination, Headset, FaceReader, Scale, Camera } from "./models/component.js"; | ||
import { | ||
// ApplicationState, | ||
CUSSDataTypes, PlatformDirectives, ApplicationStateCodes as AppState, ApplicationStateChangeReasonCodes as ChangeReason } from "@elevated-libs/cuss2-typescript-models"; | ||
CUSSDataTypes, PlatformDirectives, ApplicationStateCodes as AppState, ApplicationStateChangeReasonCodes as ChangeReason } from "cuss2-typescript-models"; | ||
export { ApplicationStateCodes }; | ||
@@ -431,12 +431,13 @@ const ExecutionModeEnum = ApplicationActivationExecutionModeEnum; | ||
* @method connect - Connect to the cuss platform. | ||
* @param {string} url - The url of the CUSS 2 platform | ||
* @param {string} wss - The WebSocket URL for CUSS 2 platform | ||
* @param {string} oauth - The URL for the Oauth2 server | ||
* @param {string} deviceID - The GUID for the device connecting to the CUSS 2 platform | ||
* @param {string} client_id - The client_id of the CUSS 2 platform | ||
* @param {string} client_secret - The client_secret of the CUSS 2 platform | ||
* @param {Object} [options={}] - An object of options passed in for the connection | ||
* @returns {Promise<Cuss2>} A promise that resolves to a Cuss2 object | ||
* @example | ||
* const connect = await Cuss2.connect('url', 'client_id', 'client_secret', "options"); | ||
* const connect = await Cuss2.connect('url', 'oauth', '00000000-0000-0000-0000-000000000000', 'client_id', 'client_secret'); | ||
* | ||
*/ | ||
static connect(url, client_id, client_secret, options = {}) { | ||
static connect(wss, oauth = null, deviceID = '00000000-0000-0000-0000-000000000000', client_id, client_secret) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -449,3 +450,3 @@ document.body.setAttribute('elevated-cuss2', '1'); | ||
logger.subscribe(broadcast); | ||
const connection = yield Connection.connect(url, client_id, client_secret, options); | ||
const connection = yield Connection.connect(wss, oauth, deviceID, client_id, client_secret); | ||
const cuss2 = new Cuss2(connection); | ||
@@ -497,3 +498,7 @@ if (document.body.hasAttribute('cuss2-devtools')) { | ||
log("info", "Getting Environment Information"); | ||
yield this.api.getEnvironment(); | ||
let level = yield this.api.getEnvironment(); | ||
// hydrate device id if none provided | ||
if (this.connection.deviceID == '00000000-0000-0000-0000-000000000000' || this.connection.deviceID == null) { | ||
this.connection.deviceID = level.deviceID; | ||
} | ||
if (!this.state) { | ||
@@ -739,5 +744,5 @@ throw new Error('Platform in abnormal state.'); | ||
export { Connection } from "./connection.js"; | ||
export * from "@elevated-libs/cuss2-typescript-models"; | ||
export * from "cuss2-typescript-models"; | ||
export * from "./helper.js"; | ||
export * from "./componentInterrogation.js"; | ||
//# sourceMappingURL=cuss2.js.map |
import { Subject } from "rxjs"; | ||
import { ApplicationData, MessageCodes } from "@elevated-libs/cuss2-typescript-models"; | ||
import { ApplicationData, MessageCodes } from "cuss2-typescript-models"; | ||
export declare class LogMessage { | ||
@@ -4,0 +4,0 @@ action: string; |
import { Subject } from "rxjs"; | ||
import * as uuid from "uuid"; | ||
import { MessageCodes, PlatformDirectives } from "@elevated-libs/cuss2-typescript-models"; | ||
import { MessageCodes, PlatformDirectives } from "cuss2-typescript-models"; | ||
export class LogMessage { | ||
@@ -97,3 +97,3 @@ constructor(level, action, data) { | ||
// @ts-ignore | ||
const { componentID, token, dataObj } = options; | ||
const { componentID, token, deviceID = "00000000-0000-0000-0000-000000000000", dataObj } = options; | ||
const meta = {}; | ||
@@ -104,2 +104,3 @@ meta.requestID = uuid.v4(); | ||
meta.componentID = componentID; | ||
meta.deviceID = deviceID; | ||
const payload = { | ||
@@ -106,0 +107,0 @@ applicationState: null, |
@@ -1,2 +0,2 @@ | ||
export * from "@elevated-libs/cuss2-typescript-models"; | ||
export * from "cuss2-typescript-models"; | ||
export * from './cuss2.js'; | ||
@@ -3,0 +3,0 @@ export * from './models/component.js'; |
@@ -1,2 +0,2 @@ | ||
export * from "@elevated-libs/cuss2-typescript-models"; | ||
export * from "cuss2-typescript-models"; | ||
export * from './cuss2.js'; | ||
@@ -3,0 +3,0 @@ export * from './models/component.js'; |
import { BehaviorSubject, Subject } from "rxjs"; | ||
import { Cuss2 } from "../cuss2.js"; | ||
import { CUSSDataTypes, EnvironmentComponent, ComponentState, PlatformData, MessageCodes } from "@elevated-libs/cuss2-typescript-models"; | ||
import { CUSSDataTypes, EnvironmentComponent, ComponentState, PlatformData, MessageCodes } from "cuss2-typescript-models"; | ||
import { DeviceType } from './deviceType.js'; | ||
@@ -5,0 +5,0 @@ /** |
@@ -12,3 +12,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { helpers } from "../cuss2.js"; | ||
import { CUSSDataTypes, ComponentState, MessageCodes, PlatformDirectives } from "@elevated-libs/cuss2-typescript-models"; | ||
import { CUSSDataTypes, ComponentState, MessageCodes, PlatformDirectives } from "cuss2-typescript-models"; | ||
import { DeviceType } from './deviceType.js'; | ||
@@ -15,0 +15,0 @@ import { take, timeout } from "rxjs/operators"; |
@@ -1,2 +0,2 @@ | ||
import { ComponentState, PlatformData, UniqueID, MessageCodes } from "@elevated-libs/cuss2-typescript-models"; | ||
import { ComponentState, PlatformData, UniqueID, MessageCodes } from "cuss2-typescript-models"; | ||
export declare class PlatformResponseError extends Error { | ||
@@ -3,0 +3,0 @@ constructor(pd: PlatformData); |
@@ -1,2 +0,2 @@ | ||
import { MessageCodes } from "@elevated-libs/cuss2-typescript-models"; | ||
import { MessageCodes } from "cuss2-typescript-models"; | ||
export class PlatformResponseError extends Error { | ||
@@ -3,0 +3,0 @@ constructor(pd) { |
@@ -1,2 +0,2 @@ | ||
import { ApplicationStateCodes } from "@elevated-libs/cuss2-typescript-models"; | ||
import { ApplicationStateCodes } from "cuss2-typescript-models"; | ||
export declare class StateChange { | ||
@@ -3,0 +3,0 @@ previous: ApplicationStateCodes; |
{ | ||
"name": "@elevated-libs/cuss2", | ||
"version": "2.2.4", | ||
"version": "2.3.0", | ||
"description": "", | ||
@@ -17,4 +17,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@types/node": "^14.17.32", | ||
"@elevated-libs/cuss2-typescript-models": "1.0.2", | ||
"cuss2-typescript-models": "1.0.2", | ||
"events": "^3.3.0", | ||
@@ -25,2 +24,3 @@ "rxjs": "^7.5.2", | ||
"devDependencies": { | ||
"@types/node": "^17.0.21", | ||
"better-docs": "^2.7.1", | ||
@@ -27,0 +27,0 @@ "chai": "^4.3.4", |
@@ -1,2 +0,2 @@ | ||
# @elevated-libs/cuss2 | ||
# cuss2 | ||
@@ -36,3 +36,3 @@ ## About Elevated CUSS Library | ||
```sh | ||
npm install @elevated-libs/cuss2 | ||
npm install cuss2 | ||
``` | ||
@@ -43,6 +43,6 @@ | ||
```ts | ||
import { Cuss2 } from "@elevated-libs/cuss2"; | ||
import { Cuss2 } from "cuss2"; | ||
const serviceState: { cuss2: Cuss2 | any} = { ref: null }; | ||
const connect = async (cuss2URL: string, clientId: string, clientSecret: string): Promise<Cuss2 | null> => { | ||
const connect = async (cuss2URL: string, oauthURL, deviceID: string, clientId: string, clientSecret: string): Promise<Cuss2 | null> => { | ||
// Avoid multiple subscriptions | ||
@@ -52,3 +52,3 @@ if (serviceState.ref) { | ||
} | ||
const cuss2 = await Cuss2.connect(cuss2URL, clientId, clientSecret); | ||
const cuss2 = await Cuss2.connect(cuss2URL, oauthURL, deviceID, clientId, clientSecret); | ||
serviceState.cuss2 = cuss2; | ||
@@ -59,4 +59,4 @@ return ref; | ||
// Connect to cuss2 Platform | ||
const { clientId, clientSecret, platformURL } = platformConfig; | ||
connect(platformURL, clientId, clientSecret) | ||
const { clientId, clientSecret, platformURL, oauthURL, deviceID } = platformConfig; | ||
connect(platformURL, oauthURL, deviceID, clientId, clientSecret) | ||
.then(checkDevices) | ||
@@ -82,3 +82,3 @@ .catch(connectionFailure); | ||
// Instantiating a connection | ||
const cuss2 = await Cuss2.connect(cuss2URL, clientId, clientSecret); | ||
const cuss2 = await Cuss2.connect(cuss2URL, oauthURL, deviceID, clientId, clientSecret); | ||
@@ -121,3 +121,3 @@ // Moving to unavailable | ||
```ts | ||
const cuss2 = await Cuss2.connect(cuss2URL, clientId, clientSecret); | ||
const cuss2 = await Cuss2.connect(cuss2URL, oauthURL, deviceID, clientId, clientSecret); | ||
@@ -153,3 +153,3 @@ // query ATB | ||
```ts | ||
const cuss2 = await Cuss2.connect(cuss2URL, clientId, clientSecret); | ||
const cuss2 = await Cuss2.connect(cuss2URL, oauthURL, deviceID, clientId, clientSecret); | ||
@@ -198,3 +198,3 @@ // query component | ||
| authorize(url, client_id, client_secret, timeout) | Retrieve a token from the CUSS Oauth Server using a client id and client secret. | | ||
| connect(baseURL, client_id, client_secret, tokenURL)| Connects to a CUSS Platform at the provided URL. | | ||
| connect(baseURL, oauthURL, deviceID,client_id, client_secret, tokenURL)| Connects to a CUSS Platform at the provided URL. | | ||
___ | ||
@@ -221,3 +221,3 @@ | ||
```ts | ||
const cuss2 = await Cuss2.connect(cuss2URL, clientId, clientSecret); | ||
const cuss2 = await Cuss2.connect(cuss2URL, oauthURL, deviceID, clientId, clientSecret); | ||
@@ -224,0 +224,0 @@ // query component |
@@ -1,2 +0,2 @@ | ||
import { MessageCodes } from '@elevated-libs/cuss2-typescript-models'; | ||
import { MessageCodes } from 'cuss2-typescript-models'; | ||
import { | ||
@@ -9,3 +9,3 @@ ComponentCharacteristics, | ||
MediaTypes | ||
} from "@elevated-libs/cuss2-typescript-models"; | ||
} from "cuss2-typescript-models"; | ||
@@ -12,0 +12,0 @@ export { EnvironmentComponent, MediaTypes }; |
import {EventEmitter} from 'events' | ||
import {ApplicationData} from "@elevated-libs/cuss2-typescript-models" | ||
import {ApplicationData} from "cuss2-typescript-models" | ||
import {helpers} from "./helper.js"; | ||
@@ -46,5 +46,6 @@ import {PlatformResponseError} from "./models/platformResponseError.js"; | ||
* @param {string} baseURL - url of the CUSS Platform | ||
* @param {string} tokenURL - The url of the CUSS Oauth Server | ||
* @param {string} deviceID - The GUID for the device connecting to the CUSS 2 platform | ||
* @param {string} client_id - The client_id of the CUSS 2 platform | ||
* @param {string} client_secret - The client_secret of the CUSS 2 platform | ||
* @param {string} tokenURL - The url of the CUSS Oauth Server | ||
* @returns {Promise<Connection>} - The connection object | ||
@@ -55,4 +56,4 @@ * @example | ||
*/ | ||
static async connect(baseURL, client_id, client_secret, tokenURL) { | ||
const connection = new Connection(baseURL, client_id, client_secret, tokenURL) | ||
static async connect(baseURL, tokenURL, deviceID, client_id, client_secret) { | ||
const connection = new Connection(baseURL, tokenURL, deviceID, client_id, client_secret) | ||
let delay = .5 | ||
@@ -81,5 +82,6 @@ function go() { | ||
constructor(baseURL, client_id, client_secret, options = {}) { | ||
constructor(baseURL, tokenURL, deviceID, client_id, client_secret) { | ||
super() | ||
this.pingInterval = options.pingInterval || this.pingInterval | ||
this.deviceID = deviceID | ||
this.setMaxListeners(0) | ||
@@ -95,7 +97,7 @@ const endOfHostname = baseURL.indexOf('?') | ||
let tokenURL = options.tokenURL | ||
if (!tokenURL) { | ||
tokenURL = baseURL + '/oauth/token' | ||
let _tokenURL = tokenURL | ||
if (!_tokenURL) { | ||
_tokenURL = baseURL + '/oauth/token' | ||
} | ||
this._auth = { url: tokenURL, client_id, client_secret } | ||
this._auth = { url: _tokenURL, client_id, client_secret } | ||
@@ -172,2 +174,5 @@ let protocol = /^https/.test(baseURL) ? "wss" : "ws" | ||
} | ||
if (data instanceof ApplicationData && !data.meta.deviceID) { | ||
data.meta.deviceID = this.deviceID | ||
} | ||
data = JSON.stringify(data) | ||
@@ -180,2 +185,6 @@ return this._socket.send(data) | ||
applicationData.meta.oauthToken = this.access_token | ||
if ((applicationData.meta.deviceID == null || applicationData.meta.deviceID == "00000000-0000-0000-0000-000000000000") | ||
&& this.deviceID != null) { | ||
applicationData.meta.deviceID = this.deviceID | ||
} | ||
const promise = this.waitFor(reqId) | ||
@@ -182,0 +191,0 @@ this._socket.send(JSON.stringify(applicationData)) |
@@ -8,3 +8,3 @@ | ||
import {ComponentInterrogation} from "./componentInterrogation.js"; | ||
import { ApplicationActivationExecutionModeEnum, ApplicationStateCodes } from '@elevated-libs/cuss2-typescript-models'; | ||
import { ApplicationActivationExecutionModeEnum, ApplicationStateCodes } from 'cuss2-typescript-models'; | ||
import { | ||
@@ -39,3 +39,3 @@ Announcement, | ||
ApplicationStateChangeReasonCodes as ChangeReason | ||
} from "@elevated-libs/cuss2-typescript-models"; | ||
} from "cuss2-typescript-models"; | ||
@@ -173,12 +173,13 @@ export { ApplicationStateCodes, DataRecordList }; | ||
* @method connect - Connect to the cuss platform. | ||
* @param {string} url - The url of the CUSS 2 platform | ||
* @param {string} wss - The WebSocket URL for CUSS 2 platform | ||
* @param {string} oauth - The URL for the Oauth2 server | ||
* @param {string} deviceID - The GUID for the device connecting to the CUSS 2 platform | ||
* @param {string} client_id - The client_id of the CUSS 2 platform | ||
* @param {string} client_secret - The client_secret of the CUSS 2 platform | ||
* @param {Object} [options={}] - An object of options passed in for the connection | ||
* @returns {Promise<Cuss2>} A promise that resolves to a Cuss2 object | ||
* @example | ||
* const connect = await Cuss2.connect('url', 'client_id', 'client_secret', "options"); | ||
* const connect = await Cuss2.connect('url', 'oauth', '00000000-0000-0000-0000-000000000000', 'client_id', 'client_secret'); | ||
* | ||
*/ | ||
static async connect(url: string, client_id: string, client_secret: string, options: any = {}): Promise<Cuss2> { | ||
static async connect(wss: string, oauth: string = null, deviceID: string = '00000000-0000-0000-0000-000000000000', client_id: string, client_secret: string): Promise<Cuss2> { | ||
document.body.setAttribute('elevated-cuss2', '1') | ||
@@ -191,3 +192,3 @@ function broadcast(detail: any) { | ||
const connection = await Connection.connect(url, client_id, client_secret, options); | ||
const connection = await Connection.connect(wss, oauth, deviceID, client_id, client_secret); | ||
const cuss2 = new Cuss2(connection); | ||
@@ -276,3 +277,7 @@ | ||
log("info", "Getting Environment Information"); | ||
await this.api.getEnvironment(); | ||
let level = await this.api.getEnvironment(); | ||
// hydrate device id if none provided | ||
if (this.connection.deviceID == '00000000-0000-0000-0000-000000000000' || this.connection.deviceID == null) { | ||
this.connection.deviceID = level.deviceID; | ||
} | ||
if (!this.state) { | ||
@@ -787,4 +792,4 @@ throw new Error('Platform in abnormal state.'); | ||
export {Connection} from "./connection.js"; | ||
export * from "@elevated-libs/cuss2-typescript-models"; | ||
export * from "cuss2-typescript-models"; | ||
export * from "./helper.js"; | ||
export * from "./componentInterrogation.js"; |
@@ -9,3 +9,3 @@ import {Subject} from "rxjs"; | ||
ApplicationDataPayload | ||
} from "@elevated-libs/cuss2-typescript-models"; | ||
} from "cuss2-typescript-models"; | ||
@@ -115,3 +115,3 @@ | ||
// @ts-ignore | ||
const {componentID, token, dataObj} = options | ||
const {componentID, token, deviceID = "00000000-0000-0000-0000-000000000000", dataObj} = options | ||
const meta = {} as ApplicationDataMeta | ||
@@ -122,2 +122,3 @@ meta.requestID = uuid.v4() | ||
meta.componentID = componentID | ||
meta.deviceID = deviceID | ||
@@ -124,0 +125,0 @@ const payload = { |
@@ -1,2 +0,2 @@ | ||
export * from "@elevated-libs/cuss2-typescript-models"; | ||
export * from "cuss2-typescript-models"; | ||
export * from './cuss2.js' | ||
@@ -3,0 +3,0 @@ export * from './models/component.js' |
@@ -13,3 +13,3 @@ import {BehaviorSubject, combineLatest, Subject} from "rxjs"; | ||
PlatformDirectives | ||
} from "@elevated-libs/cuss2-typescript-models"; | ||
} from "cuss2-typescript-models"; | ||
import {DeviceType} from './deviceType.js'; | ||
@@ -16,0 +16,0 @@ import {PlatformResponseError} from "./platformResponseError.js"; |
@@ -6,3 +6,3 @@ import { | ||
MessageCodes | ||
} from "@elevated-libs/cuss2-typescript-models"; | ||
} from "cuss2-typescript-models"; | ||
@@ -9,0 +9,0 @@ export class PlatformResponseError extends Error { |
@@ -1,2 +0,2 @@ | ||
import {ApplicationStateCodes} from "@elevated-libs/cuss2-typescript-models"; | ||
import {ApplicationStateCodes} from "cuss2-typescript-models"; | ||
@@ -3,0 +3,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
279871
4
5190
8
+ Addedcuss2-typescript-models@1.0.2(transitive)
- Removed@types/node@^14.17.32
- Removed@types/node@14.18.63(transitive)