@barchart/events-api-common
Advanced tools
Comparing version 1.0.19 to 1.0.20
@@ -6,2 +6,10 @@ const Enum = require('@barchart/common-js/lang/Enum'); | ||
/** | ||
* An enumeration for customers. | ||
* | ||
* @public | ||
* @extends {Enum} | ||
* @param {String} code | ||
* @param {String} description | ||
*/ | ||
class CustomerType extends Enum { | ||
@@ -8,0 +16,0 @@ constructor(code, description) { |
@@ -12,3 +12,2 @@ const assert = require('@barchart/common-js/lang/assert'), | ||
* @extends {Enum} | ||
* @param {Number} id | ||
* @param {String} code | ||
@@ -34,3 +33,3 @@ * @param {String} description | ||
* @public | ||
* @return {Boolean} | ||
* @returns {Boolean} | ||
*/ | ||
@@ -45,3 +44,3 @@ get initial() { | ||
* @public | ||
* @return {Boolean} | ||
* @returns {Boolean} | ||
*/ | ||
@@ -52,6 +51,2 @@ get terminal() { | ||
toString() { | ||
return `[EventsJobStatus]`; | ||
} | ||
/** | ||
@@ -89,2 +84,6 @@ * The job is in-progress. | ||
} | ||
toString() { | ||
return `[EventsJobStatus (code=${this.code})]`; | ||
} | ||
} | ||
@@ -91,0 +90,0 @@ |
@@ -1,11 +0,37 @@ | ||
const Enum = require('@barchart/common-js/lang/Enum'); | ||
const assert = require('@barchart/common-js/lang/assert'), | ||
Enum = require('@barchart/common-js/lang/Enum'); | ||
const ProductType = require('./ProductType'); | ||
module.exports = (() => { | ||
'use strict'; | ||
/** | ||
* An enumeration of event types that can be tracked. | ||
* | ||
* @public | ||
* @extends {Enum} | ||
* @param {String} code | ||
* @param {String} description | ||
* @param {ProductType=} product | ||
*/ | ||
class EventType extends Enum { | ||
constructor(code, description) { | ||
constructor(code, description, product) { | ||
super(code, description); | ||
assert.argumentIsOptional(product, 'product', ProductType, 'ProductType'); | ||
this._product = product || null; | ||
} | ||
/** | ||
* The {@link ProductType} which the event applies to. | ||
* | ||
* @public | ||
* @return {ProductType|null} | ||
*/ | ||
get product() { | ||
return this._product; | ||
} | ||
static get WATCHLIST_APPLICATION_LOADED() { | ||
@@ -106,35 +132,35 @@ return watchlistApplicationLoaded; | ||
const watchlistApplicationLoaded = new EventType('W-AL', 'Application Loaded'); | ||
const watchlistAccessed = new EventType('W-A', 'Accessed'); | ||
const watchlistCreated = new EventType('W-C', 'Created'); | ||
const watchlistDeleted = new EventType('W-D', 'Deleted'); | ||
const watchlistApplicationLoaded = new EventType('W-AL', 'Application Loaded', ProductType.WATCHLIST); | ||
const watchlistAccessed = new EventType('W-A', 'Accessed', ProductType.WATCHLIST); | ||
const watchlistCreated = new EventType('W-C', 'Created', ProductType.WATCHLIST); | ||
const watchlistDeleted = new EventType('W-D', 'Deleted', ProductType.WATCHLIST); | ||
const watchlistSymbolAdded = new EventType('W-SA', 'Symbol Added'); | ||
const watchlistSymbolRemoved = new EventType('W-SR', 'Symbol Removed'); | ||
const watchlistSymbolAdded = new EventType('W-SA', 'Symbol Added', ProductType.WATCHLIST); | ||
const watchlistSymbolRemoved = new EventType('W-SR', 'Symbol Removed', ProductType.WATCHLIST); | ||
const watchlistCustomViewCreated = new EventType('W-CVC', 'Custom View Created'); | ||
const watchlistCustomViewDeleted = new EventType('W-CVD', 'Custom View Deleted'); | ||
const watchlistCustomViewCreated = new EventType('W-CVC', 'Custom View Created', ProductType.WATCHLIST); | ||
const watchlistCustomViewDeleted = new EventType('W-CVD', 'Custom View Deleted', ProductType.WATCHLIST); | ||
// Portfolio | ||
const portfolioApplicationLoaded = new EventType('P-AL', 'Application Loaded'); | ||
const portfolioAccessed = new EventType('P-A', 'Accessed'); | ||
const portfolioCreated = new EventType('P-C', 'Created'); | ||
const portfolioDeleted = new EventType('P-D', 'Deleted'); | ||
const portfolioApplicationLoaded = new EventType('P-AL', 'Application Loaded', ProductType.PORTFOLIO); | ||
const portfolioAccessed = new EventType('P-A', 'Accessed', ProductType.PORTFOLIO); | ||
const portfolioCreated = new EventType('P-C', 'Created', ProductType.PORTFOLIO); | ||
const portfolioDeleted = new EventType('P-D', 'Deleted', ProductType.PORTFOLIO); | ||
const portfolioTransactionCreated = new EventType('P-TC', 'Transaction Created'); | ||
const portfolioTransactionEdited = new EventType('P-TE', 'Transaction Edited'); | ||
const portfolioTransactionDeleted = new EventType('P-TD', 'Transaction Deleted'); | ||
const portfolioTransactionHistoryViewedSingle = new EventType('P-THVS', 'Transaction History Viewed (Single position)'); | ||
const portfolioTransactionHistoryViewedAll = new EventType('P-THVA', 'Transaction History Viewed (All positions)'); | ||
const portfolioTransactionCreated = new EventType('P-TC', 'Transaction Created', ProductType.PORTFOLIO); | ||
const portfolioTransactionEdited = new EventType('P-TE', 'Transaction Edited', ProductType.PORTFOLIO); | ||
const portfolioTransactionDeleted = new EventType('P-TD', 'Transaction Deleted', ProductType.PORTFOLIO); | ||
const portfolioTransactionHistoryViewedSingle = new EventType('P-THVS', 'Transaction History Viewed (Single position)', ProductType.PORTFOLIO); | ||
const portfolioTransactionHistoryViewedAll = new EventType('P-THVA', 'Transaction History Viewed (All positions)', ProductType.PORTFOLIO); | ||
const portfolioPositionCreated = new EventType('P-PC', 'Position Created'); | ||
const portfolioPositionDeleted = new EventType('P-PD', 'Position Deleted'); | ||
const portfolioPositionCreated = new EventType('P-PC', 'Position Created', ProductType.PORTFOLIO); | ||
const portfolioPositionDeleted = new EventType('P-PD', 'Position Deleted', ProductType.PORTFOLIO); | ||
const portfolioBrokerageReportDownloaded = new EventType('P-BRD', 'Brokerage Report Downloaded'); | ||
const portfolioBrokerageReportDownloaded = new EventType('P-BRD', 'Brokerage Report Downloaded', ProductType.PORTFOLIO); | ||
const portfolioCustomViewCreated = new EventType('P-CVC', 'Custom View Created'); | ||
const portfolioCustomViewDeleted = new EventType('P-CVD', 'Custom View Deleted'); | ||
const portfolioCustomViewCreated = new EventType('P-CVC', 'Custom View Created', ProductType.PORTFOLIO); | ||
const portfolioCustomViewDeleted = new EventType('P-CVD', 'Custom View Deleted', ProductType.PORTFOLIO); | ||
return EventType; | ||
})(); |
@@ -6,2 +6,10 @@ const Enum = require('@barchart/common-js/lang/Enum'); | ||
/** | ||
* An enumeration of products (which are associated with events). | ||
* | ||
* @public | ||
* @extends {Enum} | ||
* @param {String} code | ||
* @param {String} description | ||
*/ | ||
class ProductType extends Enum { | ||
@@ -13,3 +21,3 @@ constructor(code, description) { | ||
/** | ||
* ProductType for Portfolio product.g | ||
* The portfolio system. | ||
* | ||
@@ -25,3 +33,3 @@ * @public | ||
/** | ||
* ProductType for Watchlist product. | ||
* The watchlist system. | ||
* | ||
@@ -28,0 +36,0 @@ * @public |
@@ -1,3 +0,5 @@ | ||
const DataType = require('@barchart/common-js/serialization/json/DataType'), | ||
const assert = require('@barchart/common-js/lang/assert'), | ||
DataType = require('@barchart/common-js/serialization/json/DataType'), | ||
Enum = require('@barchart/common-js/lang/Enum'), | ||
Schema = require('@barchart/common-js/serialization/json/Schema'), | ||
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder'); | ||
@@ -12,4 +14,13 @@ | ||
/** | ||
* An enumeration, defining schemas related to jobs. | ||
* | ||
* @public | ||
* @extends {Enum} | ||
* @param {Schema} schema | ||
*/ | ||
class EventJobSchema extends Enum { | ||
constructor(schema) { | ||
assert.argumentIsRequired(schema, 'schema', Schema, 'Schema'); | ||
super(schema.name, schema.name); | ||
@@ -16,0 +27,0 @@ |
@@ -1,3 +0,5 @@ | ||
const DataType = require('@barchart/common-js/serialization/json/DataType'), | ||
const assert = require('@barchart/common-js/lang/assert'), | ||
DataType = require('@barchart/common-js/serialization/json/DataType'), | ||
Enum = require('@barchart/common-js/lang/Enum'), | ||
Schema = require('@barchart/common-js/serialization/json/Schema'), | ||
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder'); | ||
@@ -12,4 +14,13 @@ | ||
/** | ||
* An enumeration, defining schemas related to events. | ||
* | ||
* @public | ||
* @extends {Enum} | ||
* @param {Schema} schema | ||
*/ | ||
class EventSchema extends Enum { | ||
constructor(schema) { | ||
assert.argumentIsRequired(schema, 'schema', Schema, 'Schema'); | ||
super(schema.name, schema.name); | ||
@@ -16,0 +27,0 @@ |
{ | ||
"name": "@barchart/events-api-common", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"description": "Common classes used by the Event system", | ||
@@ -5,0 +5,0 @@ "author": { |
17127
563