diff --git a/CHANGELOG.md b/CHANGELOG.md index d8afab599..0308c17df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## to be released -| Type | Namespace | Description | Reference | Breaking | -|-------------|-----------|---------------------------------------------|---------------------------------------------------------------------------------------------------------|----------| +| Type | Namespace | Description | Reference | Breaking | +|-------------|------------|----------------------------------------------------------|--------------------------------------------------------|----------| +| Enhancement | `triggers` | Add support for `Item` as argument & Add arg type checks | [#194](https://github.com/openhab/openhab-js/pull/194) | No | Also see the [Release Milestone](https://github.com/openhab/openhab-js/milestone/10). diff --git a/jest.config.js b/jest.config.js index 23303ea22..d3b42d6c1 100644 --- a/jest.config.js +++ b/jest.config.js @@ -130,7 +130,7 @@ module.exports = { // runner: "jest-runner", // The paths to modules that run some code to configure or set up the testing environment before each test - setupFiles: ['./test/java.mock.js'], + setupFiles: ['./test/java.mock.js', './test/@runtime.mock.js'], // A list of paths to modules that run some code to configure or set up the testing framework before each test // setupFilesAfterEnv: [], diff --git a/test/@runtime.mock.js b/test/@runtime.mock.js new file mode 100644 index 000000000..b7e735ebe --- /dev/null +++ b/test/@runtime.mock.js @@ -0,0 +1,20 @@ +jest.mock('@runtime', () => ({ + DateTimeType: jest.fn(), + DecimalType: jest.fn(), + StringType: jest.fn(), + QuantityType: jest.fn() +}), { virtual: true }); + +jest.mock('@runtime/Defaults', () => ({}), { virtual: true }); + +jest.mock('@runtime/osgi', () => ({ + bundleContext: { + getServiceReference: jest.fn(), + getService: jest.fn(), + getAllServiceReferences: jest.fn(), + registerService: jest.fn() + }, + lifecycle: { + addDisposeHook: jest.fn() + } +}), { virtual: true }); diff --git a/test/actions.spec.js b/test/actions.spec.js index e053cfd2a..b5673efc2 100644 --- a/test/actions.spec.js +++ b/test/actions.spec.js @@ -4,8 +4,6 @@ const { ScriptExecution, Transformation } = require('../actions'); const { JavaScriptExecution, JavaTransformation } = require('./openhab.mock'); jest.mock('../osgi'); -jest.mock('@runtime/osgi', () => ({}), { virtual: true }); -jest.mock('@runtime/Defaults', () => ({}), { virtual: true }); describe('actions.js', () => { describe('ScriptExecution', () => { diff --git a/test/openhab.mock.js b/test/openhab.mock.js index 9443fea0c..70f703f1e 100644 --- a/test/openhab.mock.js +++ b/test/openhab.mock.js @@ -1,3 +1,4 @@ +// org.openhab.core.automation.util.ModuleBuilder (https://www.openhab.org/javadoc/latest/org/openhab/core/automation/util/modulebuilder) class ModuleBuilder { constructor () { this.withId = jest.fn(() => this); @@ -9,19 +10,29 @@ class ModuleBuilder { ModuleBuilder.createTrigger = jest.fn(() => new ModuleBuilder()); +// org.openhab.core.config.core.Configuration (https://www.openhab.org/javadoc/latest/org/openhab/core/config/core/configuration) class Configuration { constructor (config) { this.config = config; } } +// org.openhab.core.items.MetadataRegistry (https://www.openhab.org/javadoc/latest/org/openhab/core/items/metadataregistry) +class MetadataRegistry { + add () {} + get () {} + update () {} +} + +// org.openhab.core.model.script.actions.ScriptExecution (https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/scriptexecution) class JavaScriptExecution { static callScript () {} static createTimer () {} } +// org.openhab.core.transform.actions.Transformation (https://www.openhab.org/javadoc/latest/org/openhab/core/transform/actions/transformation) class JavaTransformation {} JavaTransformation.transform = jest.fn(() => 'on'); JavaTransformation.transformRaw = jest.fn(() => 'on'); -module.exports = { Configuration, ModuleBuilder, JavaScriptExecution, JavaTransformation }; +module.exports = { Configuration, MetadataRegistry, ModuleBuilder, JavaScriptExecution, JavaTransformation }; diff --git a/test/osgi.spec.js b/test/osgi.spec.js index 6492ca107..5929ab21a 100644 --- a/test/osgi.spec.js +++ b/test/osgi.spec.js @@ -3,18 +3,6 @@ const { Hashtable } = require('./java.mock'); const bundleContext = require('@runtime/osgi').bundleContext; const lifecycle = require('@runtime/osgi').lifecycle; -jest.mock('@runtime/osgi', () => ({ - bundleContext: { - getServiceReference: jest.fn(), - getService: jest.fn(), - getAllServiceReferences: jest.fn(), - registerService: jest.fn() - }, - lifecycle: { - addDisposeHook: jest.fn() - } -}), { virtual: true }); - describe('osgi.js', () => { describe('getService', () => { describe('looks up given service from bundle context', () => { diff --git a/test/triggers.spec.js b/test/triggers.spec.js index 8133f695a..55793b8b6 100644 --- a/test/triggers.spec.js +++ b/test/triggers.spec.js @@ -18,6 +18,15 @@ const { PIDTrigger } = require('../triggers'); +jest.mock('../items', () => ({ + Item: class { + constructor (name) { + this.name = name; + } + } +})); +const Item = require('../items').Item; + describe('triggers.js', () => { const moduleBuilderSpy = new ModuleBuilder(); ModuleBuilder.createTrigger.mockImplementation(() => moduleBuilderSpy); @@ -32,11 +41,13 @@ describe('triggers.js', () => { }); describe('ItemCommandTrigger', () => { - it('creates trigger.', () => { - const itemName = 'itemName'; - const command = 'command'; - const triggerName = 'triggerName'; - ItemCommandTrigger(itemName, command, triggerName); + const itemName = 'itemName'; + const command = 'command'; + const triggerName = 'triggerName'; + const item = new Item(itemName); + + it.each([[itemName], [item]])('creates trigger from %s.', (itemOrName) => { + ItemCommandTrigger(itemOrName, command, triggerName); expect(moduleBuilderSpy.withTypeUID).toHaveBeenCalledWith( 'core.ItemCommandTrigger' @@ -51,12 +62,14 @@ describe('triggers.js', () => { }); describe('ItemStateChangeTrigger', () => { - it('creates trigger.', () => { - const itemName = 'itemName'; - const previousState = 'previousState'; - const state = 'state'; - const triggerName = 'triggerName'; - ItemStateChangeTrigger(itemName, previousState, state, triggerName); + const itemName = 'itemName'; + const previousState = 'previousState'; + const state = 'state'; + const triggerName = 'triggerName'; + const item = new Item(itemName); + + it.each([[itemName], [item]])('creates trigger from %s.', (itemOrName) => { + ItemStateChangeTrigger(itemOrName, previousState, state, triggerName); expect(moduleBuilderSpy.withTypeUID).toHaveBeenCalledWith( 'core.ItemStateChangeTrigger' @@ -90,11 +103,13 @@ describe('triggers.js', () => { }); describe('ItemStateUpdateTrigger', () => { - it('creates trigger.', () => { - const itemName = 'itemName'; - const state = 'state'; - const triggerName = 'triggerName'; - ItemStateUpdateTrigger(itemName, state, triggerName); + const itemName = 'itemName'; + const state = 'state'; + const triggerName = 'triggerName'; + const item = new Item(itemName); + + it.each([[itemName], [item]])('creates trigger from %s.', (itemOrName) => { + ItemStateUpdateTrigger(itemOrName, state, triggerName); expect(moduleBuilderSpy.withTypeUID).toHaveBeenCalledWith( 'core.ItemStateUpdateTrigger' @@ -109,12 +124,14 @@ describe('triggers.js', () => { }); describe('GroupStateChangeTrigger', () => { - it('creates trigger.', () => { - const groupName = 'groupName'; - const state = 'state'; - const previousState = 'previousState'; - const triggerName = 'triggerName'; - GroupStateChangeTrigger(groupName, previousState, state, triggerName); + const groupName = 'groupName'; + const state = 'state'; + const previousState = 'previousState'; + const triggerName = 'triggerName'; + const group = new Item(groupName); + + it.each([[groupName], [group]])('creates trigger from %s.', (groupOrName) => { + GroupStateChangeTrigger(groupOrName, previousState, state, triggerName); expect(moduleBuilderSpy.withTypeUID).toHaveBeenCalledWith( 'core.GroupStateChangeTrigger' @@ -129,11 +146,13 @@ describe('triggers.js', () => { }); describe('GroupStateUpdateTrigger', () => { - it('creates trigger.', () => { - const groupName = 'groupName'; - const state = 'state'; - const triggerName = 'triggerName'; - GroupStateUpdateTrigger(groupName, state, triggerName); + const groupName = 'groupName'; + const state = 'state'; + const triggerName = 'triggerName'; + const group = new Item(groupName); + + it.each([[groupName], [group]])('creates trigger from %s.', (groupOrName) => { + GroupStateUpdateTrigger(groupOrName, state, triggerName); expect(moduleBuilderSpy.withTypeUID).toHaveBeenCalledWith( 'core.GroupStateUpdateTrigger' @@ -148,11 +167,13 @@ describe('triggers.js', () => { }); describe('GroupCommandTrigger', () => { - it('creates trigger.', () => { - const groupName = 'groupName'; - const command = 'command'; - const triggerName = 'triggerName'; - GroupCommandTrigger(groupName, command, triggerName); + const groupName = 'groupName'; + const command = 'command'; + const triggerName = 'triggerName'; + const group = new Item(groupName); + + it.each([[groupName], [group]])('creates trigger from %s.', (groupOrName) => { + GroupCommandTrigger(groupOrName, command, triggerName); expect(moduleBuilderSpy.withTypeUID).toHaveBeenCalledWith( 'core.GroupCommandTrigger' @@ -262,7 +283,7 @@ describe('triggers.js', () => { describe('DateTimeTrigger', () => { it('creates trigger.', () => { const itemName = 'itemName'; - const timeOnly = 'timeOnly'; + const timeOnly = true; const triggerName = 'triggerName'; DateTimeTrigger(itemName, timeOnly, triggerName); diff --git a/test/typeOfArguments.spec.js b/test/typeOfArguments.spec.js index 2f3f51597..76d505b38 100644 --- a/test/typeOfArguments.spec.js +++ b/test/typeOfArguments.spec.js @@ -1,15 +1,27 @@ const typeOfArguments = require('../typeOfArguments'); describe('typeOfArguments.js', () => { - describe('supports primitive types (without "undefined")', () => { - const expectedArray = ['string', 'number', 'bigint', 'boolean', 'symbol', 'null']; + describe('supports primitive types', () => { + const expectedArray = ['string', 'number', 'bigint', 'boolean', 'symbol', 'null', 'undefined']; it('does not throw an error if arguments match.', () => { - expect(() => typeOfArguments(['string', 5, BigInt(5), true, Symbol('foo'), null], expectedArray)).not.toThrowError(); + expect(() => typeOfArguments(['string', 5, BigInt(5), true, Symbol('foo'), null, undefined], expectedArray)).not.toThrowError(); }); it('throws TypeError if an argument does not match.', () => { - expect(() => typeOfArguments([5, BigInt(5), true, Symbol('foo'), null, 'string'], expectedArray)).toThrowError(TypeError); + expect(() => typeOfArguments([5, BigInt(5), true, Symbol('foo'), null, undefined, 'string'], expectedArray)).toThrowError(TypeError); + }); + }); + + describe('supports classname checking', () => { + const expectedArray = ['Car', 'Bus']; + class Car {} + class Bus {} + it('does not throw an error if arguments match.', () => { + expect(() => typeOfArguments([new Car(), new Bus()], expectedArray)).not.toThrowError(); + }); + it('throws TypeError if an argument does not match.', () => { + expect(() => typeOfArguments([new Bus(), new Car()], expectedArray)).toThrowError(TypeError); }); }); @@ -24,15 +36,10 @@ describe('typeOfArguments.js', () => { expect(() => typeOfArguments([{}, new Object()], ['object', 'object'])).not.toThrowError(); // eslint-disable-line }); - describe('supports classname checking', () => { - const expectedArray = ['Car', 'Bus']; - class Car {} - class Bus {} - it('does not trow an error if arguments match.', () => { - expect(() => typeOfArguments([new Car(), new Bus()], expectedArray)).not.toThrowError(); - }); - it('throws TypeError if an argument does not match.', () => { - expect(() => typeOfArguments([new Bus(), new Car()], expectedArray)).toThrowError(TypeError); - }); + it('throws TypeError if a required argument is missing.', () => { + function testFn (x, y) { + typeOfArguments([x, y], ['string', 'string']); + } + expect(() => testFn()).toThrowError(TypeError); }); }); diff --git a/triggers.js b/triggers.js index cdc43cd06..4dea01ee9 100644 --- a/triggers.js +++ b/triggers.js @@ -7,7 +7,11 @@ * @namespace triggers */ +/** @type {object} */ +const typeOfArguments = require('./typeOfArguments'); const utils = require('./utils'); +/** @type {Item} */ +const Item = require('./items').Item; const ModuleBuilder = Java.type('org.openhab.core.automation.util.ModuleBuilder'); const Configuration = Java.type('org.openhab.core.config.core.Configuration'); @@ -46,10 +50,13 @@ const createTrigger = function (typeString, name, config) { * @param {string} [triggerName] the optional name of the trigger to create * */ -const ChannelEventTrigger = (channel, event, triggerName) => createTrigger('core.ChannelEventTrigger', triggerName, { - channelUID: channel, - event: event -}); +const ChannelEventTrigger = (channel, event, triggerName) => { + typeOfArguments([channel, event, triggerName], ['string', 'string', 'string|undefined']); + createTrigger('core.ChannelEventTrigger', triggerName, { + channelUID: channel, + event: event + }); +}; /** * Creates a trigger that fires upon an Item changing state. @@ -61,16 +68,19 @@ const ChannelEventTrigger = (channel, event, triggerName) => createTrigger('core * ItemStateChangeTrigger('my_item', 'OFF', null); // changed from OFF * * @memberof triggers - * @param {string} itemName the name of the Item to monitor for change + * @param {Item|string} itemOrName the {@link Item} or the name of the Item to monitor for change * @param {string} [oldState] the previous state of the Item * @param {string} [newState] the new state of the Item * @param {string} [triggerName] the optional name of the trigger to create */ -const ItemStateChangeTrigger = (itemName, oldState, newState, triggerName) => createTrigger('core.ItemStateChangeTrigger', triggerName, { - itemName: itemName, - state: newState, - previousState: oldState -}); +const ItemStateChangeTrigger = (itemOrName, oldState, newState, triggerName) => { + typeOfArguments([itemOrName, oldState, newState, triggerName], ['string|Item', 'string|undefined', 'string|undefined', 'string|undefined']); + createTrigger('core.ItemStateChangeTrigger', triggerName, { + itemName: (itemOrName instanceof Item) ? itemOrName.name : itemOrName, + state: newState, + previousState: oldState + }); +}; /** * Creates a trigger that fires upon an Item receiving a state update. Note that the Item does not need to change state. @@ -80,14 +90,17 @@ const ItemStateChangeTrigger = (itemName, oldState, newState, triggerName) => cr * ItemStateUpdateTrigger('my_item', 'OFF'); // received update OFF * * @memberof triggers - * @param {string} itemName the name of the Item to monitor for change + * @param {Item|string} itemOrName the {@link Item} or the name of the Item to monitor for change * @param {string} [state] the new state of the Item * @param {string} [triggerName] the optional name of the trigger to create */ -const ItemStateUpdateTrigger = (itemName, state, triggerName) => createTrigger('core.ItemStateUpdateTrigger', triggerName, { - itemName: itemName, - state: state -}); +const ItemStateUpdateTrigger = (itemOrName, state, triggerName) => { + typeOfArguments([itemOrName, state, triggerName], ['string|Item', 'string|undefined', 'string|undefined']); + createTrigger('core.ItemStateUpdateTrigger', triggerName, { + itemName: (itemOrName instanceof Item) ? itemOrName.name : itemOrName, + state: state + }); +}; /** * Creates a trigger that fires upon an Item receiving a command. Note that the Item does not need to change state. @@ -97,67 +110,79 @@ const ItemStateUpdateTrigger = (itemName, state, triggerName) => createTrigger(' * ItemCommandTrigger('my_item', 'OFF'); // received command OFF * * @memberof triggers - * @param {string} itemName the name of the Item to monitor for change + * @param {Item|string} itemOrName the {@link Item} or the name of the Item to monitor for change * @param {string} [command] the command received * @param {string} [triggerName] the optional name of the trigger to create */ -const ItemCommandTrigger = (itemName, command, triggerName) => createTrigger('core.ItemCommandTrigger', triggerName, { - itemName: itemName, - command: command -}); +const ItemCommandTrigger = (itemOrName, command, triggerName) => { + typeOfArguments([itemOrName, command, triggerName], ['string|Item', 'string|undefined', 'string|undefined']); + createTrigger('core.ItemCommandTrigger', triggerName, { + itemName: (itemOrName instanceof Item) ? itemOrName.name : itemOrName, + command: command + }); +}; /** - * Creates a trigger that fires upon a member of a group changing state. + * Creates a trigger that fires upon a member of a group changing state. Note that group Item does not need to change state. * * @example * GroupStateChangeTrigger('my_group', 'OFF', 'ON'); * * @memberof triggers - * @param {string} groupName the name of the group to monitor for change + * @param {Item|string} groupOrName the group {@link Item} or the name of the group to monitor for change * @param {string} [oldState] the previous state of the group * @param {string} [newState] the new state of the group * @param {string} [triggerName] the optional name of the trigger to create */ -const GroupStateChangeTrigger = (groupName, oldState, newState, triggerName) => createTrigger('core.GroupStateChangeTrigger', triggerName, { - groupName: groupName, - state: newState, - previousState: oldState -}); +const GroupStateChangeTrigger = (groupOrName, oldState, newState, triggerName) => { + typeOfArguments([groupOrName, oldState, newState, triggerName], ['string|Item', 'string|undefined', 'string|undefined', 'string|undefined']); + createTrigger('core.GroupStateChangeTrigger', triggerName, { + groupName: (groupOrName instanceof Item) ? groupOrName.name : groupOrName, + state: newState, + previousState: oldState + }); +}; /** - * Creates a trigger that fires upon a member of a group receiving a state update. Note that group item does not need to change state. + * Creates a trigger that fires upon a member of a group receiving a state update. Note that group Item does not need to change state. * * @example * GroupStateUpdateTrigger('my_group', 'OFF'); * * @memberof triggers - * @param {string} groupName the name of the group to monitor for change + * @param {Item|string} groupOrName the group {@link Item} or the name of the group to monitor for change * @param {string} [state] the new state of the group * @param {string} [triggerName] the optional name of the trigger to create */ -const GroupStateUpdateTrigger = (groupName, state, triggerName) => createTrigger('core.GroupStateUpdateTrigger', triggerName, { - groupName: groupName, - state: state -}); +const GroupStateUpdateTrigger = (groupOrName, state, triggerName) => { + typeOfArguments([groupOrName, state, triggerName], ['string|Item', 'string|undefined', 'string|undefined']); + createTrigger('core.GroupStateUpdateTrigger', triggerName, { + groupName: (groupOrName instanceof Item) ? groupOrName.name : groupOrName, + state: state + }); +}; /** - * Creates a trigger that fires upon a member of a group receiving a command. Note that the group does not need to change state. + * Creates a trigger that fires upon a member of a group receiving a command. Note that the group Item does not need to change state. * * @example * GroupCommandTrigger('my_group', 'OFF'); * * @memberof triggers - * @param {string} groupName the name of the group to monitor for change + * @param {Item|string} groupOrName the group {@link Item} or the name of the group to monitor for commands * @param {string} [command] the command received * @param {string} [triggerName] the optional name of the trigger to create */ -const GroupCommandTrigger = (groupName, command, triggerName) => createTrigger('core.GroupCommandTrigger', triggerName, { - groupName: groupName, - command: command -}); +const GroupCommandTrigger = (groupOrName, command, triggerName) => { + typeOfArguments([groupOrName, command, triggerName], ['string|Item', 'string|undefined', 'string|undefined']); + createTrigger('core.GroupCommandTrigger', triggerName, { + groupName: (groupOrName instanceof Item) ? groupOrName.name : groupOrName, + command: command + }); +}; /** - * Creates a trigger that fires upon an Thing status updating + * Creates a trigger that fires upon a Thing status updating. * * @example * ThingStatusUpdateTrigger('some:thing:uuid', 'OFFLINE'); @@ -167,13 +192,16 @@ const GroupCommandTrigger = (groupName, command, triggerName) => createTrigger(' * @param {string} [status] the optional status to monitor for * @param {string} [triggerName] the optional name of the trigger to create */ -const ThingStatusUpdateTrigger = (thingUID, status, triggerName) => createTrigger('core.ThingStatusUpdateTrigger', triggerName, { - thingUID: thingUID, - status: status -}); +const ThingStatusUpdateTrigger = (thingUID, status, triggerName) => { + typeOfArguments([thingUID, status, triggerName], ['string', 'string|undefined', 'string|undefined']); + createTrigger('core.ThingStatusUpdateTrigger', triggerName, { + thingUID: thingUID, + status: status + }); +}; /** - * Creates a trigger that fires upon an Thing status changing + * Creates a trigger that fires upon a Thing status changing. * * @example * ThingStatusChangeTrigger('some:thing:uuid', 'ONLINE', 'OFFLINE'); @@ -184,11 +212,14 @@ const ThingStatusUpdateTrigger = (thingUID, status, triggerName) => createTrigge * @param {string} [previousStatus] the optional previous state to monitor from * @param {string} [triggerName] the optional name of the trigger to create */ -const ThingStatusChangeTrigger = (thingUID, status, previousStatus, triggerName) => createTrigger('core.ThingStatusChangeTrigger', triggerName, { - thingUID: thingUID, - status: status, - previousStatus: previousStatus -}); +const ThingStatusChangeTrigger = (thingUID, status, previousStatus, triggerName) => { + typeOfArguments([thingUID, status, previousStatus, triggerName], ['string', 'string|undefined', 'string|undefined', 'string|undefined']); + createTrigger('core.ThingStatusChangeTrigger', triggerName, { + thingUID: thingUID, + status: status, + previousStatus: previousStatus + }); +}; /** * Creates a trigger that fires if a given start level is reached by the system @@ -205,12 +236,15 @@ const ThingStatusChangeTrigger = (thingUID, status, previousStatus, triggerName) * SystemStartlevelTrigger(100) // Startup Complete * * @memberof triggers - * @param {string} startlevel the system start level to be triggered on + * @param {string|number} startlevel the system start level to be triggered on * @param {string} [triggerName] the optional name of the trigger to create */ -const SystemStartlevelTrigger = (startlevel, triggerName) => createTrigger('core.SystemStartlevelTrigger', triggerName, { - startlevel: startlevel -}); +const SystemStartlevelTrigger = (startlevel, triggerName) => { + typeOfArguments([startlevel, triggerName], ['string|number', 'string|undefined']); + createTrigger('core.SystemStartlevelTrigger', triggerName, { + startlevel: startlevel.toString() + }); +}; /** * Creates a trigger that fires on a cron schedule. The supplied cron expression defines when the trigger will fire. @@ -222,9 +256,12 @@ const SystemStartlevelTrigger = (startlevel, triggerName) => createTrigger('core * @param {string} expression the cron expression defining the triggering schedule * @param {string} [triggerName] the optional name of the trigger to create */ -const GenericCronTrigger = (expression, triggerName) => createTrigger('timer.GenericCronTrigger', triggerName, { - cronExpression: expression -}); +const GenericCronTrigger = (expression, triggerName) => { + typeOfArguments([expression, triggerName], ['string', 'string|undefined']); + createTrigger('timer.GenericCronTrigger', triggerName, { + cronExpression: expression + }); +}; /** * Creates a trigger that fires daily at a specific time. The supplied time defines when the trigger will fire. @@ -236,9 +273,12 @@ const GenericCronTrigger = (expression, triggerName) => createTrigger('timer.Gen * @param {string} time the time expression defining the triggering schedule * @param {string} [triggerName] the optional name of the trigger to create */ -const TimeOfDayTrigger = (time, triggerName) => createTrigger('timer.TimeOfDayTrigger', triggerName, { - time: time -}); +const TimeOfDayTrigger = (time, triggerName) => { + typeOfArguments([time, triggerName], ['string', 'string|undefined']); + createTrigger('timer.TimeOfDayTrigger', triggerName, { + time: time + }); +}; /** * Creates a trigger that fires at a (optional) date and time specified in an DateTime Item. @@ -251,10 +291,13 @@ const TimeOfDayTrigger = (time, triggerName) => createTrigger('timer.TimeOfDayTr * @param {boolean} [timeOnly=false] Specifies whether only the time of the Item should be compared or the date and time. * @param {string} [triggerName] the optional name of the trigger to create */ -const DateTimeTrigger = (itemName, timeOnly = false, triggerName) => createTrigger('timer.DateTimeTrigger', triggerName, { - itemName: itemName, - timeOnly: timeOnly -}); +const DateTimeTrigger = (itemName, timeOnly = false, triggerName) => { + typeOfArguments([itemName, timeOnly, triggerName], ['string', 'boolean|undefined', 'string|undefined']); + createTrigger('timer.DateTimeTrigger', triggerName, { + itemName: itemName, + timeOnly: timeOnly + }); +}; /** * Creates a trigger for the {@link https://openhab.org/addons/automation/pwm/ Pulse Width Modulation (PWM) Automation} add-on. diff --git a/tsconfig.json b/tsconfig.json index 825041137..a168d3c29 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,8 +3,12 @@ "include": ["**/*.js"], "exclude": [ "test/**", + "coverage/**", + "dist/**", "docs/**", - "jest.config.js" + "typeOfArguments.js", + "jest.config.js", + "webpack.config.js" ], "compilerOptions": { // Tells TypeScript to read JS files, as diff --git a/typeOfArguments.js b/typeOfArguments.js index 844fd28e9..83853f879 100644 --- a/typeOfArguments.js +++ b/typeOfArguments.js @@ -1,8 +1,8 @@ /** * {@link TypeOfArguments} validates the arguments' types passed to a function. * - * @private * It's functionality was inspired by the typeof-arguments npm package (https://www.npmjs.com/package/typeof-arguments). + * @private */ class TypeOfArguments { constructor (givenArray, expectedArray) { @@ -38,7 +38,7 @@ class TypeOfArguments { * {@link TypeOfArguments} validates the arguments' types passed to a function. * * A type expression accepts the following: - * - primitive types (`string`, `number`, `bigint`,`boolean`, `symbol`, `null`) except `undefined` + * - primitive types (`string`, `number`, `bigint`,`boolean`, `symbol`, `undefined`, `null`) * - `object` * - classnames (retrieved by getting constructor.name) (e.g. `Item`) * Type expressions are case-sensitive, it is possible to allow multiple types by using the `|` symbol. diff --git a/types/items/items-provider.d.ts b/types/items/items-provider.d.ts deleted file mode 100644 index 45906bab8..000000000 --- a/types/items/items-provider.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -declare class StaticItemProvider extends AbstractProvider { - items: any; - addProviderChangeListener(listener: any): void; - removeProviderChangeListener(listener: any): void; - getAll(): any; -} -declare class ManagedItemProvider extends AbstractProvider { - constructor(); - items: Set; - listeners: Set; - addProviderChangeListener(listener: any): void; - removeProviderChangeListener(listener: any): void; - add(item: any): void; - remove(itemOrName: any): void; - update(item: any): void; - getAll(): java.util.Set; -} -declare class StaticCallbackItemProvider extends AbstractProvider { - constructor(); - itemsCallbacks: any[]; - addProviderChangeListener(listener: any): void; - removeProviderChangeListener(listener: any): void; - addItemsCallback(callback: any): void; - getAll(): java.util.List; -} -import { AbstractProvider } from "../provider"; -export function staticItemProvider(items: HostItem[]): StaticItemProvider; -export function managedItemProvider(): ManagedItemProvider; -export function staticCallbackItemProvider(): StaticCallbackItemProvider; -export {}; -//# sourceMappingURL=items-provider.d.ts.map \ No newline at end of file diff --git a/types/items/items-provider.d.ts.map b/types/items/items-provider.d.ts.map deleted file mode 100644 index 2bd2fcad0..000000000 --- a/types/items/items-provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"items-provider.d.ts","sourceRoot":"","sources":["../../items/items-provider.js"],"names":[],"mappings":"AAOA;IAGI,WAAkB;IAIpB,+CACC;IAED,kDACC;IAED,cAEC;CACF;AAED;IACE,cAKC;IAHC,gBAAsB;IACtB,oBAA0B;IAI5B,+CAEC;IAED,kDAEC;IAED,qBAWC;IAED,8BAgBC;IAED,wBAQC;IAED,wBAEC;CACF;AAED;IACE,cAGC;IADC,sBAAwB;IAG1B,+CACC;IAED,kDACC;IAED,sCAEC;IAED,yBAEC;CACF;;AAQqB,0EAAwC;AAKvC,2DAA+B;AAKxB,yEAAsC"} \ No newline at end of file diff --git a/types/metadata/metadata-provider.d.ts b/types/metadata/metadata-provider.d.ts deleted file mode 100644 index be8071e92..000000000 --- a/types/metadata/metadata-provider.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Returns a new instance of StaticCallbackMetadataProvider. - * - * @private - * @returns {StaticCallbackMetadataProvider} - */ -export function staticCallbackMetadataProvider(): StaticCallbackMetadataProvider; -declare class StaticCallbackMetadataProvider extends AbstractProvider { - constructor(); - metadataCallbacks: any[]; - addProviderChangeListener(listener: any): void; - removeProviderChangeListener(listener: any): void; - addMetadataCallback(callback: any): void; - getAll(): java.util.List; -} -import { AbstractProvider } from "../provider"; -export {}; -//# sourceMappingURL=metadata-provider.d.ts.map \ No newline at end of file diff --git a/types/metadata/metadata-provider.d.ts.map b/types/metadata/metadata-provider.d.ts.map deleted file mode 100644 index 70ff4eff8..000000000 --- a/types/metadata/metadata-provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"metadata-provider.d.ts","sourceRoot":"","sources":["../../metadata/metadata-provider.js"],"names":[],"mappings":"AAiCA;;;;;GAKG;AACH,kDAFa,8BAA8B,CAI1C;AApCD;IACE,cAGC;IADC,yBAA2B;IAG7B,+CACC;IAED,kDACC;IAED,yCAEC;IAED,yBASC;CACF"} \ No newline at end of file diff --git a/types/openhab-js.d.ts b/types/openhab-js.d.ts index 07db1b1f3..097e8d89b 100644 --- a/types/openhab-js.d.ts +++ b/types/openhab-js.d.ts @@ -35,4 +35,4 @@ export const utils: typeof import("./utils"); export const osgi: typeof import("./osgi"); export const cache: typeof import("./cache"); export const time: typeof import("./time"); -export {}; \ No newline at end of file +export {}; diff --git a/types/provider.d.ts b/types/provider.d.ts deleted file mode 100644 index 19169f5f4..000000000 --- a/types/provider.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class AbstractProvider { - constructor(type: any); - typeName: any; - JavaType: any; - register(): void; - hostProvider: any; - processHostProvider(hostProvider: any): any; -} -//# sourceMappingURL=provider.d.ts.map \ No newline at end of file diff --git a/types/provider.d.ts.map b/types/provider.d.ts.map deleted file mode 100644 index 8dbd6dbe4..000000000 --- a/types/provider.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../provider.js"],"names":[],"mappings":"AAeA;IACE,uBAGC;IAFC,cAAoC;IACpC,cAAiC;IAGnC,iBAgBC;IAHC,kBAAgC;IAKlC,4CAEC;CACF"} \ No newline at end of file diff --git a/types/rules/trigger-builder.d.ts b/types/rules/trigger-builder.d.ts index 746d529d7..baefdf2b7 100644 --- a/types/rules/trigger-builder.d.ts +++ b/types/rules/trigger-builder.d.ts @@ -9,7 +9,7 @@ export class CronTriggerConfig { constructor(timeStr: any, triggerBuilder: any); timeStr: any; _complete: () => boolean; - _toOHTriggers: () => HostTrigger[]; + _toOHTriggers: () => void[]; describe: (compact: any) => string; } /** @@ -20,7 +20,7 @@ export class CronTriggerConfig { export class ChannelTriggerConfig { constructor(channelName: any, triggerBuilder: any); channelName: any; - _toOHTriggers: () => HostTrigger[]; + _toOHTriggers: () => void[]; describe(compact: any): string; /** * trigger a specific event name @@ -105,7 +105,7 @@ export class ItemTriggerConfig { */ for(timespan: any): TriggerBuilder.ItemTriggerConfig; _complete(): boolean; - _toOHTriggers(): HostTrigger[]; + _toOHTriggers(): void[]; _executeHook(): (next: any, args: any) => any; } /** @@ -147,7 +147,7 @@ export class ThingTriggerConfig { */ to(value: any): TriggerBuilder.ThingTriggerConfig; to_value: any; - _toOHTriggers(): HostTrigger[]; + _toOHTriggers(): void[]; } /** * System based trigger @@ -158,7 +158,7 @@ export class ThingTriggerConfig { */ export class SystemTriggerConfig { constructor(triggerBuilder: any); - _toOHTriggers: () => HostTrigger[]; + _toOHTriggers: () => void[]; describe: (compact: any) => string; _complete(): boolean; /** diff --git a/types/rules/trigger-builder.d.ts.map b/types/rules/trigger-builder.d.ts.map index cdfb94383..1ca9ba475 100644 --- a/types/rules/trigger-builder.d.ts.map +++ b/types/rules/trigger-builder.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"trigger-builder.d.ts","sourceRoot":"","sources":["../../rules/trigger-builder.js"],"names":[],"mappings":"AAoLA;;;;;;GAMG;AACH;IACE,+CAMC;IAJC,aAAsB;IACtB,yBAA2B;IAC3B,mCAAsE;IACtE,mCAAgG;CAEnG;AA7DD;;;;GAIG;AACH;IACE,mDAIC;IAFC,iBAA8B;IAC9B,mCAA2F;IAG7F,+BAMC;IAED;;;;;SAKK;IACL,cAHa,MAAM,uCAKlB;IAED;;;;;SAKK;IACL,qBAHa,MAAM,uCAMlB;IAFC,kBAAgC;IAIlC,qBAEC;CACF;AAmBD;;;;;;GAMG;AACH;IACE,gEAUC;IARC,aAAyC;IAKzC,eAA2B;IA0F7B,+BA6BC;IArHC,qDAAiB;IAGnB;;;;;SAKK;IACL,iDAGC;IAFC,cAAqB;IAIvB;;;;SAIK;IACL,mDAMC;IAFC,gBAAuB;IAIzB;;;;SAIK;IACL,0CAEC;IAED;;;;SAIK;IACL,yCAEC;IAED;;;;SAIK;IACL,oDAGC;IAFC,gBAAgC;IAIlC;;;;SAIK;IACL,mDAGC;IAED;;;;SAIK;IACL,4CAGC;IAED;;;;SAIK;IACL,qDAEC;IAED,qBAEC;IAiCD,+BAwBC;IAED,8CAgBC;CACF;AAED;;;;;;GAMG;AACH;IACE,gDAGC;IADC,cAAwB;IAG1B,qBAEC;IAED,+BAmBC;IAED;;;;SAIK;IACL,6CAGC;IAFC,gBAAwB;IAI1B;;;;SAIK;IACL,6CAGC;IAED;;;;SAIK;IACL,oDAMC;IAFC,gBAAuB;IAIzB;;;;SAIK;IACL,kDAGC;IAFC,cAAqB;IAIvB,+BASC;CACF;AAED;;;;;;GAMG;AACH;IACE,iCAIC;IAFC,mCAAyE;IACzE,mCAA8F;IAGhG,qBAEC;IAED;;;;SAIK;IACL,kDAEC;IAED;;;;SAIK;IACL,wDAEC;IAED;;;;SAIK;IACL,4DAEC;IAED;;;;SAIK;IACL,wDAEC;IAED;;;;SAIK;IACL,sDAEC;IAED;;;;SAIK;IACL,2DAMC;IAFC,WAAkB;CAGrB;AA9hBD;;;;GAIG;AACH;IACE,0BAEC;IADC,aAAsB;IAGxB,+BAGC;IAFC,mBAA4B;IAI9B,sBAGC;IAED,4CAGC;IAED,0CAGC;IAED;;;;;SAKK;IACL,qDAEC;IAED;;;;;SAKK;IACL,+CAEC;IAED;;;;;SAKK;IACL,+CAEC;IAED;;;;;SAKK;IACL,mDAEC;IAED;;;;;SAKK;IACL,iDAEC;IAED;;;;;SAKK;IACL,6CAEC;CACF"} \ No newline at end of file +{"version":3,"file":"trigger-builder.d.ts","sourceRoot":"","sources":["../../rules/trigger-builder.js"],"names":[],"mappings":"AAoLA;;;;;;GAMG;AACH;IACE,+CAMC;IAJC,aAAsB;IACtB,yBAA2B;IAC3B,4BAAsE;IACtE,mCAAgG;CAEnG;AA7DD;;;;GAIG;AACH;IACE,mDAIC;IAFC,iBAA8B;IAC9B,4BAA2F;IAG7F,+BAMC;IAED;;;;;SAKK;IACL,cAHa,MAAM,uCAKlB;IAED;;;;;SAKK;IACL,qBAHa,MAAM,uCAMlB;IAFC,kBAAgC;IAIlC,qBAEC;CACF;AAmBD;;;;;;GAMG;AACH;IACE,gEAUC;IARC,aAAyC;IAKzC,eAA2B;IA0F7B,+BA6BC;IArHC,qDAAiB;IAGnB;;;;;SAKK;IACL,iDAGC;IAFC,cAAqB;IAIvB;;;;SAIK;IACL,mDAMC;IAFC,gBAAuB;IAIzB;;;;SAIK;IACL,0CAEC;IAED;;;;SAIK;IACL,yCAEC;IAED;;;;SAIK;IACL,oDAGC;IAFC,gBAAgC;IAIlC;;;;SAIK;IACL,mDAGC;IAED;;;;SAIK;IACL,4CAGC;IAED;;;;SAIK;IACL,qDAEC;IAED,qBAEC;IAiCD,wBAwBC;IAED,8CAgBC;CACF;AAED;;;;;;GAMG;AACH;IACE,gDAGC;IADC,cAAwB;IAG1B,qBAEC;IAED,+BAmBC;IAED;;;;SAIK;IACL,6CAGC;IAFC,gBAAwB;IAI1B;;;;SAIK;IACL,6CAGC;IAED;;;;SAIK;IACL,oDAMC;IAFC,gBAAuB;IAIzB;;;;SAIK;IACL,kDAGC;IAFC,cAAqB;IAIvB,wBASC;CACF;AAED;;;;;;GAMG;AACH;IACE,iCAIC;IAFC,4BAAyE;IACzE,mCAA8F;IAGhG,qBAEC;IAED;;;;SAIK;IACL,kDAEC;IAED;;;;SAIK;IACL,wDAEC;IAED;;;;SAIK;IACL,4DAEC;IAED;;;;SAIK;IACL,wDAEC;IAED;;;;SAIK;IACL,sDAEC;IAED;;;;SAIK;IACL,2DAMC;IAFC,WAAkB;CAGrB;AA9hBD;;;;GAIG;AACH;IACE,0BAEC;IADC,aAAsB;IAGxB,+BAGC;IAFC,mBAA4B;IAI9B,sBAGC;IAED,4CAGC;IAED,0CAGC;IAED;;;;;SAKK;IACL,qDAEC;IAED;;;;;SAKK;IACL,+CAEC;IAED;;;;;SAKK;IACL,+CAEC;IAED;;;;;SAKK;IACL,mDAEC;IAED;;;;;SAKK;IACL,iDAEC;IAED;;;;;SAKK;IACL,6CAEC;CACF"} \ No newline at end of file diff --git a/types/triggers.d.ts b/types/triggers.d.ts index 5d6fe7f0b..b0915ed6d 100644 --- a/types/triggers.d.ts +++ b/types/triggers.d.ts @@ -10,7 +10,7 @@ * @param {string} [triggerName] the optional name of the trigger to create * */ -export function ChannelEventTrigger(channel: string, event: string, triggerName?: string): HostTrigger; +export function ChannelEventTrigger(channel: string, event: string, triggerName?: string): void; /** * Creates a trigger that fires upon an Item changing state. * @@ -21,12 +21,12 @@ export function ChannelEventTrigger(channel: string, event: string, triggerName? * ItemStateChangeTrigger('my_item', 'OFF', null); // changed from OFF * * @memberof triggers - * @param {string} itemName the name of the Item to monitor for change + * @param {Item|string} itemOrName the {@link Item} or the name of the Item to monitor for change * @param {string} [oldState] the previous state of the Item * @param {string} [newState] the new state of the Item * @param {string} [triggerName] the optional name of the trigger to create */ -export function ItemStateChangeTrigger(itemName: string, oldState?: string, newState?: string, triggerName?: string): HostTrigger; +export function ItemStateChangeTrigger(itemOrName: any | string, oldState?: string, newState?: string, triggerName?: string): void; /** * Creates a trigger that fires upon an Item receiving a state update. Note that the Item does not need to change state. * @@ -35,11 +35,11 @@ export function ItemStateChangeTrigger(itemName: string, oldState?: string, newS * ItemStateUpdateTrigger('my_item', 'OFF'); // received update OFF * * @memberof triggers - * @param {string} itemName the name of the Item to monitor for change + * @param {Item|string} itemOrName the {@link Item} or the name of the Item to monitor for change * @param {string} [state] the new state of the Item * @param {string} [triggerName] the optional name of the trigger to create */ -export function ItemStateUpdateTrigger(itemName: string, state?: string, triggerName?: string): HostTrigger; +export function ItemStateUpdateTrigger(itemOrName: any | string, state?: string, triggerName?: string): void; /** * Creates a trigger that fires upon an Item receiving a command. Note that the Item does not need to change state. * @@ -48,50 +48,50 @@ export function ItemStateUpdateTrigger(itemName: string, state?: string, trigger * ItemCommandTrigger('my_item', 'OFF'); // received command OFF * * @memberof triggers - * @param {string} itemName the name of the Item to monitor for change + * @param {Item|string} itemOrName the {@link Item} or the name of the Item to monitor for change * @param {string} [command] the command received * @param {string} [triggerName] the optional name of the trigger to create */ -export function ItemCommandTrigger(itemName: string, command?: string, triggerName?: string): HostTrigger; +export function ItemCommandTrigger(itemOrName: any | string, command?: string, triggerName?: string): void; /** - * Creates a trigger that fires upon a member of a group changing state. + * Creates a trigger that fires upon a member of a group changing state. Note that group Item does not need to change state. * * @example * GroupStateChangeTrigger('my_group', 'OFF', 'ON'); * * @memberof triggers - * @param {string} groupName the name of the group to monitor for change + * @param {Item|string} groupOrName the group {@link Item} or the name of the group to monitor for change * @param {string} [oldState] the previous state of the group * @param {string} [newState] the new state of the group * @param {string} [triggerName] the optional name of the trigger to create */ -export function GroupStateChangeTrigger(groupName: string, oldState?: string, newState?: string, triggerName?: string): HostTrigger; +export function GroupStateChangeTrigger(groupOrName: any | string, oldState?: string, newState?: string, triggerName?: string): void; /** - * Creates a trigger that fires upon a member of a group receiving a state update. Note that group item does not need to change state. + * Creates a trigger that fires upon a member of a group receiving a state update. Note that group Item does not need to change state. * * @example * GroupStateUpdateTrigger('my_group', 'OFF'); * * @memberof triggers - * @param {string} groupName the name of the group to monitor for change + * @param {Item|string} groupOrName the group {@link Item} or the name of the group to monitor for change * @param {string} [state] the new state of the group * @param {string} [triggerName] the optional name of the trigger to create */ -export function GroupStateUpdateTrigger(groupName: string, state?: string, triggerName?: string): HostTrigger; +export function GroupStateUpdateTrigger(groupOrName: any | string, state?: string, triggerName?: string): void; /** - * Creates a trigger that fires upon a member of a group receiving a command. Note that the group does not need to change state. + * Creates a trigger that fires upon a member of a group receiving a command. Note that the group Item does not need to change state. * * @example * GroupCommandTrigger('my_group', 'OFF'); * * @memberof triggers - * @param {string} groupName the name of the group to monitor for change + * @param {Item|string} groupOrName the group {@link Item} or the name of the group to monitor for commands * @param {string} [command] the command received * @param {string} [triggerName] the optional name of the trigger to create */ -export function GroupCommandTrigger(groupName: string, command?: string, triggerName?: string): HostTrigger; +export function GroupCommandTrigger(groupOrName: any | string, command?: string, triggerName?: string): void; /** - * Creates a trigger that fires upon an Thing status updating + * Creates a trigger that fires upon a Thing status updating. * * @example * ThingStatusUpdateTrigger('some:thing:uuid', 'OFFLINE'); @@ -101,9 +101,9 @@ export function GroupCommandTrigger(groupName: string, command?: string, trigger * @param {string} [status] the optional status to monitor for * @param {string} [triggerName] the optional name of the trigger to create */ -export function ThingStatusUpdateTrigger(thingUID: string, status?: string, triggerName?: string): HostTrigger; +export function ThingStatusUpdateTrigger(thingUID: string, status?: string, triggerName?: string): void; /** - * Creates a trigger that fires upon an Thing status changing + * Creates a trigger that fires upon a Thing status changing. * * @example * ThingStatusChangeTrigger('some:thing:uuid', 'ONLINE', 'OFFLINE'); @@ -114,7 +114,7 @@ export function ThingStatusUpdateTrigger(thingUID: string, status?: string, trig * @param {string} [previousStatus] the optional previous state to monitor from * @param {string} [triggerName] the optional name of the trigger to create */ -export function ThingStatusChangeTrigger(thingUID: string, status?: string, previousStatus?: string, triggerName?: string): HostTrigger; +export function ThingStatusChangeTrigger(thingUID: string, status?: string, previousStatus?: string, triggerName?: string): void; /** * Creates a trigger that fires if a given start level is reached by the system * @@ -130,10 +130,10 @@ export function ThingStatusChangeTrigger(thingUID: string, status?: string, prev * SystemStartlevelTrigger(100) // Startup Complete * * @memberof triggers - * @param {string} startlevel the system start level to be triggered on + * @param {string|number} startlevel the system start level to be triggered on * @param {string} [triggerName] the optional name of the trigger to create */ -export function SystemStartlevelTrigger(startlevel: string, triggerName?: string): HostTrigger; +export function SystemStartlevelTrigger(startlevel: string | number, triggerName?: string): void; /** * Creates a trigger that fires on a cron schedule. The supplied cron expression defines when the trigger will fire. * @@ -144,7 +144,7 @@ export function SystemStartlevelTrigger(startlevel: string, triggerName?: string * @param {string} expression the cron expression defining the triggering schedule * @param {string} [triggerName] the optional name of the trigger to create */ -export function GenericCronTrigger(expression: string, triggerName?: string): HostTrigger; +export function GenericCronTrigger(expression: string, triggerName?: string): void; /** * Creates a trigger that fires daily at a specific time. The supplied time defines when the trigger will fire. * @@ -155,7 +155,7 @@ export function GenericCronTrigger(expression: string, triggerName?: string): Ho * @param {string} time the time expression defining the triggering schedule * @param {string} [triggerName] the optional name of the trigger to create */ -export function TimeOfDayTrigger(time: string, triggerName?: string): HostTrigger; +export function TimeOfDayTrigger(time: string, triggerName?: string): void; /** * Creates a trigger that fires at a (optional) date and time specified in an DateTime Item. * @@ -167,7 +167,7 @@ export function TimeOfDayTrigger(time: string, triggerName?: string): HostTrigge * @param {boolean} [timeOnly=false] Specifies whether only the time of the Item should be compared or the date and time. * @param {string} [triggerName] the optional name of the trigger to create */ -export function DateTimeTrigger(itemName: string, timeOnly?: boolean, triggerName?: string): HostTrigger; +export function DateTimeTrigger(itemName: string, timeOnly?: boolean, triggerName?: string): void; /** * Creates a trigger for the {@link https://openhab.org/addons/automation/pwm/ Pulse Width Modulation (PWM) Automation} add-on. * diff --git a/types/triggers.d.ts.map b/types/triggers.d.ts.map index 250508458..c7f968c55 100644 --- a/types/triggers.d.ts.map +++ b/types/triggers.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../triggers.js"],"names":[],"mappings":"AAoCA;;;;;;;;;;;GAWG;AACH,6CALW,MAAM,SACN,MAAM,gBACN,MAAM,eAMf;AAEF;;;;;;;;;;;;;;GAcG;AACH,iDALW,MAAM,aACN,MAAM,aACN,MAAM,gBACN,MAAM,eAMf;AAEF;;;;;;;;;;;GAWG;AACH,iDAJW,MAAM,UACN,MAAM,gBACN,MAAM,eAKf;AAEF;;;;;;;;;;;GAWG;AACH,6CAJW,MAAM,YACN,MAAM,gBACN,MAAM,eAKf;AAEF;;;;;;;;;;;GAWG;AACH,mDALW,MAAM,aACN,MAAM,aACN,MAAM,gBACN,MAAM,eAMf;AAEF;;;;;;;;;;GAUG;AACH,mDAJW,MAAM,UACN,MAAM,gBACN,MAAM,eAKf;AAEF;;;;;;;;;;GAUG;AACH,+CAJW,MAAM,YACN,MAAM,gBACN,MAAM,eAKf;AAEF;;;;;;;;;;GAUG;AACH,mDAJW,MAAM,WACN,MAAM,gBACN,MAAM,eAKf;AAEF;;;;;;;;;;;GAWG;AACH,mDALW,MAAM,WACN,MAAM,mBACN,MAAM,gBACN,MAAM,eAMf;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,oDAHW,MAAM,gBACN,MAAM,eAIf;AAEF;;;;;;;;;GASG;AACH,+CAHW,MAAM,gBACN,MAAM,eAIf;AAEF;;;;;;;;;GASG;AACH,uCAHW,MAAM,gBACN,MAAM,eAIf;AAEF;;;;;;;;;;GAUG;AACH,0CAJW,MAAM,aACN,OAAO,gBACP,MAAM,eAKf;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,0CAPW,MAAM,YACN,MAAM,iBACN,MAAM,iBACN,MAAM,kBACN,MAAM,gBACN,MAAM,eAQf;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,sCAhBW,MAAM,gBACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,mBACN,MAAM,aACN,MAAM,gBACN,MAAM,qBACN,MAAM,qBACN,MAAM,mBACN,MAAM,mBACN,MAAM,mBACN,MAAM,uBACN,MAAM,gBACN,MAAM,eAiBf"} \ No newline at end of file +{"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../triggers.js"],"names":[],"mappings":"AAwCA;;;;;;;;;;;GAWG;AACH,6CALW,MAAM,SACN,MAAM,gBACN,MAAM,QAShB;AAED;;;;;;;;;;;;;;GAcG;AACH,mDALW,MAAK,MAAM,aACX,MAAM,aACN,MAAM,gBACN,MAAM,QAShB;AAED;;;;;;;;;;;GAWG;AACH,mDAJW,MAAK,MAAM,UACX,MAAM,gBACN,MAAM,QAQhB;AAED;;;;;;;;;;;GAWG;AACH,+CAJW,MAAK,MAAM,YACX,MAAM,gBACN,MAAM,QAQhB;AAED;;;;;;;;;;;GAWG;AACH,qDALW,MAAK,MAAM,aACX,MAAM,aACN,MAAM,gBACN,MAAM,QAShB;AAED;;;;;;;;;;GAUG;AACH,qDAJW,MAAK,MAAM,UACX,MAAM,gBACN,MAAM,QAQhB;AAED;;;;;;;;;;GAUG;AACH,iDAJW,MAAK,MAAM,YACX,MAAM,gBACN,MAAM,QAQhB;AAED;;;;;;;;;;GAUG;AACH,mDAJW,MAAM,WACN,MAAM,gBACN,MAAM,QAQhB;AAED;;;;;;;;;;;GAWG;AACH,mDALW,MAAM,WACN,MAAM,mBACN,MAAM,gBACN,MAAM,QAShB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,oDAHW,MAAM,GAAC,MAAM,gBACb,MAAM,QAOhB;AAED;;;;;;;;;GASG;AACH,+CAHW,MAAM,gBACN,MAAM,QAOhB;AAED;;;;;;;;;GASG;AACH,uCAHW,MAAM,gBACN,MAAM,QAOhB;AAED;;;;;;;;;;GAUG;AACH,0CAJW,MAAM,aACN,OAAO,gBACP,MAAM,QAQhB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,0CAPW,MAAM,YACN,MAAM,iBACN,MAAM,iBACN,MAAM,kBACN,MAAM,gBACN,MAAM,eAQf;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,sCAhBW,MAAM,gBACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,mBACN,MAAM,aACN,MAAM,gBACN,MAAM,qBACN,MAAM,qBACN,MAAM,mBACN,MAAM,mBACN,MAAM,mBACN,MAAM,uBACN,MAAM,gBACN,MAAM,eAiBf"} \ No newline at end of file diff --git a/types/typeOfArguments.d.ts b/types/typeOfArguments.d.ts index 8c7c82489..c7aea173f 100644 --- a/types/typeOfArguments.d.ts +++ b/types/typeOfArguments.d.ts @@ -3,7 +3,7 @@ export = typeOfArguments; * {@link TypeOfArguments} validates the arguments' types passed to a function. * * A type expression accepts the following: - * - primitive types (`string`, `number`, `bigint`,`boolean`, `symbol`, `null`) except `undefined` + * - primitive types (`string`, `number`, `bigint`,`boolean`, `symbol`, `undefined`, `null`) * - `object` * - classnames (retrieved by getting constructor.name) (e.g. `Item`) * Type expressions are case-sensitive, it is possible to allow multiple types by using the `|` symbol. @@ -17,8 +17,8 @@ declare function typeOfArguments(givenArray: any[], expectedArray: any[]): TypeO /** * {@link TypeOfArguments} validates the arguments' types passed to a function. * - * @private * It's functionality was inspired by the typeof-arguments npm package (https://www.npmjs.com/package/typeof-arguments). + * @private */ declare class TypeOfArguments { constructor(givenArray: any, expectedArray: any); diff --git a/types/webpack.config.d.ts b/types/webpack.config.d.ts deleted file mode 100644 index 33bc76699..000000000 --- a/types/webpack.config.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -export const entry: string; -export const mode: string; -export const externals: { - '@runtime': { - root: string; - commonjs: string; - commonjs2: string; - amd: string; - }; - '@runtime/cache': { - root: string; - commonjs: string; - commonjs2: string; - amd: string; - }; - '@runtime/Defaults': { - root: string; - commonjs: string; - commonjs2: string; - amd: string; - }; - '@runtime/provider': { - root: string; - commonjs: string; - commonjs2: string; - amd: string; - }; - '@runtime/RuleSupport': { - root: string; - commonjs: string; - commonjs2: string; - amd: string; - }; - '@runtime/osgi': { - root: string; - commonjs: string; - commonjs2: string; - amd: string; - }; -}[]; -export namespace output { - const path: string; - const filename: string; - namespace library { - const name: string; - const type: string; - } - const globalObject: string; -} -//# sourceMappingURL=webpack.config.d.ts.map \ No newline at end of file diff --git a/types/webpack.config.d.ts.map b/types/webpack.config.d.ts.map deleted file mode 100644 index 6b6c8990c..000000000 --- a/types/webpack.config.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"webpack.config.d.ts","sourceRoot":"","sources":["../webpack.config.js"],"names":[],"mappings":""} \ No newline at end of file