@curium.rocks/data-emitter-base
Advanced tools
Comparing version 0.1.1-alpha.36 to 0.1.1-alpha.37
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BaseEmitter = exports.BaseDataEvent = exports.BaseStatusEvent = void 0; | ||
const dataEmitter_1 = require("./dataEmitter"); | ||
const loggerFacade_1 = require("./loggerFacade"); | ||
const provider_1 = require("./provider"); | ||
const common_1 = require("./common"); | ||
const chronicler_1 = require("./chronicler"); | ||
/** | ||
@@ -62,6 +62,6 @@ * | ||
}; | ||
if (dataEmitter_1.isJsonSerializable(this.data)) { | ||
if (chronicler_1.isJsonSerializable(this.data)) { | ||
ret.data = this.data.toJSON(); | ||
} | ||
if (dataEmitter_1.isJsonSerializable(this.meta)) { | ||
if (chronicler_1.isJsonSerializable(this.meta)) { | ||
ret.meta = this.meta.toJSON(); | ||
@@ -68,0 +68,0 @@ } |
@@ -1,4 +0,10 @@ | ||
import { IClassifier, IDisposable, IFormatSettings } from "./dataEmitter"; | ||
import { IChroniclerDescription, ISerializableState } from "./lib"; | ||
import { ISerializableState } from "./common"; | ||
import { IChroniclerDescription, IClassifier, IDataEvent, IDisposable, IFormatSettings, IStatusEvent } from "./dataEmitter"; | ||
/** | ||
* Check if any object conforms to the IJsonSerializable interface | ||
* @param {unknown} obj | ||
* @return {boolean} | ||
*/ | ||
export declare function isJsonSerializable(obj: unknown): boolean; | ||
/** | ||
* Enforce the object providing controlled | ||
@@ -24,5 +30,5 @@ * serialization to avoid circuler references | ||
* @return {Promise<void>} | ||
* @param {IJsonSerializable> record | ||
* @param {IJsonSerializable|IDataEvent|IStatusEvent} record | ||
*/ | ||
saveRecord(record: IJsonSerializable): Promise<void>; | ||
saveRecord(record: IJsonSerializable | IDataEvent | IStatusEvent): Promise<void>; | ||
} | ||
@@ -29,0 +35,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BaseChronicler = void 0; | ||
exports.BaseChronicler = exports.isJsonSerializable = void 0; | ||
const common_1 = require("./common"); | ||
/** | ||
* Check if any object conforms to the IJsonSerializable interface | ||
* @param {unknown} obj | ||
* @return {boolean} | ||
*/ | ||
function isJsonSerializable(obj) { | ||
if (obj == null) | ||
return false; | ||
if (typeof obj !== 'object') | ||
return false; | ||
const record = obj; | ||
if (record.toJSON == null) | ||
return false; | ||
return typeof record.toJSON === 'function'; | ||
} | ||
exports.isJsonSerializable = isJsonSerializable; | ||
/** | ||
* Base chronicler | ||
@@ -7,0 +23,0 @@ */ |
@@ -51,2 +51,8 @@ import { IChronicler, IJsonSerializable } from "./chronicler"; | ||
/** | ||
* Check if an object conforms to the IDataEvent interface | ||
* @param {uknown} obj | ||
* @return {boolean} | ||
*/ | ||
export declare function isDataEvent(obj: unknown): boolean; | ||
/** | ||
* A data emission event | ||
@@ -73,2 +79,8 @@ */ | ||
/** | ||
* Check if an object conforms to the IStatusEvent interface | ||
* @param {unknown} obj | ||
* @return {boolean} | ||
*/ | ||
export declare function isStatusEvent(obj: unknown): boolean; | ||
/** | ||
* A status event, this include information about connection status changes, built in test failures (BIT) etc | ||
@@ -138,8 +150,2 @@ */ | ||
} | ||
/** | ||
* | ||
* @param {Record<string, unknown>} obj | ||
* @return {boolean} | ||
*/ | ||
export declare function isJsonSerializable(obj: unknown): boolean; | ||
export interface IClassifier { | ||
@@ -146,0 +152,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isJsonSerializable = void 0; | ||
exports.isStatusEvent = exports.isDataEvent = void 0; | ||
/** | ||
* | ||
* @param {Record<string, unknown>} obj | ||
* Check if an object conforms to the IDataEvent interface | ||
* @param {uknown} obj | ||
* @return {boolean} | ||
*/ | ||
function isJsonSerializable(obj) { | ||
function isDataEvent(obj) { | ||
if (obj == null) | ||
return false; | ||
if (typeof obj == 'object') { | ||
const val = obj; | ||
return typeof val.toJSON == 'function'; | ||
} | ||
return false; | ||
if (typeof obj != 'object') | ||
return false; | ||
const record = obj; | ||
return record.emitter != null && record.timestamp != null && | ||
record.data != null && record.meta != null; | ||
} | ||
exports.isJsonSerializable = isJsonSerializable; | ||
exports.isDataEvent = isDataEvent; | ||
/** | ||
* Check if an object conforms to the IStatusEvent interface | ||
* @param {unknown} obj | ||
* @return {boolean} | ||
*/ | ||
function isStatusEvent(obj) { | ||
if (obj == null) | ||
return false; | ||
if (typeof obj != 'object') | ||
return false; | ||
const record = obj; | ||
return record.connected != null && record.bit != null && record.timestamp != null; | ||
} | ||
exports.isStatusEvent = isStatusEvent; | ||
//# sourceMappingURL=dataEmitter.js.map |
@@ -1,6 +0,6 @@ | ||
export { IDataEmitter, ICompoundDataEmitter, ICommand, IDataEvent, IExecutionResult, ISettings, ITraceableAction, IEmitterFactory, IDisposableAsync, IDisposable, IClassifier, IDataEventListener, IDataEventListenerFunc, IStatusChangeListener, IStatusChangeListenerFunc, IStatusEvent, IEmitterProvider, IChroniclerFactory, IChroniclerProvider, IEmitterDescription, IChroniclerDescription, IFormatSettings, isJsonSerializable } from './dataEmitter'; | ||
export { IDataEmitter, ICompoundDataEmitter, ICommand, IDataEvent, IExecutionResult, ISettings, ITraceableAction, IEmitterFactory, IDisposableAsync, IDisposable, IClassifier, IDataEventListener, IDataEventListenerFunc, IStatusChangeListener, IStatusChangeListenerFunc, IStatusEvent, IEmitterProvider, IChroniclerFactory, IChroniclerProvider, IEmitterDescription, IChroniclerDescription, IFormatSettings, isStatusEvent, isDataEvent } from './dataEmitter'; | ||
export { BaseEmitter, BaseStatusEvent, BaseDataEvent } from './baseEmitter'; | ||
export { PollingEmitter, DeltaPollingEmitter } from './pollingEmitter'; | ||
export { LoggerFacade, LogLevel } from './loggerFacade'; | ||
export { IChronicler, IFileChronicler, IRotatingFileChronicler, IJsonSerializable } from './chronicler'; | ||
export { IChronicler, IFileChronicler, IRotatingFileChronicler, IJsonSerializable, isJsonSerializable } from './chronicler'; | ||
export { IService, IChroniclerMaestro, IEmitterMaestro, IMaestro, isService } from './maestro'; | ||
@@ -7,0 +7,0 @@ export { ProviderSingleton } from './provider'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hasMethod = exports.isDisposable = exports.isDisposableAsync = exports.BaseChroniclerFactory = exports.BaseEmitterFactory = exports.BaseFactory = exports.ProviderSingleton = exports.isService = exports.LogLevel = exports.DeltaPollingEmitter = exports.PollingEmitter = exports.BaseDataEvent = exports.BaseStatusEvent = exports.BaseEmitter = exports.isJsonSerializable = void 0; | ||
exports.hasMethod = exports.isDisposable = exports.isDisposableAsync = exports.BaseChroniclerFactory = exports.BaseEmitterFactory = exports.BaseFactory = exports.ProviderSingleton = exports.isService = exports.isJsonSerializable = exports.LogLevel = exports.DeltaPollingEmitter = exports.PollingEmitter = exports.BaseDataEvent = exports.BaseStatusEvent = exports.BaseEmitter = exports.isDataEvent = exports.isStatusEvent = void 0; | ||
var dataEmitter_1 = require("./dataEmitter"); | ||
Object.defineProperty(exports, "isJsonSerializable", { enumerable: true, get: function () { return dataEmitter_1.isJsonSerializable; } }); | ||
Object.defineProperty(exports, "isStatusEvent", { enumerable: true, get: function () { return dataEmitter_1.isStatusEvent; } }); | ||
Object.defineProperty(exports, "isDataEvent", { enumerable: true, get: function () { return dataEmitter_1.isDataEvent; } }); | ||
var baseEmitter_1 = require("./baseEmitter"); | ||
@@ -15,2 +16,4 @@ Object.defineProperty(exports, "BaseEmitter", { enumerable: true, get: function () { return baseEmitter_1.BaseEmitter; } }); | ||
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return loggerFacade_1.LogLevel; } }); | ||
var chronicler_1 = require("./chronicler"); | ||
Object.defineProperty(exports, "isJsonSerializable", { enumerable: true, get: function () { return chronicler_1.isJsonSerializable; } }); | ||
var maestro_1 = require("./maestro"); | ||
@@ -17,0 +20,0 @@ Object.defineProperty(exports, "isService", { enumerable: true, get: function () { return maestro_1.isService; } }); |
{ | ||
"name": "@curium.rocks/data-emitter-base", | ||
"version": "0.1.1-alpha.36", | ||
"version": "0.1.1-alpha.37", | ||
"description": "A collection of typescript class interfaces and base classes that specify generic contracts with things that emit data", | ||
@@ -35,2 +35,3 @@ "main": "build/src/lib.js", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"madge": "^5.0.1", | ||
"mocha": "^9.0.2", | ||
@@ -37,0 +38,0 @@ "nyc": "^15.1.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
98942
2145
17