From 1fe79d8654f26d27e8601c3fea888667a9d4cf7f Mon Sep 17 00:00:00 2001
From: Bharat Raju This module provides queries for ZCL loading This module provides notification related queries. This module provides package notification related queries. This module provides queries related to packages. This module provides session notification related queries. This module provides queries for ZCL static entities
inside a single session. Things like:
@@ -76,6 +79,10 @@ inside a single session. Things like:
This module provides queries for enums. This module provides a place for creating generic queries which are common
+across different query files. This module provides queries for ZCL static queries.
Global function that can be overloaded by jxbrowser for notifications
This module provides the APIs for initializing timers specifically +for sessions.
+Copyright (c) 2020 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2020 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+This module provides queries for discriminators
Copyright (c) 2023 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2020 Silicon Labs
Licensed under the Apache License, Version 2.0 (the "License"); @@ -374,6 +428,19 @@ scripting functionality.
See the License for the specific language governing permissions and limitations under the License.Copyright (c) 2023 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2020 Silicon Labs
Licensed under the Apache License, Version 2.0 (the "License"); @@ -426,6 +493,32 @@ scripting functionality.
See the License for the specific language governing permissions and limitations under the License.Copyright (c) 2020 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2020 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2020 Silicon Labs
Licensed under the Apache License, Version 2.0 (the "License"); @@ -445,10 +538,75 @@ scripting functionality.
modify this file, but it can be used to extend your development environment.Copyright (c) 2020 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2020 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2024 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2024 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+This module provides API to access various iterator utilities that can then be used to build iterator helpers.
Copyright (c) 2021 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2022 Silicon Labs
Licensed under the Apache License, Version 2.0 (the "License"); @@ -462,6 +620,19 @@ be used to build iterator helpers.
See the License for the specific language governing permissions and limitations under the License.Copyright (c) 2023 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2020 Silicon Labs
Licensed under the Apache License, Version 2.0 (the "License"); @@ -475,6 +646,10 @@ be used to build iterator helpers.
See the License for the specific language governing permissions and limitations under the License.This module provides the APIs for validating inputs to the database, and returning flags indicating if +things were successful or not.
+This module provides the APIs for validating inputs to the database, and returning flags indicating if things were successful or not.
@@ -492,6 +667,19 @@ things were successful or not. See the License for the specific language governing permissions and limitations under the License.Copyright (c) 2023 Silicon Labs
+Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License.
+Copyright (c) 2020 Silicon Labs
Licensed under the Apache License, Version 2.0 (the "License"); @@ -523,6 +711,24 @@ things were successful or not.
## FunctionsInitializes and connects a client.
+Register a handler for the event type.
+Get the last pong data.
+Returns true if client is connected.
+Disconnects a client asynchronously.
+Sends a message to server.
+Creates array of profileId fields on endpoints
Creates Integer Array of parent endpoint identifier fields on endpoints. If the Parent Endpoint is not set then it will default to 0.
+Creates array of networkId fields on endpoints
Helper that deals with the type of the argument.
Boolean deciding whether Studio integration logic should be enabled
+Resolves into true if user has actively disabled the component toggling. +By default this row doesn't even exist in the DB, but if user toggles +the toggle to turn this off, then the "disableComponentToggling" will +be set so '1' in the database.
+Studio REST API path helper/generator
+Studio WebSocket API path helper/generator
+Send HTTP GET request to Studio Jetty server for project information.
+*
Send HTTP Post to update UC component state in Studio
+*
Send HTTP Post to update UC component state in Studio
+Handles WebSocket messages from Studio server
+Start the dirty flag reporting interval.
+Check WebSocket connections between backend and Studio jetty server. +If project is opened, verify connection is open. +If project is closed, close ws connection as well.
+Utility function for making websocket connection to Studio server
+Check if a specific Studio project (.slcp) file has been opened or not.
+Context: To get proper WebSocket notification for change in project states, + that specific project needs to be opened already. Otherwise, no notification + will happen.
+ DependsComponent API used as a quick way to check if the project is opened or not
+ If project is open/valid, the API will respond with "Component not found in project"
+ Otherwise, "Project does not exists"
+
+Clears up the reporting interval.
+Notify front-end that current session failed to load.
+Notify front-end that current session failed to load.
+Resolves to an array of endpoint types.
Given a database and a session id, this method returns a promise that resolves with a state object that needs to be saved into a file.
This function gets the state from database and converts it for a given file format.
+Updates the clusters with the new command format where there is isIncoming +and isEnabled instead of incoming and outgoing
+This function gets the JSON from the file, and converts it to the correct database state
+Locates or adds an attribute, and returns it. at contains clusterId, attributeId, isClient, mfgCode and possibly value
@@ -830,18 +1106,76 @@ Session at this point is blank, and has no packages.Auto-load package. If succesful it returns an object. Otherwise it throws an exception.
Resolves into a { packageId:, packageType:}
+object, pkg haspath
, version
, type
. It can ALSO have pathRelativity. If pathRelativity is missing
+path is considered absolute.
Convert the array of results into a more palatable value. Resolves an array of { packageId:, packageType:} objects into { zclPackageId: id, templateIds: [] }
Sorts the list of endpoints
+Imports the clusters for an endpoint type along with attributes, commands +and events
+Imports the list of commands from a cluster
+Imports the list of attributes from a cluster
+Imports the list of events from a cluster
+Retrieves the mandatory attributes of a cluster
+Retrieves the mandatory commands of a cluster
+Adds cluster compliance warnings for attributes to the console and the +session notification table
+Adds cluster compliance warnings for commands to the console and the +session notification table
+Retrieves deviceTypeClustersOnEndpointType, deviceTypeAttributesOnEndpointType +and deviceTypeCommandsOnEndpointType for an endpoint type
+Adds device type compliance warnings for clusters to the console and the +session notification table
+Adds device type compliance warnings for attributes to the console and the +session notification table
+Adds device type compliance warnings for commands to the console and the +session notification table
+Import endpointTypes
+Given a state object, this method returns a promise that resolves with the succesfull writing into the database.
Parses JSON file and creates a state object out of it, which is passed further down the chain.
Reads the data from the file and resolves with the state object if all is good.
Default startup method.
Starts a zap watchdog.
+Resets a zap watchdog.
+Promise.<Array>
Fetches forced external storage settings based on the given package ID. +Utilizes the attribute access interface to query storage policies +associated with the specified package ID.
+This function takes a clusterId (the database ID, not the specification-defined ID), an array of attributes (associated with the database defined clusterID), +and a packageId to identify the specific package the attributes belong to. It changes the global attributes (attributes with specification defined clusterId = null) to represent storage policy +based on the cluster/attribute pair in zcl.json.
+Although the specification defined clusterID of the attribute is null indicating it is a global attribute, we know what the database defined clusterID is by what is passed in as a parameter.
+That database defined clusterID is used to query the name of the cluster which is in turn used to compute the storage policy for that cluster/attribute pair based on the packageId.
+This asynchronous function computes and returns the new configuration for a storage option.
+This asynchronous function computes and returns the new configuration for a storage policy.
+This asynchronous function computes and returns the updated storage import policy.
+Returns the socket path for the IPC.
+Runs just before every time IPC request is processed.
+IPC initialization.
+Returns true if server is running.
+Shuts down the IPC server.
+Call this function to create a new or show an existing preference window.
+Hook up all the events for the electron app object.
+Perform a file->open operation.
Initial menu show.
Helper for add_user_cluster_commands that does all the work except the -collectBlocks. This allows other iterators to further filter the list -before doing collectBlocks.
+Simple dialog to show error messages from electron renderer scope.
Start session specific validation.
+Process a single file, parsing it in as JSON and then possibly opening +a new window if all is good.
Promises to read the properties file, extract all the actual xml files, and resolve with the array of files.
+Creates a new window with a blank configuration.
Promises to iterate over all the XML files and returns an aggregate promise -that will be resolved when all the XML files are done, or rejected if at least one fails.
+Toggles the dirty flag.
The Dotdot ZCL XML doesn't use the 0x prefix, but it's a nice thing to have and Silabs xml -does use this so this helper function normalizes the use of hex
-TODO: Is this the right thing to do?
+This function should be invoked as a result of the fileBrowse +notification via the renderer API. It pops the open dialog and +reports result back through the API.
The Dotdot ZCL XML doesn't have a length but it is embedded in the short name, -we can scrape the value to get the size
-TODO: Is this the right thing to do?
+Electron UI initialization.
+Note: You might be tempted to pass db
to this function. Don't.
+That was done before and it's just a lazy way to cut through the
+layers between UI and back-end. Should not be done. Any information
+UI needs from the database should be retrieved via renderer API.
Prepare XML attributes for entry into the DB
+Create a window, possibly with a given file path.
Prepare XML commands for entry into the DB
+Process the command line arguments and resets the state in this file +to the specified values.
Prepare XML cluster for insertion into the database. -This method can also prepare clusterExtensions.
+Takes an int8 value and turns it into a hex.
Parses xml type into the atomic object for insertion into the DB
+Takes an int16 value and turns it into a hex.
Parses xml type into the bitmap object for insertion into the DB
+Takes an int32 value and turns it into a hex.
Converts a string to the hex value.
+Given a number, this function returns the number of bits set in the number
+Takes the raw hex string, such as abcd
and
+converts it into a C constant array, such as
+0xAB, 0xCD
.
Getting a binary string ("0001101010010") it returns the number of zero bits at the end.
+Convert a hex number to a binary. Hex has to be in a format +as obtained by intToHex methods above: no '0x' prefix and upper-case +letters, as in "12AB".
+Returns string as C bytes, prefixed with one-byte length. +If maxLength is greater than length of value, then +the resulting array is padded with 0x00.
+Returns string as C bytes, prefixed with two-byte length +If maxLength is greater than length of value, then +the resulting array is padded with 0x00.
+Used to retrive zcl-special.json by zcl reload test in zcl-loader.test.js
+Used to retrive general-special.xml by zcl reload test in zcl-loader.test.js
+Set the state directory. This method is intended to be called +only at the application startup, when CLI args are being parsed. +This method honors '~/' being the first characters in its argument.
+Returns an app directory. It creates it, if it doesn't exist
+Returns a version as a single on-line string.
+This function locates a resource in the project, such as various +JSON files and zcl-builtin stuff.
+It needs to adapt to a change in path that can occur when +things are copied into the dist/ directory.
+Returns the zap version.
+Prints the data to stderr, without much fuss.
+Base level common logger.
+Info level message.
+Error level message.
+Warning level message.
+Sql level message.
+Browser level message.
+IPC level message.
+Debug level message.
+Returns true if versions of node and electron are matching. +If versions are not matching, it prints out a warhing +and returns false.
+Returns path to HTTP static content while taking into account DEV / PROD modes.
+Returns all available clusters.
+Returns all available events.
+Returns all available commands.
+Returns all available attributes.
+function
Wraps a helper function to add usage tracking and error handling.
+Registers a helper function.
+Promise
Executes a helper function from a script file.
+Helper for add_user_cluster_commands that does all the work except the +collectBlocks. This allows other iterators to further filter the list +before doing collectBlocks.
+Executes a named function from a given script. +Arguments passed to the function are: + api: which is the result of require('script-api.js') + context: which contains 'db', 'sessionId', etc.
+Extract project name from the Studio project path
+Start session specific validation.
+Main attribute validation function. +Returns a promise of an object which stores a list of validational issues. +Such issues as "Invalid type" or "Out of Range".
+Checks the attributes type then validates the incoming input string.
+Expects a number string , parse it back on a default base 10 if its a decimal. +If its a hexadecimal or anything else , parse it back on base 16. +Loses precision after javascripts Number.MAX_SAFE_INTEGER range.
+Converts an unsigned integer to its signed value. Returns the same integer if its not a signed type. +Works for both BigInts and regular numbers.
+Converts an attribute (number string) into a decimal number without losing precision. +Accepts both decimal and hexadecimal strings (former has priority) in any bit representation. +Shifts signed hexadecimals to their correct value.
+*
Returns information about an integer type.
+Checks if the incoming integer is within it's attributes bound while handling signed and unsigned cases.
+Promises to read the properties file, extract all the actual xml files, and resolve with the array of files.
+Promises to iterate over all the XML files and returns an aggregate promise +that will be resolved when all the XML files are done, or rejected if at least one fails.
+The Dotdot ZCL XML doesn't use the 0x prefix, but it's a nice thing to have and Silabs xml +does use this so this helper function normalizes the use of hex
+TODO: Is this the right thing to do?
+The Dotdot ZCL XML doesn't have a length but it is embedded in the short name, +we can scrape the value to get the size
+TODO: Is this the right thing to do?
+Prepare XML attributes for entry into the DB
+Prepare XML commands for entry into the DB
+Prepare XML cluster for insertion into the database. +This method can also prepare clusterExtensions.
+Parses xml type into the atomic object for insertion into the DB
+Parses xml type into the bitmap object for insertion into the DB
+Parses xml type into the enum object for insertion into the DB
*
TODO This is not supported at this time.
Toplevel function that loads the xml library file and orchestrates the promise chain.
Parses the new XML files. Returns an object containing +loaded data: + clusterIdsLoaded: array of cluster ids that were loaded
+Promises to read the JSON file and resolve all the data.
Preparation step for the device types.
Process all device types.
+Promise
Processes and inserts device types into the database. +This function logs the number of device types being processed for debugging purposes. +It maps over the provided data to prepare each device type and then iterates over each prepared device type. +If a device type has a compositionType, it inserts the endpoint composition into the database, +retrieves the endpoint composition ID, and then inserts the device composition. +Finally, it inserts all prepared device types into the database.
After XML parser is done with the barebones parsing, this function @@ -1161,6 +1746,11 @@ branches the individual toplevel tags.
This function is used for parsing each individual ZCL file at a grouped zcl file package level. This should not be used for custom XML addition due to custom xmls potentially relying on existing packges.
Checks if there is a crc mismatch on any xml file. This can be used to +decide if there is a need to reload all the xml files. Also check if the +package is not loaded before.
+Promises to iterate over all the XML files and returns an aggregate promise that will be resolved when all the XML files are done, or rejected if at least one fails.
@@ -1192,6 +1782,14 @@ Key/velues of the object itself, end up in CODE/LABEL combinations.Parses the boolean options.
Promise.<void>
Asynchronously parses and inserts attribute access interface attributes into the database. +This function iterates over the attributeAccessInterfaceAttributes object, processing each cluster +by mapping its values to a specific structure and then inserting them into the database using +the insertOptionsKeyValues function.
+The main purpose of this function is to store cluster/attribute pairs including global attributes and their cluster pair +The ATTRIBUTE table has cluster_ref as null for global attributes so this second method was necessary
+Parses the default values inside the options.
If custom device is supported, then this method creates it.
Toplevel function that loads the toplevel metafile and orchestrates the promise chain.
Records the toplevel package information and resolves into packageId
Records the version into the database.
Retrieve zcl package information
+Load attribute mapping table if there is multi-protocol information from a json file.
+Toplevel function that loads the zcl file and passes it off to the correct zcl loader.
Load individual custom XML files.
Promises to qualify whether zcl file needs to be reloaded. If yes, the it will resolve with {filePath, data, packageId} If not, then it will resolve with {error}
@@ -1272,6 +1876,7 @@ This module provides generic DB functions for performing SQL queries. - [~insertOrReplaceSetting(db, version)](#module*JS API* low level database access..insertOrReplaceSetting) ⇒ - [~updateSetting(db, rows)](#module*JS API* low level database access..updateSetting) ⇒ - [~selectSettings(db)](#module*JS API* low level database access..selectSettings) ⇒ + - [~determineIfSchemaShouldLoad(db, context)](#module*JS API* low level database access..determineIfSchemaShouldLoad) ⇒ - [~loadSchema(db, schemaPath, zapVersion)](#module*JS API* low level database access..loadSchema) ⇒ - [~initDatabaseAndLoadSchema(sqliteFile, schemaFile, zapVersion)](#module*JS API* low level database access..initDatabaseAndLoadSchema) ⇒ - [~toDbBool(value)](#module*JS API* low level database access..toDbBool) ⇒ @@ -1529,6 +2134,20 @@ Returns a promise resolving the entire SETTING table | ----- | --------------- | | db |\*
|
+
+
+### JS API: low level database access~determineIfSchemaShouldLoad(db, context) ⇒
+
+Checks the state of schema.
+
+**Kind**: inner method of [JS API: low level database access
](#module*JS API* low level database access)
+**Returns**: object containing "mustLoad" and "hasSchema" elements.
+
+| Param | Type |
+| ------- | --------------- |
+| db | \*
|
+| context | \*
|
+
### JS API: low level database access~loadSchema(db, schemaPath, zapVersion) ⇒
@@ -1613,6 +2232,7 @@ This module provides cache for commonly used static database queries.
- [~disable()](#module*DB API* zcl database access..disable)
- [~selectAtomicType(db, packageId, typeName)](#module*DB API* zcl database access..selectAtomicType)
- [~selectAtomicById(db, packageId)](#module*DB API* zcl database access..selectAtomicById)
+ - [~isTypeSignedByNameAndPackage(db, name, sessionPackages)](#module*DB API* zcl database access..isTypeSignedByNameAndPackage) ⇒ Promise.<boolean>
- [~selectAllBitmaps(db)](#module*DB API* zcl database access..selectAllBitmaps) ⇒
- [~selectBitmapByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectBitmapByNameAndClusterId) ⇒
- [~selectAllEnums(db, packageId)](#module*DB API* zcl database access..selectAllEnums) ⇒
@@ -1622,10 +2242,10 @@ This module provides cache for commonly used static database queries.
- [~selectEnumById(db, id)](#module*DB API* zcl database access..selectEnumById) ⇒
- [~selectEnumByName(db, name, packageIds)](#module*DB API* zcl database access..selectEnumByName) ⇒
- [~selectEnumByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectEnumByNameAndClusterId) ⇒
- - [~selectSessionClusterByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
+ - [~selectSessionClusterByCode(db, sessionId, code, mfgCode)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
- [~selectAllSessionClusters(db, sessionId)](#module*DB API* zcl database access..selectAllSessionClusters) ⇒
- - [~selectSessionAttributeByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
- - [~selectSessionCommandByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
+ - [~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
+ - [~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
- [~selectStructByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectStructByNameAndClusterId) ⇒
- [~selectStructsWithClusterAssociation(db, packageIds, groupByStructName)](#module*DB API* zcl database access..selectStructsWithClusterAssociation) ⇒
- [~selectClusterBitmaps(db, packageId, clusterId)](#module*DB API* zcl database access..selectClusterBitmaps) ⇒
@@ -1633,10 +2253,10 @@ This module provides cache for commonly used static database queries.
- [~selectAllStructsWithItemCount(db, packageIds)](#module*DB API* zcl database access..selectAllStructsWithItemCount) ⇒
- [~selectStructClusters(db, structId)](#module*DB API* zcl database access..selectStructClusters) ⇒
- [~selectEnumClusters(db, enumId)](#module*DB API* zcl database access..selectEnumClusters) ⇒
- - [~selectBitmapClusters(db, enumId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
+ - [~selectBitmapClusters(db, bitmapId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
- [~selectClusterStructsWithItems(db)](#module*DB API* zcl database access..selectClusterStructsWithItems) ⇒
- [~selectAllStructsWithItems(db)](#module*DB API* zcl database access..selectAllStructsWithItems) ⇒
- - [~selectAllStructItemsByStructName(db, name)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
+ - [~selectAllStructItemsByStructName(db, name, packageIds, clusterName)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
- [~selectAllClusters(db)](#module*DB API* zcl database access..selectAllClusters) ⇒
- [~selectClusterByCode(db, packageId, clusterCode, mfgCode)](#module*DB API* zcl database access..selectClusterByCode) ⇒
- [~selectClusterById(db, clusterId, packageId)](#module*DB API* zcl database access..selectClusterById) ⇒
@@ -1762,6 +2382,21 @@ Retrieves atomic type by a given Id.
| db | \*
|
| packageId | \*
|
+
+
+### DB API: zcl database access~isTypeSignedByNameAndPackage(db, name, sessionPackages) ⇒ Promise.<boolean>
+
+Checks if a type by a given name is signed.
+
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise.<boolean>
- - A promise that resolves to true if the type is signed, false otherwise.
+
+| Param | Type | Description |
+| --------------- | ------------------- | ------------------------------- |
+| db | object
| The database connection object. |
+| name | string
| The name of the type. |
+| sessionPackages | Array
| An array of session packages. |
+
### DB API: zcl database access~selectAllBitmaps(db) ⇒
@@ -1895,7 +2530,7 @@ Select an enum matched by name and clusterId.
-### DB API: zcl database access~selectSessionClusterByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionClusterByCode(db, sessionId, code, mfgCode) ⇒
Returns the cluster available to this session by the code.
@@ -1906,6 +2541,8 @@ Returns the cluster available to this session by the code.
| --------- | --------------- |
| db | \*
|
| sessionId | \*
|
+| code | \*
|
+| mfgCode | \*
|
@@ -1923,31 +2560,38 @@ Returns all the clusters visible for a given session.
-### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode) ⇒
Returns the attribute available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| side | \*
|
+| attributeCode | \*
|
+| mfgCode | \*
|
-### DB API: zcl database access~selectSessionCommandByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source) ⇒
Returns the command available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| commandCode | \*
|
+| source | \*
|
@@ -2055,17 +2699,17 @@ Returns an array of clusters that enum belongs to.
-### DB API: zcl database access~selectBitmapClusters(db, enumId) ⇒
+### DB API: zcl database access~selectBitmapClusters(db, bitmapId) ⇒
-Returns an array of clusters that enum belongs to.
+Returns an array of clusters that bitmap belongs to.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: clusters
-| Param | Type |
-| ------ | --------------- |
-| db | \*
|
-| enumId | \*
|
+| Param | Type |
+| -------- | --------------- |
+| db | \*
|
+| bitmapId | \*
|
@@ -2095,15 +2739,20 @@ Retrieves all the structs in the database with the items.
-### DB API: zcl database access~selectAllStructItemsByStructName(db, name) ⇒
+### DB API: zcl database access~selectAllStructItemsByStructName(db, name, packageIds, clusterName) ⇒
+
+Retrieves the struct items based on struct and cluster name.
+Note: By default clusterName is null.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
-**Returns**: the details of the struct items given the name of the struct
+**Returns**: the details of the struct items
-| Param |
-| ----- |
-| db |
-| name |
+| Param | Default |
+| ----------- | ------------- |
+| db | |
+| name | |
+| packageIds | |
+| clusterName |
|
@@ -2245,6 +2894,7 @@ This module provides queries for atomic type queries.
- [~disable()](#module*DB API* zcl database access..disable)
- [~selectAtomicType(db, packageId, typeName)](#module*DB API* zcl database access..selectAtomicType)
- [~selectAtomicById(db, packageId)](#module*DB API* zcl database access..selectAtomicById)
+ - [~isTypeSignedByNameAndPackage(db, name, sessionPackages)](#module*DB API* zcl database access..isTypeSignedByNameAndPackage) ⇒ Promise.<boolean>
- [~selectAllBitmaps(db)](#module*DB API* zcl database access..selectAllBitmaps) ⇒
- [~selectBitmapByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectBitmapByNameAndClusterId) ⇒
- [~selectAllEnums(db, packageId)](#module*DB API* zcl database access..selectAllEnums) ⇒
@@ -2254,10 +2904,10 @@ This module provides queries for atomic type queries.
- [~selectEnumById(db, id)](#module*DB API* zcl database access..selectEnumById) ⇒
- [~selectEnumByName(db, name, packageIds)](#module*DB API* zcl database access..selectEnumByName) ⇒
- [~selectEnumByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectEnumByNameAndClusterId) ⇒
- - [~selectSessionClusterByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
+ - [~selectSessionClusterByCode(db, sessionId, code, mfgCode)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
- [~selectAllSessionClusters(db, sessionId)](#module*DB API* zcl database access..selectAllSessionClusters) ⇒
- - [~selectSessionAttributeByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
- - [~selectSessionCommandByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
+ - [~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
+ - [~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
- [~selectStructByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectStructByNameAndClusterId) ⇒
- [~selectStructsWithClusterAssociation(db, packageIds, groupByStructName)](#module*DB API* zcl database access..selectStructsWithClusterAssociation) ⇒
- [~selectClusterBitmaps(db, packageId, clusterId)](#module*DB API* zcl database access..selectClusterBitmaps) ⇒
@@ -2265,10 +2915,10 @@ This module provides queries for atomic type queries.
- [~selectAllStructsWithItemCount(db, packageIds)](#module*DB API* zcl database access..selectAllStructsWithItemCount) ⇒
- [~selectStructClusters(db, structId)](#module*DB API* zcl database access..selectStructClusters) ⇒
- [~selectEnumClusters(db, enumId)](#module*DB API* zcl database access..selectEnumClusters) ⇒
- - [~selectBitmapClusters(db, enumId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
+ - [~selectBitmapClusters(db, bitmapId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
- [~selectClusterStructsWithItems(db)](#module*DB API* zcl database access..selectClusterStructsWithItems) ⇒
- [~selectAllStructsWithItems(db)](#module*DB API* zcl database access..selectAllStructsWithItems) ⇒
- - [~selectAllStructItemsByStructName(db, name)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
+ - [~selectAllStructItemsByStructName(db, name, packageIds, clusterName)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
- [~selectAllClusters(db)](#module*DB API* zcl database access..selectAllClusters) ⇒
- [~selectClusterByCode(db, packageId, clusterCode, mfgCode)](#module*DB API* zcl database access..selectClusterByCode) ⇒
- [~selectClusterById(db, clusterId, packageId)](#module*DB API* zcl database access..selectClusterById) ⇒
@@ -2394,6 +3044,21 @@ Retrieves atomic type by a given Id.
| db | \*
|
| packageId | \*
|
+
+
+### DB API: zcl database access~isTypeSignedByNameAndPackage(db, name, sessionPackages) ⇒ Promise.<boolean>
+
+Checks if a type by a given name is signed.
+
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise.<boolean>
- - A promise that resolves to true if the type is signed, false otherwise.
+
+| Param | Type | Description |
+| --------------- | ------------------- | ------------------------------- |
+| db | object
| The database connection object. |
+| name | string
| The name of the type. |
+| sessionPackages | Array
| An array of session packages. |
+
### DB API: zcl database access~selectAllBitmaps(db) ⇒
@@ -2527,7 +3192,7 @@ Select an enum matched by name and clusterId.
-### DB API: zcl database access~selectSessionClusterByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionClusterByCode(db, sessionId, code, mfgCode) ⇒
Returns the cluster available to this session by the code.
@@ -2538,6 +3203,8 @@ Returns the cluster available to this session by the code.
| --------- | --------------- |
| db | \*
|
| sessionId | \*
|
+| code | \*
|
+| mfgCode | \*
|
@@ -2555,31 +3222,38 @@ Returns all the clusters visible for a given session.
-### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode) ⇒
Returns the attribute available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| side | \*
|
+| attributeCode | \*
|
+| mfgCode | \*
|
-### DB API: zcl database access~selectSessionCommandByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source) ⇒
Returns the command available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| commandCode | \*
|
+| source | \*
|
@@ -2687,17 +3361,17 @@ Returns an array of clusters that enum belongs to.
-### DB API: zcl database access~selectBitmapClusters(db, enumId) ⇒
+### DB API: zcl database access~selectBitmapClusters(db, bitmapId) ⇒
-Returns an array of clusters that enum belongs to.
+Returns an array of clusters that bitmap belongs to.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: clusters
-| Param | Type |
-| ------ | --------------- |
-| db | \*
|
-| enumId | \*
|
+| Param | Type |
+| -------- | --------------- |
+| db | \*
|
+| bitmapId | \*
|
@@ -2727,15 +3401,20 @@ Retrieves all the structs in the database with the items.
-### DB API: zcl database access~selectAllStructItemsByStructName(db, name) ⇒
+### DB API: zcl database access~selectAllStructItemsByStructName(db, name, packageIds, clusterName) ⇒
+
+Retrieves the struct items based on struct and cluster name.
+Note: By default clusterName is null.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
-**Returns**: the details of the struct items given the name of the struct
+**Returns**: the details of the struct items
-| Param |
-| ----- |
-| db |
-| name |
+| Param | Default |
+| ----------- | ------------- |
+| db | |
+| name | |
+| packageIds | |
+| clusterName |
|
@@ -2871,6 +3550,7 @@ This module provides queries for enums.
- [~disable()](#module*DB API* zcl database access..disable)
- [~selectAtomicType(db, packageId, typeName)](#module*DB API* zcl database access..selectAtomicType)
- [~selectAtomicById(db, packageId)](#module*DB API* zcl database access..selectAtomicById)
+ - [~isTypeSignedByNameAndPackage(db, name, sessionPackages)](#module*DB API* zcl database access..isTypeSignedByNameAndPackage) ⇒ Promise.<boolean>
- [~selectAllBitmaps(db)](#module*DB API* zcl database access..selectAllBitmaps) ⇒
- [~selectBitmapByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectBitmapByNameAndClusterId) ⇒
- [~selectAllEnums(db, packageId)](#module*DB API* zcl database access..selectAllEnums) ⇒
@@ -2880,10 +3560,10 @@ This module provides queries for enums.
- [~selectEnumById(db, id)](#module*DB API* zcl database access..selectEnumById) ⇒
- [~selectEnumByName(db, name, packageIds)](#module*DB API* zcl database access..selectEnumByName) ⇒
- [~selectEnumByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectEnumByNameAndClusterId) ⇒
- - [~selectSessionClusterByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
+ - [~selectSessionClusterByCode(db, sessionId, code, mfgCode)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
- [~selectAllSessionClusters(db, sessionId)](#module*DB API* zcl database access..selectAllSessionClusters) ⇒
- - [~selectSessionAttributeByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
- - [~selectSessionCommandByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
+ - [~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
+ - [~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
- [~selectStructByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectStructByNameAndClusterId) ⇒
- [~selectStructsWithClusterAssociation(db, packageIds, groupByStructName)](#module*DB API* zcl database access..selectStructsWithClusterAssociation) ⇒
- [~selectClusterBitmaps(db, packageId, clusterId)](#module*DB API* zcl database access..selectClusterBitmaps) ⇒
@@ -2891,10 +3571,10 @@ This module provides queries for enums.
- [~selectAllStructsWithItemCount(db, packageIds)](#module*DB API* zcl database access..selectAllStructsWithItemCount) ⇒
- [~selectStructClusters(db, structId)](#module*DB API* zcl database access..selectStructClusters) ⇒
- [~selectEnumClusters(db, enumId)](#module*DB API* zcl database access..selectEnumClusters) ⇒
- - [~selectBitmapClusters(db, enumId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
+ - [~selectBitmapClusters(db, bitmapId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
- [~selectClusterStructsWithItems(db)](#module*DB API* zcl database access..selectClusterStructsWithItems) ⇒
- [~selectAllStructsWithItems(db)](#module*DB API* zcl database access..selectAllStructsWithItems) ⇒
- - [~selectAllStructItemsByStructName(db, name)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
+ - [~selectAllStructItemsByStructName(db, name, packageIds, clusterName)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
- [~selectAllClusters(db)](#module*DB API* zcl database access..selectAllClusters) ⇒
- [~selectClusterByCode(db, packageId, clusterCode, mfgCode)](#module*DB API* zcl database access..selectClusterByCode) ⇒
- [~selectClusterById(db, clusterId, packageId)](#module*DB API* zcl database access..selectClusterById) ⇒
@@ -3020,6 +3700,21 @@ Retrieves atomic type by a given Id.
| db | \*
|
| packageId | \*
|
+
+
+### DB API: zcl database access~isTypeSignedByNameAndPackage(db, name, sessionPackages) ⇒ Promise.<boolean>
+
+Checks if a type by a given name is signed.
+
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise.<boolean>
- - A promise that resolves to true if the type is signed, false otherwise.
+
+| Param | Type | Description |
+| --------------- | ------------------- | ------------------------------- |
+| db | object
| The database connection object. |
+| name | string
| The name of the type. |
+| sessionPackages | Array
| An array of session packages. |
+
### DB API: zcl database access~selectAllBitmaps(db) ⇒
@@ -3153,7 +3848,7 @@ Select an enum matched by name and clusterId.
-### DB API: zcl database access~selectSessionClusterByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionClusterByCode(db, sessionId, code, mfgCode) ⇒
Returns the cluster available to this session by the code.
@@ -3164,6 +3859,8 @@ Returns the cluster available to this session by the code.
| --------- | --------------- |
| db | \*
|
| sessionId | \*
|
+| code | \*
|
+| mfgCode | \*
|
@@ -3181,31 +3878,38 @@ Returns all the clusters visible for a given session.
-### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode) ⇒
Returns the attribute available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| side | \*
|
+| attributeCode | \*
|
+| mfgCode | \*
|
-### DB API: zcl database access~selectSessionCommandByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source) ⇒
Returns the command available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| commandCode | \*
|
+| source | \*
|
@@ -3313,17 +4017,17 @@ Returns an array of clusters that enum belongs to.
-### DB API: zcl database access~selectBitmapClusters(db, enumId) ⇒
+### DB API: zcl database access~selectBitmapClusters(db, bitmapId) ⇒
-Returns an array of clusters that enum belongs to.
+Returns an array of clusters that bitmap belongs to.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: clusters
-| Param | Type |
-| ------ | --------------- |
-| db | \*
|
-| enumId | \*
|
+| Param | Type |
+| -------- | --------------- |
+| db | \*
|
+| bitmapId | \*
|
@@ -3353,15 +4057,20 @@ Retrieves all the structs in the database with the items.
-### DB API: zcl database access~selectAllStructItemsByStructName(db, name) ⇒
+### DB API: zcl database access~selectAllStructItemsByStructName(db, name, packageIds, clusterName) ⇒
+
+Retrieves the struct items based on struct and cluster name.
+Note: By default clusterName is null.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
-**Returns**: the details of the struct items given the name of the struct
+**Returns**: the details of the struct items
-| Param |
-| ----- |
-| db |
-| name |
+| Param | Default |
+| ----------- | ------------- |
+| db | |
+| name | |
+| packageIds | |
+| clusterName |
|
@@ -3499,26 +4208,32 @@ This module provides queries for user configuration.
This module provides queries for device types.
- [DB API: device type database access](#module*DB API* device type database access)
- - [~selectAllDeviceTypes(db)](#module*DB API* device type database access..selectAllDeviceTypes) ⇒
+ - [~selectAllDeviceTypes(db, packageId)](#module*DB API* device type database access..selectAllDeviceTypes) ⇒
- [~selectDeviceTypeById(db, id)](#module*DB API* device type database access..selectDeviceTypeById) ⇒
- [~selectDeviceTypeByCodeAndName(db, packageId, code, name)](#module*DB API* device type database access..selectDeviceTypeByCodeAndName) ⇒
+ - [~selectDeviceTypeByCode(db, packageId, code, name)](#module*DB API* device type database access..selectDeviceTypeByCode) ⇒
- [~updateClusterReferencesForDeviceTypeClusters(db)](#module*DB API* device type database access..updateClusterReferencesForDeviceTypeClusters) ⇒
- [~updateAttributeReferencesForDeviceTypeReferences(db)](#module*DB API* device type database access..updateAttributeReferencesForDeviceTypeReferences) ⇒
- [~updateCommandReferencesForDeviceTypeReferences(db)](#module*DB API* device type database access..updateCommandReferencesForDeviceTypeReferences) ⇒
+ - [~updateFeatureReferencesForDeviceTypeReferences(db)](#module*DB API* device type database access..updateFeatureReferencesForDeviceTypeReferences) ⇒
- [~updateDeviceTypeEntityReferences(db)](#module*DB API* device type database access..updateDeviceTypeEntityReferences) ⇒
+ - [~selectDeviceTypesWithCompositionByEndpointTypeId(db, endpointTypeId)](#module*DB API* device type database access..selectDeviceTypesWithCompositionByEndpointTypeId) ⇒ Promise.<Array>
+ - [~selectDeviceTypesByEndpointTypeId(db, endpointTypeId)](#module*DB API* device type database access..selectDeviceTypesByEndpointTypeId) ⇒
+ - [~selectDeviceTypeFeaturesByEndpointTypeIdAndClusterId(db, endpointTypeId, clusterId)](#module*DB API* device type database access..selectDeviceTypeFeaturesByEndpointTypeIdAndClusterId) ⇒
-### DB API: device type database access~selectAllDeviceTypes(db) ⇒
+### DB API: device type database access~selectAllDeviceTypes(db, packageId) ⇒
Retrieves all the device types in the database.
**Kind**: inner method of [DB API: device type database access
](#module*DB API* device type database access)
**Returns**: Promise that resolves with the rows of device types.
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| packageId | \*
|
@@ -3550,6 +4265,22 @@ Retrieves the device type by the package, code and name.
| code | \*
|
| name | \*
|
+
+
+### DB API: device type database access~selectDeviceTypeByCode(db, packageId, code, name) ⇒
+
+Retrieves the device type by the package, code and name.
+
+**Kind**: inner method of [DB API: device type database access
](#module*DB API* device type database access)
+**Returns**: Device type
+
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| packageId | \*
|
+| code | \*
|
+| name | \*
|
+
### DB API: device type database access~updateClusterReferencesForDeviceTypeClusters(db) ⇒
@@ -3592,6 +4323,20 @@ this method links the refererence to actual command reference.
| ----- | --------------- |
| db | \*
|
+
+
+### DB API: device type database access~updateFeatureReferencesForDeviceTypeReferences(db) ⇒
+
+After loading up device type feature table with the names,
+this method links the refererence to actual feature reference.
+
+**Kind**: inner method of [DB API: device type database access
](#module*DB API* device type database access)
+**Returns**: promise of completion
+
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
+
### DB API: device type database access~updateDeviceTypeEntityReferences(db) ⇒
@@ -3610,35 +4355,83 @@ we have to link the foreign keys.
| ----- | --------------- |
| db | \*
|
-
+
-## DB API: endpoint type queries against the database.
+### DB API: device type database access~selectDeviceTypesWithCompositionByEndpointTypeId(db, endpointTypeId) ⇒ Promise.<Array>
-This module provides queries for endpoint type.
+Asynchronously selects device types with their compositions by a specific endpoint type ID.
-
+This function queries the database for device types associated with a given endpoint type ID,
+including details about the device type and any endpoint compositions linked to it.
-## DB API: endpoint configuration queries against the database.
+**Kind**: inner method of [DB API: device type database access
](#module*DB API* device type database access)
+**Returns**: Promise.<Array>
- A promise that resolves with an array of device types and their compositions.
-This module provides queries for endpoint configuration.
+| Param | Type | Description |
+| -------------- | ------------------- | ------------------------------------------------------------ |
+| db | Object
| The database connection object. |
+| endpointTypeId | number
| The ID of the endpoint type used to filter the device types. |
-
+
-## DB API: zcl database access
+### DB API: device type database access~selectDeviceTypesByEndpointTypeId(db, endpointTypeId) ⇒
-This module provides queries for enums.
+Retrieves the zcl device type information based on an endpoint type id
-- [DB API: zcl database access](#module*DB API* zcl database access)
- - [~clear()](#module*DB API* zcl database access..clear)
- - [~put(key, packageId, data)](#module*DB API* zcl database access..put) ⇒
- - [~get(key, packageId)](#module*DB API* zcl database access..get) ⇒
- - [~isCached(key, packageId)](#module*DB API* zcl database access..isCached) ⇒
- - [~cacheQuery(key, packageId)](#module*DB API* zcl database access..cacheQuery) ⇒
- - [~cacheStats()](#module*DB API* zcl database access..cacheStats)
- - [~enable()](#module*DB API* zcl database access..enable)
- - [~disable()](#module*DB API* zcl database access..disable)
- - [~selectAtomicType(db, packageId, typeName)](#module*DB API* zcl database access..selectAtomicType)
+**Kind**: inner method of [DB API: device type database access
](#module*DB API* device type database access)
+**Returns**: promise with zcl device type information based on endpoint type id
+
+| Param | Type |
+| -------------- | --------------- |
+| db | \*
|
+| endpointTypeId | \*
|
+
+
+
+### DB API: device type database access~selectDeviceTypeFeaturesByEndpointTypeIdAndClusterId(db, endpointTypeId, clusterId) ⇒
+
+Retrieves the device type features associated to an endpoint type id and cluster id
+Note: Use clusterId as 'all' to get all features for an endpoint type id.
+
+**Kind**: inner method of [DB API: device type database access
](#module*DB API* device type database access)
+**Returns**: promise with zcl device type feature information based on endpoint type id and cluster id
+
+| Param | Type |
+| -------------- | --------------- |
+| db | \*
|
+| endpointTypeId | \*
|
+| clusterId | \*
|
+
+
+
+## DB API: endpoint type queries against the database.
+
+This module provides queries for endpoint type.
+
+
+
+## DB API: endpoint configuration queries against the database.
+
+This module provides queries for endpoint configuration.
+
+
+
+## DB API: zcl database access
+
+This module provides queries for enums.
+
+- [DB API: zcl database access](#module*DB API* zcl database access)
+ - [~clear()](#module*DB API* zcl database access..clear)
+ - [~put(key, packageId, data)](#module*DB API* zcl database access..put) ⇒
+ - [~get(key, packageId)](#module*DB API* zcl database access..get) ⇒
+ - [~isCached(key, packageId)](#module*DB API* zcl database access..isCached) ⇒
+ - [~cacheQuery(key, packageId)](#module*DB API* zcl database access..cacheQuery) ⇒
+ - [~cacheStats()](#module*DB API* zcl database access..cacheStats)
+ - [~enable()](#module*DB API* zcl database access..enable)
+ - [~disable()](#module*DB API* zcl database access..disable)
+ - [~selectAtomicType(db, packageId, typeName)](#module*DB API* zcl database access..selectAtomicType)
- [~selectAtomicById(db, packageId)](#module*DB API* zcl database access..selectAtomicById)
+ - [~isTypeSignedByNameAndPackage(db, name, sessionPackages)](#module*DB API* zcl database access..isTypeSignedByNameAndPackage) ⇒ Promise.<boolean>
- [~selectAllBitmaps(db)](#module*DB API* zcl database access..selectAllBitmaps) ⇒
- [~selectBitmapByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectBitmapByNameAndClusterId) ⇒
- [~selectAllEnums(db, packageId)](#module*DB API* zcl database access..selectAllEnums) ⇒
@@ -3648,10 +4441,10 @@ This module provides queries for enums.
- [~selectEnumById(db, id)](#module*DB API* zcl database access..selectEnumById) ⇒
- [~selectEnumByName(db, name, packageIds)](#module*DB API* zcl database access..selectEnumByName) ⇒
- [~selectEnumByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectEnumByNameAndClusterId) ⇒
- - [~selectSessionClusterByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
+ - [~selectSessionClusterByCode(db, sessionId, code, mfgCode)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
- [~selectAllSessionClusters(db, sessionId)](#module*DB API* zcl database access..selectAllSessionClusters) ⇒
- - [~selectSessionAttributeByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
- - [~selectSessionCommandByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
+ - [~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
+ - [~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
- [~selectStructByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectStructByNameAndClusterId) ⇒
- [~selectStructsWithClusterAssociation(db, packageIds, groupByStructName)](#module*DB API* zcl database access..selectStructsWithClusterAssociation) ⇒
- [~selectClusterBitmaps(db, packageId, clusterId)](#module*DB API* zcl database access..selectClusterBitmaps) ⇒
@@ -3659,10 +4452,10 @@ This module provides queries for enums.
- [~selectAllStructsWithItemCount(db, packageIds)](#module*DB API* zcl database access..selectAllStructsWithItemCount) ⇒
- [~selectStructClusters(db, structId)](#module*DB API* zcl database access..selectStructClusters) ⇒
- [~selectEnumClusters(db, enumId)](#module*DB API* zcl database access..selectEnumClusters) ⇒
- - [~selectBitmapClusters(db, enumId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
+ - [~selectBitmapClusters(db, bitmapId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
- [~selectClusterStructsWithItems(db)](#module*DB API* zcl database access..selectClusterStructsWithItems) ⇒
- [~selectAllStructsWithItems(db)](#module*DB API* zcl database access..selectAllStructsWithItems) ⇒
- - [~selectAllStructItemsByStructName(db, name)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
+ - [~selectAllStructItemsByStructName(db, name, packageIds, clusterName)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
- [~selectAllClusters(db)](#module*DB API* zcl database access..selectAllClusters) ⇒
- [~selectClusterByCode(db, packageId, clusterCode, mfgCode)](#module*DB API* zcl database access..selectClusterByCode) ⇒
- [~selectClusterById(db, clusterId, packageId)](#module*DB API* zcl database access..selectClusterById) ⇒
@@ -3788,6 +4581,21 @@ Retrieves atomic type by a given Id.
| db | \*
|
| packageId | \*
|
+
+
+### DB API: zcl database access~isTypeSignedByNameAndPackage(db, name, sessionPackages) ⇒ Promise.<boolean>
+
+Checks if a type by a given name is signed.
+
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise.<boolean>
- - A promise that resolves to true if the type is signed, false otherwise.
+
+| Param | Type | Description |
+| --------------- | ------------------- | ------------------------------- |
+| db | object
| The database connection object. |
+| name | string
| The name of the type. |
+| sessionPackages | Array
| An array of session packages. |
+
### DB API: zcl database access~selectAllBitmaps(db) ⇒
@@ -3921,7 +4729,7 @@ Select an enum matched by name and clusterId.
-### DB API: zcl database access~selectSessionClusterByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionClusterByCode(db, sessionId, code, mfgCode) ⇒
Returns the cluster available to this session by the code.
@@ -3932,6 +4740,8 @@ Returns the cluster available to this session by the code.
| --------- | --------------- |
| db | \*
|
| sessionId | \*
|
+| code | \*
|
+| mfgCode | \*
|
@@ -3949,31 +4759,38 @@ Returns all the clusters visible for a given session.
-### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode) ⇒
Returns the attribute available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| side | \*
|
+| attributeCode | \*
|
+| mfgCode | \*
|
-### DB API: zcl database access~selectSessionCommandByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source) ⇒
Returns the command available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| commandCode | \*
|
+| source | \*
|
@@ -4081,17 +4898,17 @@ Returns an array of clusters that enum belongs to.
-### DB API: zcl database access~selectBitmapClusters(db, enumId) ⇒
+### DB API: zcl database access~selectBitmapClusters(db, bitmapId) ⇒
-Returns an array of clusters that enum belongs to.
+Returns an array of clusters that bitmap belongs to.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: clusters
-| Param | Type |
-| ------ | --------------- |
-| db | \*
|
-| enumId | \*
|
+| Param | Type |
+| -------- | --------------- |
+| db | \*
|
+| bitmapId | \*
|
@@ -4121,15 +4938,20 @@ Retrieves all the structs in the database with the items.
-### DB API: zcl database access~selectAllStructItemsByStructName(db, name) ⇒
+### DB API: zcl database access~selectAllStructItemsByStructName(db, name, packageIds, clusterName) ⇒
+
+Retrieves the struct items based on struct and cluster name.
+Note: By default clusterName is null.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
-**Returns**: the details of the struct items given the name of the struct
+**Returns**: the details of the struct items
-| Param |
-| ----- |
-| db |
-| name |
+| Param | Default |
+| ----------- | ------------- |
+| db | |
+| name | |
+| packageIds | |
+| clusterName |
|
@@ -4261,15 +5083,21 @@ This module provides queries related to imports and exports of files.
This module provides queries for ZCL loading
- [DB API: zcl loading queries](#module*DB API* zcl loading queries)
+ - [~insertAttributeMappings(db, data)](#module*DB API* zcl loading queries..insertAttributeMappings) ⇒
- [~insertGlobals(db, packageId, data)](#module*DB API* zcl loading queries..insertGlobals) ⇒
- [~insertClusterExtensions(db, packageId, data)](#module*DB API* zcl loading queries..insertClusterExtensions) ⇒
- [~insertClusters(db, packageId, data)](#module*DB API* zcl loading queries..insertClusters) ⇒
+ - [~insertFeatures(db, packageId, data)](#module*DB API* zcl loading queries..insertFeatures) ⇒
- [~insertTags(db, packageId, data)](#module*DB API* zcl loading queries..insertTags) ⇒
- [~insertDomains(db, packageId, data)](#module*DB API* zcl loading queries..insertDomains) ⇒
- [~insertSpecs(db, packageId, data)](#module*DB API* zcl loading queries..insertSpecs) ⇒
- [~insertGlobalAttributeDefault(db, packageId, clusterData)](#module*DB API* zcl loading queries..insertGlobalAttributeDefault) ⇒
- [~insertAtomics(db, packageId, data)](#module*DB API* zcl loading queries..insertAtomics)
+ - [~insertEndpointComposition(db, composition, context)](#module*DB API* zcl loading queries..insertEndpointComposition) ⇒
+ - [~getEndpointCompositionIdByCode(db, deviceType)](#module*DB API* zcl loading queries..getEndpointCompositionIdByCode) ⇒ Promise.<(number\|null)>
+ - [~insertDeviceComposition(db, deviceType, endpointCompositionId)](#module*DB API* zcl loading queries..insertDeviceComposition) ⇒ Promise
- [~insertDeviceTypes(db, packageId, data)](#module*DB API* zcl loading queries..insertDeviceTypes) ⇒
+ - [~insertDeviceTypeFeatures(db, dtClusterRefDataPairs)](#module*DB API* zcl loading queries..insertDeviceTypeFeatures)
- [~insertDeviceTypeAttributes(db, dtClusterRefDataPairs)](#module*DB API* zcl loading queries..insertDeviceTypeAttributes)
- [~insertDeviceTypeCommands(db, dtClusterRefDataPairs)](#module*DB API* zcl loading queries..insertDeviceTypeCommands)
- [~createAccessRows(db, packageId, data)](#module*DB API* zcl loading queries..createAccessRows)
@@ -4288,6 +5116,20 @@ This module provides queries for ZCL loading
- [~insertStruct(db, packageIds, data)](#module*DB API* zcl loading queries..insertStruct)
- [~insertStructItems(db, packageIds, data)](#module*DB API* zcl loading queries..insertStructItems)
+
+
+### DB API: zcl loading queries~insertAttributeMappings(db, data) ⇒
+
+Load the attribute mapping table with associated attributes
+
+**Kind**: inner method of [DB API: zcl loading queries
](#module*DB API* zcl loading queries)
+**Returns**: attribute mapping ids of the associated attributes
+
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
+| data | \*
|
+
### DB API: zcl loading queries~insertGlobals(db, packageId, data) ⇒
@@ -4333,6 +5175,21 @@ Inserts clusters into the database.
| packageId | \*
| |
| data | \*
| an array of objects that must contain: code, name, description, define. It also contains commands: and attributes: |
+
+
+### DB API: zcl loading queries~insertFeatures(db, packageId, data) ⇒
+
+Inserts features into the database.
+
+**Kind**: inner method of [DB API: zcl loading queries
](#module*DB API* zcl loading queries)
+**Returns**: A promise that resolves with array of rowids.
+
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| packageId | \*
|
+| data | \*
|
+
### DB API: zcl loading queries~insertTags(db, packageId, data) ⇒
@@ -4411,6 +5268,53 @@ Object might also contain 'size', but possibly not.
| packageId | \*
|
| data | \*
|
+
+
+### DB API: zcl loading queries~insertEndpointComposition(db, composition, context) ⇒
+
+Inserts endpoint composition data into the database based on the context's mandatory device type.
+This function checks if the context's mandatory device type matches the composition code.
+If they match, it performs an insert operation with a specific type from `dbEnum.mandatoryDeviceType`.
+If they do not match, it performs an insert with the composition's type.
+
+**Kind**: inner method of [DB API: zcl loading queries
](#module*DB API* zcl loading queries)
+**Returns**: A promise resolved with the result of the database insert operation.
+
+| Param | Type | Description |
+| ----------- | --------------- | ------------------------------------------------------------------ |
+| db | \*
| The database connection object. |
+| composition | \*
| The composition data to be inserted. |
+| context | \*
| The context containing the mandatory device type to check against. |
+
+
+
+### DB API: zcl loading queries~getEndpointCompositionIdByCode(db, deviceType) ⇒ Promise.<(number\|null)>
+
+Asynchronously retrieves the ID of an endpoint composition based on its code.
+
+**Kind**: inner method of [DB API: zcl loading queries
](#module*DB API* zcl loading queries)
+**Returns**: Promise.<(number\|null)>
- A promise that resolves with the ID of the endpoint composition if found, or null otherwise.
+
+| Param | Type | Description |
+| ---------- | ------------------- | --------------------------------------------------------------------------- |
+| db | Object
| The database connection object. |
+| deviceType | Object
| An object representing the device type, which contains the 'code' property. |
+
+
+
+### DB API: zcl loading queries~insertDeviceComposition(db, deviceType, endpointCompositionId) ⇒ Promise
+
+Inserts a new device composition record into the database.
+
+**Kind**: inner method of [DB API: zcl loading queries
](#module*DB API* zcl loading queries)
+**Returns**: Promise
- A promise that resolves with the result of the database insertion operation.
+
+| Param | Type | Description |
+| --------------------- | ------------------- | ------------------------------------------------------------------------------------ |
+| db | Object
| The database connection object. |
+| deviceType | Object
| An object representing the device type, which contains the 'childDeviceId' property. |
+| endpointCompositionId | number
| The ID of the endpoint composition associated with this device composition. |
+
### DB API: zcl loading queries~insertDeviceTypes(db, packageId, data) ⇒
@@ -4426,6 +5330,20 @@ Inserts device types into the database.
| packageId | \*
| |
| data | \*
| an array of objects that must contain: domain, code, profileId, name, description |
+
+
+### DB API: zcl loading queries~insertDeviceTypeFeatures(db, dtClusterRefDataPairs)
+
+This handles the loading of device type feature requirements into the database.
+There is a need to post-process to attach the actual feature ref after the fact
+
+**Kind**: inner method of [DB API: zcl loading queries
](#module*DB API* zcl loading queries)
+
+| Param | Type |
+| --------------------- | --------------- |
+| db | \*
|
+| dtClusterRefDataPairs | \*
|
+
### DB API: zcl loading queries~insertDeviceTypeAttributes(db, dtClusterRefDataPairs)
@@ -4687,7 +5605,7 @@ Insert all Struct items into the Struct Item Table.
## DB API: session related queries.
-This module provides notification related queries.
+This module provides package notification related queries.
@@ -4695,6 +5613,12 @@ This module provides notification related queries.
This module provides queries related to packages.
+
+
+## DB API: session related queries.
+
+This module provides session notification related queries.
+
## DB API: zcl database access
@@ -4714,6 +5638,7 @@ all visible clusters, etc.
- [~disable()](#module*DB API* zcl database access..disable)
- [~selectAtomicType(db, packageId, typeName)](#module*DB API* zcl database access..selectAtomicType)
- [~selectAtomicById(db, packageId)](#module*DB API* zcl database access..selectAtomicById)
+ - [~isTypeSignedByNameAndPackage(db, name, sessionPackages)](#module*DB API* zcl database access..isTypeSignedByNameAndPackage) ⇒ Promise.<boolean>
- [~selectAllBitmaps(db)](#module*DB API* zcl database access..selectAllBitmaps) ⇒
- [~selectBitmapByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectBitmapByNameAndClusterId) ⇒
- [~selectAllEnums(db, packageId)](#module*DB API* zcl database access..selectAllEnums) ⇒
@@ -4723,10 +5648,10 @@ all visible clusters, etc.
- [~selectEnumById(db, id)](#module*DB API* zcl database access..selectEnumById) ⇒
- [~selectEnumByName(db, name, packageIds)](#module*DB API* zcl database access..selectEnumByName) ⇒
- [~selectEnumByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectEnumByNameAndClusterId) ⇒
- - [~selectSessionClusterByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
+ - [~selectSessionClusterByCode(db, sessionId, code, mfgCode)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
- [~selectAllSessionClusters(db, sessionId)](#module*DB API* zcl database access..selectAllSessionClusters) ⇒
- - [~selectSessionAttributeByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
- - [~selectSessionCommandByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
+ - [~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
+ - [~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
- [~selectStructByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectStructByNameAndClusterId) ⇒
- [~selectStructsWithClusterAssociation(db, packageIds, groupByStructName)](#module*DB API* zcl database access..selectStructsWithClusterAssociation) ⇒
- [~selectClusterBitmaps(db, packageId, clusterId)](#module*DB API* zcl database access..selectClusterBitmaps) ⇒
@@ -4734,10 +5659,10 @@ all visible clusters, etc.
- [~selectAllStructsWithItemCount(db, packageIds)](#module*DB API* zcl database access..selectAllStructsWithItemCount) ⇒
- [~selectStructClusters(db, structId)](#module*DB API* zcl database access..selectStructClusters) ⇒
- [~selectEnumClusters(db, enumId)](#module*DB API* zcl database access..selectEnumClusters) ⇒
- - [~selectBitmapClusters(db, enumId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
+ - [~selectBitmapClusters(db, bitmapId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
- [~selectClusterStructsWithItems(db)](#module*DB API* zcl database access..selectClusterStructsWithItems) ⇒
- [~selectAllStructsWithItems(db)](#module*DB API* zcl database access..selectAllStructsWithItems) ⇒
- - [~selectAllStructItemsByStructName(db, name)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
+ - [~selectAllStructItemsByStructName(db, name, packageIds, clusterName)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
- [~selectAllClusters(db)](#module*DB API* zcl database access..selectAllClusters) ⇒
- [~selectClusterByCode(db, packageId, clusterCode, mfgCode)](#module*DB API* zcl database access..selectClusterByCode) ⇒
- [~selectClusterById(db, clusterId, packageId)](#module*DB API* zcl database access..selectClusterById) ⇒
@@ -4863,6 +5788,21 @@ Retrieves atomic type by a given Id.
| db | \*
|
| packageId | \*
|
+
+
+### DB API: zcl database access~isTypeSignedByNameAndPackage(db, name, sessionPackages) ⇒ Promise.<boolean>
+
+Checks if a type by a given name is signed.
+
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise.<boolean>
- - A promise that resolves to true if the type is signed, false otherwise.
+
+| Param | Type | Description |
+| --------------- | ------------------- | ------------------------------- |
+| db | object
| The database connection object. |
+| name | string
| The name of the type. |
+| sessionPackages | Array
| An array of session packages. |
+
### DB API: zcl database access~selectAllBitmaps(db) ⇒
@@ -4996,7 +5936,7 @@ Select an enum matched by name and clusterId.
-### DB API: zcl database access~selectSessionClusterByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionClusterByCode(db, sessionId, code, mfgCode) ⇒
Returns the cluster available to this session by the code.
@@ -5007,6 +5947,8 @@ Returns the cluster available to this session by the code.
| --------- | --------------- |
| db | \*
|
| sessionId | \*
|
+| code | \*
|
+| mfgCode | \*
|
@@ -5024,31 +5966,38 @@ Returns all the clusters visible for a given session.
-### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode) ⇒
Returns the attribute available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| side | \*
|
+| attributeCode | \*
|
+| mfgCode | \*
|
-### DB API: zcl database access~selectSessionCommandByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source) ⇒
Returns the command available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| commandCode | \*
|
+| source | \*
|
@@ -5156,17 +6105,17 @@ Returns an array of clusters that enum belongs to.
-### DB API: zcl database access~selectBitmapClusters(db, enumId) ⇒
+### DB API: zcl database access~selectBitmapClusters(db, bitmapId) ⇒
-Returns an array of clusters that enum belongs to.
+Returns an array of clusters that bitmap belongs to.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: clusters
-| Param | Type |
-| ------ | --------------- |
-| db | \*
|
-| enumId | \*
|
+| Param | Type |
+| -------- | --------------- |
+| db | \*
|
+| bitmapId | \*
|
@@ -5196,15 +6145,20 @@ Retrieves all the structs in the database with the items.
-### DB API: zcl database access~selectAllStructItemsByStructName(db, name) ⇒
+### DB API: zcl database access~selectAllStructItemsByStructName(db, name, packageIds, clusterName) ⇒
+
+Retrieves the struct items based on struct and cluster name.
+Note: By default clusterName is null.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
-**Returns**: the details of the struct items given the name of the struct
+**Returns**: the details of the struct items
-| Param |
-| ----- |
-| db |
-| name |
+| Param | Default |
+| ----------- | ------------- |
+| db | |
+| name | |
+| packageIds | |
+| clusterName |
|
@@ -5340,6 +6294,7 @@ This module provides queries for enums.
- [~disable()](#module*DB API* zcl database access..disable)
- [~selectAtomicType(db, packageId, typeName)](#module*DB API* zcl database access..selectAtomicType)
- [~selectAtomicById(db, packageId)](#module*DB API* zcl database access..selectAtomicById)
+ - [~isTypeSignedByNameAndPackage(db, name, sessionPackages)](#module*DB API* zcl database access..isTypeSignedByNameAndPackage) ⇒ Promise.<boolean>
- [~selectAllBitmaps(db)](#module*DB API* zcl database access..selectAllBitmaps) ⇒
- [~selectBitmapByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectBitmapByNameAndClusterId) ⇒
- [~selectAllEnums(db, packageId)](#module*DB API* zcl database access..selectAllEnums) ⇒
@@ -5349,10 +6304,10 @@ This module provides queries for enums.
- [~selectEnumById(db, id)](#module*DB API* zcl database access..selectEnumById) ⇒
- [~selectEnumByName(db, name, packageIds)](#module*DB API* zcl database access..selectEnumByName) ⇒
- [~selectEnumByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectEnumByNameAndClusterId) ⇒
- - [~selectSessionClusterByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
+ - [~selectSessionClusterByCode(db, sessionId, code, mfgCode)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
- [~selectAllSessionClusters(db, sessionId)](#module*DB API* zcl database access..selectAllSessionClusters) ⇒
- - [~selectSessionAttributeByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
- - [~selectSessionCommandByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
+ - [~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
+ - [~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
- [~selectStructByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectStructByNameAndClusterId) ⇒
- [~selectStructsWithClusterAssociation(db, packageIds, groupByStructName)](#module*DB API* zcl database access..selectStructsWithClusterAssociation) ⇒
- [~selectClusterBitmaps(db, packageId, clusterId)](#module*DB API* zcl database access..selectClusterBitmaps) ⇒
@@ -5360,10 +6315,10 @@ This module provides queries for enums.
- [~selectAllStructsWithItemCount(db, packageIds)](#module*DB API* zcl database access..selectAllStructsWithItemCount) ⇒
- [~selectStructClusters(db, structId)](#module*DB API* zcl database access..selectStructClusters) ⇒
- [~selectEnumClusters(db, enumId)](#module*DB API* zcl database access..selectEnumClusters) ⇒
- - [~selectBitmapClusters(db, enumId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
+ - [~selectBitmapClusters(db, bitmapId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
- [~selectClusterStructsWithItems(db)](#module*DB API* zcl database access..selectClusterStructsWithItems) ⇒
- [~selectAllStructsWithItems(db)](#module*DB API* zcl database access..selectAllStructsWithItems) ⇒
- - [~selectAllStructItemsByStructName(db, name)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
+ - [~selectAllStructItemsByStructName(db, name, packageIds, clusterName)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
- [~selectAllClusters(db)](#module*DB API* zcl database access..selectAllClusters) ⇒
- [~selectClusterByCode(db, packageId, clusterCode, mfgCode)](#module*DB API* zcl database access..selectClusterByCode) ⇒
- [~selectClusterById(db, clusterId, packageId)](#module*DB API* zcl database access..selectClusterById) ⇒
@@ -5489,6 +6444,21 @@ Retrieves atomic type by a given Id.
| db | \*
|
| packageId | \*
|
+
+
+### DB API: zcl database access~isTypeSignedByNameAndPackage(db, name, sessionPackages) ⇒ Promise.<boolean>
+
+Checks if a type by a given name is signed.
+
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise.<boolean>
- - A promise that resolves to true if the type is signed, false otherwise.
+
+| Param | Type | Description |
+| --------------- | ------------------- | ------------------------------- |
+| db | object
| The database connection object. |
+| name | string
| The name of the type. |
+| sessionPackages | Array
| An array of session packages. |
+
### DB API: zcl database access~selectAllBitmaps(db) ⇒
@@ -5622,7 +6592,7 @@ Select an enum matched by name and clusterId.
-### DB API: zcl database access~selectSessionClusterByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionClusterByCode(db, sessionId, code, mfgCode) ⇒
Returns the cluster available to this session by the code.
@@ -5633,6 +6603,8 @@ Returns the cluster available to this session by the code.
| --------- | --------------- |
| db | \*
|
| sessionId | \*
|
+| code | \*
|
+| mfgCode | \*
|
@@ -5650,31 +6622,38 @@ Returns all the clusters visible for a given session.
-### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode) ⇒
Returns the attribute available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| side | \*
|
+| attributeCode | \*
|
+| mfgCode | \*
|
-### DB API: zcl database access~selectSessionCommandByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source) ⇒
Returns the command available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| commandCode | \*
|
+| source | \*
|
@@ -5782,17 +6761,17 @@ Returns an array of clusters that enum belongs to.
-### DB API: zcl database access~selectBitmapClusters(db, enumId) ⇒
+### DB API: zcl database access~selectBitmapClusters(db, bitmapId) ⇒
-Returns an array of clusters that enum belongs to.
+Returns an array of clusters that bitmap belongs to.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: clusters
-| Param | Type |
-| ------ | --------------- |
-| db | \*
|
-| enumId | \*
|
+| Param | Type |
+| -------- | --------------- |
+| db | \*
|
+| bitmapId | \*
|
@@ -5822,15 +6801,20 @@ Retrieves all the structs in the database with the items.
-### DB API: zcl database access~selectAllStructItemsByStructName(db, name) ⇒
+### DB API: zcl database access~selectAllStructItemsByStructName(db, name, packageIds, clusterName) ⇒
+
+Retrieves the struct items based on struct and cluster name.
+Note: By default clusterName is null.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
-**Returns**: the details of the struct items given the name of the struct
+**Returns**: the details of the struct items
-| Param |
-| ----- |
-| db |
-| name |
+| Param | Default |
+| ----------- | ------------- |
+| db | |
+| name | |
+| packageIds | |
+| clusterName |
|
@@ -5947,7 +6931,8 @@ Query for attributes by side.
## DB API: zcl database access
-This module provides queries for ZCL static queries.
+This module provides a place for creating generic queries which are common
+across different query files.
- [DB API: zcl database access](#module*DB API* zcl database access)
- [~clear()](#module*DB API* zcl database access..clear)
@@ -5960,6 +6945,7 @@ This module provides queries for ZCL static queries.
- [~disable()](#module*DB API* zcl database access..disable)
- [~selectAtomicType(db, packageId, typeName)](#module*DB API* zcl database access..selectAtomicType)
- [~selectAtomicById(db, packageId)](#module*DB API* zcl database access..selectAtomicById)
+ - [~isTypeSignedByNameAndPackage(db, name, sessionPackages)](#module*DB API* zcl database access..isTypeSignedByNameAndPackage) ⇒ Promise.<boolean>
- [~selectAllBitmaps(db)](#module*DB API* zcl database access..selectAllBitmaps) ⇒
- [~selectBitmapByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectBitmapByNameAndClusterId) ⇒
- [~selectAllEnums(db, packageId)](#module*DB API* zcl database access..selectAllEnums) ⇒
@@ -5969,10 +6955,10 @@ This module provides queries for ZCL static queries.
- [~selectEnumById(db, id)](#module*DB API* zcl database access..selectEnumById) ⇒
- [~selectEnumByName(db, name, packageIds)](#module*DB API* zcl database access..selectEnumByName) ⇒
- [~selectEnumByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectEnumByNameAndClusterId) ⇒
- - [~selectSessionClusterByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
+ - [~selectSessionClusterByCode(db, sessionId, code, mfgCode)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
- [~selectAllSessionClusters(db, sessionId)](#module*DB API* zcl database access..selectAllSessionClusters) ⇒
- - [~selectSessionAttributeByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
- - [~selectSessionCommandByCode(db, sessionId)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
+ - [~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
+ - [~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
- [~selectStructByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectStructByNameAndClusterId) ⇒
- [~selectStructsWithClusterAssociation(db, packageIds, groupByStructName)](#module*DB API* zcl database access..selectStructsWithClusterAssociation) ⇒
- [~selectClusterBitmaps(db, packageId, clusterId)](#module*DB API* zcl database access..selectClusterBitmaps) ⇒
@@ -5980,10 +6966,10 @@ This module provides queries for ZCL static queries.
- [~selectAllStructsWithItemCount(db, packageIds)](#module*DB API* zcl database access..selectAllStructsWithItemCount) ⇒
- [~selectStructClusters(db, structId)](#module*DB API* zcl database access..selectStructClusters) ⇒
- [~selectEnumClusters(db, enumId)](#module*DB API* zcl database access..selectEnumClusters) ⇒
- - [~selectBitmapClusters(db, enumId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
+ - [~selectBitmapClusters(db, bitmapId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
- [~selectClusterStructsWithItems(db)](#module*DB API* zcl database access..selectClusterStructsWithItems) ⇒
- [~selectAllStructsWithItems(db)](#module*DB API* zcl database access..selectAllStructsWithItems) ⇒
- - [~selectAllStructItemsByStructName(db, name)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
+ - [~selectAllStructItemsByStructName(db, name, packageIds, clusterName)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
- [~selectAllClusters(db)](#module*DB API* zcl database access..selectAllClusters) ⇒
- [~selectClusterByCode(db, packageId, clusterCode, mfgCode)](#module*DB API* zcl database access..selectClusterByCode) ⇒
- [~selectClusterById(db, clusterId, packageId)](#module*DB API* zcl database access..selectClusterById) ⇒
@@ -6109,6 +7095,21 @@ Retrieves atomic type by a given Id.
| db | \*
|
| packageId | \*
|
+
+
+### DB API: zcl database access~isTypeSignedByNameAndPackage(db, name, sessionPackages) ⇒ Promise.<boolean>
+
+Checks if a type by a given name is signed.
+
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise.<boolean>
- - A promise that resolves to true if the type is signed, false otherwise.
+
+| Param | Type | Description |
+| --------------- | ------------------- | ------------------------------- |
+| db | object
| The database connection object. |
+| name | string
| The name of the type. |
+| sessionPackages | Array
| An array of session packages. |
+
### DB API: zcl database access~selectAllBitmaps(db) ⇒
@@ -6242,7 +7243,7 @@ Select an enum matched by name and clusterId.
-### DB API: zcl database access~selectSessionClusterByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionClusterByCode(db, sessionId, code, mfgCode) ⇒
Returns the cluster available to this session by the code.
@@ -6253,6 +7254,8 @@ Returns the cluster available to this session by the code.
| --------- | --------------- |
| db | \*
|
| sessionId | \*
|
+| code | \*
|
+| mfgCode | \*
|
@@ -6270,31 +7273,38 @@ Returns all the clusters visible for a given session.
-### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode) ⇒
Returns the attribute available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| side | \*
|
+| attributeCode | \*
|
+| mfgCode | \*
|
-### DB API: zcl database access~selectSessionCommandByCode(db, sessionId) ⇒
+### DB API: zcl database access~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source) ⇒
Returns the command available to this session by the code.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: the session attribute
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| commandCode | \*
|
+| source | \*
|
@@ -6402,17 +7412,17 @@ Returns an array of clusters that enum belongs to.
-### DB API: zcl database access~selectBitmapClusters(db, enumId) ⇒
+### DB API: zcl database access~selectBitmapClusters(db, bitmapId) ⇒
-Returns an array of clusters that enum belongs to.
+Returns an array of clusters that bitmap belongs to.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
**Returns**: clusters
-| Param | Type |
-| ------ | --------------- |
-| db | \*
|
-| enumId | \*
|
+| Param | Type |
+| -------- | --------------- |
+| db | \*
|
+| bitmapId | \*
|
@@ -6442,15 +7452,20 @@ Retrieves all the structs in the database with the items.
-### DB API: zcl database access~selectAllStructItemsByStructName(db, name) ⇒
+### DB API: zcl database access~selectAllStructItemsByStructName(db, name, packageIds, clusterName) ⇒
+
+Retrieves the struct items based on struct and cluster name.
+Note: By default clusterName is null.
**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
-**Returns**: the details of the struct items given the name of the struct
+**Returns**: the details of the struct items
-| Param |
-| ----- |
-| db |
-| name |
+| Param | Default |
+| ----------- | ------------- |
+| db | |
+| name | |
+| packageIds | |
+| clusterName |
|
@@ -6563,1019 +7578,1319 @@ Query for attributes by side.
| side | \*
|
| packageId | \*
|
-
+
-## JS API: generator logic
+## DB API: zcl database access
-- [JS API: generator logic](#module*JS API* generator logic)
- - [~loadGenTemplateFromFile(path)](#module*JS API* generator logic..loadGenTemplateFromFile) ⇒
- - [~recordTemplatesPackage(context)](#module*JS API* generator logic..recordTemplatesPackage) ⇒
- - [~decodePackageExtensionEntity(entityType, entity)](#module*JS API* generator logic..decodePackageExtensionEntity) ⇒
- - [~loadZclExtensions(zclExt)](#module*JS API* generator logic..loadZclExtensions) ⇒
- - [~loadTemplates(db, genTemplatesJsonArray)](#module*JS API* generator logic..loadTemplates)
- - [~loadSingleTemplate(db, genTemplatesJson)](#module*JS API* generator logic..loadSingleTemplate) ⇒
- - [~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly)](#module*JS API* generator logic..generateAllTemplates) ⇒
- - [~generateSingleTemplate(genResult, singleTemplatePkg)](#module*JS API* generator logic..generateSingleTemplate) ⇒
- - [~generate(db, packageId)](#module*JS API* generator logic..generate) ⇒
- - [~writeFileWithBackup(fileName, content, doBackup)](#module*JS API* generator logic..writeFileWithBackup) ⇒
- - [~generateGenerationContent(genResult)](#module*JS API* generator logic..generateGenerationContent)
- - [~generateAndWriteFiles(db, sessionId, packageId, outputDirectory)](#module*JS API* generator logic..generateAndWriteFiles) ⇒
- - [~postProcessGeneratedFiles(outputDirectory, genResult)](#module*JS API* generator logic..postProcessGeneratedFiles) ⇒
- - [~contentIndexer(content)](#module*JS API* generator logic..contentIndexer)
- - [~generateSingleFileForPreview(db, sessionId, fileName)](#module*JS API* generator logic..generateSingleFileForPreview) ⇒
- - [~produceCompiledTemplate(singleTemplatePkg)](#module*JS API* generator logic..produceCompiledTemplate) ⇒
- - [~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:)](#module*JS API* generator logic..produceContent) ⇒
- - [~wrapOverridable(originalFn, overrideFn)](#module*JS API* generator logic..wrapOverridable) ⇒
- - [~loadOverridable(genTemplatePackageId)](#module*JS API* generator logic..loadOverridable)
- - [~loadPartial(path)](#module*JS API* generator logic..loadPartial)
- - [~loadHelper(helpers)](#module*JS API* generator logic..loadHelper)
- - [~allBuiltInHelpers()](#module*JS API* generator logic..allBuiltInHelpers) ⇒
- - [~findHelperPackageByAlias(alias)](#module*JS API* generator logic..findHelperPackageByAlias) ⇒
- - [~initializeBuiltInHelpersForPackage()](#module*JS API* generator logic..initializeBuiltInHelpersForPackage)
- - [~hbInstance()](#module*JS API* generator logic..hbInstance) ⇒
- - [~makeSynchronizablePromise(promise)](#module*JS API* generator logic..makeSynchronizablePromise)
- - [~collectBlocks(resultArray, options, context)](#module*JS API* generator logic..collectBlocks) ⇒
- - [~ensureZclPackageId(context)](#module*JS API* generator logic..ensureZclPackageId) ⇒
- - [~ensureZclPackageIds(context)](#module*JS API* generator logic..ensureZclPackageIds) ⇒
- - [~ensureTemplatePackageId(context)](#module*JS API* generator logic..ensureTemplatePackageId) ⇒
- - [~ensureEndpointTypeIds(context)](#module*JS API* generator logic..ensureEndpointTypeIds) ⇒
- - [~ensureZclClusterSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclClusterSdkExtensions) ⇒
- - [~ensureZclDeviceTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclDeviceTypeSdkExtensions) ⇒
- - [~ensureZclAttributeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeSdkExtensions) ⇒
- - [~ensureZclAttributeTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeTypeSdkExtensions) ⇒
- - [~ensureZclCommandSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclCommandSdkExtensions) ⇒
- - [~ensureZclEventSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclEventSdkExtensions) ⇒
- - [~templatePromise(global, promise)](#module*JS API* generator logic..templatePromise)
- - [~deprecatedHelper(fn, explanation)](#module*JS API* generator logic..deprecatedHelper) ⇒
+This module provides queries for ZCL static queries.
-
+- [DB API: zcl database access](#module*DB API* zcl database access)
+ - [~clear()](#module*DB API* zcl database access..clear)
+ - [~put(key, packageId, data)](#module*DB API* zcl database access..put) ⇒
+ - [~get(key, packageId)](#module*DB API* zcl database access..get) ⇒
+ - [~isCached(key, packageId)](#module*DB API* zcl database access..isCached) ⇒
+ - [~cacheQuery(key, packageId)](#module*DB API* zcl database access..cacheQuery) ⇒
+ - [~cacheStats()](#module*DB API* zcl database access..cacheStats)
+ - [~enable()](#module*DB API* zcl database access..enable)
+ - [~disable()](#module*DB API* zcl database access..disable)
+ - [~selectAtomicType(db, packageId, typeName)](#module*DB API* zcl database access..selectAtomicType)
+ - [~selectAtomicById(db, packageId)](#module*DB API* zcl database access..selectAtomicById)
+ - [~isTypeSignedByNameAndPackage(db, name, sessionPackages)](#module*DB API* zcl database access..isTypeSignedByNameAndPackage) ⇒ Promise.<boolean>
+ - [~selectAllBitmaps(db)](#module*DB API* zcl database access..selectAllBitmaps) ⇒
+ - [~selectBitmapByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectBitmapByNameAndClusterId) ⇒
+ - [~selectAllEnums(db, packageId)](#module*DB API* zcl database access..selectAllEnums) ⇒
+ - [~selectClusterEnums(db, packageId, clusterId)](#module*DB API* zcl database access..selectClusterEnums) ⇒
+ - [~selectAllEnumItemsById(db, id)](#module*DB API* zcl database access..selectAllEnumItemsById) ⇒
+ - [~selectAllEnumItems(db, packageId)](#module*DB API* zcl database access..selectAllEnumItems) ⇒
+ - [~selectEnumById(db, id)](#module*DB API* zcl database access..selectEnumById) ⇒
+ - [~selectEnumByName(db, name, packageIds)](#module*DB API* zcl database access..selectEnumByName) ⇒
+ - [~selectEnumByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectEnumByNameAndClusterId) ⇒
+ - [~selectSessionClusterByCode(db, sessionId, code, mfgCode)](#module*DB API* zcl database access..selectSessionClusterByCode) ⇒
+ - [~selectAllSessionClusters(db, sessionId)](#module*DB API* zcl database access..selectAllSessionClusters) ⇒
+ - [~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode)](#module*DB API* zcl database access..selectSessionAttributeByCode) ⇒
+ - [~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source)](#module*DB API* zcl database access..selectSessionCommandByCode) ⇒
+ - [~selectStructByNameAndClusterId(db, name, clusterId, packageIds)](#module*DB API* zcl database access..selectStructByNameAndClusterId) ⇒
+ - [~selectStructsWithClusterAssociation(db, packageIds, groupByStructName)](#module*DB API* zcl database access..selectStructsWithClusterAssociation) ⇒
+ - [~selectClusterBitmaps(db, packageId, clusterId)](#module*DB API* zcl database access..selectClusterBitmaps) ⇒
+ - [~selectAllDomains(db)](#module*DB API* zcl database access..selectAllDomains) ⇒
+ - [~selectAllStructsWithItemCount(db, packageIds)](#module*DB API* zcl database access..selectAllStructsWithItemCount) ⇒
+ - [~selectStructClusters(db, structId)](#module*DB API* zcl database access..selectStructClusters) ⇒
+ - [~selectEnumClusters(db, enumId)](#module*DB API* zcl database access..selectEnumClusters) ⇒
+ - [~selectBitmapClusters(db, bitmapId)](#module*DB API* zcl database access..selectBitmapClusters) ⇒
+ - [~selectClusterStructsWithItems(db)](#module*DB API* zcl database access..selectClusterStructsWithItems) ⇒
+ - [~selectAllStructsWithItems(db)](#module*DB API* zcl database access..selectAllStructsWithItems) ⇒
+ - [~selectAllStructItemsByStructName(db, name, packageIds, clusterName)](#module*DB API* zcl database access..selectAllStructItemsByStructName) ⇒
+ - [~selectAllClusters(db)](#module*DB API* zcl database access..selectAllClusters) ⇒
+ - [~selectClusterByCode(db, packageId, clusterCode, mfgCode)](#module*DB API* zcl database access..selectClusterByCode) ⇒
+ - [~selectClusterById(db, clusterId, packageId)](#module*DB API* zcl database access..selectClusterById) ⇒
+ - [~selectAttributesByClusterIdIncludingGlobal(db, clusterId, packageIds)](#module*DB API* zcl database access..selectAttributesByClusterIdIncludingGlobal) ⇒
+ - [~selectAttributesByClusterCodeAndManufacturerCode(db, packageId, clusterCode, manufacturerCode)](#module*DB API* zcl database access..selectAttributesByClusterCodeAndManufacturerCode) ⇒
+ - [~selectAttributeByAttributeIdAndClusterRef(db, attributeId, clusterRef)](#module*DB API* zcl database access..selectAttributeByAttributeIdAndClusterRef)
+ - [~selectAllAttributesBySide(db, side, packageId)](#module*DB API* zcl database access..selectAllAttributesBySide) ⇒
-### JS API: generator logic~loadGenTemplateFromFile(path) ⇒
+
-Given a path, it will read generation template object into memory.
+### DB API: zcl database access~clear()
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Object that contains: data, crc, templateData
+Clears the entire cache.
-| Param | Type |
-| ----- | --------------- |
-| path | \*
|
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+
-
+### DB API: zcl database access~put(key, packageId, data) ⇒
-### JS API: generator logic~recordTemplatesPackage(context) ⇒
+Puts a data object into the cache under a given key/packageId
-Given a loading context, it records the package into the packages table and adds the packageId field into the resolved context.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Returns true on success.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the same context passed in, except packageId added to it
+| Param | Type |
+| --------- | --------------- |
+| key | \*
|
+| packageId | \*
|
+| data | \*
|
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+
-
+### DB API: zcl database access~get(key, packageId) ⇒
-### JS API: generator logic~decodePackageExtensionEntity(entityType, entity) ⇒
+Returns a data object under a given key/packageId.
-This method takes extension data in JSON, and converts it into
-an object that contains:
-entityCode, entityQualifier, parentCode, manufacturerCode and value
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: cached object or undefined if none is present or expired.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: object that can be used for database injection
+| Param | Type |
+| --------- | --------------- |
+| key | \*
|
+| packageId | \*
|
-| Param | Type |
-| ---------- | --------------- |
-| entityType | \*
|
-| entity | \*
|
+
-
+### DB API: zcl database access~isCached(key, packageId) ⇒
-### JS API: generator logic~loadZclExtensions(zclExt) ⇒
+Returns true if a given key/packageId cache exists.
-Returns a promise that will load the zcl extensions.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: true or false, depending on whether the cache is present.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise of loading the zcl extensions.
+| Param | Type |
+| --------- | --------------- |
+| key | \*
|
+| packageId | \*
|
-| Param | Type |
-| ------ | --------------- |
-| zclExt | \*
|
+
-
+### DB API: zcl database access~cacheQuery(key, packageId) ⇒
-### JS API: generator logic~loadTemplates(db, genTemplatesJsonArray)
+Cache input / output of provided queryFunction
+The queryFunction is assumed to have the following signature:
-Api that loads an array of template JSON files or a single file if
-you just pass in one String.
+async function queryFunction(db, ...) {...}
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+The DB handle is ignored and the remaining arguments are used as the cache key.
-| Param | Type |
-| --------------------- | --------------- |
-| db | \*
|
-| genTemplatesJsonArray | \*
|
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: true or false, depending on whether the cache is present.
-
+| Param | Type |
+| --------- | --------------- |
+| key | \*
|
+| packageId | \*
|
-### JS API: generator logic~loadSingleTemplate(db, genTemplatesJson) ⇒
+
-Main API async function to load templates from a gen-template.json file.
+### DB API: zcl database access~cacheStats()
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: the loading context, contains: db, path, crc, packageId and templateData, or error
+Returns the cache statistics.
-| Param | Type | Description |
-| ---------------- | --------------- | ------------------------------------------------------- |
-| db | \*
| Database |
-| genTemplatesJson | \*
| Path to the JSON file or an array of paths to JSON file |
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+
-
+### DB API: zcl database access~enable()
-### JS API: generator logic~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly) ⇒
+Enable the Database Query cache
-Generates all the templates inside a toplevel package.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves with genResult, that contains all the generated templates, keyed by their 'output'
+### DB API: zcl database access~disable()
-| Param | Type | Description |
-| ------------------ | --------------- | -------------------------------------------------------------------------------------------------- |
-| genResult | \*
| |
-| genTemplateJsonPkg | \*
| Package that points to genTemplate.json file |
-| generateOnly | \*
| if NULL then generate all templates, else only generate template whose out file name matches this. |
+Disable the database cache
-
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+
-### JS API: generator logic~generateSingleTemplate(genResult, singleTemplatePkg) ⇒
+### DB API: zcl database access~selectAtomicType(db, packageId, typeName)
-Function that generates a single package and adds it to the generation result.
+Locates atomic type based on a type name. Query is not case sensitive.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the genResult, with newly generated content added.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
-| Param | Type | Description |
-| ----------------- | --------------- | ------------------------ |
-| genResult | \*
| |
-| singleTemplatePkg | \*
| Single template package. |
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| packageId | \*
|
+| typeName | \*
|
-
+
-### JS API: generator logic~generate(db, packageId) ⇒
+### DB API: zcl database access~selectAtomicById(db, packageId)
-Main API async function to generate stuff.
+Retrieves atomic type by a given Id.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves into a generation result.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
-| Param | Type | Description |
-| --------- | --------------- | ------------------------------------------------------------------------------------- |
-| db | \*
| Database |
-| packageId | \*
| packageId Template package id. It can be either single template or gen template json. |
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| packageId | \*
|
-
+
-### JS API: generator logic~writeFileWithBackup(fileName, content, doBackup) ⇒
+### DB API: zcl database access~isTypeSignedByNameAndPackage(db, name, sessionPackages) ⇒ Promise.<boolean>
-Promise to write out a file, optionally creating a backup.
+Checks if a type by a given name is signed.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise of a written file.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise.<boolean>
- - A promise that resolves to true if the type is signed, false otherwise.
-| Param | Type |
-| -------- | --------------- |
-| fileName | \*
|
-| content | \*
|
-| doBackup | \*
|
+| Param | Type | Description |
+| --------------- | ------------------- | ------------------------------- |
+| db | object
| The database connection object. |
+| name | string
| The name of the type. |
+| sessionPackages | Array
| An array of session packages. |
-
+
-### JS API: generator logic~generateGenerationContent(genResult)
+### DB API: zcl database access~selectAllBitmaps(db) ⇒
-Returns a promise that resolves into a content that should be written out to gen result file.
+Retrieves all the bitmaps in the database.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise that resolves with the rows of bitmaps.
-| Param | Type |
-| --------- | --------------- |
-| genResult | \*
|
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### JS API: generator logic~generateAndWriteFiles(db, sessionId, packageId, outputDirectory) ⇒
+### DB API: zcl database access~selectBitmapByNameAndClusterId(db, name, clusterId, packageIds) ⇒
-Generate files and write them into the given directory.
+Select a bitmap matched by name and clusterId.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: a promise which will resolve when all the files are written.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: bitmap information or undefined
-| Param | Type |
-| --------------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
-| packageId | \*
|
-| outputDirectory | \*
|
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| name | \*
|
+| clusterId | \*
|
+| packageIds | \*
|
-
+
-### JS API: generator logic~postProcessGeneratedFiles(outputDirectory, genResult) ⇒
+### DB API: zcl database access~selectAllEnums(db, packageId) ⇒
-Executes post processing actions as defined by the gen-templates.json
+Retrieves all the enums in the database.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise of a dealt-with post processing actions
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise that resolves with the rows of enums.
-| Param | Type |
-| --------------- | --------------- |
-| outputDirectory | \*
|
-| genResult | \*
|
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| packageId | \*
|
-
+
-### JS API: generator logic~contentIndexer(content)
+### DB API: zcl database access~selectClusterEnums(db, packageId, clusterId) ⇒
-This async function takes a string, and resolves a preview object out of it.
+Retrieves all the enums with cluster references in the database.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise that resolves with the rows of enums.
-| Param | Type | Description |
-| ------- | --------------- | ---------------------------- |
-| content | \*
| String to form into preview. |
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| packageId | \*
|
+| clusterId | \*
|
-
+
-### JS API: generator logic~generateSingleFileForPreview(db, sessionId, fileName) ⇒
+### DB API: zcl database access~selectAllEnumItemsById(db, id) ⇒
-Generates a single file and feeds it back for preview.
+Returns an enum by ID.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves into a preview object.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: enum
+
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
+| id | \*
|
+
+
+
+### DB API: zcl database access~selectAllEnumItems(db, packageId) ⇒
+
+Select all enum items in a package.
+
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: list of enum items
| Param | Type |
| --------- | --------------- |
| db | \*
|
-| sessionId | \*
|
-| fileName | \*
|
+| packageId | \*
|
-
+
-### JS API: generator logic~produceCompiledTemplate(singleTemplatePkg) ⇒
+### DB API: zcl database access~selectEnumById(db, id) ⇒
-Resolves into a precompiled template, either from previous precompile or freshly compiled.
+Select an enum matched by its primary key.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: templates
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: an enum or underfined if not found
-| Param | Type |
-| ----------------- | --------------- |
-| singleTemplatePkg | \*
|
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
+| id | \*
|
-
+
-### JS API: generator logic~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:) ⇒
+### DB API: zcl database access~selectEnumByName(db, name, packageIds) ⇒
-Given db connection, session and a single template package, produce the output.
+Select an enum matched by name.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves with the 'utf8' string that contains the generated content.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: enum or undefined
-| Param | Type | Description |
-| ------------- | --------------- | --------------------------------------------------------------------------------------- |
-| hb | \*
| |
-| metaInfo | \*
| |
-| db | \*
| |
-| sessionId | \*
| |
-| singlePkg | \*
| |
-| overridePath: | \*
| if passed, it provides a path to the override file that can override the overridable.js |
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| name | \*
|
+| packageIds | \*
|
-
+
-### JS API: generator logic~wrapOverridable(originalFn, overrideFn) ⇒
+### DB API: zcl database access~selectEnumByNameAndClusterId(db, name, clusterId, packageIds) ⇒
-This function attemps to call override function, but if override function
-throws an exception, it calls the original function.
+Select an enum matched by name and clusterId.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: result from override function, unless it throws an exception, in which case return result from original function.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: enum information or undefined
| Param | Type |
| ---------- | --------------- |
-| originalFn | \*
|
-| overrideFn | \*
|
+| db | \*
|
+| name | \*
|
+| clusterId | \*
|
+| packageIds | \*
|
-
+
-### JS API: generator logic~loadOverridable(genTemplatePackageId)
+### DB API: zcl database access~selectSessionClusterByCode(db, sessionId, code, mfgCode) ⇒
-This function is responsible to load the overridable function container.
+Returns the cluster available to this session by the code.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: all the cluster objects for a given session.
-| Param | Type |
-| -------------------- | --------------- |
-| genTemplatePackageId | \*
|
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| code | \*
|
+| mfgCode | \*
|
-
+
-### JS API: generator logic~loadPartial(path)
+### DB API: zcl database access~selectAllSessionClusters(db, sessionId) ⇒
-Function that loads the partials.
+Returns all the clusters visible for a given session.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: all the cluster objects for a given session.
-| Param | Type |
-| ----- | --------------- |
-| path | \*
|
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
-
+
-### JS API: generator logic~loadHelper(helpers)
+### DB API: zcl database access~selectSessionAttributeByCode(db, sessionId, clusterCode, side, attributeCode, mfgCode) ⇒
-Function that loads the helpers.
+Returns the attribute available to this session by the code.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: the session attribute
-| Param | Type | Description |
-| ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| helpers | \*
| a string path if value is passed through CLI, the nativeRequire() is leverage the native js function instead of webpack's special sauce. a required() module if invoked by backend js code. this is required to force webpack to resolve the included files as path will be difference after being packed for production. |
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| side | \*
|
+| attributeCode | \*
|
+| mfgCode | \*
|
-
+
-### JS API: generator logic~allBuiltInHelpers() ⇒
+### DB API: zcl database access~selectSessionCommandByCode(db, sessionId, clusterCode, commandCode, source) ⇒
-Returns an object that contains all the helper functions, keyed
-by their name
+Returns the command available to this session by the code.
-NOTE: This method is ONLY used for API testing. You should not use
-this method for any real work inside the engine or something.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: the session attribute
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Object containing all the helper functions.
-
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterCode | \*
|
+| commandCode | \*
|
+| source | \*
|
-### JS API: generator logic~findHelperPackageByAlias(alias) ⇒
+
-Given an alias, this method finds a builtin helper package
-by its alias.
+### DB API: zcl database access~selectStructByNameAndClusterId(db, name, clusterId, packageIds) ⇒
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Helper package or undefined if none was found.
+Select a struct matched by name and clusterId
-| Param | Type |
-| ----- | --------------- |
-| alias | \*
|
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: struct information or undefined
-
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| name | \*
|
+| clusterId | \*
|
+| packageIds | \*
|
-### JS API: generator logic~initializeBuiltInHelpersForPackage()
+
-Global helper initialization
+### DB API: zcl database access~selectStructsWithClusterAssociation(db, packageIds, groupByStructName) ⇒
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-
+Get all structs which have a cluster associated with them. If a struct is
+present in more than one cluster then it can be grouped by struct name to
+avoid additional rows.
-### JS API: generator logic~hbInstance() ⇒
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: structs which have an association with clusters
-This method returns the correct instance for a given generation flow.
+| Param | Type |
+| ----------------- | --------------- |
+| db | \*
|
+| packageIds | \*
|
+| groupByStructName | \*
|
-TBD: At this point it doesn't do anything yet, it's just
-a central point to get the correct instance.
+
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Instance of handlebars to be used.
-
+### DB API: zcl database access~selectClusterBitmaps(db, packageId, clusterId) ⇒
-### JS API: generator logic~makeSynchronizablePromise(promise)
+Retrieves all the bitmaps that are associated with a cluster.
-All promises used by the templates should be synchronizable.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: cluster-related bitmaps
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| packageId | \*
|
+| clusterId | \*
|
-| Param | Type |
-| ------- | --------------- |
-| promise | \*
|
+
-
+### DB API: zcl database access~selectAllDomains(db) ⇒
-### JS API: generator logic~collectBlocks(resultArray, options, context) ⇒
+Retrieves all the domains in the database.
-Helpful function that collects the individual blocks by using elements of an array as a context,
-executing promises for each, and collecting them into the outgoing string.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise that resolves with the rows of domains.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves with a content string.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type | Description |
-| ----------- | --------------- | ---------------------------------------- |
-| resultArray | \*
| |
-| options | \*
| Options passed from a block helper. |
-| context | \*
| The context from within this was called. |
+
-
+### DB API: zcl database access~selectAllStructsWithItemCount(db, packageIds) ⇒
-### JS API: generator logic~ensureZclPackageId(context) ⇒
+Retrieves all the structs in the database, including the count
+of items.
-Returns the promise that resolves with the ZCL properties package id.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise that resolves with the rows of structs.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the package id.
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| packageIds | \*
|
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+
-
+### DB API: zcl database access~selectStructClusters(db, structId) ⇒
-### JS API: generator logic~ensureZclPackageIds(context) ⇒
+Returns an array of clusters that struct belongs to.
-Returns the promise that resolves with all ZCL package id specific to current session.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: clusters
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with a list of package id.
+| Param | Type |
+| -------- | --------------- |
+| db | \*
|
+| structId | \*
|
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+
-
+### DB API: zcl database access~selectEnumClusters(db, enumId) ⇒
-### JS API: generator logic~ensureTemplatePackageId(context) ⇒
+Returns an array of clusters that enum belongs to.
-Returns the promise that resolves with the ZCL properties package id.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: clusters
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the package id.
+| Param | Type |
+| ------ | --------------- |
+| db | \*
|
+| enumId | \*
|
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+
-
+### DB API: zcl database access~selectBitmapClusters(db, bitmapId) ⇒
-### JS API: generator logic~ensureEndpointTypeIds(context) ⇒
+Returns an array of clusters that bitmap belongs to.
-Populate the endpoint type ids into the global context.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: clusters
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: endpoint type ids
+| Param | Type |
+| -------- | --------------- |
+| db | \*
|
+| bitmapId | \*
|
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+
-
+### DB API: zcl database access~selectClusterStructsWithItems(db) ⇒
-### JS API: generator logic~ensureZclClusterSdkExtensions(context, templatePackageId) ⇒
+Retrieves all the cluster-related structs in the database with the items.
-Resolves with cached cluster extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise that resolves with the rows of structs, each one containing items field with rows of items.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with cluster extensions.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+
-
+### DB API: zcl database access~selectAllStructsWithItems(db) ⇒
-### JS API: generator logic~ensureZclDeviceTypeSdkExtensions(context, templatePackageId) ⇒
+Retrieves all the structs in the database with the items.
-Resolves with cached cluster extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise that resolves with the rows of structs, each one containing items field with rows of items.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with cluster extensions.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+
-
+### DB API: zcl database access~selectAllStructItemsByStructName(db, name, packageIds, clusterName) ⇒
-### JS API: generator logic~ensureZclAttributeSdkExtensions(context, templatePackageId) ⇒
+Retrieves the struct items based on struct and cluster name.
+Note: By default clusterName is null.
-Resolves with cached attribute extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: the details of the struct items
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with attribute extensions.
+| Param | Default |
+| ----------- | ------------- |
+| db | |
+| name | |
+| packageIds | |
+| clusterName |
|
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+
-
+### DB API: zcl database access~selectAllClusters(db) ⇒
-### JS API: generator logic~ensureZclAttributeTypeSdkExtensions(context, templatePackageId) ⇒
+Retrieves all the clusters in the database.
-Resolves with cached attribute type extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: Promise that resolves with the rows of clusters.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with attribute type extensions.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+
-
+### DB API: zcl database access~selectClusterByCode(db, packageId, clusterCode, mfgCode) ⇒
-### JS API: generator logic~ensureZclCommandSdkExtensions(context, templatePackageId) ⇒
+Finds cluster by code.
-Resolves with cached command extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: cluster by code in a single package id.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with command extensions.
+| Param | Type | Default | Description |
+| ----------- | --------------- | ------------- | ------------------------------------- |
+| db | \*
| | |
+| packageId | \*
| | Single packageId or an array of them. |
+| clusterCode | \*
| | |
+| mfgCode | \*
|
| |
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+
-
+### DB API: zcl database access~selectClusterById(db, clusterId, packageId) ⇒
-### JS API: generator logic~ensureZclEventSdkExtensions(context, templatePackageId) ⇒
+Returns a promise that resolves into a cluster.
-Resolves with cached command extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: promise that resolves into a cluster object
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with command extensions.
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| clusterId | \*
|
+| packageId | \*
|
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+
-
+### DB API: zcl database access~selectAttributesByClusterIdIncludingGlobal(db, clusterId, packageIds) ⇒
-### JS API: generator logic~templatePromise(global, promise)
+Returns attributes for a given cluster.
+IMPORTANT:
+packageIds are needed to properly deal with the global attributes.
-Every helper that returns a promise, should
-not return the promise directly. So instead of
-returning the promise directly, it should return:
-return templatePromise(this.global, promise)
+This method will NOT only return the attributes that link to
+a given cluster, but will ALSO return the attributes that have
+empty clusterRef (which are global attributes), and the check
+in that case will be made via packageId.
-This will ensure that after tag works as expected.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: promise of a list of attributes, including global attributes
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| clusterId | \*
|
+| packageIds | \*
|
-| Param | Type |
-| ------- | --------------- |
-| global | \*
|
-| promise | \*
|
+
-
+### DB API: zcl database access~selectAttributesByClusterCodeAndManufacturerCode(db, packageId, clusterCode, manufacturerCode) ⇒
-### JS API: generator logic~deprecatedHelper(fn, explanation) ⇒
+Queries for attributes inside a cluster.
-Function wrapper that can be used when a helper is deprecated.
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: promise that resolves into attributes.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: a function that wraps the original function, with deprecation message.
+| Param | Type |
+| ---------------- | --------------- |
+| db | \*
|
+| packageId | \*
|
+| clusterCode | \*
|
+| manufacturerCode | \*
|
-| Param | Type | Description |
-| ----------- | --------------- | ----------------------------------------------------------------------- |
-| fn | \*
| |
-| explanation | \*
| can contain `text`, or `from`/`to`, or just be a string message itself. |
+
-
+### DB API: zcl database access~selectAttributeByAttributeIdAndClusterRef(db, attributeId, clusterRef)
-## Templating API: Access helpers
+This async function should be used when you want to get attributes, while also resolving against any global data that may be overridden by a particular cluster.
-This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
-- [Templating API: Access helpers](#module*Templating API* Access helpers)
- - [~access_aggregate(options)](#module*Templating API* Access helpers..access_aggregate)
- - [~access(options)](#module*Templating API* Access helpers..access)
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| attributeId | \*
|
+| clusterRef | \*
|
-
+
-### Templating API: Access helpers~access_aggregate(options)
+### DB API: zcl database access~selectAllAttributesBySide(db, side, packageId) ⇒
-This helper creates a context for the aggregates of access.
+Query for attributes by side.
-**Kind**: inner method of [Templating API: Access helpers
](#module*Templating API* Access helpers)
+**Kind**: inner method of [DB API: zcl database access
](#module*DB API* zcl database access)
+**Returns**: promise that resolves into attributes.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| side | \*
|
+| packageId | \*
|
-
+
-### Templating API: Access helpers~access(options)
+## JS API: generator logic
-Access helper iterates across all the access triplets associated with the element.
-For each element, context contains role, operation, accessModifier.
-Additionally it creates booleans hasRole, hasOperation and hasAccessModifier
-and hasAtLeastOneAccessElement and hasAllAccessElements
+- [JS API: generator logic](#module*JS API* generator logic)
+ - [~loadGenTemplateFromFile(path)](#module*JS API* generator logic..loadGenTemplateFromFile) ⇒
+ - [~recordTemplatesPackage(context)](#module*JS API* generator logic..recordTemplatesPackage) ⇒
+ - [~decodePackageExtensionEntity(entityType, entity)](#module*JS API* generator logic..decodePackageExtensionEntity) ⇒
+ - [~loadZclExtensions(zclExt)](#module*JS API* generator logic..loadZclExtensions) ⇒
+ - [~loadTemplates(db, genTemplatesJsonArray)](#module*JS API* generator logic..loadTemplates)
+ - [~loadGenTemplatesJsonFile(db, genTemplatesJson)](#module*JS API* generator logic..loadGenTemplatesJsonFile) ⇒
+ - [~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly)](#module*JS API* generator logic..generateAllTemplates) ⇒
+ - [~generateSingleTemplate(genResult, singleTemplatePkg)](#module*JS API* generator logic..generateSingleTemplate) ⇒
+ - [~generate(db, sessionId, templatePackageId, templateGeneratorOptions, options)](#module*JS API* generator logic..generate) ⇒
+ - [~writeFileWithBackup(fileName, content, doBackup)](#module*JS API* generator logic..writeFileWithBackup) ⇒
+ - [~generateGenerationContent(genResult)](#module*JS API* generator logic..generateGenerationContent)
+ - [~generateAndWriteFiles(db, sessionId, packageId, outputDirectory)](#module*JS API* generator logic..generateAndWriteFiles) ⇒
+ - [~postProcessGeneratedFiles(outputDirectory, genResult)](#module*JS API* generator logic..postProcessGeneratedFiles) ⇒
+ - [~contentIndexer(content)](#module*JS API* generator logic..contentIndexer)
+ - [~generateSingleFileForPreview(db, sessionId, fileName)](#module*JS API* generator logic..generateSingleFileForPreview) ⇒
+ - [~produceCompiledTemplate(singleTemplatePkg)](#module*JS API* generator logic..produceCompiledTemplate) ⇒
+ - [~produceIterativeContent(hb, metaInfo, db, sessionId, singleTemplatePkg, genTemplateJsonPackage, options)](#module*JS API* generator logic..produceIterativeContent) ⇒
+ - [~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:)](#module*JS API* generator logic..produceContent) ⇒
+ - [~wrapOverridable(originalFn, overrideFn)](#module*JS API* generator logic..wrapOverridable) ⇒
+ - [~loadOverridable(path)](#module*JS API* generator logic..loadOverridable)
+ - [~loadPartial(path)](#module*JS API* generator logic..loadPartial)
+ - [~loadHelper(helpers)](#module*JS API* generator logic..loadHelper)
+ - [~allBuiltInHelpers()](#module*JS API* generator logic..allBuiltInHelpers) ⇒
+ - [~findHelperPackageByAlias(alias)](#module*JS API* generator logic..findHelperPackageByAlias) ⇒
+ - [~initializeBuiltInHelpersForPackage()](#module*JS API* generator logic..initializeBuiltInHelpersForPackage)
+ - [~hbInstance()](#module*JS API* generator logic..hbInstance) ⇒
+ - [~makeSynchronizablePromise(promise)](#module*JS API* generator logic..makeSynchronizablePromise)
+ - [~collectBlocks(resultArray, options, context)](#module*JS API* generator logic..collectBlocks) ⇒
+ - [~ensureZclPackageId(context)](#module*JS API* generator logic..ensureZclPackageId) ⇒
+ - [~ensureZclPackageIds(context)](#module*JS API* generator logic..ensureZclPackageIds) ⇒
+ - [~ensureTemplatePackageCategory(context)](#module*JS API* generator logic..ensureTemplatePackageCategory) ⇒
+ - [~ensureTemplatePackageId(context)](#module*JS API* generator logic..ensureTemplatePackageId) ⇒
+ - [~ensureEndpointTypeIds(context)](#module*JS API* generator logic..ensureEndpointTypeIds) ⇒
+ - [~ensureZclClusterSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclClusterSdkExtensions) ⇒
+ - [~ensureZclDeviceTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclDeviceTypeSdkExtensions) ⇒
+ - [~ensureZclAttributeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeSdkExtensions) ⇒
+ - [~ensureZclAttributeTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeTypeSdkExtensions) ⇒
+ - [~ensureZclCommandSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclCommandSdkExtensions) ⇒
+ - [~ensureZclEventSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclEventSdkExtensions) ⇒
+ - [~templatePromise(global, promise)](#module*JS API* generator logic..templatePromise)
+ - [~deprecatedHelper(fn, explanation)](#module*JS API* generator logic..deprecatedHelper) ⇒
-**Kind**: inner method of [Templating API: Access helpers
](#module*Templating API* Access helpers)
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+### JS API: generator logic~loadGenTemplateFromFile(path) ⇒
-
+Given a path, it will read generation template object into memory.
-## Templating API: C formatting helpers
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Object that contains: data, crc, templateData
-This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
+| Param | Type |
+| ----- | --------------- |
+| path | \*
|
-- [Templating API: C formatting helpers](#module*Templating API* C formatting helpers)
- - [~asOffset(hex)](#module*Templating API* C formatting helpers..asOffset)
- - [~asDelimitedMacro(label)](#module*Templating API* C formatting helpers..asDelimitedMacro)
- - [~asHex(label)](#module*Templating API* C formatting helpers..asHex) ⇒
- - [~asUnderlyingTypeHelper(dataType, context, packageIds)](#module*Templating API* C formatting helpers..asUnderlyingTypeHelper) ⇒
- - [~asUnderlyingType(value)](#module*Templating API* C formatting helpers..asUnderlyingType) ⇒
- - [~asType(label)](#module*Templating API* C formatting helpers..asType) ⇒
- - [~asSymbol(label)](#module*Templating API* C formatting helpers..asSymbol) ⇒
- - [~asBytes(value)](#module*Templating API* C formatting helpers..asBytes)
- - [~asCamelCased(str)](#module*Templating API* C formatting helpers..asCamelCased) ⇒
- - [~cleanseLabel(label)](#module*Templating API* C formatting helpers..cleanseLabel)
- - [~asUnderscoreLowercase(str)](#module*Templating API* C formatting helpers..asUnderscoreLowercase) ⇒
- - [~cleanseLabelAsKebabCase(label)](#module*Templating API* C formatting helpers..cleanseLabelAsKebabCase)
- - [~asSpacedLowercase(str)](#module*Templating API* C formatting helpers..asSpacedLowercase) ⇒
- - [~asUnderscoreUppercase(str)](#module*Templating API* C formatting helpers..asUnderscoreUppercase) ⇒
- - [~asCliType(size, isSigned)](#module*Templating API* C formatting helpers..asCliType) ⇒
- - [~as_zcl_cli_type(str, optional, isSigned)](#module*Templating API* C formatting helpers..as_zcl_cli_type)
- - [~dataTypeForBitmap(db, bitmap_name, packageIds)](#module*Templating API* C formatting helpers..dataTypeForBitmap)
- - [~dataTypeForEnum(db, enum_name, packageIds)](#module*Templating API* C formatting helpers..dataTypeForEnum)
- - [~addOne(number)](#module*Templating API* C formatting helpers..addOne)
- - [~is_number_greater_than(num1, num2)](#module*Templating API* C formatting helpers..is_number_greater_than) ⇒
- - [~cluster_extension(options)](#module*Templating API* C formatting helpers..cluster_extension) ⇒
- - [~device_type_extension(options)](#module*Templating API* C formatting helpers..device_type_extension) ⇒
- - [~attribute_type_extension(options)](#module*Templating API* C formatting helpers..attribute_type_extension) ⇒
- - [~attribute_extension(options)](#module*Templating API* C formatting helpers..attribute_extension) ⇒
- - [~command_extension(options)](#module*Templating API* C formatting helpers..command_extension) ⇒
- - [~event_extension(options)](#module*Templating API* C formatting helpers..event_extension) ⇒
+
-
+### JS API: generator logic~recordTemplatesPackage(context) ⇒
-### Templating API: C formatting helpers~asOffset(hex)
+Given a loading context, it records the package into the packages table and adds the packageId field into the resolved context.
-Given a hex number, it prints the offset, which is the index of the first non-zero bit.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the same context passed in, except packageId added to it
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
-| Param | Type |
-| ----- | --------------- |
-| hex | \*
|
+
-
+### JS API: generator logic~decodePackageExtensionEntity(entityType, entity) ⇒
-### Templating API: C formatting helpers~asDelimitedMacro(label)
+This method takes extension data in JSON, and converts it into
+an object that contains:
+entityCode, entityQualifier, parentCode, manufacturerCode and value
-Takes a label, and delimits is on camelcasing.
-For example:
-VerySimpleLabel will turn into VERY_SIMPLE_LABEL
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: object that can be used for database injection
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+| Param | Type |
+| ---------- | --------------- |
+| entityType | \*
|
+| entity | \*
|
-| Param | Type |
-| ----- | --------------- |
-| label | \*
|
+
-
+### JS API: generator logic~loadZclExtensions(zclExt) ⇒
-### Templating API: C formatting helpers~asHex(label) ⇒
+Returns a promise that will load the zcl extensions.
-Formats label as a C hex constant.
-If value starts as 0x or 0X it is already treated as hex,
-otherwise it is assumed decimal and converted to hex.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise of loading the zcl extensions.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: Label formatted as C hex constant.
+| Param | Type |
+| ------ | --------------- |
+| zclExt | \*
|
-| Param | Type |
-| ----- | --------------- |
-| label | \*
|
+
-
+### JS API: generator logic~loadTemplates(db, genTemplatesJsonArray)
-### Templating API: C formatting helpers~asUnderlyingTypeHelper(dataType, context, packageIds) ⇒
+Api that loads an array of template JSON files or a single file if
+you just pass in one String.
-This function is a helper function for asUnderlyingType and assists in
-returning the correct C type for the given data type
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: The appropriate C type for the given data type
+| Param | Type |
+| --------------------- | --------------- |
+| db | \*
|
+| genTemplatesJsonArray | \*
|
-| Param | Type |
-| ---------- | --------------- |
-| dataType | \*
|
-| context | \*
|
-| packageIds | \*
|
+
-
+### JS API: generator logic~loadGenTemplatesJsonFile(db, genTemplatesJson) ⇒
-### Templating API: C formatting helpers~asUnderlyingType(value) ⇒
+Main API async function to load templates from a gen-template.json file.
-Converts the actual zcl type into an underlying usable C type.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: the loading context, contains: db, path, crc, packageId and templateData, or error
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: The appropriate C Type
+| Param | Type | Description |
+| ---------------- | --------------- | ------------------------------------------------------- |
+| db | \*
| Database |
+| genTemplatesJson | \*
| Path to the JSON file or an array of paths to JSON file |
-| Param | Type |
-| ----- | --------------- |
-| value | \*
|
+
-
+### JS API: generator logic~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly) ⇒
-### Templating API: C formatting helpers~asType(label) ⇒
+Generates all the templates inside a toplevel package.
-Formats label as a C type.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves with genResult, that contains all the generated templates, keyed by their 'output'
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: Label formatted as C type.
+| Param | Type | Description |
+| ------------------ | --------------- | -------------------------------------------------------------------------------------------------- |
+| genResult | \*
| |
+| genTemplateJsonPkg | \*
| Package that points to genTemplate.json file |
+| generateOnly | \*
| if NULL then generate all templates, else only generate template whose out file name matches this. |
-| Param | Type |
-| ----- | --------------- |
-| label | \*
|
+
-
+### JS API: generator logic~generateSingleTemplate(genResult, singleTemplatePkg) ⇒
-### Templating API: C formatting helpers~asSymbol(label) ⇒
+Function that generates a single package and adds it to the generation result.
-Formats label as a C symbol.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the genResult, with newly generated content added.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: Label formatted as C symbol.
+| Param | Type | Description |
+| ----------------- | --------------- | ------------------------ |
+| genResult | \*
| |
+| singleTemplatePkg | \*
| Single template package. |
-| Param | Type |
-| ----- | --------------- |
-| label | \*
|
+
-
+### JS API: generator logic~generate(db, sessionId, templatePackageId, templateGeneratorOptions, options) ⇒
-### Templating API: C formatting helpers~asBytes(value)
+Main API async function to generate stuff.
-Given a default value of attribute, this method converts it into bytes
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves into a generation result.Promise that resolves into a generation result.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+| Param | Type | Description |
+| ------------------------ | --------------- | ------------------------------------------------------------------------------------- |
+| db | \*
| Database |
+| sessionId | \*
| |
+| templatePackageId | \*
| packageId Template package id. It can be either single template or gen template json. |
+| templateGeneratorOptions | \*
| |
+| options | \*
| |
-| Param | Type |
-| ----- | --------------- |
-| value | \*
|
+
-
+### JS API: generator logic~writeFileWithBackup(fileName, content, doBackup) ⇒
-### Templating API: C formatting helpers~asCamelCased(str) ⇒
+Promise to write out a file, optionally creating a backup.
-Given a string convert it into a camelCased string
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise of a written file.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: a spaced out string in lowercase
+| Param | Type |
+| -------- | --------------- |
+| fileName | \*
|
+| content | \*
|
+| doBackup | \*
|
-| Param | Type |
-| ----- | --------------- |
-| str | \*
|
+
-
+### JS API: generator logic~generateGenerationContent(genResult)
-### Templating API: C formatting helpers~cleanseLabel(label)
+Returns a promise that resolves into a content that should be written out to gen result file.
-returns a string after converting ':' and '-' into '\_'
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+| Param | Type |
+| --------- | --------------- |
+| genResult | \*
|
-| Param | Type |
-| ----- | --------------- |
-| label | \*
|
+
-
+### JS API: generator logic~generateAndWriteFiles(db, sessionId, packageId, outputDirectory) ⇒
-### Templating API: C formatting helpers~asUnderscoreLowercase(str) ⇒
+Generate files and write them into the given directory.
-Given a camel case string, convert it into one with underscore and lowercase
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: a promise which will resolve when all the files are written.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: String in lowercase with underscores
-
-| Param | Type |
-| ----- | --------------- |
-| str | \*
|
+| Param | Type |
+| --------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| packageId | \*
|
+| outputDirectory | \*
|
-
+
-### Templating API: C formatting helpers~cleanseLabelAsKebabCase(label)
+### JS API: generator logic~postProcessGeneratedFiles(outputDirectory, genResult) ⇒
-returns a string after converting ':', ' ' and camel case into '-'
+Executes post processing actions as defined by the gen-templates.json
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise of a dealt-with post processing actions
-| Param | Type |
-| ----- | --------------- |
-| label | \*
|
+| Param | Type |
+| --------------- | --------------- |
+| outputDirectory | \*
|
+| genResult | \*
|
-
+
-### Templating API: C formatting helpers~asSpacedLowercase(str) ⇒
+### JS API: generator logic~contentIndexer(content)
-Given a camel case string convert it into one with space and lowercase
+This async function takes a string, and resolves a preview object out of it.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: a spaced out string in lowercase
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-| Param | Type |
-| ----- | --------------- |
-| str | \*
|
+| Param | Type | Description |
+| ------- | --------------- | ---------------------------- |
+| content | \*
| String to form into preview. |
-
+
-### Templating API: C formatting helpers~asUnderscoreUppercase(str) ⇒
+### JS API: generator logic~generateSingleFileForPreview(db, sessionId, fileName) ⇒
-Given a camel case string convert it into one with underscore and uppercase
+Generates a single file and feeds it back for preview.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: String in uppercase with underscores
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves into a preview object.
-| Param | Type |
-| ----- | --------------- |
-| str | \*
|
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| fileName | \*
|
-
+
-### Templating API: C formatting helpers~asCliType(size, isSigned) ⇒
+### JS API: generator logic~produceCompiledTemplate(singleTemplatePkg) ⇒
-Returns the cli type representation.
+Resolves into a precompiled template, either from previous precompile or freshly compiled.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: the type representation required for CLI.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: templates
-| Param |
-| -------- |
-| size |
-| isSigned |
+| Param | Type |
+| ----------------- | --------------- |
+| singleTemplatePkg | \*
|
-
+
-### Templating API: C formatting helpers~as_zcl_cli_type(str, optional, isSigned)
+### JS API: generator logic~produceIterativeContent(hb, metaInfo, db, sessionId, singleTemplatePkg, genTemplateJsonPackage, options) ⇒
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+This function is reached if the template is an "iterative one", meaning
+it has the iterator set to one of the valid options.
-| Param | Description |
-| -------- | ------------------------------- |
-| str | |
-| optional | |
-| isSigned | Return the data type of zcl cli |
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves into an array of key/content/stats objects.
+
+| Param | Type |
+| ---------------------- | --------------- |
+| hb | \*
|
+| metaInfo | \*
|
+| db | \*
|
+| sessionId | \*
|
+| singleTemplatePkg | \*
|
+| genTemplateJsonPackage | \*
|
+| options | \*
|
-
+
-### Templating API: C formatting helpers~dataTypeForBitmap(db, bitmap_name, packageIds)
+### JS API: generator logic~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:) ⇒
-Returns the type of bitmap based on the bitmap's name
+Given db connection, session and a single template package, produce the output.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves into an array of key/content/stats objects.
-| Param | Type |
-| ----------- | --------------- |
-| db | \*
|
-| bitmap_name | \*
|
-| packageIds | \*
|
+| Param | Type | Description |
+| ------------- | --------------- | --------------------------------------------------------------------------------------- |
+| hb | \*
| |
+| metaInfo | \*
| |
+| db | \*
| |
+| sessionId | \*
| |
+| singlePkg | \*
| |
+| overridePath: | \*
| if passed, it provides a path to the override file that can override the overridable.js |
-
+
-### Templating API: C formatting helpers~dataTypeForEnum(db, enum_name, packageIds)
+### JS API: generator logic~wrapOverridable(originalFn, overrideFn) ⇒
-Returns the type of enum
+This function attemps to call override function, but if override function
+throws an exception, it calls the original function.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: result from override function, unless it throws an exception, in which case return result from original function.
| Param | Type |
| ---------- | --------------- |
-| db | \*
|
-| enum_name | \*
|
-| packageIds | \*
|
-
-
-
-### Templating API: C formatting helpers~addOne(number)
-
-Returns the number by adding 1 to it.
-
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+| originalFn | \*
|
+| overrideFn | \*
|
-| Param | Type |
-| ------ | --------------- |
-| number | \*
|
+
-
+### JS API: generator logic~loadOverridable(path)
-### Templating API: C formatting helpers~is_number_greater_than(num1, num2) ⇒
+This function is responsible to load the overridable function container.
-Return true if number1 is greater than number2
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: true if num1 is greater than num2 else returns false
+| Param | Type | Description |
+| ----- | --------------- | -------------------- |
+| path | \*
| of the override file |
-| Param |
-| ----- |
-| num1 |
-| num2 |
+
-
+### JS API: generator logic~loadPartial(path)
-### Templating API: C formatting helpers~cluster_extension(options) ⇒
+Function that loads the partials.
-When inside a context that contains 'code', this
-helper will output the value of the cluster extension
-specified by property="propName" attribute.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: Value of the cluster extension property.
+| Param | Type |
+| ----- | --------------- |
+| path | \*
|
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+
-
+### JS API: generator logic~loadHelper(helpers)
-### Templating API: C formatting helpers~device_type_extension(options) ⇒
+Function that loads the helpers.
-When inside a context that contains 'code', this
-helper will output the value of the cluster extension
-specified by property="propName" attribute.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: Value of the cluster extension property.
+| Param | Type | Description |
+| ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| helpers | \*
| a string path if value is passed through CLI, the nativeRequire() is leverage the native js function instead of webpack's special sauce. a required() module if invoked by backend js code. this is required to force webpack to resolve the included files as path will be difference after being packed for production. |
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+
-
+### JS API: generator logic~allBuiltInHelpers() ⇒
-### Templating API: C formatting helpers~attribute_type_extension(options) ⇒
+Returns an object that contains all the helper functions, keyed
+by their name
-When inside a context that contains 'type', this
-helper will output the value of the attribute type extension
-specified by property="propName" attribute.
+NOTE: This method is ONLY used for API testing. You should not use
+this method for any real work inside the engine or something.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: Value of the attribute type extension property.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Object containing all the helper functions.
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+### JS API: generator logic~findHelperPackageByAlias(alias) ⇒
-
+Given an alias, this method finds a builtin helper package
+by its alias.
-### Templating API: C formatting helpers~attribute_extension(options) ⇒
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Helper package or undefined if none was found.
-When inside a context that contains 'code' and parent 'code', this
-helper will output the value of the attribute extension
-specified by property="propName" attribute.
+| Param | Type |
+| ----- | --------------- |
+| alias | \*
|
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: Value of the attribute extension property.
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+### JS API: generator logic~initializeBuiltInHelpersForPackage()
-
+Global helper initialization
-### Templating API: C formatting helpers~command_extension(options) ⇒
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
-When inside a context that contains 'code' and parent 'code', this
-helper will output the value of the command extension
-specified by property="propName" attribute.
+### JS API: generator logic~hbInstance() ⇒
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: Value of the command extension property.
+This method returns the correct instance for a given generation flow.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+TBD: At this point it doesn't do anything yet, it's just
+a central point to get the correct instance.
-
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Instance of handlebars to be used.
+
-### Templating API: C formatting helpers~event_extension(options) ⇒
+### JS API: generator logic~makeSynchronizablePromise(promise)
-When inside a context that contains 'code' and parent 'code', this
-helper will output the value of the command extension
-specified by property="propName" attribute.
+All promises used by the templates should be synchronizable.
-**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-**Returns**: Value of the command extension property.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
| Param | Type |
| ------- | --------------- |
-| options | \*
|
+| promise | \*
|
-
+
-## Templating API: C formatting helpers
+### JS API: generator logic~collectBlocks(resultArray, options, context) ⇒
-This module contains the API for accessing SDK extensions.
+Helpful function that collects the individual blocks by using elements of an array as a context,
+executing promises for each, and collecting them into the outgoing string.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves with a content string.
+
+| Param | Type | Description |
+| ----------- | --------------- | ---------------------------------------- |
+| resultArray | \*
| |
+| options | \*
| Options passed from a block helper. |
+| context | \*
| The context from within this was called. |
+
+
+
+### JS API: generator logic~ensureZclPackageId(context) ⇒
+
+Returns the promise that resolves with the ZCL properties package id.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the package id.
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~ensureZclPackageIds(context) ⇒
+
+Returns the promise that resolves with all ZCL package id specific to current session.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with a list of package id.
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~ensureTemplatePackageCategory(context) ⇒
+
+Returns a package category of the toplevel template package from context.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: proimise that resolves into a package category
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~ensureTemplatePackageId(context) ⇒
+
+Returns the promise that resolves with the ZCL properties package id.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the package id.
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~ensureEndpointTypeIds(context) ⇒
+
+Populate the endpoint type ids into the global context.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: endpoint type ids
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~ensureZclClusterSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached cluster extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with cluster extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~ensureZclDeviceTypeSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached cluster extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with cluster extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~ensureZclAttributeSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached attribute extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with attribute extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~ensureZclAttributeTypeSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached attribute type extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with attribute type extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~ensureZclCommandSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached command extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with command extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~ensureZclEventSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached command extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with command extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~templatePromise(global, promise)
+
+Every helper that returns a promise, should
+not return the promise directly. So instead of
+returning the promise directly, it should return:
+return templatePromise(this.global, promise)
+
+This will ensure that after tag works as expected.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+| Param | Type |
+| ------- | --------------- |
+| global | \*
|
+| promise | \*
|
+
+
+
+### JS API: generator logic~deprecatedHelper(fn, explanation) ⇒
+
+Function wrapper that can be used when a helper is deprecated.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: a function that wraps the original function, with deprecation message.
+
+| Param | Type | Description |
+| ----------- | --------------- | ----------------------------------------------------------------------- |
+| fn | \*
| |
+| explanation | \*
| can contain `text`, or `from`/`to`, or just be a string message itself. |
+
+
+
+## Templating API: Access helpers
+
+This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
+
+- [Templating API: Access helpers](#module*Templating API* Access helpers)
+ - [~access_aggregate(options)](#module*Templating API* Access helpers..access_aggregate)
+ - [~access(options)](#module*Templating API* Access helpers..access)
+
+
+
+### Templating API: Access helpers~access_aggregate(options)
+
+This helper creates a context for the aggregates of access.
+
+**Kind**: inner method of [Templating API: Access helpers
](#module*Templating API* Access helpers)
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: Access helpers~access(options)
+
+Access helper iterates across all the access triplets associated with the element.
+For each element, context contains role, operation, accessModifier.
+Additionally it creates booleans hasRole, hasOperation and hasAccessModifier
+and hasAtLeastOneAccessElement and hasAllAccessElements
+
+**Kind**: inner method of [Templating API: Access helpers
](#module*Templating API* Access helpers)
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+## Templating API: C formatting helpers
+
+This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
- [Templating API: C formatting helpers](#module*Templating API* C formatting helpers)
- [~asOffset(hex)](#module*Templating API* C formatting helpers..asOffset)
@@ -7959,7617 +9274,10351 @@ specified by property="propName" attribute.
| ------- | --------------- |
| options | \*
|
-
+
-## Templating API: user-data specific helpers
+## Templating API: C formatting helpers
-This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
+This module contains the API for accessing SDK extensions.
-- [Templating API: user-data specific helpers](#module*Templating API* user-data specific helpers)
- - [~user_endpoints(options)](#module*Templating API* user-data specific helpers..user_endpoints)
- - [~user_endpoint_types(options)](#module*Templating API* user-data specific helpers..user_endpoint_types)
- - [~user_clusters(options)](#module*Templating API* user-data specific helpers..user_clusters)
- - [~user_cluster_attributes(options)](#module*Templating API* user-data specific helpers..user_cluster_attributes) ⇒
- - [~user_cluster_commands(options)](#module*Templating API* user-data specific helpers..user_cluster_commands) ⇒
- - [~user_cluster_events(options)](#module*Templating API* user-data specific helpers..user_cluster_events) ⇒
- - [~user_endpoint_count_by_cluster(clusterTypeId)](#module*Templating API* user-data specific helpers..user_endpoint_count_by_cluster) ⇒
- - [~user_all_attributes(options)](#module*Templating API* user-data specific helpers..user_all_attributes) ⇒
- - [~all_user_cluster_commands(options)](#module*Templating API* user-data specific helpers..all_user_cluster_commands) ⇒
- - [~all_user_cluster_command_util(name, side, options, currentContext, isManufacturingSpecific, isIrrespectiveOfManufacturingSpecification)](#module*Templating API* user-data specific helpers..all_user_cluster_command_util)
- - [~all_user_cluster_manufacturer_specific_commands(options)](#module*Templating API* user-data specific helpers..all_user_cluster_manufacturer_specific_commands) ⇒
- - [~all_user_cluster_non_manufacturer_specific_commands(options)](#module*Templating API* user-data specific helpers..all_user_cluster_non_manufacturer_specific_commands) ⇒
- - [~all_user_cluster_manufacturer_specific_attributes(options)](#module*Templating API* user-data specific helpers..all_user_cluster_manufacturer_specific_attributes) ⇒
- - [~all_user_cluster_non_manufacturer_specific_attributes(options)](#module*Templating API* user-data specific helpers..all_user_cluster_non_manufacturer_specific_attributes) ⇒
- - [~all_commands_for_user_enabled_clusters(options)](#module*Templating API* user-data specific helpers..all_commands_for_user_enabled_clusters) ⇒
- - [~all_cli_commands_for_user_enabled_clusters(options)](#module*Templating API* user-data specific helpers..all_cli_commands_for_user_enabled_clusters) ⇒
- - [~all_user_clusters(options)](#module*Templating API* user-data specific helpers..all_user_clusters) ⇒
- - [~all_user_clusters_irrespective_of_side(options)](#module*Templating API* user-data specific helpers..all_user_clusters_irrespective_of_side) ⇒
- - [~all_user_clusters_names(options)](#module*Templating API* user-data specific helpers..all_user_clusters_names) ⇒
- - [~user_cluster_command_count_with_cli()](#module*Templating API* user-data specific helpers..user_cluster_command_count_with_cli)
- - [~user_cluster_commands_with_cli()](#module*Templating API* user-data specific helpers..user_cluster_commands_with_cli)
- - [~user_cluster_commands_all_endpoints(options)](#module*Templating API* user-data specific helpers..user_cluster_commands_all_endpoints)
- - [~user_cluster_has_enabled_command(name, side)](#module*Templating API* user-data specific helpers..user_cluster_has_enabled_command) ⇒
- - [~all_user_cluster_commands_irrespective_of_manufaturing_specification(options)](#module*Templating API* user-data specific helpers..all_user_cluster_commands_irrespective_of_manufaturing_specification) ⇒
- - [~enabled_attributes_for_cluster_and_side(name, side, options)](#module*Templating API* user-data specific helpers..enabled_attributes_for_cluster_and_side) ⇒
- - [~user_session_key(options)](#module*Templating API* user-data specific helpers..user_session_key) ⇒
- - [~if_command_discovery_enabled()](#module*Templating API* user-data specific helpers..if_command_discovery_enabled)
- - [~is_command_default_response_enabled(command, options)](#module*Templating API* user-data specific helpers..is_command_default_response_enabled) ⇒
- - [~is_command_default_response_disabled(command, options)](#module*Templating API* user-data specific helpers..is_command_default_response_disabled) ⇒
- - [~all_user_cluster_attributes_for_generated_defaults(name, side, options)](#module*Templating API* user-data specific helpers..all_user_cluster_attributes_for_generated_defaults) ⇒
- - [~all_user_cluster_generated_attributes(options)](#module*Templating API* user-data specific helpers..all_user_cluster_generated_attributes) ⇒
- - [~all_user_reportable_attributes(options)](#module*Templating API* user-data specific helpers..all_user_reportable_attributes) ⇒
- - [~all_user_cluster_generated_commands(options)](#module*Templating API* user-data specific helpers..all_user_cluster_generated_commands) ⇒
- - [~all_user_clusters_with_incoming_or_outgoing_commands(options, is_incoming)](#module*Templating API* user-data specific helpers..all_user_clusters_with_incoming_or_outgoing_commands) ⇒
- - [~all_user_clusters_with_incoming_commands(options)](#module*Templating API* user-data specific helpers..all_user_clusters_with_incoming_commands) ⇒
- - [~all_user_clusters_with_outgoing_commands(options)](#module*Templating API* user-data specific helpers..all_user_clusters_with_outgoing_commands) ⇒
- - [~manufacturing_clusters_with_incoming_commands(clusterCode, options)](#module*Templating API* user-data specific helpers..manufacturing_clusters_with_incoming_commands) ⇒
- - [~all_user_clusters_with_incoming_commands_combined(options)](#module*Templating API* user-data specific helpers..all_user_clusters_with_incoming_commands_combined) ⇒
- - [~all_incoming_commands_for_cluster_combined(clusterName, clientSide, serverSide, options)](#module*Templating API* user-data specific helpers..all_incoming_commands_for_cluster_combined) ⇒
- - [~all_incoming_or_outgoing_commands_for_cluster(clusterName, clusterSide, isIncoming, options)](#module*Templating API* user-data specific helpers..all_incoming_or_outgoing_commands_for_cluster) ⇒
- - [~all_incoming_commands_for_cluster(clusterName, options)](#module*Templating API* user-data specific helpers..all_incoming_commands_for_cluster) ⇒
- - [~all_outgoing_commands_for_cluster(clusterName, options)](#module*Templating API* user-data specific helpers..all_outgoing_commands_for_cluster) ⇒
- - [~generated_clustes_details(options)](#module*Templating API* user-data specific helpers..generated_clustes_details) ⇒
- - [~generated_endpoint_type_details(options)](#module*Templating API* user-data specific helpers..generated_endpoint_type_details) ⇒
- - [~all_user_cluster_attributes_min_max_defaults(name, side, options)](#module*Templating API* user-data specific helpers..all_user_cluster_attributes_min_max_defaults) ⇒
- - [~checkAttributeMatch(clusterName, attributeName, attributeSide, attributeValue, attributeValueType, endpointAttributes)](#module*Templating API* user-data specific helpers..checkAttributeMatch) ⇒
- - [~generated_defaults_index(clusterName, attributeName, attributeValueType, attributeValue, prefixReturn, postFixReturn)](#module*Templating API* user-data specific helpers..generated_defaults_index) ⇒
- - [~generated_default_index(clusterName, attributeName, attributeSide, attributeValueType, attributeValue, prefixReturn, postFixReturn)](#module*Templating API* user-data specific helpers..generated_default_index) ⇒
- - [~generated_attributes_min_max_index(name, side, options)](#module*Templating API* user-data specific helpers..generated_attributes_min_max_index) ⇒
- - [~generated_attribute_min_max_index(clusterName, attributeName, attributeSide, options)](#module*Templating API* user-data specific helpers..generated_attribute_min_max_index) ⇒
+- [Templating API: C formatting helpers](#module*Templating API* C formatting helpers)
+ - [~asOffset(hex)](#module*Templating API* C formatting helpers..asOffset)
+ - [~asDelimitedMacro(label)](#module*Templating API* C formatting helpers..asDelimitedMacro)
+ - [~asHex(label)](#module*Templating API* C formatting helpers..asHex) ⇒
+ - [~asUnderlyingTypeHelper(dataType, context, packageIds)](#module*Templating API* C formatting helpers..asUnderlyingTypeHelper) ⇒
+ - [~asUnderlyingType(value)](#module*Templating API* C formatting helpers..asUnderlyingType) ⇒
+ - [~asType(label)](#module*Templating API* C formatting helpers..asType) ⇒
+ - [~asSymbol(label)](#module*Templating API* C formatting helpers..asSymbol) ⇒
+ - [~asBytes(value)](#module*Templating API* C formatting helpers..asBytes)
+ - [~asCamelCased(str)](#module*Templating API* C formatting helpers..asCamelCased) ⇒
+ - [~cleanseLabel(label)](#module*Templating API* C formatting helpers..cleanseLabel)
+ - [~asUnderscoreLowercase(str)](#module*Templating API* C formatting helpers..asUnderscoreLowercase) ⇒
+ - [~cleanseLabelAsKebabCase(label)](#module*Templating API* C formatting helpers..cleanseLabelAsKebabCase)
+ - [~asSpacedLowercase(str)](#module*Templating API* C formatting helpers..asSpacedLowercase) ⇒
+ - [~asUnderscoreUppercase(str)](#module*Templating API* C formatting helpers..asUnderscoreUppercase) ⇒
+ - [~asCliType(size, isSigned)](#module*Templating API* C formatting helpers..asCliType) ⇒
+ - [~as_zcl_cli_type(str, optional, isSigned)](#module*Templating API* C formatting helpers..as_zcl_cli_type)
+ - [~dataTypeForBitmap(db, bitmap_name, packageIds)](#module*Templating API* C formatting helpers..dataTypeForBitmap)
+ - [~dataTypeForEnum(db, enum_name, packageIds)](#module*Templating API* C formatting helpers..dataTypeForEnum)
+ - [~addOne(number)](#module*Templating API* C formatting helpers..addOne)
+ - [~is_number_greater_than(num1, num2)](#module*Templating API* C formatting helpers..is_number_greater_than) ⇒
+ - [~cluster_extension(options)](#module*Templating API* C formatting helpers..cluster_extension) ⇒
+ - [~device_type_extension(options)](#module*Templating API* C formatting helpers..device_type_extension) ⇒
+ - [~attribute_type_extension(options)](#module*Templating API* C formatting helpers..attribute_type_extension) ⇒
+ - [~attribute_extension(options)](#module*Templating API* C formatting helpers..attribute_extension) ⇒
+ - [~command_extension(options)](#module*Templating API* C formatting helpers..command_extension) ⇒
+ - [~event_extension(options)](#module*Templating API* C formatting helpers..event_extension) ⇒
-
+
-### Templating API: user-data specific helpers~user_endpoints(options)
+### Templating API: C formatting helpers~asOffset(hex)
-Creates block iterator over the endpoints.
+Given a hex number, it prints the offset, which is the index of the first non-zero bit.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----- | --------------- |
+| hex | \*
|
-
+
-### Templating API: user-data specific helpers~user_endpoint_types(options)
+### Templating API: C formatting helpers~asDelimitedMacro(label)
-Creates block iterator helper over the endpoint types.
+Takes a label, and delimits is on camelcasing.
+For example:
+VerySimpleLabel will turn into VERY_SIMPLE_LABEL
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----- | --------------- |
+| label | \*
|
-
+
-### Templating API: user-data specific helpers~user_clusters(options)
+### Templating API: C formatting helpers~asHex(label) ⇒
-Creates cluster iterator over the endpoint types.
-This works ony inside user_endpoint_types.
+Formats label as a C hex constant.
+If value starts as 0x or 0X it is already treated as hex,
+otherwise it is assumed decimal and converted to hex.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: Label formatted as C hex constant.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----- | --------------- |
+| label | \*
|
-
+
-### Templating API: user-data specific helpers~user_cluster_attributes(options) ⇒
+### Templating API: C formatting helpers~asUnderlyingTypeHelper(dataType, context, packageIds) ⇒
-Creates endpoint type cluster attribute iterator. This works only
-inside user_clusters.
+This function is a helper function for asUnderlyingType and assists in
+returning the correct C type for the given data type
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over cluster attributes.
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: The appropriate C type for the given data type
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ---------- | --------------- |
+| dataType | \*
|
+| context | \*
|
+| packageIds | \*
|
-
+
-### Templating API: user-data specific helpers~user_cluster_commands(options) ⇒
+### Templating API: C formatting helpers~asUnderlyingType(value) ⇒
-Creates endpoint type cluster command iterator. This works only inside
-user_clusters.
+Converts the actual zcl type into an underlying usable C type.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over cluster commands.
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: The appropriate C Type
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----- | --------------- |
+| value | \*
|
-
+
-### Templating API: user-data specific helpers~user_cluster_events(options) ⇒
+### Templating API: C formatting helpers~asType(label) ⇒
-Creates endpoint type cluster event iterator. This works only inside
-user_clusters.
+Formats label as a C type.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over cluster events.
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: Label formatted as C type.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----- | --------------- |
+| label | \*
|
-
+
-### Templating API: user-data specific helpers~user_endpoint_count_by_cluster(clusterTypeId) ⇒
+### Templating API: C formatting helpers~asSymbol(label) ⇒
-Retrieve the number of endpoints which possess the specified
-cluster type
+Formats label as a C symbol.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the number of endpoint
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: Label formatted as C symbol.
-| Param | Type |
-| ------------- | --------------- |
-| clusterTypeId | \*
|
+| Param | Type |
+| ----- | --------------- |
+| label | \*
|
-
+
-### Templating API: user-data specific helpers~user_all_attributes(options) ⇒
+### Templating API: C formatting helpers~asBytes(value)
-Iterates over all attributes required by the user configuration.
+Given a default value of attribute, this method converts it into bytes
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over cluster commands.
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----- | --------------- |
+| value | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_cluster_commands(options) ⇒
+### Templating API: C formatting helpers~asCamelCased(str) ⇒
-Creates endpoint type cluster command iterator. This fetches all
-commands which have been enabled on added endpoints
+Given a string convert it into a camelCased string
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over cluster commands.
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: a spaced out string in lowercase
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----- | --------------- |
+| str | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_cluster_command_util(name, side, options, currentContext, isManufacturingSpecific, isIrrespectiveOfManufacturingSpecification)
+### Templating API: C formatting helpers~cleanseLabel(label)
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+returns a string after converting ':' and '-' into '\_'
-| Param | Default | Description |
-| ------------------------------------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
-| name | | |
-| side | | |
-| options | | |
-| currentContext | | |
-| isManufacturingSpecific | | |
-| isIrrespectiveOfManufacturingSpecification | false
| Returns: Promise of the resolved blocks iterating over manufacturing specific, non-manufacturing specific or both of the cluster commands. |
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-
+| Param | Type |
+| ----- | --------------- |
+| label | \*
|
-### Templating API: user-data specific helpers~all_user_cluster_manufacturer_specific_commands(options) ⇒
+
-Creates endpoint type cluster command iterator. This fetches all
-manufacturing specific commands which have been enabled on added endpoints
+### Templating API: C formatting helpers~asUnderscoreLowercase(str) ⇒
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over manufacturing specific
-cluster commands.
+Given a camel case string, convert it into one with underscore and lowercase
-| Param |
-| ------- |
-| options |
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: String in lowercase with underscores
-
+| Param | Type |
+| ----- | --------------- |
+| str | \*
|
-### Templating API: user-data specific helpers~all_user_cluster_non_manufacturer_specific_commands(options) ⇒
+
-Creates endpoint type cluster command iterator. This fetches all
-non-manufacturing specific commands which have been enabled on added endpoints
+### Templating API: C formatting helpers~cleanseLabelAsKebabCase(label)
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over non-manufacturing specific
-cluster commands.
+returns a string after converting ':', ' ' and camel case into '-'
-| Param |
-| ------- |
-| options |
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-
+| Param | Type |
+| ----- | --------------- |
+| label | \*
|
-### Templating API: user-data specific helpers~all_user_cluster_manufacturer_specific_attributes(options) ⇒
+
-Creates endpoint type cluster command iterator. This fetches all
-manufacturing specific commands which have been enabled on added endpoints
+### Templating API: C formatting helpers~asSpacedLowercase(str) ⇒
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over manufacturing specific
-cluster commands.
+Given a camel case string convert it into one with space and lowercase
-| Param |
-| ------- |
-| options |
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: a spaced out string in lowercase
-
+| Param | Type |
+| ----- | --------------- |
+| str | \*
|
-### Templating API: user-data specific helpers~all_user_cluster_non_manufacturer_specific_attributes(options) ⇒
+
-Creates endpoint type cluster command iterator. This fetches all
-non-manufacturing specific commands which have been enabled on added endpoints
+### Templating API: C formatting helpers~asUnderscoreUppercase(str) ⇒
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over non-manufacturing specific
-cluster commands.
+Given a camel case string convert it into one with underscore and uppercase
-| Param |
-| ------- |
-| options |
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: String in uppercase with underscores
-
+| Param | Type |
+| ----- | --------------- |
+| str | \*
|
-### Templating API: user-data specific helpers~all_commands_for_user_enabled_clusters(options) ⇒
+
-Creates endpoint type cluster command iterator. This fetches all
-commands which have been enabled on added endpoints
+### Templating API: C formatting helpers~asCliType(size, isSigned) ⇒
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over cluster commands.
+Returns the cli type representation.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: the type representation required for CLI.
-
+| Param |
+| -------- |
+| size |
+| isSigned |
-### Templating API: user-data specific helpers~all_cli_commands_for_user_enabled_clusters(options) ⇒
+
-This helper returns all commands which have cli within the list of enabled
-clusters.
+### Templating API: C formatting helpers~as_zcl_cli_type(str, optional, isSigned)
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: all commands with cli from the list of enabled clusters
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-| Param |
-| ------- |
-| options |
+| Param | Description |
+| -------- | ------------------------------- |
+| str | |
+| optional | |
+| isSigned | Return the data type of zcl cli |
-
+
-### Templating API: user-data specific helpers~all_user_clusters(options) ⇒
+### Templating API: C formatting helpers~dataTypeForBitmap(db, bitmap_name, packageIds)
-Creates cluster iterator for all endpoints.
+Returns the type of bitmap based on the bitmap's name
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over cluster commands.
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| bitmap_name | \*
|
+| packageIds | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_clusters_irrespective_of_side(options) ⇒
+### Templating API: C formatting helpers~dataTypeForEnum(db, enum_name, packageIds)
-Creates cluster command iterator for all endpoints.
+Returns the type of enum
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over cluster commands.
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| enum_name | \*
|
+| packageIds | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_clusters_names(options) ⇒
+### Templating API: C formatting helpers~addOne(number)
-Creates cluster command iterator for all endpoints whitout any duplicates
-cause by cluster side
+Returns the number by adding 1 to it.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over cluster commands.
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ------ | --------------- |
+| number | \*
|
-
+
-### Templating API: user-data specific helpers~user_cluster_command_count_with_cli()
+### Templating API: C formatting helpers~is_number_greater_than(num1, num2) ⇒
-Get the count of the number of clusters commands with cli for a cluster.
-This is used under a cluster block helper
+Return true if number1 is greater than number2
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: true if num1 is greater than num2 else returns false
-### Templating API: user-data specific helpers~user_cluster_commands_with_cli()
+| Param |
+| ----- |
+| num1 |
+| num2 |
-This helper works within the the cluster block helpers. It is used to get
-all commands of the cluster which have cli associated with them.
+
-param options
-Returns: all commands with cli for a cluster
+### Templating API: C formatting helpers~cluster_extension(options) ⇒
-Example:
-{{#all_user_clusters_irrespective_of_side}}
-{{#user_cluster_commands_with_cli}}
-{{/user_cluster_commands_with_cli}}
-{{/all_user_clusters_irrespective_of_side}}
+When inside a context that contains 'code', this
+helper will output the value of the cluster extension
+specified by property="propName" attribute.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: Value of the cluster extension property.
-### Templating API: user-data specific helpers~user_cluster_commands_all_endpoints(options)
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-Creates endpoint type cluster command iterator. This works only inside
-cluster block helpers.
+
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+### Templating API: C formatting helpers~device_type_extension(options) ⇒
-| Param | Description |
-| ------- | ------------------------------------------------------------------------ |
-| options | Returns: Promise of the resolved blocks iterating over cluster commands. |
+When inside a context that contains 'code', this
+helper will output the value of the cluster extension
+specified by property="propName" attribute.
-
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: Value of the cluster extension property.
-### Templating API: user-data specific helpers~user_cluster_has_enabled_command(name, side) ⇒
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-Check if the cluster (name) has any enabled commands. This works only inside
-cluster block helpers.
+
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: True if cluster has enabled commands otherwise false
+### Templating API: C formatting helpers~attribute_type_extension(options) ⇒
-| Param | Type | Description |
-| ----- | --------------- | -------------- |
-| name | \*
| : Cluster name |
-| side | \*
| : Cluster side |
+When inside a context that contains 'type', this
+helper will output the value of the attribute type extension
+specified by property="propName" attribute.
-
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: Value of the attribute type extension property.
-### Templating API: user-data specific helpers~all_user_cluster_commands_irrespective_of_manufaturing_specification(options) ⇒
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-Creates endpoint type cluster command iterator. This fetches all
-manufacturing and non-manufaturing specific commands which have been enabled
-on added endpoints
+
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over manufacturing specific
-and non-manufacturing specific cluster commands.
+### Templating API: C formatting helpers~attribute_extension(options) ⇒
-| Param |
-| ------- |
-| options |
+When inside a context that contains 'code' and parent 'code', this
+helper will output the value of the attribute extension
+specified by property="propName" attribute.
-
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: Value of the attribute extension property.
-### Templating API: user-data specific helpers~enabled_attributes_for_cluster_and_side(name, side, options) ⇒
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-Creates endpoint type cluster attribute iterator. This fetches all
-manufacturing-specific and standard attributes which have been enabled on
-added endpoints based on the name and side of the cluster. When side
-is not mentioned then client and server attributes are returned.
-Available Options:
+
-- removeKeys: Removes one or more keys from the map(for eg keys in db-mapping.js)
- for eg:(#enabled_attributes_for_cluster_and_side
- [cluster-name], [cluster-side], removeKeys='isOptional, isNullable')
- will remove 'isOptional' and 'isNullable' from the results
+### Templating API: C formatting helpers~command_extension(options) ⇒
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of the resolved blocks iterating over manufacturing specific
-and standard cluster attributes.
+When inside a context that contains 'code' and parent 'code', this
+helper will output the value of the command extension
+specified by property="propName" attribute.
-| Param |
-| ------- |
-| name |
-| side |
-| options |
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: Value of the command extension property.
-
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-### Templating API: user-data specific helpers~user_session_key(options) ⇒
+
-Helper that resolves into a user session key value.
+### Templating API: C formatting helpers~event_extension(options) ⇒
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Promise of value of the session key or undefined.
+When inside a context that contains 'code' and parent 'code', this
+helper will output the value of the command extension
+specified by property="propName" attribute.
+
+**Kind**: inner method of [Templating API: C formatting helpers
](#module*Templating API* C formatting helpers)
+**Returns**: Value of the command extension property.
| Param | Type |
| ------- | --------------- |
| options | \*
|
-
+
-### Templating API: user-data specific helpers~if_command_discovery_enabled()
+## Templating API: user-data specific helpers
-If helper that checks if command discovery is enabled
+This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
-example:
-{{#if_command_discovery_enabled}}
-command discovery is enabled
-{{else}}
-command discovery is not enabled
-{{/if_command_discovery_enabled}}
+- [Templating API: user-data specific helpers](#module*Templating API* user-data specific helpers)
+ - [~user_endpoints(options)](#module*Templating API* user-data specific helpers..user_endpoints)
+ - [~user_device_types(options)](#module*Templating API* user-data specific helpers..user_device_types)
+ - [~user_endpoint_types(options)](#module*Templating API* user-data specific helpers..user_endpoint_types)
+ - [~user_clusters(options)](#module*Templating API* user-data specific helpers..user_clusters)
+ - [~user_cluster_attributes(options)](#module*Templating API* user-data specific helpers..user_cluster_attributes) ⇒
+ - [~user_cluster_commands(options)](#module*Templating API* user-data specific helpers..user_cluster_commands) ⇒
+ - [~user_cluster_events(options)](#module*Templating API* user-data specific helpers..user_cluster_events) ⇒
+ - [~user_endpoint_count_by_cluster(clusterTypeId)](#module*Templating API* user-data specific helpers..user_endpoint_count_by_cluster) ⇒
+ - [~user_all_attributes(options)](#module*Templating API* user-data specific helpers..user_all_attributes) ⇒
+ - [~all_user_cluster_commands(options)](#module*Templating API* user-data specific helpers..all_user_cluster_commands) ⇒
+ - [~all_user_cluster_command_util(name, side, options, currentContext, isManufacturingSpecific, isIrrespectiveOfManufacturingSpecification)](#module*Templating API* user-data specific helpers..all_user_cluster_command_util)
+ - [~all_user_cluster_manufacturer_specific_commands(options)](#module*Templating API* user-data specific helpers..all_user_cluster_manufacturer_specific_commands) ⇒
+ - [~all_user_cluster_non_manufacturer_specific_commands(options)](#module*Templating API* user-data specific helpers..all_user_cluster_non_manufacturer_specific_commands) ⇒
+ - [~all_user_cluster_manufacturer_specific_attributes(options)](#module*Templating API* user-data specific helpers..all_user_cluster_manufacturer_specific_attributes) ⇒
+ - [~all_user_cluster_non_manufacturer_specific_attributes(options)](#module*Templating API* user-data specific helpers..all_user_cluster_non_manufacturer_specific_attributes) ⇒
+ - [~all_commands_for_user_enabled_clusters(options)](#module*Templating API* user-data specific helpers..all_commands_for_user_enabled_clusters) ⇒
+ - [~all_cli_commands_for_user_enabled_clusters(options)](#module*Templating API* user-data specific helpers..all_cli_commands_for_user_enabled_clusters) ⇒
+ - [~all_user_clusters(options)](#module*Templating API* user-data specific helpers..all_user_clusters) ⇒
+ - [~all_user_clusters_irrespective_of_side(options)](#module*Templating API* user-data specific helpers..all_user_clusters_irrespective_of_side) ⇒
+ - [~all_user_clusters_names(options)](#module*Templating API* user-data specific helpers..all_user_clusters_names) ⇒
+ - [~user_cluster_command_count_with_cli()](#module*Templating API* user-data specific helpers..user_cluster_command_count_with_cli)
+ - [~user_cluster_commands_with_cli()](#module*Templating API* user-data specific helpers..user_cluster_commands_with_cli)
+ - [~user_cluster_commands_all_endpoints(options)](#module*Templating API* user-data specific helpers..user_cluster_commands_all_endpoints)
+ - [~user_cluster_has_enabled_command(name, side)](#module*Templating API* user-data specific helpers..user_cluster_has_enabled_command) ⇒
+ - [~all_user_cluster_commands_irrespective_of_manufaturing_specification(options)](#module*Templating API* user-data specific helpers..all_user_cluster_commands_irrespective_of_manufaturing_specification) ⇒
+ - [~enabled_attributes_for_cluster_and_side(name, side, options)](#module*Templating API* user-data specific helpers..enabled_attributes_for_cluster_and_side) ⇒
+ - [~user_session_key(options)](#module*Templating API* user-data specific helpers..user_session_key) ⇒
+ - [~if_command_discovery_enabled()](#module*Templating API* user-data specific helpers..if_command_discovery_enabled)
+ - [~is_command_default_response_enabled(command, options)](#module*Templating API* user-data specific helpers..is_command_default_response_enabled) ⇒
+ - [~is_command_default_response_disabled(command, options)](#module*Templating API* user-data specific helpers..is_command_default_response_disabled) ⇒
+ - [~all_user_cluster_attributes_for_generated_defaults(name, side, options)](#module*Templating API* user-data specific helpers..all_user_cluster_attributes_for_generated_defaults) ⇒
+ - [~all_user_cluster_generated_attributes(options)](#module*Templating API* user-data specific helpers..all_user_cluster_generated_attributes) ⇒
+ - [~all_user_reportable_attributes(options)](#module*Templating API* user-data specific helpers..all_user_reportable_attributes) ⇒
+ - [~all_user_cluster_generated_commands(options)](#module*Templating API* user-data specific helpers..all_user_cluster_generated_commands) ⇒
+ - [~all_user_clusters_with_incoming_or_outgoing_commands(options, is_incoming)](#module*Templating API* user-data specific helpers..all_user_clusters_with_incoming_or_outgoing_commands) ⇒
+ - [~all_user_clusters_with_incoming_commands(options)](#module*Templating API* user-data specific helpers..all_user_clusters_with_incoming_commands) ⇒
+ - [~all_user_clusters_with_outgoing_commands(options)](#module*Templating API* user-data specific helpers..all_user_clusters_with_outgoing_commands) ⇒
+ - [~manufacturing_clusters_with_incoming_commands(clusterCode, options)](#module*Templating API* user-data specific helpers..manufacturing_clusters_with_incoming_commands) ⇒
+ - [~all_user_clusters_with_incoming_commands_combined(options)](#module*Templating API* user-data specific helpers..all_user_clusters_with_incoming_commands_combined) ⇒
+ - [~all_incoming_commands_for_cluster_combined(clusterName, clientSide, serverSide, options)](#module*Templating API* user-data specific helpers..all_incoming_commands_for_cluster_combined) ⇒
+ - [~all_incoming_or_outgoing_commands_for_cluster(clusterName, clusterSide, isIncoming, options)](#module*Templating API* user-data specific helpers..all_incoming_or_outgoing_commands_for_cluster) ⇒
+ - [~all_incoming_commands_for_cluster(clusterName, options)](#module*Templating API* user-data specific helpers..all_incoming_commands_for_cluster) ⇒
+ - [~all_outgoing_commands_for_cluster(clusterName, options)](#module*Templating API* user-data specific helpers..all_outgoing_commands_for_cluster) ⇒
+ - [~generated_clustes_details(options)](#module*Templating API* user-data specific helpers..generated_clustes_details) ⇒
+ - [~generated_endpoint_type_details(options)](#module*Templating API* user-data specific helpers..generated_endpoint_type_details) ⇒
+ - [~all_user_cluster_attributes_min_max_defaults(name, side, options)](#module*Templating API* user-data specific helpers..all_user_cluster_attributes_min_max_defaults) ⇒
+ - [~checkAttributeMatch(clusterName, attributeName, attributeSide, attributeValue, attributeValueType, endpointAttributes)](#module*Templating API* user-data specific helpers..checkAttributeMatch) ⇒
+ - [~generated_defaults_index(clusterName, attributeName, attributeValueType, attributeValue, prefixReturn, postFixReturn)](#module*Templating API* user-data specific helpers..generated_defaults_index) ⇒
+ - [~generated_default_index(clusterName, attributeName, attributeSide, attributeValueType, attributeValue, prefixReturn, postFixReturn)](#module*Templating API* user-data specific helpers..generated_default_index) ⇒
+ - [~generated_attributes_min_max_index(name, side, options)](#module*Templating API* user-data specific helpers..generated_attributes_min_max_index) ⇒
+ - [~generated_attribute_min_max_index(clusterName, attributeName, attributeSide, options)](#module*Templating API* user-data specific helpers..generated_attribute_min_max_index) ⇒
+ - [~if_enabled_clusters(options)](#module*Templating API* user-data specific helpers..if_enabled_clusters) ⇒
+ - [~if_multi_protocol_attributes_enabled(options)](#module*Templating API* user-data specific helpers..if_multi_protocol_attributes_enabled) ⇒
+ - [~all_multi_protocol_attributes(options)](#module*Templating API* user-data specific helpers..all_multi_protocol_attributes) ⇒
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-
+
-### Templating API: user-data specific helpers~is_command_default_response_enabled(command, options) ⇒
+### Templating API: user-data specific helpers~user_endpoints(options)
-An if helper to check if default response for a command is enabled or not.
+Creates block iterator over the endpoints.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: true if the the default response policy is either always or
-when the policy is not never and the command has the disable default
-response policy set to false(not true)
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
| Param | Type |
| ------- | --------------- |
-| command | \*
|
| options | \*
|
-
+
-### Templating API: user-data specific helpers~is_command_default_response_disabled(command, options) ⇒
+### Templating API: user-data specific helpers~user_device_types(options)
-An if helper to check if default response for a command is disabled or not.
+Creates device type iterator over an endpoint type id.
+This works inside user_endpoints or user_endpoint_types.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: true if the the default response policy is either never or
-when the policy is not always and the command has the disable default
-response policy set to true(for eg disableDefaultResponse="true" in xml).
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
| Param | Type |
| ------- | --------------- |
-| command | \*
|
| options | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_cluster_attributes_for_generated_defaults(name, side, options) ⇒
+### Templating API: user-data specific helpers~user_endpoint_types(options)
-Default values for the attributes longer than a pointer.
-All attribute values with size greater than 2 bytes.
-Excluding 0 values and externally saved values
+Creates block iterator helper over the endpoint types.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Attribute values greater than 2 bytes and not 0 nor externally saved.
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-| Param |
-| ------- |
-| name |
-| side |
-| options |
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_cluster_generated_attributes(options) ⇒
+### Templating API: user-data specific helpers~user_clusters(options)
-Entails the list of all attributes which have been enabled. Given the
-cluster is enabled as well. The helper retrieves the attributes across
-all endpoints.
+Creates cluster iterator over the endpoint types.
+This works ony inside user_endpoint_types.
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: enabled attributes
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-| Param |
-| ------- |
-| options |
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_reportable_attributes(options) ⇒
+### Templating API: user-data specific helpers~user_cluster_attributes(options) ⇒
-Entails the list of reportable attributes which have been enabled. Given the
-cluster is enabled as well. The helper retrieves the reportable attributes
-per endpoint per cluster.
+Creates endpoint type cluster attribute iterator. This works only
+inside user_clusters.
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Reportable attributes
+**Returns**: Promise of the resolved blocks iterating over cluster attributes.
-| Param |
-| ------- |
-| options |
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_cluster_generated_commands(options) ⇒
+### Templating API: user-data specific helpers~user_cluster_commands(options) ⇒
-All available cluster commands across all endpoints and clusters.
+Creates endpoint type cluster command iterator. This works only inside
+user_clusters.
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: All available cluster commands across all endpoints and clusters
+**Returns**: Promise of the resolved blocks iterating over cluster commands.
-| Param |
-| ------- |
-| options |
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_clusters_with_incoming_or_outgoing_commands(options, is_incoming) ⇒
+### Templating API: user-data specific helpers~user_cluster_events(options) ⇒
-Util function for all clusters with side that have available incoming or
-outgiong commands across all endpoints.
+Creates endpoint type cluster event iterator. This works only inside
+user_clusters.
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: All clusters with side that have available incoming or outgiong
-commands across all endpoints.
+**Returns**: Promise of the resolved blocks iterating over cluster events.
-| Param | Description |
-| ----------- | ----------------------------------------------------- |
-| options | |
-| is_incoming | boolean to check if commands are incoming or outgoing |
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_clusters_with_incoming_commands(options) ⇒
+### Templating API: user-data specific helpers~user_endpoint_count_by_cluster(clusterTypeId) ⇒
-All clusters with side that have available incoming commands
+Retrieve the number of endpoints which possess the specified
+cluster type
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: All clusters with side that have available incoming commands across
-all endpoints.
+**Returns**: Promise of the number of endpoint
-| Param |
-| ------- |
-| options |
+| Param | Type |
+| ------------- | --------------- |
+| clusterTypeId | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_clusters_with_outgoing_commands(options) ⇒
+### Templating API: user-data specific helpers~user_all_attributes(options) ⇒
-All clusters with side that have available outgoing commands
+Iterates over all attributes required by the user configuration.
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: All clusters with side that have available outgoing commands across
-all endpoints.
+**Returns**: Promise of the resolved blocks iterating over cluster commands.
-| Param |
-| ------- |
-| options |
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-
+
-### Templating API: user-data specific helpers~manufacturing_clusters_with_incoming_commands(clusterCode, options) ⇒
+### Templating API: user-data specific helpers~all_user_cluster_commands(options) ⇒
-Provide all manufacturing specific clusters that have incoming commands with
-the given cluster code.
+Creates endpoint type cluster command iterator. This fetches all
+commands which have been enabled on added endpoints
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Details of manufacturing specific clusters that have incoming
-commands with the given cluster code
+**Returns**: Promise of the resolved blocks iterating over cluster commands.
-| Param |
-| ----------- |
-| clusterCode |
-| options |
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-
+
-### Templating API: user-data specific helpers~all_user_clusters_with_incoming_commands_combined(options) ⇒
+### Templating API: user-data specific helpers~all_user_cluster_command_util(name, side, options, currentContext, isManufacturingSpecific, isIrrespectiveOfManufacturingSpecification)
-All clusters that have available incoming commands.
-If there is a client and server enabled on the endpoint, this combines them
-into a single entry.
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: All clusters that have available incoming commands across
-all endpoints.
+| Param | Default | Description |
+| ------------------------------------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
+| name | | |
+| side | | |
+| options | | |
+| currentContext | | |
+| isManufacturingSpecific | | |
+| isIrrespectiveOfManufacturingSpecification | false
| Returns: Promise of the resolved blocks iterating over manufacturing specific, non-manufacturing specific or both of the cluster commands. |
-| Param |
-| ------- |
-| options |
+
-
-
-### Templating API: user-data specific helpers~all_incoming_commands_for_cluster_combined(clusterName, clientSide, serverSide, options) ⇒
+### Templating API: user-data specific helpers~all_user_cluster_manufacturer_specific_commands(options) ⇒
-All commands that need to be parsed for a given cluster. This takes in booleans
-for if the client and or server are included.
+Creates endpoint type cluster command iterator. This fetches all
+manufacturing specific commands which have been enabled on added endpoints
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: all commands that need to be parsed for a given cluster
+**Returns**: Promise of the resolved blocks iterating over manufacturing specific
+cluster commands.
-| Param |
-| ----------- |
-| clusterName |
-| clientSide |
-| serverSide |
-| options |
+| Param |
+| ------- |
+| options |
-
+
-### Templating API: user-data specific helpers~all_incoming_or_outgoing_commands_for_cluster(clusterName, clusterSide, isIncoming, options) ⇒
+### Templating API: user-data specific helpers~all_user_cluster_non_manufacturer_specific_commands(options) ⇒
-A util function for all incoming or outgoing commands that need to be parsed
-for a given cluster
+Creates endpoint type cluster command iterator. This fetches all
+non-manufacturing specific commands which have been enabled on added endpoints
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: All incoming or outgoing commands that need to be parsed for a given
-cluster
+**Returns**: Promise of the resolved blocks iterating over non-manufacturing specific
+cluster commands.
-| Param |
-| ----------- |
-| clusterName |
-| clusterSide |
-| isIncoming |
-| options |
+| Param |
+| ------- |
+| options |
-
+
-### Templating API: user-data specific helpers~all_incoming_commands_for_cluster(clusterName, options) ⇒
+### Templating API: user-data specific helpers~all_user_cluster_manufacturer_specific_attributes(options) ⇒
-All incoming commands that need to be parsed for a given cluster
+Creates endpoint type cluster command iterator. This fetches all
+manufacturing specific commands which have been enabled on added endpoints
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: all incoming commands that need to be parsed for a given cluster
+**Returns**: Promise of the resolved blocks iterating over manufacturing specific
+cluster commands.
-| Param |
-| ----------- |
-| clusterName |
-| options |
+| Param |
+| ------- |
+| options |
-
+
-### Templating API: user-data specific helpers~all_outgoing_commands_for_cluster(clusterName, options) ⇒
+### Templating API: user-data specific helpers~all_user_cluster_non_manufacturer_specific_attributes(options) ⇒
-All outgoing commands that need to be parsed for a given cluster
+Creates endpoint type cluster command iterator. This fetches all
+non-manufacturing specific commands which have been enabled on added endpoints
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: all outgoing commands that need to be parsed for a given cluster
+**Returns**: Promise of the resolved blocks iterating over non-manufacturing specific
+cluster commands.
-| Param |
-| ----------- |
-| clusterName |
-| options |
+| Param |
+| ------- |
+| options |
-
+
-### Templating API: user-data specific helpers~generated_clustes_details(options) ⇒
+### Templating API: user-data specific helpers~all_commands_for_user_enabled_clusters(options) ⇒
-Entails the Cluster details per endpoint
+Creates endpoint type cluster command iterator. This fetches all
+commands which have been enabled on added endpoints
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Cluster Details per endpoint with attribute summaries within the clusters
+**Returns**: Promise of the resolved blocks iterating over cluster commands.
| Param | Type |
| ------- | --------------- |
| options | \*
|
-
+
-### Templating API: user-data specific helpers~generated_endpoint_type_details(options) ⇒
+### Templating API: user-data specific helpers~all_cli_commands_for_user_enabled_clusters(options) ⇒
-Entails Endpoint type details along with their cluster summaries
+This helper returns all commands which have cli within the list of enabled
+clusters.
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: Endpoint type details along with their cluster summaries
+**Returns**: all commands with cli from the list of enabled clusters
| Param |
| ------- |
| options |
-
+
-### Templating API: user-data specific helpers~all_user_cluster_attributes_min_max_defaults(name, side, options) ⇒
+### Templating API: user-data specific helpers~all_user_clusters(options) ⇒
-Returns attributes inside an endpoint type that either have a default or a
-bounded attribute.
+Creates cluster iterator for all endpoints.
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: endpoints with bounds or defaults
+**Returns**: Promise of the resolved blocks iterating over cluster commands.
-| Param |
-| ------- |
-| name |
-| side |
-| options |
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-
+
-### Templating API: user-data specific helpers~checkAttributeMatch(clusterName, attributeName, attributeSide, attributeValue, attributeValueType, endpointAttributes) ⇒
+### Templating API: user-data specific helpers~all_user_clusters_irrespective_of_side(options) ⇒
+
+Creates cluster command iterator for all endpoints.
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: arrayIndex
+**Returns**: Promise of the resolved blocks iterating over cluster commands.
-| Param |
-| ------------------ |
-| clusterName |
-| attributeName |
-| attributeSide |
-| attributeValue |
-| attributeValueType |
-| endpointAttributes |
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-
+
-### Templating API: user-data specific helpers~generated_defaults_index(clusterName, attributeName, attributeValueType, attributeValue, prefixReturn, postFixReturn) ⇒
+### Templating API: user-data specific helpers~all_user_clusters_names(options) ⇒
-Extracts the index of generated defaults array which come from
-all_user_cluster_attributes_for_generated_defaults
+Creates cluster command iterator for all endpoints whitout any duplicates
+cause by cluster side
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: index of the generated default array
+**Returns**: Promise of the resolved blocks iterating over cluster commands.
-| Param |
-| ------------------ |
-| clusterName |
-| attributeName |
-| attributeValueType |
-| attributeValue |
-| prefixReturn |
-| postFixReturn |
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-
+
-### Templating API: user-data specific helpers~generated_default_index(clusterName, attributeName, attributeSide, attributeValueType, attributeValue, prefixReturn, postFixReturn) ⇒
+### Templating API: user-data specific helpers~user_cluster_command_count_with_cli()
-Extracts the index of generated defaults array which come from
-all_user_cluster_attributes_for_generated_defaults
+Get the count of the number of clusters commands with cli for a cluster.
+This is used under a cluster block helper
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: deafult value's index in the generated default array
+
-| Param |
-| ------------------ |
-| clusterName |
-| attributeName |
-| attributeSide |
-| attributeValueType |
-| attributeValue |
-| prefixReturn |
-| postFixReturn |
+### Templating API: user-data specific helpers~user_cluster_commands_with_cli()
-
+This helper works within the the cluster block helpers. It is used to get
+all commands of the cluster which have cli associated with them.
-### Templating API: user-data specific helpers~generated_attributes_min_max_index(name, side, options) ⇒
+param options
+Returns: all commands with cli for a cluster
-Extracts the index of generated min max defaults array which come from
-all_user_cluster_attributes_min_max_defaults
+Example:
+{{#all_user_clusters_irrespective_of_side}}
+{{#user_cluster_commands_with_cli}}
+{{/user_cluster_commands_with_cli}}
+{{/all_user_clusters_irrespective_of_side}}
**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: index of the generated min max default array
-
-| Param |
-| ------- |
-| name |
-| side |
-| options |
+
-
+### Templating API: user-data specific helpers~user_cluster_commands_all_endpoints(options)
-### Templating API: user-data specific helpers~generated_attribute_min_max_index(clusterName, attributeName, attributeSide, options) ⇒
+Creates endpoint type cluster command iterator. This works only inside
+cluster block helpers.
-Extracts the index of generated min max defaults array which come from
-all_user_cluster_attributes_min_max_defaults
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
-**Returns**: index of the generated min max default in the array
+| Param | Description |
+| ------- | ------------------------------------------------------------------------ |
+| options | Returns: Promise of the resolved blocks iterating over cluster commands. |
-| Param |
-| ------------- |
-| clusterName |
-| attributeName |
-| attributeSide |
-| options |
+
-
+### Templating API: user-data specific helpers~user_cluster_has_enabled_command(name, side) ⇒
-## Templating API: toplevel utility helpers
+Check if the cluster (name) has any enabled commands. This works only inside
+cluster block helpers.
-This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: True if cluster has enabled commands otherwise false
-- [Templating API: toplevel utility helpers](#module*Templating API* toplevel utility helpers)
- - [~zap_header()](#module*Templating API* toplevel utility helpers..zap_header) ⇒
- - [~ident()](#module*Templating API* toplevel utility helpers..ident) ⇒
- - [~template_options(category, options)](#module*Templating API* toplevel utility helpers..template_options)
- - [~first(options)](#module*Templating API* toplevel utility helpers..first) ⇒
- - [~not_first(options)](#module*Templating API* toplevel utility helpers..not_first) ⇒
- - [~last(options)](#module*Templating API* toplevel utility helpers..last) ⇒
- - [~not_last(optionms)](#module*Templating API* toplevel utility helpers..not_last) ⇒
- - [~middle(options)](#module*Templating API* toplevel utility helpers..middle) ⇒
- - [~template_option_with_code(options, key)](#module*Templating API* toplevel utility helpers..template_option_with_code)
- - [~fail(options)](#module*Templating API* toplevel utility helpers..fail)
- - [~isEqual(string_a, string_b)](#module*Templating API* toplevel utility helpers..isEqual)
- - [~is_lowercase_equal(string_a, string_b)](#module*Templating API* toplevel utility helpers..is_lowercase_equal)
- - [~trim_string(str)](#module*Templating API* toplevel utility helpers..trim_string) ⇒
- - [~asLastWord(str)](#module*Templating API* toplevel utility helpers..asLastWord)
- - [~iterate()](#module*Templating API* toplevel utility helpers..iterate)
- - [~concatenate()](#module*Templating API* toplevel utility helpers..concatenate)
- - [~is_num_equal(numA, numB)](#module*Templating API* toplevel utility helpers..is_num_equal) ⇒
- - [~is_defined(value)](#module*Templating API* toplevel utility helpers..is_defined) ⇒
- - [~replace_string(mainString, replaceString, replaceWithString)](#module*Templating API* toplevel utility helpers..replace_string) ⇒
- - [~add_prefix_to_all_strings(str, prefixStr)](#module*Templating API* toplevel utility helpers..add_prefix_to_all_strings) ⇒
- - [~multiply()](#module*Templating API* toplevel utility helpers..multiply) ⇒
- - [~is_string_underscored(val)](#module*Templating API* toplevel utility helpers..is_string_underscored) ⇒
- - [~as_uppercase(val)](#module*Templating API* toplevel utility helpers..as_uppercase) ⇒
+| Param | Type | Description |
+| ----- | --------------- | -------------- |
+| name | \*
| : Cluster name |
+| side | \*
| : Cluster side |
-
+
-### Templating API: toplevel utility helpers~zap_header() ⇒
+### Templating API: user-data specific helpers~all_user_cluster_commands_irrespective_of_manufaturing_specification(options) ⇒
-Produces the top-of-the-file header for a C file.
+Creates endpoint type cluster command iterator. This fetches all
+manufacturing and non-manufaturing specific commands which have been enabled
+on added endpoints
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: The header content
-
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: Promise of the resolved blocks iterating over manufacturing specific
+and non-manufacturing specific cluster commands.
-### Templating API: toplevel utility helpers~ident() ⇒
+| Param |
+| ------- |
+| options |
-Simple helper that produces an approved size of identation.
+
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: whitespace that is the identation.
-
+### Templating API: user-data specific helpers~enabled_attributes_for_cluster_and_side(name, side, options) ⇒
-### Templating API: toplevel utility helpers~template_options(category, options)
+Creates endpoint type cluster attribute iterator. This fetches all
+manufacturer-specific and standard attributes which have been enabled on
+added endpoints based on the name and side of the cluster. When side
+is not mentioned then client and server attributes are returned.
+Available Options:
-Block helper that iterates over the package options of a given category.
+- removeKeys: Removes one or more keys from the map(for eg keys in db-mapping.js)
+ for eg:(#enabled_attributes_for_cluster_and_side
+ [cluster-name], [cluster-side], removeKeys='isOptional, isNullable')
+ will remove 'isOptional' and 'isNullable' from the results
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: Promise of the resolved blocks iterating over manufacturing specific
+and standard cluster attributes.
-| Param | Type |
-| -------- | --------------- |
-| category | \*
|
-| options | \*
|
+| Param |
+| ------- |
+| name |
+| side |
+| options |
-
+
-### Templating API: toplevel utility helpers~first(options) ⇒
+### Templating API: user-data specific helpers~user_session_key(options) ⇒
-Inside an iterator, this helper allows you to specify the content that will be output only
-during the first element.
+Helper that resolves into a user session key value.
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: content, if it's the first element inside an operator, empty otherwise.
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: Promise of value of the session key or undefined.
| Param | Type |
| ------- | --------------- |
| options | \*
|
-
+
-### Templating API: toplevel utility helpers~not_first(options) ⇒
+### Templating API: user-data specific helpers~if_command_discovery_enabled()
-Inside an iterator, this helper allows you to specify the content that will be output only
-if the element is not the first element.
+If helper that checks if command discovery is enabled
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: content, if it's the first element inside an operator, empty otherwise.
+example:
+{{#if_command_discovery_enabled}}
+command discovery is enabled
+{{else}}
+command discovery is not enabled
+{{/if_command_discovery_enabled}}
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+
+
+### Templating API: user-data specific helpers~is_command_default_response_enabled(command, options) ⇒
+
+An if helper to check if default response for a command is enabled or not.
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: true if the the default response policy is either always or
+when the policy is not never and the command has the disable default
+response policy set to false(not true)
| Param | Type |
| ------- | --------------- |
+| command | \*
|
| options | \*
|
-
+
-### Templating API: toplevel utility helpers~last(options) ⇒
+### Templating API: user-data specific helpers~is_command_default_response_disabled(command, options) ⇒
-Inside an iterator, this helper allows you to specify the content that will be output only
-during the last element.
+An if helper to check if default response for a command is disabled or not.
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: content, if it's the last element inside an operator, empty otherwise.
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: true if the the default response policy is either never or
+when the policy is not always and the command has the disable default
+response policy set to true(for eg disableDefaultResponse="true" in xml).
| Param | Type |
| ------- | --------------- |
+| command | \*
|
| options | \*
|
-
+
-### Templating API: toplevel utility helpers~not_last(optionms) ⇒
+### Templating API: user-data specific helpers~all_user_cluster_attributes_for_generated_defaults(name, side, options) ⇒
-Inside an iterator. the block is output only if this is NOT the last item.
-Useful for wrapping commas in the list of arguments and such.
+Default values for the attributes longer than a pointer.
+All attribute values with size greater than 2 bytes.
+Excluding 0 values and externally saved values
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: content, if it's not the last element inside a block, empty otherwise.
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: Attribute values greater than 2 bytes and not 0 nor externally saved.
-| Param | Type |
-| -------- | --------------- |
-| optionms | \*
|
+| Param |
+| ------- |
+| name |
+| side |
+| options |
-
+
-### Templating API: toplevel utility helpers~middle(options) ⇒
+### Templating API: user-data specific helpers~all_user_cluster_generated_attributes(options) ⇒
-Inside an iterator, this helper allows you to specify the content that will be output only
-during the non-first and no-last element.
+Entails the list of all attributes which have been enabled. Given the
+cluster is enabled as well. The helper retrieves the attributes across
+all endpoints.
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: content, if it's the middle element inside an operator, empty otherwise.
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: enabled attributes
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param |
+| ------- |
+| options |
-
+
-### Templating API: toplevel utility helpers~template_option_with_code(options, key)
+### Templating API: user-data specific helpers~all_user_reportable_attributes(options) ⇒
-This fetches a promise which returns template options if provided
+Entails the list of reportable attributes which have been enabled. Given the
+cluster is enabled as well. The helper retrieves the reportable attributes
+per endpoint per cluster.
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: Reportable attributes
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
-| key | \*
|
+| Param |
+| ------- |
+| options |
-
+
-### Templating API: toplevel utility helpers~fail(options)
+### Templating API: user-data specific helpers~all_user_cluster_generated_commands(options) ⇒
-Forced fail halper.
+All available cluster commands across all endpoints and clusters.
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: All available cluster commands across all endpoints and clusters
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param |
+| ------- |
+| options |
-
+
-### Templating API: toplevel utility helpers~isEqual(string_a, string_b)
+### Templating API: user-data specific helpers~all_user_clusters_with_incoming_or_outgoing_commands(options, is_incoming) ⇒
-This returns a boolean if the 2 strings are same
+Util function for all clusters with side that have available incoming or
+outgiong commands across all endpoints.
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: All clusters with side that have available incoming or outgiong
+commands across all endpoints.
-| Param | Type |
-| -------- | --------------- |
-| string_a | \*
|
-| string_b | \*
|
+| Param | Description |
+| ----------- | ----------------------------------------------------- |
+| options | |
+| is_incoming | boolean to check if commands are incoming or outgoing |
-
+
-### Templating API: toplevel utility helpers~is_lowercase_equal(string_a, string_b)
+### Templating API: user-data specific helpers~all_user_clusters_with_incoming_commands(options) ⇒
-This returns a boolean based on the 2 strings being equal or not given that both
+All clusters with side that have available incoming commands
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: All clusters with side that have available incoming commands across
+all endpoints.
-| Param | Type |
-| -------- | --------------- |
-| string_a | \*
|
-| string_b | \*
|
+| Param |
+| ------- |
+| options |
-
+
-### Templating API: toplevel utility helpers~trim_string(str) ⇒
+### Templating API: user-data specific helpers~all_user_clusters_with_outgoing_commands(options) ⇒
-Remove leading and trailing spaces from a string
+All clusters with side that have available outgoing commands
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: A string with no leading and trailing spaces
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: All clusters with side that have available outgoing commands across
+all endpoints.
-| Param | Type |
-| ----- | --------------- |
-| str | \*
|
+| Param |
+| ------- |
+| options |
-
+
-### Templating API: toplevel utility helpers~asLastWord(str)
+### Templating API: user-data specific helpers~manufacturing_clusters_with_incoming_commands(clusterCode, options) ⇒
-Split the string based on spaces and return the last word
+Provide all manufacturing specific clusters that have incoming commands with
+the given cluster code.
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: Details of manufacturing specific clusters that have incoming
+commands with the given cluster code
-| Param | Type |
-| ----- | --------------- |
-| str | \*
|
+| Param |
+| ----------- |
+| clusterCode |
+| options |
-
+
-### Templating API: toplevel utility helpers~iterate()
+### Templating API: user-data specific helpers~all_user_clusters_with_incoming_commands_combined(options) ⇒
-Iteration block.
+All clusters that have available incoming commands.
+If there is a client and server enabled on the endpoint, this combines them
+into a single entry.
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: All clusters that have available incoming commands across
+all endpoints.
-### Templating API: toplevel utility helpers~concatenate()
+| Param |
+| ------- |
+| options |
-Given: A list of strings
-Returns a concatenated string with spaces between each string
+
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+### Templating API: user-data specific helpers~all_incoming_commands_for_cluster_combined(clusterName, clientSide, serverSide, options) ⇒
+
+All commands that need to be parsed for a given cluster. This takes in booleans
+for if the client and or server are included.
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: all commands that need to be parsed for a given cluster
+
+| Param |
+| ----------- |
+| clusterName |
+| clientSide |
+| serverSide |
+| options |
+
+
+
+### Templating API: user-data specific helpers~all_incoming_or_outgoing_commands_for_cluster(clusterName, clusterSide, isIncoming, options) ⇒
+
+A util function for all incoming or outgoing commands that need to be parsed
+for a given cluster
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: All incoming or outgoing commands that need to be parsed for a given
+cluster
+
+| Param |
+| ----------- |
+| clusterName |
+| clusterSide |
+| isIncoming |
+| options |
+
+
+
+### Templating API: user-data specific helpers~all_incoming_commands_for_cluster(clusterName, options) ⇒
+
+All incoming commands that need to be parsed for a given cluster
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: all incoming commands that need to be parsed for a given cluster
+
+| Param |
+| ----------- |
+| clusterName |
+| options |
+
+
+
+### Templating API: user-data specific helpers~all_outgoing_commands_for_cluster(clusterName, options) ⇒
+
+All outgoing commands that need to be parsed for a given cluster
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: all outgoing commands that need to be parsed for a given cluster
+
+| Param |
+| ----------- |
+| clusterName |
+| options |
+
+
+
+### Templating API: user-data specific helpers~generated_clustes_details(options) ⇒
+
+Entails the Cluster details per endpoint
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: Cluster Details per endpoint with attribute summaries within the clusters
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: user-data specific helpers~generated_endpoint_type_details(options) ⇒
+
+Entails Endpoint type details along with their cluster summaries
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: Endpoint type details along with their cluster summaries
+
+| Param |
+| ------- |
+| options |
+
+
+
+### Templating API: user-data specific helpers~all_user_cluster_attributes_min_max_defaults(name, side, options) ⇒
+
+Returns attributes inside an endpoint type that either have a default or a
+bounded attribute.
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: endpoints with bounds or defaults
+
+| Param |
+| ------- |
+| name |
+| side |
+| options |
+
+
+
+### Templating API: user-data specific helpers~checkAttributeMatch(clusterName, attributeName, attributeSide, attributeValue, attributeValueType, endpointAttributes) ⇒
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: arrayIndex
+
+| Param |
+| ------------------ |
+| clusterName |
+| attributeName |
+| attributeSide |
+| attributeValue |
+| attributeValueType |
+| endpointAttributes |
+
+
+
+### Templating API: user-data specific helpers~generated_defaults_index(clusterName, attributeName, attributeValueType, attributeValue, prefixReturn, postFixReturn) ⇒
+
+Extracts the index of generated defaults array which come from
+all_user_cluster_attributes_for_generated_defaults
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: index of the generated default array
+
+| Param |
+| ------------------ |
+| clusterName |
+| attributeName |
+| attributeValueType |
+| attributeValue |
+| prefixReturn |
+| postFixReturn |
+
+
+
+### Templating API: user-data specific helpers~generated_default_index(clusterName, attributeName, attributeSide, attributeValueType, attributeValue, prefixReturn, postFixReturn) ⇒
+
+Extracts the index of generated defaults array which come from
+all_user_cluster_attributes_for_generated_defaults
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: deafult value's index in the generated default array
+
+| Param |
+| ------------------ |
+| clusterName |
+| attributeName |
+| attributeSide |
+| attributeValueType |
+| attributeValue |
+| prefixReturn |
+| postFixReturn |
+
+
+
+### Templating API: user-data specific helpers~generated_attributes_min_max_index(name, side, options) ⇒
+
+Extracts the index of generated min max defaults array which come from
+all_user_cluster_attributes_min_max_defaults
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: index of the generated min max default array
+
+| Param |
+| ------- |
+| name |
+| side |
+| options |
+
+
+
+### Templating API: user-data specific helpers~generated_attribute_min_max_index(clusterName, attributeName, attributeSide, options) ⇒
+
+Extracts the index of generated min max defaults array which come from
+all_user_cluster_attributes_min_max_defaults
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: index of the generated min max default in the array
+
+| Param |
+| ------------- |
+| clusterName |
+| attributeName |
+| attributeSide |
+| options |
+
+
+
+### Templating API: user-data specific helpers~if_enabled_clusters(options) ⇒
+
+If helper that checks if there are clusters enabled
+Available options:
+
+- side: side="client/server" can be used to check if there are client or
+ server side clusters are available
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: user-data specific helpers~if_multi_protocol_attributes_enabled(options) ⇒
+
+Check if multi-protocol is enabled for the application.
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: boolean based on existence of attribute-attribute associations.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: user-data specific helpers~all_multi_protocol_attributes(options) ⇒
+
+Retrieve all the attribute-attribute associations for the current session.
+
+**Kind**: inner method of [Templating API: user-data specific helpers
](#module*Templating API* user-data specific helpers)
+**Returns**: attribute-attribute mapping entries
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+## Templating API: toplevel utility helpers
+
+This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
+
+- [Templating API: toplevel utility helpers](#module*Templating API* toplevel utility helpers)
+ - [~zap_header()](#module*Templating API* toplevel utility helpers..zap_header) ⇒
+ - [~ident()](#module*Templating API* toplevel utility helpers..ident) ⇒
+ - [~template_options(category, options)](#module*Templating API* toplevel utility helpers..template_options)
+ - [~first(options)](#module*Templating API* toplevel utility helpers..first) ⇒
+ - [~not_first(options)](#module*Templating API* toplevel utility helpers..not_first) ⇒
+ - [~last(options)](#module*Templating API* toplevel utility helpers..last) ⇒
+ - [~not_last(optionms)](#module*Templating API* toplevel utility helpers..not_last) ⇒
+ - [~middle(options)](#module*Templating API* toplevel utility helpers..middle) ⇒
+ - [~template_option_with_code(options, key)](#module*Templating API* toplevel utility helpers..template_option_with_code)
+ - [~fail(options)](#module*Templating API* toplevel utility helpers..fail)
+ - [~isEqual(string_a, string_b)](#module*Templating API* toplevel utility helpers..isEqual)
+ - [~is_lowercase_equal(string_a, string_b)](#module*Templating API* toplevel utility helpers..is_lowercase_equal)
+ - [~trim_string(str)](#module*Templating API* toplevel utility helpers..trim_string) ⇒
+ - [~asLastWord(str)](#module*Templating API* toplevel utility helpers..asLastWord)
+ - [~iterate()](#module*Templating API* toplevel utility helpers..iterate)
+ - [~concatenate()](#module*Templating API* toplevel utility helpers..concatenate)
+ - [~is_num_equal(numA, numB)](#module*Templating API* toplevel utility helpers..is_num_equal) ⇒
+ - [~is_defined(value)](#module*Templating API* toplevel utility helpers..is_defined) ⇒
+ - [~replace_string(mainString, replaceString, replaceWithString)](#module*Templating API* toplevel utility helpers..replace_string) ⇒
+ - [~add_prefix_to_all_strings(str, prefixStr)](#module*Templating API* toplevel utility helpers..add_prefix_to_all_strings) ⇒
+ - [~multiply()](#module*Templating API* toplevel utility helpers..multiply) ⇒
+ - [~is_string_underscored(val)](#module*Templating API* toplevel utility helpers..is_string_underscored) ⇒
+ - [~as_uppercase(val)](#module*Templating API* toplevel utility helpers..as_uppercase) ⇒
+
+
+
+### Templating API: toplevel utility helpers~zap_header() ⇒
+
+Produces the top-of-the-file header for a C file.
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: The header content
+
+
+### Templating API: toplevel utility helpers~ident() ⇒
+
+Simple helper that produces an approved size of identation.
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: whitespace that is the identation.
+
+
+### Templating API: toplevel utility helpers~template_options(category, options)
+
+Block helper that iterates over the package options of a given category.
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+
+| Param | Type |
+| -------- | --------------- |
+| category | \*
|
+| options | \*
|
+
+
+
+### Templating API: toplevel utility helpers~first(options) ⇒
+
+Inside an iterator, this helper allows you to specify the content that will be output only
+during the first element.
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: content, if it's the first element inside an operator, empty otherwise.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: toplevel utility helpers~not_first(options) ⇒
+
+Inside an iterator, this helper allows you to specify the content that will be output only
+if the element is not the first element.
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: content, if it's the first element inside an operator, empty otherwise.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: toplevel utility helpers~last(options) ⇒
+
+Inside an iterator, this helper allows you to specify the content that will be output only
+during the last element.
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: content, if it's the last element inside an operator, empty otherwise.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: toplevel utility helpers~not_last(optionms) ⇒
+
+Inside an iterator. the block is output only if this is NOT the last item.
+Useful for wrapping commas in the list of arguments and such.
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: content, if it's not the last element inside a block, empty otherwise.
+
+| Param | Type |
+| -------- | --------------- |
+| optionms | \*
|
+
+
+
+### Templating API: toplevel utility helpers~middle(options) ⇒
+
+Inside an iterator, this helper allows you to specify the content that will be output only
+during the non-first and no-last element.
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: content, if it's the middle element inside an operator, empty otherwise.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: toplevel utility helpers~template_option_with_code(options, key)
+
+This fetches a promise which returns template options if provided
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+| key | \*
|
+
+
+
+### Templating API: toplevel utility helpers~fail(options)
+
+Forced fail halper.
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: toplevel utility helpers~isEqual(string_a, string_b)
+
+This returns a boolean if the 2 strings are same
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+
+| Param | Type |
+| -------- | --------------- |
+| string_a | \*
|
+| string_b | \*
|
+
+
+
+### Templating API: toplevel utility helpers~is_lowercase_equal(string_a, string_b)
+
+This returns a boolean based on the 2 strings being equal or not given that both
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+
+| Param | Type |
+| -------- | --------------- |
+| string_a | \*
|
+| string_b | \*
|
+
+
+
+### Templating API: toplevel utility helpers~trim_string(str) ⇒
+
+Remove leading and trailing spaces from a string
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: A string with no leading and trailing spaces
+
+| Param | Type |
+| ----- | --------------- |
+| str | \*
|
+
+
+
+### Templating API: toplevel utility helpers~asLastWord(str)
+
+Split the string based on spaces and return the last word
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+
+| Param | Type |
+| ----- | --------------- |
+| str | \*
|
+
+
+
+### Templating API: toplevel utility helpers~iterate()
+
+Iteration block.
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+
+
+### Templating API: toplevel utility helpers~concatenate()
+
+Given: A list of strings
+Returns a concatenated string with spaces between each string
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-### Templating API: toplevel utility helpers~is_num_equal(numA, numB) ⇒
+### Templating API: toplevel utility helpers~is_num_equal(numA, numB) ⇒
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: true if both numbers are equal else returns false
+
+| Param |
+| ----- |
+| numA |
+| numB |
+
+
+
+### Templating API: toplevel utility helpers~is_defined(value) ⇒
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: true or false based on whether the value is undefined or not
+
+| Param |
+| ----- |
+| value |
+
+
+
+### Templating API: toplevel utility helpers~replace_string(mainString, replaceString, replaceWithString) ⇒
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: A string replaced with another string in the mainString
+
+| Param |
+| ----------------- |
+| mainString |
+| replaceString |
+| replaceWithString |
+
+
+
+### Templating API: toplevel utility helpers~add_prefix_to_all_strings(str, prefixStr) ⇒
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: A resultant string with all string values prefixed with prefixStr
+
+| Param |
+| --------- |
+| str |
+| prefixStr |
+
+
+
+### Templating API: toplevel utility helpers~multiply() ⇒
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: A number which is result of multiplying all the arguments given
+
+
+### Templating API: toplevel utility helpers~is_string_underscored(val) ⇒
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: true if a string has an underscore in it
+
+| Param | Type |
+| ----- | --------------- |
+| val | \*
|
+
+
+
+### Templating API: toplevel utility helpers~as_uppercase(val) ⇒
+
+**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
+**Returns**: val in uppercase
+
+| Param | Type |
+| ----- | --------------- |
+| val | \*
|
+
+
+
+## Templating API: static zcl helpers
+
+This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
+
+- [Templating API: static zcl helpers](#module*Templating API* static zcl helpers)
+ - [~zcl_bitmaps(options)](#module*Templating API* static zcl helpers..zcl_bitmaps) ⇒
+ - [~zcl_bitmap_items(options)](#module*Templating API* static zcl helpers..zcl_bitmap_items)
+ - [~zcl_enums(options)](#module*Templating API* static zcl helpers..zcl_enums) ⇒
+ - [~zcl_structs(options)](#module*Templating API* static zcl helpers..zcl_structs) ⇒
+ - [~zcl_enum_items(options)](#module*Templating API* static zcl helpers..zcl_enum_items)
+ - [~first_unused_enum_value(options)](#module*Templating API* static zcl helpers..first_unused_enum_value) ⇒
+ - [~zcl_struct_items(options)](#module*Templating API* static zcl helpers..zcl_struct_items) ⇒
+ - [~zcl_struct_items_by_struct_name(name, options)](#module*Templating API* static zcl helpers..zcl_struct_items_by_struct_name) ⇒
+ - [~zcl_struct_items_by_struct_and_cluster_name(name, clusterName, options)](#module*Templating API* static zcl helpers..zcl_struct_items_by_struct_and_cluster_name) ⇒
+ - [~zcl_device_types(options)](#module*Templating API* static zcl helpers..zcl_device_types) ⇒
+ - [~zcl_device_type_clusters(options)](#module*Templating API* static zcl helpers..zcl_device_type_clusters) ⇒
+ - [~zcl_device_type_cluster_commands(options)](#module*Templating API* static zcl helpers..zcl_device_type_cluster_commands) ⇒
+ - [~zcl_device_type_cluster_attributes(options)](#module*Templating API* static zcl helpers..zcl_device_type_cluster_attributes) ⇒
+ - [~zcl_clusters(options)](#module*Templating API* static zcl helpers..zcl_clusters) ⇒
+ - [~zcl_commands(options)](#module*Templating API* static zcl helpers..zcl_commands) ⇒
+ - [~zcl_command_responses(options)](#module*Templating API* static zcl helpers..zcl_command_responses) ⇒
+ - [~zcl_commands_with_cluster_info(options)](#module*Templating API* static zcl helpers..zcl_commands_with_cluster_info) ⇒
+ - [~zcl_commands_with_arguments(options)](#module*Templating API* static zcl helpers..zcl_commands_with_arguments)
+ - [~zcl_commands_source_client(options)](#module*Templating API* static zcl helpers..zcl_commands_source_client) ⇒
+ - [~zcl_commands_source_server(options)](#module*Templating API* static zcl helpers..zcl_commands_source_server) ⇒
+ - [~zcl_events(options)](#module*Templating API* static zcl helpers..zcl_events) ⇒
+ - [~zcl_command_tree(options)](#module*Templating API* static zcl helpers..zcl_command_tree) ⇒
+ - [~zcl_global_commands(options)](#module*Templating API* static zcl helpers..zcl_global_commands) ⇒
+ - [~zcl_attributes(options)](#module*Templating API* static zcl helpers..zcl_attributes) ⇒
+ - [~zcl_attributes_client(options)](#module*Templating API* static zcl helpers..zcl_attributes_client) ⇒
+ - [~zcl_attributes_server(options)](#module*Templating API* static zcl helpers..zcl_attributes_server) ⇒
+ - [~zcl_atomics(options)](#module*Templating API* static zcl helpers..zcl_atomics) ⇒
+ - [~zcl_cluster_largest_label_length()](#module*Templating API* static zcl helpers..zcl_cluster_largest_label_length) ⇒
+ - [~largestLabelLength(An)](#module*Templating API* static zcl helpers..largestLabelLength) ⇒
+ - [~zcl_command_arguments_count(commandId)](#module*Templating API* static zcl helpers..zcl_command_arguments_count) ⇒
+ - [~ifCommandArgumentsHaveFixedLengthWithCurrentContext(commandId, fixedLengthReturn, notFixedLengthReturn, currentContext)](#module*Templating API* static zcl helpers..ifCommandArgumentsHaveFixedLengthWithCurrentContext)
+ - [~if_command_arguments_have_fixed_length(commandId, fixedLengthReturn, notFixedLengthReturn)](#module*Templating API* static zcl helpers..if_command_arguments_have_fixed_length)
+ - [~as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present(type, command, commandArg, appendString, options)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present) ⇒
+ - [~as_underlying_zcl_type_if_command_is_not_fixed_length(type, commandId, appendString, options)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_if_command_is_not_fixed_length)
+ - [~command_arguments_total_length(commandId)](#module*Templating API* static zcl helpers..command_arguments_total_length)
+ - [~zcl_command_arguments(options)](#module*Templating API* static zcl helpers..zcl_command_arguments) ⇒
+ - [~zcl_event_fields(options)](#module*Templating API* static zcl helpers..zcl_event_fields)
+ - [~zcl_command_argument_data_type(typeName, options)](#module*Templating API* static zcl helpers..zcl_command_argument_data_type)
+ - [~asUnderlyingZclType(typeName, options)](#module*Templating API* static zcl helpers..asUnderlyingZclType)
+ - [~zcl_string_type_return(type, options)](#module*Templating API* static zcl helpers..zcl_string_type_return)
+ - [~is_zcl_string(type)](#module*Templating API* static zcl helpers..is_zcl_string)
+ - [~if_is_number(type)](#module*Templating API* static zcl helpers..if_is_number) ⇒
+ - [~if_is_string(type)](#module*Templating API* static zcl helpers..if_is_string) ⇒
+ - [~if_is_char_string(type)](#module*Templating API* static zcl helpers..if_is_char_string) ⇒
+ - [~if_is_octet_string(type)](#module*Templating API* static zcl helpers..if_is_octet_string) ⇒
+ - [~if_is_short_string(type)](#module*Templating API* static zcl helpers..if_is_short_string) ⇒
+ - [~if_is_long_string(type)](#module*Templating API* static zcl helpers..if_is_long_string) ⇒
+ - [~if_is_atomic(type:)](#module*Templating API* static zcl helpers..if_is_atomic) ⇒
+ - [~if_is_bitmap(type)](#module*Templating API* static zcl helpers..if_is_bitmap) ⇒
+ - [~if_is_enum(type)](#module*Templating API* static zcl helpers..if_is_enum) ⇒
+ - [~if_is_struct(type)](#module*Templating API* static zcl helpers..if_is_struct) ⇒
+ - [~isClient(side)](#module*Templating API* static zcl helpers..isClient) ⇒
+ - [~isServer(side)](#module*Templating API* static zcl helpers..isServer) ⇒
+ - [~as_underlying_zcl_type_command_argument_always_present(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_command_argument_always_present) ⇒
+ - [~if_command_argument_always_present(commandId, introducedInRef, removedInRef, presentIf, argumentPresentReturn, argumentNotPresentReturn)](#module*Templating API* static zcl helpers..if_command_argument_always_present) ⇒
+ - [~as_underlying_zcl_type_command_argument_not_always_present_no_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_command_argument_not_always_present_no_presentif) ⇒
+ - [~as_underlying_zcl_type_ca_not_always_present_no_presentif(commandArg, appendString, options)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_ca_not_always_present_no_presentif) ⇒
+ - [~if_command_argument_not_always_present_no_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsReturn, argumentInAllVersionsReturn)](#module*Templating API* static zcl helpers..if_command_argument_not_always_present_no_presentif) ⇒
+ - [~as_underlying_zcl_type_command_argument_not_always_present_with_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_command_argument_not_always_present_with_presentif) ⇒
+ - [~as_underlying_zcl_type_ca_not_always_present_with_presentif(commandArg, appendString, options)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_ca_not_always_present_with_presentif) ⇒
+ - [~if_command_argument_not_always_present_with_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsPresentIfReturn, argumentInAllVersionsReturn)](#module*Templating API* static zcl helpers..if_command_argument_not_always_present_with_presentif) ⇒
+ - [~as_underlying_zcl_type_command_argument_always_present_with_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_command_argument_always_present_with_presentif) ⇒
+ - [~as_underlying_zcl_type_ca_always_present_with_presentif(commandArg, appendString, options)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_ca_always_present_with_presentif) ⇒
+ - [~if_command_argument_always_present_with_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsPresentIfReturn, argumentInAllVersionsReturn)](#module*Templating API* static zcl helpers..if_command_argument_always_present_with_presentif) ⇒
+ - [~if_manufacturing_specific_cluster(clusterId, manufacturer_specific_return, null_manufacturer_specific_return)](#module*Templating API* static zcl helpers..if_manufacturing_specific_cluster) ⇒
+ - [~if_mfg_specific_cluster(clusterId, options)](#module*Templating API* static zcl helpers..if_mfg_specific_cluster) ⇒
+ - [~as_generated_default_macro(value, attributeSize, options)](#module*Templating API* static zcl helpers..as_generated_default_macro) ⇒
+ - [~attribute_mask(writable, storageOption, minMax, mfgSpecific, clusterCode, client, isSingleton, prefixString, postfixString)](#module*Templating API* static zcl helpers..attribute_mask) ⇒
+ - [~command_mask(commmandSource, clusterSide, isIncomingEnabled, isOutgoingEnabled, manufacturingCode, prefixForMask)](#module*Templating API* static zcl helpers..command_mask) ⇒
+ - [~command_mask_sub_helper(commandMask, str)](#module*Templating API* static zcl helpers..command_mask_sub_helper) ⇒
+ - [~format_zcl_string_as_characters_for_generated_defaults(stringVal, sizeOfString)](#module*Templating API* static zcl helpers..format_zcl_string_as_characters_for_generated_defaults) ⇒
+ - [~as_type_min_value(type, options)](#module*Templating API* static zcl helpers..as_type_min_value) ⇒
+ - [~as_type_max_value(type, options)](#module*Templating API* static zcl helpers..as_type_max_value) ⇒
+ - [~structs_with_clusters(options)](#module*Templating API* static zcl helpers..structs_with_clusters)
+ - [~as_zcl_type_size(type, options)](#module*Templating API* static zcl helpers..as_zcl_type_size) ⇒
+ - [~if_compare(leftValue, rightValue, options)](#module*Templating API* static zcl helpers..if_compare) ⇒ Object
+ - [~if_is_data_type_signed(type, clusterId, options)](#module*Templating API* static zcl helpers..if_is_data_type_signed) ⇒
+ - [~as_zcl_data_type_size(type, clusterId, options)](#module*Templating API* static zcl helpers..as_zcl_data_type_size) ⇒
+
+
+
+### Templating API: static zcl helpers~zcl_bitmaps(options) ⇒
+
+Block helper iterating over all bitmaps.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_bitmap_items(options)
+
+Iterates over enum items. Valid only inside zcl_enums.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_enums(options) ⇒
+
+Block helper iterating over all enums.
+If existing independently, it iterates over ALL the enums.
+Within a context of a cluster, it iterates only over the
+enums belonging to a cluster.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_structs(options) ⇒
+
+Block helper iterating over all structs.
+If existing independently, it iterates over ALL the structs.
+Within a context of a cluster, it iterates only over the
+structs belonging to a cluster.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_enum_items(options)
+
+Iterates over enum items. Valid only inside zcl_enums.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~first_unused_enum_value(options) ⇒
+
+This helper prints out the first unused enum value.
+It supports mode="next_larger" and
+mode="first_unused" (which is the default).
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: the unused enum value
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_struct_items(options) ⇒
+
+Block helper iterating over all struct items. Valid only inside zcl_structs.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_struct_items_by_struct_name(name, options) ⇒
+
+Block helper iterating over all struct items given the struct name.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param |
+| ------- |
+| name |
+| options |
+
+
+
+### Templating API: static zcl helpers~zcl_struct_items_by_struct_and_cluster_name(name, clusterName, options) ⇒
+
+Block helper iterating over all struct items given the struct name and
+cluster name. The items iterated will be those that correspond to that
+struct name being used within the given cluster. That means the struct name
+must be either a global struct (in which case the cluster name is just
+ignored), or a struct associated with the given cluster.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param |
+| ----------- |
+| name |
+| clusterName |
+| options |
+
+
+
+### Templating API: static zcl helpers~zcl_device_types(options) ⇒
+
+Block helper iterating over all deviceTypes.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_device_type_clusters(options) ⇒
+
+Block helper for use inside zcl_device_types
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: blocks for clusters
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_device_type_cluster_commands(options) ⇒
+
+Block helper for use inside zcl_device_type_clusters
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: blocks for commands
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_device_type_cluster_attributes(options) ⇒
+
+Block helper for use inside zcl_device_type_clusters
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: blocks for attributes
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_clusters(options) ⇒
+
+Block helper iterating over all clusters.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_commands(options) ⇒
+
+Block helper iterating over all commands.
+There are two modes of this helper:
+when used in a global context, it iterates over ALL commands in the database.
+when used inside a `zcl_cluster` block helper, it iterates only over the commands for that cluster.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_command_responses(options) ⇒
+
+Returns all commands which are command responses.
+For eg, If the xml has the following:
+Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: all command responses
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_commands_with_cluster_info(options) ⇒
+
+Block helper iterating over all commands with cluster information.
+Note: Similar to zcl_commands but has cluster information as well.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_commands_with_arguments(options)
+
+Helper that retrieves all commands that contain arguments.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_commands_source_client(options) ⇒
+
+Block helper iterating over all client commands.
+There are two modes of this helper:
+when used in a global context, it iterates over ALL client commands in the database.
+when used inside a `zcl_cluster` block helper, it iterates only over the commands for that client cluster.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_commands_source_server(options) ⇒
+
+Block helper iterating over all server commands.
+There are two modes of this helper:
+when used in a global context, it iterates over ALL server commands in the database.
+when used inside a `zcl_cluster` block helper, it iterates only over the commands for that server cluster.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_events(options) ⇒
+
+Block helper iterating over all events.
+There are two modes of this helper:
+when used in a global context, it iterates over ALL events in the database.
+when used inside a `zcl_cluster` block helper, it iterates only over the events for that cluster.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_command_tree(options) ⇒
+
+Block helper iterating over all commands, including their arguments and clusters.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_global_commands(options) ⇒
+
+Helper to iterate over all global commands.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of global command iteration.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_attributes(options) ⇒
+
+Iterator over the attributes. If it is used at toplevel, if iterates over all the attributes
+in the database. If used within zcl_cluster context, it iterates over all the attributes
+that belong to that cluster.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of attribute iteration.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_attributes_client(options) ⇒
+
+Iterator over the client attributes. If it is used at toplevel, if iterates over all the client attributes
+in the database. If used within zcl_cluster context, it iterates over all the client attributes
+that belong to that cluster.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of attribute iteration.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_attributes_server(options) ⇒
+
+Iterator over the server attributes. If it is used at toplevel, if iterates over all the server attributes
+in the database. If used within zcl_cluster context, it iterates over all the server attributes
+that belong to that cluster.
+Available Options:
+
+- removeKeys: Removes one or more keys from the map(for eg keys in db-mapping.js)
+ for eg: (#zcl_attributes_server removeKeys='isOptional, isNullable') will remove 'isOptional'
+ from the results
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of attribute iteration.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_atomics(options) ⇒
+
+Block helper iterating over all atomic types.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_cluster_largest_label_length() ⇒
+
+Given: N/A
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: the length of largest cluster name in a list of clusters
+
+
+### Templating API: static zcl helpers~largestLabelLength(An) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: the length of largest object name in an array. Helper for
+zcl_cluster_largest_label_length
+
+| Param | Type | Description |
+| ----- | --------------- | ----------- |
+| An | \*
| Array |
+
+
+
+### Templating API: static zcl helpers~zcl_command_arguments_count(commandId) ⇒
+
+Helper to extract the number of command arguments in a command
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Number of command arguments as an integer
+
+| Param | Type |
+| --------- | --------------- |
+| commandId | \*
|
+
+
+
+### Templating API: static zcl helpers~ifCommandArgumentsHaveFixedLengthWithCurrentContext(commandId, fixedLengthReturn, notFixedLengthReturn, currentContext)
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Description |
+| -------------------- | ----------------------------------------------------------------------------------------------------- |
+| commandId | |
+| fixedLengthReturn | |
+| notFixedLengthReturn | |
+| currentContext | Returns fixedLengthReturn or notFixedLengthReturn based on whether the command is fixed length or not |
+
+
+
+### Templating API: static zcl helpers~if_command_arguments_have_fixed_length(commandId, fixedLengthReturn, notFixedLengthReturn)
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Description |
+| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| commandId | |
+| fixedLengthReturn | |
+| notFixedLengthReturn | Returns fixedLengthReturn or notFixedLengthReturn based on whether the command is fixed length or not. Does not check if command arguments are always present or not. |
+
+
+
+### Templating API: static zcl helpers~as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present(type, command, commandArg, appendString, options) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: the underlying zcl type of a command argument if the argument is
+not fixed length but is always present. If the condition is not met then
+returns an empty string.
+
+| Param |
+| ------------ |
+| type |
+| command |
+| commandArg |
+| appendString |
+| options |
+
+
+
+### Templating API: static zcl helpers~as_underlying_zcl_type_if_command_is_not_fixed_length(type, commandId, appendString, options)
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Description |
+| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| type | |
+| commandId | |
+| appendString | |
+| options | Returns: Given the commandId and the type of one of its arguments, based on whether the command is fixed length or not either return nothing or return the underlying zcl type appended with the appendString. |
+
+
+
+### Templating API: static zcl helpers~command_arguments_total_length(commandId)
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Description |
+| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| commandId | Returns the size of the command by calculating the sum total of the command arguments Note: This helper should be called on fixed length commands only. It should not be called with commands which do not have a fixed length. |
+
+
+
+### Templating API: static zcl helpers~zcl_command_arguments(options) ⇒
+
+Block helper iterating over command arguments within a command
+or a command tree.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of command argument iteration.
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_event_fields(options)
+
+Block helper iterating over the event fields inside an event.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~zcl_command_argument_data_type(typeName, options)
+
+Helper that deals with the type of the argument.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Type |
+| -------- | --------------- |
+| typeName | \*
|
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~asUnderlyingZclType(typeName, options)
+
+Helper that deals with the type of the argument.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Type | Description |
+| -------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| typeName | \*
| |
+| options | \*
| Note: If the options has zclCharFormatter set to true then the function will return the user defined data associated with the zcl data type and not the actual data type. example: {{asUnderlyingZclType [array type] array="b" one_byte="u" two_byte="v" three_byte="x" four_byte="w" short_string="s" long_string="l" default="b" zclCharFormatter="true"}} For the above if asUnderlyingZclType was given [array type] then the above will return 'b' |
+
+
+
+### Templating API: static zcl helpers~zcl_string_type_return(type, options)
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Description |
+| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| type | |
+| options | Returns the data mentioned in the helper options based on whether the type is short string, long string or not a string Example: {{zcl_string_type_return type short_string="short string output" long_string="short string output" default="Output when not a string") |
+
+
+
+### Templating API: static zcl helpers~is_zcl_string(type)
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Description |
+| ----- | ------------------------------------------------------------------- |
+| type | Return: true or false based on whether the type is a string or not. |
+
+
+
+### Templating API: static zcl helpers~if_is_number(type) ⇒
+
+If helper that checks if a type is a string
+
+example:
+{{#if_is_number type}}
+type is number
+{{else}}
+type is not number
+{{/if_is_number}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
+
+
+
+### Templating API: static zcl helpers~if_is_string(type) ⇒
+
+If helper that checks if a type is a string
+
+example:
+{{#if_is_string type}}
+type is string
+{{else}}
+type is not string
+{{/if_is_string}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
+
+
+
+### Templating API: static zcl helpers~if_is_char_string(type) ⇒
+
+If helper that checks if a string type is present in the list of char strings
+i.e. characterStringTypes
+
+example:
+{{#if_is_char_string type}}
+type is char string
+{{else}}
+type is not char string
+{{/if_is_char_string}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
+
+
+
+### Templating API: static zcl helpers~if_is_octet_string(type) ⇒
+
+If helper that checks if a string type is present in the list of octet strings
+i.e. octetStringTypes
+
+example:
+{{#if_is_octet_string type}}
+type is octet string
+{{else}}
+type is not octet string
+{{/if_is_octet_string}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
+
+
+
+### Templating API: static zcl helpers~if_is_short_string(type) ⇒
+
+If helper that checks if a string type is present in the list of short strings
+i.e. stringShortTypes
+
+example:
+{{#if_is_short_string type}}
+type is short string
+{{else}}
+type is not short string
+{{/if_is_short_string}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
+
+
+
+### Templating API: static zcl helpers~if_is_long_string(type) ⇒
+
+If helper that checks if a string type is present in the list of long strings
+i.e. stringLongTypes
+
+example:
+{{#if_is_long_string type}}
+type is long string
+{{else}}
+type is not long string
+{{/if_is_long_string}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
+
+
+
+### Templating API: static zcl helpers~if_is_atomic(type:) ⇒
+
+If helper that checks if a type is an atomic
+
+example:
+{{#if_is_atomic type}}
+type is atomic
+{{else}}
+type is not atomic
+{{/if_is_atomic}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type | Description |
+| ----- | --------------- | ----------- |
+| type: | \*
| string |
+
+
+
+### Templating API: static zcl helpers~if_is_bitmap(type) ⇒
+
+If helper that checks if a type is a bitmap
+
+example:
+{{#if_is_bitmap type}}
+type is bitmap
+{{else}}
+type is not bitmap
+{{/if_is_bitmap}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
+
+
+
+### Templating API: static zcl helpers~if_is_enum(type) ⇒
+
+If helper that checks if a type is an enum
+
+- example:
+ {{#if_is_enum type}}
+ type is enum
+ {{else}}
+ type is not enum
+ {{/if_is_enum}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
+
+
+
+### Templating API: static zcl helpers~if_is_struct(type) ⇒
+
+If helper that checks if a type is an struct
+
+- example:
+ {{#if_is_struct type}}
+ type is struct
+ {{else}}
+ type is not struct
+ {{/if_is_struct}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content.
+
+| Param |
+| ----- |
+| type |
+
+
+
+### Templating API: static zcl helpers~isClient(side) ⇒
+
+Checks if the side is client or not
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: boolean
+
+| Param | Type |
+| ----- | --------------- |
+| side | \*
|
+
+
+
+### Templating API: static zcl helpers~isServer(side) ⇒
+
+Checks if the side is server or not
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: boolean
+
+| Param | Type |
+| ----- | --------------- |
+| side | \*
|
+
+
+
+### Templating API: static zcl helpers~as_underlying_zcl_type_command_argument_always_present(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: A string as an underlying zcl type if the command is not fixed length and the command
+argument is always present in all zcl specifications.
+
+| Param | Description |
+| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
+| type: | type of argument |
+| commandId: | command id |
+| appendString: | append the string to the argument |
+| introducedInRef: | If the command argument is not present in all zcl specifications and was introduced in a certain specification version then this will not be null |
+| removedInRef: | If the command argument is not present in all zcl specifications and was removed in a certain specification version then this will not be null |
+| presentIf: | If the command argument is present conditionally then this will be a condition and not null |
+| options: | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+
+
+
+### Templating API: static zcl helpers~if_command_argument_always_present(commandId, introducedInRef, removedInRef, presentIf, argumentPresentReturn, argumentNotPresentReturn) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: argumentPresentReturn if the command is not fixed length and command
+argument is always present without conditions(introducedInRef, removedInRef,
+presentIf) else returns argumentNotPresentReturn
+
+| Param |
+| ------------------------ |
+| commandId |
+| introducedInRef |
+| removedInRef |
+| presentIf |
+| argumentPresentReturn |
+| argumentNotPresentReturn |
+
+
+
+### Templating API: static zcl helpers~as_underlying_zcl_type_command_argument_not_always_present_no_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: A string as an underlying zcl type if the command is not fixed length, the command
+argument is not always present in all zcl specifications and there is no present if conditionality
+on the command argument.
+
+| Param | Description |
+| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
+| type: | type of argument |
+| commandId: | command id |
+| appendString: | append the string to the argument |
+| introducedInRef: | If the command argument is not present in all zcl specifications and was introduced in a certain specification version then this will not be null |
+| removedInRef: | If the command argument is not present in all zcl specifications and was removed in a certain specification version then this will not be null |
+| presentIf: | If the command argument is present conditionally then this will be a condition and not null |
+| options: | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+
+
+
+### Templating API: static zcl helpers~as_underlying_zcl_type_ca_not_always_present_no_presentif(commandArg, appendString, options) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: A string as an underlying zcl type if the command is not fixed
+length, the command argument is not always present in all zcl specifications
+and there is no present if conditionality on the command argument.
+
+| Param | Description |
+| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
+| commandArg | command argument |
+| appendString | append the string to the argument |
+| options | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+
+
+
+### Templating API: static zcl helpers~if_command_argument_not_always_present_no_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsReturn, argumentInAllVersionsReturn) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: argumentNotInAllVersionsReturn if the command is not fixed length and command
+argument is present with conditions introducedInRef or removedInRef but no presentIf
+conditions else returns argumentNotPresentReturn
+
+| Param |
+| ------------------------------ |
+| commandId |
+| introducedInRef |
+| removedInRef |
+| presentIf |
+| argumentNotInAllVersionsReturn |
+| argumentInAllVersionsReturn |
+
+
+
+### Templating API: static zcl helpers~as_underlying_zcl_type_command_argument_not_always_present_with_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: A string as an underlying zcl type if the command is not fixed length, the command
+argument is not always present in all zcl specifications and there is a present if conditionality
+on the command argument.
+
+| Param | Description |
+| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
+| type: | type of argument |
+| commandId: | command id |
+| appendString: | append the string to the argument |
+| introducedInRef: | If the command argument is not present in all zcl specifications and was introduced in a certain specification version then this will not be null |
+| removedInRef: | If the command argument is not present in all zcl specifications and was removed in a certain specification version then this will not be null |
+| presentIf: | If the command argument is present conditionally then this will be a condition and not null |
+| options: | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+
+
+
+### Templating API: static zcl helpers~as_underlying_zcl_type_ca_not_always_present_with_presentif(commandArg, appendString, options) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: A string as an underlying zcl type if the command is not fixed
+length, the command argument is not always present in all zcl specifications
+but there is a present if conditionality on the command argument.
+
+| Param | Description |
+| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
+| commandArg | command argument |
+| appendString | append the string to the argument |
+| options | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+
+
+
+### Templating API: static zcl helpers~if_command_argument_not_always_present_with_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsPresentIfReturn, argumentInAllVersionsReturn) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: argumentNotInAllVersionsReturn if the command is not fixed length, command
+argument is present with conditions introducedInRef or removedInRef and presentIf
+conditions exist as well else returns argumentNotPresentReturn
+
+| Param |
+| --------------------------------------- |
+| commandId |
+| introducedInRef |
+| removedInRef |
+| presentIf |
+| argumentNotInAllVersionsPresentIfReturn |
+| argumentInAllVersionsReturn |
+
+
+
+### Templating API: static zcl helpers~as_underlying_zcl_type_command_argument_always_present_with_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: A string as an underlying zcl type if the command is not fixed length, the command
+argument is always present in all zcl specifications and there is a present if conditionality
+on the command argument.
+
+| Param | Description |
+| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
+| type: | type of argument |
+| commandId: | command id |
+| appendString: | append the string to the argument |
+| introducedInRef: | If the command argument is not present in all zcl specifications and was introduced in a certain specification version then this will not be null |
+| removedInRef: | If the command argument is not present in all zcl specifications and was removed in a certain specification version then this will not be null |
+| presentIf: | If the command argument is present conditionally then this will be a condition and not null |
+| options: | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+
+
+
+### Templating API: static zcl helpers~as_underlying_zcl_type_ca_always_present_with_presentif(commandArg, appendString, options) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: A string as an underlying zcl type if the command is not fixed
+length, the command argument is always present in all zcl specifications
+but there is a present if conditionality on the command argument.
+
+| Param | Description |
+| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
+| commandArg | command argument |
+| appendString | append the string to the argument |
+| options | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+
+
+
+### Templating API: static zcl helpers~if_command_argument_always_present_with_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsPresentIfReturn, argumentInAllVersionsReturn) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: argumentInAllVersionsPresentIfReturn if the command is not fixed length, command
+argument is always present and presentIf conditions exist else returns argumentNotPresentReturn
+
+| Param |
+| --------------------------------------- |
+| commandId |
+| introducedInRef |
+| removedInRef |
+| presentIf |
+| argumentNotInAllVersionsPresentIfReturn |
+| argumentInAllVersionsReturn |
+
+
+
+### Templating API: static zcl helpers~if_manufacturing_specific_cluster(clusterId, manufacturer_specific_return, null_manufacturer_specific_return) ⇒
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: manufacturer_specific_return if the cluster is manufacturer
+specific or returns null_manufacturer_specific_return if cluster is
+not manufacturer specific.
+
+| Param | Type |
+| --------------------------------- | --------------- |
+| clusterId | \*
|
+| manufacturer_specific_return | \*
|
+| null_manufacturer_specific_return | \*
|
+
+
+
+### Templating API: static zcl helpers~if_mfg_specific_cluster(clusterId, options) ⇒
+
+If helper which checks if cluster is manufacturing specific or not
+example:
+{{#if_mfg_specific_cluster clusterId}}
+cluster is manufacturing specific
+{{else}}
+cluster is not manufacturing specific
+{{/if_mfg_specific_cluster}}
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Returns content in the handlebar template based on whether the
+command is manufacturing specific or not.
+
+| Param |
+| --------- |
+| clusterId |
+| options |
+
+
+
+### Templating API: static zcl helpers~as_generated_default_macro(value, attributeSize, options) ⇒
+
+Given the value and size of an attribute along with endian as an option.
+This helper returns the attribute value as big/little endian.
+Example: {{as_generated_default_macro 0x00003840 4 endian="big"}}
+will return: 0x00, 0x00, 0x38, 0x40,
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Formatted attribute value based on given arguments
+Available options:
+
+- endian: Specify 'big' or 'little' endian format
+- isCommaTerminated: '0' or '1' for output to have a ',' at the end
+
+| Param |
+| ------------- |
+| value |
+| attributeSize |
+| options |
+
+
+
+### Templating API: static zcl helpers~attribute_mask(writable, storageOption, minMax, mfgSpecific, clusterCode, client, isSingleton, prefixString, postfixString) ⇒
+
+Given the attributes of a zcl attribute. Creates an attribute mask based on
+the given options
+Available options:
+isClusterCodeMfgSpecific: 0/1, This is to determine if cluster code needs to
+be used to determine if a cluster is mfg specific or not.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: attribute mask based on given values
+
+| Param |
+| ------------- |
+| writable |
+| storageOption |
+| minMax |
+| mfgSpecific |
+| clusterCode |
+| client |
+| isSingleton |
+| prefixString |
+| postfixString |
+
+
+
+### Templating API: static zcl helpers~command_mask(commmandSource, clusterSide, isIncomingEnabled, isOutgoingEnabled, manufacturingCode, prefixForMask) ⇒
+
+Given the attributes of a zcl command. Creates a command mask based on
+the given options
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: command mask based on given values
+
+| Param |
+| ----------------- |
+| commmandSource |
+| clusterSide |
+| isIncomingEnabled |
+| isOutgoingEnabled |
+| manufacturingCode |
+| prefixForMask |
+
+
+
+### Templating API: static zcl helpers~command_mask_sub_helper(commandMask, str) ⇒
+
+A Sub helper api for command_mask to reduce code redundancy
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: command mask addition based on the arguments
+
+| Param |
+| ----------- |
+| commandMask |
+| str |
+
+
+
+### Templating API: static zcl helpers~format_zcl_string_as_characters_for_generated_defaults(stringVal, sizeOfString) ⇒
+
+This may be used within all_user_cluster_attributes_for_generated_defaults
+for example:
+{{format_zcl_string_as_characters_for_generated_defaults 'abc' 5}}
+will return as follows:
+3, 'a', 'b', 'c' 0, 0
+
+Available Options:
+
+- isOctet: 0/1 can be used to return results correctly for octet strings
+- isCommaTerminated: 0/1 can be used to return result with/without ',' at
+ the end
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Formatted string for generated defaults starting with the lenth of a
+string then each character and then filler for the size allocated for the
+string. Long strings prefixed by 2 byte length field.
+
+| Param |
+| ------------ |
+| stringVal |
+| sizeOfString |
+
+
+
+### Templating API: static zcl helpers~as_type_min_value(type, options) ⇒
+
+Given a zcl data type return the min allowed value for that zcl data type
+based on the language specified in the options
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: max allowed value for the given zcl data type
+Available Options:
+
+- language: determines the output of the helper based on language
+ for eg: (as_type_min_value language='c++') will give the output specific to
+ the c++ language.
+ Note: If language is not specified then helper throws an error.
+
+| Param | Type |
+| ------- | --------------- |
+| type | \*
|
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~as_type_max_value(type, options) ⇒
+
+Given a zcl data type return the max allowed value for that zcl data type
+based on the language specified in the options
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: max allowed value for the given zcl data type
+Available Options:
+
+- language: determines the output of the helper based on language
+ for eg: (as_type_max_value language='c++') will give the output specific to
+ the c++ language.
+ Note: If language is not specified then the helper returns size of type in
+ bits.
+
+| Param | Type |
+| ------- | --------------- |
+| type | \*
|
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~structs_with_clusters(options)
+
+Returns all structs which have clusters associated with them
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
+| Param | Type | Description |
+| ------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| options | \*
| Available Options: - groupByStructName: Can group the query results based on struct name for structs which are present in more than one cluster eg Usage: {{#structs_with_clusters groupByStructName=1}}{{/structs_with_clusters}} |
+
+
+
+### Templating API: static zcl helpers~as_zcl_type_size(type, options) ⇒
+
+Returns the size of the zcl type if possible else returns -1
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: size of zcl type
+
+| Param | Type |
+| ------- | --------------- |
+| type | \*
|
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~if_compare(leftValue, rightValue, options) ⇒ Object
+
+An if helper for comparisons
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Object
- Promise of content
+example: checking if (4 < 5)
+(if_compare 4 5 operator='<')
+Content when comparison returns true
+
+Content when comparison returns false
+(/if_compare)
+
+| Param | Type |
+| ---------- | --------------- |
+| leftValue | \*
|
+| rightValue | \*
|
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~if_is_data_type_signed(type, clusterId, options) ⇒
+
+Check if the given type is signed or not based on the type name and cluster
+id.
+Note: This helper needs to be used under a block helper which has a
+reference to clusterId.
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: Promise of content
+
+| Param | Type |
+| --------- | --------------- |
+| type | \*
|
+| clusterId | \*
|
+| options | \*
|
+
+
+
+### Templating API: static zcl helpers~as_zcl_data_type_size(type, clusterId, options) ⇒
+
+Fetches the size of the data type based on type name and cluster id given
+Note:
+
+- Size is zero for structs
+- This helper needs to be used under a block helper which has a
+ reference to clusterId.
+ Available Options:
+- roundUpToPowerOfTwo: Rounds the size up to the nearest power of 2
+- sizeIn: By default size is returned in bytes but it can be returned in bits
+ by mentioning sizeIn="bits"
+
+**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Returns**: size of the data type
+
+| Param | Type |
+| --------- | --------------- |
+| type | \*
|
+| clusterId | \*
|
+| options | \*
|
+
+
+
+## Templating API: Overridable functions.
+
+This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
+
+
+
+## JS API: generator logic
+
+- [JS API: generator logic](#module*JS API* generator logic)
+ - [~loadGenTemplateFromFile(path)](#module*JS API* generator logic..loadGenTemplateFromFile) ⇒
+ - [~recordTemplatesPackage(context)](#module*JS API* generator logic..recordTemplatesPackage) ⇒
+ - [~decodePackageExtensionEntity(entityType, entity)](#module*JS API* generator logic..decodePackageExtensionEntity) ⇒
+ - [~loadZclExtensions(zclExt)](#module*JS API* generator logic..loadZclExtensions) ⇒
+ - [~loadTemplates(db, genTemplatesJsonArray)](#module*JS API* generator logic..loadTemplates)
+ - [~loadGenTemplatesJsonFile(db, genTemplatesJson)](#module*JS API* generator logic..loadGenTemplatesJsonFile) ⇒
+ - [~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly)](#module*JS API* generator logic..generateAllTemplates) ⇒
+ - [~generateSingleTemplate(genResult, singleTemplatePkg)](#module*JS API* generator logic..generateSingleTemplate) ⇒
+ - [~generate(db, sessionId, templatePackageId, templateGeneratorOptions, options)](#module*JS API* generator logic..generate) ⇒
+ - [~writeFileWithBackup(fileName, content, doBackup)](#module*JS API* generator logic..writeFileWithBackup) ⇒
+ - [~generateGenerationContent(genResult)](#module*JS API* generator logic..generateGenerationContent)
+ - [~generateAndWriteFiles(db, sessionId, packageId, outputDirectory)](#module*JS API* generator logic..generateAndWriteFiles) ⇒
+ - [~postProcessGeneratedFiles(outputDirectory, genResult)](#module*JS API* generator logic..postProcessGeneratedFiles) ⇒
+ - [~contentIndexer(content)](#module*JS API* generator logic..contentIndexer)
+ - [~generateSingleFileForPreview(db, sessionId, fileName)](#module*JS API* generator logic..generateSingleFileForPreview) ⇒
+ - [~produceCompiledTemplate(singleTemplatePkg)](#module*JS API* generator logic..produceCompiledTemplate) ⇒
+ - [~produceIterativeContent(hb, metaInfo, db, sessionId, singleTemplatePkg, genTemplateJsonPackage, options)](#module*JS API* generator logic..produceIterativeContent) ⇒
+ - [~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:)](#module*JS API* generator logic..produceContent) ⇒
+ - [~wrapOverridable(originalFn, overrideFn)](#module*JS API* generator logic..wrapOverridable) ⇒
+ - [~loadOverridable(path)](#module*JS API* generator logic..loadOverridable)
+ - [~loadPartial(path)](#module*JS API* generator logic..loadPartial)
+ - [~loadHelper(helpers)](#module*JS API* generator logic..loadHelper)
+ - [~allBuiltInHelpers()](#module*JS API* generator logic..allBuiltInHelpers) ⇒
+ - [~findHelperPackageByAlias(alias)](#module*JS API* generator logic..findHelperPackageByAlias) ⇒
+ - [~initializeBuiltInHelpersForPackage()](#module*JS API* generator logic..initializeBuiltInHelpersForPackage)
+ - [~hbInstance()](#module*JS API* generator logic..hbInstance) ⇒
+ - [~makeSynchronizablePromise(promise)](#module*JS API* generator logic..makeSynchronizablePromise)
+ - [~collectBlocks(resultArray, options, context)](#module*JS API* generator logic..collectBlocks) ⇒
+ - [~ensureZclPackageId(context)](#module*JS API* generator logic..ensureZclPackageId) ⇒
+ - [~ensureZclPackageIds(context)](#module*JS API* generator logic..ensureZclPackageIds) ⇒
+ - [~ensureTemplatePackageCategory(context)](#module*JS API* generator logic..ensureTemplatePackageCategory) ⇒
+ - [~ensureTemplatePackageId(context)](#module*JS API* generator logic..ensureTemplatePackageId) ⇒
+ - [~ensureEndpointTypeIds(context)](#module*JS API* generator logic..ensureEndpointTypeIds) ⇒
+ - [~ensureZclClusterSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclClusterSdkExtensions) ⇒
+ - [~ensureZclDeviceTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclDeviceTypeSdkExtensions) ⇒
+ - [~ensureZclAttributeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeSdkExtensions) ⇒
+ - [~ensureZclAttributeTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeTypeSdkExtensions) ⇒
+ - [~ensureZclCommandSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclCommandSdkExtensions) ⇒
+ - [~ensureZclEventSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclEventSdkExtensions) ⇒
+ - [~templatePromise(global, promise)](#module*JS API* generator logic..templatePromise)
+ - [~deprecatedHelper(fn, explanation)](#module*JS API* generator logic..deprecatedHelper) ⇒
+
+
+
+### JS API: generator logic~loadGenTemplateFromFile(path) ⇒
+
+Given a path, it will read generation template object into memory.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Object that contains: data, crc, templateData
+
+| Param | Type |
+| ----- | --------------- |
+| path | \*
|
+
+
+
+### JS API: generator logic~recordTemplatesPackage(context) ⇒
+
+Given a loading context, it records the package into the packages table and adds the packageId field into the resolved context.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the same context passed in, except packageId added to it
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~decodePackageExtensionEntity(entityType, entity) ⇒
+
+This method takes extension data in JSON, and converts it into
+an object that contains:
+entityCode, entityQualifier, parentCode, manufacturerCode and value
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: object that can be used for database injection
+
+| Param | Type |
+| ---------- | --------------- |
+| entityType | \*
|
+| entity | \*
|
+
+
+
+### JS API: generator logic~loadZclExtensions(zclExt) ⇒
+
+Returns a promise that will load the zcl extensions.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise of loading the zcl extensions.
+
+| Param | Type |
+| ------ | --------------- |
+| zclExt | \*
|
+
+
+
+### JS API: generator logic~loadTemplates(db, genTemplatesJsonArray)
+
+Api that loads an array of template JSON files or a single file if
+you just pass in one String.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+| Param | Type |
+| --------------------- | --------------- |
+| db | \*
|
+| genTemplatesJsonArray | \*
|
+
+
+
+### JS API: generator logic~loadGenTemplatesJsonFile(db, genTemplatesJson) ⇒
+
+Main API async function to load templates from a gen-template.json file.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: the loading context, contains: db, path, crc, packageId and templateData, or error
+
+| Param | Type | Description |
+| ---------------- | --------------- | ------------------------------------------------------- |
+| db | \*
| Database |
+| genTemplatesJson | \*
| Path to the JSON file or an array of paths to JSON file |
+
+
+
+### JS API: generator logic~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly) ⇒
+
+Generates all the templates inside a toplevel package.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves with genResult, that contains all the generated templates, keyed by their 'output'
+
+| Param | Type | Description |
+| ------------------ | --------------- | -------------------------------------------------------------------------------------------------- |
+| genResult | \*
| |
+| genTemplateJsonPkg | \*
| Package that points to genTemplate.json file |
+| generateOnly | \*
| if NULL then generate all templates, else only generate template whose out file name matches this. |
+
+
+
+### JS API: generator logic~generateSingleTemplate(genResult, singleTemplatePkg) ⇒
+
+Function that generates a single package and adds it to the generation result.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the genResult, with newly generated content added.
+
+| Param | Type | Description |
+| ----------------- | --------------- | ------------------------ |
+| genResult | \*
| |
+| singleTemplatePkg | \*
| Single template package. |
+
+
+
+### JS API: generator logic~generate(db, sessionId, templatePackageId, templateGeneratorOptions, options) ⇒
+
+Main API async function to generate stuff.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves into a generation result.Promise that resolves into a generation result.
+
+| Param | Type | Description |
+| ------------------------ | --------------- | ------------------------------------------------------------------------------------- |
+| db | \*
| Database |
+| sessionId | \*
| |
+| templatePackageId | \*
| packageId Template package id. It can be either single template or gen template json. |
+| templateGeneratorOptions | \*
| |
+| options | \*
| |
+
+
+
+### JS API: generator logic~writeFileWithBackup(fileName, content, doBackup) ⇒
+
+Promise to write out a file, optionally creating a backup.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise of a written file.
+
+| Param | Type |
+| -------- | --------------- |
+| fileName | \*
|
+| content | \*
|
+| doBackup | \*
|
+
+
+
+### JS API: generator logic~generateGenerationContent(genResult)
+
+Returns a promise that resolves into a content that should be written out to gen result file.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+| Param | Type |
+| --------- | --------------- |
+| genResult | \*
|
+
+
+
+### JS API: generator logic~generateAndWriteFiles(db, sessionId, packageId, outputDirectory) ⇒
+
+Generate files and write them into the given directory.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: a promise which will resolve when all the files are written.
+
+| Param | Type |
+| --------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| packageId | \*
|
+| outputDirectory | \*
|
+
+
+
+### JS API: generator logic~postProcessGeneratedFiles(outputDirectory, genResult) ⇒
+
+Executes post processing actions as defined by the gen-templates.json
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise of a dealt-with post processing actions
+
+| Param | Type |
+| --------------- | --------------- |
+| outputDirectory | \*
|
+| genResult | \*
|
+
+
+
+### JS API: generator logic~contentIndexer(content)
+
+This async function takes a string, and resolves a preview object out of it.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+| Param | Type | Description |
+| ------- | --------------- | ---------------------------- |
+| content | \*
| String to form into preview. |
+
+
+
+### JS API: generator logic~generateSingleFileForPreview(db, sessionId, fileName) ⇒
+
+Generates a single file and feeds it back for preview.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves into a preview object.
+
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| fileName | \*
|
+
+
+
+### JS API: generator logic~produceCompiledTemplate(singleTemplatePkg) ⇒
+
+Resolves into a precompiled template, either from previous precompile or freshly compiled.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: templates
+
+| Param | Type |
+| ----------------- | --------------- |
+| singleTemplatePkg | \*
|
+
+
+
+### JS API: generator logic~produceIterativeContent(hb, metaInfo, db, sessionId, singleTemplatePkg, genTemplateJsonPackage, options) ⇒
+
+This function is reached if the template is an "iterative one", meaning
+it has the iterator set to one of the valid options.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves into an array of key/content/stats objects.
+
+| Param | Type |
+| ---------------------- | --------------- |
+| hb | \*
|
+| metaInfo | \*
|
+| db | \*
|
+| sessionId | \*
|
+| singleTemplatePkg | \*
|
+| genTemplateJsonPackage | \*
|
+| options | \*
|
+
+
+
+### JS API: generator logic~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:) ⇒
+
+Given db connection, session and a single template package, produce the output.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves into an array of key/content/stats objects.
+
+| Param | Type | Description |
+| ------------- | --------------- | --------------------------------------------------------------------------------------- |
+| hb | \*
| |
+| metaInfo | \*
| |
+| db | \*
| |
+| sessionId | \*
| |
+| singlePkg | \*
| |
+| overridePath: | \*
| if passed, it provides a path to the override file that can override the overridable.js |
+
+
+
+### JS API: generator logic~wrapOverridable(originalFn, overrideFn) ⇒
+
+This function attemps to call override function, but if override function
+throws an exception, it calls the original function.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: result from override function, unless it throws an exception, in which case return result from original function.
+
+| Param | Type |
+| ---------- | --------------- |
+| originalFn | \*
|
+| overrideFn | \*
|
+
+
+
+### JS API: generator logic~loadOverridable(path)
+
+This function is responsible to load the overridable function container.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+| Param | Type | Description |
+| ----- | --------------- | -------------------- |
+| path | \*
| of the override file |
+
+
+
+### JS API: generator logic~loadPartial(path)
+
+Function that loads the partials.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+| Param | Type |
+| ----- | --------------- |
+| path | \*
|
+
+
+
+### JS API: generator logic~loadHelper(helpers)
+
+Function that loads the helpers.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+| Param | Type | Description |
+| ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| helpers | \*
| a string path if value is passed through CLI, the nativeRequire() is leverage the native js function instead of webpack's special sauce. a required() module if invoked by backend js code. this is required to force webpack to resolve the included files as path will be difference after being packed for production. |
+
+
+
+### JS API: generator logic~allBuiltInHelpers() ⇒
+
+Returns an object that contains all the helper functions, keyed
+by their name
+
+NOTE: This method is ONLY used for API testing. You should not use
+this method for any real work inside the engine or something.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Object containing all the helper functions.
+
+
+### JS API: generator logic~findHelperPackageByAlias(alias) ⇒
+
+Given an alias, this method finds a builtin helper package
+by its alias.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Helper package or undefined if none was found.
+
+| Param | Type |
+| ----- | --------------- |
+| alias | \*
|
+
+
+
+### JS API: generator logic~initializeBuiltInHelpersForPackage()
+
+Global helper initialization
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+
+### JS API: generator logic~hbInstance() ⇒
+
+This method returns the correct instance for a given generation flow.
+
+TBD: At this point it doesn't do anything yet, it's just
+a central point to get the correct instance.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Instance of handlebars to be used.
+
+
+### JS API: generator logic~makeSynchronizablePromise(promise)
+
+All promises used by the templates should be synchronizable.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+| Param | Type |
+| ------- | --------------- |
+| promise | \*
|
+
+
+
+### JS API: generator logic~collectBlocks(resultArray, options, context) ⇒
+
+Helpful function that collects the individual blocks by using elements of an array as a context,
+executing promises for each, and collecting them into the outgoing string.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves with a content string.
+
+| Param | Type | Description |
+| ----------- | --------------- | ---------------------------------------- |
+| resultArray | \*
| |
+| options | \*
| Options passed from a block helper. |
+| context | \*
| The context from within this was called. |
+
+
+
+### JS API: generator logic~ensureZclPackageId(context) ⇒
+
+Returns the promise that resolves with the ZCL properties package id.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the package id.
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~ensureZclPackageIds(context) ⇒
+
+Returns the promise that resolves with all ZCL package id specific to current session.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with a list of package id.
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~ensureTemplatePackageCategory(context) ⇒
+
+Returns a package category of the toplevel template package from context.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: proimise that resolves into a package category
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~ensureTemplatePackageId(context) ⇒
+
+Returns the promise that resolves with the ZCL properties package id.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the package id.
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~ensureEndpointTypeIds(context) ⇒
+
+Populate the endpoint type ids into the global context.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: endpoint type ids
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~ensureZclClusterSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached cluster extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with cluster extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~ensureZclDeviceTypeSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached cluster extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with cluster extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~ensureZclAttributeSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached attribute extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with attribute extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~ensureZclAttributeTypeSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached attribute type extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with attribute type extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~ensureZclCommandSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached command extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with command extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~ensureZclEventSdkExtensions(context, templatePackageId) ⇒
+
+Resolves with cached command extensions, but if they don't
+exist, it will populate them.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with command extensions.
+
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
+
+
+
+### JS API: generator logic~templatePromise(global, promise)
+
+Every helper that returns a promise, should
+not return the promise directly. So instead of
+returning the promise directly, it should return:
+return templatePromise(this.global, promise)
+
+This will ensure that after tag works as expected.
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: true if both numbers are equal else returns false
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-| Param |
-| ----- |
-| numA |
-| numB |
+| Param | Type |
+| ------- | --------------- |
+| global | \*
|
+| promise | \*
|
-
+
-### Templating API: toplevel utility helpers~is_defined(value) ⇒
+### JS API: generator logic~deprecatedHelper(fn, explanation) ⇒
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: true or false based on whether the value is undefined or not
+Function wrapper that can be used when a helper is deprecated.
-| Param |
-| ----- |
-| value |
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: a function that wraps the original function, with deprecation message.
-
+| Param | Type | Description |
+| ----------- | --------------- | ----------------------------------------------------------------------- |
+| fn | \*
| |
+| explanation | \*
| can contain `text`, or `from`/`to`, or just be a string message itself. |
-### Templating API: toplevel utility helpers~replace_string(mainString, replaceString, replaceWithString) ⇒
+
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: A string replaced with another string in the mainString
+## JS API: template iterators.
+
+
+
+## JS API: generator logic
+
+- [JS API: generator logic](#module*JS API* generator logic)
+ - [~loadGenTemplateFromFile(path)](#module*JS API* generator logic..loadGenTemplateFromFile) ⇒
+ - [~recordTemplatesPackage(context)](#module*JS API* generator logic..recordTemplatesPackage) ⇒
+ - [~decodePackageExtensionEntity(entityType, entity)](#module*JS API* generator logic..decodePackageExtensionEntity) ⇒
+ - [~loadZclExtensions(zclExt)](#module*JS API* generator logic..loadZclExtensions) ⇒
+ - [~loadTemplates(db, genTemplatesJsonArray)](#module*JS API* generator logic..loadTemplates)
+ - [~loadGenTemplatesJsonFile(db, genTemplatesJson)](#module*JS API* generator logic..loadGenTemplatesJsonFile) ⇒
+ - [~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly)](#module*JS API* generator logic..generateAllTemplates) ⇒
+ - [~generateSingleTemplate(genResult, singleTemplatePkg)](#module*JS API* generator logic..generateSingleTemplate) ⇒
+ - [~generate(db, sessionId, templatePackageId, templateGeneratorOptions, options)](#module*JS API* generator logic..generate) ⇒
+ - [~writeFileWithBackup(fileName, content, doBackup)](#module*JS API* generator logic..writeFileWithBackup) ⇒
+ - [~generateGenerationContent(genResult)](#module*JS API* generator logic..generateGenerationContent)
+ - [~generateAndWriteFiles(db, sessionId, packageId, outputDirectory)](#module*JS API* generator logic..generateAndWriteFiles) ⇒
+ - [~postProcessGeneratedFiles(outputDirectory, genResult)](#module*JS API* generator logic..postProcessGeneratedFiles) ⇒
+ - [~contentIndexer(content)](#module*JS API* generator logic..contentIndexer)
+ - [~generateSingleFileForPreview(db, sessionId, fileName)](#module*JS API* generator logic..generateSingleFileForPreview) ⇒
+ - [~produceCompiledTemplate(singleTemplatePkg)](#module*JS API* generator logic..produceCompiledTemplate) ⇒
+ - [~produceIterativeContent(hb, metaInfo, db, sessionId, singleTemplatePkg, genTemplateJsonPackage, options)](#module*JS API* generator logic..produceIterativeContent) ⇒
+ - [~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:)](#module*JS API* generator logic..produceContent) ⇒
+ - [~wrapOverridable(originalFn, overrideFn)](#module*JS API* generator logic..wrapOverridable) ⇒
+ - [~loadOverridable(path)](#module*JS API* generator logic..loadOverridable)
+ - [~loadPartial(path)](#module*JS API* generator logic..loadPartial)
+ - [~loadHelper(helpers)](#module*JS API* generator logic..loadHelper)
+ - [~allBuiltInHelpers()](#module*JS API* generator logic..allBuiltInHelpers) ⇒
+ - [~findHelperPackageByAlias(alias)](#module*JS API* generator logic..findHelperPackageByAlias) ⇒
+ - [~initializeBuiltInHelpersForPackage()](#module*JS API* generator logic..initializeBuiltInHelpersForPackage)
+ - [~hbInstance()](#module*JS API* generator logic..hbInstance) ⇒
+ - [~makeSynchronizablePromise(promise)](#module*JS API* generator logic..makeSynchronizablePromise)
+ - [~collectBlocks(resultArray, options, context)](#module*JS API* generator logic..collectBlocks) ⇒
+ - [~ensureZclPackageId(context)](#module*JS API* generator logic..ensureZclPackageId) ⇒
+ - [~ensureZclPackageIds(context)](#module*JS API* generator logic..ensureZclPackageIds) ⇒
+ - [~ensureTemplatePackageCategory(context)](#module*JS API* generator logic..ensureTemplatePackageCategory) ⇒
+ - [~ensureTemplatePackageId(context)](#module*JS API* generator logic..ensureTemplatePackageId) ⇒
+ - [~ensureEndpointTypeIds(context)](#module*JS API* generator logic..ensureEndpointTypeIds) ⇒
+ - [~ensureZclClusterSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclClusterSdkExtensions) ⇒
+ - [~ensureZclDeviceTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclDeviceTypeSdkExtensions) ⇒
+ - [~ensureZclAttributeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeSdkExtensions) ⇒
+ - [~ensureZclAttributeTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeTypeSdkExtensions) ⇒
+ - [~ensureZclCommandSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclCommandSdkExtensions) ⇒
+ - [~ensureZclEventSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclEventSdkExtensions) ⇒
+ - [~templatePromise(global, promise)](#module*JS API* generator logic..templatePromise)
+ - [~deprecatedHelper(fn, explanation)](#module*JS API* generator logic..deprecatedHelper) ⇒
+
+
+
+### JS API: generator logic~loadGenTemplateFromFile(path) ⇒
+
+Given a path, it will read generation template object into memory.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Object that contains: data, crc, templateData
+
+| Param | Type |
+| ----- | --------------- |
+| path | \*
|
+
+
+
+### JS API: generator logic~recordTemplatesPackage(context) ⇒
+
+Given a loading context, it records the package into the packages table and adds the packageId field into the resolved context.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the same context passed in, except packageId added to it
+
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+
+
+
+### JS API: generator logic~decodePackageExtensionEntity(entityType, entity) ⇒
+
+This method takes extension data in JSON, and converts it into
+an object that contains:
+entityCode, entityQualifier, parentCode, manufacturerCode and value
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: object that can be used for database injection
+
+| Param | Type |
+| ---------- | --------------- |
+| entityType | \*
|
+| entity | \*
|
+
+
+
+### JS API: generator logic~loadZclExtensions(zclExt) ⇒
+
+Returns a promise that will load the zcl extensions.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise of loading the zcl extensions.
+
+| Param | Type |
+| ------ | --------------- |
+| zclExt | \*
|
+
+
+
+### JS API: generator logic~loadTemplates(db, genTemplatesJsonArray)
+
+Api that loads an array of template JSON files or a single file if
+you just pass in one String.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+| Param | Type |
+| --------------------- | --------------- |
+| db | \*
|
+| genTemplatesJsonArray | \*
|
+
+
+
+### JS API: generator logic~loadGenTemplatesJsonFile(db, genTemplatesJson) ⇒
+
+Main API async function to load templates from a gen-template.json file.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: the loading context, contains: db, path, crc, packageId and templateData, or error
+
+| Param | Type | Description |
+| ---------------- | --------------- | ------------------------------------------------------- |
+| db | \*
| Database |
+| genTemplatesJson | \*
| Path to the JSON file or an array of paths to JSON file |
+
+
+
+### JS API: generator logic~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly) ⇒
+
+Generates all the templates inside a toplevel package.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves with genResult, that contains all the generated templates, keyed by their 'output'
+
+| Param | Type | Description |
+| ------------------ | --------------- | -------------------------------------------------------------------------------------------------- |
+| genResult | \*
| |
+| genTemplateJsonPkg | \*
| Package that points to genTemplate.json file |
+| generateOnly | \*
| if NULL then generate all templates, else only generate template whose out file name matches this. |
+
+
+
+### JS API: generator logic~generateSingleTemplate(genResult, singleTemplatePkg) ⇒
+
+Function that generates a single package and adds it to the generation result.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the genResult, with newly generated content added.
+
+| Param | Type | Description |
+| ----------------- | --------------- | ------------------------ |
+| genResult | \*
| |
+| singleTemplatePkg | \*
| Single template package. |
+
+
+
+### JS API: generator logic~generate(db, sessionId, templatePackageId, templateGeneratorOptions, options) ⇒
+
+Main API async function to generate stuff.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves into a generation result.Promise that resolves into a generation result.
+
+| Param | Type | Description |
+| ------------------------ | --------------- | ------------------------------------------------------------------------------------- |
+| db | \*
| Database |
+| sessionId | \*
| |
+| templatePackageId | \*
| packageId Template package id. It can be either single template or gen template json. |
+| templateGeneratorOptions | \*
| |
+| options | \*
| |
+
+
+
+### JS API: generator logic~writeFileWithBackup(fileName, content, doBackup) ⇒
+
+Promise to write out a file, optionally creating a backup.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise of a written file.
+
+| Param | Type |
+| -------- | --------------- |
+| fileName | \*
|
+| content | \*
|
+| doBackup | \*
|
+
+
+
+### JS API: generator logic~generateGenerationContent(genResult)
+
+Returns a promise that resolves into a content that should be written out to gen result file.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
+| Param | Type |
+| --------- | --------------- |
+| genResult | \*
|
+
+
+
+### JS API: generator logic~generateAndWriteFiles(db, sessionId, packageId, outputDirectory) ⇒
+
+Generate files and write them into the given directory.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: a promise which will resolve when all the files are written.
+
+| Param | Type |
+| --------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| packageId | \*
|
+| outputDirectory | \*
|
+
+
+
+### JS API: generator logic~postProcessGeneratedFiles(outputDirectory, genResult) ⇒
+
+Executes post processing actions as defined by the gen-templates.json
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise of a dealt-with post processing actions
+
+| Param | Type |
+| --------------- | --------------- |
+| outputDirectory | \*
|
+| genResult | \*
|
+
+
-| Param |
-| ----------------- |
-| mainString |
-| replaceString |
-| replaceWithString |
+### JS API: generator logic~contentIndexer(content)
-
+This async function takes a string, and resolves a preview object out of it.
-### Templating API: toplevel utility helpers~add_prefix_to_all_strings(str, prefixStr) ⇒
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: A resultant string with all string values prefixed with prefixStr
+| Param | Type | Description |
+| ------- | --------------- | ---------------------------- |
+| content | \*
| String to form into preview. |
-| Param |
-| --------- |
-| str |
-| prefixStr |
+
-
+### JS API: generator logic~generateSingleFileForPreview(db, sessionId, fileName) ⇒
-### Templating API: toplevel utility helpers~multiply() ⇒
+Generates a single file and feeds it back for preview.
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: A number which is result of multiplying all the arguments given
-
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves into a preview object.
-### Templating API: toplevel utility helpers~is_string_underscored(val) ⇒
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| fileName | \*
|
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: true if a string has an underscore in it
+
-| Param | Type |
-| ----- | --------------- |
-| val | \*
|
+### JS API: generator logic~produceCompiledTemplate(singleTemplatePkg) ⇒
-
+Resolves into a precompiled template, either from previous precompile or freshly compiled.
-### Templating API: toplevel utility helpers~as_uppercase(val) ⇒
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: templates
-**Kind**: inner method of [Templating API: toplevel utility helpers
](#module*Templating API* toplevel utility helpers)
-**Returns**: val in uppercase
+| Param | Type |
+| ----------------- | --------------- |
+| singleTemplatePkg | \*
|
-| Param | Type |
-| ----- | --------------- |
-| val | \*
|
+
-
+### JS API: generator logic~produceIterativeContent(hb, metaInfo, db, sessionId, singleTemplatePkg, genTemplateJsonPackage, options) ⇒
-## Templating API: static zcl helpers
+This function is reached if the template is an "iterative one", meaning
+it has the iterator set to one of the valid options.
-This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves into an array of key/content/stats objects.
+
+| Param | Type |
+| ---------------------- | --------------- |
+| hb | \*
|
+| metaInfo | \*
|
+| db | \*
|
+| sessionId | \*
|
+| singleTemplatePkg | \*
|
+| genTemplateJsonPackage | \*
|
+| options | \*
|
-- [Templating API: static zcl helpers](#module*Templating API* static zcl helpers)
- - [~zcl_bitmaps(options)](#module*Templating API* static zcl helpers..zcl_bitmaps) ⇒
- - [~zcl_bitmap_items(options)](#module*Templating API* static zcl helpers..zcl_bitmap_items)
- - [~zcl_enums(options)](#module*Templating API* static zcl helpers..zcl_enums) ⇒
- - [~zcl_structs(options)](#module*Templating API* static zcl helpers..zcl_structs) ⇒
- - [~zcl_enum_items(options)](#module*Templating API* static zcl helpers..zcl_enum_items)
- - [~first_unused_enum_value(options)](#module*Templating API* static zcl helpers..first_unused_enum_value) ⇒
- - [~zcl_struct_items(options)](#module*Templating API* static zcl helpers..zcl_struct_items) ⇒
- - [~zcl_struct_items_by_struct_name(name, options)](#module*Templating API* static zcl helpers..zcl_struct_items_by_struct_name) ⇒
- - [~zcl_device_types(options)](#module*Templating API* static zcl helpers..zcl_device_types) ⇒
- - [~zcl_device_type_clusters(options)](#module*Templating API* static zcl helpers..zcl_device_type_clusters) ⇒
- - [~zcl_device_type_cluster_commands(options)](#module*Templating API* static zcl helpers..zcl_device_type_cluster_commands) ⇒
- - [~zcl_device_type_cluster_attributes(options)](#module*Templating API* static zcl helpers..zcl_device_type_cluster_attributes) ⇒
- - [~zcl_clusters(options)](#module*Templating API* static zcl helpers..zcl_clusters) ⇒
- - [~zcl_commands(options)](#module*Templating API* static zcl helpers..zcl_commands) ⇒
- - [~zcl_commands_with_cluster_info(options)](#module*Templating API* static zcl helpers..zcl_commands_with_cluster_info) ⇒
- - [~zcl_commands_with_arguments(options)](#module*Templating API* static zcl helpers..zcl_commands_with_arguments)
- - [~zcl_commands_source_client(options)](#module*Templating API* static zcl helpers..zcl_commands_source_client) ⇒
- - [~zcl_commands_source_server(options)](#module*Templating API* static zcl helpers..zcl_commands_source_server) ⇒
- - [~zcl_events(options)](#module*Templating API* static zcl helpers..zcl_events) ⇒
- - [~zcl_command_tree(options)](#module*Templating API* static zcl helpers..zcl_command_tree) ⇒
- - [~zcl_global_commands(options)](#module*Templating API* static zcl helpers..zcl_global_commands) ⇒
- - [~zcl_attributes(options)](#module*Templating API* static zcl helpers..zcl_attributes) ⇒
- - [~zcl_attributes_client(options)](#module*Templating API* static zcl helpers..zcl_attributes_client) ⇒
- - [~zcl_attributes_server(options)](#module*Templating API* static zcl helpers..zcl_attributes_server) ⇒
- - [~zcl_atomics(options)](#module*Templating API* static zcl helpers..zcl_atomics) ⇒
- - [~zcl_cluster_largest_label_length()](#module*Templating API* static zcl helpers..zcl_cluster_largest_label_length) ⇒
- - [~largestLabelLength(An)](#module*Templating API* static zcl helpers..largestLabelLength) ⇒
- - [~zcl_command_arguments_count(commandId)](#module*Templating API* static zcl helpers..zcl_command_arguments_count) ⇒
- - [~ifCommandArgumentsHaveFixedLengthWithCurrentContext(commandId, fixedLengthReturn, notFixedLengthReturn, currentContext)](#module*Templating API* static zcl helpers..ifCommandArgumentsHaveFixedLengthWithCurrentContext)
- - [~if_command_arguments_have_fixed_length(commandId, fixedLengthReturn, notFixedLengthReturn)](#module*Templating API* static zcl helpers..if_command_arguments_have_fixed_length)
- - [~as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present(type, command, commandArg, appendString, options)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present) ⇒
- - [~as_underlying_zcl_type_if_command_is_not_fixed_length(type, commandId, appendString, options)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_if_command_is_not_fixed_length)
- - [~command_arguments_total_length(commandId)](#module*Templating API* static zcl helpers..command_arguments_total_length)
- - [~zcl_command_arguments(options)](#module*Templating API* static zcl helpers..zcl_command_arguments) ⇒
- - [~zcl_event_fields(options)](#module*Templating API* static zcl helpers..zcl_event_fields)
- - [~zcl_command_argument_data_type(typeName, options)](#module*Templating API* static zcl helpers..zcl_command_argument_data_type)
- - [~asUnderlyingZclType(typeName, options)](#module*Templating API* static zcl helpers..asUnderlyingZclType)
- - [~zcl_string_type_return(type, options)](#module*Templating API* static zcl helpers..zcl_string_type_return)
- - [~is_zcl_string(type)](#module*Templating API* static zcl helpers..is_zcl_string)
- - [~if_is_number(type)](#module*Templating API* static zcl helpers..if_is_number) ⇒
- - [~if_is_string(type)](#module*Templating API* static zcl helpers..if_is_string) ⇒
- - [~if_is_char_string(type)](#module*Templating API* static zcl helpers..if_is_char_string) ⇒
- - [~if_is_octet_string(type)](#module*Templating API* static zcl helpers..if_is_octet_string) ⇒
- - [~if_is_short_string(type)](#module*Templating API* static zcl helpers..if_is_short_string) ⇒
- - [~if_is_long_string(type)](#module*Templating API* static zcl helpers..if_is_long_string) ⇒
- - [~if_is_atomic(type:)](#module*Templating API* static zcl helpers..if_is_atomic) ⇒
- - [~if_is_bitmap(type)](#module*Templating API* static zcl helpers..if_is_bitmap) ⇒
- - [~if_is_enum(type)](#module*Templating API* static zcl helpers..if_is_enum) ⇒
- - [~if_is_struct(type)](#module*Templating API* static zcl helpers..if_is_struct) ⇒
- - [~isClient(side)](#module*Templating API* static zcl helpers..isClient) ⇒
- - [~isServer(side)](#module*Templating API* static zcl helpers..isServer) ⇒
- - [~as_underlying_zcl_type_command_argument_always_present(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_command_argument_always_present) ⇒
- - [~if_command_argument_always_present(commandId, introducedInRef, removedInRef, presentIf, argumentPresentReturn, argumentNotPresentReturn)](#module*Templating API* static zcl helpers..if_command_argument_always_present) ⇒
- - [~as_underlying_zcl_type_command_argument_not_always_present_no_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_command_argument_not_always_present_no_presentif) ⇒
- - [~as_underlying_zcl_type_ca_not_always_present_no_presentif(commandArg, appendString, options)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_ca_not_always_present_no_presentif) ⇒
- - [~if_command_argument_not_always_present_no_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsReturn, argumentInAllVersionsReturn)](#module*Templating API* static zcl helpers..if_command_argument_not_always_present_no_presentif) ⇒
- - [~as_underlying_zcl_type_command_argument_not_always_present_with_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_command_argument_not_always_present_with_presentif) ⇒
- - [~as_underlying_zcl_type_ca_not_always_present_with_presentif(commandArg, appendString, options)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_ca_not_always_present_with_presentif) ⇒
- - [~if_command_argument_not_always_present_with_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsPresentIfReturn, argumentInAllVersionsReturn)](#module*Templating API* static zcl helpers..if_command_argument_not_always_present_with_presentif) ⇒
- - [~as_underlying_zcl_type_command_argument_always_present_with_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_command_argument_always_present_with_presentif) ⇒
- - [~as_underlying_zcl_type_ca_always_present_with_presentif(commandArg, appendString, options)](#module*Templating API* static zcl helpers..as_underlying_zcl_type_ca_always_present_with_presentif) ⇒
- - [~if_command_argument_always_present_with_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsPresentIfReturn, argumentInAllVersionsReturn)](#module*Templating API* static zcl helpers..if_command_argument_always_present_with_presentif) ⇒
- - [~if_manufacturing_specific_cluster(clusterId, manufacturer_specific_return, null_manufacturer_specific_return)](#module*Templating API* static zcl helpers..if_manufacturing_specific_cluster) ⇒
- - [~if_mfg_specific_cluster(clusterId, options)](#module*Templating API* static zcl helpers..if_mfg_specific_cluster) ⇒
- - [~as_generated_default_macro(value, attributeSize, options)](#module*Templating API* static zcl helpers..as_generated_default_macro) ⇒
- - [~attribute_mask(writable, storageOption, minMax, mfgSpecific, clusterCode, client, isSingleton, prefixString, postfixString)](#module*Templating API* static zcl helpers..attribute_mask) ⇒
- - [~command_mask(commmandSource, clusterSide, isIncomingEnabled, isOutgoingEnabled, manufacturingCode, prefixForMask)](#module*Templating API* static zcl helpers..command_mask) ⇒
- - [~command_mask_sub_helper(commandMask, str)](#module*Templating API* static zcl helpers..command_mask_sub_helper) ⇒
- - [~format_zcl_string_as_characters_for_generated_defaults(stringVal, sizeOfString)](#module*Templating API* static zcl helpers..format_zcl_string_as_characters_for_generated_defaults) ⇒
- - [~as_type_min_value(type, options)](#module*Templating API* static zcl helpers..as_type_min_value) ⇒
- - [~as_type_max_value(type, options)](#module*Templating API* static zcl helpers..as_type_max_value) ⇒
- - [~structs_with_clusters(options)](#module*Templating API* static zcl helpers..structs_with_clusters)
- - [~as_zcl_type_size(type, options)](#module*Templating API* static zcl helpers..as_zcl_type_size) ⇒
- - [~if_compare(leftValue, rightValue, options)](#module*Templating API* static zcl helpers..if_compare) ⇒ Object
- - [~if_is_data_type_signed(type, clusterId, options)](#module*Templating API* static zcl helpers..if_is_data_type_signed) ⇒
- - [~as_zcl_data_type_size(type, clusterId, options)](#module*Templating API* static zcl helpers..as_zcl_data_type_size) ⇒
+
-
+### JS API: generator logic~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:) ⇒
-### Templating API: static zcl helpers~zcl_bitmaps(options) ⇒
+Given db connection, session and a single template package, produce the output.
-Block helper iterating over all bitmaps.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves into an array of key/content/stats objects.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+| Param | Type | Description |
+| ------------- | --------------- | --------------------------------------------------------------------------------------- |
+| hb | \*
| |
+| metaInfo | \*
| |
+| db | \*
| |
+| sessionId | \*
| |
+| singlePkg | \*
| |
+| overridePath: | \*
| if passed, it provides a path to the override file that can override the overridable.js |
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+
-
+### JS API: generator logic~wrapOverridable(originalFn, overrideFn) ⇒
-### Templating API: static zcl helpers~zcl_bitmap_items(options)
+This function attemps to call override function, but if override function
+throws an exception, it calls the original function.
-Iterates over enum items. Valid only inside zcl_enums.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: result from override function, unless it throws an exception, in which case return result from original function.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+| Param | Type |
+| ---------- | --------------- |
+| originalFn | \*
|
+| overrideFn | \*
|
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+
-
+### JS API: generator logic~loadOverridable(path)
-### Templating API: static zcl helpers~zcl_enums(options) ⇒
+This function is responsible to load the overridable function container.
-Block helper iterating over all enums.
-If existing independently, it iterates over ALL the enums.
-Within a context of a cluster, it iterates only over the
-enums belonging to a cluster.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+| Param | Type | Description |
+| ----- | --------------- | -------------------- |
+| path | \*
| of the override file |
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+
-
+### JS API: generator logic~loadPartial(path)
-### Templating API: static zcl helpers~zcl_structs(options) ⇒
+Function that loads the partials.
-Block helper iterating over all structs.
-If existing independently, it iterates over ALL the structs.
-Within a context of a cluster, it iterates only over the
-structs belonging to a cluster.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+| Param | Type |
+| ----- | --------------- |
+| path | \*
|
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+
-
+### JS API: generator logic~loadHelper(helpers)
-### Templating API: static zcl helpers~zcl_enum_items(options)
+Function that loads the helpers.
-Iterates over enum items. Valid only inside zcl_enums.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+| Param | Type | Description |
+| ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| helpers | \*
| a string path if value is passed through CLI, the nativeRequire() is leverage the native js function instead of webpack's special sauce. a required() module if invoked by backend js code. this is required to force webpack to resolve the included files as path will be difference after being packed for production. |
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+
-
+### JS API: generator logic~allBuiltInHelpers() ⇒
-### Templating API: static zcl helpers~first_unused_enum_value(options) ⇒
+Returns an object that contains all the helper functions, keyed
+by their name
-This helper prints out the first unused enum value.
-It supports mode="next_larger" and
-mode="first_unused" (which is the default).
+NOTE: This method is ONLY used for API testing. You should not use
+this method for any real work inside the engine or something.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: the unused enum value
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Object containing all the helper functions.
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+### JS API: generator logic~findHelperPackageByAlias(alias) ⇒
-
+Given an alias, this method finds a builtin helper package
+by its alias.
-### Templating API: static zcl helpers~zcl_struct_items(options) ⇒
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Helper package or undefined if none was found.
-Block helper iterating over all struct items. Valid only inside zcl_structs.
+| Param | Type |
+| ----- | --------------- |
+| alias | \*
|
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+### JS API: generator logic~initializeBuiltInHelpersForPackage()
-
+Global helper initialization
-### Templating API: static zcl helpers~zcl_struct_items_by_struct_name(name, options) ⇒
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
-Block helper iterating over all struct items given the struct name.
+### JS API: generator logic~hbInstance() ⇒
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+This method returns the correct instance for a given generation flow.
-| Param |
-| ------- |
-| name |
-| options |
+TBD: At this point it doesn't do anything yet, it's just
+a central point to get the correct instance.
-
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Instance of handlebars to be used.
+
-### Templating API: static zcl helpers~zcl_device_types(options) ⇒
+### JS API: generator logic~makeSynchronizablePromise(promise)
-Block helper iterating over all deviceTypes.
+All promises used by the templates should be synchronizable.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
| Param | Type |
| ------- | --------------- |
-| options | \*
|
+| promise | \*
|
-
+
-### Templating API: static zcl helpers~zcl_device_type_clusters(options) ⇒
+### JS API: generator logic~collectBlocks(resultArray, options, context) ⇒
-Block helper for use inside zcl_device_types
+Helpful function that collects the individual blocks by using elements of an array as a context,
+executing promises for each, and collecting them into the outgoing string.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: blocks for clusters
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: Promise that resolves with a content string.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type | Description |
+| ----------- | --------------- | ---------------------------------------- |
+| resultArray | \*
| |
+| options | \*
| Options passed from a block helper. |
+| context | \*
| The context from within this was called. |
-
+
-### Templating API: static zcl helpers~zcl_device_type_cluster_commands(options) ⇒
+### JS API: generator logic~ensureZclPackageId(context) ⇒
-Block helper for use inside zcl_device_type_clusters
+Returns the promise that resolves with the ZCL properties package id.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: blocks for commands
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the package id.
| Param | Type |
| ------- | --------------- |
-| options | \*
|
+| context | \*
|
-
+
-### Templating API: static zcl helpers~zcl_device_type_cluster_attributes(options) ⇒
+### JS API: generator logic~ensureZclPackageIds(context) ⇒
-Block helper for use inside zcl_device_type_clusters
+Returns the promise that resolves with all ZCL package id specific to current session.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: blocks for attributes
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with a list of package id.
| Param | Type |
| ------- | --------------- |
-| options | \*
|
+| context | \*
|
-
+
-### Templating API: static zcl helpers~zcl_clusters(options) ⇒
+### JS API: generator logic~ensureTemplatePackageCategory(context) ⇒
-Block helper iterating over all clusters.
+Returns a package category of the toplevel template package from context.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: proimise that resolves into a package category
| Param | Type |
| ------- | --------------- |
-| options | \*
|
+| context | \*
|
-
+
-### Templating API: static zcl helpers~zcl_commands(options) ⇒
+### JS API: generator logic~ensureTemplatePackageId(context) ⇒
-Block helper iterating over all commands.
-There are two modes of this helper:
-when used in a global context, it iterates over ALL commands in the database.
-when used inside a `zcl_cluster` block helper, it iterates only over the commands for that cluster.
+Returns the promise that resolves with the ZCL properties package id.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with the package id.
| Param | Type |
| ------- | --------------- |
-| options | \*
|
+| context | \*
|
-
+
-### Templating API: static zcl helpers~zcl_commands_with_cluster_info(options) ⇒
+### JS API: generator logic~ensureEndpointTypeIds(context) ⇒
-Block helper iterating over all commands with cluster information.
-Note: Similar to zcl_commands but has cluster information as well.
+Populate the endpoint type ids into the global context.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: endpoint type ids
| Param | Type |
| ------- | --------------- |
-| options | \*
|
+| context | \*
|
-
+
-### Templating API: static zcl helpers~zcl_commands_with_arguments(options)
+### JS API: generator logic~ensureZclClusterSdkExtensions(context, templatePackageId) ⇒
-Helper that retrieves all commands that contain arguments.
+Resolves with cached cluster extensions, but if they don't
+exist, it will populate them.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with cluster extensions.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
-
+
-### Templating API: static zcl helpers~zcl_commands_source_client(options) ⇒
+### JS API: generator logic~ensureZclDeviceTypeSdkExtensions(context, templatePackageId) ⇒
-Block helper iterating over all client commands.
-There are two modes of this helper:
-when used in a global context, it iterates over ALL client commands in the database.
-when used inside a `zcl_cluster` block helper, it iterates only over the commands for that client cluster.
+Resolves with cached cluster extensions, but if they don't
+exist, it will populate them.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with cluster extensions.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
-
+
-### Templating API: static zcl helpers~zcl_commands_source_server(options) ⇒
+### JS API: generator logic~ensureZclAttributeSdkExtensions(context, templatePackageId) ⇒
-Block helper iterating over all server commands.
-There are two modes of this helper:
-when used in a global context, it iterates over ALL server commands in the database.
-when used inside a `zcl_cluster` block helper, it iterates only over the commands for that server cluster.
+Resolves with cached attribute extensions, but if they don't
+exist, it will populate them.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with attribute extensions.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
-
+
-### Templating API: static zcl helpers~zcl_events(options) ⇒
+### JS API: generator logic~ensureZclAttributeTypeSdkExtensions(context, templatePackageId) ⇒
-Block helper iterating over all events.
-There are two modes of this helper:
-when used in a global context, it iterates over ALL events in the database.
-when used inside a `zcl_cluster` block helper, it iterates only over the events for that cluster.
+Resolves with cached attribute type extensions, but if they don't
+exist, it will populate them.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with attribute type extensions.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
-
+
-### Templating API: static zcl helpers~zcl_command_tree(options) ⇒
+### JS API: generator logic~ensureZclCommandSdkExtensions(context, templatePackageId) ⇒
-Block helper iterating over all commands, including their arguments and clusters.
+Resolves with cached command extensions, but if they don't
+exist, it will populate them.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with command extensions.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
-
+
-### Templating API: static zcl helpers~zcl_global_commands(options) ⇒
+### JS API: generator logic~ensureZclEventSdkExtensions(context, templatePackageId) ⇒
-Helper to iterate over all global commands.
+Resolves with cached command extensions, but if they don't
+exist, it will populate them.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of global command iteration.
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: promise that resolves with command extensions.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ----------------- | --------------- |
+| context | \*
|
+| templatePackageId | \*
|
-
+
-### Templating API: static zcl helpers~zcl_attributes(options) ⇒
+### JS API: generator logic~templatePromise(global, promise)
-Iterator over the attributes. If it is used at toplevel, if iterates over all the attributes
-in the database. If used within zcl_cluster context, it iterates over all the attributes
-that belong to that cluster.
+Every helper that returns a promise, should
+not return the promise directly. So instead of
+returning the promise directly, it should return:
+return templatePromise(this.global, promise)
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of attribute iteration.
+This will ensure that after tag works as expected.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
| Param | Type |
| ------- | --------------- |
-| options | \*
|
+| global | \*
|
+| promise | \*
|
-
+
-### Templating API: static zcl helpers~zcl_attributes_client(options) ⇒
+### JS API: generator logic~deprecatedHelper(fn, explanation) ⇒
-Iterator over the client attributes. If it is used at toplevel, if iterates over all the client attributes
-in the database. If used within zcl_cluster context, it iterates over all the client attributes
-that belong to that cluster.
+Function wrapper that can be used when a helper is deprecated.
+
+**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Returns**: a function that wraps the original function, with deprecation message.
+
+| Param | Type | Description |
+| ----------- | --------------- | ----------------------------------------------------------------------- |
+| fn | \*
| |
+| explanation | \*
| can contain `text`, or `from`/`to`, or just be a string message itself. |
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of attribute iteration.
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+## REST API: user data
-
+This module provides the API to access zcl specific information.
-### Templating API: static zcl helpers~zcl_attributes_server(options) ⇒
+- [REST API: user data](#module*REST API* user data)
+ - [~getComponentIdsByCluster(db, sessionId, clusterId, side)](#module*REST API* user data..getComponentIdsByCluster) ⇒ \*
+ - [~httpGetSessionKeyValues(db)](#module*REST API* user data..httpGetSessionKeyValues) ⇒
+ - [~httpGetEndpointIds(db)](#module*REST API* user data..httpGetEndpointIds) ⇒
+ - [~httpGetSessionNotifications(db)](#module*REST API* user data..httpGetSessionNotifications) ⇒
+ - [~httpDeleteSessionNotification(db)](#module*REST API* user data..httpDeleteSessionNotification) ⇒
+ - [~httpGetPackageNotifications(db)](#module*REST API* user data..httpGetPackageNotifications) ⇒
+ - [~httpGetPackageNotificationsByPackageId(db)](#module*REST API* user data..httpGetPackageNotificationsByPackageId) ⇒
+ - [~httpDeletePackageNotification(db)](#module*REST API* user data..httpDeletePackageNotification) ⇒
+ - [~httpGetUnseenNotificationCount(db)](#module*REST API* user data..httpGetUnseenNotificationCount) ⇒
+ - [~httpGetUnseenNotificationAndUpdate(db)](#module*REST API* user data..httpGetUnseenNotificationAndUpdate) ⇒
+ - [~httpPostSaveSessionKeyValue(db)](#module*REST API* user data..httpPostSaveSessionKeyValue) ⇒
+ - [~httpPostCluster(db)](#module*REST API* user data..httpPostCluster) ⇒
+ - [~httpPostForcedExternal(db)](#module*REST API* user data..httpPostForcedExternal) ⇒ function
+ - [~httpPostAttributeUpdate(db)](#module*REST API* user data..httpPostAttributeUpdate) ⇒
+ - [~httpPostCommandUpdate(db)](#module*REST API* user data..httpPostCommandUpdate) ⇒
+ - [~httpPostEventUpdate(db)](#module*REST API* user data..httpPostEventUpdate) ⇒
+ - [~httpGetInitialState(db)](#module*REST API* user data..httpGetInitialState) ⇒
+ - [~httpGetOption(db)](#module*REST API* user data..httpGetOption) ⇒
+ - [~httpGetUiOptions(db)](#module*REST API* user data..httpGetUiOptions) ⇒
+ - [~httpGetPackages()](#module*REST API* user data..httpGetPackages)
+ - [~httpGetAllPackages()](#module*REST API* user data..httpGetAllPackages)
+ - [~httpPostAddNewPackage()](#module*REST API* user data..httpPostAddNewPackage)
+ - [~httpPostShareClusterStatesAcrossEndpoints()](#module*REST API* user data..httpPostShareClusterStatesAcrossEndpoints)
+ - [~httpPostDuplicateEndpoint(db)](#module*REST API* user data..httpPostDuplicateEndpoint) ⇒
+ - [~httpPostDuplicateEndpointType(db)](#module*REST API* user data..httpPostDuplicateEndpointType) ⇒
+ - [~duplicateEndpointTypeClusters(db, oldEndpointTypeId, newEndpointTypeId)](#module*REST API* user data..duplicateEndpointTypeClusters)
-Iterator over the server attributes. If it is used at toplevel, if iterates over all the server attributes
-in the database. If used within zcl_cluster context, it iterates over all the server attributes
-that belong to that cluster.
-Available Options:
+
-- removeKeys: Removes one or more keys from the map(for eg keys in db-mapping.js)
- for eg: (#zcl_attributes_server removeKeys='isOptional, isNullable') will remove 'isOptional'
- from the results
+### REST API: user data~getComponentIdsByCluster(db, sessionId, clusterId, side) ⇒ \*
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of attribute iteration.
+Promise that return a list of component Ids required by a specific cluster
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: \*
- array of componentIds
-
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterId | \*
|
+| side | \*
|
-### Templating API: static zcl helpers~zcl_atomics(options) ⇒
+
-Block helper iterating over all atomic types.
+### REST API: user data~httpGetSessionKeyValues(db) ⇒
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+HTTP GET: session key values
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-### Templating API: static zcl helpers~zcl_cluster_largest_label_length() ⇒
+
-Given: N/A
+### REST API: user data~httpGetEndpointIds(db) ⇒
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: the length of largest cluster name in a list of clusters
-
+HTTP GET: endpoint ids of endpoints within a specified session
-### Templating API: static zcl helpers~largestLabelLength(An) ⇒
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: the length of largest object name in an array. Helper for
-zcl_cluster_largest_label_length
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type | Description |
-| ----- | --------------- | ----------- |
-| An | \*
| Array |
+
-
+### REST API: user data~httpGetSessionNotifications(db) ⇒
-### Templating API: static zcl helpers~zcl_command_arguments_count(commandId) ⇒
+HTTP GET: session get notifications
-Helper to extract the number of command arguments in a command
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Number of command arguments as an integer
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| --------- | --------------- |
-| commandId | \*
|
+
-
+### REST API: user data~httpDeleteSessionNotification(db) ⇒
-### Templating API: static zcl helpers~ifCommandArgumentsHaveFixedLengthWithCurrentContext(commandId, fixedLengthReturn, notFixedLengthReturn, currentContext)
+HTTP DELETE: session delete notifications
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-| Param | Description |
-| -------------------- | ----------------------------------------------------------------------------------------------------- |
-| commandId | |
-| fixedLengthReturn | |
-| notFixedLengthReturn | |
-| currentContext | Returns fixedLengthReturn or notFixedLengthReturn based on whether the command is fixed length or not |
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### Templating API: static zcl helpers~if_command_arguments_have_fixed_length(commandId, fixedLengthReturn, notFixedLengthReturn)
+### REST API: user data~httpGetPackageNotifications(db) ⇒
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+HTTP GET: package get notifications
-| Param | Description |
-| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| commandId | |
-| fixedLengthReturn | |
-| notFixedLengthReturn | Returns fixedLengthReturn or notFixedLengthReturn based on whether the command is fixed length or not. Does not check if command arguments are always present or not. |
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-### Templating API: static zcl helpers~as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present(type, command, commandArg, appendString, options) ⇒
+
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: the underlying zcl type of a command argument if the argument is
-not fixed length but is always present. If the condition is not met then
-returns an empty string.
+### REST API: user data~httpGetPackageNotificationsByPackageId(db) ⇒
-| Param |
-| ------------ |
-| type |
-| command |
-| commandArg |
-| appendString |
-| options |
+HTTP GET: package get notifications
-
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-### Templating API: static zcl helpers~as_underlying_zcl_type_if_command_is_not_fixed_length(type, commandId, appendString, options)
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+
-| Param | Description |
-| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| type | |
-| commandId | |
-| appendString | |
-| options | Returns: Given the commandId and the type of one of its arguments, based on whether the command is fixed length or not either return nothing or return the underlying zcl type appended with the appendString. |
+### REST API: user data~httpDeletePackageNotification(db) ⇒
-
+HTTP DELETE: session delete notifications
-### Templating API: static zcl helpers~command_arguments_total_length(commandId)
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Description |
-| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| commandId | Returns the size of the command by calculating the sum total of the command arguments Note: This helper should be called on fixed length commands only. It should not be called with commands which do not have a fixed length. |
+
-
+### REST API: user data~httpGetUnseenNotificationCount(db) ⇒
-### Templating API: static zcl helpers~zcl_command_arguments(options) ⇒
+HTTP GET: session get unseen session notification count
-Block helper iterating over command arguments within a command
-or a command tree.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of command argument iteration.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+
-
+### REST API: user data~httpGetUnseenNotificationAndUpdate(db) ⇒
-### Templating API: static zcl helpers~zcl_event_fields(options)
+HTTP GET: session update all session notifications to be SEEN
-Block helper iterating over the event fields inside an event.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+
-
+### REST API: user data~httpPostSaveSessionKeyValue(db) ⇒
-### Templating API: static zcl helpers~zcl_command_argument_data_type(typeName, options)
+HTTP POST: save session key value
-Helper that deals with the type of the argument.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| -------- | --------------- |
-| typeName | \*
|
-| options | \*
|
+
-
+### REST API: user data~httpPostCluster(db) ⇒
-### Templating API: static zcl helpers~asUnderlyingZclType(typeName, options)
+HTTP POST: cluster
-Helper that deals with the type of the argument.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type | Description |
-| -------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| typeName | \*
| |
-| options | \*
| Note: If the options has zclCharFormatter set to true then the function will return the user defined data associated with the zcl data type and not the actual data type. example: {{asUnderlyingZclType [array type] array="b" one_byte="u" two_byte="v" three_byte="x" four_byte="w" short_string="s" long_string="l" default="b" zclCharFormatter="true"}} For the above if asUnderlyingZclType was given [array type] then the above will return 'b' |
+
-
+### REST API: user data~httpPostForcedExternal(db) ⇒ function
-### Templating API: static zcl helpers~zcl_string_type_return(type, options)
+Handles a POST request to retrieve forced external storage options.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+This function is designed to be used as a middleware in an Express.js route. It extracts the session ID from the request,
+queries the database for package information associated with that session, and then retrieves forced external storage
+options for the identified package. The results are sent back to the client as a JSON response.
-| Param | Description |
-| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| type | |
-| options | Returns the data mentioned in the helper options based on whether the type is short string, long string or not a string Example: {{zcl_string_type_return type short_string="short string output" long_string="short string output" default="Output when not a string") |
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: function
- An asynchronous function that takes Express.js request and response objects.
-
+| Param | Type | Description |
+| ----- | ------------------- | ------------------------------- |
+| db | Object
| The database connection object. |
-### Templating API: static zcl helpers~is_zcl_string(type)
+
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+### REST API: user data~httpPostAttributeUpdate(db) ⇒
-| Param | Description |
-| ----- | ------------------------------------------------------------------- |
-| type | Return: true or false based on whether the type is a string or not. |
+HTTP POST attribute update
-
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-### Templating API: static zcl helpers~if_is_number(type) ⇒
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-If helper that checks if a type is a string
+
-example:
-{{#if_is_number type}}
-type is number
-{{else}}
-type is not number
-{{/if_is_number}}
+### REST API: user data~httpPostCommandUpdate(db) ⇒
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+HTTP POST: command update
+
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
| Param | Type |
| ----- | --------------- |
-| type | \*
|
-
-
+| db | \*
|
-### Templating API: static zcl helpers~if_is_string(type) ⇒
+
-If helper that checks if a type is a string
+### REST API: user data~httpPostEventUpdate(db) ⇒
-example:
-{{#if_is_string type}}
-type is string
-{{else}}
-type is not string
-{{/if_is_string}}
+HTTP POST: command update
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
| Param | Type |
| ----- | --------------- |
-| type | \*
|
-
-
+| db | \*
|
-### Templating API: static zcl helpers~if_is_char_string(type) ⇒
+
-If helper that checks if a string type is present in the list of char strings
-i.e. characterStringTypes
+### REST API: user data~httpGetInitialState(db) ⇒
-example:
-{{#if_is_char_string type}}
-type is char string
-{{else}}
-type is not char string
-{{/if_is_char_string}}
+HTTP GET: initial state
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
| Param | Type |
| ----- | --------------- |
-| type | \*
|
-
-
+| db | \*
|
-### Templating API: static zcl helpers~if_is_octet_string(type) ⇒
+
-If helper that checks if a string type is present in the list of octet strings
-i.e. octetStringTypes
+### REST API: user data~httpGetOption(db) ⇒
-example:
-{{#if_is_octet_string type}}
-type is octet string
-{{else}}
-type is not octet string
-{{/if_is_octet_string}}
+HTTP GET: option
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
| Param | Type |
| ----- | --------------- |
-| type | \*
|
-
-
+| db | \*
|
-### Templating API: static zcl helpers~if_is_short_string(type) ⇒
+
-If helper that checks if a string type is present in the list of short strings
-i.e. stringShortTypes
+### REST API: user data~httpGetUiOptions(db) ⇒
-example:
-{{#if_is_short_string type}}
-type is short string
-{{else}}
-type is not short string
-{{/if_is_short_string}}
+HTTP GET: ui_options
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: UI options from all packages.
| Param | Type |
| ----- | --------------- |
-| type | \*
|
+| db | \*
|
-
+
-### Templating API: static zcl helpers~if_is_long_string(type) ⇒
+### REST API: user data~httpGetPackages()
-If helper that checks if a string type is present in the list of long strings
-i.e. stringLongTypes
+HTTP GET: Project packages
-example:
-{{#if_is_long_string type}}
-type is long string
-{{else}}
-type is not long string
-{{/if_is_long_string}}
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+### REST API: user data~httpGetAllPackages()
-| Param | Type |
-| ----- | --------------- |
-| type | \*
|
+HTTP GET: All Packages
-
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+
-### Templating API: static zcl helpers~if_is_atomic(type:) ⇒
+### REST API: user data~httpPostAddNewPackage()
-If helper that checks if a type is an atomic
+HTTP POST: Add new project package
-example:
-{{#if_is_atomic type}}
-type is atomic
-{{else}}
-type is not atomic
-{{/if_is_atomic}}
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+### REST API: user data~httpPostShareClusterStatesAcrossEndpoints()
-| Param | Type | Description |
-| ----- | --------------- | ----------- |
-| type: | \*
| string |
+HTTP POST: Unify all Attributes / Command states if a certain cluster is enabled
+on more than one endpoint.
-
+1. In Zigbee world, the Attribute / Command configurations is a global singleton entity.
+ If one cluster is enabled by more than 1 endpoint, the attribute states (on/off) should be
+ identical across each endpoint.
+ To emulate the global singleton entity, this function ensures Attribute changes
+ are applied to all endpoint specific attribute fields.
+ When unify event is triggered, this function will align all shared Attribute/Command states
+ to the first matching entry from beginning of the endpoint list.
+2. (native case in ZAP) In Matter, the Attribute configuration are endpoint specific.
-### Templating API: static zcl helpers~if_is_bitmap(type) ⇒
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+
-If helper that checks if a type is a bitmap
+### REST API: user data~httpPostDuplicateEndpoint(db) ⇒
-example:
-{{#if_is_bitmap type}}
-type is bitmap
-{{else}}
-type is not bitmap
-{{/if_is_bitmap}}
+Creating a duplicate for endpoint
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: newly created endpoint id
| Param | Type |
| ----- | --------------- |
-| type | \*
|
-
-
+| db | \*
|
-### Templating API: static zcl helpers~if_is_enum(type) ⇒
+
-If helper that checks if a type is an enum
+### REST API: user data~httpPostDuplicateEndpointType(db) ⇒
-- example:
- {{#if_is_enum type}}
- type is enum
- {{else}}
- type is not enum
- {{/if_is_enum}}
+Creating a duplicate for endpoint-type and endpoint-type-attributes
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: newly created endpoint-type id
| Param | Type |
| ----- | --------------- |
-| type | \*
|
+| db | \*
|
-
+
-### Templating API: static zcl helpers~if_is_struct(type) ⇒
+### REST API: user data~duplicateEndpointTypeClusters(db, oldEndpointTypeId, newEndpointTypeId)
-If helper that checks if a type is an struct
+duplicate all clusters and attributes of an old endpoint type, using oldEndpointType id and newly created endpointType id
-- example:
- {{#if_is_struct type}}
- type is struct
- {{else}}
- type is not struct
- {{/if_is_struct}}
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content.
+| Param | Type |
+| ----------------- | --------------- |
+| db | \*
|
+| oldEndpointTypeId | \*
|
+| newEndpointTypeId | \*
|
-| Param |
-| ----- |
-| type |
+
-
+## REST API: admin functions
-### Templating API: static zcl helpers~isClient(side) ⇒
+This module provides the REST API to the admin functions.
-Checks if the side is client or not
+- [REST API: admin functions](#module*REST API* admin functions)
+ - [~httpPostSql(db, app)](#module*REST API* admin functions..httpPostSql) ⇒
+ - [~httpGetVersion(db)](#module*REST API* admin functions..httpGetVersion) ⇒
+ - [~httpGetCache(db)](#module*REST API* admin functions..httpGetCache)
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: boolean
+
+
+### REST API: admin functions~httpPostSql(db, app) ⇒
+
+API: /sql
+Request JSON:
+
++ { + sql: SQL Query + } ++ +Response JSON: + +
+ { + result: Array of rows. + } ++ +**Kind**: inner method of [
REST API: admin functions
](#module*REST API* admin functions)
+**Returns**: callback for the express uri registration
| Param | Type |
| ----- | --------------- |
-| side | \*
|
+| db | \*
|
+| app | \*
|
-
+
-### Templating API: static zcl helpers~isServer(side) ⇒
+### REST API: admin functions~httpGetVersion(db) ⇒
-Checks if the side is server or not
+API: /version
+Response JSON:
+
++ { + version: full version. + featureLevel: feature level. + hash: git hash code + timestamp: Unix time from the last commit in the repo. + date: Date of the last commit in the repo. + } +-**Kind**: inner method of [
Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: boolean
+**Kind**: inner method of [REST API: admin functions
](#module*REST API* admin functions)
+**Returns**: callback for the express uri registration.
| Param | Type |
| ----- | --------------- |
-| side | \*
|
-
-
-
-### Templating API: static zcl helpers~as_underlying_zcl_type_command_argument_always_present(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:) ⇒
+| db | \*
|
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: A string as an underlying zcl type if the command is not fixed length and the command
-argument is always present in all zcl specifications.
+
-| Param | Description |
-| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
-| type: | type of argument |
-| commandId: | command id |
-| appendString: | append the string to the argument |
-| introducedInRef: | If the command argument is not present in all zcl specifications and was introduced in a certain specification version then this will not be null |
-| removedInRef: | If the command argument is not present in all zcl specifications and was removed in a certain specification version then this will not be null |
-| presentIf: | If the command argument is present conditionally then this will be a condition and not null |
-| options: | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+### REST API: admin functions~httpGetCache(db)
-
+API: /cache
+Response JSON:
-### Templating API: static zcl helpers~if_command_argument_always_present(commandId, introducedInRef, removedInRef, presentIf, argumentPresentReturn, argumentNotPresentReturn) ⇒
++ { + keys: 0, // global key count + hits: 0, // global hit count + misses: 0, // global miss count + ksize: 0, // global key size count in approximately bytes + vsize: 0 // global value size count in approximately bytes + } +-**Kind**: inner method of [
Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: argumentPresentReturn if the command is not fixed length and command
-argument is always present without conditions(introducedInRef, removedInRef,
-presentIf) else returns argumentNotPresentReturn
+**Kind**: inner method of [REST API: admin functions
](#module*REST API* admin functions)
-| Param |
-| ------------------------ |
-| commandId |
-| introducedInRef |
-| removedInRef |
-| presentIf |
-| argumentPresentReturn |
-| argumentNotPresentReturn |
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### Templating API: static zcl helpers~as_underlying_zcl_type_command_argument_not_always_present_no_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:) ⇒
+## REST API: endpoint
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: A string as an underlying zcl type if the command is not fixed length, the command
-argument is not always present in all zcl specifications and there is no present if conditionality
-on the command argument.
+This module provides the REST API to the user specific data.
-| Param | Description |
-| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
-| type: | type of argument |
-| commandId: | command id |
-| appendString: | append the string to the argument |
-| introducedInRef: | If the command argument is not present in all zcl specifications and was introduced in a certain specification version then this will not be null |
-| removedInRef: | If the command argument is not present in all zcl specifications and was removed in a certain specification version then this will not be null |
-| presentIf: | If the command argument is present conditionally then this will be a condition and not null |
-| options: | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+- [REST API: endpoint](#module*REST API* endpoint)
+ - [~httpDeleteEndpoint(db)](#module*REST API* endpoint..httpDeleteEndpoint) ⇒
+ - [~httpDeleteEndpointType(db)](#module*REST API* endpoint..httpDeleteEndpointType) ⇒
+ - [~httpPostEndpoint(db)](#module*REST API* endpoint..httpPostEndpoint) ⇒
+ - [~httpPatchEndpoint(db)](#module*REST API* endpoint..httpPatchEndpoint) ⇒
+ - [~httpPostEndpointType(db)](#module*REST API* endpoint..httpPostEndpointType) ⇒
+ - [~httpPatchEndpointType(db)](#module*REST API* endpoint..httpPatchEndpointType) ⇒
-
+
-### Templating API: static zcl helpers~as_underlying_zcl_type_ca_not_always_present_no_presentif(commandArg, appendString, options) ⇒
+### REST API: endpoint~httpDeleteEndpoint(db) ⇒
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: A string as an underlying zcl type if the command is not fixed
-length, the command argument is not always present in all zcl specifications
-and there is no present if conditionality on the command argument.
+HTTP DELETE: endpoint
-| Param | Description |
-| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
-| commandArg | command argument |
-| appendString | append the string to the argument |
-| options | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
+**Returns**: callback for the express uri registration
-
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-### Templating API: static zcl helpers~if_command_argument_not_always_present_no_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsReturn, argumentInAllVersionsReturn) ⇒
+
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: argumentNotInAllVersionsReturn if the command is not fixed length and command
-argument is present with conditions introducedInRef or removedInRef but no presentIf
-conditions else returns argumentNotPresentReturn
+### REST API: endpoint~httpDeleteEndpointType(db) ⇒
-| Param |
-| ------------------------------ |
-| commandId |
-| introducedInRef |
-| removedInRef |
-| presentIf |
-| argumentNotInAllVersionsReturn |
-| argumentInAllVersionsReturn |
+HTTP DELETE: endpoint type
-
+**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
+**Returns**: callback for the express uri registration
-### Templating API: static zcl helpers~as_underlying_zcl_type_command_argument_not_always_present_with_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:) ⇒
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: A string as an underlying zcl type if the command is not fixed length, the command
-argument is not always present in all zcl specifications and there is a present if conditionality
-on the command argument.
+
-| Param | Description |
-| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
-| type: | type of argument |
-| commandId: | command id |
-| appendString: | append the string to the argument |
-| introducedInRef: | If the command argument is not present in all zcl specifications and was introduced in a certain specification version then this will not be null |
-| removedInRef: | If the command argument is not present in all zcl specifications and was removed in a certain specification version then this will not be null |
-| presentIf: | If the command argument is present conditionally then this will be a condition and not null |
-| options: | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+### REST API: endpoint~httpPostEndpoint(db) ⇒
-
+HTTP POST: endpoint
-### Templating API: static zcl helpers~as_underlying_zcl_type_ca_not_always_present_with_presentif(commandArg, appendString, options) ⇒
+**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: A string as an underlying zcl type if the command is not fixed
-length, the command argument is not always present in all zcl specifications
-but there is a present if conditionality on the command argument.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Description |
-| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
-| commandArg | command argument |
-| appendString | append the string to the argument |
-| options | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+
-
+### REST API: endpoint~httpPatchEndpoint(db) ⇒
-### Templating API: static zcl helpers~if_command_argument_not_always_present_with_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsPresentIfReturn, argumentInAllVersionsReturn) ⇒
+HTTP POST: endpoint
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: argumentNotInAllVersionsReturn if the command is not fixed length, command
-argument is present with conditions introducedInRef or removedInRef and presentIf
-conditions exist as well else returns argumentNotPresentReturn
+**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
+**Returns**: callback for the express uri registration
-| Param |
-| --------------------------------------- |
-| commandId |
-| introducedInRef |
-| removedInRef |
-| presentIf |
-| argumentNotInAllVersionsPresentIfReturn |
-| argumentInAllVersionsReturn |
+| Param | Type | Description |
+| ----- | --------------- | --------------------------------------- |
+| db | \*
| Main database to use for the operation. |
-
+
-### Templating API: static zcl helpers~as_underlying_zcl_type_command_argument_always_present_with_presentif(type:, commandId:, appendString:, introducedInRef:, removedInRef:, presentIf:, options:) ⇒
+### REST API: endpoint~httpPostEndpointType(db) ⇒
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: A string as an underlying zcl type if the command is not fixed length, the command
-argument is always present in all zcl specifications and there is a present if conditionality
-on the command argument.
+HTTP POST endpoint type
-| Param | Description |
-| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
-| type: | type of argument |
-| commandId: | command id |
-| appendString: | append the string to the argument |
-| introducedInRef: | If the command argument is not present in all zcl specifications and was introduced in a certain specification version then this will not be null |
-| removedInRef: | If the command argument is not present in all zcl specifications and was removed in a certain specification version then this will not be null |
-| presentIf: | If the command argument is present conditionally then this will be a condition and not null |
-| options: | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
+**Returns**: callback for the express uri registration
-
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-### Templating API: static zcl helpers~as_underlying_zcl_type_ca_always_present_with_presentif(commandArg, appendString, options) ⇒
+
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: A string as an underlying zcl type if the command is not fixed
-length, the command argument is always present in all zcl specifications
-but there is a present if conditionality on the command argument.
+### REST API: endpoint~httpPatchEndpointType(db) ⇒
-| Param | Description |
-| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
-| commandArg | command argument |
-| appendString | append the string to the argument |
-| options | options which can be passed to zclUtil.asUnderlyingZclTypeWithPackageId for determining the underlying zcl type for the provided argument type |
+HTTP POST: endpoint type update
-
+**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
+**Returns**: callback for the express uri registration
-### Templating API: static zcl helpers~if_command_argument_always_present_with_presentif(commandId, introducedInRef, removedInRef, presentIf, argumentNotInAllVersionsPresentIfReturn, argumentInAllVersionsReturn) ⇒
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: argumentInAllVersionsPresentIfReturn if the command is not fixed length, command
-argument is always present and presentIf conditions exist else returns argumentNotPresentReturn
+
-| Param |
-| --------------------------------------- |
-| commandId |
-| introducedInRef |
-| removedInRef |
-| presentIf |
-| argumentNotInAllVersionsPresentIfReturn |
-| argumentInAllVersionsReturn |
+## External IDE interface.
-
+This module provides the interface to an extenal IDE: Simplicity Studio.
-### Templating API: static zcl helpers~if_manufacturing_specific_cluster(clusterId, manufacturer_specific_return, null_manufacturer_specific_return) ⇒
+
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: manufacturer_specific_return if the cluster is manufacturer
-specific or returns null_manufacturer_specific_return if cluster is
-not manufacturer specific.
+## REST API: generation functions
-| Param | Type |
-| --------------------------------- | --------------- |
-| clusterId | \*
|
-| manufacturer_specific_return | \*
|
-| null_manufacturer_specific_return | \*
|
+This module provides the REST API to the generation.
-
+- [REST API: generation functions](#module*REST API* generation functions)
+ - [~httpGetPreviewNameIndex(db)](#module*REST API* generation functions..httpGetPreviewNameIndex) ⇒
+ - [~httpGetPreviewName(db)](#module*REST API* generation functions..httpGetPreviewName) ⇒
+ - [~httpGetPreview(db)](#module*REST API* generation functions..httpGetPreview) ⇒
+ - [~httpPutGenerate(db)](#module*REST API* generation functions..httpPutGenerate) ⇒
+ - [~httpPostComponentAdd(db)](#module*REST API* generation functions..httpPostComponentAdd)
-### Templating API: static zcl helpers~if_mfg_specific_cluster(clusterId, options) ⇒
+
-If helper which checks if cluster is manufacturing specific or not
-example:
-{{#if_mfg_specific_cluster clusterId}}
-cluster is manufacturing specific
-{{else}}
-cluster is not manufacturing specific
-{{/if_mfg_specific_cluster}}
+### REST API: generation functions~httpGetPreviewNameIndex(db) ⇒
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Returns content in the handlebar template based on whether the
-command is manufacturing specific or not.
+HTTP GET: preview single file with index.
-| Param |
-| --------- |
-| clusterId |
-| options |
+**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
+**Returns**: callback for the express uri registration
-
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-### Templating API: static zcl helpers~as_generated_default_macro(value, attributeSize, options) ⇒
+
-Given the value and size of an attribute along with endian as an option.
-This helper returns the attribute value as big/little endian.
-Example: {{as_generated_default_macro 0x00003840 4 endian="big"}}
-will return: 0x00, 0x00, 0x38, 0x40,
+### REST API: generation functions~httpGetPreviewName(db) ⇒
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Formatted attribute value based on given arguments
-Available options:
+HTTP GET: Preview a single file.
-- endian: Specify 'big' or 'little' endian format
-- isCommaTerminated: '0' or '1' for output to have a ',' at the end
+**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
+**Returns**: callback for the express uri registration
-| Param |
-| ------------- |
-| value |
-| attributeSize |
-| options |
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### Templating API: static zcl helpers~attribute_mask(writable, storageOption, minMax, mfgSpecific, clusterCode, client, isSingleton, prefixString, postfixString) ⇒
+### REST API: generation functions~httpGetPreview(db) ⇒
-Given the attributes of a zcl attribute. Creates an attribute mask based on
-the given options
-Available options:
-isClusterCodeMfgSpecific: 0/1, This is to determine if cluster code needs to
-be used to determine if a cluster is mfg specific or not.
+HTTP GET: total preview object.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: attribute mask based on given values
+**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
+**Returns**: callback for the express uri registration
-| Param |
-| ------------- |
-| writable |
-| storageOption |
-| minMax |
-| mfgSpecific |
-| clusterCode |
-| client |
-| isSingleton |
-| prefixString |
-| postfixString |
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### Templating API: static zcl helpers~command_mask(commmandSource, clusterSide, isIncomingEnabled, isOutgoingEnabled, manufacturingCode, prefixForMask) ⇒
+### REST API: generation functions~httpPutGenerate(db) ⇒
-Given the attributes of a zcl command. Creates a command mask based on
-the given options
+HTTP PUT: performs local generation into a specified directory.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: command mask based on given values
+**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
+**Returns**: callback for the express uri registration
-| Param |
-| ----------------- |
-| commmandSource |
-| clusterSide |
-| isIncomingEnabled |
-| isOutgoingEnabled |
-| manufacturingCode |
-| prefixForMask |
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### Templating API: static zcl helpers~command_mask_sub_helper(commandMask, str) ⇒
+### REST API: generation functions~httpPostComponentAdd(db)
-A Sub helper api for command_mask to reduce code redundancy
+Enable components by 'componentId' or corresponding components specified, via 'defaults', by 'clusterId' / 'roles'
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: command mask addition based on the arguments
+**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
-| Param |
-| ----------- |
-| commandMask |
-| str |
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### Templating API: static zcl helpers~format_zcl_string_as_characters_for_generated_defaults(stringVal, sizeOfString) ⇒
+## REST API: generation functions
-This may be used within all_user_cluster_attributes_for_generated_defaults
-for example:
-{{format_zcl_string_as_characters_for_generated_defaults 'abc' 5}}
-will return as follows:
-3, 'a', 'b', 'c' 0, 0
+This module provides the REST API to the IDE component handling.
-Available Options:
+- [REST API: generation functions](#module*REST API* generation functions)
+ - [~httpGetPreviewNameIndex(db)](#module*REST API* generation functions..httpGetPreviewNameIndex) ⇒
+ - [~httpGetPreviewName(db)](#module*REST API* generation functions..httpGetPreviewName) ⇒
+ - [~httpGetPreview(db)](#module*REST API* generation functions..httpGetPreview) ⇒
+ - [~httpPutGenerate(db)](#module*REST API* generation functions..httpPutGenerate) ⇒
+ - [~httpPostComponentAdd(db)](#module*REST API* generation functions..httpPostComponentAdd)
-- isOctet: 0/1 can be used to return results correctly for octet strings
-- isCommaTerminated: 0/1 can be used to return result with/without ',' at
- the end
+
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Formatted string for generated defaults starting with the lenth of a
-string then each character and then filler for the size allocated for the
-string. Long strings prefixed by 2 byte length field.
+### REST API: generation functions~httpGetPreviewNameIndex(db) ⇒
-| Param |
-| ------------ |
-| stringVal |
-| sizeOfString |
+HTTP GET: preview single file with index.
-
+**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
+**Returns**: callback for the express uri registration
-### Templating API: static zcl helpers~as_type_min_value(type, options) ⇒
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-Given a zcl data type return the min allowed value for that zcl data type
-based on the language specified in the options
+
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: max allowed value for the given zcl data type
-Available Options:
+### REST API: generation functions~httpGetPreviewName(db) ⇒
-- language: determines the output of the helper based on language
- for eg: (as_type_min_value language='c++') will give the output specific to
- the c++ language.
- Note: If language is not specified then helper throws an error.
+HTTP GET: Preview a single file.
-| Param | Type |
-| ------- | --------------- |
-| type | \*
|
-| options | \*
|
+**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
+**Returns**: callback for the express uri registration
-
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-### Templating API: static zcl helpers~as_type_max_value(type, options) ⇒
+
-Given a zcl data type return the max allowed value for that zcl data type
-based on the language specified in the options
+### REST API: generation functions~httpGetPreview(db) ⇒
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: max allowed value for the given zcl data type
-Available Options:
+HTTP GET: total preview object.
-- language: determines the output of the helper based on language
- for eg: (as_type_max_value language='c++') will give the output specific to
- the c++ language.
- Note: If language is not specified then the helper returns size of type in
- bits.
+**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
+**Returns**: callback for the express uri registration
-| Param | Type |
-| ------- | --------------- |
-| type | \*
|
-| options | \*
|
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### Templating API: static zcl helpers~structs_with_clusters(options)
+### REST API: generation functions~httpPutGenerate(db) ⇒
-Returns all structs which have clusters associated with them
+HTTP PUT: performs local generation into a specified directory.
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
+**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
+**Returns**: callback for the express uri registration
-| Param | Type | Description |
-| ------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| options | \*
| Available Options: - groupByStructName: Can group the query results based on struct name for structs which are present in more than one cluster eg Usage: {{#structs_with_clusters groupByStructName=1}}{{/structs_with_clusters}} |
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### Templating API: static zcl helpers~as_zcl_type_size(type, options) ⇒
+### REST API: generation functions~httpPostComponentAdd(db)
-Returns the size of the zcl type if possible else returns -1
+Enable components by 'componentId' or corresponding components specified, via 'defaults', by 'clusterId' / 'roles'
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: size of zcl type
+**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
-| Param | Type |
-| ------- | --------------- |
-| type | \*
|
-| options | \*
|
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### Templating API: static zcl helpers~if_compare(leftValue, rightValue, options) ⇒ Object
+## REST API: initialization functions
-An if helper for comparisons
+This module provides the REST API to the session initialization
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Object
- Promise of content
-example: checking if (4 < 5)
-(if_compare 4 5 operator='<')
-Content when comparison returns true
+- [REST API: initialization functions](#module*REST API* initialization functions)
+ - [~sessionAttempt(db)](#module*REST API* initialization functions..sessionAttempt) ⇒
+ - [~sessionCreate(db)](#module*REST API* initialization functions..sessionCreate) ⇒
+ - [~initializeSession(db, options:)](#module*REST API* initialization functions..initializeSession) ⇒
+ - [~loadPreviousSessions(db)](#module*REST API* initialization functions..loadPreviousSessions) ⇒
+ - [~init(db)](#module*REST API* initialization functions..init) ⇒
-Content when comparison returns false
-(/if_compare)
+
-| Param | Type |
-| ---------- | --------------- |
-| leftValue | \*
|
-| rightValue | \*
|
-| options | \*
|
+### REST API: initialization functions~sessionAttempt(db) ⇒
-
+This function returns Properties, Templates and Dirty-Sessions
-### Templating API: static zcl helpers~if_is_data_type_signed(type, clusterId, options) ⇒
+**Kind**: inner method of [REST API: initialization functions
](#module*REST API* initialization functions)
+**Returns**: An async function that handles HTTP requests
-Check if the given type is signed or not based on the type name and cluster
-id.
+| Param | Type | Description |
+| ----- | --------------- | ------------------------------ |
+| db | \*
| The database connection object |
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: Promise of content
+
-| Param | Type |
-| --------- | --------------- |
-| type | \*
|
-| clusterId | \*
|
-| options | \*
|
+### REST API: initialization functions~sessionCreate(db) ⇒
-
+This function creates a new session.
-### Templating API: static zcl helpers~as_zcl_data_type_size(type, clusterId, options) ⇒
+**Kind**: inner method of [REST API: initialization functions
](#module*REST API* initialization functions)
+**Returns**: An async function that handles HTTP requests. The function extracts session parameters from the request,
+ensures the user and session exist in the database, and populates the session options with the provided packages.
-Fetches the size of the data type based on type name and cluster id given
-Note: size is zero for structs
-Available Options:
+| Param | Type | Description |
+| ----- | --------------- | ------------------------------ |
+| db | \*
| The database connection object |
-- roundUpToPowerOfTwo: Rounds the size up to the nearest power of 2
-- sizeIn: By default size is returned in bytes but it can be returned in bits
- by mentioning sizeIn="bits"
+
-**Kind**: inner method of [Templating API: static zcl helpers
](#module*Templating API* static zcl helpers)
-**Returns**: size of the data type
+### REST API: initialization functions~initializeSession(db, options:) ⇒
-| Param | Type |
-| --------- | --------------- |
-| type | \*
|
-| clusterId | \*
|
-| options | \*
|
+This function creates a new session with its packages according to selected Properties and Templates
-
+**Kind**: inner method of [REST API: initialization functions
](#module*REST API* initialization functions)
+**Returns**: A success message.
-## Templating API: Overridable functions.
+| Param | Type | Description |
+| -------- | --------------- | -------------------------------------- |
+| db | \*
| |
+| options: | \*
| object containing 'zcl' and 'template' |
-This module contains the API for templating. For more detailed instructions, read {@tutorial template-tutorial}
+
-
+### REST API: initialization functions~loadPreviousSessions(db) ⇒
-## JS API: generator logic
+This function reloads previous session by user selected session's id
-- [JS API: generator logic](#module*JS API* generator logic)
- - [~loadGenTemplateFromFile(path)](#module*JS API* generator logic..loadGenTemplateFromFile) ⇒
- - [~recordTemplatesPackage(context)](#module*JS API* generator logic..recordTemplatesPackage) ⇒
- - [~decodePackageExtensionEntity(entityType, entity)](#module*JS API* generator logic..decodePackageExtensionEntity) ⇒
- - [~loadZclExtensions(zclExt)](#module*JS API* generator logic..loadZclExtensions) ⇒
- - [~loadTemplates(db, genTemplatesJsonArray)](#module*JS API* generator logic..loadTemplates)
- - [~loadSingleTemplate(db, genTemplatesJson)](#module*JS API* generator logic..loadSingleTemplate) ⇒
- - [~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly)](#module*JS API* generator logic..generateAllTemplates) ⇒
- - [~generateSingleTemplate(genResult, singleTemplatePkg)](#module*JS API* generator logic..generateSingleTemplate) ⇒
- - [~generate(db, packageId)](#module*JS API* generator logic..generate) ⇒
- - [~writeFileWithBackup(fileName, content, doBackup)](#module*JS API* generator logic..writeFileWithBackup) ⇒
- - [~generateGenerationContent(genResult)](#module*JS API* generator logic..generateGenerationContent)
- - [~generateAndWriteFiles(db, sessionId, packageId, outputDirectory)](#module*JS API* generator logic..generateAndWriteFiles) ⇒
- - [~postProcessGeneratedFiles(outputDirectory, genResult)](#module*JS API* generator logic..postProcessGeneratedFiles) ⇒
- - [~contentIndexer(content)](#module*JS API* generator logic..contentIndexer)
- - [~generateSingleFileForPreview(db, sessionId, fileName)](#module*JS API* generator logic..generateSingleFileForPreview) ⇒
- - [~produceCompiledTemplate(singleTemplatePkg)](#module*JS API* generator logic..produceCompiledTemplate) ⇒
- - [~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:)](#module*JS API* generator logic..produceContent) ⇒
- - [~wrapOverridable(originalFn, overrideFn)](#module*JS API* generator logic..wrapOverridable) ⇒
- - [~loadOverridable(genTemplatePackageId)](#module*JS API* generator logic..loadOverridable)
- - [~loadPartial(path)](#module*JS API* generator logic..loadPartial)
- - [~loadHelper(helpers)](#module*JS API* generator logic..loadHelper)
- - [~allBuiltInHelpers()](#module*JS API* generator logic..allBuiltInHelpers) ⇒
- - [~findHelperPackageByAlias(alias)](#module*JS API* generator logic..findHelperPackageByAlias) ⇒
- - [~initializeBuiltInHelpersForPackage()](#module*JS API* generator logic..initializeBuiltInHelpersForPackage)
- - [~hbInstance()](#module*JS API* generator logic..hbInstance) ⇒
- - [~makeSynchronizablePromise(promise)](#module*JS API* generator logic..makeSynchronizablePromise)
- - [~collectBlocks(resultArray, options, context)](#module*JS API* generator logic..collectBlocks) ⇒
- - [~ensureZclPackageId(context)](#module*JS API* generator logic..ensureZclPackageId) ⇒
- - [~ensureZclPackageIds(context)](#module*JS API* generator logic..ensureZclPackageIds) ⇒
- - [~ensureTemplatePackageId(context)](#module*JS API* generator logic..ensureTemplatePackageId) ⇒
- - [~ensureEndpointTypeIds(context)](#module*JS API* generator logic..ensureEndpointTypeIds) ⇒
- - [~ensureZclClusterSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclClusterSdkExtensions) ⇒
- - [~ensureZclDeviceTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclDeviceTypeSdkExtensions) ⇒
- - [~ensureZclAttributeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeSdkExtensions) ⇒
- - [~ensureZclAttributeTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeTypeSdkExtensions) ⇒
- - [~ensureZclCommandSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclCommandSdkExtensions) ⇒
- - [~ensureZclEventSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclEventSdkExtensions) ⇒
- - [~templatePromise(global, promise)](#module*JS API* generator logic..templatePromise)
- - [~deprecatedHelper(fn, explanation)](#module*JS API* generator logic..deprecatedHelper) ⇒
+**Kind**: inner method of [REST API: initialization functions
](#module*REST API* initialization functions)
+**Returns**: A success message.
-
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-### JS API: generator logic~loadGenTemplateFromFile(path) ⇒
+
-Given a path, it will read generation template object into memory.
+### REST API: initialization functions~init(db) ⇒
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Object that contains: data, crc, templateData
+Init function from the App.vue
+
+**Kind**: inner method of [REST API: initialization functions
](#module*REST API* initialization functions)
+**Returns**: A success message.
| Param | Type |
| ----- | --------------- |
-| path | \*
|
+| db | \*
|
-
+
-### JS API: generator logic~recordTemplatesPackage(context) ⇒
+## REST API: static zcl functions
-Given a loading context, it records the package into the packages table and adds the packageId field into the resolved context.
+This module provides the REST API to the static zcl queries.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the same context passed in, except packageId added to it
+- [REST API: static zcl functions](#module*REST API* static zcl functions)
+ - [~httpGetZclEntity(app)](#module*REST API* static zcl functions..httpGetZclEntity)
+ - [~httpGetZclExtension(db)](#module*REST API* static zcl functions..httpGetZclExtension) ⇒
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+
-
+### REST API: static zcl functions~httpGetZclEntity(app)
-### JS API: generator logic~decodePackageExtensionEntity(entityType, entity) ⇒
+API: /zcl/:entity/:id
-This method takes extension data in JSON, and converts it into
-an object that contains:
-entityCode, entityQualifier, parentCode, manufacturerCode and value
+**Kind**: inner method of [REST API: static zcl functions
](#module*REST API* static zcl functions)
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: object that can be used for database injection
+| Param | Type | Description |
+| ----- | --------------- | ----------------- |
+| app | \*
| Express instance. |
-| Param | Type |
-| ---------- | --------------- |
-| entityType | \*
|
-| entity | \*
|
+
-
+### REST API: static zcl functions~httpGetZclExtension(db) ⇒
-### JS API: generator logic~loadZclExtensions(zclExt) ⇒
+API: /zclExtension/:entity/:extension
-Returns a promise that will load the zcl extensions.
+**Kind**: inner method of [REST API: static zcl functions
](#module*REST API* static zcl functions)
+**Returns**: zcl extension handler
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise of loading the zcl extensions.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| ------ | --------------- |
-| zclExt | \*
|
+
-
+## REST API: user data
-### JS API: generator logic~loadTemplates(db, genTemplatesJsonArray)
+This module provides the REST API to the user specific data.
-Api that loads an array of template JSON files or a single file if
-you just pass in one String.
+- [REST API: user data](#module*REST API* user data)
+ - [~getComponentIdsByCluster(db, sessionId, clusterId, side)](#module*REST API* user data..getComponentIdsByCluster) ⇒ \*
+ - [~httpGetSessionKeyValues(db)](#module*REST API* user data..httpGetSessionKeyValues) ⇒
+ - [~httpGetEndpointIds(db)](#module*REST API* user data..httpGetEndpointIds) ⇒
+ - [~httpGetSessionNotifications(db)](#module*REST API* user data..httpGetSessionNotifications) ⇒
+ - [~httpDeleteSessionNotification(db)](#module*REST API* user data..httpDeleteSessionNotification) ⇒
+ - [~httpGetPackageNotifications(db)](#module*REST API* user data..httpGetPackageNotifications) ⇒
+ - [~httpGetPackageNotificationsByPackageId(db)](#module*REST API* user data..httpGetPackageNotificationsByPackageId) ⇒
+ - [~httpDeletePackageNotification(db)](#module*REST API* user data..httpDeletePackageNotification) ⇒
+ - [~httpGetUnseenNotificationCount(db)](#module*REST API* user data..httpGetUnseenNotificationCount) ⇒
+ - [~httpGetUnseenNotificationAndUpdate(db)](#module*REST API* user data..httpGetUnseenNotificationAndUpdate) ⇒
+ - [~httpPostSaveSessionKeyValue(db)](#module*REST API* user data..httpPostSaveSessionKeyValue) ⇒
+ - [~httpPostCluster(db)](#module*REST API* user data..httpPostCluster) ⇒
+ - [~httpPostForcedExternal(db)](#module*REST API* user data..httpPostForcedExternal) ⇒ function
+ - [~httpPostAttributeUpdate(db)](#module*REST API* user data..httpPostAttributeUpdate) ⇒
+ - [~httpPostCommandUpdate(db)](#module*REST API* user data..httpPostCommandUpdate) ⇒
+ - [~httpPostEventUpdate(db)](#module*REST API* user data..httpPostEventUpdate) ⇒
+ - [~httpGetInitialState(db)](#module*REST API* user data..httpGetInitialState) ⇒
+ - [~httpGetOption(db)](#module*REST API* user data..httpGetOption) ⇒
+ - [~httpGetUiOptions(db)](#module*REST API* user data..httpGetUiOptions) ⇒
+ - [~httpGetPackages()](#module*REST API* user data..httpGetPackages)
+ - [~httpGetAllPackages()](#module*REST API* user data..httpGetAllPackages)
+ - [~httpPostAddNewPackage()](#module*REST API* user data..httpPostAddNewPackage)
+ - [~httpPostShareClusterStatesAcrossEndpoints()](#module*REST API* user data..httpPostShareClusterStatesAcrossEndpoints)
+ - [~httpPostDuplicateEndpoint(db)](#module*REST API* user data..httpPostDuplicateEndpoint) ⇒
+ - [~httpPostDuplicateEndpointType(db)](#module*REST API* user data..httpPostDuplicateEndpointType) ⇒
+ - [~duplicateEndpointTypeClusters(db, oldEndpointTypeId, newEndpointTypeId)](#module*REST API* user data..duplicateEndpointTypeClusters)
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
-| Param | Type |
-| --------------------- | --------------- |
-| db | \*
|
-| genTemplatesJsonArray | \*
|
+### REST API: user data~getComponentIdsByCluster(db, sessionId, clusterId, side) ⇒ \*
-
+Promise that return a list of component Ids required by a specific cluster
-### JS API: generator logic~loadSingleTemplate(db, genTemplatesJson) ⇒
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: \*
- array of componentIds
-Main API async function to load templates from a gen-template.json file.
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| clusterId | \*
|
+| side | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: the loading context, contains: db, path, crc, packageId and templateData, or error
+
-| Param | Type | Description |
-| ---------------- | --------------- | ------------------------------------------------------- |
-| db | \*
| Database |
-| genTemplatesJson | \*
| Path to the JSON file or an array of paths to JSON file |
+### REST API: user data~httpGetSessionKeyValues(db) ⇒
-
+HTTP GET: session key values
-### JS API: generator logic~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly) ⇒
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-Generates all the templates inside a toplevel package.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves with genResult, that contains all the generated templates, keyed by their 'output'
+
-| Param | Type | Description |
-| ------------------ | --------------- | -------------------------------------------------------------------------------------------------- |
-| genResult | \*
| |
-| genTemplateJsonPkg | \*
| Package that points to genTemplate.json file |
-| generateOnly | \*
| if NULL then generate all templates, else only generate template whose out file name matches this. |
+### REST API: user data~httpGetEndpointIds(db) ⇒
-
+HTTP GET: endpoint ids of endpoints within a specified session
-### JS API: generator logic~generateSingleTemplate(genResult, singleTemplatePkg) ⇒
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-Function that generates a single package and adds it to the generation result.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the genResult, with newly generated content added.
+
-| Param | Type | Description |
-| ----------------- | --------------- | ------------------------ |
-| genResult | \*
| |
-| singleTemplatePkg | \*
| Single template package. |
+### REST API: user data~httpGetSessionNotifications(db) ⇒
-
+HTTP GET: session get notifications
-### JS API: generator logic~generate(db, packageId) ⇒
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-Main API async function to generate stuff.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves into a generation result.
+
-| Param | Type | Description |
-| --------- | --------------- | ------------------------------------------------------------------------------------- |
-| db | \*
| Database |
-| packageId | \*
| packageId Template package id. It can be either single template or gen template json. |
+### REST API: user data~httpDeleteSessionNotification(db) ⇒
-
+HTTP DELETE: session delete notifications
-### JS API: generator logic~writeFileWithBackup(fileName, content, doBackup) ⇒
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-Promise to write out a file, optionally creating a backup.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise of a written file.
+
-| Param | Type |
-| -------- | --------------- |
-| fileName | \*
|
-| content | \*
|
-| doBackup | \*
|
+### REST API: user data~httpGetPackageNotifications(db) ⇒
+
+HTTP GET: package get notifications
+
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
+
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
+
+
-
+### REST API: user data~httpGetPackageNotificationsByPackageId(db) ⇒
-### JS API: generator logic~generateGenerationContent(genResult)
+HTTP GET: package get notifications
-Returns a promise that resolves into a content that should be written out to gen result file.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| --------- | --------------- |
-| genResult | \*
|
+
-
+### REST API: user data~httpDeletePackageNotification(db) ⇒
-### JS API: generator logic~generateAndWriteFiles(db, sessionId, packageId, outputDirectory) ⇒
+HTTP DELETE: session delete notifications
-Generate files and write them into the given directory.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: a promise which will resolve when all the files are written.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| --------------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
-| packageId | \*
|
-| outputDirectory | \*
|
+
-
+### REST API: user data~httpGetUnseenNotificationCount(db) ⇒
-### JS API: generator logic~postProcessGeneratedFiles(outputDirectory, genResult) ⇒
+HTTP GET: session get unseen session notification count
-Executes post processing actions as defined by the gen-templates.json
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise of a dealt-with post processing actions
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| --------------- | --------------- |
-| outputDirectory | \*
|
-| genResult | \*
|
+
-
+### REST API: user data~httpGetUnseenNotificationAndUpdate(db) ⇒
-### JS API: generator logic~contentIndexer(content)
+HTTP GET: session update all session notifications to be SEEN
-This async function takes a string, and resolves a preview object out of it.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type | Description |
-| ------- | --------------- | ---------------------------- |
-| content | \*
| String to form into preview. |
+
-
+### REST API: user data~httpPostSaveSessionKeyValue(db) ⇒
-### JS API: generator logic~generateSingleFileForPreview(db, sessionId, fileName) ⇒
+HTTP POST: save session key value
-Generates a single file and feeds it back for preview.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves into a preview object.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
-| fileName | \*
|
+
-
+### REST API: user data~httpPostCluster(db) ⇒
-### JS API: generator logic~produceCompiledTemplate(singleTemplatePkg) ⇒
+HTTP POST: cluster
-Resolves into a precompiled template, either from previous precompile or freshly compiled.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: templates
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-| Param | Type |
-| ----------------- | --------------- |
-| singleTemplatePkg | \*
|
+
-
+### REST API: user data~httpPostForcedExternal(db) ⇒ function
-### JS API: generator logic~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:) ⇒
+Handles a POST request to retrieve forced external storage options.
-Given db connection, session and a single template package, produce the output.
+This function is designed to be used as a middleware in an Express.js route. It extracts the session ID from the request,
+queries the database for package information associated with that session, and then retrieves forced external storage
+options for the identified package. The results are sent back to the client as a JSON response.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves with the 'utf8' string that contains the generated content.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: function
- An asynchronous function that takes Express.js request and response objects.
-| Param | Type | Description |
-| ------------- | --------------- | --------------------------------------------------------------------------------------- |
-| hb | \*
| |
-| metaInfo | \*
| |
-| db | \*
| |
-| sessionId | \*
| |
-| singlePkg | \*
| |
-| overridePath: | \*
| if passed, it provides a path to the override file that can override the overridable.js |
+| Param | Type | Description |
+| ----- | ------------------- | ------------------------------- |
+| db | Object
| The database connection object. |
-
+
-### JS API: generator logic~wrapOverridable(originalFn, overrideFn) ⇒
+### REST API: user data~httpPostAttributeUpdate(db) ⇒
-This function attemps to call override function, but if override function
-throws an exception, it calls the original function.
+HTTP POST attribute update
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: result from override function, unless it throws an exception, in which case return result from original function.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-| Param | Type |
-| ---------- | --------------- |
-| originalFn | \*
|
-| overrideFn | \*
|
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### JS API: generator logic~loadOverridable(genTemplatePackageId)
+### REST API: user data~httpPostCommandUpdate(db) ⇒
-This function is responsible to load the overridable function container.
+HTTP POST: command update
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-| Param | Type |
-| -------------------- | --------------- |
-| genTemplatePackageId | \*
|
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### JS API: generator logic~loadPartial(path)
+### REST API: user data~httpPostEventUpdate(db) ⇒
-Function that loads the partials.
+HTTP POST: command update
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
| Param | Type |
| ----- | --------------- |
-| path | \*
|
+| db | \*
|
-
+
-### JS API: generator logic~loadHelper(helpers)
+### REST API: user data~httpGetInitialState(db) ⇒
-Function that loads the helpers.
+HTTP GET: initial state
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-| Param | Type | Description |
-| ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| helpers | \*
| a string path if value is passed through CLI, the nativeRequire() is leverage the native js function instead of webpack's special sauce. a required() module if invoked by backend js code. this is required to force webpack to resolve the included files as path will be difference after being packed for production. |
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-
+
-### JS API: generator logic~allBuiltInHelpers() ⇒
+### REST API: user data~httpGetOption(db) ⇒
-Returns an object that contains all the helper functions, keyed
-by their name
+HTTP GET: option
-NOTE: This method is ONLY used for API testing. You should not use
-this method for any real work inside the engine or something.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: callback for the express uri registration
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Object containing all the helper functions.
-
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-### JS API: generator logic~findHelperPackageByAlias(alias) ⇒
+
-Given an alias, this method finds a builtin helper package
-by its alias.
+### REST API: user data~httpGetUiOptions(db) ⇒
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Helper package or undefined if none was found.
+HTTP GET: ui_options
+
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: UI options from all packages.
| Param | Type |
| ----- | --------------- |
-| alias | \*
|
-
-
-
-### JS API: generator logic~initializeBuiltInHelpersForPackage()
+| db | \*
|
-Global helper initialization
+
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-
+### REST API: user data~httpGetPackages()
-### JS API: generator logic~hbInstance() ⇒
+HTTP GET: Project packages
-This method returns the correct instance for a given generation flow.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+
-TBD: At this point it doesn't do anything yet, it's just
-a central point to get the correct instance.
+### REST API: user data~httpGetAllPackages()
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Instance of handlebars to be used.
-
+HTTP GET: All Packages
-### JS API: generator logic~makeSynchronizablePromise(promise)
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+
-All promises used by the templates should be synchronizable.
+### REST API: user data~httpPostAddNewPackage()
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+HTTP POST: Add new project package
-| Param | Type |
-| ------- | --------------- |
-| promise | \*
|
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+
-
+### REST API: user data~httpPostShareClusterStatesAcrossEndpoints()
-### JS API: generator logic~collectBlocks(resultArray, options, context) ⇒
+HTTP POST: Unify all Attributes / Command states if a certain cluster is enabled
+on more than one endpoint.
-Helpful function that collects the individual blocks by using elements of an array as a context,
-executing promises for each, and collecting them into the outgoing string.
+1. In Zigbee world, the Attribute / Command configurations is a global singleton entity.
+ If one cluster is enabled by more than 1 endpoint, the attribute states (on/off) should be
+ identical across each endpoint.
+ To emulate the global singleton entity, this function ensures Attribute changes
+ are applied to all endpoint specific attribute fields.
+ When unify event is triggered, this function will align all shared Attribute/Command states
+ to the first matching entry from beginning of the endpoint list.
+2. (native case in ZAP) In Matter, the Attribute configuration are endpoint specific.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves with a content string.
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+
-| Param | Type | Description |
-| ----------- | --------------- | ---------------------------------------- |
-| resultArray | \*
| |
-| options | \*
| Options passed from a block helper. |
-| context | \*
| The context from within this was called. |
+### REST API: user data~httpPostDuplicateEndpoint(db) ⇒
-
+Creating a duplicate for endpoint
-### JS API: generator logic~ensureZclPackageId(context) ⇒
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: newly created endpoint id
-Returns the promise that resolves with the ZCL properties package id.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the package id.
+
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+### REST API: user data~httpPostDuplicateEndpointType(db) ⇒
-
+Creating a duplicate for endpoint-type and endpoint-type-attributes
-### JS API: generator logic~ensureZclPackageIds(context) ⇒
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+**Returns**: newly created endpoint-type id
-Returns the promise that resolves with all ZCL package id specific to current session.
+| Param | Type |
+| ----- | --------------- |
+| db | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with a list of package id.
+
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+### REST API: user data~duplicateEndpointTypeClusters(db, oldEndpointTypeId, newEndpointTypeId)
-
+duplicate all clusters and attributes of an old endpoint type, using oldEndpointType id and newly created endpointType id
-### JS API: generator logic~ensureTemplatePackageId(context) ⇒
+**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-Returns the promise that resolves with the ZCL properties package id.
+| Param | Type |
+| ----------------- | --------------- |
+| db | \*
|
+| oldEndpointTypeId | \*
|
+| newEndpointTypeId | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the package id.
+
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+## JS API: http server
-
+This module provides the HTTP server functionality.
-### JS API: generator logic~ensureEndpointTypeIds(context) ⇒
+- [JS API: http server](#module*JS API* http server)
+ - [~registerRestApi(filename, db, app)](#module*JS API* http server..registerRestApi)
+ - [~initHttpServer(db, port)](#module*JS API* http server..initHttpServer) ⇒
+ - [~shutdownHttpServer()](#module*JS API* http server..shutdownHttpServer) ⇒
+ - [~shutdownHttpServerSync()](#module*JS API* http server..shutdownHttpServerSync) ⇒
+ - [~httpServerPort()](#module*JS API* http server..httpServerPort) ⇒
+ - [~httpServerUrl()](#module*JS API* http server..httpServerUrl) ⇒
+ - [~httpServerStartupMessage()](#module*JS API* http server..httpServerStartupMessage)
-Populate the endpoint type ids into the global context.
+
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: endpoint type ids
+### JS API: http server~registerRestApi(filename, db, app)
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+This function is used to register a rest module, which exports
+get/post/etc. arrays.
-
+**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
-### JS API: generator logic~ensureZclClusterSdkExtensions(context, templatePackageId) ⇒
+| Param | Type |
+| -------- | --------------- |
+| filename | \*
|
+| db | \*
|
+| app | \*
|
-Resolves with cached cluster extensions, but if they don't
-exist, it will populate them.
+
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with cluster extensions.
+### JS API: http server~initHttpServer(db, port) ⇒
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+Promises to initialize the http server on a given port
+using a given database.
-
+**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
+**Returns**: A promise that resolves with an express app.
-### JS API: generator logic~ensureZclDeviceTypeSdkExtensions(context, templatePackageId) ⇒
+| Param | Type | Description |
+| ----- | --------------- | ------------------------- |
+| db | \*
| Database object to use. |
+| port | \*
| Port for the HTTP server. |
-Resolves with cached cluster extensions, but if they don't
-exist, it will populate them.
+
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with cluster extensions.
+### JS API: http server~shutdownHttpServer() ⇒
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+Promises to shut down the http server.
-
+**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
+**Returns**: Promise that resolves when server is shut down.
+
-### JS API: generator logic~ensureZclAttributeSdkExtensions(context, templatePackageId) ⇒
+### JS API: http server~shutdownHttpServerSync() ⇒
-Resolves with cached attribute extensions, but if they don't
-exist, it will populate them.
+Promises to shut down the http server.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with attribute extensions.
+**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
+**Returns**: Promise that resolves when server is shut down.
+
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+### JS API: http server~httpServerPort() ⇒
-
+Port http server is listening on.
-### JS API: generator logic~ensureZclAttributeTypeSdkExtensions(context, templatePackageId) ⇒
+**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
+**Returns**: port
+
-Resolves with cached attribute type extensions, but if they don't
-exist, it will populate them.
+### JS API: http server~httpServerUrl() ⇒
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with attribute type extensions.
+Returns the URL of the server.
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
+**Returns**: the server URL
+
-
+### JS API: http server~httpServerStartupMessage()
-### JS API: generator logic~ensureZclCommandSdkExtensions(context, templatePackageId) ⇒
+Returns the startup message that needs to be printed out.
-Resolves with cached command extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
+
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with command extensions.
+## JS API: websocket server
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+This module provides the HTTP server functionality.
-
+- [JS API: websocket server](#module*JS API* websocket server)
+ - [~initializeWebSocket(httpServer)](#module*JS API* websocket server..initializeWebSocket)
+ - [~clientSocket(sessionUuid)](#module*JS API* websocket server..clientSocket)
+ - [~doSend(socket, object)](#module*JS API* websocket server..doSend)
+ - [~sendWebSocketData(category, payload)](#module*JS API* websocket server..sendWebSocketData)
+ - [~sendWebSocketMessage(msg)](#module*JS API* websocket server..sendWebSocketMessage)
+ - [~onWebSocket(category, listener)](#module*JS API* websocket server..onWebSocket)
-### JS API: generator logic~ensureZclEventSdkExtensions(context, templatePackageId) ⇒
+
-Resolves with cached command extensions, but if they don't
-exist, it will populate them.
+### JS API: websocket server~initializeWebSocket(httpServer)
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with command extensions.
+Initialize a websocket, and register listeners to the
+websocket connection and the message receipt.
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
-
+| Param | Type |
+| ---------- | --------------- |
+| httpServer | \*
|
-### JS API: generator logic~templatePromise(global, promise)
+
-Every helper that returns a promise, should
-not return the promise directly. So instead of
-returning the promise directly, it should return:
-return templatePromise(this.global, promise)
+### JS API: websocket server~clientSocket(sessionUuid)
-This will ensure that after tag works as expected.
+Method that returns the websocket for a given session key.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
-| Param | Type |
-| ------- | --------------- |
-| global | \*
|
-| promise | \*
|
+| Param | Type |
+| ----------- | --------------- |
+| sessionUuid | \*
|
-
+
-### JS API: generator logic~deprecatedHelper(fn, explanation) ⇒
+### JS API: websocket server~doSend(socket, object)
-Function wrapper that can be used when a helper is deprecated.
+Bottom-most function that sends an object over a socket.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: a function that wraps the original function, with deprecation message.
+**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
-| Param | Type | Description |
-| ----------- | --------------- | ----------------------------------------------------------------------- |
-| fn | \*
| |
-| explanation | \*
| can contain `text`, or `from`/`to`, or just be a string message itself. |
+| Param | Type |
+| ------ | --------------- |
+| socket | \*
|
+| object | \*
|
-
+
-## JS API: generator logic
+### JS API: websocket server~sendWebSocketData(category, payload)
-- [JS API: generator logic](#module*JS API* generator logic)
- - [~loadGenTemplateFromFile(path)](#module*JS API* generator logic..loadGenTemplateFromFile) ⇒
- - [~recordTemplatesPackage(context)](#module*JS API* generator logic..recordTemplatesPackage) ⇒
- - [~decodePackageExtensionEntity(entityType, entity)](#module*JS API* generator logic..decodePackageExtensionEntity) ⇒
- - [~loadZclExtensions(zclExt)](#module*JS API* generator logic..loadZclExtensions) ⇒
- - [~loadTemplates(db, genTemplatesJsonArray)](#module*JS API* generator logic..loadTemplates)
- - [~loadSingleTemplate(db, genTemplatesJson)](#module*JS API* generator logic..loadSingleTemplate) ⇒
- - [~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly)](#module*JS API* generator logic..generateAllTemplates) ⇒
- - [~generateSingleTemplate(genResult, singleTemplatePkg)](#module*JS API* generator logic..generateSingleTemplate) ⇒
- - [~generate(db, packageId)](#module*JS API* generator logic..generate) ⇒
- - [~writeFileWithBackup(fileName, content, doBackup)](#module*JS API* generator logic..writeFileWithBackup) ⇒
- - [~generateGenerationContent(genResult)](#module*JS API* generator logic..generateGenerationContent)
- - [~generateAndWriteFiles(db, sessionId, packageId, outputDirectory)](#module*JS API* generator logic..generateAndWriteFiles) ⇒
- - [~postProcessGeneratedFiles(outputDirectory, genResult)](#module*JS API* generator logic..postProcessGeneratedFiles) ⇒
- - [~contentIndexer(content)](#module*JS API* generator logic..contentIndexer)
- - [~generateSingleFileForPreview(db, sessionId, fileName)](#module*JS API* generator logic..generateSingleFileForPreview) ⇒
- - [~produceCompiledTemplate(singleTemplatePkg)](#module*JS API* generator logic..produceCompiledTemplate) ⇒
- - [~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:)](#module*JS API* generator logic..produceContent) ⇒
- - [~wrapOverridable(originalFn, overrideFn)](#module*JS API* generator logic..wrapOverridable) ⇒
- - [~loadOverridable(genTemplatePackageId)](#module*JS API* generator logic..loadOverridable)
- - [~loadPartial(path)](#module*JS API* generator logic..loadPartial)
- - [~loadHelper(helpers)](#module*JS API* generator logic..loadHelper)
- - [~allBuiltInHelpers()](#module*JS API* generator logic..allBuiltInHelpers) ⇒
- - [~findHelperPackageByAlias(alias)](#module*JS API* generator logic..findHelperPackageByAlias) ⇒
- - [~initializeBuiltInHelpersForPackage()](#module*JS API* generator logic..initializeBuiltInHelpersForPackage)
- - [~hbInstance()](#module*JS API* generator logic..hbInstance) ⇒
- - [~makeSynchronizablePromise(promise)](#module*JS API* generator logic..makeSynchronizablePromise)
- - [~collectBlocks(resultArray, options, context)](#module*JS API* generator logic..collectBlocks) ⇒
- - [~ensureZclPackageId(context)](#module*JS API* generator logic..ensureZclPackageId) ⇒
- - [~ensureZclPackageIds(context)](#module*JS API* generator logic..ensureZclPackageIds) ⇒
- - [~ensureTemplatePackageId(context)](#module*JS API* generator logic..ensureTemplatePackageId) ⇒
- - [~ensureEndpointTypeIds(context)](#module*JS API* generator logic..ensureEndpointTypeIds) ⇒
- - [~ensureZclClusterSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclClusterSdkExtensions) ⇒
- - [~ensureZclDeviceTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclDeviceTypeSdkExtensions) ⇒
- - [~ensureZclAttributeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeSdkExtensions) ⇒
- - [~ensureZclAttributeTypeSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclAttributeTypeSdkExtensions) ⇒
- - [~ensureZclCommandSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclCommandSdkExtensions) ⇒
- - [~ensureZclEventSdkExtensions(context, templatePackageId)](#module*JS API* generator logic..ensureZclEventSdkExtensions) ⇒
- - [~templatePromise(global, promise)](#module*JS API* generator logic..templatePromise)
- - [~deprecatedHelper(fn, explanation)](#module*JS API* generator logic..deprecatedHelper) ⇒
+Send websocket payload with a given category.
+
+**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
-
+| Param | Type |
+| -------- | --------------- |
+| category | \*
|
+| payload | \*
|
-### JS API: generator logic~loadGenTemplateFromFile(path) ⇒
+
-Given a path, it will read generation template object into memory.
+### JS API: websocket server~sendWebSocketMessage(msg)
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Object that contains: data, crc, templateData
+This can be used to send unstructured websocket message.
+On the receiving end, the event will contain category
+'generic'.
+
+**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
| Param | Type |
| ----- | --------------- |
-| path | \*
|
+| msg | \*
|
-
+
-### JS API: generator logic~recordTemplatesPackage(context) ⇒
+### JS API: websocket server~onWebSocket(category, listener)
-Given a loading context, it records the package into the packages table and adds the packageId field into the resolved context.
+If you wish to register to a specific category of websocket
+messages, you can use this function. Listener will be executed with
+a given socket and data object.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the same context passed in, except packageId added to it
+**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+| Param | Type | Description |
+| -------- | --------------- | ------------------------------------ |
+| category | \*
| category of message. |
+| listener | \*
| function that receives socket, data. |
-
+
-### JS API: generator logic~decodePackageExtensionEntity(entityType, entity) ⇒
+## JS API: renderer API related utilities
-This method takes extension data in JSON, and converts it into
-an object that contains:
-entityCode, entityQualifier, parentCode, manufacturerCode and value
+- [JS API: renderer API related utilities](#module*JS API* renderer API related utilities)
+ - [~getSessionUuidFromBrowserWindow(browserWindow)](#module*JS API* renderer API related utilities..getSessionUuidFromBrowserWindow) ⇒
+ - [~getRendererApiInformation(browserWindow)](#module*JS API* renderer API related utilities..getRendererApiInformation) ⇒
+ - [~execRendererApi(browserWindow, rendererApiCommand, ...theArgs)](#module*JS API* renderer API related utilities..execRendererApi)
+ - [~execFileOpen(browserWindow, filePath)](#module*JS API* renderer API related utilities..execFileOpen) ⇒
+ - [~processRendererNotify(message)](#module*JS API* renderer API related utilities..processRendererNotify) ⇒
+ - [~reportFiles(browserWindow, result)](#module*JS API* renderer API related utilities..reportFiles)
+ - [~getUserKeyFromCookieValue(cookieValue)](#module*JS API* renderer API related utilities..getUserKeyFromCookieValue) ⇒
+ - [~getUserKeyFromBrowserCookie(browserCookie)](#module*JS API* renderer API related utilities..getUserKeyFromBrowserCookie)
+ - [~getUserKeyFromBrowserWindow(browserWindow)](#module*JS API* renderer API related utilities..getUserKeyFromBrowserWindow)
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: object that can be used for database injection
+
-| Param | Type |
-| ---------- | --------------- |
-| entityType | \*
|
-| entity | \*
|
+### JS API: renderer API related utilities~getSessionUuidFromBrowserWindow(browserWindow) ⇒
-
+This method returns the global session UUID from the browser window that is set by the front-end.
-### JS API: generator logic~loadZclExtensions(zclExt) ⇒
+**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
+**Returns**: session UUID
-Returns a promise that will load the zcl extensions.
+| Param | Type |
+| ------------- | --------------- |
+| browserWindow | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise of loading the zcl extensions.
+
-| Param | Type |
-| ------ | --------------- |
-| zclExt | \*
|
+### JS API: renderer API related utilities~getRendererApiInformation(browserWindow) ⇒
-
+Returns descriptive text about renderer api.
-### JS API: generator logic~loadTemplates(db, genTemplatesJsonArray)
+**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
+**Returns**: description of renderer api
-Api that loads an array of template JSON files or a single file if
-you just pass in one String.
+| Param | Type |
+| ------------- | --------------- |
+| browserWindow | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
-| Param | Type |
-| --------------------- | --------------- |
-| db | \*
|
-| genTemplatesJsonArray | \*
|
+### JS API: renderer API related utilities~execRendererApi(browserWindow, rendererApiCommand, ...theArgs)
-
+Execute RendererApi commands
-### JS API: generator logic~loadSingleTemplate(db, genTemplatesJson) ⇒
+**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
-Main API async function to load templates from a gen-template.json file.
+| Param | Type |
+| ------------------ | ---------------- |
+| browserWindow | \*
|
+| rendererApiCommand | \*
|
+| ...theArgs | any
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: the loading context, contains: db, path, crc, packageId and templateData, or error
+
-| Param | Type | Description |
-| ---------------- | --------------- | ------------------------------------------------------- |
-| db | \*
| Database |
-| genTemplatesJson | \*
| Path to the JSON file or an array of paths to JSON file |
+### JS API: renderer API related utilities~execFileOpen(browserWindow, filePath) ⇒
-
+Executes the file open renderer API action.
-### JS API: generator logic~generateAllTemplates(genResult, genTemplateJsonPkg, generateOnly) ⇒
+**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
+**Returns**: Result of file open call.
-Generates all the templates inside a toplevel package.
+| Param | Type |
+| ------------- | --------------- |
+| browserWindow | \*
|
+| filePath | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves with genResult, that contains all the generated templates, keyed by their 'output'
+
-| Param | Type | Description |
-| ------------------ | --------------- | -------------------------------------------------------------------------------------------------- |
-| genResult | \*
| |
-| genTemplateJsonPkg | \*
| Package that points to genTemplate.json file |
-| generateOnly | \*
| if NULL then generate all templates, else only generate template whose out file name matches this. |
+### JS API: renderer API related utilities~processRendererNotify(message) ⇒
-
+This method takes a message and checks if it's a renderer API
+notification call. If it is, it processe it and returns true.
+If it's not it returns false.
-### JS API: generator logic~generateSingleTemplate(genResult, singleTemplatePkg) ⇒
+**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
+**Returns**: true if message was a notify message and was consumed.
-Function that generates a single package and adds it to the generation result.
+| Param | Type |
+| ------- | --------------- |
+| message | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the genResult, with newly generated content added.
+
-| Param | Type | Description |
-| ----------------- | --------------- | ------------------------ |
-| genResult | \*
| |
-| singleTemplatePkg | \*
| Single template package. |
+### JS API: renderer API related utilities~reportFiles(browserWindow, result)
-
+This method calls the reportFiles renderer API call.
-### JS API: generator logic~generate(db, packageId) ⇒
+**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
-Main API async function to generate stuff.
+| Param | Type |
+| ------------- | --------------- |
+| browserWindow | \*
|
+| result | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves into a generation result.
+
-| Param | Type | Description |
-| --------- | --------------- | ------------------------------------------------------------------------------------- |
-| db | \*
| Database |
-| packageId | \*
| packageId Template package id. It can be either single template or gen template json. |
+### JS API: renderer API related utilities~getUserKeyFromCookieValue(cookieValue) ⇒
-
+Returns cookie for user identification.
-### JS API: generator logic~writeFileWithBackup(fileName, content, doBackup) ⇒
+**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
+**Returns**: cookie value used for user identification
-Promise to write out a file, optionally creating a backup.
+| Param | Type |
+| ----------- | --------------- |
+| cookieValue | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise of a written file.
+
-| Param | Type |
-| -------- | --------------- |
-| fileName | \*
|
-| content | \*
|
-| doBackup | \*
|
+### JS API: renderer API related utilities~getUserKeyFromBrowserCookie(browserCookie)
-
+Returns the session key
-### JS API: generator logic~generateGenerationContent(genResult)
+**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
-Returns a promise that resolves into a content that should be written out to gen result file.
+| Param | Type | Description |
+| ------------- | --------------- | ----------- |
+| browserCookie | \*
| object |
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
-| Param | Type |
-| --------- | --------------- |
-| genResult | \*
|
+### JS API: renderer API related utilities~getUserKeyFromBrowserWindow(browserWindow)
-
+Returns a promise that resolves into the session key.
-### JS API: generator logic~generateAndWriteFiles(db, sessionId, packageId, outputDirectory) ⇒
+**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
-Generate files and write them into the given directory.
+| Param | Type |
+| ------------- | --------------- |
+| browserWindow | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: a promise which will resolve when all the files are written.
+
-| Param | Type |
-| --------------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
-| packageId | \*
|
-| outputDirectory | \*
|
+## JS API: async reporting
-
+This module provides the mechanism for dealing with the async reporting
+from backend to the UI.
-### JS API: generator logic~postProcessGeneratedFiles(outputDirectory, genResult) ⇒
+This mechanism takes care of:
-Executes post processing actions as defined by the gen-templates.json
+- dirty flag
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise of a dealt-with post processing actions
+* [JS API: async reporting](#module*JS API* async reporting)
+ - [~sendDirtyFlagStatus(db, session)](#module*JS API* async reporting..sendDirtyFlagStatus)
+ - [~sendNotificationUpdate(db, session)](#module*JS API* async reporting..sendNotificationUpdate)
+ - [~startAsyncReporting(db, intervalMs)](#module*JS API* async reporting..startAsyncReporting)
+ - [~stopAsyncReporting()](#module*JS API* async reporting..stopAsyncReporting)
-| Param | Type |
-| --------------- | --------------- |
-| outputDirectory | \*
|
-| genResult | \*
|
+
-
+### JS API: async reporting~sendDirtyFlagStatus(db, session)
-### JS API: generator logic~contentIndexer(content)
+Sends a dirty flag status for a single session.
-This async function takes a string, and resolves a preview object out of it.
+**Kind**: inner method of [JS API: async reporting
](#module*JS API* async reporting)
+
+| Param | Type |
+| ------- | --------------- |
+| db | \*
|
+| session | \*
|
+
+
+
+### JS API: async reporting~sendNotificationUpdate(db, session)
+
+Sends a dirty flag status for a single session.
+
+**Kind**: inner method of [JS API: async reporting
](#module*JS API* async reporting)
+
+| Param | Type |
+| ------- | --------------- |
+| db | \*
|
+| session | \*
|
+
+
+
+### JS API: async reporting~startAsyncReporting(db, intervalMs)
+
+Start the interval that will check and report dirty flags.
+
+**Kind**: inner method of [JS API: async reporting
](#module*JS API* async reporting)
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| intervalMs | \*
|
-| Param | Type | Description |
-| ------- | --------------- | ---------------------------- |
-| content | \*
| String to form into preview. |
+
-
+### JS API: async reporting~stopAsyncReporting()
-### JS API: generator logic~generateSingleFileForPreview(db, sessionId, fileName) ⇒
+Stop the interval that will check and report dirty flags
-Generates a single file and feeds it back for preview.
+**Kind**: inner method of [JS API: async reporting
](#module*JS API* async reporting)
+
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves into a preview object.
+## JS API: post-import.
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
-| fileName | \*
|
+This module contains the API functions for the post-load
+scripting functionality.
-
+
-### JS API: generator logic~produceCompiledTemplate(singleTemplatePkg) ⇒
+## JS API: SDK utilities
-Resolves into a precompiled template, either from previous precompile or freshly compiled.
+
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: templates
+### JS API: SDK utilities~readSdkJson(sdkPath, logger)
-| Param | Type |
-| ----------------- | --------------- |
-| singleTemplatePkg | \*
|
+This function reads in the sdk.json that is passed as sdkPath,
+and resolve the promise with the sdk object.
+logger is used for printouts.
-
+**Kind**: inner method of [JS API: SDK utilities
](#module*JS API* SDK utilities)
-### JS API: generator logic~produceContent(hb, metaInfo, db, sessionId, singlePkg, overridePath:) ⇒
+| Param | Type |
+| ------- | --------------- |
+| sdkPath | \*
|
+| logger | \*
|
-Given db connection, session and a single template package, produce the output.
+
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves with the 'utf8' string that contains the generated content.
+## JS API: string utilities
-| Param | Type | Description |
-| ------------- | --------------- | --------------------------------------------------------------------------------------- |
-| hb | \*
| |
-| metaInfo | \*
| |
-| db | \*
| |
-| sessionId | \*
| |
-| singlePkg | \*
| |
-| overridePath: | \*
| if passed, it provides a path to the override file that can override the overridable.js |
+- [JS API: string utilities](#module*JS API* string utilities)
+ - [~toCamelCase(str)](#module*JS API* string utilities..toCamelCase) ⇒
+ - [~toSnakeCaseAllCaps(label)](#module*JS API* string utilities..toSnakeCaseAllCaps)
+ - [~toCleanSymbol(label)](#module*JS API* string utilities..toCleanSymbol)
+ - [~toCleanSymbolAsKebabCase(label)](#module*JS API* string utilities..toCleanSymbolAsKebabCase)
+ - [~toCleanMacro(label)](#module*JS API* string utilities..toCleanMacro) ⇒
+ - [~isDigit(ch)](#module*JS API* string utilities..isDigit)
-
+
-### JS API: generator logic~wrapOverridable(originalFn, overrideFn) ⇒
+### JS API: string utilities~toCamelCase(str) ⇒
-This function attemps to call override function, but if override function
-throws an exception, it calls the original function.
+Given a string convert it into a camelCased string
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: result from override function, unless it throws an exception, in which case return result from original function.
+**Kind**: inner method of [JS API: string utilities
](#module*JS API* string utilities)
+**Returns**: a spaced out string in lowercase
+**Parem**: \*
firstLower if True the it starts with lowecase.
-| Param | Type |
-| ---------- | --------------- |
-| originalFn | \*
|
-| overrideFn | \*
|
+| Param | Type |
+| ----- | --------------- |
+| str | \*
|
-
+
-### JS API: generator logic~loadOverridable(genTemplatePackageId)
+### JS API: string utilities~toSnakeCaseAllCaps(label)
-This function is responsible to load the overridable function container.
+Takes a label, and delimits is on camelcasing.
+For example:
+VerySimpleLabel will turn into VERY_SIMPLE_LABEL
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [JS API: string utilities
](#module*JS API* string utilities)
-| Param | Type |
-| -------------------- | --------------- |
-| genTemplatePackageId | \*
|
+| Param | Type |
+| ----- | --------------- |
+| label | \*
|
-
+
-### JS API: generator logic~loadPartial(path)
+### JS API: string utilities~toCleanSymbol(label)
-Function that loads the partials.
+returns a string after converting ':' and '-' into '\_'
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [JS API: string utilities
](#module*JS API* string utilities)
| Param | Type |
| ----- | --------------- |
-| path | \*
|
+| label | \*
|
-
+
-### JS API: generator logic~loadHelper(helpers)
+### JS API: string utilities~toCleanSymbolAsKebabCase(label)
-Function that loads the helpers.
+returns a string after converting ':' and '\_' into '-'
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+**Kind**: inner method of [JS API: string utilities
](#module*JS API* string utilities)
-| Param | Type | Description |
-| ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| helpers | \*
| a string path if value is passed through CLI, the nativeRequire() is leverage the native js function instead of webpack's special sauce. a required() module if invoked by backend js code. this is required to force webpack to resolve the included files as path will be difference after being packed for production. |
+| Param | Type |
+| ----- | --------------- |
+| label | \*
|
-
+
-### JS API: generator logic~allBuiltInHelpers() ⇒
+### JS API: string utilities~toCleanMacro(label) ⇒
-Returns an object that contains all the helper functions, keyed
-by their name
+Formats label as a C macro. This method performs a very simply substition
+of illegal characters, such as ' ', ':' and such into a '\_' character.
-NOTE: This method is ONLY used for API testing. You should not use
-this method for any real work inside the engine or something.
+**Kind**: inner method of [JS API: string utilities
](#module*JS API* string utilities)
+**Returns**: Label formatted as C macro.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Object containing all the helper functions.
-
+| Param | Type |
+| ----- | --------------- |
+| label | \*
|
-### JS API: generator logic~findHelperPackageByAlias(alias) ⇒
+
-Given an alias, this method finds a builtin helper package
-by its alias.
+### JS API: string utilities~isDigit(ch)
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Helper package or undefined if none was found.
+Returns true if given character is a digit.
+
+**Kind**: inner method of [JS API: string utilities
](#module*JS API* string utilities)
| Param | Type |
| ----- | --------------- |
-| alias | \*
|
+| ch | \*
|
-
+
-### JS API: generator logic~initializeBuiltInHelpersForPackage()
+## JS API: type related utilities
-Global helper initialization
+- [JS API: type related utilities](#module*JS API* type related utilities)
+ - [~typeSize(db, zclPackageId, type)](#module*JS API* type related utilities..typeSize)
+ - [~typeSizeAttribute(db, zclPackageIds, at, [defaultValue])](#module*JS API* type related utilities..typeSizeAttribute) ⇒
+ - [~convertFloatToBigEndian(value, size)](#module*JS API* type related utilities..convertFloatToBigEndian) ⇒
+ - [~convertIntToBigEndian(value, size)](#module*JS API* type related utilities..convertIntToBigEndian) ⇒
+ - [~longTypeDefaultValue(size, type, value)](#module*JS API* type related utilities..longTypeDefaultValue) ⇒
+ - [~convertToCliType(str)](#module*JS API* type related utilities..convertToCliType) ⇒
+ - [~isString(type)](#module*JS API* type related utilities..isString) ⇒
+ - [~isFloat(type)](#module*JS API* type related utilities..isFloat) ⇒
+ - [~isSignedInteger(db, sessionId, type)](#module*JS API* type related utilities..isSignedInteger) ⇒ Promise.<boolean>
+ - [~isOneBytePrefixedString(type)](#module*JS API* type related utilities..isOneBytePrefixedString) ⇒
+ - [~isTwoBytePrefixedString(type)](#module*JS API* type related utilities..isTwoBytePrefixedString) ⇒
+ - [~nullStringDefaultValue(type)](#module*JS API* type related utilities..nullStringDefaultValue) ⇒ string
+ - [~getSignAndSizeOfZclType(type, context, options)](#module*JS API* type related utilities..getSignAndSizeOfZclType) ⇒
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-
+
-### JS API: generator logic~hbInstance() ⇒
+### JS API: type related utilities~typeSize(db, zclPackageId, type)
-This method returns the correct instance for a given generation flow.
+This function resolves with the size of a given type.
+-1 means that this size is variable.
-TBD: At this point it doesn't do anything yet, it's just
-a central point to get the correct instance.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Instance of handlebars to be used.
-
+| Param | Type |
+| ------------ | --------------- |
+| db | \*
|
+| zclPackageId | \*
|
+| type | \*
|
-### JS API: generator logic~makeSynchronizablePromise(promise)
+
-All promises used by the templates should be synchronizable.
+### JS API: type related utilities~typeSizeAttribute(db, zclPackageIds, at, [defaultValue]) ⇒
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+Returns the size of a real attribute, taking type size and defaults
+into consideration, so that strings are properly sized.
-| Param | Type |
-| ------- | --------------- |
-| promise | \*
|
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: Promise that resolves into the size of the attribute.
-
+| Param | Type | Default |
+| -------------- | --------------- | ------------- |
+| db | \*
| |
+| zclPackageIds | \*
| |
+| at | \*
| |
+| [defaultValue] | \*
|
|
-### JS API: generator logic~collectBlocks(resultArray, options, context) ⇒
+
-Helpful function that collects the individual blocks by using elements of an array as a context,
-executing promises for each, and collecting them into the outgoing string.
+### JS API: type related utilities~convertFloatToBigEndian(value, size) ⇒
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: Promise that resolves with a content string.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: The big endian value for a given float value padded with
+the given size. The value is returned in hex format and prefixed with '0x'.
-| Param | Type | Description |
-| ----------- | --------------- | ---------------------------------------- |
-| resultArray | \*
| |
-| options | \*
| Options passed from a block helper. |
-| context | \*
| The context from within this was called. |
+| Param | Type |
+| ----- | --------------- |
+| value | \*
|
+| size | \*
|
-
+
-### JS API: generator logic~ensureZclPackageId(context) ⇒
+### JS API: type related utilities~convertIntToBigEndian(value, size) ⇒
-Returns the promise that resolves with the ZCL properties package id.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: The big endian value for a given integer value padded with
+the given size. The value is returned in hex format and prefixed with '0x'.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the package id.
+| Param | Type |
+| ----- | --------------- |
+| value | \*
|
+| size | \*
|
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+
-
+### JS API: type related utilities~longTypeDefaultValue(size, type, value) ⇒
-### JS API: generator logic~ensureZclPackageIds(context) ⇒
+If the type is more than 2 bytes long, then this method creates
+the default byte array.
-Returns the promise that resolves with all ZCL package id specific to current session.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: string which is a C-formatted byte array.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with a list of package id.
+| Param | Type | Description |
+| ----- | --------------- | ------------------------ |
+| size | \*
| Size of bytes generated. |
+| type | \*
| Type of the object. |
+| value | \*
| Default value. |
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+
-
+### JS API: type related utilities~convertToCliType(str) ⇒
-### JS API: generator logic~ensureTemplatePackageId(context) ⇒
+Conversion to a CLI type. THis is here temporarily until we come up
+with a proper type engine.
-Returns the promise that resolves with the ZCL properties package id.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: converted type
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with the package id.
+| Param | Type |
+| ----- | --------------- |
+| str | \*
|
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+
-
+### JS API: type related utilities~isString(type) ⇒
-### JS API: generator logic~ensureEndpointTypeIds(context) ⇒
+Returns true if a given ZCL type is a string type.
-Populate the endpoint type ids into the global context.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: true if type is string, false otherwise
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: endpoint type ids
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
-| Param | Type |
-| ------- | --------------- |
-| context | \*
|
+
-
+### JS API: type related utilities~isFloat(type) ⇒
-### JS API: generator logic~ensureZclClusterSdkExtensions(context, templatePackageId) ⇒
+Returns true if a given ZCL type is a float type.
-Resolves with cached cluster extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: true if type is float, false otherwise
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with cluster extensions.
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+
-
+### JS API: type related utilities~isSignedInteger(db, sessionId, type) ⇒ Promise.<boolean>
-### JS API: generator logic~ensureZclDeviceTypeSdkExtensions(context, templatePackageId) ⇒
+Checks if a given ZCL type is a signed integer.
-Resolves with cached cluster extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: Promise.<boolean>
- - A promise that resolves to true if the type is a signed integer, false otherwise.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with cluster extensions.
+| Param | Type | Description |
+| --------- | ------------------- | ------------------------------- |
+| db | object
| The database connection object. |
+| sessionId | string
| The session ID. |
+| type | string
| The name of the ZCL type. |
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+
-
+### JS API: type related utilities~isOneBytePrefixedString(type) ⇒
-### JS API: generator logic~ensureZclAttributeSdkExtensions(context, templatePackageId) ⇒
+Checks if type is a one-byte lengh string.
-Resolves with cached attribute extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: true if the said type is a string prefixed by one byte length
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with attribute extensions.
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+
-
+### JS API: type related utilities~isTwoBytePrefixedString(type) ⇒
-### JS API: generator logic~ensureZclAttributeTypeSdkExtensions(context, templatePackageId) ⇒
+Checks if type is a two-byte lengh string.
-Resolves with cached attribute type extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: true if the said type is a string prefixed by two byte length
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with attribute type extensions.
+| Param | Type |
+| ----- | --------------- |
+| type | \*
|
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+
-
+### JS API: type related utilities~nullStringDefaultValue(type) ⇒ string
-### JS API: generator logic~ensureZclCommandSdkExtensions(context, templatePackageId) ⇒
+Generates a default value for a null string based on its type.
+This function is designed to abstract away the specific null representation
+of strings from the longTypeDefaultValue function, ensuring that the latter
+does not need to be aware of these details.
-Resolves with cached command extensions, but if they don't
-exist, it will populate them.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: string
- The default value for a null string of the specified type.
+**Throws**:
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with command extensions.
+- Error
Throws an error if the string type is unknown.
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+| Param | Type | Description |
+| ----- | ------------------- | ----------------------------------------------------------------- |
+| type | string
| The type of the string, which determines its null representation. |
-
+
-### JS API: generator logic~ensureZclEventSdkExtensions(context, templatePackageId) ⇒
+### JS API: type related utilities~getSignAndSizeOfZclType(type, context, options) ⇒
-Resolves with cached command extensions, but if they don't
-exist, it will populate them.
+Given a zcl device type returns its sign, size and zcl data type info stored
+in the database table.
+Note: Enums and Bitmaps are considered to be unsigned.
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: promise that resolves with command extensions.
+**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+**Returns**: returns sign, size and info of zcl device type
+Available Options:
-| Param | Type |
-| ----------------- | --------------- |
-| context | \*
|
-| templatePackageId | \*
|
+- size: Determine whether to calculate the size of zcl device type in bits
+ or bytes
+ for eg: getSignAndSizeOfZclType('int8u' this size='bits') will return
+ the size in bits which will be 8. If not mentioned then it will return the size
+ in bytes i.e. 1 in this case.
-
+| Param | Type |
+| ------- | --------------- |
+| type | \*
|
+| context | \*
|
+| options | \*
|
-### JS API: generator logic~templatePromise(global, promise)
+
-Every helper that returns a promise, should
-not return the promise directly. So instead of
-returning the promise directly, it should return:
-return templatePromise(this.global, promise)
+## JS API: random utilities
-This will ensure that after tag works as expected.
+- [JS API: random utilities](#module*JS API* random utilities)
+ - [~checksum(data)](#module*JS API* random utilities..checksum) ⇒
+ - [~ensurePackagesAndPopulateSessionOptions(db, sessionId, options:, selectedZclPropertyPackage, selectedGenTemplatePackages)](#module*JS API* random utilities..ensurePackagesAndPopulateSessionOptions) ⇒
+ - [~createBackupFile(filePath)](#module*JS API* random utilities..createBackupFile)
+ - [~matchFeatureLevel(featureLevel)](#module*JS API* random utilities..matchFeatureLevel)
+ - [~sessionReport(db, sessionId)](#module*JS API* random utilities..sessionReport) ⇒
+ - [~sessionDump(db, sessionId)](#module*JS API* random utilities..sessionDump) ⇒
+ - [~executePromisesSequentially(arrayOfData, promiseCreator)](#module*JS API* random utilities..executePromisesSequentially)
+ - [~createAbsolutePath(relativePath, relativity, zapFilePath)](#module*JS API* random utilities..createAbsolutePath)
+ - [~locateRelativeFilePath(rootFileLocations, relativeFilePath)](#module*JS API* random utilities..locateRelativeFilePath) ⇒
+ - [~executeExternalProgram(cmd)](#module*JS API* random utilities..executeExternalProgram)
+ - [~getClusterExtensionDefault(extensions, extensionId, clusterCode)](#module*JS API* random utilities..getClusterExtensionDefault) ⇒
+ - [~getClusterExtension(extensions, property, clusterCode)](#module*JS API* random utilities..getClusterExtension) ⇒
+ - [~createUuid()](#module*JS API* random utilities..createUuid)
+ - [~waitFor(time)](#module*JS API* random utilities..waitFor)
+ - [~parseXml(fileContent)](#module*JS API* random utilities..parseXml) ⇒
+ - [~readFileContentAndCrc(metadata)](#module*JS API* random utilities..readFileContentAndCrc) ⇒
+ - [~duration(nsDifference)](#module*JS API* random utilities..duration) ⇒
+ - [~mainOrSecondaryInstance()](#module*JS API* random utilities..mainOrSecondaryInstance)
+ - [~collectJsonData(jsonFile)](#module*JS API* random utilities..collectJsonData)
+ - [~patternFormat(pattern, data)](#module*JS API* random utilities..patternFormat)
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
+
-| Param | Type |
-| ------- | --------------- |
-| global | \*
|
-| promise | \*
|
+### JS API: random utilities~checksum(data) ⇒
-
+Returns the CRC of the data that is passed.
-### JS API: generator logic~deprecatedHelper(fn, explanation) ⇒
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Returns**: Calculated CRC of a data.
-Function wrapper that can be used when a helper is deprecated.
+| Param | Type |
+| ----- | --------------- |
+| data | \*
|
-**Kind**: inner method of [JS API: generator logic
](#module*JS API* generator logic)
-**Returns**: a function that wraps the original function, with deprecation message.
+
-| Param | Type | Description |
-| ----------- | --------------- | ----------------------------------------------------------------------- |
-| fn | \*
| |
-| explanation | \*
| can contain `text`, or `from`/`to`, or just be a string message itself. |
+### JS API: random utilities~ensurePackagesAndPopulateSessionOptions(db, sessionId, options:, selectedZclPropertyPackage, selectedGenTemplatePackages) ⇒
-
+This function assigns a proper package ID to the session if there
+are no packages present. It will also populate session options.
-## REST API: user data
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Returns**: Promise that resolves with the packages array.
-This module provides the API to access zcl specific information.
+| Param | Type | Description |
+| --------------------------- | --------------- | -------------------------------------- |
+| db | \*
| |
+| sessionId | \*
| |
+| options: | \*
| object containing 'zcl' and 'template' |
+| selectedZclPropertyPackage | \*
| |
+| selectedGenTemplatePackages | \*
| |
-- [REST API: user data](#module*REST API* user data)
- - [~getComponentIdsByCluster(db, sessionId, clusterId, side)](#module*REST API* user data..getComponentIdsByCluster) ⇒ \*
- - [~httpGetSessionKeyValues(db)](#module*REST API* user data..httpGetSessionKeyValues) ⇒
- - [~httpGetNotifications(db)](#module*REST API* user data..httpGetNotifications) ⇒
- - [~httpPostSaveSessionKeyValue(db)](#module*REST API* user data..httpPostSaveSessionKeyValue) ⇒
- - [~httpPostCluster(db)](#module*REST API* user data..httpPostCluster) ⇒
- - [~httpPostAttributeUpdate(db)](#module*REST API* user data..httpPostAttributeUpdate) ⇒
- - [~httpPostCommandUpdate(db)](#module*REST API* user data..httpPostCommandUpdate) ⇒
- - [~httpPostEventUpdate(db)](#module*REST API* user data..httpPostEventUpdate) ⇒
- - [~httpGetInitialState(db)](#module*REST API* user data..httpGetInitialState) ⇒
- - [~httpGetOption(db)](#module*REST API* user data..httpGetOption) ⇒
- - [~httpGetUiOptions(db)](#module*REST API* user data..httpGetUiOptions) ⇒
- - [~httpGetPackages()](#module*REST API* user data..httpGetPackages)
- - [~httpGetAllPackages()](#module*REST API* user data..httpGetAllPackages)
- - [~httpPostAddNewPackage()](#module*REST API* user data..httpPostAddNewPackage)
- - [~httpPostShareClusterStatesAcrossEndpoints()](#module*REST API* user data..httpPostShareClusterStatesAcrossEndpoints)
- - [~httpPostDuplicateEndpoint(db)](#module*REST API* user data..httpPostDuplicateEndpoint) ⇒
- - [~httpPostDuplicateEndpointType(db)](#module*REST API* user data..httpPostDuplicateEndpointType) ⇒
- - [~duplicateEndpointTypeClusters(db, oldEndpointTypeId, newEndpointTypeId)](#module*REST API* user data..duplicateEndpointTypeClusters)
+
-
+### JS API: random utilities~createBackupFile(filePath)
-### REST API: user data~getComponentIdsByCluster(db, sessionId, clusterId, side) ⇒ \*
+Move database file out of the way into the backup location.
-Promise that return a list of component Ids required by a specific cluster
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: \*
- - {componentIds, clusterId, clusterLabel, side}
+| Param | Type |
+| -------- | --------------- |
+| filePath | \*
|
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
-| clusterId | \*
|
-| side | \*
|
+
-
+### JS API: random utilities~matchFeatureLevel(featureLevel)
-### REST API: user data~httpGetSessionKeyValues(db) ⇒
+Returns an object that contains:
+match: true or false if featureLevel is matched or not.
+message: in case of missmatch, the message shown to user.
-HTTP GET: session key values
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+| Param | Type |
+| ------------ | --------------- |
+| featureLevel | \*
|
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+
-
+### JS API: random utilities~sessionReport(db, sessionId) ⇒
-### REST API: user data~httpGetNotifications(db) ⇒
+Produces a text dump of a session data for human consumption.
-HTTP GET: session get notifications
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Returns**: promise that resolves into a text report for the session.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+
-
+### JS API: random utilities~sessionDump(db, sessionId) ⇒
-### REST API: user data~httpPostSaveSessionKeyValue(db) ⇒
+Produces a text dump of a session data for human consumption.
-HTTP POST: save session key value
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Returns**: promise that resolves into a text report for the session.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+
-
+### JS API: random utilities~executePromisesSequentially(arrayOfData, promiseCreator)
-### REST API: user data~httpPostCluster(db) ⇒
+If you have an array of arguments, and a function that creates
+a promise out of each of those arguments, this function
+executes them sequentially, one by one.
-HTTP POST: cluster
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+| Param | Type |
+| -------------- | --------------- |
+| arrayOfData | \*
|
+| promiseCreator | \*
|
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+
-
+### JS API: random utilities~createAbsolutePath(relativePath, relativity, zapFilePath)
-### REST API: user data~httpPostAttributeUpdate(db) ⇒
+This function creates absolute path out of relative path and its relativity
-HTTP POST attribute update
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+| Param | Type |
+| ------------ | --------------- |
+| relativePath | \*
|
+| relativity | \*
|
+| zapFilePath | \*
|
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+
-
+### JS API: random utilities~locateRelativeFilePath(rootFileLocations, relativeFilePath) ⇒
-### REST API: user data~httpPostCommandUpdate(db) ⇒
+This method takes an array of root locations and a relative path.
+It will attempt to locate an absolute file at the path, combining
+the root location and a relative path, until a file is found and returned.
-HTTP POST: command update
+If none of the combined root locations and relative paths results
+in an actual file, null is returned.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Returns**: A fully resolved path that exists, or null if none is available.
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+| Param | Type | Description |
+| ----------------- | --------------- | --------------------------------------------------- |
+| rootFileLocations | \*
| Array of root file locations, typically directories |
+| relativeFilePath | \*
| Relative path |
-
+
-### REST API: user data~httpPostEventUpdate(db) ⇒
+### JS API: random utilities~executeExternalProgram(cmd)
-HTTP POST: command update
+Returns a promise of an execution of an external program.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
| Param | Type |
| ----- | --------------- |
-| db | \*
|
+| cmd | \*
|
-
+
-### REST API: user data~httpGetInitialState(db) ⇒
+### JS API: random utilities~getClusterExtensionDefault(extensions, extensionId, clusterCode) ⇒
-HTTP GET: initial state
+Retrieve specific entry from extensions defaults(array) via 'clusterCode' key fields
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Returns**: Value of the cluster extension property.
+**Parem**: \*
clusterRole: one of server/client enums, or null for either.
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+| Param | Type | Description |
+| ----------- | --------------- | ----------------------------------- |
+| extensions | \*
| |
+| extensionId | \*
| field name under specific extension |
+| clusterCode | \*
| search key |
-
+
-### REST API: user data~httpGetOption(db) ⇒
+### JS API: random utilities~getClusterExtension(extensions, property, clusterCode) ⇒
-HTTP GET: option
+Retrieve specific entry from extensions defaults(array) via 'clusterCode' key fields
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Returns**: Object containing all attribuetes specific to the extension
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+| Param | Type | Description |
+| ----------- | --------------- | ----------------------------------- |
+| extensions | \*
| |
+| property | \*
| field name under specific extension |
+| clusterCode | \*
| search key |
-
+
-### REST API: user data~httpGetUiOptions(db) ⇒
+### JS API: random utilities~createUuid()
-HTTP GET: ui_options
+Global way how to get an UUID.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: UI options from all packages.
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+### JS API: random utilities~waitFor(time)
-
+Returns a promise that resolves after time milliseconds
-### REST API: user data~httpGetPackages()
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-HTTP GET: Project packages
+| Param |
+| ----- |
+| time |
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-
+
-### REST API: user data~httpGetAllPackages()
+### JS API: random utilities~parseXml(fileContent) ⇒
-HTTP GET: All Packages
+Returns a promise that resolve into a parsed XML object.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Returns**: promise that resolves into parsed object.
-### REST API: user data~httpPostAddNewPackage()
+| Param | Type |
+| ----------- | --------------- |
+| fileContent | \*
|
-HTTP POST: Add new project package
+
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-
+### JS API: random utilities~readFileContentAndCrc(metadata) ⇒
-### REST API: user data~httpPostShareClusterStatesAcrossEndpoints()
+Reads the properties file and returns object containing
+'data', 'filePath' and 'crc'
-HTTP POST: Unify all Attributes / Command states if a certain cluster is enabled
-on more than one endpoint.
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Returns**: Promise to populate data, filePath and crc into the context.
-1. In Zigbee world, the Attribute / Command configurations is a global singleton entity.
- If one cluster is enabled by more than 1 endpoint, the attribute states (on/off) should be
- identical across each endpoint.
- To emulate the global singleton entity, this function ensures Attribute changes
- are applied to all endpoint specific attribute fields.
- When unify event is triggered, this function will align all shared Attribute/Command states
- to the first matching entry from beginning of the endpoint list.
-2. (native case in ZAP) In Matter, the Attribute configuration are endpoint specific.
+| Param | Type | Description |
+| -------- | --------------- | ----------- |
+| metadata | \*
| file |
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-
+
-### REST API: user data~httpPostDuplicateEndpoint(db) ⇒
+### JS API: random utilities~duration(nsDifference) ⇒
-Creating a duplicate for endpoint
+This method takes a nanosecond duration and prints out
+decently human readable time out of it.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: newly created endpoint id
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Returns**: String with human readable time duration.
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+| Param | Type |
+| ------------ | --------------- |
+| nsDifference | \*
|
-
+
-### REST API: user data~httpPostDuplicateEndpointType(db) ⇒
+### JS API: random utilities~mainOrSecondaryInstance()
-Creating a duplicate for endpoint-type and endpoint-type-attributes
+This method returns true if the running instance is the first
+and main instance of the zap, and false if zap instance is already
+running.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: newly created endpoint-type id
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+### JS API: random utilities~collectJsonData(jsonFile)
-
+Utility method that collects data from a JSON file.
-### REST API: user data~duplicateEndpointTypeClusters(db, oldEndpointTypeId, newEndpointTypeId)
+JSON file is formatted as a bunch of keyed strings:
+"someKey": [ "a", "b", "c"]
+Then it supports following special keys:
+"include": "path/to/json/file" - includes the said JSON file
+"disable": [ "x", "y" ...] - disables the specified data points
+"collection": ["key", "key2", ...] - collects final list of data points
-duplicate all clusters and attributes of an old endpoint type, using oldEndpointType id and newly created endpointType id
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+| Param | Type |
+| -------- | --------------- |
+| jsonFile | \*
|
-| Param | Type |
-| ----------------- | --------------- |
-| db | \*
|
-| oldEndpointTypeId | \*
|
-| newEndpointTypeId | \*
|
+
-
+### JS API: random utilities~patternFormat(pattern, data)
-## REST API: admin functions
+This function receives pattern and data, and it formats pattern
+by applyind data to it via it's keys.
+For example, if pattern is "{a}" and data.a is 1, then this prints out "1".
-This module provides the REST API to the admin functions.
+**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-- [REST API: admin functions](#module*REST API* admin functions)
- - [~httpPostSql(db, app)](#module*REST API* admin functions..httpPostSql) ⇒
- - [~httpGetVersion(db)](#module*REST API* admin functions..httpGetVersion) ⇒
- - [~httpGetCache(db)](#module*REST API* admin functions..httpGetCache)
+| Param | Type |
+| ------- | --------------- |
+| pattern | \*
|
+| data | \*
|
-
+
-### REST API: admin functions~httpPostSql(db, app) ⇒
+## REST API: various zcl utilities
-API: /sql
-Request JSON:
+This module provides the API to access various zcl utilities.
+
+- [REST API: various zcl utilities](#module*REST API* various zcl utilities)
+ - [~clusterComparator(a, b)](#module*REST API* various zcl utilities..clusterComparator) ⇒
+ - [~attributeComparator(a, b)](#module*REST API* various zcl utilities..attributeComparator) ⇒
+ - [~commandComparator(a, b)](#module*REST API* various zcl utilities..commandComparator) ⇒
+ - [~eventComparator(a, b)](#module*REST API* various zcl utilities..eventComparator) ⇒
+ - [~sortStructsByDependency(structs)](#module*REST API* various zcl utilities..sortStructsByDependency) ⇒
+ - [~calculateBytes(res, options, db, packageIds, isStructType)](#module*REST API* various zcl utilities..calculateBytes)
+ - [~optionsHashOrDefault(options, optionsKey, defaultValue)](#module*REST API* various zcl utilities..optionsHashOrDefault)
+ - [~dataTypeCharacterFormatter(db, packageIds, type, options, resType)](#module*REST API* various zcl utilities..dataTypeCharacterFormatter)
+ - [~isEnum(db, enum_name, packageIds)](#module*REST API* various zcl utilities..isEnum) ⇒
+ - [~isStruct(db, struct_name, packageIds)](#module*REST API* various zcl utilities..isStruct) ⇒
+ - [~isEvent(db, event_name, packageId)](#module*REST API* various zcl utilities..isEvent) ⇒
+ - [~isBitmap(db, bitmap_name, packageIds)](#module*REST API* various zcl utilities..isBitmap) ⇒
+ - [~defaultMessageForTypeConversion(fromType, toType, noWarning)](#module*REST API* various zcl utilities..defaultMessageForTypeConversion)
+ - [~dataTypeHelper(type, options, packageIds, db, resolvedType, overridable)](#module*REST API* various zcl utilities..dataTypeHelper) ⇒
+ - [~asUnderlyingZclTypeWithPackageId(type, options, packageIds, currentInstance)](#module*REST API* various zcl utilities..asUnderlyingZclTypeWithPackageId)
+ - [~determineType(db, type, packageIds)](#module*REST API* various zcl utilities..determineType)
+ - [~zcl_data_type_size_and_sign(type, dataType, clusterId, packageIds, context)](#module*REST API* various zcl utilities..zcl_data_type_size_and_sign) ⇒
-- { - sql: SQL Query - } -+ -Response JSON: +### REST API: various zcl utilities~clusterComparator(a, b) ⇒ -
- { - result: Array of rows. - } -+Comparator for sorting clusters. -**Kind**: inner method of [
REST API: admin functions
](#module*REST API* admin functions)
-**Returns**: callback for the express uri registration
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: -1, 0 or 1
| Param | Type |
| ----- | --------------- |
-| db | \*
|
-| app | \*
|
-
-
+| a | \*
|
+| b | \*
|
-### REST API: admin functions~httpGetVersion(db) ⇒
+
-API: /version
-Response JSON:
+### REST API: various zcl utilities~attributeComparator(a, b) ⇒
-- { - version: full version. - featureLevel: feature level. - hash: git hash code - timestamp: Unix time from the last commit in the repo. - date: Date of the last commit in the repo. - } -+Comparator for sorting attribute. -**Kind**: inner method of [
REST API: admin functions
](#module*REST API* admin functions)
-**Returns**: callback for the express uri registration.
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: -1, 0 or 1
| Param | Type |
| ----- | --------------- |
-| db | \*
|
-
-
+| a | \*
|
+| b | \*
|
-### REST API: admin functions~httpGetCache(db)
+
-API: /cache
-Response JSON:
+### REST API: various zcl utilities~commandComparator(a, b) ⇒
-- { - keys: 0, // global key count - hits: 0, // global hit count - misses: 0, // global miss count - ksize: 0, // global key size count in approximately bytes - vsize: 0 // global value size count in approximately bytes - } -+Comparator for sorting commands. -**Kind**: inner method of [
REST API: admin functions
](#module*REST API* admin functions)
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: -1, 0 or 1
| Param | Type |
| ----- | --------------- |
-| db | \*
|
+| a | \*
|
+| b | \*
|
-
+
-## REST API: endpoint
+### REST API: various zcl utilities~eventComparator(a, b) ⇒
-This module provides the REST API to the user specific data.
+Comparator for sorting events.
-- [REST API: endpoint](#module*REST API* endpoint)
- - [~httpDeleteEndpoint(db)](#module*REST API* endpoint..httpDeleteEndpoint) ⇒
- - [~httpDeleteEndpointType(db)](#module*REST API* endpoint..httpDeleteEndpointType) ⇒
- - [~httpPostEndpoint(db)](#module*REST API* endpoint..httpPostEndpoint) ⇒
- - [~httpPatchEndpoint(db)](#module*REST API* endpoint..httpPatchEndpoint) ⇒
- - [~httpPostEndpointType(db)](#module*REST API* endpoint..httpPostEndpointType) ⇒
- - [~httpPatchEndpointType(db)](#module*REST API* endpoint..httpPatchEndpointType) ⇒
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: -1, 0 or 1
-
+| Param | Type |
+| ----- | --------------- |
+| a | \*
|
+| b | \*
|
-### REST API: endpoint~httpDeleteEndpoint(db) ⇒
+
-HTTP DELETE: endpoint
+### REST API: various zcl utilities~sortStructsByDependency(structs) ⇒
-**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
-**Returns**: callback for the express uri registration
+This method retrieves a bunch of structs sorted
+alphabetically. It's expected to resort the structs into a list
+where they are sorted in a way where dependency is observed.
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+It uses the DFS-based topological sort algorithm.
-
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: sorted structs according to topological search.
-### REST API: endpoint~httpDeleteEndpointType(db) ⇒
+| Param | Type |
+| ------- | --------------- |
+| structs | \*
|
-HTTP DELETE: endpoint type
+
-**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
-**Returns**: callback for the express uri registration
+### REST API: various zcl utilities~calculateBytes(res, options, db, packageIds, isStructType)
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+This function calculates the number of bytes in the data type and based on
+that returns the option specified in the template.
+for eg: Given that options are as follows:
+options.hash.array="b"
+options.hash.one_byte="u"
+options.hash.two_byte="v"
+options.hash.three_byte="x"
+options.hash.four_byte="w"
+options.hash.short_string="s"
+options.hash.long_string="l"
+options.hash.default="b"
-
+calculateBytes("char_string", options)
+will return 's'
-### REST API: endpoint~httpPostEndpoint(db) ⇒
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-HTTP POST: endpoint
+| Param | Type |
+| ------------ | --------------- |
+| res | \*
|
+| options | \*
|
+| db | \*
|
+| packageIds | \*
|
+| isStructType | \*
|
-**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
-**Returns**: callback for the express uri registration
+
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+### REST API: various zcl utilities~optionsHashOrDefault(options, optionsKey, defaultValue)
-
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-### REST API: endpoint~httpPatchEndpoint(db) ⇒
+| Param | Description |
+| ------------ | --------------------------------------------------------------------------------- |
+| options | |
+| optionsKey | |
+| defaultValue | Given the values determine to give the user defined value or the calculated value |
-HTTP POST: endpoint
+
-**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
-**Returns**: callback for the express uri registration
+### REST API: various zcl utilities~dataTypeCharacterFormatter(db, packageIds, type, options, resType)
-| Param | Type | Description |
-| ----- | --------------- | --------------------------------------- |
-| db | \*
| Main database to use for the operation. |
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-
+| Param | Type | Description |
+| ---------- | --------------- | ------------------------------------------ |
+| db | \*
| |
+| packageIds | \*
| |
+| type | \*
| |
+| options | \*
| |
+| resType | \*
| Character associated to a zcl/c data type. |
-### REST API: endpoint~httpPostEndpointType(db) ⇒
+
-HTTP POST endpoint type
+### REST API: various zcl utilities~isEnum(db, enum_name, packageIds) ⇒
-**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
-**Returns**: callback for the express uri registration
+Local function that checks if an enum by the name exists
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: Promise of content.
-
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| enum_name | \*
|
+| packageIds | \*
|
-### REST API: endpoint~httpPatchEndpointType(db) ⇒
+
-HTTP POST: endpoint type update
+### REST API: various zcl utilities~isStruct(db, struct_name, packageIds) ⇒
-**Kind**: inner method of [REST API: endpoint
](#module*REST API* endpoint)
-**Returns**: callback for the express uri registration
+Local function that checks if a struct by the name exists
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: Promise of content.
-
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| struct_name | \*
|
+| packageIds | \*
|
-## External IDE interface.
+
-This module provides the interface to an extenal IDE: Simplicity Studio.
+### REST API: various zcl utilities~isEvent(db, event_name, packageId) ⇒
-
+Function that checks if a given thing is an avent.
-## REST API: generation functions
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: Promise of content.
-This module provides the REST API to the generation.
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| event_name | \*
|
+| packageId | \*
|
-- [REST API: generation functions](#module*REST API* generation functions)
- - [~httpGetPreviewNameIndex(db)](#module*REST API* generation functions..httpGetPreviewNameIndex) ⇒
- - [~httpGetPreviewName(db)](#module*REST API* generation functions..httpGetPreviewName) ⇒
- - [~httpGetPreview(db)](#module*REST API* generation functions..httpGetPreview) ⇒
- - [~httpPutGenerate(db)](#module*REST API* generation functions..httpPutGenerate) ⇒
- - [~httpPostComponentAdd(db)](#module*REST API* generation functions..httpPostComponentAdd)
+
-
+### REST API: various zcl utilities~isBitmap(db, bitmap_name, packageIds) ⇒
-### REST API: generation functions~httpGetPreviewNameIndex(db) ⇒
+Local function that checks if a bitmap by the name exists
-HTTP GET: preview single file with index.
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: Promise of content.
-**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
-**Returns**: callback for the express uri registration
+| Param | Type |
+| ----------- | --------------- |
+| db | \*
|
+| bitmap_name | \*
|
+| packageIds | \*
|
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+
+
+### REST API: various zcl utilities~defaultMessageForTypeConversion(fromType, toType, noWarning)
+
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-
+| Param | Type | Description |
+| --------- | --------------- | --------------------------------------------------------------------------------------------- |
+| fromType | \*
| |
+| toType | \*
| |
+| noWarning | \*
| Type warning message. If noWarning is set to true then the warning message will not be shown. |
-### REST API: generation functions~httpGetPreviewName(db) ⇒
+
-HTTP GET: Preview a single file.
+### REST API: various zcl utilities~dataTypeHelper(type, options, packageIds, db, resolvedType, overridable) ⇒
-**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
-**Returns**: callback for the express uri registration
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: the data type associated with the resolvedType
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+| Param | Type |
+| ------------ | --------------- |
+| type | \*
|
+| options | \*
|
+| packageIds | \*
|
+| db | \*
|
+| resolvedType | \*
|
+| overridable | \*
|
-
+
-### REST API: generation functions~httpGetPreview(db) ⇒
+### REST API: various zcl utilities~asUnderlyingZclTypeWithPackageId(type, options, packageIds, currentInstance)
-HTTP GET: total preview object.
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
-**Returns**: callback for the express uri registration
+| Param | Description |
+| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| type | |
+| options | |
+| packageIds | |
+| currentInstance | Note: If the options has zclCharFormatter set to true then the function will return the user defined data associated with the zcl data type and not the actual data type. It can also be used to calculate the size of the data types This is a utility function which is called from other helper functions using ut current instance. See comments in asUnderlyingZclType for usage instructions. |
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+
-
+### REST API: various zcl utilities~determineType(db, type, packageIds)
-### REST API: generation functions~httpPutGenerate(db) ⇒
+Returns a promise that resolves into an object containing:
+type:
+atomicType:
+Base type for struct is a null.
-HTTP PUT: performs local generation into a specified directory.
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
-**Returns**: callback for the express uri registration
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| type | \*
|
+| packageIds | \*
|
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+
-
+### REST API: various zcl utilities~zcl_data_type_size_and_sign(type, dataType, clusterId, packageIds, context) ⇒
-### REST API: generation functions~httpPostComponentAdd(db)
+**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Returns**: The size and sign of a zcl data type
-Enable components by 'componentId' or corresponding components specified, via 'defaults', by 'clusterId' / 'roles'
+| Param | Type |
+| ---------- | --------------- |
+| type | \*
|
+| dataType | \*
|
+| clusterId | \*
|
+| packageIds | \*
|
+| context | \*
|
-**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
+
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+## renderer_api
-
+Copyright (c) 2020 Silicon Labs
-## REST API: generation functions
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-This module provides the REST API to the IDE component handling.
+ http://www.apache.org/licenses/LICENSE-2.0
-- [REST API: generation functions](#module*REST API* generation functions)
- - [~httpGetPreviewNameIndex(db)](#module*REST API* generation functions..httpGetPreviewNameIndex) ⇒
- - [~httpGetPreviewName(db)](#module*REST API* generation functions..httpGetPreviewName) ⇒
- - [~httpGetPreview(db)](#module*REST API* generation functions..httpGetPreview) ⇒
- - [~httpPutGenerate(db)](#module*REST API* generation functions..httpPutGenerate) ⇒
- - [~httpPostComponentAdd(db)](#module*REST API* generation functions..httpPostComponentAdd)
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-
+**Kind**: global variable
+
-### REST API: generation functions~httpGetPreviewNameIndex(db) ⇒
+## GLOBAL_SYMBOL_INFO
-HTTP GET: preview single file with index.
+Global symbol that carries the API info metadata
-**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
-**Returns**: callback for the express uri registration
+**Kind**: global variable
+
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+## GLOBAL_SYMBOL_EXECUTE
-
+Global function that can execute the APIs.
-### REST API: generation functions~httpGetPreviewName(db) ⇒
+**Kind**: global variable
+
-HTTP GET: Preview a single file.
+## GLOBAL_SYMBOL_NOTIFY
-**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
-**Returns**: callback for the express uri registration
+Global function that can be overloaded by jxbrowser for notifications
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+**Kind**: global variable
+
-
+## ASYNC_DEFAULT_TIMER_INTERVAL_MS
-### REST API: generation functions~httpGetPreview(db) ⇒
+This module provides the APIs for initializing timers specifically
+for sessions.
-HTTP GET: total preview object.
+**Kind**: global variable
+
-**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
-**Returns**: callback for the express uri registration
+## watchDogId
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+Copyright (c) 2020 Silicon Labs
-
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-### REST API: generation functions~httpPutGenerate(db) ⇒
+ http://www.apache.org/licenses/LICENSE-2.0
-HTTP PUT: performs local generation into a specified directory.
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
-**Returns**: callback for the express uri registration
+**Kind**: global variable
+
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+## uri
-
+Copyright (c) 2020 Silicon Labs
-### REST API: generation functions~httpPostComponentAdd(db)
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-Enable components by 'componentId' or corresponding components specified, via 'defaults', by 'clusterId' / 'roles'
+ http://www.apache.org/licenses/LICENSE-2.0
-**Kind**: inner method of [REST API: generation functions
](#module*REST API* generation functions)
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+**Kind**: global constant
+
-
+## env
-## REST API: initialization functions
+Copyright (c) 2020 Silicon Labs
-This module provides the REST API to the session initialization
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-- [REST API: initialization functions](#module*REST API* initialization functions)
- - [~packagesAndSessions(db)](#module*REST API* initialization functions..packagesAndSessions) ⇒
- - [~initializeSession(db, options:)](#module*REST API* initialization functions..initializeSession) ⇒
- - [~loadPreviousSessions(db)](#module*REST API* initialization functions..loadPreviousSessions) ⇒
- - [~init(db)](#module*REST API* initialization functions..init) ⇒
+ http://www.apache.org/licenses/LICENSE-2.0
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### REST API: initialization functions~packagesAndSessions(db) ⇒
+**Kind**: global constant
+
-This function returns Properties, Templates and Dirty-Sessions
+## dbApi
-**Kind**: inner method of [REST API: initialization functions
](#module*REST API* initialization functions)
-**Returns**: Properties, Templates and Dirty-Sessions.
+This module provides queries for discriminators
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+**Kind**: global constant
+
-
+## dbApi
-### REST API: initialization functions~initializeSession(db, options:) ⇒
+This module provides queries for data types
-This function creates a new session with its packages according to selected Properties and Templates
+**Kind**: global constant
+
-**Kind**: inner method of [REST API: initialization functions
](#module*REST API* initialization functions)
-**Returns**: A success message.
+## dbApi
-| Param | Type | Description |
-| -------- | --------------- | -------------------------------------- |
-| db | \*
| |
-| options: | \*
| object containing 'zcl' and 'template' |
+This module provides queries for numbers
-
+**Kind**: global constant
+
-### REST API: initialization functions~loadPreviousSessions(db) ⇒
+## dbApi
-This function reloads previous session by user selected session's id
+This module provides queries for strings
-**Kind**: inner method of [REST API: initialization functions
](#module*REST API* initialization functions)
-**Returns**: A success message.
+**Kind**: global constant
+
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+## queryAccess
-
+Copyright (c) 2020 Silicon Labs
-### REST API: initialization functions~init(db) ⇒
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-Init function from the App.vue
+ http://www.apache.org/licenses/LICENSE-2.0
-**Kind**: inner method of [REST API: initialization functions
](#module*REST API* initialization functions)
-**Returns**: A success message.
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+**Kind**: global constant
+
-
+## queryAttribute
-## REST API: static zcl functions
+Copyright (c) 2020 Silicon Labs
-This module provides the REST API to the static zcl queries.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-- [REST API: static zcl functions](#module*REST API* static zcl functions)
- - [~httpGetZclEntity(app)](#module*REST API* static zcl functions..httpGetZclEntity)
- - [~httpGetZclExtension(db)](#module*REST API* static zcl functions..httpGetZclExtension) ⇒
+ http://www.apache.org/licenses/LICENSE-2.0
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### REST API: static zcl functions~httpGetZclEntity(app)
+**Kind**: global constant
+
-API: /zcl/:entity/:id
+## queryZcl
-**Kind**: inner method of [REST API: static zcl functions
](#module*REST API* static zcl functions)
+Copyright (c) 2020 Silicon Labs
-| Param | Type | Description |
-| ----- | --------------- | ----------------- |
-| app | \*
| Express instance. |
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-
+ http://www.apache.org/licenses/LICENSE-2.0
-### REST API: static zcl functions~httpGetZclExtension(db) ⇒
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-API: /zclExtension/:entity/:extension
+**Kind**: global constant
+
-**Kind**: inner method of [REST API: static zcl functions
](#module*REST API* static zcl functions)
-**Returns**: zcl extension handler
+## queryCommand
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+Copyright (c) 2021 Silicon Labs
-
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-## REST API: user data
+ http://www.apache.org/licenses/LICENSE-2.0
-This module provides the REST API to the user specific data.
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-- [REST API: user data](#module*REST API* user data)
- - [~getComponentIdsByCluster(db, sessionId, clusterId, side)](#module*REST API* user data..getComponentIdsByCluster) ⇒ \*
- - [~httpGetSessionKeyValues(db)](#module*REST API* user data..httpGetSessionKeyValues) ⇒
- - [~httpGetNotifications(db)](#module*REST API* user data..httpGetNotifications) ⇒
- - [~httpPostSaveSessionKeyValue(db)](#module*REST API* user data..httpPostSaveSessionKeyValue) ⇒
- - [~httpPostCluster(db)](#module*REST API* user data..httpPostCluster) ⇒
- - [~httpPostAttributeUpdate(db)](#module*REST API* user data..httpPostAttributeUpdate) ⇒
- - [~httpPostCommandUpdate(db)](#module*REST API* user data..httpPostCommandUpdate) ⇒
- - [~httpPostEventUpdate(db)](#module*REST API* user data..httpPostEventUpdate) ⇒
- - [~httpGetInitialState(db)](#module*REST API* user data..httpGetInitialState) ⇒
- - [~httpGetOption(db)](#module*REST API* user data..httpGetOption) ⇒
- - [~httpGetUiOptions(db)](#module*REST API* user data..httpGetUiOptions) ⇒
- - [~httpGetPackages()](#module*REST API* user data..httpGetPackages)
- - [~httpGetAllPackages()](#module*REST API* user data..httpGetAllPackages)
- - [~httpPostAddNewPackage()](#module*REST API* user data..httpPostAddNewPackage)
- - [~httpPostShareClusterStatesAcrossEndpoints()](#module*REST API* user data..httpPostShareClusterStatesAcrossEndpoints)
- - [~httpPostDuplicateEndpoint(db)](#module*REST API* user data..httpPostDuplicateEndpoint) ⇒
- - [~httpPostDuplicateEndpointType(db)](#module*REST API* user data..httpPostDuplicateEndpointType) ⇒
- - [~duplicateEndpointTypeClusters(db, oldEndpointTypeId, newEndpointTypeId)](#module*REST API* user data..duplicateEndpointTypeClusters)
+**Kind**: global constant
+
-
+## cHelper
-### REST API: user data~getComponentIdsByCluster(db, sessionId, clusterId, side) ⇒ \*
+Copyright (c) 2020 Silicon Labs
-Promise that return a list of component Ids required by a specific cluster
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: \*
- - {componentIds, clusterId, clusterLabel, side}
+ http://www.apache.org/licenses/LICENSE-2.0
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
-| clusterId | \*
|
-| side | \*
|
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-
+**Kind**: global constant
+
-### REST API: user data~httpGetSessionKeyValues(db) ⇒
+## futureKey
-HTTP GET: session key values
+Copyright (c) 2021 Silicon Labs
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+ http://www.apache.org/licenses/LICENSE-2.0
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### REST API: user data~httpGetNotifications(db) ⇒
+**Kind**: global constant
+
-HTTP GET: session get notifications
+## dbEnum
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+Copyright (c) 2020 Silicon Labs
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-
+ http://www.apache.org/licenses/LICENSE-2.0
-### REST API: user data~httpPostSaveSessionKeyValue(db) ⇒
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-HTTP POST: save session key value
+**Kind**: global constant
+
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+## templateUtil
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+Copyright (c) 2020 Silicon Labs
-
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-### REST API: user data~httpPostCluster(db) ⇒
+ http://www.apache.org/licenses/LICENSE-2.0
-HTTP POST: cluster
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+**Kind**: global constant
+
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+## templateUtil
-
+Copyright (c) 2020 Silicon Labs
-### REST API: user data~httpPostAttributeUpdate(db) ⇒
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-HTTP POST attribute update
+ http://www.apache.org/licenses/LICENSE-2.0
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+**Kind**: global constant
+
-
+## queryZcl
-### REST API: user data~httpPostCommandUpdate(db) ⇒
+Copyright (c) 2020 Silicon Labs
-HTTP POST: command update
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+ http://www.apache.org/licenses/LICENSE-2.0
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-
+**Kind**: global constant
+
-### REST API: user data~httpPostEventUpdate(db) ⇒
+## queryZcl
-HTTP POST: command update
+Copyright (c) 2020 Silicon Labs
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+ http://www.apache.org/licenses/LICENSE-2.0
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### REST API: user data~httpGetInitialState(db) ⇒
+**Kind**: global constant
+
-HTTP GET: initial state
+## dbEnums
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+Copyright (c) 2023 Silicon Labs
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-
+ http://www.apache.org/licenses/LICENSE-2.0
-### REST API: user data~httpGetOption(db) ⇒
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-HTTP GET: option
+**Kind**: global constant
+
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: callback for the express uri registration
+## queryPackage
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+Copyright (c) 2020 Silicon Labs
-
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-### REST API: user data~httpGetUiOptions(db) ⇒
+ http://www.apache.org/licenses/LICENSE-2.0
-HTTP GET: ui_options
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: UI options from all packages.
+**Kind**: global constant
+
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+## \_
-
+Copyright (c) 2023 Silicon Labs
-### REST API: user data~httpGetPackages()
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-HTTP GET: Project packages
+ http://www.apache.org/licenses/LICENSE-2.0
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### REST API: user data~httpGetAllPackages()
+**Kind**: global constant
+
-HTTP GET: All Packages
+## path
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-
+Copyright (c) 2020 Silicon Labs
-### REST API: user data~httpPostAddNewPackage()
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-HTTP POST: Add new project package
+ http://www.apache.org/licenses/LICENSE-2.0
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### REST API: user data~httpPostShareClusterStatesAcrossEndpoints()
+**Kind**: global constant
+
-HTTP POST: Unify all Attributes / Command states if a certain cluster is enabled
-on more than one endpoint.
+## fs
-1. In Zigbee world, the Attribute / Command configurations is a global singleton entity.
- If one cluster is enabled by more than 1 endpoint, the attribute states (on/off) should be
- identical across each endpoint.
- To emulate the global singleton entity, this function ensures Attribute changes
- are applied to all endpoint specific attribute fields.
- When unify event is triggered, this function will align all shared Attribute/Command states
- to the first matching entry from beginning of the endpoint list.
-2. (native case in ZAP) In Matter, the Attribute configuration are endpoint specific.
+Copyright (c) 2020 Silicon Labs
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-### REST API: user data~httpPostDuplicateEndpoint(db) ⇒
+ http://www.apache.org/licenses/LICENSE-2.0
-Creating a duplicate for endpoint
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: newly created endpoint id
+**Kind**: global constant
+
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+## fs
-
+Copyright (c) 2020 Silicon Labs
-### REST API: user data~httpPostDuplicateEndpointType(db) ⇒
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-Creating a duplicate for endpoint-type and endpoint-type-attributes
+ http://www.apache.org/licenses/LICENSE-2.0
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
-**Returns**: newly created endpoint-type id
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-| Param | Type |
-| ----- | --------------- |
-| db | \*
|
+**Kind**: global constant
+
-
+## dbApi
-### REST API: user data~duplicateEndpointTypeClusters(db, oldEndpointTypeId, newEndpointTypeId)
+Copyright (c) 2020 Silicon Labs
-duplicate all clusters and attributes of an old endpoint type, using oldEndpointType id and newly created endpointType id
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-**Kind**: inner method of [REST API: user data
](#module*REST API* user data)
+ http://www.apache.org/licenses/LICENSE-2.0
-| Param | Type |
-| ----------------- | --------------- |
-| db | \*
|
-| oldEndpointTypeId | \*
|
-| newEndpointTypeId | \*
|
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-
+**Kind**: global constant
+
-## JS API: http server
+## dbApi
-This module provides the HTTP server functionality.
+Copyright (c) 2020 Silicon Labs
-- [JS API: http server](#module*JS API* http server)
- - [~registerRestApi(filename, db, app)](#module*JS API* http server..registerRestApi)
- - [~initHttpServer(db, port)](#module*JS API* http server..initHttpServer) ⇒
- - [~shutdownHttpServer()](#module*JS API* http server..shutdownHttpServer) ⇒
- - [~shutdownHttpServerSync()](#module*JS API* http server..shutdownHttpServerSync) ⇒
- - [~httpServerPort()](#module*JS API* http server..httpServerPort) ⇒
- - [~httpServerUrl()](#module*JS API* http server..httpServerUrl) ⇒
- - [~httpServerStartupMessage()](#module*JS API* http server..httpServerStartupMessage)
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-
+ http://www.apache.org/licenses/LICENSE-2.0
-### JS API: http server~registerRestApi(filename, db, app)
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-This function is used to register a rest module, which exports
-get/post/etc. arrays.
+**Kind**: global constant
+
-**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
+## ipc
-| Param | Type |
-| -------- | --------------- |
-| filename | \*
|
-| db | \*
|
-| app | \*
|
+Copyright (c) 2020 Silicon Labs
-
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-### JS API: http server~initHttpServer(db, port) ⇒
+ http://www.apache.org/licenses/LICENSE-2.0
-Promises to initialize the http server on a given port
-using a given database.
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
-**Returns**: A promise that resolves with an express app.
+**Kind**: global constant
+
-| Param | Type | Description |
-| ----- | --------------- | ------------------------- |
-| db | \*
| Database object to use. |
-| port | \*
| Port for the HTTP server. |
+## rendApi
-
+Copyright (c) 2020 Silicon Labs
-### JS API: http server~shutdownHttpServer() ⇒
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-Promises to shut down the http server.
+ http://www.apache.org/licenses/LICENSE-2.0
-**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
-**Returns**: Promise that resolves when server is shut down.
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### JS API: http server~shutdownHttpServerSync() ⇒
+**Kind**: global constant
+
-Promises to shut down the http server.
+## env
-**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
-**Returns**: Promise that resolves when server is shut down.
-
+This file is used specifically and only for development. It installs
+`electron-debug` & `vue-devtools`. There shouldn't be any need to
+modify this file, but it can be used to extend your development
+environment.
-### JS API: http server~httpServerPort() ⇒
+**Kind**: global constant
+
-Port http server is listening on.
+## yargs
-**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
-**Returns**: port
-
+Copyright (c) 2020 Silicon Labs
-### JS API: http server~httpServerUrl() ⇒
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-Returns the URL of the server.
+ http://www.apache.org/licenses/LICENSE-2.0
-**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
-**Returns**: the server URL
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### JS API: http server~httpServerStartupMessage()
+**Kind**: global constant
+
-Returns the startup message that needs to be printed out.
+## path
-**Kind**: inner method of [JS API: http server
](#module*JS API* http server)
-
+Copyright (c) 2020 Silicon Labs
-## JS API: websocket server
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-This module provides the HTTP server functionality.
+ http://www.apache.org/licenses/LICENSE-2.0
-- [JS API: websocket server](#module*JS API* websocket server)
- - [~initializeWebSocket(httpServer)](#module*JS API* websocket server..initializeWebSocket)
- - [~clientSocket(sessionUuid)](#module*JS API* websocket server..clientSocket)
- - [~doSend(socket, object)](#module*JS API* websocket server..doSend)
- - [~sendWebSocketData(category, payload)](#module*JS API* websocket server..sendWebSocketData)
- - [~sendWebSocketMessage(msg)](#module*JS API* websocket server..sendWebSocketMessage)
- - [~onWebSocket(category, listener)](#module*JS API* websocket server..onWebSocket)
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-
+**Kind**: global constant
+
-### JS API: websocket server~initializeWebSocket(httpServer)
+## queryZcl
-Initialize a websocket, and register listeners to the
-websocket connection and the message receipt.
+Copyright (c) 2024 Silicon Labs
-**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-| Param | Type |
-| ---------- | --------------- |
-| httpServer | \*
|
+ http://www.apache.org/licenses/LICENSE-2.0
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### JS API: websocket server~clientSocket(sessionUuid)
+**Kind**: global constant
+
-Method that returns the websocket for a given session key.
+## path
-**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
+Copyright (c) 2024 Silicon Labs
-| Param | Type |
-| ----------- | --------------- |
-| sessionUuid | \*
|
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-
+ http://www.apache.org/licenses/LICENSE-2.0
-### JS API: websocket server~doSend(socket, object)
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-Bottom-most function that sends an object over a socket.
+**Kind**: global constant
+
-**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
+## templateUtil
-| Param | Type |
-| ------ | --------------- |
-| socket | \*
|
-| object | \*
|
+This module provides API to access various iterator utilities that can then
+be used to build iterator helpers.
-
+**Kind**: global constant
+
-### JS API: websocket server~sendWebSocketData(category, payload)
+## path
-Send websocket payload with a given category.
+Copyright (c) 2021 Silicon Labs
-**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-| Param | Type |
-| -------- | --------------- |
-| category | \*
|
-| payload | \*
|
+ http://www.apache.org/licenses/LICENSE-2.0
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### JS API: websocket server~sendWebSocketMessage(msg)
+**Kind**: global constant
+
-This can be used to send unstructured websocket message.
-On the receiving end, the event will contain category
-'generic'.
+## fs
-**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
+Copyright (c) 2022 Silicon Labs
-| Param | Type |
-| ----- | --------------- |
-| msg | \*
|
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-
+ http://www.apache.org/licenses/LICENSE-2.0
-### JS API: websocket server~onWebSocket(category, listener)
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-If you wish to register to a specific category of websocket
-messages, you can use this function. Listener will be executed with
-a given socket and data object.
+**Kind**: global constant
+
-**Kind**: inner method of [JS API: websocket server
](#module*JS API* websocket server)
+## path
-| Param | Type | Description |
-| -------- | --------------- | ------------------------------------ |
-| category | \*
| category of message. |
-| listener | \*
| function that receives socket, data. |
+Copyright (c) 2023 Silicon Labs
-
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-## JS API: renderer API related utilities
+ http://www.apache.org/licenses/LICENSE-2.0
-- [JS API: renderer API related utilities](#module*JS API* renderer API related utilities)
- - [~getSessionUuidFromBrowserWindow(browserWindow)](#module*JS API* renderer API related utilities..getSessionUuidFromBrowserWindow) ⇒
- - [~getRendererApiInformation(browserWindow)](#module*JS API* renderer API related utilities..getRendererApiInformation) ⇒
- - [~execRendererApi(browserWindow, rendererApiCommand, ...theArgs)](#module*JS API* renderer API related utilities..execRendererApi)
- - [~execFileOpen(browserWindow, filePath)](#module*JS API* renderer API related utilities..execFileOpen) ⇒
- - [~processRendererNotify(message)](#module*JS API* renderer API related utilities..processRendererNotify) ⇒
- - [~reportFiles(browserWindow, result)](#module*JS API* renderer API related utilities..reportFiles)
- - [~getUserKeyFromCookieValue(cookieValue)](#module*JS API* renderer API related utilities..getUserKeyFromCookieValue) ⇒
- - [~getUserKeyFromBrowserCookie(browserCookie)](#module*JS API* renderer API related utilities..getUserKeyFromBrowserCookie)
- - [~getUserKeyFromBrowserWindow(browserWindow)](#module*JS API* renderer API related utilities..getUserKeyFromBrowserWindow)
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-
+**Kind**: global constant
+
-### JS API: renderer API related utilities~getSessionUuidFromBrowserWindow(browserWindow) ⇒
+## queryZcl
-This method returns the global session UUID from the browser window that is set by the front-end.
+Copyright (c) 2020 Silicon Labs
-**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
-**Returns**: session UUID
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-| Param | Type |
-| ------------- | --------------- |
-| browserWindow | \*
|
+ http://www.apache.org/licenses/LICENSE-2.0
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### JS API: renderer API related utilities~getRendererApiInformation(browserWindow) ⇒
+**Kind**: global constant
+
-Returns descriptive text about renderer api.
+## queryPackage
-**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
-**Returns**: description of renderer api
+This module provides the APIs for validating inputs to the database, and returning flags indicating if
+things were successful or not.
-| Param | Type |
-| ------------- | --------------- |
-| browserWindow | \*
|
+**Kind**: global constant
+
-
+## queryZcl
-### JS API: renderer API related utilities~execRendererApi(browserWindow, rendererApiCommand, ...theArgs)
+This module provides the APIs for validating inputs to the database, and returning flags indicating if
+things were successful or not.
-Execute RendererApi commands
+**Kind**: global constant
+
-**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
+## fs
-| Param | Type |
-| ------------------ | ---------------- |
-| browserWindow | \*
|
-| rendererApiCommand | \*
|
-| ...theArgs | any
|
+Copyright (c) 2020 Silicon Labs
-
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-### JS API: renderer API related utilities~execFileOpen(browserWindow, filePath) ⇒
+ http://www.apache.org/licenses/LICENSE-2.0
-Executes the file open renderer API action.
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
-**Returns**: Result of file open call.
+**Kind**: global constant
+
-| Param | Type |
-| ------------- | --------------- |
-| browserWindow | \*
|
-| filePath | \*
|
+## \_
-
+Copyright (c) 2023 Silicon Labs
-### JS API: renderer API related utilities~processRendererNotify(message) ⇒
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-This method takes a message and checks if it's a renderer API
-notification call. If it is, it processe it and returns true.
-If it's not it returns false.
+ http://www.apache.org/licenses/LICENSE-2.0
-**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
-**Returns**: true if message was a notify message and was consumed.
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-| Param | Type |
-| ------- | --------------- |
-| message | \*
|
+**Kind**: global constant
+
-
+## fs
-### JS API: renderer API related utilities~reportFiles(browserWindow, result)
+Copyright (c) 2020 Silicon Labs
-This method calls the reportFiles renderer API call.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
+ http://www.apache.org/licenses/LICENSE-2.0
-| Param | Type |
-| ------------- | --------------- |
-| browserWindow | \*
|
-| result | \*
|
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-
+**Kind**: global constant
+
-### JS API: renderer API related utilities~getUserKeyFromCookieValue(cookieValue) ⇒
+## fs
-Returns cookie for user identification.
+Copyright (c) 2020 Silicon Labs
-**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
-**Returns**: cookie value used for user identification
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
-| Param | Type |
-| ----------- | --------------- |
-| cookieValue | \*
|
+ http://www.apache.org/licenses/LICENSE-2.0
-
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
-### JS API: renderer API related utilities~getUserKeyFromBrowserCookie(browserCookie)
+**Kind**: global constant
+
-Returns the session key
+## initAndConnectClient() ⇒
-**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
+Initializes and connects a client.
-| Param | Type | Description |
-| ------------- | --------------- | ----------- |
-| browserCookie | \*
| object |
+**Kind**: global function
+**Returns**: a promise which resolves when client connects
+
-
+## on(eventType, handler)
-### JS API: renderer API related utilities~getUserKeyFromBrowserWindow(browserWindow)
+Register a handler for the event type.
-Returns a promise that resolves into the session key.
+**Kind**: global function
-**Kind**: inner method of [JS API: renderer API related utilities
](#module*JS API* renderer API related utilities)
+| Param | Type |
+| --------- | --------------- |
+| eventType | \*
|
+| handler | \*
|
-| Param | Type |
-| ------------- | --------------- |
-| browserWindow | \*
|
+
-
+## lastPongData() ⇒
-## JS API: async reporting
+Get the last pong data.
-This module provides the mechanism for dealing with the async reporting
-from backend to the UI.
+**Kind**: global function
+**Returns**: last pong data or null if none is available
+
-This mechanism takes care of:
+## isClientConnected() ⇒
-- dirty flag
+Returns true if client is connected.
-* [JS API: async reporting](#module*JS API* async reporting)
- - [~sendDirtyFlagStatus(db, session)](#module*JS API* async reporting..sendDirtyFlagStatus)
- - [~startAsyncReporting(db, intervalMs)](#module*JS API* async reporting..startAsyncReporting)
- - [~stopAsyncReporting()](#module*JS API* async reporting..stopAsyncReporting)
+**Kind**: global function
+**Returns**: true if client is connected
+
-
+## disconnectClient()
-### JS API: async reporting~sendDirtyFlagStatus(db, session)
+Disconnects a client asynchronously.
-Sends a dirty flag status for a single session.
+**Kind**: global function
+
-**Kind**: inner method of [JS API: async reporting
](#module*JS API* async reporting)
+## emit(key, object)
-| Param | Type |
-| ------- | --------------- |
-| db | \*
|
-| session | \*
|
+Sends a message to server.
-
+**Kind**: global function
-### JS API: async reporting~startAsyncReporting(db, intervalMs)
+| Param | Type |
+| ------ | --------------- |
+| key | \*
|
+| object | \*
|
-Start the interval that will check and report dirty flags.
+
-**Kind**: inner method of [JS API: async reporting
](#module*JS API* async reporting)
+## selectAllDiscriminators(db, packageIds) ⇒
+
+**Kind**: global function
+**Returns**: all the data type discriminator information
| Param | Type |
| ---------- | --------------- |
| db | \*
|
-| intervalMs | \*
|
-
-
-
-### JS API: async reporting~stopAsyncReporting()
-
-Stop the interval that will check and report dirty flags
-
-**Kind**: inner method of [JS API: async reporting
](#module*JS API* async reporting)
-
+| packageIds | \*
|
-## JS API: post-import.
+
-This module contains the API functions for the post-load
-scripting functionality.
+## selectDataTypeById(db, id) ⇒
-
+Gathers the data type information of an entry based on data type id along
+with its actual type from disciminator table.
-## JS API: SDK utilities
+**Kind**: global function
+**Returns**: Data type information
-
+| Param |
+| ----- |
+| db |
+| id |
-### JS API: SDK utilities~readSdkJson(sdkPath, logger)
+
-This function reads in the sdk.json that is passed as sdkPath,
-and resolve the promise with the sdk object.
-logger is used for printouts.
+## selectDataTypeByName(db, name, packageIds) ⇒
-**Kind**: inner method of [JS API: SDK utilities
](#module*JS API* SDK utilities)
+Gathers the data type information of an entry based on data type name along
+with its actual type from disciminator table.
-| Param | Type |
-| ------- | --------------- |
-| sdkPath | \*
|
-| logger | \*
|
+**Kind**: global function
+**Returns**: Data type information
-
+| Param |
+| ---------- |
+| db |
+| name |
+| packageIds |
-## JS API: type related utilities
+
-- [JS API: type related utilities](#module*JS API* type related utilities)
- - [~typeSize(db, zclPackageId, type)](#module*JS API* type related utilities..typeSize)
- - [~typeSizeAttribute(db, zclPackageIds, at, [defaultValue])](#module*JS API* type related utilities..typeSizeAttribute) ⇒
- - [~convertFloatToBigEndian(value, size)](#module*JS API* type related utilities..convertFloatToBigEndian) ⇒
- - [~convertIntToBigEndian(value, size)](#module*JS API* type related utilities..convertIntToBigEndian) ⇒
- - [~longTypeDefaultValue(size, type, value)](#module*JS API* type related utilities..longTypeDefaultValue) ⇒
- - [~convertToCliType(str)](#module*JS API* type related utilities..convertToCliType) ⇒
- - [~isString(type)](#module*JS API* type related utilities..isString) ⇒
- - [~isFloat(type)](#module*JS API* type related utilities..isFloat) ⇒
- - [~isSignedInteger(type)](#module*JS API* type related utilities..isSignedInteger) ⇒
- - [~isOneBytePrefixedString(type)](#module*JS API* type related utilities..isOneBytePrefixedString) ⇒
- - [~isTwoBytePrefixedString(type)](#module*JS API* type related utilities..isTwoBytePrefixedString) ⇒
- - [~getSignAndSizeOfZclType(type, context, options)](#module*JS API* type related utilities..getSignAndSizeOfZclType) ⇒
+## selectDataTypeByNameAndClusterId(db, name, clusterId, packageIds) ⇒
-
+Gathers the data type information based on data type name and
+clusterId along with its actual type from disciminator table.
-### JS API: type related utilities~typeSize(db, zclPackageId, type)
+**Kind**: global function
+**Returns**: Data type information
-This function resolves with the size of a given type.
--1 means that this size is variable.
+| Param |
+| ---------- |
+| db |
+| name |
+| clusterId |
+| packageIds |
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
+
-| Param | Type |
-| ------------ | --------------- |
-| db | \*
|
-| zclPackageId | \*
|
-| type | \*
|
+## selectAllDataTypes(db, packageId) ⇒
-
+Gathers All the data types
-### JS API: type related utilities~typeSizeAttribute(db, zclPackageIds, at, [defaultValue]) ⇒
+**Kind**: global function
+**Returns**: All data types
-Returns the size of a real attribute, taking type size and defaults
-into consideration, so that strings are properly sized.
+| Param |
+| --------- |
+| db |
+| packageId |
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: Promise that resolves into the size of the attribute.
+
-| Param | Type | Default |
-| -------------- | --------------- | ------------- |
-| db | \*
| |
-| zclPackageIds | \*
| |
-| at | \*
| |
-| [defaultValue] | \*
|
|
+## selectSizeFromType(db, packageIds, value) ⇒
-
+Return the size of the given value whether it be a reference to it in the data
+type table in the form of a number or be it the name of the type in the form
+if string.
-### JS API: type related utilities~convertFloatToBigEndian(value, size) ⇒
+**Kind**: global function
+**Returns**: The size of the given value
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: The big endian value for a given float value padded with
-the given size. The value is returned in hex format and prefixed with '0x'.
+| Param | Type |
+| ---------- | --------------- |
+| db | \*
|
+| packageIds | \*
|
+| value | \*
|
-| Param | Type |
-| ----- | --------------- |
-| value | \*
|
-| size | \*
|
+
-
+## selectNumberByName(db, name, packageIds) ⇒
-### JS API: type related utilities~convertIntToBigEndian(value, size) ⇒
+Select an number matched by name.
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: The big endian value for a given integer value padded with
-the given size. The value is returned in hex format and prefixed with '0x'.
+**Kind**: global function
+**Returns**: number or undefined
-| Param | Type |
-| ----- | --------------- |
-| value | \*
|
-| size | \*
|
+| Param |
+| ---------- |
+| db |
+| name |
+| packageIds |
-
+
-### JS API: type related utilities~longTypeDefaultValue(size, type, value) ⇒
+## selectNumberByNameAndClusterId(db, name, packageIds) ⇒
-If the type is more than 2 bytes long, then this method creates
-the default byte array.
+Select a number matched by name and clusterId
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: string which is a C-formatted byte array.
+**Kind**: global function
+**Returns**: number information or undefined
-| Param | Type | Description |
-| ----- | --------------- | ------------------------ |
-| size | \*
| Size of bytes generated. |
-| type | \*
| Type of the object. |
-| value | \*
| Default value. |
+| Param |
+| ---------- |
+| db |
+| name |
+| packageIds |
-
+
-### JS API: type related utilities~convertToCliType(str) ⇒
+## selectNumberById(db, name) ⇒
-Conversion to a CLI type. THis is here temporarily until we come up
-with a proper type engine.
+Select an number matched by id.
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: converted type
+**Kind**: global function
+**Returns**: number or undefined
-| Param | Type |
-| ----- | --------------- |
-| str | \*
|
+| Param |
+| ----- |
+| db |
+| name |
-
+
-### JS API: type related utilities~isString(type) ⇒
+## selectAllNumbers(db, packageId) ⇒
-Returns true if a given ZCL type is a string type.
+Select all numbers.
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: true if type is string, false otherwise
+**Kind**: global function
+**Returns**: All numbers
-| Param | Type |
-| ----- | --------------- |
-| type | \*
|
+| Param |
+| --------- |
+| db |
+| packageId |
-
+
-### JS API: type related utilities~isFloat(type) ⇒
+## selectAllStrings(db, packageId) ⇒
-Returns true if a given ZCL type is a float type.
+Select all Strings.
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: true if type is float, false otherwise
+**Kind**: global function
+**Returns**: All Strings
-| Param | Type |
-| ----- | --------------- |
-| type | \*
|
+| Param |
+| --------- |
+| db |
+| packageId |
-
+
-### JS API: type related utilities~isSignedInteger(type) ⇒
+## selectStringById(db, packageId) ⇒
-Returns true if a given ZCL type is a signed integer.
+Select String by ID.
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: true if type is signed integer, false otherwise
+**Kind**: global function
+**Returns**: String
-| Param | Type |
-| ----- | --------------- |
-| type | \*
|
+| Param |
+| --------- |
+| db |
+| packageId |
-
+
-### JS API: type related utilities~isOneBytePrefixedString(type) ⇒
+## selectStringByName(db, name, packageIds) ⇒
-Checks if type is a one-byte lengh string.
+Select String by name.
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: true if the said type is a string prefixed by one byte length
+**Kind**: global function
+**Returns**: String
-| Param | Type |
-| ----- | --------------- |
-| type | \*
|
+| Param |
+| ---------- |
+| db |
+| name |
+| packageIds |
-
+
-### JS API: type related utilities~isTwoBytePrefixedString(type) ⇒
+## attributeDefault() ⇒
-Checks if type is a two-byte lengh string.
+Valid within a cluster context, requires code.
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: true if the said type is a string prefixed by two byte length
+**Kind**: global function
+**Returns**: Produces attribute defaults.
+
-| Param | Type |
-| ----- | --------------- |
-| type | \*
|
+## if_command_arguments_exist(commandId, argument_return, no_argument_return)
-
+**Kind**: global function
-### JS API: type related utilities~getSignAndSizeOfZclType(type, context, options) ⇒
+| Param | Type | Description |
+| ------------------ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| commandId | \*
| |
+| argument_return | \*
| |
+| no_argument_return | \*
| If the command arguments for a command exist then returns argument_return else returns no_argument_return Example: {{if_command_arguments_exist [command-id] "," ""}} The above will return ',' if the command arguments for a command exist and will return nothing if the command arguments for a command do not exist. |
-Given a zcl device type returns its sign, size and zcl data type info stored
-in the database table.
-Note: Enums and Bitmaps are considered to be unsigned.
+
-**Kind**: inner method of [JS API: type related utilities
](#module*JS API* type related utilities)
-**Returns**: returns sign, size and info of zcl device type
-Available Options:
+## if_command_args_exist(commandId, options) ⇒
-- size: Determine whether to calculate the size of zcl device type in bits
- or bytes
- for eg: getSignAndSizeOfZclType('int8u' this size='bits') will return
- the size in bits which will be 8. If not mentioned then it will return the size
- in bytes i.e. 1 in this case.
+If helper which checks if command arguments exist for a command or not
+example:
+{{#if_command_args_exist commandId}}
+command arguments exist for the command
+{{else}}
+command arguments do not exist for the command
+{{/if_command_args_exist}}
-| Param | Type |
-| ------- | --------------- |
-| type | \*
|
-| context | \*
|
-| options | \*
|
+**Kind**: global function
+**Returns**: Returns content in the handlebar template based on whether the
+command arguments are present or not.
-
+| Param |
+| --------- |
+| commandId |
+| options |
-## JS API: random utilities
+
-- [JS API: random utilities](#module*JS API* random utilities)
- - [~checksum(data)](#module*JS API* random utilities..checksum) ⇒
- - [~ensurePackagesAndPopulateSessionOptions(db, sessionId, options:, selectedZclPropertyPackage, selectedGenTemplatePackages)](#module*JS API* random utilities..ensurePackagesAndPopulateSessionOptions) ⇒
- - [~createBackupFile(filePath)](#module*JS API* random utilities..createBackupFile)
- - [~matchFeatureLevel(featureLevel)](#module*JS API* random utilities..matchFeatureLevel)
- - [~sessionReport(db, sessionId)](#module*JS API* random utilities..sessionReport) ⇒
- - [~sessionDump(db, sessionId)](#module*JS API* random utilities..sessionDump) ⇒
- - [~executePromisesSequentially(arrayOfData, promiseCreator)](#module*JS API* random utilities..executePromisesSequentially)
- - [~createAbsolutePath(relativePath, relativity, zapFilePath)](#module*JS API* random utilities..createAbsolutePath)
- - [~locateRelativeFilePath(rootFileLocations, relativeFilePath)](#module*JS API* random utilities..locateRelativeFilePath) ⇒
- - [~executeExternalProgram(cmd)](#module*JS API* random utilities..executeExternalProgram)
- - [~getClusterExtensionDefault(extensions, extensionId, clusterCode)](#module*JS API* random utilities..getClusterExtensionDefault) ⇒
- - [~getClusterExtension(extensions, property, clusterCode)](#module*JS API* random utilities..getClusterExtension) ⇒
- - [~createUuid()](#module*JS API* random utilities..createUuid)
- - [~waitFor(time)](#module*JS API* random utilities..waitFor)
- - [~parseXml(fileContent)](#module*JS API* random utilities..parseXml) ⇒
- - [~readFileContentAndCrc(metadata)](#module*JS API* random utilities..readFileContentAndCrc) ⇒
- - [~duration(nsDifference)](#module*JS API* random utilities..duration) ⇒
- - [~mainOrSecondaryInstance()](#module*JS API* random utilities..mainOrSecondaryInstance)
- - [~collectJsonData(jsonFile)](#module*JS API* random utilities..collectJsonData)
+## if_ca_always_present_with_presentif(commandArg, trueReturn, falseReturn) ⇒
-
+**Kind**: global function
+**Returns**: trueReturn if command argument is always present and there is a
+presentIf condition else returns false
-### JS API: random utilities~checksum(data) ⇒
+| Param |
+| ----------- |
+| commandArg |
+| trueReturn |
+| falseReturn |
-Returns the CRC of the data that is passed.
+
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Returns**: Calculated CRC of a data.
+## if_command_arg_always_present_with_presentif(commandArg, options) ⇒
-| Param | Type |
-| ----- | --------------- |
-| data | \*
|
+If helper that checks if a command argument is always present with a
+presentIf condition.
+example:
+{{#if_command_arg_always_present_with_presentif commandArg}}
+command argument has a presentIf condition
+{{else}}
+command argument does not have a presentIf condition
+{{/if_command_arg_always_present_with_presentif}}
-
+**Kind**: global function
+**Returns**: Returns content in the handlebar template based on the command
+argument having a presentIf condition or not
-### JS API: random utilities~ensurePackagesAndPopulateSessionOptions(db, sessionId, options:, selectedZclPropertyPackage, selectedGenTemplatePackages) ⇒
+| Param |
+| ---------- |
+| commandArg |
+| options |
-This function assigns a proper package ID to the session if there
-are no packages present. It will also populate session options.
+
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Returns**: Promise that resolves with the packages array.
+## if_command_is_not_fixed_length_but_command_argument_is_always_present(command, commandArg, trueReturn, falseReturn) ⇒
-| Param | Type | Description |
-| --------------------------- | --------------- | -------------------------------------- |
-| db | \*
| |
-| sessionId | \*
| |
-| options: | \*
| object containing 'zcl' and 'template' |
-| selectedZclPropertyPackage | \*
| |
-| selectedGenTemplatePackages | \*
| |
+**Kind**: global function
+**Returns**: trueReturn if command is not fixed length but command argument is
+always present else returns falseReturn
-
+| Param |
+| ----------- |
+| command |
+| commandArg |
+| trueReturn |
+| falseReturn |
-### JS API: random utilities~createBackupFile(filePath)
+
-Move database file out of the way into the backup location.
+## if_command_not_fixed_length_command_argument_always_present(command, commandArg, options) ⇒
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+If helper that checks if command is not fixed lenth and that the command is
+always present.
+example:
+{{#if_command_not_fixed_length_command_argument_always_present commandId}}
+command is not fixed length and command argument is always present
+{{else}}
+either command is fixed length or command argument is not always present
+{{/if_command_not_fixed_length_command_argument_always_present}}
-| Param | Type |
-| -------- | --------------- |
-| filePath | \*
|
+**Kind**: global function
+**Returns**: Returns content in the handlebar template based on the command being
+fixed length or not and whether the command argument is always present
-
+| Param |
+| ---------- |
+| command |
+| commandArg |
+| options |
-### JS API: random utilities~matchFeatureLevel(featureLevel)
+
-Returns an object that contains:
-match: true or false if featureLevel is matched or not.
-message: in case of missmatch, the message shown to user.
+## if_ca_not_always_present_no_presentif(commandArg, trueReturn, falseReturn) ⇒
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+**Kind**: global function
+**Returns**: trueReturn if command argument is not always present and there is no
+presentIf condition else returns false
-| Param | Type |
-| ------------ | --------------- |
-| featureLevel | \*
|
+| Param |
+| ----------- |
+| commandArg |
+| trueReturn |
+| falseReturn |
-
+
-### JS API: random utilities~sessionReport(db, sessionId) ⇒
+## if_command_arg_not_always_present_no_presentif(commandArg, options) ⇒
-Produces a text dump of a session data for human consumption.
+If helper that checks if a command argument is not always present because it
+has a introduced in or removed in clause. The helper also checks that there
+is no presentIf condition.
+example:
+{{#if_command_arg_not_always_present_no_presentif commandArg}}
+command argument is not always present and there is no presentIf condition
+{{else}}
+Either command argument is always present or there is a presentIf condition
+{{/if_command_arg_not_always_present_no_presentif}}
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Returns**: promise that resolves into a text report for the session.
+**Kind**: global function
+**Returns**: Returns content in the handlebar template based on the command
+argument being present and if there is a presentIf condition.
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param |
+| ---------- |
+| commandArg |
+| options |
-
+
-### JS API: random utilities~sessionDump(db, sessionId) ⇒
+## if_ca_not_always_present_with_presentif(commandArg, trueReturn, falseReturn) ⇒
-Produces a text dump of a session data for human consumption.
+**Kind**: global function
+**Returns**: trueReturn if command argument is not always present and there is a
+presentIf condition else returns false
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Returns**: promise that resolves into a text report for the session.
+| Param |
+| ----------- |
+| commandArg |
+| trueReturn |
+| falseReturn |
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+
-
+## if_command_arg_not_always_present_with_presentif(commandArg, options) ⇒
-### JS API: random utilities~executePromisesSequentially(arrayOfData, promiseCreator)
+If helper that checks if a command argument is not always present because it
+has a introduced in or removed in clause. The helper also checks that there
+is a presentIf condition.
+example:
+{{#if_command_arg_not_always_present_with_presentif commandArg}}
+command argument is not always present and there is a presentIf condition
+{{else}}
+Either command argument is always present or there is no presentIf condition
+{{/if_command_arg_not_always_present_with_presentif}}
-If you have an array of arguments, and a function that creates
-a promise out of each of those arguments, this function
-executes them sequentially, one by one.
+**Kind**: global function
+**Returns**: Returns content in the handlebar template based on the command
+argument being present and if there is a presentIf condition.
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+| Param |
+| ---------- |
+| commandArg |
+| options |
-| Param | Type |
-| -------------- | --------------- |
-| arrayOfData | \*
|
-| promiseCreator | \*
|
+
-
+## if_command_is_fixed_length(commandId, fixedLengthReturn, notFixedLengthReturn)
-### JS API: random utilities~createAbsolutePath(relativePath, relativity, zapFilePath)
+**Kind**: global function
-This function creates absolute path out of relative path and its relativity
+| Param | Description |
+| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| commandId | |
+| fixedLengthReturn | |
+| notFixedLengthReturn | Returns fixedLengthReturn or notFixedLengthReturn based on whether the command is fixed length or not. Also checks if the command arguments are always present or not. |
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+
-| Param | Type |
-| ------------ | --------------- |
-| relativePath | \*
|
-| relativity | \*
|
-| zapFilePath | \*
|
+## if_command_fixed_length(commandId, options)
-
+If helper which checks if a command is fixed length or not
-### JS API: random utilities~locateRelativeFilePath(rootFileLocations, relativeFilePath) ⇒
+example:
+{{#if_command_fixed_length commandId}}
+command is fixed length
+{{else}}
+command is not fixed length
+{{/if_command_fixed_length}}
-This method takes an array of root locations and a relative path.
-It will attempt to locate an absolute file at the path, combining
-the root location and a relative path, until a file is found and returned.
+**Kind**: global function
-If none of the combined root locations and relative paths results
-in an actual file, null is returned.
+| Param | Description |
+| --------- | ----------------------------------------------------------------------------------------------------------------------- |
+| commandId | |
+| options | Returns content in the handlebar template based on the command being fixed length or not as shown in the example above. |
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Returns**: A fully resolved path that exists, or null if none is available.
+
-| Param | Type | Description |
-| ----------------- | --------------- | --------------------------------------------------- |
-| rootFileLocations | \*
| Array of root file locations, typically directories |
-| relativeFilePath | \*
| Relative path |
+## endpoint_type_count(options) ⇒
-
+Returns number of endpoint types.
-### JS API: random utilities~executeExternalProgram(cmd)
+**Kind**: global function
+**Returns**: number of endpoint types
-Returns a promise of an execution of an external program.
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+
-| Param | Type |
-| ----- | --------------- |
-| cmd | \*
|
+## endpoint_count(options) ⇒
-
+Returns number of endpoints.
-### JS API: random utilities~getClusterExtensionDefault(extensions, extensionId, clusterCode) ⇒
+**Kind**: global function
+**Returns**: number of endpoints
-Retrieve specific entry from extensions defaults(array) via 'clusterCode' key fields
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Returns**: Value of the cluster extension property.
-**Parem**: \*
clusterRole: one of server/client enums, or null for either.
+
-| Param | Type | Description |
-| ----------- | --------------- | ----------------------------------- |
-| extensions | \*
| |
-| extensionId | \*
| field name under specific extension |
-| clusterCode | \*
| search key |
+## endpoint_config_macros() ⇒
-
+Prints out all the macros that the endpoint config
+configuration depends on. These macros are created
+by ZAP, because the use of these macros is also
+created by ZAP.
-### JS API: random utilities~getClusterExtension(extensions, property, clusterCode) ⇒
+**Kind**: global function
+**Returns**: Macros that need to be created
+
-Retrieve specific entry from extensions defaults(array) via 'clusterCode' key fields
+## endpoint_fixed_endpoint_array(options) ⇒
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Returns**: Object containing all attribuetes specific to the extension
+Creates array of endpointId fields on endpoints
-| Param | Type | Description |
-| ----------- | --------------- | ----------------------------------- |
-| extensions | \*
| |
-| property | \*
| field name under specific extension |
-| clusterCode | \*
| search key |
+**Kind**: global function
+**Returns**: C array including the brackets
-
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-### JS API: random utilities~createUuid()
+
-Global way how to get an UUID.
+## endpoint_fixed_profile_id_array(options) ⇒
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-
+Creates array of profileId fields on endpoints
-### JS API: random utilities~waitFor(time)
+**Kind**: global function
+**Returns**: C array including the brackets
-Returns a promise that resolves after time milliseconds
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+
-| Param |
-| ----- |
-| time |
+## endpoint_fixed_parent_id_array() ⇒
-
+Creates Integer Array of parent endpoint identifier fields on endpoints. If the Parent Endpoint is not set then it will default to 0.
-### JS API: random utilities~parseXml(fileContent) ⇒
+**Kind**: global function
+**Returns**: C array including the brackets
+
-Returns a promise that resolve into a parsed XML object.
+## endpoint_fixed_network_array(options) ⇒
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Returns**: promise that resolves into parsed object.
+Creates array of networkId fields on endpoints
-| Param | Type |
-| ----------- | --------------- |
-| fileContent | \*
|
+**Kind**: global function
+**Returns**: C array including the brackets
-
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-### JS API: random utilities~readFileContentAndCrc(metadata) ⇒
+
-Reads the properties file and returns object containing
-'data', 'filePath' and 'crc'
+## endpoint_fixed_endpoint_type_array(options) ⇒
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Returns**: Promise to populate data, filePath and crc into the context.
+Each element of an array contains an index into the
+endpoint type array, for the appropriate endpoint.
-| Param | Type | Description |
-| -------- | --------------- | ----------- |
-| metadata | \*
| file |
+**Kind**: global function
+**Returns**: C array of indexes, one for each endpoint.
-
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-### JS API: random utilities~duration(nsDifference) ⇒
+
-This method takes a nanosecond duration and prints out
-decently human readable time out of it.
+## endpoint_attribute_manufacturer_codes(options) ⇒
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-**Returns**: String with human readable time duration.
+Generates array of { index , mfgCode } pairs, matching
+the indexes in attribute table.
-| Param | Type |
-| ------------ | --------------- |
-| nsDifference | \*
|
+**Kind**: global function
+**Returns**: manufacturer code array
-
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-### JS API: random utilities~mainOrSecondaryInstance()
+
-This method returns true if the running instance is the first
-and main instance of the zap, and false if zap instance is already
-running.
+## endpoint_reporting_config_defaults(options)
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
-
+This helper supports an "order" CSV string, such as:
+"direction,endpoint,clusterId,attributeId,mask,mfgCode,minmax"
+The string above is a default value, and it determines in what order are the fields generated.
-### JS API: random utilities~collectJsonData(jsonFile)
+**Kind**: global function
-Utility method that collects data from a JSON file.
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-JSON file is formatted as a bunch of keyed strings:
-"someKey": [ "a", "b", "c"]
-Then it supports following special keys:
-"include": "path/to/json/file" - includes the said JSON file
-"disable": [ "x", "y" ...] - disables the specified data points
-"collection": ["key", "key2", ...] - collects final list of data points
+
-**Kind**: inner method of [JS API: random utilities
](#module*JS API* random utilities)
+## collectAttributes()
-| Param | Type |
-| -------- | --------------- |
-| jsonFile | \*
|
+Attribute collection works like this:
+1.) Go over all the clusters that exist.
+2.) If client is included on at least one endpoint add client atts.
+3.) If server is included on at least one endpoint add server atts.
-
+**Kind**: global function
+
-## REST API: various zcl utilities
+## collectAttributeSizes(db, zclPackageIds, endpointTypes) ⇒
-This module provides the API to access various zcl utilities.
+This function goes over all the attributes and populates sizes.
-- [REST API: various zcl utilities](#module*REST API* various zcl utilities)
- - [~clusterComparator(a, b)](#module*REST API* various zcl utilities..clusterComparator) ⇒
- - [~attributeComparator(a, b)](#module*REST API* various zcl utilities..attributeComparator) ⇒
- - [~commandComparator(a, b)](#module*REST API* various zcl utilities..commandComparator) ⇒
- - [~eventComparator(a, b)](#module*REST API* various zcl utilities..eventComparator) ⇒
- - [~sortStructsByDependency(structs)](#module*REST API* various zcl utilities..sortStructsByDependency) ⇒
- - [~calculateBytes(res, options, db, packageIds, isStructType)](#module*REST API* various zcl utilities..calculateBytes)
- - [~optionsHashOrDefault(options, optionsKey, defaultValue)](#module*REST API* various zcl utilities..optionsHashOrDefault)
- - [~dataTypeCharacterFormatter(db, packageIds, type, options, resType)](#module*REST API* various zcl utilities..dataTypeCharacterFormatter)
- - [~isEnum(db, enum_name, packageIds)](#module*REST API* various zcl utilities..isEnum) ⇒
- - [~isStruct(db, struct_name, packageIds)](#module*REST API* various zcl utilities..isStruct) ⇒
- - [~isEvent(db, event_name, packageId)](#module*REST API* various zcl utilities..isEvent) ⇒
- - [~isBitmap(db, bitmap_name, packageIds)](#module*REST API* various zcl utilities..isBitmap) ⇒
- - [~defaultMessageForTypeConversion(fromType, toType, noWarning)](#module*REST API* various zcl utilities..defaultMessageForTypeConversion)
- - [~dataTypeHelper(type, options, packageIds, db, resolvedType, overridable)](#module*REST API* various zcl utilities..dataTypeHelper) ⇒
- - [~asUnderlyingZclTypeWithPackageId(type, options, packageIds, currentInstance)](#module*REST API* various zcl utilities..asUnderlyingZclTypeWithPackageId)
- - [~determineType(db, type, packageIds)](#module*REST API* various zcl utilities..determineType)
- - [~zcl_data_type_size_and_sign(type, dataType, clusterId, packageIds, context)](#module*REST API* various zcl utilities..zcl_data_type_size_and_sign) ⇒
+**Kind**: global function
+**Returns**: promise that resolves with the passed endpointTypes, after populating the attribute type sizes.
-
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| zclPackageIds | \*
|
+| endpointTypes | \*
|
-### REST API: various zcl utilities~clusterComparator(a, b) ⇒
+
-Comparator for sorting clusters.
+## collectAttributeTypeInfo(db, zclPackageIds, endpointTypes) ⇒
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: -1, 0 or 1
+This function goes over all attributes and populates atomic types.
-| Param | Type |
-| ----- | --------------- |
-| a | \*
|
-| b | \*
|
+**Kind**: global function
+**Returns**: promise that resolves with the passed endpointTypes, after populating the attribute atomic types.
-
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| zclPackageIds | \*
|
+| endpointTypes | \*
|
-### REST API: various zcl utilities~attributeComparator(a, b) ⇒
+
-Comparator for sorting attribute.
+## endpoint_config(options) ⇒
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: -1, 0 or 1
+Starts the endpoint configuration block.,
+longDefaults: longDefaults
-| Param | Type |
-| ----- | --------------- |
-| a | \*
|
-| b | \*
|
+**Kind**: global function
+**Returns**: a promise of a rendered block
-
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-### REST API: various zcl utilities~commandComparator(a, b) ⇒
+
-Comparator for sorting commands.
+## ifFuture(options)
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: -1, 0 or 1
+Block helper resolving the block if the
+value of the specified future matches.
-| Param | Type |
-| ----- | --------------- |
-| a | \*
|
-| b | \*
|
+**Kind**: global function
-
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-### REST API: various zcl utilities~eventComparator(a, b) ⇒
+
-Comparator for sorting events.
+## setFuture(options)
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: -1, 0 or 1
+This method sets the value of the future.
+Use it as:
+{{set_future name="NAME" value="VALUE"}}
-| Param | Type |
-| ----- | --------------- |
-| a | \*
|
-| b | \*
|
+**Kind**: global function
-
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-### REST API: various zcl utilities~sortStructsByDependency(structs) ⇒
+
-This method retrieves a bunch of structs sorted
-alphabetically. It's expected to resort the structs into a list
-where they are sorted in a way where dependency is observed.
+## future(options)
-It uses the DFS-based topological sort algorithm.
+This method defines the future with a given name.
+Use it as: {{future name="NAME"}}
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: sorted structs according to topological search.
+**Kind**: global function
| Param | Type |
| ------- | --------------- |
-| structs | \*
|
+| options | \*
|
-
+
-### REST API: various zcl utilities~calculateBytes(res, options, db, packageIds, isStructType)
+## tokens_context()
-This function calculates the number of bytes in the data type and based on
-that returns the option specified in the template.
-for eg: Given that options are as follows:
-options.hash.array="b"
-options.hash.one_byte="u"
-options.hash.two_byte="v"
-options.hash.three_byte="x"
-options.hash.four_byte="w"
-options.hash.short_string="s"
-options.hash.long_string="l"
-options.hash.default="b"
+This function builds creates a new context from the endpoint_config structure
+for use in the zap-tokens.h template. The endpoint_config context provides a
+list of endpoints, and endpointTypes, where each endpointType contains a list
+of clusters, and each cluster contains a list of attributes. However, the
+tokens template requires a list of attributes per endpoint, and per cluster,
+discriminating from singletons and non-singletons, so this function performs
+the required grouping.
-calculateBytes("char_string", options)
-will return 's'
+While each attribute contains an isSingleton attribute, the database schema
+allows for the same attribute to be returned both as singleton and non-singleton
+in different clusters, for different endpoints. In consequence, care must be
+taken to remove the singletons from the cluster and endpoint attribute lists.
+This is done in two steps, the first loop creates a global (context) list of
+singletons and non-singletons, and the second loop removes the singletons from
+the endpoint, and clusters.
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+Clusters from different endpoints may have different attributes, therefore each
+endpoint keeps a separate list of clusters. Additionally, a context-level
+map of clusters is required in order to gather all attributes (singletons and
+non-singletons) from all endpoint clusters.
-| Param | Type |
-| ------------ | --------------- |
-| res | \*
|
-| options | \*
|
-| db | \*
|
-| packageIds | \*
|
-| isStructType | \*
|
+**Kind**: global function
+
-
+## token_next()
-### REST API: various zcl utilities~optionsHashOrDefault(options, optionsKey, defaultValue)
+The token template assigns an unique ID to each unique attribute. These IDs
+span all attributes from all clusters from all endpointTypes. This helper
+function allows the template to increment the token ID within the tokens context.
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Kind**: global function
+
-| Param | Description |
-| ------------ | --------------------------------------------------------------------------------- |
-| options | |
-| optionsKey | |
-| defaultValue | Given the values determine to give the user defined value or the calculated value |
+## token_attribute_util(context, options) ⇒
-
+Util function that extracts all the token attribute information.
-### REST API: various zcl utilities~dataTypeCharacterFormatter(db, packageIds, type, options, resType)
+**Kind**: global function
+**Returns**: Information on all token attributes in the configuration.
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
+| options | \*
|
-| Param | Type | Description |
-| ---------- | --------------- | ------------------------------------------ |
-| db | \*
| |
-| packageIds | \*
| |
-| type | \*
| |
-| options | \*
| |
-| resType | \*
| Character associated to a zcl/c data type. |
+
-
+## token_attributes(endpointTypeRef, options) ⇒
-### REST API: various zcl utilities~isEnum(db, enum_name, packageIds) ⇒
+Get information about all the token attributes in the configuration or this
+helper can be used within an endpoint block helper to fetch the
+corresponding token attributes based on endpoint type given.
+Available Options:
+isSingleton: 0/1, option can be used to filter attributes based on singleton
+or non-singleton(Available with endpointTypeRef only)
-Local function that checks if an enum by the name exists
+**Kind**: global function
+**Returns**: singleton and non-singleton token attributes along with their
+endpoint information. Singleton attributes are only returned once whereas
+non-singleton attributes are returned per endpoint. However if used within
+an endpoint block helper it returns token_attributes for a given endpoint
+type.
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: Promise of content.
+| Param | Type |
+| --------------- | --------------- |
+| endpointTypeRef | \*
|
+| options | \*
|
-| Param | Type |
-| ---------- | --------------- |
-| db | \*
|
-| enum_name | \*
|
-| packageIds | \*
|
+
-
+## token_attribute_clusters(endpointTypeRef, options) ⇒
+
+This helper can return all token associated clusters across endpoints or
+this helper can be used within an endpoint block helper to fetch the
+corresponding token associated clusters.
+Available Options:
+isSingleton: 0/1, option can be used to filter clusters based on singleton
+or non-singleton attributes.
+
+**Kind**: global function
+**Returns**: Token associated clusters for a particular endpoint type or all
+token associated clusters across endpoints.
-### REST API: various zcl utilities~isStruct(db, struct_name, packageIds) ⇒
+| Param | Type |
+| --------------- | --------------- |
+| endpointTypeRef | \*
|
+| options | \*
|
-Local function that checks if a struct by the name exists
+
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: Promise of content.
+## token_attribute_endpoints(options) ⇒
-| Param | Type |
-| ----------- | --------------- |
-| db | \*
|
-| struct_name | \*
|
-| packageIds | \*
|
+Get all endpoints which have token attributes in the configuration.
+AvailableOptions:
-
+- isSingleton: 0/1, option can be used to filter endpoints based on singleton
+ or non-singleton.
-### REST API: various zcl utilities~isEvent(db, event_name, packageId) ⇒
+**Kind**: global function
+**Returns**: all endpoints with token attributes
-Function that checks if a given thing is an avent.
+| Param | Type |
+| ------- | --------------- |
+| options | \*
|
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: Promise of content.
+
-| Param | Type |
-| ---------- | --------------- |
-| db | \*
|
-| event_name | \*
|
-| packageId | \*
|
+## get_cli_size(size, type, allowZclTypes) ⇒
-
+**Kind**: global function
+**Returns**: The size in bits for a cli type based on allowZclTypes
-### REST API: various zcl utilities~isBitmap(db, bitmap_name, packageIds) ⇒
+| Param | Type |
+| ------------- | --------------- |
+| size | \*
|
+| type | \*
|
+| allowZclTypes | \*
|
-Local function that checks if a bitmap by the name exists
+
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: Promise of content.
+## zcl_command_argument_type_to_cli_data_type_util(type, cliPrefix, context, options) ⇒
-| Param | Type |
-| ----------- | --------------- |
-| db | \*
|
-| bitmap_name | \*
|
-| packageIds | \*
|
+**Kind**: global function
+**Returns**: the zcl cli data type string with the cli prefix given
+Additional Options:
-
+- isOptional option can be passed along with the command argument
+ to return optional command argument extension accordingly
+ eg:
+ #zcl_command_arguments
+ zcl_command_argument_type_to_zcl_cli_data_type type isOptional=isOptional
+ /zcl_command_arguments
-### REST API: various zcl utilities~defaultMessageForTypeConversion(fromType, toType, noWarning)
+| Param | Type |
+| --------- | --------------- |
+| type | \*
|
+| cliPrefix | \*
|
+| context | \*
|
+| options | \*
|
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+
-| Param | Type | Description |
-| --------- | --------------- | --------------------------------------------------------------------------------------------- |
-| fromType | \*
| |
-| toType | \*
| |
-| noWarning | \*
| Type warning message. If noWarning is set to true then the warning message will not be shown. |
+## zcl_command_argument_type_to_cli_data_type(typeName, options)
-
+Helper that deals with the type of the argument.
-### REST API: various zcl utilities~dataTypeHelper(type, options, packageIds, db, resolvedType, overridable) ⇒
+**Kind**: global function
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: the data type associated with the resolvedType
+| Param | Type |
+| -------- | --------------- |
+| typeName | \*
|
+| options | \*
|
-| Param | Type |
-| ------------ | --------------- |
-| type | \*
|
-| options | \*
|
-| packageIds | \*
|
-| db | \*
|
-| resolvedType | \*
|
-| overridable | \*
|
+
-
+## zcl_command_argument_type_to_zcl_cli_data_type(typeName, options)
-### REST API: various zcl utilities~asUnderlyingZclTypeWithPackageId(type, options, packageIds, currentInstance)
+Helper that deals with the type of the argument.
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Kind**: global function
-| Param | Description |
-| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| type | |
-| options | |
-| packageIds | |
-| currentInstance | Note: If the options has zclCharFormatter set to true then the function will return the user defined data associated with the zcl data type and not the actual data type. It can also be used to calculate the size of the data types This is a utility function which is called from other helper functions using ut current instance. See comments in asUnderlyingZclType for usage instructions. |
+| Param | Type |
+| -------- | --------------- |
+| typeName | \*
|
+| options | \*
|
-
+
-### REST API: various zcl utilities~determineType(db, type, packageIds)
+## integrationEnabled(db, sessionId) ⇒
-Returns a promise that resolves into an object containing:
-type:
-atomicType:
-Base type for struct is a null.
+Boolean deciding whether Studio integration logic should be enabled
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
+**Kind**: global function
+**Returns**: Promise to studio project path
-| Param | Type |
-| ---------- | --------------- |
-| db | \*
|
-| type | \*
|
-| packageIds | \*
|
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
-
+
-### REST API: various zcl utilities~zcl_data_type_size_and_sign(type, dataType, clusterId, packageIds, context) ⇒
+## isComponentTogglingDisabled(db, sessionId) ⇒
-**Kind**: inner method of [REST API: various zcl utilities
](#module*REST API* various zcl utilities)
-**Returns**: The size and sign of a zcl data type
+Resolves into true if user has actively disabled the component toggling.
+By default this row doesn't even exist in the DB, but if user toggles
+the toggle to turn this off, then the "disableComponentToggling" will
+be set so '1' in the database.
-| Param | Type |
-| ---------- | --------------- |
-| type | \*
|
-| dataType | \*
|
-| clusterId | \*
|
-| packageIds | \*
|
-| context | \*
|
+**Kind**: global function
+**Returns**: promise that resolves into a true or false, depending on whether the component toggling has been disabled manually.
-
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
-## renderer_api
+
-Copyright (c) 2020 Silicon Labs
+## restApiUrl(api, path, queryParams) ⇒
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+Studio REST API path helper/generator
- http://www.apache.org/licenses/LICENSE-2.0
+**Kind**: global function
+**Returns**: URL for rest api.
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+| Param |
+| ----------- |
+| api |
+| path |
+| queryParams |
-**Kind**: global variable
-
+
-## GLOBAL_SYMBOL_INFO
+## wsApiUrl(api, path, queryParams) ⇒
-Global symbol that carries the API info metadata
+Studio WebSocket API path helper/generator
-**Kind**: global variable
-
+**Kind**: global function
+**Returns**: URL for WS
-## GLOBAL_SYMBOL_EXECUTE
+| Param |
+| ----------- |
+| api |
+| path |
+| queryParams |
-Global function that can execute the APIs.
+
-**Kind**: global variable
-
+## getProjectInfo(db, sessionId) ⇒
-## GLOBAL_SYMBOL_NOTIFY
+Send HTTP GET request to Studio Jetty server for project information.
-Global function that can be overloaded by jxbrowser for notifications
+**Kind**: global function
+**Returns**: - HTTP RESP with project info in JSON form
-**Kind**: global variable
-
+| Param | Type |
+| --------- | --------------- |
+| db | |
+| sessionId | \*
|
-## uri
+
-Copyright (c) 2020 Silicon Labs
+## updateComponentByClusterIdAndComponentId(project, componentIds, add, db, sessionId, side) ⇒ \*
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+Send HTTP Post to update UC component state in Studio
- http://www.apache.org/licenses/LICENSE-2.0
+**Kind**: global function
+**Returns**: \*
- - [{id, status, data }]
+id - string,
+status - boolean. true if HTTP REQ status code is OK,
+data - HTTP response data field
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+| Param | Type |
+| ------------ | --------------- |
+| project | \*
|
+| componentIds | \*
|
+| add | \*
|
+| db | \*
|
+| sessionId | \*
|
+| side | \*
|
-**Kind**: global constant
-
+
-## dbApi
+## updateComponentByComponentIds(project, componentIds, add) ⇒ \*
-This module provides queries for discriminators
+Send HTTP Post to update UC component state in Studio
-**Kind**: global constant
-
+**Kind**: global function
+**Returns**: \*
- - [{id, status, data }]
+id - string,
+status - boolean. true if HTTP REQ status code is OK,
+data - HTTP response data field
-## dbApi
+| Param | Type | Description |
+| ------------ | --------------- | -------------------------------------------- |
+| project | \*
| local Studio project path |
+| componentIds | \*
| a list of component Ids |
+| add | \*
| true if adding component, false if removing. |
-This module provides queries for data types
+
-**Kind**: global constant
-
+## wsMessageHandler(db, session, message)
-## dbApi
+Handles WebSocket messages from Studio server
-This module provides queries for numbers
+**Kind**: global function
-**Kind**: global constant
-
+| Param |
+| ------- |
+| db |
+| session |
+| message |
-## dbApi
+
-This module provides queries for strings
+## initIdeIntegration()
-**Kind**: global constant
-
+Start the dirty flag reporting interval.
-## queryAccess
+**Kind**: global function
+
-Copyright (c) 2020 Silicon Labs
+## verifyWsConnection(db, sessionId)
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+Check WebSocket connections between backend and Studio jetty server.
+If project is opened, verify connection is open.
+If project is closed, close ws connection as well.
- http://www.apache.org/licenses/LICENSE-2.0
+**Kind**: global function
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+| Param |
+| --------- |
+| db |
+| sessionId |
-**Kind**: global constant
-
+
-## queryAttribute
+## wsConnect(sessionId, path) ⇒
-Copyright (c) 2020 Silicon Labs
+Utility function for making websocket connection to Studio server
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+**Kind**: global function
+**Returns**: websocket
- http://www.apache.org/licenses/LICENSE-2.0
+| Param |
+| --------- |
+| sessionId |
+| path |
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+
-**Kind**: global constant
-
+## isProjectActive(path)
-## queryZcl
+Check if a specific Studio project (.slcp) file has been opened or not.
-Copyright (c) 2020 Silicon Labs
+Context: To get proper WebSocket notification for change in project states,
+that specific project needs to be opened already. Otherwise, no notification
+will happen.
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+ DependsComponent API used as a quick way to check if the project is opened or not
+ If project is open/valid, the API will respond with "Component not found in project"
+ Otherwise, "Project does not exists"
- http://www.apache.org/licenses/LICENSE-2.0
+**Kind**: global function
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+| Param |
+| ----- |
+| path |
-**Kind**: global constant
-
+
-## queryCommand
+## deinitIdeIntegration()
-Copyright (c) 2021 Silicon Labs
+Clears up the reporting interval.
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+**Kind**: global function
+
- http://www.apache.org/licenses/LICENSE-2.0
+## sendSessionCreationErrorStatus(err)
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+Notify front-end that current session failed to load.
-**Kind**: global constant
-
+**Kind**: global function
-## cHelper
+| Param |
+| ----- |
+| err |
-Copyright (c) 2020 Silicon Labs
+
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+## sendComponentUpdateStatus(err)
- http://www.apache.org/licenses/LICENSE-2.0
+Notify front-end that current session failed to load.
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+**Kind**: global function
-**Kind**: global constant
-
+| Param | Type |
+| ----- | --------------- |
+| err | \*
|
-## futureKey
+
-Copyright (c) 2021 Silicon Labs
+## exportEndpointTypes(db, sessionId) ⇒
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+Resolves to an array of endpoint types.
- http://www.apache.org/licenses/LICENSE-2.0
+**Kind**: global function
+**Returns**: Promise to retrieve all endpoint types.
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
-**Kind**: global constant
-
+
-## dbEnum
+## exportSessionPackages(db, sessionId)
-Copyright (c) 2020 Silicon Labs
+Resolves with data for packages.
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+**Kind**: global function
- http://www.apache.org/licenses/LICENSE-2.0
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+
-**Kind**: global constant
-
+## exportDataIntoFile(db, sessionId, filePath) ⇒
-## templateUtil
+Toplevel file that takes a given session ID and exports the data into the file
-Copyright (c) 2020 Silicon Labs
+**Kind**: global function
+**Returns**: A promise that resolves with the path of the file written.
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| filePath | \*
|
- http://www.apache.org/licenses/LICENSE-2.0
+
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+## createStateFromDatabase(db, sessionId) ⇒
-**Kind**: global constant
-
+Given a database and a session id, this method returns a promise that
+resolves with a state object that needs to be saved into a file.
-## templateUtil
+**Kind**: global function
+**Returns**: state object that needs to be saved into a file.
-Copyright (c) 2020 Silicon Labs
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+
- http://www.apache.org/licenses/LICENSE-2.0
+## convertToFile(state, fileFormat)
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+This function gets the state from database and converts it for a given file format.
-**Kind**: global constant
-
+**Kind**: global function
-## queryZcl
+| Param | Type |
+| ---------- | --------------- |
+| state | \*
|
+| fileFormat | \*
|
-Copyright (c) 2020 Silicon Labs
+
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+## updateCommands(cluster, clusterToCommandMap) ⇒
- http://www.apache.org/licenses/LICENSE-2.0
+Updates the clusters with the new command format where there is isIncoming
+and isEnabled instead of incoming and outgoing
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+**Kind**: global function
+**Returns**: state or null
-**Kind**: global constant
-
+| Param | Type |
+| ------------------- | --------------- |
+| cluster | \*
|
+| clusterToCommandMap | \*
|
-## queryZcl
+
-Copyright (c) 2020 Silicon Labs
+## convertFromFile()
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+This function gets the JSON from the file, and converts it to the correct database state
- http://www.apache.org/licenses/LICENSE-2.0
+**Kind**: global function
+
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+## locateAttribute(state)
-**Kind**: global constant
-
+Locates or adds an attribute, and returns it.
+at contains clusterId, attributeId, isClient, mfgCode and possibly value
-## queryPackage
+**Kind**: global function
-Copyright (c) 2020 Silicon Labs
+| Param | Type |
+| ----- | --------------- |
+| state | \*
|
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+
- http://www.apache.org/licenses/LICENSE-2.0
+## parseAttribute(attributeString, [value])
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+Parses attribute string in a form:
+cl:0xABCD, at:0xABCD, di: [client|server], mf:0xABCD
-**Kind**: global constant
-
+**Kind**: global function
-## path
+| Param | Type | Default |
+| --------------- | --------------- | ------------- |
+| attributeString | \*
| |
+| [value] | \*
|
|
-Copyright (c) 2020 Silicon Labs
+
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+## parseZclAfv2Line(state, line)
- http://www.apache.org/licenses/LICENSE-2.0
+Logic that parses data out of an ISC file into a java object
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+**Kind**: global function
-**Kind**: global constant
-
+| Param | Type |
+| ----- | --------------- |
+| state | \*
|
+| line | \*
|
-## fs
+
-Copyright (c) 2020 Silicon Labs
+## parseZclCustomizer(state, line)
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+Function that deals with the zcl customizer data inside the ISC file
- http://www.apache.org/licenses/LICENSE-2.0
+**Kind**: global function
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+| Param | Type |
+| ----- | --------------- |
+| state | \*
|
+| line | \*
|
-**Kind**: global constant
-
+
-## fs
+## readIscData(filePath, data) ⇒
+
+Toplevel parser that ignore anything except the two setups that are
+ZCL relevant.
+
+**Kind**: global function
+**Returns**: promise of read ISC data
+
+| Param | Type |
+| -------- | --------------- |
+| filePath | \*
|
+| data | \*
|
-Copyright (c) 2020 Silicon Labs
+
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+## loadEndpointType(db, sessionId, zclPackages, endpointType)
- http://www.apache.org/licenses/LICENSE-2.0
+Load individual endpoint types.
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+**Kind**: global function
-**Kind**: global constant
-
+| Param | Type | Description |
+| ------------ | --------------- | ------------------------------------- |
+| db | \*
| |
+| sessionId | \*
| |
+| zclPackages | \*
| Array of package IDs for zcl queries. |
+| endpointType | \*
| |
-## dbApi
+
-Copyright (c) 2020 Silicon Labs
+## loadImplementedCommandsForEndpoint(db, zclPackageId, state, commandExtensions, endpointTypeId)
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+Loads all implemented commands for a single endpoint.
- http://www.apache.org/licenses/LICENSE-2.0
+**Kind**: global function
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+| Param | Type |
+| ----------------- | --------------- |
+| db | \*
|
+| zclPackageId | \*
|
+| state | \*
|
+| commandExtensions | \*
|
+| endpointTypeId | \*
|
-**Kind**: global constant
-
+
-## rendApi
+## loadImplementedCommandsExtensions(db, zclPackageId, state, commandExtensions, endpointTypeIdArray)
-Copyright (c) 2020 Silicon Labs
+This method goes over the endpoint type and the state, and enables
+commands that belong to enabled clusters and are listed in the
+commandExtensions as "implemented".
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+**Kind**: global function
- http://www.apache.org/licenses/LICENSE-2.0
+| Param | Type |
+| ------------------- | --------------- |
+| db | \*
|
+| zclPackageId | \*
|
+| state | \*
|
+| commandExtensions | \*
|
+| endpointTypeIdArray | \*
|
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+
-**Kind**: global constant
-
+## loadCommands(db, state, sessionId)
-## env
+This method resolves promises that contain all the
+queries that are needed to load the attribute state
-This file is used specifically and only for development. It installs
-`electron-debug` & `vue-devtools`. There shouldn't be any need to
-modify this file, but it can be used to extend your development
-environment.
+**Kind**: global function
-**Kind**: global constant
-
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| state | \*
|
+| sessionId | \*
|
-## templateUtil
+
-This module provides API to access various iterator utilities that can then
-be used to build iterator helpers.
+## loadAttributes(db, state, sessionId)
-**Kind**: global constant
-
+This method resolves promises that contain all the
+queries that are needed to load the attribute state
-## fs
+**Kind**: global function
-Copyright (c) 2022 Silicon Labs
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| state | \*
|
+| sessionId | \*
|
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+
- http://www.apache.org/licenses/LICENSE-2.0
+## loadSessionKeyValues(db, sessionId, keyValues)
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+Loads the session key values from the keyValues object
-**Kind**: global constant
-
+**Kind**: global function
-## queryZcl
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| keyValues | \*
|
-Copyright (c) 2020 Silicon Labs
+
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+## iscDataLoader(db, state, sessionId)
- http://www.apache.org/licenses/LICENSE-2.0
+Function that actually loads the data out of a state object.
+Session at this point is blank, and has no packages.
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+**Kind**: global function
-**Kind**: global constant
-
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| state | \*
|
+| sessionId | \*
|
-## queryZcl
+
-This module provides the APIs for validating inputs to the database, and returning flags indicating if
-things were successful or not.
+## importSessionKeyValues(db, sessionId, keyValuePairs)
-**Kind**: global constant
-
+Resolves with a promise that imports session key values.
-## fs
+**Kind**: global function
-Copyright (c) 2020 Silicon Labs
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| keyValuePairs | \*
|
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+
- http://www.apache.org/licenses/LICENSE-2.0
+## autoLoadPackage(db, pkg, absPath) ⇒
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+Auto-load package. If succesful it returns an object.
+Otherwise it throws an exception.
-**Kind**: global constant
-
+**Kind**: global function
+**Returns**: object containing packageId and packageType.
-## fs
+| Param | Type |
+| ------- | --------------- |
+| db | \*
|
+| pkg | \*
|
+| absPath | \*
|
-Copyright (c) 2020 Silicon Labs
+
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+## importSinglePackage(db, pkg, zapFilePath, packageMatch, defaultZclMetafile, defaultTemplateFile) ⇒
- http://www.apache.org/licenses/LICENSE-2.0
+Resolves into a { packageId:, packageType:}
+object, pkg has`path`, `version`, `type`. It can ALSO have pathRelativity. If pathRelativity is missing
+path is considered absolute.
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+**Kind**: global function
+**Returns**: pkg information based on a match
-**Kind**: global constant
-
+| Param | Type | Default |
+| ------------------- | --------------- | ------------- |
+| db | \*
| |
+| pkg | \*
| |
+| zapFilePath | \*
| |
+| packageMatch | \*
| |
+| defaultZclMetafile | \*
|
|
+| defaultTemplateFile | \*
|
|
-## fs
+
-Copyright (c) 2020 Silicon Labs
+## convertPackageResult(data) ⇒
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
+Convert the array of results into a more palatable value.
+Resolves an array of { packageId:, packageType:} objects into { zclPackageId: id, templateIds: [] }
- http://www.apache.org/licenses/LICENSE-2.0
+**Kind**: global function
+**Returns**: an object that contains session ids.
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+| Param | Type |
+| ----- | --------------- |
+| data | \*
|
-**Kind**: global constant
-
+
-## selectAllDiscriminators(db, packageIds) ⇒
+## importPackages(db, packages, zapFilePath, packageMatch, defaultZclMetafile, defaultTemplateFile) ⇒
**Kind**: global function
-**Returns**: all the data type discriminator information
+**Returns**: a promise that resolves into an object containing: packageId and otherIds
-| Param | Type |
-| ---------- | --------------- |
-| db | \*
|
-| packageIds | \*
|
+| Param | Type | Default |
+| ------------------- | --------------- | ------------- |
+| db | \*
| |
+| packages | \*
| |
+| zapFilePath | \*
| |
+| packageMatch | \*
| |
+| defaultZclMetafile | \*
|
|
+| defaultTemplateFile | \*
|
|
-
+
-## selectDataTypeById(db, id) ⇒
+## sortEndpoints(endpoints) ⇒
-Gathers the data type information of an entry based on data type id along
-with its actual type from disciminator table.
+Sorts the list of endpoints
**Kind**: global function
-**Returns**: Data type information
-
-| Param |
-| ----- |
-| db |
-| id |
+**Returns**: list or sorted endpoints based on endpoint type index
-
+| Param | Type |
+| --------- | --------------- |
+| endpoints | \*
|
-## selectDataTypeByName(db, name, packageIds) ⇒
+
-Gathers the data type information of an entry based on data type name along
-with its actual type from disciminator table.
+## importClusters(db, allZclPackageIds, endpointTypeId, clusters)
-**Kind**: global function
-**Returns**: Data type information
+Imports the clusters for an endpoint type along with attributes, commands
+and events
-| Param |
-| ---------- |
-| db |
-| name |
-| packageIds |
+**Kind**: global function
-
+| Param | Type |
+| ---------------- | --------------- |
+| db | \*
|
+| allZclPackageIds | \*
|
+| endpointTypeId | \*
|
+| clusters | \*
|
-## selectDataTypeByNameAndClusterId(db, name, clusterId, packageIds) ⇒
+
-Gathers the data type information based on data type name and
-clusterId along with its actual type from disciminator table.
+## importCommands(db, allZclPackageIds, endpointTypeId, endpointClusterId, commands)
-**Kind**: global function
-**Returns**: Data type information
+Imports the list of commands from a cluster
-| Param |
-| ---------- |
-| db |
-| name |
-| clusterId |
-| packageIds |
+**Kind**: global function
-
+| Param | Type |
+| ----------------- | --------------- |
+| db | \*
|
+| allZclPackageIds | \*
|
+| endpointTypeId | \*
|
+| endpointClusterId | \*
|
+| commands | \*
|
-## selectAllDataTypes(db, packageId) ⇒
+
-Gathers All the data types
+## importAttributes(db, allZclPackageIds, endpointTypeId, endpointClusterId, attributes, cluster)
-**Kind**: global function
-**Returns**: All data types
+Imports the list of attributes from a cluster
-| Param |
-| --------- |
-| db |
-| packageId |
+**Kind**: global function
-
+| Param | Type |
+| ----------------- | --------------- |
+| db | \*
|
+| allZclPackageIds | \*
|
+| endpointTypeId | \*
|
+| endpointClusterId | \*
|
+| attributes | \*
|
+| cluster | \*
|
-## selectSizeFromType(db, packageIds, value) ⇒
+
-Return the size of the given value whether it be a reference to it in the data
-type table in the form of a number or be it the name of the type in the form
-if string.
+## importEvents(db, allZclPackageIds, endpointClusterId, events)
-**Kind**: global function
-**Returns**: The size of the given value
+Imports the list of events from a cluster
-| Param | Type |
-| ---------- | --------------- |
-| db | \*
|
-| packageIds | \*
|
-| value | \*
|
+**Kind**: global function
-
+| Param | Type |
+| ----------------- | --------------- |
+| db | \*
|
+| allZclPackageIds | \*
|
+| endpointClusterId | \*
|
+| events | \*
|
-## selectNumberByName(db, name, packageIds) ⇒
+
-Select an number matched by name.
+## getMandatoryClusterAttributes(db, epc, cluster, allZclPackageIds) ⇒
+
+Retrieves the mandatory attributes of a cluster
**Kind**: global function
-**Returns**: number or undefined
+**Returns**: mandatory attributes of a cluster
-| Param |
-| ---------- |
-| db |
-| name |
-| packageIds |
+| Param | Type |
+| ---------------- | --------------- |
+| db | \*
|
+| epc | \*
|
+| cluster | \*
|
+| allZclPackageIds | \*
|
-
+
-## selectNumberByNameAndClusterId(db, name, packageIds) ⇒
+## getMandatoryClusterCommands(db, epc, cluster, allZclPackageIds) ⇒
-Select a number matched by name and clusterId
+Retrieves the mandatory commands of a cluster
**Kind**: global function
-**Returns**: number information or undefined
+**Returns**: mandatory commands of a cluster
-| Param |
-| ---------- |
-| db |
-| name |
-| packageIds |
+| Param | Type |
+| ---------------- | --------------- |
+| db | \*
|
+| epc | \*
|
+| cluster | \*
|
+| allZclPackageIds | \*
|
-
+
-## selectNumberById(db, name) ⇒
+## clusterComplianceForAttributes(db, sessionId, endpointTypeAttributes, allMandatoryAttributes, endpointId, clusterSpecCheckComplianceMessage, specMessageIndent) ⇒
-Select an number matched by id.
+Adds cluster compliance warnings for attributes to the console and the
+session notification table
**Kind**: global function
-**Returns**: number or undefined
+**Returns**: clusterSpecCheckComplianceMessage by concatenating all
+clusterSpecComplianceMessageForAttributes
-| Param |
-| ----- |
-| db |
-| name |
+| Param | Type |
+| --------------------------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| endpointTypeAttributes | \*
|
+| allMandatoryAttributes | \*
|
+| endpointId | \*
|
+| clusterSpecCheckComplianceMessage | \*
|
+| specMessageIndent | \*
|
-
+
-## selectAllNumbers(db, packageId) ⇒
+## clusterComplianceForCommands(db, sessionId, endpointTypeCommands, allMandatoryCommands, endpointId, clusterSpecCheckComplianceMessage, specMessageIndent) ⇒
-Select all numbers.
+Adds cluster compliance warnings for commands to the console and the
+session notification table
**Kind**: global function
-**Returns**: All numbers
+**Returns**: clusterSpecCheckComplianceMessage by concatenating all
+clusterSpecComplianceMessageForAttributes
-| Param |
-| --------- |
-| db |
-| packageId |
+| Param | Type |
+| --------------------------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| endpointTypeCommands | \*
|
+| allMandatoryCommands | \*
|
+| endpointId | \*
|
+| clusterSpecCheckComplianceMessage | \*
|
+| specMessageIndent | \*
|
-
+
-## selectAllStrings(db, packageId) ⇒
+## deviceTypeClustersAttributesAndCommands(db, endpointTypeId) ⇒
-Select all Strings.
+Retrieves deviceTypeClustersOnEndpointType, deviceTypeAttributesOnEndpointType
+and deviceTypeCommandsOnEndpointType for an endpoint type
**Kind**: global function
-**Returns**: All Strings
-
-| Param |
-| --------- |
-| db |
-| packageId |
+**Returns**: deviceTypeClustersOnEndpointType, deviceTypeAttributesOnEndpointType
+and deviceTypeCommandsOnEndpointType for an endpoint type
-
+| Param | Type |
+| -------------- | --------------- |
+| db | \*
|
+| endpointTypeId | \*
|
-## selectStringById(db, packageId) ⇒
+
-Select String by ID.
+## deviceTypeClusterToFeatureBits(deviceTypeFeaturesOnEndpointType) ⇒
**Kind**: global function
-**Returns**: String
+**Returns**: a map between device type's cluster id to feature bits for that cluster
-| Param |
-| --------- |
-| db |
-| packageId |
+| Param | Type |
+| -------------------------------- | --------------- |
+| deviceTypeFeaturesOnEndpointType | \*
|
-
+
-## selectStringByName(db, name, packageIds) ⇒
+## deviceTypeComplianceForClusters(db, endpointId, sessionId, deviceTypeClustersOnEndpointType, endpointTypeClusterRefMap, deviceTypeSpecCheckComplianceMessage, specMessageIndent) ⇒
-Select String by name.
+Adds device type compliance warnings for clusters to the console and the
+session notification table
**Kind**: global function
-**Returns**: String
+**Returns**: deviceTypeSpecCheckComplianceMessage by concatenating all
+clusterSpecComplianceMessages
-| Param |
-| ---------- |
-| db |
-| name |
-| packageIds |
+| Param | Type |
+| ------------------------------------ | --------------- |
+| db | \*
|
+| endpointId | \*
|
+| sessionId | \*
|
+| deviceTypeClustersOnEndpointType | \*
|
+| endpointTypeClusterRefMap | \*
|
+| deviceTypeSpecCheckComplianceMessage | \*
|
+| specMessageIndent | \*
|
-
+
-## attributeDefault() ⇒
+## deviceTypeComplianceForAttributes(db, endpointId, sessionId, deviceTypeAttributesOnEndpointType, endpointTypeAttributeRefMap, deviceTypeSpecCheckComplianceMessage, specMessageIndent) ⇒
-Valid within a cluster context, requires code.
+Adds device type compliance warnings for attributes to the console and the
+session notification table
**Kind**: global function
-**Returns**: Produces attribute defaults.
-
+**Returns**: deviceTypeSpecCheckComplianceMessage by concatenating all
+attributeSpecComplianceMessages
-## if_command_arguments_exist(commandId, argument_return, no_argument_return)
-
-**Kind**: global function
-
-| Param | Type | Description |
-| ------------------ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| commandId | \*
| |
-| argument_return | \*
| |
-| no_argument_return | \*
| If the command arguments for a command exist then returns argument_return else returns no_argument_return Example: {{if_command_arguments_exist [command-id] "," ""}} The above will return ',' if the command arguments for a command exist and will return nothing if the command arguments for a command do not exist. |
+| Param | Type |
+| ------------------------------------ | --------------- |
+| db | \*
|
+| endpointId | \*
|
+| sessionId | \*
|
+| deviceTypeAttributesOnEndpointType | \*
|
+| endpointTypeAttributeRefMap | \*
|
+| deviceTypeSpecCheckComplianceMessage | \*
|
+| specMessageIndent | \*
|
-
+
-## if_command_args_exist(commandId, options) ⇒
+## deviceTypeComplianceForCommands(db, endpointId, sessionId, deviceTypeCommandsOnEndpointType, endpointTypeCommandRefMap, deviceTypeSpecCheckComplianceMessage, specMessageIndent) ⇒
-If helper which checks if command arguments exist for a command or not
-example:
-{{#if_command_args_exist commandId}}
-command arguments exist for the command
-{{else}}
-command arguments do not exist for the command
-{{/if_command_args_exist}}
+Adds device type compliance warnings for commands to the console and the
+session notification table
**Kind**: global function
-**Returns**: Returns content in the handlebar template based on whether the
-command arguments are present or not.
+**Returns**: deviceTypeSpecCheckComplianceMessage by concatenating all
+commandSpecComplianceMessages
-| Param |
-| --------- |
-| commandId |
-| options |
+| Param | Type |
+| ------------------------------------ | --------------- |
+| db | \*
|
+| endpointId | \*
|
+| sessionId | \*
|
+| deviceTypeCommandsOnEndpointType | \*
|
+| endpointTypeCommandRefMap | \*
|
+| deviceTypeSpecCheckComplianceMessage | \*
|
+| specMessageIndent | \*
|
-
+
-## if_ca_always_present_with_presentif(commandArg, trueReturn, falseReturn) ⇒
+## importEndpointTypes(db, sessionId, allZclPackageIds, endpointTypes, endpoints)
-**Kind**: global function
-**Returns**: trueReturn if command argument is always present and there is a
-presentIf condition else returns false
+Import endpointTypes
-| Param |
-| ----------- |
-| commandArg |
-| trueReturn |
-| falseReturn |
+**Kind**: global function
-
+| Param | Type |
+| ---------------- | --------------- |
+| db | \*
|
+| sessionId | \*
|
+| allZclPackageIds | \*
|
+| endpointTypes | \*
|
+| endpoints | \*
|
-## if_command_arg_always_present_with_presentif(commandArg, options) ⇒
+
-If helper that checks if a command argument is always present with a
-presentIf condition.
-example:
-{{#if_command_arg_always_present_with_presentif commandArg}}
-command argument has a presentIf condition
-{{else}}
-command argument does not have a presentIf condition
-{{/if_command_arg_always_present_with_presentif}}
+### importEndpointTypes~endpointTypeClusters
-**Kind**: global function
-**Returns**: Returns content in the handlebar template based on the command
-argument having a presentIf condition or not
+The following code looks into the spec conformance coming from the xml
+loading. This involves compliance of between device types, clusters,
+commands and attributes on an endpoint.
-| Param |
-| ---------- |
-| commandArg |
-| options |
+**Kind**: inner property of [importEndpointTypes
](#importEndpointTypes)
+
-
+## jsonDataLoader(db, state, sessionId, packageMatch, defaultZclMetafile, defaultTemplateFile) ⇒
-## if_command_is_not_fixed_length_but_command_argument_is_always_present(command, commandArg, trueReturn, falseReturn) ⇒
+Given a state object, this method returns a promise that resolves
+with the succesfull writing into the database.
**Kind**: global function
-**Returns**: trueReturn if command is not fixed length but command argument is
-always present else returns falseReturn
+**Returns**: a promise that resolves into a sessionId that was created.
-| Param |
-| ----------- |
-| command |
-| commandArg |
-| trueReturn |
-| falseReturn |
+| Param | Type | Description |
+| ------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
+| db | \*
| |
+| state | \*
| |
+| sessionId | \*
| If null, then new session will get created, otherwise it loads the data into an existing session. Previous session data is not deleted. |
+| packageMatch | \*
| One of the package match strategies. See dbEnum.packageMatch |
+| defaultZclMetafile | \*
| |
+| defaultTemplateFile | \*
| |
-
+
-## if_command_not_fixed_length_command_argument_always_present(command, commandArg, options) ⇒
+## readJsonData(filePath, data, defaultZclMetafile, defaultTemplateFile) ⇒
-If helper that checks if command is not fixed lenth and that the command is
-always present.
-example:
-{{#if_command_not_fixed_length_command_argument_always_present commandId}}
-command is not fixed length and command argument is always present
-{{else}}
-either command is fixed length or command argument is not always present
-{{/if_command_not_fixed_length_command_argument_always_present}}
+Parses JSON file and creates a state object out of it, which is passed further down the chain.
**Kind**: global function
-**Returns**: Returns content in the handlebar template based on the command being
-fixed length or not and whether the command argument is always present
+**Returns**: Promise of parsed JSON object
-| Param |
-| ---------- |
-| command |
-| commandArg |
-| options |
+| Param | Type |
+| ------------------- | --------------- |
+| filePath | \*
|
+| data | \*
|
+| defaultZclMetafile | \*
|
+| defaultTemplateFile | \*
|
-
+
-## if_ca_not_always_present_no_presentif(commandArg, trueReturn, falseReturn) ⇒
+## readDataFromFile(filePath, defaultZclMetafile, defaultTemplateFile) ⇒
+
+Reads the data from the file and resolves with the state object if all is good.
**Kind**: global function
-**Returns**: trueReturn if command argument is not always present and there is no
-presentIf condition else returns false
+**Returns**: Promise of file reading.
-| Param |
-| ----------- |
-| commandArg |
-| trueReturn |
-| falseReturn |
+| Param | Type |
+| ------------------- | --------------- |
+| filePath | \*
|
+| defaultZclMetafile | \*
|
+| defaultTemplateFile | \*
|
-
+
-## if_command_arg_not_always_present_no_presentif(commandArg, options) ⇒
+## importDataFromFile(db, filePath) ⇒
-If helper that checks if a command argument is not always present because it
-has a introduced in or removed in clause. The helper also checks that there
-is no presentIf condition.
-example:
-{{#if_command_arg_not_always_present_no_presentif commandArg}}
-command argument is not always present and there is no presentIf condition
-{{else}}
-Either command argument is always present or there is a presentIf condition
-{{/if_command_arg_not_always_present_no_presentif}}
+Writes the data from the file into a new session.
+NOTE: This function does NOT initialize session packages.
**Kind**: global function
-**Returns**: Returns content in the handlebar template based on the command
-argument being present and if there is a presentIf condition.
+**Returns**: a promise that resolves with the import result object that contains: sessionId, errors, warnings.
+
+| Param | Type |
+| -------- | --------------- |
+| db | \*
|
+| filePath | \*
|
-| Param |
-| ---------- |
-| commandArg |
-| options |
+
-
+## initSessionTimers()
-## if_ca_not_always_present_with_presentif(commandArg, trueReturn, falseReturn) ⇒
+Start session specific validation.
**Kind**: global function
-**Returns**: trueReturn if command argument is not always present and there is a
-presentIf condition else returns false
-
-| Param |
-| ----------- |
-| commandArg |
-| trueReturn |
-| falseReturn |
+
-
+## deinitSessionTimers(db, session)
-## if_command_arg_not_always_present_with_presentif(commandArg, options) ⇒
+Deinitalize all validation timers associated with a specific session.
-If helper that checks if a command argument is not always present because it
-has a introduced in or removed in clause. The helper also checks that there
-is a presentIf condition.
-example:
-{{#if_command_arg_not_always_present_with_presentif commandArg}}
-command argument is not always present and there is a presentIf condition
-{{else}}
-Either command argument is always present or there is no presentIf condition
-{{/if_command_arg_not_always_present_with_presentif}}
+**Kind**: global function
-**Kind**: global function
-**Returns**: Returns content in the handlebar template based on the command
-argument being present and if there is a presentIf condition.
+| Param |
+| ------- |
+| db |
+| session |
-| Param |
-| ---------- |
-| commandArg |
-| options |
+
-
+## startNormal(uiEnabled, showUrl, uiMode, zapFiles)
-## if_command_is_fixed_length(commandId, fixedLengthReturn, notFixedLengthReturn)
+Start up application in a normal mode.
**Kind**: global function
-| Param | Description |
-| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| commandId | |
-| fixedLengthReturn | |
-| notFixedLengthReturn | Returns fixedLengthReturn or notFixedLengthReturn based on whether the command is fixed length or not. Also checks if the command arguments are always present or not. |
+| Param | Type | Description |
+| --------- | --------------- | --------------------------------------------- |
+| uiEnabled | \*
| |
+| showUrl | \*
| |
+| uiMode | \*
| |
+| zapFiles | \*
| An array of .zap files to open, can be empty. |
-
+
-## if_command_fixed_length(commandId, options)
+## outputFile(inputFile, outputPattern) ⇒
-If helper which checks if a command is fixed length or not
+Returns the output file out of input file and a pattern
-example:
-{{#if_command_fixed_length commandId}}
-command is fixed length
-{{else}}
-command is not fixed length
-{{/if_command_fixed_length}}
+**Kind**: global function
+**Returns**: the path to the output file.
+
+| Param | Type |
+| ------------- | --------------- |
+| inputFile | \*
|
+| outputPattern | \*
|
+
+
+
+## gatherFiles(filesArg, options)
+
+This method gathers all the files to process.
**Kind**: global function
-| Param | Description |
-| --------- | ----------------------------------------------------------------------------------------------------------------------- |
-| commandId | |
-| options | Returns content in the handlebar template based on the command being fixed length or not as shown in the example above. |
+| Param | Type | Description |
+| -------- | --------------- | ------------------------ |
+| filesArg | \*
| array of files arguments |
+| options | \*
| |
-
+
-## endpoint_type_count(options) ⇒
+## startConvert(files, output)
-Returns number of endpoint types.
+Perform file conversion.
-**Kind**: global function
-**Returns**: number of endpoint types
+**Kind**: global function
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type |
+| ------ | --------------- |
+| files | \*
|
+| output | \*
|
-
+
-## endpoint_count(options) ⇒
+## startRegenerateSdk(argv, options)
-Returns number of endpoints.
+Performs a full SDK regeneration.
-**Kind**: global function
-**Returns**: number of endpoints
+**Kind**: global function
| Param | Type |
| ------- | --------------- |
+| argv | \*
|
| options | \*
|
-
+
-## endpoint_config_macros() ⇒
+## startAnalyze(paths, [options])
-Prints out all the macros that the endpoint config
-configuration depends on. These macros are created
-by ZAP, because the use of these macros is also
-created by ZAP.
+Perform file analysis.
-**Kind**: global function
-**Returns**: Macros that need to be created
-
+**Kind**: global function
-## endpoint_fixed_endpoint_array(options) ⇒
+| Param | Type | Default | Description |
+| --------- | -------------------- | -------------------------------------- | ------------------------ |
+| paths | \*
| | List of paths to analyze |
+| [options] | boolean
| { log: true, quit: true }
| |
-Creates array of endpointId fields on endpoints
+
+
+## startServer(options) ⇒
+
+Starts zap in a server mode.
**Kind**: global function
-**Returns**: C array including the brackets
+**Returns**: promise of a startup
| Param | Type |
| ------- | --------------- |
| options | \*
|
-
+
-## endpoint_fixed_profile_id_array(options) ⇒
+## startSelfCheck()
-Creates array of profileId fields on endpoints
+Start up applicationa in self-check mode.
**Kind**: global function
-**Returns**: C array including the brackets
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+## startGeneration() ⇒
-
+Performs headless regeneration for given parameters.
-## endpoint_fixed_network_array(options) ⇒
+**Kind**: global function
+**Returns**: Nothing, triggers quit function
+
-Creates array of networkId fields on endpoints
+## clearDatabaseFile(path)
-**Kind**: global function
-**Returns**: C array including the brackets
+Move database file out of the way into the backup location.
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+**Kind**: global function
-
+| Param | Type |
+| ----- | --------------- |
+| path | \*
|
-## endpoint_fixed_endpoint_type_array(options) ⇒
+
-Each element of an array contains an index into the
-endpoint type array, for the appropriate endpoint.
+## shutdown()
+
+Shuts down any servers that might be running.
**Kind**: global function
-**Returns**: C array of indexes, one for each endpoint.
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+## startUpSecondaryInstance(argv)
-
+Startup method for the secondary instance.
-## endpoint_attribute_manufacturer_codes(options) ⇒
+**Kind**: global function
-Generates array of { index , mfgCode } pairs, matching
-the indexes in attribute table.
+| Param | Type |
+| ----- | --------------- |
+| argv | \*
|
-**Kind**: global function
-**Returns**: manufacturer code array
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+## startUpMainInstance(quitFunction, argv)
-
+Default startup method.
-## endpoint_reporting_config_defaults(options)
+**Kind**: global function
-This helper supports an "order" CSV string, such as:
-"direction,endpoint,clusterId,attributeId,mask,mfgCode,minmax"
-The string above is a default value, and it determines in what order are the fields generated.
+| Param | Type |
+| ------------ | --------------- |
+| quitFunction | \*
|
+| argv | \*
|
-**Kind**: global function
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+## start(expirationInterval, triggerFunction)
-
+Starts a zap watchdog.
-## collectAttributes()
+**Kind**: global function
-Attribute collection works like this:
-1.) Go over all the clusters that exist.
-2.) If client is included on at least one endpoint add client atts.
-3.) If server is included on at least one endpoint add server atts.
+| Param | Type |
+| ------------------ | --------------- |
+| expirationInterval | \*
|
+| triggerFunction | \*
|
-**Kind**: global function
-
+
-## collectAttributeSizes(db, zclPackageIds, endpointTypes) ⇒
+## reset()
-This function goes over all the attributes and populates sizes.
+Resets a zap watchdog.
**Kind**: global function
-**Returns**: promise that resolves with the passed endpointTypes, after populating the attribute type sizes.
+
-| Param | Type |
-| ------------- | --------------- |
-| db | \*
|
-| zclPackageIds | \*
|
-| endpointTypes | \*
|
+## getForcedExternalStorage(db, packageIds) ⇒ Promise.<Array>
-
+Fetches forced external storage settings based on the given package ID.
+Utilizes the attribute access interface to query storage policies
+associated with the specified package ID.
-## collectAttributeTypeInfo(db, zclPackageIds, endpointTypes) ⇒
+**Kind**: global function
+**Returns**: Promise.<Array>
- A promise that resolves to an array of forced external storage settings.
-This function goes over all attributes and populates atomic types.
+| Param | Type | Description |
+| ---------- | ------------------- | -------------------------------- |
+| db | Object
| Database connection object. |
+| packageIds | Number
| The ID of the packages to query. |
-**Kind**: global function
-**Returns**: promise that resolves with the passed endpointTypes, after populating the attribute atomic types.
+
-| Param | Type |
-| ------------- | --------------- |
-| db | \*
|
-| zclPackageIds | \*
|
-| endpointTypes | \*
|
+## computeStoragePolicyForGlobalAttributes(db, clusterId, attributes, packageId) ⇒
-
+This function takes a clusterId (the database ID, not the specification-defined ID), an array of attributes (associated with the database defined clusterID),
+and a packageId to identify the specific package the attributes belong to. It changes the global attributes (attributes with specification defined clusterId = null) to represent storage policy
+based on the cluster/attribute pair in zcl.json.
-## endpoint_config(options) ⇒
+Although the specification defined clusterID of the attribute is null indicating it is a global attribute, we know what the database defined clusterID is by what is passed in as a parameter.
-Starts the endpoint configuration block.,
-longDefaults: longDefaults
+That database defined clusterID is used to query the name of the cluster which is in turn used to compute the storage policy for that cluster/attribute pair based on the packageId.
**Kind**: global function
-**Returns**: a promise of a rendered block
+**Returns**: an array of objects representing attributes in the database
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type | Description |
+| ---------- | --------------- | ---------------------------------------------------------------------------------------------------------------- |
+| db | \*
| |
+| clusterId | \*
| (database defined) the clusterId representing a cluster from the database being used in the application |
+| attributes | \*
| an array of objects representing the attributes associated with the cluster |
+| packageId | \*
| the ID of the package to which the attributes belong, used to determine storage policies specific to the package |
-
+
-## ifFuture(options)
+## computeStorageOptionNewConfig(storagePolicy)
-Block helper resolving the block if the
-value of the specified future matches.
+This asynchronous function computes and returns the new configuration for a storage option.
**Kind**: global function
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type | Description |
+| ------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| storagePolicy | String
| The current storage policy. The function first initializes the storageOption. Then it checks the storagePolicy: - If it's 'attributeAccessInterface', it sets the storageOption to 'external'. - If it's 'any', it sets the storageOption to 'ram'. If the storagePolicy is neither of these, it throws an error 'check storage policy'. Finally, it returns the updated storage option. |
-
+
-## setFuture(options)
+## computeStoragePolicyNewConfig(db, clusterRef, storagePolicy, forcedExternal, attributeName)
-This method sets the value of the future.
-Use it as:
-{{set_future name="NAME" value="VALUE"}}
+This asynchronous function computes and returns the new configuration for a storage policy.
**Kind**: global function
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+| Param | Type | Description |
+| -------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| db | Object
| The database instance. |
+| clusterRef | Number
| The reference to the cluster. |
+| storagePolicy | String
| The current storage policy. |
+| forcedExternal | Array
| An array of external options. |
+| attributeName | String
| The name of the attribute. The function first queries to get the cluster name using the cluster reference. Then it iterates over each option in the forcedExternal array. If the option's category matches the cluster name and the option's label matches the attribute name, it updates the storage policy to attributeAccessInterface. Finally, it returns the updated storage policy. |
-
+
-## future(options)
+## computeStorageImport(db, clusterName, storagePolicy, forcedExternal, attributeName)
-This method defines the future with a given name.
-Use it as: {{future name="NAME"}}
+This asynchronous function computes and returns the updated storage import policy.
**Kind**: global function
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
-
-
-
-## tokens_context()
+| Param | Type | Description |
+| -------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| db | Object
| The database instance. |
+| clusterName | String
| The name of the cluster. |
+| storagePolicy | String
| The current storage policy. |
+| forcedExternal | Array
| An array of external options. |
+| attributeName | String
| The name of the attribute. The function first initializes the updatedStoragePolicy with the current storage policy. Then it iterates over each option in the forcedExternal array. If the option's category matches the cluster name and the option's label matches the attribute name, it updates the updatedStoragePolicy to attributeAccessInterface and stops the iteration. Finally, it returns the updated storage policy. |
-This function builds creates a new context from the endpoint_config structure
-for use in the zap-tokens.h template. The endpoint_config context provides a
-list of endpoints, and endpointTypes, where each endpointType contains a list
-of clusters, and each cluster contains a list of attributes. However, the
-tokens template requires a list of attributes per endpoint, and per cluster,
-discriminating from singletons and non-singletons, so this function performs
-the required grouping.
+
-While each attribute contains an isSingleton attribute, the database schema
-allows for the same attribute to be returned both as singleton and non-singleton
-in different clusters, for different endpoints. In consequence, care must be
-taken to remove the singletons from the cluster and endpoint attribute lists.
-This is done in two steps, the first loop creates a global (context) list of
-singletons and non-singletons, and the second loop removes the singletons from
-the endpoint, and clusters.
+## socketPath()
-Clusters from different endpoints may have different attributes, therefore each
-endpoint keeps a separate list of clusters. Additionally, a context-level
-map of clusters is required in order to gather all attributes (singletons and
-non-singletons) from all endpoint clusters.
+Returns the socket path for the IPC.
**Kind**: global function
-
+
-## token_next()
+## preHandler()
-The token template assigns an unique ID to each unique attribute. These IDs
-span all attributes from all clusters from all endpointTypes. This helper
-function allows the template to increment the token ID within the tokens context.
+Runs just before every time IPC request is processed.
**Kind**: global function
-
+
-## token_attribute_util(context, options) ⇒
+## initServer(options)
-Util function that extracts all the token attribute information.
+IPC initialization.
**Kind**: global function
-**Returns**: Information on all token attributes in the configuration.
+**Parem**: \*
isServer 'true' if this is a server, 'false' for client.
| Param | Type |
| ------- | --------------- |
-| context | \*
|
| options | \*
|
-
+
-## token_attributes(endpointTypeRef, options) ⇒
+## isServerRunning() ⇒
-Get information about all the token attributes in the configuration or this
-helper can be used within an endpoint block helper to fetch the
-corresponding token attributes based on endpoint type given.
-Available Options:
-isSingleton: 0/1, option can be used to filter attributes based on singleton
-or non-singleton(Available with endpointTypeRef only)
+Returns true if server is running.
**Kind**: global function
-**Returns**: singleton and non-singleton token attributes along with their
-endpoint information. Singleton attributes are only returned once whereas
-non-singleton attributes are returned per endpoint. However if used within
-an endpoint block helper it returns token_attributes for a given endpoint
-type.
+**Returns**: true if server is running.
+
-| Param | Type |
-| --------------- | --------------- |
-| endpointTypeRef | \*
|
-| options | \*
|
+## shutdownServerSync(isServer)
-
+Shuts down the IPC server.
-## token_attribute_clusters(endpointTypeRef, options) ⇒
+**Kind**: global function
-This helper can return all token associated clusters across endpoints or
-this helper can be used within an endpoint block helper to fetch the
-corresponding token associated clusters.
-Available Options:
-isSingleton: 0/1, option can be used to filter clusters based on singleton
-or non-singleton attributes.
+| Param | Type |
+| -------- | --------------- |
+| isServer | \*
|
-**Kind**: global function
-**Returns**: Token associated clusters for a particular endpoint type or all
-token associated clusters across endpoints.
+
-| Param | Type |
-| --------------- | --------------- |
-| endpointTypeRef | \*
|
-| options | \*
|
+## createOrShowAboutWindow(port)
-
+Call this function to create a new or show an existing preference window.
-## token_attribute_endpoints(options) ⇒
+**Kind**: global function
-Get all endpoints which have token attributes in the configuration.
-AvailableOptions:
+| Param | Type |
+| ----- | --------------- |
+| port | \*
|
-- isSingleton: 0/1, option can be used to filter endpoints based on singleton
- or non-singleton.
+
+
+## hookMainInstanceEvents()
+
+Hook up all the events for the electron app object.
**Kind**: global function
-**Returns**: all endpoints with token attributes
+
-| Param | Type |
-| ------- | --------------- |
-| options | \*
|
+## doOpen(menuItem, browserWindow, event)
-
+Perform a file->open operation.
-## get_cli_size(size, type, allowZclTypes) ⇒
+**Kind**: global function
-**Kind**: global function
-**Returns**: The size in bits for a cli type based on allowZclTypes
+| Param | Type |
+| ------------- | --------------- |
+| menuItem | \*
|
+| browserWindow | \*
|
+| event | \*
|
+
+
+
+## doSave(browserWindow)
+
+Perform a save, defering to save as if file is not yet selected.
+
+**Kind**: global function
| Param | Type |
| ------------- | --------------- |
-| size | \*
|
-| type | \*
|
-| allowZclTypes | \*
|
+| browserWindow | \*
|
-
+
-## zcl_command_argument_type_to_cli_data_type_util(type, cliPrefix, context, options) ⇒
+## doSaveAs(menuItem, browserWindow, event)
+
+Perform save as.
+
+**Kind**: global function
+
+| Param | Type |
+| ------------- | --------------- |
+| menuItem | \*
|
+| browserWindow | \*
|
+| event | \*
|
+
+
+
+## fileSave(db, browserWindow, filePath) ⇒
+
+perform the save.
**Kind**: global function
-**Returns**: the zcl cli data type string with the cli prefix given
-Additional Options:
+**Returns**: Promise of saving.
-- isOptional option can be passed along with the command argument
- to return optional command argument extension accordingly
- eg:
- #zcl_command_arguments
- zcl_command_argument_type_to_zcl_cli_data_type type isOptional=isOptional
- /zcl_command_arguments
+| Param | Type |
+| ------------- | --------------- |
+| db | \*
|
+| browserWindow | \*
|
+| filePath | \*
|
+
+
+
+## fileOpen(db, filePaths)
+
+Perform the do open action, possibly reading in multiple files.
+
+**Kind**: global function
| Param | Type |
| --------- | --------------- |
-| type | \*
|
-| cliPrefix | \*
|
-| context | \*
|
-| options | \*
|
+| db | \*
|
+| filePaths | \*
|
-
+
-## zcl_command_argument_type_to_cli_data_type(typeName, options)
+## toggleMenu(port)
-Helper that deals with the type of the argument.
+Toggling of menu
**Kind**: global function
-| Param | Type |
-| -------- | --------------- |
-| typeName | \*
|
-| options | \*
|
+| Param | Type |
+| ----- | --------------- |
+| port | \*
|
-
+
-## zcl_command_argument_type_to_zcl_cli_data_type(typeName, options)
+## initMenu(httpPort)
-Helper that deals with the type of the argument.
+Initial menu show.
**Kind**: global function
| Param | Type |
| -------- | --------------- |
-| typeName | \*
|
-| options | \*
|
+| httpPort | \*
|
-
+
-## exportEndpointTypes(db, sessionId) ⇒
+## showErrorMessage(title, err)
-Resolves to an array of endpoint types.
+Simple dialog to show error messages from electron renderer scope.
-**Kind**: global function
-**Returns**: Promise to retrieve all endpoint types.
+**Kind**: global function
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ----- | --------------- |
+| title | \*
|
+| err | \*
|
-
+
-## exportSessionPackages(db, sessionId)
+## openFileConfiguration(db, filePath, httpPort)
-Resolves with data for packages.
+Process a single file, parsing it in as JSON and then possibly opening
+a new window if all is good.
**Kind**: global function
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type | Description |
+| -------- | --------------- | ------------------------------------------------- |
+| db | \*
| |
+| filePath | \*
| |
+| httpPort | \*
| Server port for the URL that will be constructed. |
-
+
-## exportDataIntoFile(db, sessionId, filePath) ⇒
+## openNewConfiguration(httpPort, options:)
-Toplevel file that takes a given session ID and exports the data into the file
+Creates a new window with a blank configuration.
+
+**Kind**: global function
+
+| Param | Type | Description |
+| -------- | --------------- | ------------------- |
+| httpPort | \*
| |
+| options: | \*
| uiMode, debugNavBar |
+
+
+
+## toggleDirtyFlag(browserWindow, dirty)
+
+Toggles the dirty flag.
+
+**Kind**: global function
+
+| Param | Type | Description |
+| ------------- | --------------- | ----------------------------------------------------- |
+| browserWindow | \*
| window to affect |
+| dirty | \*
| true if this windows is now dirty, false if otherwise |
+
+
+
+## openFileDialogAndReportResult(browserWindow, options)
+
+This function should be invoked as a result of the fileBrowse
+notification via the renderer API. It pops the open dialog and
+reports result back through the API.
+
+**Kind**: global function
+
+| Param | Type | Description |
+| ------------- | --------------- | ------------------------------------- |
+| browserWindow | \*
| |
+| options | \*
| 'key', 'title', 'mode', 'defaultPath' |
+
+
+
+## initializeElectronUi(port)
+
+Electron UI initialization.
+
+Note: You might be tempted to pass `db` to this function. Don't.
+That was done before and it's just a lazy way to cut through the
+layers between UI and back-end. Should not be done. Any information
+UI needs from the database should be retrieved via renderer API.
+
+**Kind**: global function
+
+| Param | Type |
+| ----- | --------------- |
+| port | \*
|
+
+
+
+## windowCreate(port, filePath, [uiMode]) ⇒
+
+Create a window, possibly with a given file path.
+
+**Kind**: global function
+**Returns**: BrowserWindow that got created
+
+| Param | Type | Default |
+| -------- | --------------- | ------------- |
+| port | \*
| |
+| filePath | \*
| |
+| [uiMode] | \*
|
|
+
+
+
+## processCommandLineArguments(argv) ⇒
+
+Process the command line arguments and resets the state in this file
+to the specified values.
**Kind**: global function
-**Returns**: A promise that resolves with the path of the file written.
+**Returns**: parsed argv object
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
-| filePath | \*
|
+| Param | Type |
+| ----- | --------------- |
+| argv | \*
|
-
+
-## createStateFromDatabase(db, sessionId) ⇒
+## int8ToHex(value) ⇒
-Given a database and a session id, this method returns a promise that
-resolves with a state object that needs to be saved into a file.
+Takes an int8 value and turns it into a hex.
**Kind**: global function
-**Returns**: state object that needs to be saved into a file.
+**Returns**: hex string, 2 characters long without '0x'
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
+| Param | Type |
+| ----- | --------------- |
+| value | \*
|
-
+
-## locateAttribute(state)
+## int16ToHex(value) ⇒
-Locates or adds an attribute, and returns it.
-at contains clusterId, attributeId, isClient, mfgCode and possibly value
+Takes an int16 value and turns it into a hex.
-**Kind**: global function
+**Kind**: global function
+**Returns**: hex string, 4 characters long without '0x'
| Param | Type |
| ----- | --------------- |
-| state | \*
|
+| value | \*
|
-
+
-## parseAttribute(attributeString, [value])
+## int32ToHex(value) ⇒
-Parses attribute string in a form:
-cl:0xABCD, at:0xABCD, di: [client|server], mf:0xABCD
+Takes an int32 value and turns it into a hex.
-**Kind**: global function
+**Kind**: global function
+**Returns**: hex string, 8 characters long without '0x'
-| Param | Type | Default |
-| --------------- | --------------- | ------------- |
-| attributeString | \*
| |
-| [value] | \*
|
|
+| Param | Type |
+| ----- | --------------- |
+| value | \*
|
-
+
-## parseZclAfv2Line(state, line)
+## stringToHex(value) ⇒
-Logic that parses data out of an ISC file into a java object
+Converts a string to the hex value.
-**Kind**: global function
+**Kind**: global function
+**Returns**: hex string, value.length \* 2 + 2 characters long. It appends the terminating NULL, so 0x00 is at the end.
| Param | Type |
| ----- | --------------- |
-| state | \*
|
-| line | \*
|
+| value | \*
|
-
+
-## parseZclCustomizer(state, line)
+## bitCount(n) ⇒
-Function that deals with the zcl customizer data inside the ISC file
+Given a number, this function returns the number of bits set in the number
-**Kind**: global function
+**Kind**: global function
+**Returns**: number of bits set.
| Param | Type |
| ----- | --------------- |
-| state | \*
|
-| line | \*
|
+| n | \*
|
-
+
-## readIscData(filePath, data) ⇒
+## hexToCBytes(value) ⇒
-Toplevel parser that ignore anything except the two setups that are
-ZCL relevant.
+Takes the raw hex string, such as `abcd` and
+converts it into a C constant array, such as
+`0xAB, 0xCD`.
**Kind**: global function
-**Returns**: promise of read ISC data
+**Returns**: C byte array
-| Param | Type |
-| -------- | --------------- |
-| filePath | \*
|
-| data | \*
|
+| Param | Type |
+| ----- | --------------- |
+| value | \*
|
-
+
-## loadEndpointType(db, sessionId, zclPackages, endpointType)
+## bitOffset(binary)
-Load individual endpoint types.
+Getting a binary string ("0001101010010") it returns the number of zero bits at the end.
**Kind**: global function
-| Param | Type | Description |
-| ------------ | --------------- | ------------------------------------- |
-| db | \*
| |
-| sessionId | \*
| |
-| zclPackages | \*
| Array of package IDs for zcl queries. |
-| endpointType | \*
| |
+| Param | Type |
+| ------ | --------------- |
+| binary | \*
|
-
+
-## loadImplementedCommandsForEndpoint(db, zclPackageId, state, commandExtensions, endpointTypeId)
+## hexToBinary(hex)
-Loads all implemented commands for a single endpoint.
+Convert a hex number to a binary. Hex has to be in a format
+as obtained by intToHex methods above: no '0x' prefix and upper-case
+letters, as in "12AB".
**Kind**: global function
-| Param | Type |
-| ----------------- | --------------- |
-| db | \*
|
-| zclPackageId | \*
|
-| state | \*
|
-| commandExtensions | \*
|
-| endpointTypeId | \*
|
+| Param | Type |
+| ----- | --------------- |
+| hex | \*
|
-
+
-## loadImplementedCommandsExtensions(db, zclPackageId, state, commandExtensions, endpointTypeIdArray)
+## stringToOneByteLengthPrefixCBytes(value, maxLength, pad) ⇒
-This method goes over the endpoint type and the state, and enables
-commands that belong to enabled clusters and are listed in the
-commandExtensions as "implemented".
+Returns string as C bytes, prefixed with one-byte length.
+If maxLength is greater than length of value, then
+the resulting array is padded with 0x00.
-**Kind**: global function
+**Kind**: global function
+**Returns**: Object containing 'length' and 'content', where length
+is number of bytes used and content is actual content in C format.
-| Param | Type |
-| ------------------- | --------------- |
-| db | \*
|
-| zclPackageId | \*
|
-| state | \*
|
-| commandExtensions | \*
|
-| endpointTypeIdArray | \*
|
+| Param | Type | Default | Description |
+| --------- | --------------- | ----------------- | -------------------------------------------------- |
+| value | \*
| | |
+| maxLength | \*
| | the maximum length of the used memory in bytes |
+| pad | \*
| true
| If true, then pad with 0x00 until maxLength bytes. |
-
+
-## loadCommands(db, state, sessionId)
+## stringToTwoByteLengthPrefixCBytes(value, maxLength, pad) ⇒
-This method resolves promises that contain all the
-queries that are needed to load the attribute state
+Returns string as C bytes, prefixed with two-byte length
+If maxLength is greater than length of value, then
+the resulting array is padded with 0x00.
-**Kind**: global function
+**Kind**: global function
+**Returns**: Object containing 'length' and 'content', where length
+is number of bytes used and content is actual content in C format.
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| state | \*
|
-| sessionId | \*
|
+| Param | Type | Default | Description |
+| --------- | --------------- | ----------------- | -------------------------------------------------- |
+| value | \*
| | |
+| maxLength | \*
| | the maximum length of the used memory in bytes |
+| pad | \*
| true
| If true, then pad with 0x00 until maxLength bytes. |
-
+
-## loadAttributes(db, state, sessionId)
+## builtinSilabsZclMetafile() ⇒
-This method resolves promises that contain all the
-queries that are needed to load the attribute state
+**Kind**: global function
+**Returns**: path to zcl.json file
+
-**Kind**: global function
+## builtinSilabsZclSpecialMetafile() ⇒
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| state | \*
|
-| sessionId | \*
|
+Used to retrive zcl-special.json by zcl reload test in zcl-loader.test.js
-
+**Kind**: global function
+**Returns**: path to zcl-special.json file used by zcl-loader.test.js
+
-## loadSessionKeyValues(db, sessionId, keyValues)
+## builtinSilabsZclGeneralXmlFile() ⇒
-Loads the session key values from the keyValues object
+**Kind**: global function
+**Returns**: path to general.xml file
+
-**Kind**: global function
+## builtinSilabsSpecialZclGeneralSpecialXmlFile() ⇒
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
-| keyValues | \*
|
+Used to retrive general-special.xml by zcl reload test in zcl-loader.test.js
-
+**Kind**: global function
+**Returns**: path to general-special.xml file used by zcl-loader.test.js
+
-## iscDataLoader(db, state, sessionId)
+## setAppDirectory(path)
-Function that actually loads the data out of a state object.
-Session at this point is blank, and has no packages.
+Set the state directory. This method is intended to be called
+only at the application startup, when CLI args are being parsed.
+This method honors '~/' being the first characters in its argument.
**Kind**: global function
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| state | \*
|
-| sessionId | \*
|
+| Param | Type | Description |
+| ----- | --------------- | ---------------------------------- |
+| path | \*
| Absolute path. Typically '~/.zap'. |
-
+
-## importSessionKeyValues(db, sessionId, keyValuePairs)
+## appDirectory() ⇒
-Resolves with a promise that imports session key values.
+Returns an app directory. It creates it, if it doesn't exist
-**Kind**: global function
+**Kind**: global function
+**Returns**: state directory, which is guaranteed to be already existing
+
-| Param | Type |
-| ------------- | --------------- |
-| db | \*
|
-| sessionId | \*
|
-| keyValuePairs | \*
|
+## zapVersionAsString()
-
+Returns a version as a single on-line string.
-## autoLoadPackage(db, pkg, absPath) ⇒
+**Kind**: global function
+
-Auto-load package. If succesful it returns an object.
-Otherwise it throws an exception.
+## locateProjectResource(filePath) ⇒
+
+This function locates a resource in the project, such as various
+JSON files and zcl-builtin stuff.
+
+It needs to adapt to a change in path that can occur when
+things are copied into the dist/ directory.
**Kind**: global function
-**Returns**: object containing packageId and packageType.
+**Returns**: located project resource
-| Param | Type |
-| ------- | --------------- |
-| db | \*
|
-| pkg | \*
|
-| absPath | \*
|
+| Param |
+| -------- |
+| filePath |
-
+
-## convertPackageResult(data) ⇒
+## zapVersion() ⇒
-Convert the array of results into a more palatable value.
-Resolves an array of { packageId:, packageType:} objects into { zclPackageId: id, templateIds: [] }
+Returns the zap version.
**Kind**: global function
-**Returns**: an object that contains session ids.
+**Returns**: zap version, which is an object that
+contains 'version', 'featureLevel', 'hash', 'timestamp' and 'date'
+
-| Param | Type |
-| ----- | --------------- |
-| data | \*
|
+## printToStderr(msg)
-
+Prints the data to stderr, without much fuss.
-## jsonDataLoader(db, state, sessionId, packageMatch) ⇒
+**Kind**: global function
-Given a state object, this method returns a promise that resolves
-with the succesfull writing into the database.
+| Param |
+| ----- |
+| msg |
-**Kind**: global function
-**Returns**: a promise that resolves into a sessionId that was created.
+
-| Param | Type | Description |
-| ------------ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
-| db | \*
| |
-| state | \*
| |
-| sessionId | \*
| If null, then new session will get created, otherwise it loads the data into an existing session. Previous session data is not deleted. |
-| packageMatch | \*
| One of the package match strategies. See dbEnum.packageMatch |
+## log(level, msg, err)
-
+Base level common logger.
-## readJsonData(filePath, data) ⇒
+**Kind**: global function
-Parses JSON file and creates a state object out of it, which is passed further down the chain.
+| Param | Type |
+| ----- | --------------- |
+| level | \*
|
+| msg | \*
|
+| err | \*
|
-**Kind**: global function
-**Returns**: Promise of parsed JSON object
+
-| Param | Type |
-| -------- | --------------- |
-| filePath | \*
|
-| data | \*
|
+## logInfo(msg, err)
-
+Info level message.
-## readDataFromFile(filePath) ⇒
+**Kind**: global function
-Reads the data from the file and resolves with the state object if all is good.
+| Param | Type |
+| ----- | --------------- |
+| msg | \*
|
+| err | \*
|
-**Kind**: global function
-**Returns**: Promise of file reading.
+
-| Param | Type |
-| -------- | --------------- |
-| filePath | \*
|
+## logError(msg, err)
-
+Error level message.
-## importDataFromFile(db, filePath) ⇒
+**Kind**: global function
-Writes the data from the file into a new session.
-NOTE: This function does NOT initialize session packages.
+| Param | Type |
+| ----- | --------------- |
+| msg | \*
|
+| err | \*
|
-**Kind**: global function
-**Returns**: a promise that resolves with the import result object that contains: sessionId, errors, warnings.
+
-| Param | Type |
-| -------- | --------------- |
-| db | \*
|
-| filePath | \*
|
+## logWarning(msg, err)
-
+Warning level message.
-## initSessionTimers()
+**Kind**: global function
-Start session specific validation.
+| Param | Type |
+| ----- | --------------- |
+| msg | \*
|
+| err | \*
|
-**Kind**: global function
-
+
-## deinitSessionTimers(db, session)
+## logSql(msg, err)
-Deinitalize all validation timers associated with a specific session.
+Sql level message.
**Kind**: global function
-| Param |
-| ------- |
-| db |
-| session |
+| Param | Type |
+| ----- | --------------- |
+| msg | \*
|
+| err | \*
|
-
+
-## startNormal(uiEnabled, showUrl, uiMode, zapFiles)
+## logBrowser(msg, err)
-Start up application in a normal mode.
+Browser level message.
**Kind**: global function
-| Param | Type | Description |
-| --------- | --------------- | --------------------------------------------- |
-| uiEnabled | \*
| |
-| showUrl | \*
| |
-| uiMode | \*
| |
-| zapFiles | \*
| An array of .zap files to open, can be empty. |
-
-
+| Param | Type |
+| ----- | --------------- |
+| msg | \*
|
+| err | \*
|
-## outputFile(inputFile, outputPattern) ⇒
+
-Returns the output file out of input file and a pattern
+## logIpc(msg, err)
-**Kind**: global function
-**Returns**: the path to the output file.
+IPC level message.
-| Param | Type |
-| ------------- | --------------- |
-| inputFile | \*
|
-| outputPattern | \*
|
+**Kind**: global function
-
+| Param | Type |
+| ----- | --------------- |
+| msg | \*
|
+| err | \*
|
-## gatherFiles(filesArg, options)
+
-This method gathers all the files to process.
+## logDebug(msg, err)
+
+Debug level message.
**Kind**: global function
-| Param | Type | Description |
-| -------- | --------------- | ------------------------ |
-| filesArg | \*
| array of files arguments |
-| options | \*
| |
+| Param | Type |
+| ----- | --------------- |
+| msg | \*
|
+| err | \*
|
-
+
-## startConvert(files, output)
+## versionsCheck() ⇒
-Perform file conversion.
+Returns true if versions of node and electron are matching.
+If versions are not matching, it prints out a warhing
+and returns false.
-**Kind**: global function
+**Kind**: global function
+**Returns**: true or false, depending on match
+
-| Param | Type |
-| ------ | --------------- |
-| files | \*
|
-| output | \*
|
+## httpStaticContent() ⇒
-
+Returns path to HTTP static content while taking into account DEV / PROD modes.
-## startRegenerateSdk(argv, options)
+**Kind**: global function
+**Returns**: full path to HTTP static content
+
-Performs a full SDK regeneration.
+## availableClusters(context) ⇒
-**Kind**: global function
+Returns all available clusters.
+
+**Kind**: global function
+**Returns**: all available clusters
| Param | Type |
| ------- | --------------- |
-| argv | \*
|
-| options | \*
|
+| context | \*
|
-
+
-## startAnalyze(paths, [options])
+## availableEvents(context) ⇒
-Perform file analysis.
+Returns all available events.
-**Kind**: global function
+**Kind**: global function
+**Returns**: all available events
-| Param | Type | Default | Description |
-| --------- | -------------------- | -------------------------------------- | ------------------------ |
-| paths | \*
| | List of paths to analyze |
-| [options] | boolean
| { log: true, quit: true }
| |
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
-
+
-## startServer(options) ⇒
+## availableCommands(context) ⇒
-Starts zap in a server mode.
+Returns all available commands.
**Kind**: global function
-**Returns**: promise of a startup
+**Returns**: all available ccommands
| Param | Type |
| ------- | --------------- |
-| options | \*
|
+| context | \*
|
-
+
-## startSelfCheck()
+## availableAttributes(context) ⇒
-Start up applicationa in self-check mode.
+Returns all available attributes.
**Kind**: global function
-
+**Returns**: all available attributes
-## startGeneration() ⇒
+| Param | Type |
+| ------- | --------------- |
+| context | \*
|
-Performs headless regeneration for given parameters.
+
+
+## helperWrapper(wrappedHelper) ⇒ function
+
+Wraps a helper function to add usage tracking and error handling.
**Kind**: global function
-**Returns**: Nothing, triggers quit function
-
+**Returns**: function
- - The wrapped helper function.
-## clearDatabaseFile(path)
+| Param | Type | Description |
+| ------------- | --------------------- | ---------------------------- |
+| wrappedHelper | function
| The helper function to wrap. |
-Move database file out of the way into the backup location.
+
+
+## registerHelpers(singleHelper, registerHelper, context)
+
+Registers a helper function.
**Kind**: global function
-| Param | Type |
-| ----- | --------------- |
-| path | \*
|
+| Param | Type | Description |
+| -------------- | --------------------- | -------------------------------- |
+| singleHelper | string
| The name of the helper function. |
+| registerHelper | function
| The helper function to register. |
+| context | Object
| The context object. |
-
+
-## shutdown()
+## executeHelperFunction(functionName, context, helper) ⇒ Promise
-Shuts down any servers that might be running.
+Executes a helper function from a script file.
**Kind**: global function
-
+**Returns**: Promise
- - A Promise that resolves with the result of the helper function.
-## startUpSecondaryInstance(argv)
+| Param | Type | Description |
+| ------------ | ------------------- | ------------------------------------------------------------ |
+| functionName | string
| The name of the helper function to execute. |
+| context | Object
| The context object to pass to the helper function. |
+| helper | string
| The path to the helper file containing the helper functions. |
-Startup method for the secondary instance.
+
-**Kind**: global function
+## all_user_cluster_commands_helper()
-| Param | Type |
-| ----- | --------------- |
-| argv | \*
|
+Helper for add_user_cluster_commands that does all the work except the
+collectBlocks. This allows other iterators to further filter the list
+before doing collectBlocks.
-
+**Kind**: global function
+
-## startUpMainInstance(quitFunction, argv)
+## executeScriptFunction(functionName, db, sessionId, script)
-Default startup method.
+Executes a named function from a given script.
+Arguments passed to the function are:
+api: which is the result of require('script-api.js')
+context: which contains 'db', 'sessionId', etc.
**Kind**: global function
| Param | Type |
| ------------ | --------------- |
-| quitFunction | \*
|
-| argv | \*
|
-
-
-
-## doOpen(menuItem, browserWindow, event)
+| functionName | \*
|
+| db | \*
|
+| sessionId | \*
|
+| script | \*
|
-Perform a file->open operation.
+
-**Kind**: global function
+## projectName(db, sessionId) ⇒
-| Param | Type |
-| ------------- | --------------- |
-| menuItem | \*
|
-| browserWindow | \*
|
-| event | \*
|
+Extract project name from the Studio project path
-
+**Kind**: global function
+**Returns**: '' if parsing fails
-## doSave(browserWindow)
+| Param | Type |
+| --------- | --------------- |
+| db | |
+| sessionId | \*
|
-Perform a save, defering to save as if file is not yet selected.
+
-**Kind**: global function
+## initAsyncValidation()
-| Param | Type |
-| ------------- | --------------- |
-| browserWindow | \*
|
+Start session specific validation.
-
+**Kind**: global function
+
-## doSaveAs(menuItem, browserWindow, event)
+## validateAttribute(db, endpointTypeId, attributeRef, clusterRef, zapSessionId) ⇒
-Perform save as.
+Main attribute validation function.
+Returns a promise of an object which stores a list of validational issues.
+Such issues as "Invalid type" or "Out of Range".
-**Kind**: global function
+**Kind**: global function
+**Returns**: Promise of the list of issues
-| Param | Type |
-| ------------- | --------------- |
-| menuItem | \*
|
-| browserWindow | \*
|
-| event | \*
|
+| Param | Type | Description |
+| -------------- | --------------- | ------------------- |
+| db | \*
| db reference |
+| endpointTypeId | \*
| endpoint reference |
+| attributeRef | \*
| attribute reference |
+| clusterRef | \*
| cluster reference |
+| zapSessionId | \*
| session reference |
-
+
-## fileSave(db, browserWindow, filePath) ⇒
+## validateSpecificAttribute(endpointAttribute, attribute, db, zapSessionId) ⇒
-perform the save.
+Checks the attributes type then validates the incoming input string.
**Kind**: global function
-**Returns**: Promise of saving.
+**Returns**: List of issues wrapped in an object
-| Param | Type |
-| ------------- | --------------- |
-| db | \*
|
-| browserWindow | \*
|
-| filePath | \*
|
+| Param | Type |
+| ----------------- | --------------- |
+| endpointAttribute | \*
|
+| attribute | \*
|
+| db | \*
|
+| zapSessionId | \*
|
-
+
-## fileOpen(db, filePaths)
+## extractIntegerValue(value) ⇒
-Perform the do open action, possibly reading in multiple files.
+Expects a number string , parse it back on a default base 10 if its a decimal.
+If its a hexadecimal or anything else , parse it back on base 16.
+Loses precision after javascripts Number.MAX_SAFE_INTEGER range.
-**Kind**: global function
+**Kind**: global function
+**Returns**: A decimal number
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| filePaths | \*
|
+| Param | Type |
+| ----- | --------------- |
+| value | \*
|
-
+
-## toggleMenu(port)
+## unsignedToSignedInteger(value, typeSize) ⇒
-Toggling of menu
+Converts an unsigned integer to its signed value. Returns the same integer if its not a signed type.
+Works for both BigInts and regular numbers.
-**Kind**: global function
+**Kind**: global function
+**Returns**: A decimal number
-| Param | Type |
-| ----- | --------------- |
-| port | \*
|
+| Param | Type | Description |
+| -------- | --------------- | ------------------ |
+| value | \*
| integer to convert |
+| typeSize | \*
| bit representation |
-
+
-## initMenu(httpPort)
+## getIntegerFromAttribute(attribute, typeSize, isSigned) ⇒
-Initial menu show.
+Converts an attribute (number string) into a decimal number without losing precision.
+Accepts both decimal and hexadecimal strings (former has priority) in any bit representation.
+Shifts signed hexadecimals to their correct value.
-**Kind**: global function
+**Kind**: global function
+**Returns**: A decimal number
-| Param | Type |
-| -------- | --------------- |
-| httpPort | \*
|
+| Param | Type | Description |
+| --------- | --------------- | ----------------------- |
+| attribute | \*
| attribute to convert |
+| typeSize | \*
| bit representation size |
+| isSigned | \*
| is type is signed |
-
+
-## all_user_cluster_commands_helper()
+## getIntegerAttributeSize(db, zapSessionId, attribType) ⇒ \*
-Helper for add_user_cluster_commands that does all the work except the
-collectBlocks. This allows other iterators to further filter the list
-before doing collectBlocks.
+Returns information about an integer type.
**Kind**: global function
-
+**Returns**: \*
- { size: bit representation , isSigned: is signed type }
-## initAsyncValidation()
+| Param | Type |
+| ------------ | --------------- |
+| db | \*
|
+| zapSessionId | \*
|
+| attribType | \*
|
-Start session specific validation.
+
+
+## checkAttributeBoundsInteger(attribute, endpointAttribute, db, zapSessionId) ⇒
+
+Checks if the incoming integer is within it's attributes bound while handling signed and unsigned cases.
**Kind**: global function
+**Returns**: boolean
+
+| Param | Type |
+| ----------------- | --------------- |
+| attribute | \*
|
+| endpointAttribute | \*
|
+| db | \*
|
+| zapSessionId | \*
|
+
## collectDataFromLibraryXml(ctx) ⇒
@@ -16087,9 +20136,9 @@ TODO This is not supported at this time.
| db | \*
|
| filePath | \*
|
-
+
-## loadDotdotZcl(db, ctx) ⇒
+## loadToplevelXmlFile(db, ctx) ⇒
Toplevel function that loads the xml library file
and orchestrates the promise chain.
@@ -16102,6 +20151,24 @@ and orchestrates the promise chain.
| db | \*
| |
| ctx | \*
| Context of loading. |
+
+
+## parseNewXmlFiles(db, packageId, files, context) ⇒
+
+Parses the new XML files. Returns an object containing
+loaded data:
+clusterIdsLoaded: array of cluster ids that were loaded
+
+**Kind**: global function
+**Returns**: Promise that resolves when all the new XML data is loaded.
+
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| packageId | \*
|
+| files | \*
|
+| context | \*
|
+
## collectDataFromJsonFile(ctx) ⇒
@@ -16652,19 +20719,25 @@ Preparation step for the device types.
-## processDeviceTypes(db, filePath, packageId, data) ⇒
+## processDeviceTypes(db, filePath, packageId, data, context) ⇒ Promise
-Process all device types.
+Processes and inserts device types into the database.
+This function logs the number of device types being processed for debugging purposes.
+It maps over the provided data to prepare each device type and then iterates over each prepared device type.
+If a device type has a compositionType, it inserts the endpoint composition into the database,
+retrieves the endpoint composition ID, and then inserts the device composition.
+Finally, it inserts all prepared device types into the database.
**Kind**: global function
-**Returns**: Promise of a resolved device types.
+**Returns**: Promise
- A promise that resolves after all device types have been inserted into the database.
-| Param | Type |
-| --------- | --------------- |
-| db | \*
|
-| filePath | \*
|
-| packageId | \*
|
-| data | \*
|
+| Param | Type | Description |
+| --------- | ------------------- | -------------------------------------------------------------- |
+| db | \*
| The database connection object. |
+| filePath | string
| The file path from which the device types are being processed. |
+| packageId | \*
| The package ID associated with the device types. |
+| data | Array
| The array of device types to be processed. |
+| context | \*
| Additional context that might be required for processing. |
@@ -16697,6 +20770,24 @@ This should _not_ be used for custom XML addition due to custom xmls potentially
| packageId | \*
|
| file | \*
|
+
+
+## isCrcMismatchOrPackageDoesNotExist(db, packageId, files) ⇒
+
+Checks if there is a crc mismatch on any xml file. This can be used to
+decide if there is a need to reload all the xml files. Also check if the
+package is not loaded before.
+
+**Kind**: global function
+**Returns**: the status of crc mismatch and whether a package is present in an
+object
+
+| Param | Type |
+| --------- | --------------- |
+| db | \*
|
+| packageId | \*
|
+| files | \*
|
+
## parseZclFiles(db, packageId, zclFiles, context) ⇒
@@ -16821,6 +20912,27 @@ Parses the boolean options.
| pkgRef | \*
|
| booleanCategories | \*
|
+
+
+## parseattributeAccessInterfaceAttributes(db, pkgRef, attributeAccessInterfaceAttributes) ⇒ Promise.<void>
+
+Asynchronously parses and inserts attribute access interface attributes into the database.
+This function iterates over the attributeAccessInterfaceAttributes object, processing each cluster
+by mapping its values to a specific structure and then inserting them into the database using
+the insertOptionsKeyValues function.
+
+The main purpose of this function is to store cluster/attribute pairs including global attributes and their cluster pair
+The ATTRIBUTE table has cluster_ref as null for global attributes so this second method was necessary
+
+**Kind**: global function
+**Returns**: Promise.<void>
- A promise that resolves when all attributes have been processed and inserted.
+
+| Param | Type | Description |
+| ---------------------------------- | --------------- | -------------------------------------------------------------------------------------- |
+| db | \*
| The database connection object. |
+| pkgRef | \*
| The package reference id for which the attributes are being parsed. |
+| attributeAccessInterfaceAttributes | \*
| An object containing the attribute access interface attributes, structured by cluster. |
+
## parseDefaults(db, ctx) ⇒
@@ -16866,9 +20978,9 @@ If custom device is supported, then this method creates it.
| db | \*
|
| ctx | \*
|
-
+
-## loadSilabsZcl(db, ctx) ⇒
+## loadZclJsonOrProperties(db, ctx) ⇒
Toplevel function that loads the toplevel metafile
and orchestrates the promise chain.
@@ -16883,18 +20995,19 @@ and orchestrates the promise chain.
-## recordToplevelPackage(db, metadataFile, crc) ⇒
+## recordToplevelPackage(db, metadataFile, crc, isTopLevelPackageInSync) ⇒
Records the toplevel package information and resolves into packageId
**Kind**: global function
**Returns**: packageId
-| Param | Type |
-| ------------ | --------------- |
-| db | \*
|
-| metadataFile | \*
|
-| crc | \*
|
+| Param | Type |
+| ----------------------- | --------------- |
+| db | \*
|
+| metadataFile | \*
|
+| crc | \*
|
+| isTopLevelPackageInSync | \*
|
@@ -16909,6 +21022,35 @@ Records the version into the database.
| db | \*
|
| ctx | \*
|
+
+
+## loadZclMetaFilesCommon(db, metadataFile, options) ⇒
+
+Retrieve zcl package information
+
+**Kind**: global function
+**Returns**: package zcl package information
+
+| Param | Type |
+| ------------ | --------------- |
+| db | \*
|
+| metadataFile | \*
|
+| options | \*
|
+
+
+
+## loadAttributeMappingForMultiProtocol(db, multiProtcolInfo, categoryToPackageIdMap)
+
+Load attribute mapping table if there is multi-protocol information from a json file.
+
+**Kind**: global function
+
+| Param | Type |
+| ---------------------- | --------------- |
+| db | \*
|
+| multiProtcolInfo | \*
|
+| categoryToPackageIdMap | \*
|
+
## loadZclMetafiles(db, metadataFile) ⇒
@@ -16953,7 +21095,7 @@ Load individual custom XML files.
-## qualifyZclFile(db, info, parentPackageId) ⇒
+## qualifyZclFile(db, info, parentPackageId, isCustom) ⇒
Promises to qualify whether zcl file needs to be reloaded.
If yes, the it will resolve with {filePath, data, packageId}
@@ -16967,6 +21109,7 @@ If not, then it will resolve with {error}
| db | \*
|
| info | \*
|
| parentPackageId | \*
|
+| isCustom | \*
|
diff --git a/docs/notifications.md b/docs/notifications.md
index 1d34227bfe..fa2d739967 100644
--- a/docs/notifications.md
+++ b/docs/notifications.md
@@ -6,7 +6,7 @@ The purpose of this document is to provide ZAP developers with simple instructio
### Adding a Session Notification
-Session notifications are set after a session is created. To add a session notification, call the setNotification function in zap/src-electron/query-session-notification.js.
+Session notifications are set after a session is created. To add a session notification, call the setNotification function in zap/src-electron/query-session-notification.js.
setNotification takes the following arguments:
- db => database object (object)
@@ -54,7 +54,7 @@ For example, the picture below is the result of importing an isc file in the not
### Adding a Package Notification
-Package notifications are set when processing and loading a specific package. To add a package notification, call the setNotification function in zap/src-electron/query-package-notification.js.
+Package notifications are set when processing and loading a specific package. To add a package notification, call the setNotification function in zap/src-electron/query-package-notification.js.
setNotification takes the following arguments:
- db => database object (object)
@@ -79,10 +79,10 @@ function prepareEnumOrBitmap(db, packageId, a, dataType, typeMap) {
a.$.name + ' with type ' + a.$.type
env.logWarning(message)
queryPackageNotification.setNotification(
- db,
- "WARNING",
- message,
- packageId,
+ db,
+ "WARNING",
+ message,
+ packageId,
2
)
}
@@ -90,7 +90,7 @@ function prepareEnumOrBitmap(db, packageId, a, dataType, typeMap) {
- When calling the setNotification function, ensure a valid package Id is accessible within the current scope
-- For testing you can navigate to **zap/src/pages/ZapConfig.vue** which queries the PACKAGE_NOTICE table and returns all notifications from packages referenced by the current session.
+- For testing you can navigate to **zap/src/pages/ZapConfig.vue** which queries the PACKAGE_NOTICE table and returns all notifications from packages referenced by the current session.
For example, in the pictures below, clicking the warning icon will lead you to a dialog showing all notifications for that package.
diff --git a/src-electron/db/db-api.js b/src-electron/db/db-api.js
index 2928da0a38..0b170a9624 100644
--- a/src-electron/db/db-api.js
+++ b/src-electron/db/db-api.js
@@ -321,7 +321,7 @@ async function dbMultiInsert(db, sql, arrayOfArrays) {
', values: ' +
singleArray +
', ' +
- err2
+ err2,
)
lastIds.push(this.lastID)
})
@@ -419,7 +419,7 @@ async function insertOrReplaceSetting(db, category, key, value) {
return dbInsert(
db,
'INSERT OR REPLACE INTO SETTING ( CATEGORY, KEY, VALUE ) VALUES ( ?, ?, ? )',
- [category, key, value]
+ [category, key, value],
)
}
@@ -435,7 +435,7 @@ async function updateSetting(db, rows) {
dbInsert(
db,
'INSERT OR REPLACE INTO SETTING ( CATEGORY, KEY, VALUE ) VALUES ( ?, ?, ? )',
- [rows[i].category, rows[i].key, rows[i].value]
+ [rows[i].category, rows[i].key, rows[i].value],
)
}
}
@@ -469,7 +469,7 @@ async function determineIfSchemaShouldLoad(db, filePath, crc) {
db,
'SELECT CRC FROM PACKAGE WHERE PATH = ?',
[filePath],
- false
+ false,
)
if (row == null) {
result.mustLoad = true
@@ -489,7 +489,7 @@ async function updateCurrentSchemaCrc(db, filePath, crc) {
return dbInsert(
db,
'INSERT OR REPLACE INTO PACKAGE (PATH, CRC, TYPE) VALUES ( ?, ?, ? )',
- [filePath, crc, dbEnum.packageType.sqlSchema]
+ [filePath, crc, dbEnum.packageType.sqlSchema],
)
}
@@ -529,7 +529,7 @@ async function loadSchema(db, schemaPath, zapVersion, sqliteFile = null) {
let schemaStatus = await determineIfSchemaShouldLoad(
db,
context.filePath,
- context.crc
+ context.crc,
)
if (schemaStatus.mustLoad && schemaStatus.hasSchema) {
await closeDatabase(db)
diff --git a/src-electron/db/db-mapping.js b/src-electron/db/db-mapping.js
index bc380ad1bf..974a858253 100644
--- a/src-electron/db/db-mapping.js
+++ b/src-electron/db/db-mapping.js
@@ -636,7 +636,7 @@ exports.map = {
isGlobalAttribute: x.IS_GLOBAL_ATTRIBUTE, // Is attribute global
isIncluded: dbApi.fromDbBool(x.INCLUDED), // Is endpoint type attribute included
isManufacturingSpecific: dbApi.toDbBool(
- x.MANUFACTURER_CODE | x.CLUSTER_MANUFACTURER_CODE
+ x.MANUFACTURER_CODE | x.CLUSTER_MANUFACTURER_CODE,
), // Is Attribute mfg specific or not
isNullable: dbApi.fromDbBool(x.IS_NULLABLE), // Is attribute nullable
isOptionalAttribute: dbApi.fromDbBool(x.IS_OPTIONAL),
diff --git a/src-electron/db/query-access.js b/src-electron/db/query-access.js
index 0fbc2f9e04..1efabcbf5f 100644
--- a/src-electron/db/query-access.js
+++ b/src-electron/db/query-access.js
@@ -29,9 +29,9 @@ async function selectAccessOperations(db, packageIds) {
db,
`
SELECT NAME, DESCRIPTION FROM OPERATION WHERE PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
+ packageIds,
)}) ORDER BY NAME
-`
+`,
)
.then((rows) => rows.map(dbMapping.map.accessOperation))
}
@@ -42,9 +42,9 @@ async function selectAccessRoles(db, packageIds) {
db,
`
SELECT NAME, DESCRIPTION, LEVEL FROM ROLE WHERE PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
+ packageIds,
)}) ORDER BY NAME
- `
+ `,
)
.then((rows) => rows.map(dbMapping.map.accessRole))
}
@@ -55,9 +55,9 @@ async function selectAccessModifiers(db, packageIds) {
db,
`
SELECT NAME, DESCRIPTION FROM ACCESS_MODIFIER WHERE PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
+ packageIds,
)}) ORDER BY NAME
- `
+ `,
)
.then((rows) => rows.map(dbMapping.map.accessModifier))
}
@@ -94,7 +94,7 @@ ON A.ACCESS_MODIFIER_REF = ACCESS_MODIFIER.ACCESS_MODIFIER_ID
WHERE DA.PACKAGE_REF IN (${dbApi.toInClause(packageIds)}) AND DA.ENTITY_TYPE = ?
ORDER BY OPERATION.NAME, ROLE.NAME, ACCESS_MODIFIER.NAME
`,
- [type]
+ [type],
)
.then((rows) => rows.map(dbMapping.map.access))
}
@@ -123,7 +123,7 @@ ON A.ACCESS_MODIFIER_REF = ACCESS_MODIFIER.ACCESS_MODIFIER_ID
WHERE AA.ATTRIBUTE_REF = ?
ORDER BY OPERATION.NAME, ROLE.NAME, ACCESS_MODIFIER.NAME
`,
- [attributeId]
+ [attributeId],
)
.then((rows) => rows.map(dbMapping.map.access))
}
@@ -152,7 +152,7 @@ ON A.ACCESS_MODIFIER_REF = ACCESS_MODIFIER.ACCESS_MODIFIER_ID
WHERE CA.COMMAND_REF = ?
ORDER BY OPERATION.NAME, ROLE.NAME, ACCESS_MODIFIER.NAME
`,
- [commandId]
+ [commandId],
)
.then((rows) => rows.map(dbMapping.map.access))
}
@@ -181,7 +181,7 @@ ON A.ACCESS_MODIFIER_REF = ACCESS_MODIFIER.ACCESS_MODIFIER_ID
WHERE EA.EVENT_REF = ?
ORDER BY OPERATION.NAME, ROLE.NAME, ACCESS_MODIFIER.NAME
`,
- [eventId]
+ [eventId],
)
.then((rows) => rows.map(dbMapping.map.access))
}
diff --git a/src-electron/db/query-atomic.js b/src-electron/db/query-atomic.js
index 8228e198b4..be708deb09 100644
--- a/src-electron/db/query-atomic.js
+++ b/src-electron/db/query-atomic.js
@@ -47,7 +47,7 @@ async function selectAllAtomics(db, packageId) {
let rows = await dbApi.dbAll(
db,
`${ATOMIC_QUERY} WHERE PACKAGE_REF = ? ORDER BY ATOMIC_IDENTIFIER`,
- [packageId]
+ [packageId],
)
return rows.map(dbMapping.map.atomic)
}
@@ -64,9 +64,9 @@ async function selectAtomicType(db, packageIds, name) {
.dbGet(
db,
`${ATOMIC_QUERY} WHERE PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
+ packageIds,
)}) AND UPPER(NAME) = ?`,
- [name == null ? name : name.toUpperCase()]
+ [name == null ? name : name.toUpperCase()],
)
.then(dbMapping.map.atomic)
}
@@ -95,7 +95,7 @@ async function isTypeSignedByNameAndPackage(db, name, sessionPackages) {
const row = await dbApi.dbGet(
db,
`SELECT IS_SIGNED FROM ATOMIC WHERE NAME = ? AND PACKAGE_REF = ?`,
- [name, sessionPackage]
+ [name, sessionPackage],
)
return row ? row.IS_SIGNED === 1 : false
diff --git a/src-electron/db/query-attribute.js b/src-electron/db/query-attribute.js
index f1fa61167c..f0a4deffd2 100644
--- a/src-electron/db/query-attribute.js
+++ b/src-electron/db/query-attribute.js
@@ -36,7 +36,7 @@ const dbCache = require('./db-cache')
async function selectEndpointTypeAttributesByEndpointTypeRefAndClusterRef(
db,
endpointTypeRef,
- endpointTypeClusterRef
+ endpointTypeClusterRef,
) {
let rows = await dbApi.dbAll(
db,
@@ -63,7 +63,7 @@ async function selectEndpointTypeAttributesByEndpointTypeRefAndClusterRef(
ENDPOINT_TYPE_ATTRIBUTE.ENDPOINT_TYPE_CLUSTER_REF = ENDPOINT_TYPE_CLUSTER.ENDPOINT_TYPE_CLUSTER_ID
WHERE
ENDPOINT_TYPE_CLUSTER.ENDPOINT_TYPE_REF = ? and ENDPOINT_TYPE_ATTRIBUTE.ENDPOINT_TYPE_CLUSTER_REF = ?`,
- [endpointTypeRef, endpointTypeClusterRef]
+ [endpointTypeRef, endpointTypeClusterRef],
)
return rows.map(dbMapping.map.endpointTypeAttribute)
}
@@ -80,7 +80,7 @@ async function selectEndpointTypeAttributesByEndpointTypeRefAndClusterRef(
async function duplicateEndpointTypeAttribute(
db,
newEndpointTypeClusterRef,
- attribute
+ attribute,
) {
return await dbApi.dbInsert(
db,
@@ -121,7 +121,7 @@ async function duplicateEndpointTypeAttribute(
attribute.minInterval,
attribute.maxInterval,
attribute.reportableChange,
- ]
+ ],
)
}
@@ -138,7 +138,7 @@ async function selectAllAttributeDetailsFromEnabledClusters(
db,
endpointsAndClusters,
packageIds,
- side = null
+ side = null,
) {
let sideFilter = ''
if (side) {
@@ -214,7 +214,7 @@ async function selectAllAttributeDetailsFromEnabledClusters(
${sideFilter}
GROUP BY CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, ATTRIBUTE.MANUFACTURER_CODE, ATTRIBUTE.CODE, ATTRIBUTE.SIDE
ORDER BY ATTRIBUTE.CODE
- `
+ `,
)
.then((rows) => rows.map(dbMapping.map.endpointTypeAttributeExtended))
}
@@ -234,7 +234,7 @@ async function selectAttributeDetailsFromAllEndpointTypesAndClustersUtil(
db,
endpointsAndClusters,
isManufacturingSpecific,
- packageIds
+ packageIds,
) {
let endpointTypeIds = endpointsAndClusters
.map((ep) => ep.endpointId)
@@ -280,7 +280,7 @@ async function selectAttributeDetailsFromAllEndpointTypesAndClustersUtil(
AND ENDPOINT_TYPE_ATTRIBUTE.INCLUDED = 1
AND ATTRIBUTE.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
GROUP BY ATTRIBUTE.NAME
- `
+ `,
)
.then((rows) => rows.map(dbMapping.map.endpointTypeAttributeExtended))
}
@@ -296,13 +296,13 @@ async function selectAttributeDetailsFromAllEndpointTypesAndClustersUtil(
async function selectManufacturerSpecificAttributeDetailsFromAllEndpointTypesAndClusters(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
return selectAttributeDetailsFromAllEndpointTypesAndClustersUtil(
db,
endpointsAndClusters,
true,
- packageIds
+ packageIds,
)
}
@@ -317,13 +317,13 @@ async function selectManufacturerSpecificAttributeDetailsFromAllEndpointTypesAnd
async function selectNonManufacturerSpecificAttributeDetailsFromAllEndpointTypesAndClusters(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
return selectAttributeDetailsFromAllEndpointTypesAndClustersUtil(
db,
endpointsAndClusters,
false,
- packageIds
+ packageIds,
)
}
@@ -339,7 +339,7 @@ async function selectNonManufacturerSpecificAttributeDetailsFromAllEndpointTypes
async function selectAttributeDetailsWithABoundFromEnabledClusters(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
let endpointClusterIds = endpointsAndClusters
.map((ep) => ep.endpointClusterId)
@@ -390,7 +390,7 @@ WHERE ENDPOINT_TYPE_ATTRIBUTE.ENDPOINT_TYPE_CLUSTER_REF in (${endpointClusterIds
AND ENDPOINT_TYPE_CLUSTER.ENABLED=1
AND ATTRIBUTE.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
GROUP BY CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, ATTRIBUTE.MANUFACTURER_CODE, ATTRIBUTE.NAME, ATTRIBUTE.SIDE
- `
+ `,
)
.then((rows) => rows.map(mapFunction))
}
@@ -405,7 +405,7 @@ GROUP BY CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, ATTRIBUTE.MANUFACTURER_CODE, A
async function selectAttributeDetailsFromEnabledClusters(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
let endpointClusterIds = endpointsAndClusters
.map((ep) => ep.endpointClusterId)
@@ -443,7 +443,7 @@ async function selectAttributeDetailsFromEnabledClusters(
maxTokenAttributeSize: x.MAX_TOKEN_ATTRIBUTE_SIZE,
isString: x.IS_STRING,
isManufacturingSpecific: dbApi.toDbBool(
- x.MANUFACTURER_CODE | x.CLUSTER_MANUFACTURER_CODE
+ x.MANUFACTURER_CODE | x.CLUSTER_MANUFACTURER_CODE,
), // Is Attribute mfg specific or not
}
}
@@ -548,7 +548,7 @@ async function selectAttributeDetailsFromEnabledClusters(
AND ATTRIBUTE.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
GROUP BY CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, ATTRIBUTE.CODE, ATTRIBUTE.MANUFACTURER_CODE, ATTRIBUTE.SIDE
ORDER BY CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, ENDPOINT_TYPE_CLUSTER.SIDE, ATTRIBUTE.CODE, ATTRIBUTE.MANUFACTURER_CODE
- `
+ `,
)
.then((rows) => rows.map(mapFunction))
}
@@ -569,7 +569,7 @@ async function selectAttributeDetailsFromEnabledClusters(
async function selectAttributeBoundDetails(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
let endpointClusterIds = endpointsAndClusters
.map((ep) => ep.endpointClusterId)
@@ -719,7 +719,7 @@ AND (CASE
END) > 2 AND ENDPOINT_TYPE_ATTRIBUTE.INCLUDED = 1 AND ATT_VALUE IS NOT NULL AND ATT_VALUE != "" AND ENDPOINT_TYPE_ATTRIBUTE.BOUNDED !=0 AND REPLACE(ATT_VALUE, '0', '')!='x' AND REPLACE(ATT_VALUE, '0', '')!=''
AND ATTRIBUTE.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
GROUP BY CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, ATTRIBUTE.CODE, ATTRIBUTE.MANUFACTURER_CODE, ATTRIBUTE.SIDE )
- `
+ `,
)
.then((rows) => rows.map(mapFunction))
}
@@ -734,7 +734,7 @@ GROUP BY CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, ATTRIBUTE.CODE, ATTRIBUTE.MANU
async function selectReportableAttributeDetailsFromEnabledClustersAndEndpoints(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
let endpointClusterIds = endpointsAndClusters
.map((ep) => ep.endpointClusterId)
@@ -788,7 +788,7 @@ async function selectReportableAttributeDetailsFromEnabledClustersAndEndpoints(
GROUP BY CASE WHEN SINGLETON=0 THEN ENDPOINT.ENDPOINT_IDENTIFIER END, CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, ATTRIBUTE.CODE, ATTRIBUTE.MANUFACTURER_CODE, ATTRIBUTE.SIDE
HAVING CASE WHEN SINGLETON=1 THEN ENDPOINT.ENDPOINT_IDENTIFIER = MIN(ENDPOINT.ENDPOINT_IDENTIFIER) ELSE SINGLETON=0 END
ORDER BY ENDPOINT.ENDPOINT_IDENTIFIER, CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, ATTRIBUTE.CODE, ATTRIBUTE.MANUFACTURER_CODE
- `
+ `,
)
.then((rows) => rows.map(mapFunction))
}
@@ -798,14 +798,14 @@ async function selectAttributeByCode(
packageIds,
clusterCode,
attributeCode,
- manufacturerCode
+ manufacturerCode,
) {
if (clusterCode == null) {
return selectGlobalAttributeByCode(
db,
packageIds,
attributeCode,
- manufacturerCode
+ manufacturerCode,
)
} else {
return selectNonGlobalAttributeByCode(
@@ -813,7 +813,7 @@ async function selectAttributeByCode(
packageIds,
clusterCode,
attributeCode,
- manufacturerCode
+ manufacturerCode,
)
}
}
@@ -823,7 +823,7 @@ async function selectNonGlobalAttributeByCode(
packageIds,
clusterCode,
attributeCode,
- manufacturerCode
+ manufacturerCode,
) {
let manufacturerCondition
let arg = [attributeCode, clusterCode]
@@ -873,7 +873,7 @@ WHERE A.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
AND A.CODE = ?
AND C.CODE = ?
AND ${manufacturerCondition}`,
- arg
+ arg,
)
.then(dbMapping.map.attribute)
}
@@ -882,7 +882,7 @@ async function selectGlobalAttributeByCode(
db,
packageIds,
attributeCode,
- manufacturerCode
+ manufacturerCode,
) {
let manufacturerCondition
let arg = [attributeCode]
@@ -929,7 +929,7 @@ FROM ATTRIBUTE AS A
WHERE A.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
AND A.CODE = ?
AND ${manufacturerCondition}`,
- arg
+ arg,
)
.then(dbMapping.map.attribute)
}
@@ -963,7 +963,7 @@ WHERE
ORDER BY
GAD.CLUSTER_REF, GAD.ATTRIBUTE_REF, GAB.BIT
`,
- [clusterRef, attributeRef]
+ [clusterRef, attributeRef],
)
.then((rows) =>
rows.reduce((ac, row) => {
@@ -977,7 +977,7 @@ ORDER BY
ac.featureBits.push({ bit: row.BIT, value: row.VALUE, tag: row.TAG })
}
return ac
- }, {})
+ }, {}),
)
}
@@ -995,7 +995,7 @@ async function selectTokenAttributesForEndpoint(
db,
packageIds,
endpointTypeRef,
- options
+ options,
) {
let singletonQuery =
'isSingleton' in options.hash
@@ -1044,7 +1044,7 @@ async function selectTokenAttributesForEndpoint(
ATTRIBUTE.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
${singletonQuery}
`,
- endpointTypeRef
+ endpointTypeRef,
)
return rows.map(dbMapping.map.endpointTypeAttributeExtended)
}
@@ -1062,7 +1062,7 @@ async function selectAllUserTokenAttributes(
db,
sessionId,
packageIds,
- options
+ options,
) {
const tokenSqlQuery = `SELECT
ATTRIBUTE.NAME,
@@ -1162,7 +1162,7 @@ AND
)
ORDER BY
TOKEN_ID
- `
+ `,
)
return rows.map(dbMapping.map.endpointTypeAttributeExtended)
@@ -1217,13 +1217,13 @@ async function selectAttributeMappingsByPackageIds(db, packageIds) {
OR
A2.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
- `
+ `,
)
return rows.map(dbMapping.map.attributeMapping)
}
exports.selectAllAttributeDetailsFromEnabledClusters = dbCache.cacheQuery(
- selectAllAttributeDetailsFromEnabledClusters
+ selectAllAttributeDetailsFromEnabledClusters,
)
exports.selectManufacturerSpecificAttributeDetailsFromAllEndpointTypesAndClusters =
selectManufacturerSpecificAttributeDetailsFromAllEndpointTypesAndClusters
@@ -1232,10 +1232,10 @@ exports.selectNonManufacturerSpecificAttributeDetailsFromAllEndpointTypesAndClus
exports.selectAttributeDetailsWithABoundFromEnabledClusters =
dbCache.cacheQuery(selectAttributeDetailsWithABoundFromEnabledClusters)
exports.selectAttributeDetailsFromEnabledClusters = dbCache.cacheQuery(
- selectAttributeDetailsFromEnabledClusters
+ selectAttributeDetailsFromEnabledClusters,
)
exports.selectAttributeBoundDetails = dbCache.cacheQuery(
- selectAttributeBoundDetails
+ selectAttributeBoundDetails,
)
exports.selectReportableAttributeDetailsFromEnabledClustersAndEndpoints =
selectReportableAttributeDetailsFromEnabledClustersAndEndpoints
diff --git a/src-electron/db/query-bitmap.js b/src-electron/db/query-bitmap.js
index ffdf934a51..f3eabae7ec 100644
--- a/src-electron/db/query-bitmap.js
+++ b/src-electron/db/query-bitmap.js
@@ -46,7 +46,7 @@ FROM BITMAP
INNER JOIN DATA_TYPE ON
BITMAP.BITMAP_ID = DATA_TYPE.DATA_TYPE_ID
WHERE PACKAGE_REF = ? ORDER BY NAME`,
- [packageId]
+ [packageId],
)
return rows.map(dbMapping.map.bitmap)
}
@@ -64,9 +64,9 @@ SELECT
FROM BITMAP
INNER JOIN DATA_TYPE ON BITMAP.BITMAP_ID = DATA_TYPE.DATA_TYPE_ID
WHERE (DATA_TYPE.NAME = ? OR DATA_TYPE.NAME = ?) AND DATA_TYPE.PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
+ packageIds,
)})`,
- [name, name.toLowerCase()]
+ [name, name.toLowerCase()],
)
.then(dbMapping.map.bitmap)
}
@@ -83,12 +83,12 @@ async function selectBitmapByNameAndClusterId(db, name, clusterId, packageIds) {
let queryWithoutClusterId = queryUtil.sqlQueryForDataTypeByNameAndClusterId(
'bitmap',
null,
- packageIds
+ packageIds,
)
let queryWithClusterId = queryUtil.sqlQueryForDataTypeByNameAndClusterId(
'bitmap',
clusterId,
- packageIds
+ packageIds,
)
let res = await dbApi
@@ -116,7 +116,7 @@ SELECT
FROM BITMAP
INNER JOIN DATA_TYPE ON BITMAP.BITMAP_ID = DATA_TYPE.DATA_TYPE_ID
WHERE BITMAP_ID = ?`,
- [id]
+ [id],
)
.then(dbMapping.map.bitmap)
}
@@ -125,5 +125,5 @@ exports.selectBitmapById = selectBitmapById
exports.selectAllBitmaps = selectAllBitmaps
exports.selectBitmapByName = dbCache.cacheQuery(selectBitmapByName)
exports.selectBitmapByNameAndClusterId = dbCache.cacheQuery(
- selectBitmapByNameAndClusterId
+ selectBitmapByNameAndClusterId,
)
diff --git a/src-electron/db/query-cluster.js b/src-electron/db/query-cluster.js
index ac717ed96a..6023aa7ad1 100644
--- a/src-electron/db/query-cluster.js
+++ b/src-electron/db/query-cluster.js
@@ -34,7 +34,7 @@ async function selectClusterName(db, clusterRef) {
let clusterName = await dbApi.dbAll(
db,
'SELECT NAME FROM CLUSTER WHERE CLUSTER_ID = ?',
- [clusterRef]
+ [clusterRef],
)
return clusterName[0].NAME
}
@@ -49,7 +49,7 @@ async function selectClusterName(db, clusterRef) {
async function selectClusterDetailsFromEnabledClusters(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
let endpointClusterIds = endpointsAndClusters
.map((ep) => ep.endpointClusterId)
@@ -171,7 +171,7 @@ WHERE
CLUSTER_INDEX = 1
ORDER BY
ENDPOINT_IDENTIFIER, CLUSTER_CODE, CLUSTER_SIDE
- `
+ `,
)
.then((rows) => rows.map(mapFunction))
}
@@ -189,7 +189,7 @@ async function selectAllUserClustersWithTokenAttributes(
db,
sessionId,
packageIds,
- options
+ options,
) {
let singletonQuery =
'isSingleton' in options.hash
@@ -236,7 +236,7 @@ async function selectAllUserClustersWithTokenAttributes(
GROUP BY
CLUSTER.CODE, CLUSTER.MANUFACTURER_CODE
`,
- sessionId
+ sessionId,
)
return rows.map(dbMapping.map.endpointTypeClusterExtended)
@@ -256,7 +256,7 @@ async function selectTokenAttributeClustersForEndpoint(
db,
packageIds,
endpointTypeRef,
- options
+ options,
) {
let singletonQuery =
'isSingleton' in options.hash
@@ -296,7 +296,7 @@ async function selectTokenAttributeClustersForEndpoint(
GROUP BY
CLUSTER.CODE, CLUSTER.MANUFACTURER_CODE
`,
- endpointTypeRef
+ endpointTypeRef,
)
return rows.map(dbMapping.map.cluster)
}
diff --git a/src-electron/db/query-command.js b/src-electron/db/query-command.js
index 82428e17b9..6a7bd72173 100644
--- a/src-electron/db/query-command.js
+++ b/src-electron/db/query-command.js
@@ -34,7 +34,7 @@ async function selectCliCommandCountFromEndpointTypeCluster(
db,
endpointTypes,
endpointClusterId,
- packageIds
+ packageIds,
) {
let endpointTypeIds = endpointTypes.map((ep) => ep.endpointTypeId).toString()
let res = await dbApi.dbAll(
@@ -54,7 +54,7 @@ WHERE ENDPOINT_TYPE_CLUSTER.ENDPOINT_TYPE_REF IN (${endpointTypeIds})
AND ENDPOINT_TYPE_CLUSTER.ENDPOINT_TYPE_CLUSTER_ID = ?
AND COMMAND.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
`,
- [endpointClusterId]
+ [endpointClusterId],
)
return res[0].COUNT
}
@@ -95,9 +95,9 @@ INNER JOIN
ON
PACKAGE_OPTION.OPTION_CODE = COMMAND.NAME
WHERE CLUSTER.CLUSTER_ID = ? AND COMMAND.PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
+ packageIds,
)})`,
- [endpointClusterId]
+ [endpointClusterId],
)
.then((rows) => rows.map(mapFunction))
}
@@ -116,7 +116,7 @@ WHERE CLUSTER.CLUSTER_ID = ? AND COMMAND.PACKAGE_REF IN (${dbApi.toInClause(
async function selectAllAvailableClusterCommandDetailsFromEndpointTypes(
db,
endpointTypes,
- packageIds
+ packageIds,
) {
let endpointTypeIds = endpointTypes.map((ep) => ep.endpointTypeId).toString()
let mapFunction = (x) => {
@@ -226,7 +226,7 @@ GROUP BY
COMMAND_MANUFACTURER_CODE,
COMMAND_NAME
ORDER BY
- CLUSTER_MANUFACTURER_CODE, CLUSTER_CODE, COMMAND_MANUFACTURER_CODE, COMMAND_CODE`
+ CLUSTER_MANUFACTURER_CODE, CLUSTER_CODE, COMMAND_MANUFACTURER_CODE, COMMAND_CODE`,
)
.then((rows) => rows.map(mapFunction))
}
@@ -253,7 +253,7 @@ async function selectAllClustersWithIncomingOrOutgoingCommands(
endpointTypes,
uniqueClusterCodes,
isIncoming,
- packageIds
+ packageIds,
) {
let endpointTypeIds = endpointTypes.map((ep) => ep.endpointTypeId).toString()
let sqlGroupBy = uniqueClusterCodes ? 'CLUSTER.CODE' : 'CLUSTER.NAME'
@@ -305,7 +305,7 @@ AND ENDPOINT_TYPE_CLUSTER.SIDE IN ("client", "server")
AND ENDPOINT_TYPE_CLUSTER.ENABLED = 1 AND ${isIncomingOrOutgoingSql}
AND COMMAND.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
GROUP BY
-${sqlGroupBy}, ENDPOINT_TYPE_CLUSTER.SIDE ORDER BY CLUSTER.NAME, ENDPOINT_TYPE_CLUSTER.SIDE`
+${sqlGroupBy}, ENDPOINT_TYPE_CLUSTER.SIDE ORDER BY CLUSTER.NAME, ENDPOINT_TYPE_CLUSTER.SIDE`,
)
.then((rows) => rows.map(mapFunction))
}
@@ -328,14 +328,14 @@ async function selectAllClustersWithIncomingCommands(
db,
endpointTypes,
uniqueClusterCodes = false,
- packageIds
+ packageIds,
) {
return selectAllClustersWithIncomingOrOutgoingCommands(
db,
endpointTypes,
uniqueClusterCodes,
true,
- packageIds
+ packageIds,
)
}
/**
@@ -357,14 +357,14 @@ async function selectAllClustersWithOutgoingCommands(
db,
endpointTypes,
uniqueClusterCodes = false,
- packageIds
+ packageIds,
) {
return selectAllClustersWithIncomingOrOutgoingCommands(
db,
endpointTypes,
uniqueClusterCodes,
false,
- packageIds
+ packageIds,
)
}
@@ -386,7 +386,7 @@ async function selectMfgClustersWithIncomingCommandsForClusterCode(
db,
endpointTypes,
clusterCode,
- packageIds
+ packageIds,
) {
let endpointTypeIds = endpointTypes.map((ep) => ep.endpointTypeId).toString()
let mapFunction = (x) => {
@@ -441,7 +441,7 @@ WHERE
GROUP BY
CLUSTER.NAME, ENDPOINT_TYPE_CLUSTER.SIDE
ORDER BY
- CLUSTER.NAME, ENDPOINT_TYPE_CLUSTER.SIDE`
+ CLUSTER.NAME, ENDPOINT_TYPE_CLUSTER.SIDE`,
)
.then((rows) => rows.map(mapFunction))
}
@@ -461,12 +461,12 @@ ORDER BY
async function selectAllClustersWithIncomingCommandsCombined(
db,
endpointTypes,
- packageIds
+ packageIds,
) {
let uncombinedClusters = selectAllClustersWithIncomingCommands(
db,
endpointTypes,
- packageIds
+ packageIds,
)
let reduceFunction = (combinedClusters, currentValue) => {
// Find out if current cluster is in combinedClusters, or just use currentValue otherwise.
@@ -490,7 +490,7 @@ async function selectAllClustersWithIncomingCommandsCombined(
return uncombinedClusters.then((rows) => {
return Array.from(
rows.reduce(reduceFunction, new Map()),
- (value, key) => value[1]
+ (value, key) => value[1],
)
})
}
@@ -514,7 +514,7 @@ async function selectAllIncomingCommandsForClusterCombined(
clientSideEnabled,
serverSideEnabled,
isMfgSpecific,
- packageIds
+ packageIds,
) {
let client = clientSideEnabled
? await selectAllIncomingCommandsForCluster(
@@ -523,7 +523,7 @@ async function selectAllIncomingCommandsForClusterCombined(
clName,
'client',
isMfgSpecific,
- packageIds
+ packageIds,
)
: []
let server = serverSideEnabled
@@ -533,7 +533,7 @@ async function selectAllIncomingCommandsForClusterCombined(
clName,
'server',
isMfgSpecific,
- packageIds
+ packageIds,
)
: []
// The assumption here is that, given that this is inside a cluster already; that the command name are unique and sufficient outside of
@@ -549,7 +549,7 @@ async function selectAllIncomingCommandsForClusterCombined(
return Array.from(
combinedClusters.reduce(reduceFunction, new Map()),
- (value, key) => value[1]
+ (value, key) => value[1],
)
}
@@ -571,15 +571,15 @@ async function selectAllIncomingOrOutgoingCommandsForCluster(
clSide,
isMfgSpecific,
isIncoming,
- packageIds
+ packageIds,
) {
let endpointTypeIds = endpointTypes.map((ep) => ep.endpointTypeId).toString()
let mfgSpecificString =
isMfgSpecific === undefined
? ``
: isMfgSpecific
- ? ` AND COMMAND.MANUFACTURER_CODE IS NOT NULL `
- : ` AND COMMAND.MANUFACTURER_CODE IS NULL `
+ ? ` AND COMMAND.MANUFACTURER_CODE IS NOT NULL `
+ : ` AND COMMAND.MANUFACTURER_CODE IS NULL `
let isIncomingOrOutgoingSql = isIncoming
? `ENDPOINT_TYPE_COMMAND.IS_INCOMING = 1 AND ENDPOINT_TYPE_COMMAND.IS_ENABLED=1`
: `ENDPOINT_TYPE_COMMAND.IS_INCOMING = 0 AND ENDPOINT_TYPE_COMMAND.IS_ENABLED=1`
@@ -658,7 +658,7 @@ AND ENDPOINT_TYPE_CLUSTER.SIDE IN ("client", "server") AND ENDPOINT_TYPE_CLUSTER
AND CLUSTER.NAME = "${clName}" AND ENDPOINT_TYPE_CLUSTER.SIDE = "${clSide}"
AND COMMAND.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
${mfgSpecificString} GROUP BY COMMAND.NAME
-ORDER BY CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, COMMAND.MANUFACTURER_CODE, COMMAND.CODE`
+ORDER BY CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, COMMAND.MANUFACTURER_CODE, COMMAND.CODE`,
)
.then((rows) => rows.map(mapFunction))
}
@@ -679,7 +679,7 @@ async function selectAllIncomingCommandsForCluster(
clName,
clSide,
isMfgSpecific,
- packageIds
+ packageIds,
) {
return selectAllIncomingOrOutgoingCommandsForCluster(
db,
@@ -688,7 +688,7 @@ async function selectAllIncomingCommandsForCluster(
clSide,
isMfgSpecific,
true,
- packageIds
+ packageIds,
)
}
@@ -708,7 +708,7 @@ async function selectAllOutgoingCommandsForCluster(
clName,
clSide,
isMfgSpecific,
- packageIds
+ packageIds,
) {
return selectAllIncomingOrOutgoingCommandsForCluster(
db,
@@ -717,7 +717,7 @@ async function selectAllOutgoingCommandsForCluster(
clSide,
isMfgSpecific,
false,
- packageIds
+ packageIds,
)
}
@@ -733,15 +733,15 @@ async function selectAllIncomingCommands(
db,
endpointTypes,
isMfgSpecific,
- packageIds
+ packageIds,
) {
let endpointTypeIds = endpointTypes.map((ep) => ep.endpointTypeId).toString()
let mfgSpecificString =
isMfgSpecific === undefined
? ``
: isMfgSpecific
- ? ` AND COMMAND.MANUFACTURER_CODE IS NOT NULL `
- : ` AND COMMAND.MANUFACTURER_CODE IS NULL `
+ ? ` AND COMMAND.MANUFACTURER_CODE IS NOT NULL `
+ : ` AND COMMAND.MANUFACTURER_CODE IS NULL `
let mapFunction = (x) => {
return {
clusterId: x.CLUSTER_ID,
@@ -822,7 +822,7 @@ WHERE
AND ENDPOINT_TYPE_COMMAND.IS_INCOMING=1 AND ENDPOINT_TYPE_COMMAND.IS_ENABLED = 1
AND COMMAND.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
${mfgSpecificString} GROUP BY CLUSTER.NAME, COMMAND.NAME
-ORDER BY CLUSTER.NAME, COMMAND.NAME`
+ORDER BY CLUSTER.NAME, COMMAND.NAME`,
)
.then((rows) => rows.map(mapFunction))
}
@@ -832,7 +832,7 @@ async function selectCommandByCode(
packageId,
clusterCode,
commandCode,
- mfgCode = null
+ mfgCode = null,
) {
if (clusterCode == null) {
return selectGlobalCommandByCode(db, packageId, commandCode, mfgCode)
@@ -842,7 +842,7 @@ async function selectCommandByCode(
packageId,
clusterCode,
commandCode,
- mfgCode
+ mfgCode,
)
}
}
@@ -852,7 +852,7 @@ async function selectNonGlobalCommandByCode(
packageId,
clusterCode,
commandCode,
- mfgCode = null
+ mfgCode = null,
) {
let query = `
SELECT
@@ -892,7 +892,7 @@ async function selectGlobalCommandByCode(
db,
packageId,
commandCode,
- mfgCode = null
+ mfgCode = null,
) {
let query = `
SELECT
@@ -947,7 +947,7 @@ SELECT
RESPONSE_NAME
FROM COMMAND
WHERE COMMAND_ID = ?`,
- [id]
+ [id],
)
.then(dbMapping.map.command)
}
@@ -991,7 +991,7 @@ WHERE
GROUP BY
COMMAND.COMMAND_ID
ORDER BY CODE`,
- [clusterId]
+ [clusterId],
)
.then((rows) => rows.map(dbMapping.map.command))
}
@@ -1074,7 +1074,7 @@ WHERE
CO.PACKAGE_REF = ?
ORDER BY
CL.CODE, CO.SOURCE, CO.CODE, CA.FIELD_IDENTIFIER`,
- [packageId]
+ [packageId],
)
rows = rows.map(mapFunction)
let reduction = rows.reduce((total, current) => {
@@ -1180,7 +1180,7 @@ ON
CLUSTER.CLUSTER_ID = COMMAND.CLUSTER_REF
WHERE
COMMAND.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
-ORDER BY CLUSTER.CODE, COMMAND.CODE`
+ORDER BY CLUSTER.CODE, COMMAND.CODE`,
)
.then((rows) => rows.map(dbMapping.map.command))
}
@@ -1214,7 +1214,7 @@ ON
WHERE PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
GROUP BY
COMMAND.COMMAND_ID
-ORDER BY COMMAND.CODE, COMMAND.NAME`
+ORDER BY COMMAND.CODE, COMMAND.NAME`,
)
.then((rows) => rows.map(dbMapping.map.command))
}
@@ -1243,7 +1243,7 @@ WHERE
SOURCE = ?
AND PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
ORDER BY CODE`,
- [source]
+ [source],
)
.then((rows) => rows.map(dbMapping.map.command))
}
@@ -1262,7 +1262,7 @@ async function selectCommandsByClusterIdAndSource(
db,
clusterId,
source,
- packageIds
+ packageIds,
) {
return dbApi
.dbAll(
@@ -1286,7 +1286,7 @@ WHERE
AND SOURCE = ?
AND PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
ORDER BY CODE`,
- [clusterId, source]
+ [clusterId, source],
)
.then((rows) => rows.map(dbMapping.map.command))
}
@@ -1323,7 +1323,7 @@ GROUP BY
COMMAND.COMMAND_ID
ORDER BY
CODE`,
- []
+ [],
)
.then((rows) => rows.map(dbMapping.map.command))
}
@@ -1353,7 +1353,7 @@ WHERE
AND PACKAGE_REF = ?
ORDER BY
CODE`,
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.command))
}
@@ -1383,7 +1383,7 @@ FROM COMMAND_ARG, COMMAND
WHERE
COMMAND_ARG.COMMAND_REF = COMMAND.COMMAND_ID
AND COMMAND.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
-ORDER BY COMMAND_REF, FIELD_IDENTIFIER`
+ORDER BY COMMAND_REF, FIELD_IDENTIFIER`,
)
.then((rows) => rows.map(dbMapping.map.commandArgument))
}
@@ -1402,7 +1402,7 @@ async function selectCommandArgumentsCountByCommandId(db, commandId) {
`
SELECT COUNT(*) AS count
FROM COMMAND_ARG WHERE COMMAND_REF = ? `,
- [commandId]
+ [commandId],
)
.then((res) => res[0].count)
}
@@ -1439,7 +1439,7 @@ SELECT
FROM COMMAND_ARG
WHERE COMMAND_REF = ?
ORDER BY FIELD_IDENTIFIER`,
- [commandId]
+ [commandId],
)
.then((rows) => rows.map(dbMapping.map.commandArgument))
}
@@ -1497,7 +1497,7 @@ LEFT JOIN
ON
CMD.COMMAND_ID = CA.COMMAND_REF
WHERE CMD.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
-ORDER BY CL.CODE, CMD.CODE, CA.FIELD_IDENTIFIER`
+ORDER BY CL.CODE, CMD.CODE, CA.FIELD_IDENTIFIER`,
)
.then((rows) => rows.map(dbMapping.map.command))
}
@@ -1534,7 +1534,7 @@ WHERE
COMMAND.RESPONSE_NAME IS NOT NULL
AND COMMAND.PACKAGE_REF = ?
`,
- [packageId]
+ [packageId],
)
}
@@ -1576,7 +1576,7 @@ function commandMapFunction(x) {
async function selectAllCommandDetailsFromEnabledClusters(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
let endpointTypeClusterRef = endpointsAndClusters
.map((ep) => ep.endpointTypeClusterRef)
@@ -1616,7 +1616,7 @@ async function selectAllCommandDetailsFromEnabledClusters(
AND COMMAND.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
GROUP BY
COMMAND.NAME
- `
+ `,
)
.then((rows) => rows.map(commandMapFunction))
}
@@ -1631,7 +1631,7 @@ async function selectAllCommandDetailsFromEnabledClusters(
async function selectAllCliCommandDetailsFromEnabledClusters(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
let endpointTypeClusterRef = endpointsAndClusters
.map((ep) => ep.endpointTypeClusterRef)
@@ -1670,7 +1670,7 @@ async function selectAllCliCommandDetailsFromEnabledClusters(
WHERE ENDPOINT_TYPE_CLUSTER.CLUSTER_REF IN (${endpointTypeClusterRef}) AND ENDPOINT_TYPE_CLUSTER.ENABLED=1
AND COMMAND.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
GROUP BY COMMAND.NAME, CLUSTER.NAME
- `
+ `,
)
.then((rows) => rows.map(commandMapFunction))
}
@@ -1688,7 +1688,7 @@ async function selectCommandDetailsFromAllEndpointTypesAndClusters(
db,
endpointsAndClusters,
doGroupBy,
- packageIds
+ packageIds,
) {
let endpointTypeIds = endpointsAndClusters
.map((ep) => ep.endpointId)
@@ -1772,7 +1772,7 @@ async function selectCommandDetailsFromAllEndpointTypesAndClustersUtil(
db,
endpointsAndClusters,
isManufacturingSpecific,
- packageIds
+ packageIds,
) {
let endpointTypeIds = endpointsAndClusters
.map((ep) => ep.endpointId)
@@ -1837,7 +1837,7 @@ SELECT * FROM (
} NULL
AND COMMAND.PACKAGE_REF IN (${dbApi.toInClause(packageIds)}))
GROUP BY NAME
- `
+ `,
)
.then((rows) => rows.map(commandMapFunction))
}
@@ -1853,13 +1853,13 @@ SELECT * FROM (
async function selectManufacturerSpecificCommandDetailsFromAllEndpointTypesAndClusters(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
return selectCommandDetailsFromAllEndpointTypesAndClustersUtil(
db,
endpointsAndClusters,
true,
- packageIds
+ packageIds,
)
}
@@ -1874,13 +1874,13 @@ async function selectManufacturerSpecificCommandDetailsFromAllEndpointTypesAndCl
async function selectNonManufacturerSpecificCommandDetailsFromAllEndpointTypesAndClusters(
db,
endpointsAndClusters,
- packageIds
+ packageIds,
) {
return selectCommandDetailsFromAllEndpointTypesAndClustersUtil(
db,
endpointsAndClusters,
false,
- packageIds
+ packageIds,
)
}
diff --git a/src-electron/db/query-config.js b/src-electron/db/query-config.js
index f6861fb4ea..88ebd30a27 100644
--- a/src-electron/db/query-config.js
+++ b/src-electron/db/query-config.js
@@ -51,7 +51,7 @@ async function insertOrReplaceClusterState(
endpointTypeId,
clusterRef,
side,
- enabled
+ enabled,
) {
return dbApi.dbInsert(
db,
@@ -64,7 +64,7 @@ VALUES
ON CONFLICT
(ENDPOINT_TYPE_REF, CLUSTER_REF, SIDE)
DO UPDATE SET ENABLED = ?`,
- [endpointTypeId, clusterRef, side, enabled, enabled]
+ [endpointTypeId, clusterRef, side, enabled, enabled],
)
}
@@ -81,7 +81,7 @@ async function selectEndpointClusters(db, endpointTypeId) {
WHERE
ENDPOINT_TYPE_REF = ?
`,
- [endpointTypeId]
+ [endpointTypeId],
)
return rows.map(dbMapping.map.endpointTypeCluster)
@@ -112,7 +112,7 @@ async function selectClusterState(db, endpointTypeId, clusterRef, side) {
CLUSTER_REF = ? AND
SIDE = ?
`,
- [endpointTypeId, clusterRef, side]
+ [endpointTypeId, clusterRef, side],
)
.then(dbMapping.map.endpointTypeCluster)
}
@@ -140,7 +140,7 @@ async function selectClusterStatesForAllEndpoints(db, clusterRef, side) {
CLUSTER_REF = ? AND
SIDE = ?
`,
- [clusterRef, side]
+ [clusterRef, side],
)
.then((rows) => rows.map(dbMapping.map.endpointTypeCluster))
}
@@ -155,10 +155,10 @@ async function selectClusterStatesForAllEndpoints(db, clusterRef, side) {
async function insertClusterDefaults(db, endpointTypeId, packageId, cluster) {
let promises = []
promises.push(
- resolveDefaultAttributes(db, endpointTypeId, packageId, [cluster])
+ resolveDefaultAttributes(db, endpointTypeId, packageId, [cluster]),
)
promises.push(
- resolveNonOptionalCommands(db, endpointTypeId, [cluster], packageId)
+ resolveNonOptionalCommands(db, endpointTypeId, [cluster], packageId),
)
return Promise.all(promises)
}
@@ -183,7 +183,7 @@ async function insertOrUpdateAttributeState(
paramValuePairArray,
reportMinInterval,
reportMaxInterval,
- reportableChange
+ reportableChange,
) {
if (reportMinInterval === undefined || reportMinInterval === null) {
reportMinInterval = 1
@@ -201,7 +201,7 @@ async function insertOrUpdateAttributeState(
db,
endpointTypeId,
clusterRef,
- side
+ side,
)
if (cluster == null) {
throw new Error(`Could not locate cluster: ${clusterRef}`)
@@ -211,7 +211,7 @@ async function insertOrUpdateAttributeState(
await queryZcl.selectAttributeByAttributeIdAndClusterRef(
db,
attributeId,
- clusterRef
+ clusterRef,
)
// Looking for the feature map attribute in matter and setting it as per
// the device types if default value is 0
@@ -225,19 +225,19 @@ async function insertOrUpdateAttributeState(
await queryDeviceType.selectDeviceTypeFeaturesByEndpointTypeIdAndClusterId(
db,
endpointTypeId,
- clusterRef
+ clusterRef,
)
let featureMapBitsToBeEnabled =
mandatoryFeaturesOnEndpointTypeAndCluster.map((f) => f.featureBit)
featureMapBitsToBeEnabled.forEach(
(featureBit) =>
- (featureMapDefaultValue = featureMapDefaultValue | (1 << featureBit))
+ (featureMapDefaultValue = featureMapDefaultValue | (1 << featureBit)),
)
staticAttribute.defaultValue = featureMapDefaultValue
}
let forcedExternal = await queryUpgrade.getForcedExternalStorage(
db,
- staticAttribute.packageRef
+ staticAttribute.packageRef,
)
staticAttribute.storagePolicy =
await queryUpgrade.computeStoragePolicyNewConfig(
@@ -245,10 +245,10 @@ async function insertOrUpdateAttributeState(
clusterRef,
staticAttribute.storagePolicy,
forcedExternal,
- staticAttribute.name
+ staticAttribute.name,
)
let storageOption = await queryUpgrade.computeStorageOptionNewConfig(
- staticAttribute.storagePolicy
+ staticAttribute.storagePolicy,
)
if (
staticAttribute.storagePolicy ==
@@ -291,7 +291,7 @@ INTO ENDPOINT_TYPE_ATTRIBUTE (
reportMinInterval,
reportMaxInterval,
reportableChange,
- ]
+ ],
)
if (paramValuePairArray == null || paramValuePairArray.length == 0) {
@@ -316,7 +316,7 @@ FROM
ENDPOINT_TYPE_ATTRIBUTE AS ETA
WHERE
ENDPOINT_TYPE_CLUSTER_REF = ? AND ATTRIBUTE_REF = ?`,
- [cluster.endpointTypeClusterId, attributeId]
+ [cluster.endpointTypeClusterId, attributeId],
)
return row.ENDPOINT_TYPE_ATTRIBUTE_ID
}
@@ -430,7 +430,7 @@ async function insertOrUpdateCommandState(
side,
commandId,
value,
- isIncoming
+ isIncoming,
) {
/*
Retrieve the cluster side and command source and based on that add incoming/outgoing, incoming is 1 and outgoing is 0
@@ -445,8 +445,8 @@ async function insertOrUpdateCommandState(
!isIncoming
? side
: dbEnum.source.client == side
- ? dbEnum.source.server
- : dbEnum.source.client
+ ? dbEnum.source.server
+ : dbEnum.source.client,
)
await dbApi.dbInsert(
@@ -459,7 +459,7 @@ INTO ENDPOINT_TYPE_COMMAND (
IS_INCOMING
) VALUES( ?, ?, ? )
`,
- [cluster.endpointTypeClusterId, commandId, dbApi.toDbBool(isIncoming)]
+ [cluster.endpointTypeClusterId, commandId, dbApi.toDbBool(isIncoming)],
)
return dbApi.dbUpdate(
db,
@@ -474,7 +474,7 @@ WHERE ENDPOINT_TYPE_CLUSTER_REF = ?
cluster.endpointTypeClusterId,
commandId,
dbApi.toDbBool(isIncoming),
- ]
+ ],
)
}
@@ -496,13 +496,13 @@ async function insertOrUpdateEventState(
clusterRef,
side,
eventId,
- value
+ value,
) {
let cluster = await insertOrSelectDefaultEndpointTypeCluster(
db,
endpointTypeId,
clusterRef,
- side
+ side,
)
await dbApi.dbInsert(
@@ -514,7 +514,7 @@ INTO ENDPOINT_TYPE_EVENT (
EVENT_REF
) VALUES( ?, ? )
`,
- [cluster.endpointTypeClusterId, eventId]
+ [cluster.endpointTypeClusterId, eventId],
)
return dbApi.dbUpdate(
db,
@@ -523,7 +523,7 @@ UPDATE ENDPOINT_TYPE_EVENT
SET INCLUDED = ?
WHERE ENDPOINT_TYPE_CLUSTER_REF = ?
AND EVENT_REF = ? `,
- [value, cluster.endpointTypeClusterId, eventId]
+ [value, cluster.endpointTypeClusterId, eventId],
)
}
@@ -542,7 +542,7 @@ async function updateEndpoint(db, sessionId, endpointId, changesArray) {
`UPDATE ENDPOINT SET ` +
getAllParamValuePairArrayClauses(changesArray) +
`WHERE ENDPOINT_ID = ? AND SESSION_REF = ?`,
- [endpointId, sessionId]
+ [endpointId, sessionId],
)
}
@@ -559,7 +559,7 @@ async function updateParentEndpoint(db, sessionId, endpointId, parentRef) {
return dbApi.dbUpdate(
db,
`UPDATE ENDPOINT SET PARENT_ENDPOINT_REF = ? WHERE ENDPOINT_ID = ? AND SESSION_REF = ?`,
- [parentRef, endpointId, sessionId]
+ [parentRef, endpointId, sessionId],
)
}
@@ -574,13 +574,13 @@ async function updateParentEndpoint(db, sessionId, endpointId, parentRef) {
async function selectCountOfEndpointsWithGivenEndpointIdentifier(
db,
endpointIdentifier,
- sessionId
+ sessionId,
) {
return dbApi
.dbGet(
db,
'SELECT COUNT(ENDPOINT_IDENTIFIER) FROM ENDPOINT WHERE ENDPOINT_IDENTIFIER = ? AND SESSION_REF = ?',
- [endpointIdentifier, sessionId]
+ [endpointIdentifier, sessionId],
)
.then((x) => x['COUNT(ENDPOINT_IDENTIFIER)'])
}
@@ -604,7 +604,7 @@ async function insertEndpointType(
deviceTypeRef,
deviceTypeIdentifier,
deviceTypeVersion,
- doTransaction = true
+ doTransaction = true,
) {
let deviceTypeRefs = Array.isArray(deviceTypeRef)
? deviceTypeRef
@@ -619,7 +619,7 @@ async function insertEndpointType(
let newEndpointTypeId = await dbApi.dbInsert(
db,
'INSERT OR REPLACE INTO ENDPOINT_TYPE ( SESSION_PARTITION_REF, NAME ) VALUES ( ?, ?)',
- [sessionPartitionInfo.sessionPartitionId, name]
+ [sessionPartitionInfo.sessionPartitionId, name],
)
// Creating endpoint type and device type ref combinations along with order of insertion
@@ -640,7 +640,7 @@ async function insertEndpointType(
let etd = await dbApi.dbMultiInsert(
db,
'INSERT INTO ENDPOINT_TYPE_DEVICE (ENDPOINT_TYPE_REF, DEVICE_TYPE_REF, DEVICE_IDENTIFIER, DEVICE_VERSION, DEVICE_TYPE_ORDER) VALUES (?, ?, ?, ?, ?)',
- newEndpointTypeIdDeviceCombination
+ newEndpointTypeIdDeviceCombination,
)
} catch (err) {
// Catching an error from a sql trigger
@@ -651,17 +651,17 @@ async function insertEndpointType(
isErrorStringPresent ? err.split('Error:')[1] : err,
sessionPartitionInfo.sessionRef,
1,
- 1
+ 1,
)
await dbApi.dbMultiInsert(
db,
'DELETE FROM ENDPOINT_TYPE_DEVICE WHERE ENDPOINT_TYPE_REF = ? AND DEVICE_TYPE_REF = ? AND DEVICE_IDENTIFIER = ? AND DEVICE_VERSION =? AND DEVICE_TYPE_ORDER = ?',
- newEndpointTypeIdDeviceCombination
+ newEndpointTypeIdDeviceCombination,
)
await dbApi.dbRemove(
db,
'DELETE FROM ENDPOINT_TYPE WHERE ENDPOINT_TYPE_ID = ?',
- newEndpointTypeId
+ newEndpointTypeId,
)
throw new Error(err)
}
@@ -673,7 +673,7 @@ async function insertEndpointType(
sessionPartitionInfo.sessionRef,
newEndpointTypeId,
dtRef,
- doTransaction
+ doTransaction,
)
}
return newEndpointTypeId
@@ -711,7 +711,7 @@ async function duplicateEndpointType(db, endpointTypeId) {
ENDPOINT_TYPE.SESSION_PARTITION_REF = SESSION_PARTITION.SESSION_PARTITION_ID
WHERE
ENDPOINT_TYPE_DEVICE.ENDPOINT_TYPE_REF = ?`,
- [endpointTypeId]
+ [endpointTypeId],
)
let newEndpointTypeId = 0
if (endpointTypeDeviceInfo && endpointTypeDeviceInfo.length > 0) {
@@ -723,7 +723,7 @@ async function duplicateEndpointType(db, endpointTypeId) {
[
endpointTypeDeviceInfo[0].SESSION_PARTITION_ID,
endpointTypeDeviceInfo[0].NAME,
- ]
+ ],
)
// Enter into the endpoint_type_device table to establish the endpoint_type
@@ -736,7 +736,7 @@ async function duplicateEndpointType(db, endpointTypeId) {
dt.DEVICE_IDENTIFIER,
dt.DEVICE_VERSION,
index,
- ])
+ ]),
)
await dbApi.dbMultiInsert(
db,
@@ -745,7 +745,7 @@ async function duplicateEndpointType(db, endpointTypeId) {
ENDPOINT_TYPE_DEVICE (ENDPOINT_TYPE_REF, DEVICE_TYPE_REF, DEVICE_IDENTIFIER, DEVICE_VERSION, DEVICE_TYPE_ORDER)
VALUES
(?, ?, ?, ?, ?)`,
- endpointTypeDeviceInfoValues
+ endpointTypeDeviceInfoValues,
)
}
@@ -788,13 +788,13 @@ async function updateEndpointType(db, sessionId, endpointTypeId, changesArray) {
ENDPOINT_TYPE.ENDPOINT_TYPE_ID = ? AND SESSION_PARTITION.SESSION_REF = ?
ORDER BY
ENDPOINT_TYPE_DEVICE.DEVICE_TYPE_ORDER`,
- [endpointTypeId, sessionId]
+ [endpointTypeId, sessionId],
)
let existingDeviceTypeRefs = existingDeviceTypeInfo.map(
- (dt) => dt.DEVICE_TYPE_REF
+ (dt) => dt.DEVICE_TYPE_REF,
)
let existingDeviceVersions = existingDeviceTypeInfo.map(
- (dt) => dt.DEVICE_VERSION
+ (dt) => dt.DEVICE_VERSION,
)
let existingEndpointTypeDeviceInfoValues = []
@@ -812,13 +812,13 @@ async function updateEndpointType(db, sessionId, endpointTypeId, changesArray) {
let isDeviceTypeRefsUpdated =
existingDeviceTypeRefs.length != updatedDeviceTypeRefs.length ||
!existingDeviceTypeRefs.every(
- (dtRef, index) => dtRef == updatedDeviceTypeRefs[index]
+ (dtRef, index) => dtRef == updatedDeviceTypeRefs[index],
)
let isDeviceVersionsUpdated =
existingDeviceVersions.length != updatedDeviceVersions.length ||
!existingDeviceVersions.every(
- (version, index) => version == updatedDeviceVersions[index]
+ (version, index) => version == updatedDeviceVersions[index],
)
// Make changes if device type refs or versions have been updated
@@ -827,7 +827,7 @@ async function updateEndpointType(db, sessionId, endpointTypeId, changesArray) {
await dbApi.dbRemove(
db,
'DELETE FROM ENDPOINT_TYPE_DEVICE WHERE ENDPOINT_TYPE_REF = ?',
- endpointTypeId
+ endpointTypeId,
)
// Re-insert endpoint_type_device references with the new references to device types
@@ -850,7 +850,7 @@ async function updateEndpointType(db, sessionId, endpointTypeId, changesArray) {
ENDPOINT_TYPE_DEVICE (ENDPOINT_TYPE_REF, DEVICE_TYPE_REF, DEVICE_VERSION, DEVICE_IDENTIFIER, DEVICE_TYPE_ORDER)
VALUES
(?, ?, ?, ?, ?)`,
- endpointTypeDeviceInfoValues
+ endpointTypeDeviceInfoValues,
)
} catch (err) {
// Catching an error from a sql trigger
@@ -861,13 +861,13 @@ async function updateEndpointType(db, sessionId, endpointTypeId, changesArray) {
isErrorStringPresent ? err.split('Error:')[1] : err,
sessionId,
1,
- 1
+ 1,
)
// Delete endpoint type devices with the latest updates
let test = await dbApi.dbMultiInsert(
db,
'DELETE FROM ENDPOINT_TYPE_DEVICE WHERE ENDPOINT_TYPE_REF = ? AND DEVICE_TYPE_REF = ? AND DEVICE_VERSION =? AND DEVICE_IDENTIFIER = ? AND DEVICE_TYPE_ORDER = ?',
- endpointTypeDeviceInfoValues
+ endpointTypeDeviceInfoValues,
)
// Re add the old device types on the endpoint before the update
@@ -878,7 +878,7 @@ async function updateEndpointType(db, sessionId, endpointTypeId, changesArray) {
ENDPOINT_TYPE_DEVICE (ENDPOINT_TYPE_REF, DEVICE_TYPE_REF, DEVICE_VERSION, DEVICE_IDENTIFIER, DEVICE_TYPE_ORDER)
VALUES
(?, ?, ?, ?, ?)`,
- existingEndpointTypeDeviceInfoValues
+ existingEndpointTypeDeviceInfoValues,
)
throw new Error(err)
}
@@ -909,7 +909,7 @@ async function setEndpointDefaults(
sessionId,
endpointTypeId,
deviceTypeRef,
- doTransaction = true
+ doTransaction = true,
) {
if (doTransaction) {
await dbApi.dbBeginTransaction(db)
@@ -917,7 +917,7 @@ async function setEndpointDefaults(
let pkgs = await queryPackage.getSessionPackagesByType(
db,
sessionId,
- dbEnum.packageType.zclProperties
+ dbEnum.packageType.zclProperties,
)
if (pkgs == null || pkgs.length < 1)
throw new Error('Could not locate package id for a given session.')
@@ -925,7 +925,7 @@ async function setEndpointDefaults(
let deviceTypeInfo =
await querySession.selectDeviceTypePackageInfoFromDeviceTypeId(
db,
- deviceTypeRef
+ deviceTypeRef,
)
let endpointTypeCategory =
deviceTypeInfo.length > 0 ? deviceTypeInfo[0].category : null
@@ -938,12 +938,12 @@ async function setEndpointDefaults(
}
let clusters = await queryDeviceType.selectDeviceTypeClustersByDeviceTypeRef(
db,
- deviceTypeRef
+ deviceTypeRef,
)
let defaultClusters = await resolveDefaultClusters(
db,
endpointTypeId,
- clusters
+ clusters,
)
let promises = []
@@ -951,7 +951,7 @@ async function setEndpointDefaults(
resolveDefaultDeviceTypeAttributes(db, endpointTypeId, deviceTypeRef),
resolveDefaultDeviceTypeCommands(db, endpointTypeId, deviceTypeRef),
resolveDefaultAttributes(db, endpointTypeId, packageId, defaultClusters),
- resolveNonOptionalCommands(db, endpointTypeId, defaultClusters, packageId)
+ resolveNonOptionalCommands(db, endpointTypeId, defaultClusters, packageId),
)
return Promise.all(promises).finally(() => {
@@ -978,13 +978,13 @@ async function resolveDefaultClusters(db, endpointTypeId, clusters) {
endpointTypeId,
cluster.clusterRef,
dbEnum.side.client,
- true
+ true,
).then(() => {
return {
clusterRef: cluster.clusterRef,
side: dbEnum.side.client,
}
- })
+ }),
)
}
if (cluster.includeServer) {
@@ -994,13 +994,13 @@ async function resolveDefaultClusters(db, endpointTypeId, clusters) {
endpointTypeId,
cluster.clusterRef,
dbEnum.side.server,
- true
+ true,
).then(() => {
return {
clusterRef: cluster.clusterRef,
side: dbEnum.side.server,
}
- })
+ }),
)
}
return Promise.all(clientServerPromise)
@@ -1020,19 +1020,19 @@ async function resolveDefaultClusters(db, endpointTypeId, clusters) {
async function resolveDefaultDeviceTypeAttributes(
db,
endpointTypeId,
- deviceTypeRef
+ deviceTypeRef,
) {
let deviceTypeAttributes =
await queryDeviceType.selectDeviceTypeAttributesByDeviceTypeRef(
db,
- deviceTypeRef
+ deviceTypeRef,
)
let promises = deviceTypeAttributes.map(async (deviceAttribute) => {
if (deviceAttribute.attributeRef != null) {
let attribute = await queryZcl.selectAttributeById(
db,
- deviceAttribute.attributeRef
+ deviceAttribute.attributeRef,
)
let clusterRef = attribute?.clusterRef
@@ -1059,7 +1059,7 @@ async function resolveDefaultDeviceTypeAttributes(
],
attribute.reportMinInterval,
attribute.reportMaxInterval,
- attribute.reportableChange
+ attribute.reportableChange,
)
}
})
@@ -1070,13 +1070,13 @@ async function resolveCommandState(db, endpointTypeId, deviceCommand) {
let deviceTypeCluster =
await queryDeviceType.selectDeviceTypeClusterByDeviceTypeClusterId(
db,
- deviceCommand.deviceTypeClusterRef
+ deviceCommand.deviceTypeClusterRef,
)
if (deviceCommand.commandRef == null) return null
let command = await queryCommand.selectCommandById(
db,
- deviceCommand.commandRef
+ deviceCommand.commandRef,
)
if (command == null) return null
@@ -1090,8 +1090,8 @@ async function resolveCommandState(db, endpointTypeId, deviceCommand) {
command.source,
deviceCommand.commandRef,
true,
- command.source != dbEnum.source.client
- )
+ command.source != dbEnum.source.client,
+ ),
)
}
if (deviceTypeCluster.includeServer) {
@@ -1103,8 +1103,8 @@ async function resolveCommandState(db, endpointTypeId, deviceCommand) {
command.source,
deviceCommand.commandRef,
true,
- command.source != dbEnum.source.server
- )
+ command.source != dbEnum.source.server,
+ ),
)
}
return Promise.all(promises)
@@ -1121,14 +1121,14 @@ async function resolveCommandState(db, endpointTypeId, deviceCommand) {
async function resolveDefaultDeviceTypeCommands(
db,
endpointTypeId,
- deviceTypeRef
+ deviceTypeRef,
) {
let commands = await queryDeviceType.selectDeviceTypeCommandsByDeviceTypeRef(
db,
- deviceTypeRef
+ deviceTypeRef,
)
return Promise.all(
- commands.map((cmd) => resolveCommandState(db, endpointTypeId, cmd))
+ commands.map((cmd) => resolveCommandState(db, endpointTypeId, cmd)),
)
}
@@ -1136,7 +1136,7 @@ async function resolveNonOptionalCommands(
db,
endpointTypeId,
clusters,
- packageIds
+ packageIds,
) {
let clustersPromises = clusters.map((cluster) =>
queryCommand
@@ -1157,14 +1157,14 @@ async function resolveNonOptionalCommands(
command.source,
command.id,
true,
- !isOutgoing
+ !isOutgoing,
)
} else {
return Promise.resolve()
}
- })
- )
- )
+ }),
+ ),
+ ),
)
return Promise.all(clustersPromises)
}
@@ -1173,7 +1173,7 @@ async function resolveDefaultAttributes(
db,
endpointTypeId,
packageId,
- endpointClusters
+ endpointClusters,
) {
let endpointClustersPromises = endpointClusters.map((cluster) =>
queryZcl
@@ -1181,7 +1181,7 @@ async function resolveDefaultAttributes(
db,
cluster.clusterRef,
[packageId],
- cluster.side
+ cluster.side,
)
.then((attributes) => {
let promiseArray = []
@@ -1190,11 +1190,11 @@ async function resolveDefaultAttributes(
db,
endpointTypeId,
attributes,
- cluster
- )
+ cluster,
+ ),
)
return Promise.all(promiseArray)
- })
+ }),
)
return Promise.all(endpointClustersPromises)
}
@@ -1203,7 +1203,7 @@ async function resolveNonOptionalAndReportableAttributes(
db,
endpointTypeId,
attributes,
- cluster
+ cluster,
) {
let promises = attributes.map((attribute) => {
let settings = []
@@ -1239,7 +1239,7 @@ async function resolveNonOptionalAndReportableAttributes(
settings,
attribute.reportMinInterval,
attribute.reportMaxInterval,
- attribute.reportableChange
+ attribute.reportableChange,
)
} else {
return Promise.resolve()
@@ -1268,7 +1268,7 @@ async function selectEndpointTypeCount(db, sessionId) {
SESSION_PARTITION.SESSION_PARTITION_ID = ENDPOINT_TYPE.SESSION_PARTITION_REF
WHERE
SESSION_PARTITION.SESSION_REF = ?`,
- [sessionId]
+ [sessionId],
)
return x['CNT']
}
@@ -1285,7 +1285,7 @@ async function selectEndpointTypeCountByCluster(
db,
sessionId,
endpointClusterId,
- side
+ side,
) {
let x = await dbApi.dbGet(
db,
@@ -1303,7 +1303,7 @@ WHERE SESSION_PARTITION.SESSION_REF = ?
(SELECT ENDPOINT_TYPE_REF
FROM ENDPOINT_TYPE_CLUSTER
WHERE CLUSTER_REF = ? AND SIDE = ? AND ENABLED = 1) `,
- [sessionId, endpointClusterId, side]
+ [sessionId, endpointClusterId, side],
)
return x['COUNT(ENDPOINT_TYPE_ID)']
}
@@ -1320,7 +1320,7 @@ async function insertOrSelectDefaultEndpointTypeCluster(
db,
endpointTypeId,
clusterRef,
- side
+ side,
) {
await dbApi.dbInsert(
db,
@@ -1330,7 +1330,7 @@ INTO ENDPOINT_TYPE_CLUSTER (
ENDPOINT_TYPE_REF, CLUSTER_REF, SIDE, ENABLED
) VALUES ( ?, ?, ?, ? )
`,
- [endpointTypeId, clusterRef, side, false]
+ [endpointTypeId, clusterRef, side, false],
)
let eptClusterData = await dbApi.dbGet(
@@ -1346,7 +1346,7 @@ FROM ENDPOINT_TYPE_CLUSTER
WHERE ENDPOINT_TYPE_REF = ?
AND CLUSTER_REF = ?
AND SIDE = ?`,
- [endpointTypeId, clusterRef, side]
+ [endpointTypeId, clusterRef, side],
)
return dbMapping.map.endpointTypeCluster(eptClusterData)
@@ -1370,7 +1370,7 @@ async function selectEndpointTypeAttributeId(
clusterCode,
attributeCode,
attributeSide,
- mfgCode
+ mfgCode,
) {
let args = [
endpointTypeId,
@@ -1411,7 +1411,7 @@ WHERE
: 'A.MANUFACTURER_CODE = ?'
}
`,
- args
+ args,
)
if (rows.length == 0) {
return null
@@ -1419,7 +1419,7 @@ WHERE
return rows[0].ENDPOINT_TYPE_ATTRIBUTE_ID
} else {
throw new Error(
- `Ambiguity: multiple attributes with same data loaded: ${endpointTypeId} / ${clusterCode} / ${attributeCode} / ${attributeSide}.`
+ `Ambiguity: multiple attributes with same data loaded: ${endpointTypeId} / ${clusterCode} / ${attributeCode} / ${attributeSide}.`,
)
}
}
@@ -1472,7 +1472,7 @@ WHERE
ORDER BY
CLUSTER_CODE, ATTRIBUTE_CODE
`,
- [sessionId]
+ [sessionId],
)
.then((rows) =>
rows.map((row) => {
@@ -1497,7 +1497,7 @@ ORDER BY
change: row.REPORTABLE_CHANGE,
},
}
- })
+ }),
)
}
@@ -1516,14 +1516,14 @@ async function setClusterIncluded(
endpointTypeId,
clusterCode,
isIncluded,
- side
+ side,
) {
let cluster = await queryZcl.selectClusterByCode(db, packageId, clusterCode)
let clusterState = await selectClusterState(
db,
endpointTypeId,
cluster.id,
- side
+ side,
)
let insertDefaults = clusterState == null
await insertOrReplaceClusterState(
@@ -1531,7 +1531,7 @@ async function setClusterIncluded(
endpointTypeId,
cluster.id,
side,
- isIncluded
+ isIncluded,
)
if (insertDefaults) {
await insertClusterDefaults(db, endpointTypeId, packageId, {
diff --git a/src-electron/db/query-data-type-discriminator.js b/src-electron/db/query-data-type-discriminator.js
index 9792f6e624..bae6600f50 100644
--- a/src-electron/db/query-data-type-discriminator.js
+++ b/src-electron/db/query-data-type-discriminator.js
@@ -40,7 +40,7 @@ async function selectAllDiscriminators(db, packageIds) {
DISCRIMINATOR
WHERE
PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
- `
+ `,
)
.then((rows) => rows.map(dbMapping.map.discriminator))
}
diff --git a/src-electron/db/query-data-type.js b/src-electron/db/query-data-type.js
index 83c0a76091..46bc80b36e 100644
--- a/src-electron/db/query-data-type.js
+++ b/src-electron/db/query-data-type.js
@@ -53,7 +53,7 @@ async function selectDataTypeById(db, id) {
DATA_TYPE.DISCRIMINATOR_REF = DISCRIMINATOR.DISCRIMINATOR_ID
WHERE
DATA_TYPE_ID = ?`,
- [id]
+ [id],
)
.then(dbMapping.map.dataType)
}
@@ -87,9 +87,9 @@ async function selectDataTypeByName(db, name, packageIds) {
DATA_TYPE.DISCRIMINATOR_REF = DISCRIMINATOR.DISCRIMINATOR_ID
WHERE
(DATA_TYPE.NAME = ? OR DATA_TYPE.NAME = ?) AND DATA_TYPE.PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
+ packageIds,
)})`,
- [name, smallCaseName]
+ [name, smallCaseName],
)
.then(dbMapping.map.dataType)
}
@@ -107,7 +107,7 @@ async function selectDataTypeByNameAndClusterId(
db,
name,
clusterId,
- packageIds
+ packageIds,
) {
let selectQueryString = `
SELECT
@@ -184,7 +184,7 @@ async function selectAllDataTypes(db, packageId) {
ON
DATA_TYPE.DISCRIMINATOR_REF = DISCRIMINATOR.DISCRIMINATOR_ID
WHERE DATA_TYPE.PACKAGE_REF = ?`,
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.dataType))
}
@@ -242,7 +242,7 @@ async function selectSizeFromType(db, packageIds, value) {
}
} catch (err) {
envConfig.logError(
- 'Could not find the size of type: ' + dataType.name + ' : ' + err
+ 'Could not find the size of type: ' + dataType.name + ' : ' + err,
)
}
}
@@ -252,5 +252,5 @@ exports.selectDataTypeByName = dbCache.cacheQuery(selectDataTypeByName)
exports.selectAllDataTypes = selectAllDataTypes
exports.selectSizeFromType = selectSizeFromType
exports.selectDataTypeByNameAndClusterId = dbCache.cacheQuery(
- selectDataTypeByNameAndClusterId
+ selectDataTypeByNameAndClusterId,
)
diff --git a/src-electron/db/query-device-type.js b/src-electron/db/query-device-type.js
index 3f2a8d8462..bea1c70227 100644
--- a/src-electron/db/query-device-type.js
+++ b/src-electron/db/query-device-type.js
@@ -35,7 +35,7 @@ async function selectAllDeviceTypes(db, packageId) {
.dbAll(
db,
'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION, CLASS, PACKAGE_REF FROM DEVICE_TYPE WHERE PACKAGE_REF = ? ORDER BY DOMAIN, CODE',
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.deviceType))
}
@@ -52,7 +52,7 @@ async function selectDeviceTypeById(db, id) {
.dbGet(
db,
'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION, CLASS, PACKAGE_REF FROM DEVICE_TYPE WHERE DEVICE_TYPE_ID = ?',
- [id]
+ [id],
)
.then(dbMapping.map.deviceType)
}
@@ -71,7 +71,7 @@ async function selectDeviceTypeByCodeAndName(db, packageId, code, name) {
.dbGet(
db,
'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION, CLASS FROM DEVICE_TYPE WHERE CODE = ? AND NAME = ? AND PACKAGE_REF = ? ',
- [code, name, packageId]
+ [code, name, packageId],
)
.then(dbMapping.map.deviceType)
}
@@ -90,7 +90,7 @@ async function selectDeviceTypeByCode(db, packageId, code) {
.dbGet(
db,
'SELECT DEVICE_TYPE_ID, DOMAIN, CODE, PROFILE_ID, NAME, DESCRIPTION, CLASS FROM DEVICE_TYPE WHERE CODE = ? AND PACKAGE_REF = ? ',
- [code, packageId]
+ [code, packageId],
)
.then(dbMapping.map.deviceType)
}
@@ -113,14 +113,14 @@ async function selectDeviceTypeClustersByDeviceTypeRef(db, deviceTypeRef) {
WHERE
DEVICE_TYPE_REF IN (?)
ORDER BY CLUSTER_NAME`,
- [deviceTypeRef]
+ [deviceTypeRef],
)
return rows.map(dbMapping.map.deviceTypeCluster)
}
async function selectDeviceTypeClusterByDeviceTypeClusterId(
db,
- deviceTypeClusterId
+ deviceTypeClusterId,
) {
let row = await dbApi.dbGet(
db,
@@ -138,7 +138,7 @@ async function selectDeviceTypeClusterByDeviceTypeClusterId(
DEVICE_TYPE_CLUSTER
WHERE
DEVICE_TYPE_CLUSTER_ID = ?`,
- [deviceTypeClusterId]
+ [deviceTypeClusterId],
)
return dbMapping.map.deviceTypeCluster(row)
}
@@ -166,7 +166,7 @@ async function selectDeviceTypeAttributesByDeviceTypeRef(db, deviceTypeRef) {
AT.ATTRIBUTE_REF = ATTRIBUTE.ATTRIBUTE_ID
WHERE
C.DEVICE_TYPE_REF IN (?)`,
- [deviceTypeRef]
+ [deviceTypeRef],
)
return rows.map(dbMapping.map.deviceTypeAttribute)
}
@@ -195,7 +195,7 @@ async function selectDeviceTypeCommandsByDeviceTypeRef(db, deviceTypeRef) {
CMD.COMMAND_REF = COMMAND.COMMAND_ID
WHERE
C.DEVICE_TYPE_REF IN (?)`,
- [deviceTypeRef]
+ [deviceTypeRef],
)
return rows.map(dbMapping.map.deviceTypeCommand)
}
@@ -229,7 +229,7 @@ WHERE
FROM DEVICE_TYPE
WHERE DEVICE_TYPE_ID = DEVICE_TYPE_CLUSTER.DEVICE_TYPE_REF
) = ?`,
- [packageId, packageId]
+ [packageId, packageId],
)
}
@@ -269,7 +269,7 @@ SET
WHERE
DEVICE_TYPE_ATTRIBUTE.ATTRIBUTE_REF IS NULL
`,
- [packageId]
+ [packageId],
)
}
@@ -308,7 +308,7 @@ SET
)
WHERE
DEVICE_TYPE_COMMAND.COMMAND_REF IS NULL`,
- [packageId]
+ [packageId],
)
}
@@ -347,7 +347,7 @@ SET
)
WHERE
DEVICE_TYPE_FEATURE.FEATURE_REF IS NULL`,
- [packageId]
+ [packageId],
)
}
@@ -381,7 +381,7 @@ async function updateDeviceTypeEntityReferences(db, packageId) {
*/
async function selectDeviceTypesWithCompositionByEndpointTypeId(
db,
- endpointTypeId
+ endpointTypeId,
) {
let rows = await dbApi.dbAll(
db,
@@ -402,7 +402,7 @@ async function selectDeviceTypesWithCompositionByEndpointTypeId(
ENDPOINT_COMPOSITION AS EC ON DT.CODE = EC.CODE
WHERE
ETD.ENDPOINT_TYPE_REF = ?`,
- [endpointTypeId]
+ [endpointTypeId],
)
return rows.map(dbMapping.map.endpointTypeDeviceExtended)
}
@@ -428,7 +428,7 @@ async function selectDeviceTypesByEndpointTypeId(db, endpointTypeId) {
ENDPOINT_TYPE_DEVICE AS ETD
WHERE
ETD.ENDPOINT_TYPE_REF = ?`,
- [endpointTypeId]
+ [endpointTypeId],
)
return rows.map(dbMapping.map.endpointTypeDevice)
}
@@ -444,7 +444,7 @@ async function selectDeviceTypesByEndpointTypeId(db, endpointTypeId) {
async function selectDeviceTypeFeaturesByEndpointTypeIdAndClusterId(
db,
endpointTypeId,
- clusterId
+ clusterId,
) {
let rows = await dbApi.dbAll(
db,
@@ -484,7 +484,7 @@ async function selectDeviceTypeFeaturesByEndpointTypeIdAndClusterId(
(clusterId != 'all'
? ` AND
DEVICE_TYPE_CLUSTER.CLUSTER_REF = ${clusterId}`
- : ``)
+ : ``),
)
return rows.map(dbMapping.map.endpointTypeDeviceExtended)
}
diff --git a/src-electron/db/query-endpoint-type.js b/src-electron/db/query-endpoint-type.js
index f587cf6014..278a3fcf86 100644
--- a/src-electron/db/query-endpoint-type.js
+++ b/src-electron/db/query-endpoint-type.js
@@ -34,7 +34,7 @@ async function deleteEndpointType(db, id) {
return dbApi.dbRemove(
db,
'DELETE FROM ENDPOINT_TYPE WHERE ENDPOINT_TYPE_ID = ?',
- [id]
+ [id],
)
}
@@ -62,7 +62,7 @@ async function selectAllEndpointTypes(db, sessionId) {
ON
ENDPOINT_TYPE.SESSION_PARTITION_REF = SESSION_PARTITION.SESSION_PARTITION_ID
WHERE SESSION_PARTITION.SESSION_REF = ? ORDER BY NAME`,
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(dbMapping.map.endpointType))
@@ -104,7 +104,7 @@ WHERE SESSION_PARTITION.SESSION_REF = ? ORDER BY NAME`,
DEVICE_TYPE.NAME,
DEVICE_TYPE.CODE,
DEVICE_TYPE.PROFILE_ID`,
- [sessionId, et.endpointTypeId]
+ [sessionId, et.endpointTypeId],
)
// Updating the device type info for the endpoint
et.deviceTypeRef = rows.map((x) => x.DEVICE_TYPE_ID)
@@ -147,7 +147,7 @@ ON
WHERE
SESSION_PARTITION.SESSION_REF = ?
ORDER BY ENDPOINT_TYPE.NAME`,
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(mapFunction))
}
@@ -187,7 +187,7 @@ ON
WHERE
SESSION_PARTITION.SESSION_REF = ?
ORDER BY ENDPOINT_TYPE.NAME`,
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(mapFunction))
}
@@ -216,7 +216,7 @@ async function selectEndpointType(db, id) {
ENDPOINT_TYPE.SESSION_PARTITION_REF = SESSION_PARTITION.SESSION_PARTITION_ID
WHERE
ENDPOINT_TYPE_ID = ?`,
- [id]
+ [id],
)
.then(dbMapping.map.endpointType)
@@ -240,7 +240,7 @@ async function selectEndpointType(db, id) {
DEVICE_TYPE.NAME,
DEVICE_TYPE.CODE,
DEVICE_TYPE.PROFILE_ID`,
- [id]
+ [id],
)
endpointType.deviceTypes = rows.map((row) => row.DEVICE_TYPE_ID)
endpointType.deviceVersions = rows.map((row) => row.DEVICE_VERSION)
@@ -263,7 +263,7 @@ async function selectEndpointType(db, id) {
async function selectAllClustersDetailsFromEndpointTypes(
db,
endpointTypes,
- side = null // should be null (for either), 'client' or 'server'
+ side = null, // should be null (for either), 'client' or 'server'
) {
let endpointClusterSideFilter
if (side == null) {
@@ -324,7 +324,7 @@ ${
doOrderBy
? 'ORDER BY CLUSTER.MANUFACTURER_CODE, CLUSTER.CODE, CLUSTER.DEFINE'
: ''
-}`
+}`,
)
.then((rows) => rows.map(mapFunction))
}
@@ -338,7 +338,7 @@ ${
*/
async function selectEndpointDetailsFromAddedEndpoints(
db,
- endpointsAndClusters
+ endpointsAndClusters,
) {
let endpointClusterIds = endpointsAndClusters
.map((ep) => ep.endpointClusterId)
@@ -457,7 +457,7 @@ SELECT * FROM (
WHERE ENDPOINT_TYPE_ATTRIBUTE.ENDPOINT_TYPE_CLUSTER_REF IN (${endpointClusterIds}) AND ENDPOINT_TYPE_CLUSTER.ENABLED=1
AND ENDPOINT_TYPE_ATTRIBUTE.INCLUDED = 1 AND ENDPOINT_TYPE_CLUSTER.SIDE=ATTRIBUTE.SIDE AND ENDPOINT_TYPE_DEVICE.DEVICE_TYPE_ORDER = 0
GROUP BY ENDPOINT.ENDPOINT_IDENTIFIER, CLUSTER.MANUFACTURER_CODE, CLUSTER.NAME, ENDPOINT_TYPE_CLUSTER.SIDE, ATTRIBUTE.NAME) WHERE ENDPOINT_INDEX=1 ORDER BY ENDPOINT_IDENTIFIER
- `
+ `,
)
.then((rows) => rows.map(mapFunction))
}
@@ -505,7 +505,7 @@ WHERE
ENDPOINT_TYPE_CLUSTER.ENDPOINT_TYPE_REF IN (${endpointTypeIds})
AND ENDPOINT_TYPE_CLUSTER.SIDE IS NOT "" AND ENDPOINT_TYPE_CLUSTER.ENABLED = 1
GROUP BY
- NAME`
+ NAME`,
)
.then((rows) => rows.map(mapFunction))
}
@@ -519,7 +519,7 @@ GROUP BY
*/
async function selectAllClustersDetailsIrrespectiveOfSideFromEndpointTypes(
db,
- endpointTypes
+ endpointTypes,
) {
let endpointTypeIds = endpointTypes.map((ep) => ep.endpointTypeId).toString()
let mapFunction = (x) => {
@@ -553,7 +553,7 @@ INNER JOIN ENDPOINT_TYPE_CLUSTER
ON CLUSTER.CLUSTER_ID = ENDPOINT_TYPE_CLUSTER.CLUSTER_REF
WHERE ENDPOINT_TYPE_CLUSTER.ENDPOINT_TYPE_REF IN (${endpointTypeIds})
AND ENDPOINT_TYPE_CLUSTER.SIDE IS NOT "" AND ENDPOINT_TYPE_CLUSTER.ENABLED=1
-GROUP BY NAME`
+GROUP BY NAME`,
)
.then((rows) => rows.map(mapFunction))
}
@@ -571,7 +571,7 @@ async function selectCommandDetailsFromAllEndpointTypeCluster(
db,
endpointTypes,
endpointClusterId,
- packageIds
+ packageIds,
) {
let endpointTypeIds = endpointTypes.map((ep) => ep.endpointTypeId).toString()
let mapFunction = (x) => {
@@ -614,7 +614,7 @@ async function selectCommandDetailsFromAllEndpointTypeCluster(
AND
COMMAND.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
`,
- [endpointClusterId]
+ [endpointClusterId],
)
.then((rows) => rows.map(mapFunction))
}
@@ -634,7 +634,7 @@ async function selectCommandDetailsFromAllEndpointTypeCluster(
*/
async function selectClustersAndEndpointDetailsFromEndpointTypes(
db,
- endpointTypes
+ endpointTypes,
) {
let endpointTypeIds = endpointTypes.map((ep) => ep.endpointTypeId).toString()
let mapFunction = (x) => {
@@ -659,7 +659,7 @@ INNER JOIN
ON
CLUSTER.CLUSTER_ID = ETC.CLUSTER_REF
WHERE
- ETC.ENDPOINT_TYPE_REF IN (${endpointTypeIds})`
+ ETC.ENDPOINT_TYPE_REF IN (${endpointTypeIds})`,
)
return rows.map(mapFunction)
}
@@ -677,7 +677,7 @@ async function selectEndpointTypeAttributeFromEndpointTypeClusterId(
db,
endpointTypeClusterId,
attributeCode,
- attributeMfgCode
+ attributeMfgCode,
) {
let eta = await dbApi.dbGet(
db,
@@ -706,7 +706,7 @@ async function selectEndpointTypeAttributeFromEndpointTypeClusterId(
` +
(attributeMfgCode
? ` AND A.MANUFACTURER_CODE = ${attributeMfgCode}`
- : ` AND A.MANUFACTURER_CODE IS NULL`)
+ : ` AND A.MANUFACTURER_CODE IS NULL`),
)
return dbMapping.map.endpointTypeAttribute(eta)
}
@@ -724,7 +724,7 @@ async function selectEndpointTypeClusterFromEndpointIdentifierAndAttributeRef(
db,
sessionId,
endpointIdentifier,
- attributeRef
+ attributeRef,
) {
let etc = await dbApi.dbGet(
db,
@@ -763,7 +763,7 @@ async function selectEndpointTypeClusterFromEndpointIdentifierAndAttributeRef(
AND
E.ENDPOINT_IDENTIFIER = ${endpointIdentifier}
AND
- ETC.SIDE = A.SIDE`
+ ETC.SIDE = A.SIDE`,
)
return dbMapping.map.endpointTypeCluster(etc)
}
diff --git a/src-electron/db/query-endpoint.js b/src-electron/db/query-endpoint.js
index c5978fcf75..baf98b1a33 100644
--- a/src-electron/db/query-endpoint.js
+++ b/src-electron/db/query-endpoint.js
@@ -53,7 +53,7 @@ ON
WHERE E1.SESSION_REF = ?
ORDER BY E1.ENDPOINT_IDENTIFIER
`,
- [sessionId]
+ [sessionId],
)
return rows.map(dbMapping.map.endpoint)
}
@@ -70,7 +70,7 @@ ORDER BY E1.ENDPOINT_IDENTIFIER
async function selectAllEndpointsBasedOnTemplateCategory(
db,
sessionId,
- templateCategory
+ templateCategory,
) {
let rows = await dbApi.dbAll(
db,
@@ -115,7 +115,7 @@ GROUP BY
E1.ENDPOINT_IDENTIFIER
ORDER BY E1.ENDPOINT_IDENTIFIER
`,
- [sessionId, templateCategory]
+ [sessionId, templateCategory],
)
// if now rows are found then return all endpoints in the session. This can
@@ -157,7 +157,7 @@ WHERE
AND EC.ENDPOINT_TYPE_REF = ?
ORDER BY C.CODE
`,
- [endpointTypeId]
+ [endpointTypeId],
)
return rows.map((row) => {
return {
@@ -186,7 +186,7 @@ async function selectEndpointClusterAttributes(
db,
clusterId,
side,
- endpointTypeId
+ endpointTypeId,
) {
let rows = await dbApi.dbAll(
db,
@@ -234,7 +234,7 @@ WHERE
WHERE CLUSTER_REF = ? AND SIDE = ? AND ENDPOINT_TYPE_REF = ?) ))
ORDER BY A.MANUFACTURER_CODE, A.CODE
`,
- [clusterId, side, clusterId, side, endpointTypeId]
+ [clusterId, side, clusterId, side, endpointTypeId],
)
return rows.map((row) => {
@@ -336,7 +336,7 @@ GROUP BY
COMMAND_ID
ORDER BY CODE
`,
- [clusterId, endpointTypeId]
+ [clusterId, endpointTypeId],
)
return rows.map((row) => {
@@ -400,7 +400,7 @@ WHERE
AND ETC.ENDPOINT_TYPE_REF = ?
ORDER BY E.MANUFACTURER_CODE, E.CODE
`,
- [clusterId, endpointTypeId]
+ [clusterId, endpointTypeId],
)
.then((rows) => rows.map(dbMapping.map.event))
}
@@ -430,7 +430,7 @@ async function getParentEndpointRef(db, parentEndpointIdentifier, sessionId) {
let parentEndpointRef = await dbApi.dbAll(
db,
'SELECT ENDPOINT_ID FROM ENDPOINT WHERE ENDPOINT_IDENTIFIER = ? AND SESSION_REF = ?',
- [parentEndpointIdentifier, sessionId]
+ [parentEndpointIdentifier, sessionId],
)
if (parentEndpointRef[0]) {
return parentEndpointRef[0].ENDPOINT_ID
@@ -451,7 +451,7 @@ async function getParentEndpointIdentifier(db, parentRef, sessionId) {
let parentEndpointIdentifier = await dbApi.dbAll(
db,
'SELECT ENDPOINT_IDENTIFIER FROM ENDPOINT WHERE ENDPOINT_ID = ? AND SESSION_REF = ?',
- [parentRef, sessionId]
+ [parentRef, sessionId],
)
if (parentEndpointIdentifier[0]) {
return parentEndpointIdentifier[0].ENDPOINT_ID
@@ -480,7 +480,7 @@ async function insertEndpoint(
endpointTypeRef,
networkIdentifier,
profileIdentifier,
- parentRef = null
+ parentRef = null,
) {
return dbApi.dbInsert(
db,
@@ -501,7 +501,7 @@ INTO ENDPOINT (
networkIdentifier,
profileIdentifier,
parentRef,
- ]
+ ],
)
}
@@ -534,7 +534,7 @@ async function duplicateEndpoint(db, id, endpointIdentifier, endpointTypeId) {
ENDPOINT
WHERE
ENDPOINT_ID = ?`,
- [endpointIdentifier, endpointTypeId, id]
+ [endpointIdentifier, endpointTypeId, id],
)
}
@@ -574,7 +574,7 @@ ON
E2.ENDPOINT_ID = E1.PARENT_ENDPOINT_REF
WHERE
E1.ENDPOINT_ID = ?`,
- [endpointId]
+ [endpointId],
)
.then(dbMapping.map.endpoint)
}
diff --git a/src-electron/db/query-enum.js b/src-electron/db/query-enum.js
index 94489f3bec..26d9dbf136 100644
--- a/src-electron/db/query-enum.js
+++ b/src-electron/db/query-enum.js
@@ -51,7 +51,7 @@ INNER JOIN DATA_TYPE ON
WHERE
DATA_TYPE.PACKAGE_REF = ?
ORDER BY DATA_TYPE.NAME`,
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.enum))
}
@@ -89,7 +89,7 @@ WHERE
DT.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
AND DATA_TYPE_CLUSTER.CLUSTER_REF = ?
ORDER BY DT.NAME`,
- [clusterId]
+ [clusterId],
)
.then((rows) => rows.map(dbMapping.map.enum))
}
@@ -113,7 +113,7 @@ FROM
WHERE
ENUM_REF = ?
ORDER BY FIELD_IDENTIFIER`,
- [id]
+ [id],
)
.then((rows) => rows.map(dbMapping.map.enumItem))
}
@@ -147,7 +147,7 @@ ON
WHERE
DT.PACKAGE_REF = ?
ORDER BY EI.ENUM_REF, EI.FIELD_IDENTIFIER`,
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.enumItem))
}
@@ -175,7 +175,7 @@ ON
ENUM.ENUM_ID = DATA_TYPE.DATA_TYPE_ID
WHERE
ENUM_ID = ?`,
- [id]
+ [id],
)
.then(dbMapping.map.enum)
}
@@ -206,10 +206,10 @@ ON
ENUM.ENUM_ID = DATA_TYPE.DATA_TYPE_ID
WHERE
(DATA_TYPE.NAME = ? OR DATA_TYPE.NAME = ?)AND PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
+ packageIds,
)})
ORDER BY NAME`,
- [name, name.toLowerCase()]
+ [name, name.toLowerCase()],
)
.then(dbMapping.map.enum)
}
@@ -227,12 +227,12 @@ async function selectEnumByNameAndClusterId(db, name, clusterId, packageIds) {
let queryWithoutClusterId = queryUtil.sqlQueryForDataTypeByNameAndClusterId(
'enum',
null,
- packageIds
+ packageIds,
)
let queryWithClusterId = queryUtil.sqlQueryForDataTypeByNameAndClusterId(
'enum',
clusterId,
- packageIds
+ packageIds,
)
let res = await dbApi
.dbAll(db, queryWithoutClusterId, [name, name.toLowerCase()])
@@ -251,7 +251,7 @@ async function selectEnumByNameAndClusterId(db, name, clusterId, packageIds) {
exports.selectAllEnums = selectAllEnums
exports.selectEnumByName = dbCache.cacheQuery(selectEnumByName)
exports.selectEnumByNameAndClusterId = dbCache.cacheQuery(
- selectEnumByNameAndClusterId
+ selectEnumByNameAndClusterId,
)
exports.selectEnumById = selectEnumById
exports.selectClusterEnums = selectClusterEnums
diff --git a/src-electron/db/query-event.js b/src-electron/db/query-event.js
index a97ceb1f4a..d3fd6bd8f2 100644
--- a/src-electron/db/query-event.js
+++ b/src-electron/db/query-event.js
@@ -52,7 +52,7 @@ WHERE
CLUSTER_REF = ?
ORDER BY
CODE`,
- [clusterId]
+ [clusterId],
)
.then((rows) => rows.map(dbMapping.map.event))
}
@@ -91,7 +91,7 @@ WHERE
E.PACKAGE_REF in (${dbApi.toInClause(packageIds)})
ORDER BY
C.CODE, E.CODE`,
- []
+ [],
)
.then((rows) => rows.map(dbMapping.map.event))
}
@@ -118,7 +118,7 @@ WHERE
EVENT.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
ORDER BY
EF.FIELD_IDENTIFIER
-`
+`,
)
.then((rows) => rows.map(dbMapping.map.eventField))
}
@@ -142,7 +142,7 @@ WHERE
ORDER BY
FIELD_IDENTIFIER
`,
- [eventId]
+ [eventId],
)
.then((rows) => rows.map(dbMapping.map.eventField))
}
diff --git a/src-electron/db/query-impexp.js b/src-electron/db/query-impexp.js
index 0901690d9d..8c0a198bb6 100644
--- a/src-electron/db/query-impexp.js
+++ b/src-electron/db/query-impexp.js
@@ -57,7 +57,7 @@ INSERT INTO ENDPOINT (
endpoint.profileId,
endpoint.endpointId,
endpoint.networkId,
- ]
+ ],
)
}
@@ -76,7 +76,7 @@ async function importParentEndpoint(db, sessionRef, endpointId, parentRef) {
SET PARENT_ENDPOINT_REF = ?
WHERE ENDPOINT_IDENTIFIER = ? AND SESSION_REF = ?
`,
- [parentRef, endpointId, sessionRef]
+ [parentRef, endpointId, sessionRef],
)
}
@@ -96,7 +96,7 @@ async function exportEndpoints(db, sessionId, endpointTypes) {
endpointTypeName: x.NAME,
endpointTypeIndex: endpointTypeIndexFunction(
endpointTypes,
- x.ENDPOINT_TYPE_REF
+ x.ENDPOINT_TYPE_REF,
),
endpointTypeRef: x.ENDPOINT_TYPE_REF,
profileId: x.PROFILE,
@@ -132,7 +132,7 @@ WHERE
E.SESSION_REF = ?
ORDER BY E.ENDPOINT_IDENTIFIER
`,
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(mapFunction))
}
@@ -170,7 +170,7 @@ WHERE
ORDER BY
ENDPOINT.ENDPOINT_IDENTIFIER,
ENDPOINT_TYPE.NAME`,
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(dbMapping.map.endpointTypeExport))
@@ -206,7 +206,7 @@ ORDER BY
DEVICE_TYPE.NAME,
DEVICE_TYPE.CODE,
DEVICE_TYPE.PROFILE_ID`,
- [sessionId, endpointTypes[i].endpointTypeId]
+ [sessionId, endpointTypes[i].endpointTypeId],
)
// Updating the device type info for the endpoint
@@ -244,7 +244,7 @@ async function importEndpointType(
sessionPartitionId,
packageIds,
endpointType,
- sessionId
+ sessionId,
) {
// Insert endpoint type
let endpointTypeId = await dbApi.dbInsert(
@@ -255,7 +255,7 @@ async function importEndpointType(
SESSION_PARTITION_REF,
NAME
) VALUES (?, ?)`,
- [sessionPartitionId, endpointType.name]
+ [sessionPartitionId, endpointType.name],
)
// Process device types
@@ -295,7 +295,7 @@ async function importEndpointType(
let profileId = await dbApi.dbGet(
db,
`SELECT PROFILE_ID FROM DEVICE_TYPE WHERE CODE = ? AND NAME = ? AND PACKAGE_REF IN (${packageIds})`,
- [parseInt(deviceTypes[i].code), deviceTypes[i].name]
+ [parseInt(deviceTypes[i].code), deviceTypes[i].name],
)
deviceTypes[i].profileId = profileId ? profileId.PROFILE_ID : ''
}
@@ -307,7 +307,7 @@ async function importEndpointType(
parseInt(deviceTypes[i].code),
parseInt(deviceTypes[i].profileId),
deviceTypes[i].name,
- ]
+ ],
)
// Log an error message into the session notice table when device types being imported are not found
@@ -318,7 +318,7 @@ async function importEndpointType(
'Device Types could not be found in the ZCL extensions linked to this project. Please make sure the zcl and template json files listed in your zap file exist.',
sessionId,
1,
- 1
+ 1,
)
}
@@ -334,8 +334,8 @@ async function importEndpointType(
i,
deviceVersions[i] ? deviceVersions[i] : 0,
deviceIdentifiers[i],
- ]
- )
+ ],
+ ),
)
}
}
@@ -381,7 +381,7 @@ INNER JOIN
ON
SESSION_PACKAGE.SESSION_PARTITION_REF= SESSION_PARTITION.SESSION_PARTITION_ID
WHERE SESSION_PARTITION.SESSION_REF = ? AND SESSION_PACKAGE.ENABLED = 1`,
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(mapFunction))
}
@@ -431,7 +431,7 @@ INNER JOIN ENDPOINT_TYPE_CLUSTER
ON CLUSTER.CLUSTER_ID = ENDPOINT_TYPE_CLUSTER.CLUSTER_REF
WHERE ENDPOINT_TYPE_CLUSTER.ENDPOINT_TYPE_REF = ?
ORDER BY CLUSTER.CODE, CLUSTER.NAME`,
- [endpointTypeId]
+ [endpointTypeId],
)
.then((rows) => rows.map(mapFunction))
}
@@ -448,19 +448,21 @@ async function importClusterForEndpointType(
db,
packageIds,
endpointTypeId,
- cluster
+ cluster,
) {
let matchedPackageId = await dbApi
.dbAll(
db,
`SELECT CLUSTER_ID, PACKAGE_REF FROM CLUSTER WHERE PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
+ packageIds,
)}) AND CODE = ? AND ${
cluster.mfgCode == null
? 'MANUFACTURER_CODE IS NULL'
: 'MANUFACTURER_CODE = ?'
}`,
- cluster.mfgCode == null ? [cluster.code] : [cluster.code, cluster.mfgCode]
+ cluster.mfgCode == null
+ ? [cluster.code]
+ : [cluster.code, cluster.mfgCode],
)
.then((matchedPackageIds) => matchedPackageIds.shift()?.PACKAGE_REF)
return dbApi.dbInsert(
@@ -492,7 +494,7 @@ VALUES
cluster.mfgCode,
cluster.side,
cluster.enabled,
- ]
+ ],
)
}
@@ -534,7 +536,7 @@ WHERE
ORDER BY
E.CODE, E.MANUFACTURER_CODE
`,
- [endpointClusterId]
+ [endpointClusterId],
)
.then((rows) => rows.map(mapFunction))
}
@@ -552,7 +554,7 @@ async function importEventForEndpointType(
db,
packageIds,
endpointClusterId,
- event
+ event,
) {
let selectEventQuery = `
SELECT
@@ -598,7 +600,7 @@ INSERT INTO ENDPOINT_TYPE_EVENT (
?,?,?
)
`,
- arg
+ arg,
)
}
@@ -663,7 +665,7 @@ WHERE
ORDER BY
A.CODE, A.MANUFACTURER_CODE
`,
- [endpointClusterId]
+ [endpointClusterId],
)
.then((rows) => rows.map(mapFunction))
}
@@ -683,7 +685,7 @@ async function importAttributeForEndpointType(
packageIds,
endpointClusterId,
attribute,
- cluster
+ cluster,
) {
let selectAttributeQuery = `
SELECT
@@ -743,7 +745,7 @@ WHERE
cluster.name,
storagePolicy,
forcedExternal,
- attributeName
+ attributeName,
)
}
if (storagePolicy == dbEnums.storagePolicy.attributeAccessInterface) {
@@ -784,7 +786,7 @@ INSERT INTO ENDPOINT_TYPE_ATTRIBUTE (
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
)
`,
- arg
+ arg,
)
}
@@ -798,7 +800,7 @@ INSERT INTO ENDPOINT_TYPE_ATTRIBUTE (
async function exportCommandsFromEndpointTypeCluster(
db,
endpointTypeId,
- endpointClusterId
+ endpointClusterId,
) {
let mapFunction = (x) => {
return {
@@ -837,7 +839,7 @@ WHERE
ORDER BY
C.MANUFACTURER_CODE, C.CODE
`,
- [endpointTypeId, endpointClusterId]
+ [endpointTypeId, endpointClusterId],
)
.then((rows) => rows.map(mapFunction))
}
@@ -857,7 +859,7 @@ async function importCommandForEndpointType(
packageIds,
endpointTypeId,
endpointClusterId,
- command
+ command,
) {
let matchedCmdId = await dbApi
.dbAll(
@@ -876,7 +878,7 @@ async function importCommandForEndpointType(
}`,
command.mfgCode == null
? [command.code, command.source, endpointClusterId]
- : [command.code, command.source, endpointClusterId, command.mfgCode]
+ : [command.code, command.source, endpointClusterId, command.mfgCode],
)
.then((matchedCmdIds) => matchedCmdIds.shift()?.COMMAND_ID)
@@ -900,7 +902,7 @@ INSERT OR IGNORE INTO ENDPOINT_TYPE_COMMAND
VALUES
(?, ?, ?, ?)
`,
- arg
+ arg,
)
}
diff --git a/src-electron/db/query-loader.js b/src-electron/db/query-loader.js
index 74eaefb46a..40853f8e3d 100644
--- a/src-electron/db/query-loader.js
+++ b/src-electron/db/query-loader.js
@@ -327,7 +327,7 @@ async function insertAttributeAccessData(db, packageId, accessData) {
return dbApi.dbMultiInsert(
db,
`INSERT INTO ATTRIBUTE_ACCESS (ATTRIBUTE_REF, ACCESS_REF) VALUES (?,?)`,
- insertData
+ insertData,
)
}
@@ -342,7 +342,7 @@ async function insertCommandAccessData(db, packageId, accessData) {
return dbApi.dbMultiInsert(
db,
`INSERT INTO COMMAND_ACCESS (COMMAND_REF, ACCESS_REF) VALUES (?,?)`,
- insertData
+ insertData,
)
}
// access data is array of objects, containing id/op/role/modifier
@@ -356,7 +356,7 @@ async function insertEventAccessData(db, packageId, accessData) {
return dbApi.dbMultiInsert(
db,
`INSERT INTO EVENT_ACCESS (EVENT_REF, ACCESS_REF) VALUES (?,?)`,
- insertData
+ insertData,
)
}
@@ -427,7 +427,7 @@ async function insertAttributeMappings(db, data) {
VALUES
(${selectAttributeIdQuery}, ${selectAttributeIdQuery})
`,
- data
+ data,
)
}
@@ -557,9 +557,9 @@ async function insertClusterExtensions(db, packageId, knownPackages, data) {
.dbMultiSelect(
db,
`SELECT CLUSTER_ID FROM CLUSTER WHERE PACKAGE_REF IN (${dbApi.toInClause(
- knownPackages
+ knownPackages,
)}) AND CODE = ?`,
- data.map((cluster) => [cluster.code])
+ data.map((cluster) => [cluster.code]),
)
.then((rows) => {
let commands = {
@@ -619,7 +619,7 @@ async function insertClusterExtensions(db, packageId, knownPackages, data) {
'WARNING',
message,
packageId,
- 2
+ 2,
)
}
}
@@ -663,7 +663,7 @@ async function insertClusters(db, packageId, data) {
packageId,
cluster.apiMaturity,
]
- })
+ }),
)
.then((lastIdsArray) => {
let commands = {
@@ -742,7 +742,7 @@ async function insertFeatures(db, packageId, data, clusterId) {
feature.description,
feature.conformance,
clusterId,
- ])
+ ]),
)
}
@@ -758,7 +758,7 @@ async function insertTags(db, packageId, data, clusterRef) {
return dbApi.dbMultiInsert(
db,
'INSERT INTO TAG (PACKAGE_REF, CLUSTER_REF, NAME, DESCRIPTION) VALUES (?, ?, ?, ?)',
- data.map((tag) => [packageId, clusterRef, tag.name, tag.description])
+ data.map((tag) => [packageId, clusterRef, tag.name, tag.description]),
)
}
@@ -777,7 +777,7 @@ async function insertDomains(db, packageId, data) {
return dbApi.dbMultiInsert(
db,
'INSERT OR IGNORE INTO DOMAIN (PACKAGE_REF, NAME, LATEST_SPEC_REF) VALUES (?, ?, (SELECT SPEC_ID FROM SPEC WHERE PACKAGE_REF = ? AND CODE = ? ))',
- data.map((domain) => [packageId, domain.name, packageId, domain.specCode])
+ data.map((domain) => [packageId, domain.name, packageId, domain.specCode]),
)
}
@@ -805,7 +805,7 @@ async function insertSpecs(db, packageId, data) {
older.specCode,
older.specDescription,
older.specCertifiable ? 1 : 0,
- ])
+ ]),
)
}
return dbApi.dbMultiInsert(
@@ -816,7 +816,7 @@ async function insertSpecs(db, packageId, data) {
domain.specCode,
domain.specDescription,
domain.specCertifiable ? 1 : 0,
- ])
+ ]),
)
}
@@ -853,7 +853,7 @@ async function insertGlobalAttributeDefault(db, packageId, clusterData) {
( SELECT ATTRIBUTE_ID FROM ATTRIBUTE WHERE PACKAGE_REF = ? AND CODE = ? AND SIDE = ? ),
?)
`,
- args
+ args,
)
.then((individualGaIds) => {
let featureBitArgs = []
@@ -890,7 +890,7 @@ INSERT OR IGNORE INTO GLOBAL_ATTRIBUTE_BIT (
(SELECT TAG_ID FROM TAG WHERE PACKAGE_REF = ? AND NAME = ?)
)
`,
- featureBitArgs
+ featureBitArgs,
)
}
})
@@ -923,7 +923,7 @@ async function insertAtomics(db, packageId, data) {
at.isString,
at.isLong,
at.isChar,
- ])
+ ]),
)
}
@@ -943,13 +943,13 @@ function insertEndpointComposition(db, composition, context) {
return dbApi.dbInsert(
db,
'INSERT INTO ENDPOINT_COMPOSITION (TYPE, CODE) VALUES (?, ?)',
- [dbEnum.composition.mandatoryEndpoint, composition.code]
+ [dbEnum.composition.mandatoryEndpoint, composition.code],
)
} else {
return dbApi.dbInsert(
db,
'INSERT INTO ENDPOINT_COMPOSITION (TYPE, CODE) VALUES (?, ?)',
- [composition.compositionType, composition.code]
+ [composition.compositionType, composition.code],
)
}
}
@@ -1014,7 +1014,7 @@ async function insertDeviceTypes(db, packageId, data) {
dt.scope,
dt.superset,
]
- })
+ }),
)
.then((lastIdsArray) => {
let zclIdsPromises = []
@@ -1037,20 +1037,20 @@ async function insertDeviceTypes(db, packageId, data) {
cluster.clientLocked,
cluster.serverLocked,
],
- true
+ true,
)
.then((deviceTypeClusterRef) => {
return {
dtClusterRef: deviceTypeClusterRef,
clusterData: cluster,
}
- })
- )
+ }),
+ ),
)
.then((dtClusterRefDataPairs) => {
let promises = []
promises.push(
- insertDeviceTypeAttributes(db, dtClusterRefDataPairs)
+ insertDeviceTypeAttributes(db, dtClusterRefDataPairs),
)
promises.push(insertDeviceTypeCommands(db, dtClusterRefDataPairs))
promises.push(insertDeviceTypeFeatures(db, dtClusterRefDataPairs))
@@ -1106,7 +1106,7 @@ async function insertDeviceTypeFeatures(db, dtClusterRefDataPairs) {
return dbApi.dbMultiInsert(
db,
'INSERT INTO DEVICE_TYPE_FEATURE (DEVICE_TYPE_CLUSTER_REF, FEATURE_CODE) VALUES (?, ?)',
- features
+ features,
)
}
@@ -1130,7 +1130,7 @@ async function insertDeviceTypeAttributes(db, dtClusterRefDataPairs) {
return dbApi.dbMultiInsert(
db,
'INSERT INTO DEVICE_TYPE_ATTRIBUTE (DEVICE_TYPE_CLUSTER_REF, ATTRIBUTE_NAME) VALUES (?, ?)',
- attributes
+ attributes,
)
}
@@ -1154,7 +1154,7 @@ async function insertDeviceTypeCommands(db, dtClusterRefDataPairs) {
return dbApi.dbMultiInsert(
db,
'INSERT INTO DEVICE_TYPE_COMMAND (DEVICE_TYPE_CLUSTER_REF, COMMAND_NAME) VALUES (?, ?)',
- commands
+ commands,
)
}
@@ -1168,7 +1168,7 @@ INSERT INTO OPERATION
VALUES
(?, ?, ?)
`,
- data
+ data,
)
}
@@ -1182,7 +1182,7 @@ INSERT INTO ROLE
VALUES
(?, ?, ?, ?)
`,
- data
+ data,
)
}
@@ -1196,7 +1196,7 @@ INSERT INTO ACCESS_MODIFIER
VALUES
(?, ?, ?)
`,
- data
+ data,
)
}
@@ -1218,7 +1218,14 @@ VALUES (
(SELECT ACCESS_MODIFIER_ID FROM ACCESS_MODIFIER WHERE NAME = ? AND PACKAGE_REF = ?)
)
`,
- data.map((x) => [x.op, packageId, x.role, packageId, x.modifier, packageId])
+ data.map((x) => [
+ x.op,
+ packageId,
+ x.role,
+ packageId,
+ x.modifier,
+ packageId,
+ ]),
)
}
@@ -1234,7 +1241,7 @@ async function insertDefaultAccess(db, packageId, defaultAccess) {
return dbApi.dbMultiInsert(
db,
`INSERT INTO DEFAULT_ACCESS ( PACKAGE_REF, ENTITY_TYPE, ACCESS_REF) VALUES (?, ?, ?)`,
- ids.map((id) => [packageId, defaultAccess.type, id])
+ ids.map((id) => [packageId, defaultAccess.type, id]),
)
}
@@ -1270,7 +1277,7 @@ WHERE
) = ?
`,
- [packageId, packageId]
+ [packageId, packageId],
)
}
@@ -1291,7 +1298,7 @@ async function insertDataTypeDiscriminator(db, packageId, data) {
return dbApi.dbMultiInsert(
db,
'INSERT OR IGNORE INTO DISCRIMINATOR (PACKAGE_REF, NAME) VALUES (?, ?)',
- data.map((at) => [packageId, at.name])
+ data.map((at) => [packageId, at.name]),
)
}
@@ -1309,7 +1316,12 @@ async function insertDataType(db, packageId, data) {
const lastIdsArray = await dbApi.dbMultiInsert(
db,
'INSERT INTO DATA_TYPE (PACKAGE_REF, NAME, DESCRIPTION, DISCRIMINATOR_REF) VALUES ( ?, ?, ?, ?)',
- data.map((at) => [packageId, at.name, at.description, at.discriminator_ref])
+ data.map((at) => [
+ packageId,
+ at.name,
+ at.description,
+ at.discriminator_ref,
+ ]),
)
let clustersToLoad = []
@@ -1325,7 +1337,7 @@ async function insertDataType(db, packageId, data) {
return dbApi.dbMultiInsert(
db,
`INSERT INTO DATA_TYPE_CLUSTER (DATA_TYPE_REF, CLUSTER_CODE) VALUES (?, ?)`,
- clustersToLoad
+ clustersToLoad,
)
return lastIdsArray
}
@@ -1356,7 +1368,7 @@ VALUES (
at.discriminator_ref,
at.size,
at.is_signed,
- ])
+ ]),
)
}
@@ -1388,7 +1400,7 @@ VALUES (
at.is_long,
at.size,
at.is_char,
- ])
+ ]),
)
}
@@ -1411,7 +1423,7 @@ VALUES (
AND NAME = ?
AND DISCRIMINATOR_REF = ?),
?)`,
- data.map((at) => [packageId, at.name, at.discriminator_ref, at.size])
+ data.map((at) => [packageId, at.name, at.discriminator_ref, at.size]),
)
}
@@ -1435,18 +1447,18 @@ VALUES (
CASE
WHEN
(${SELECT_CLUSTER_SPECIFIC_DATA_TYPE} AND PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
- )}))
+ packageIds,
+ )}))
IS
NULL
THEN
(${SELECT_GENERIC_DATA_TYPE} AND PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
- )}))
+ packageIds,
+ )}))
ELSE
(${SELECT_CLUSTER_SPECIFIC_DATA_TYPE} AND PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
- )}))
+ packageIds,
+ )}))
END AS DATA_TYPE_ID),
(SELECT
CASE
@@ -1475,7 +1487,7 @@ VALUES (
ENUM.ENUM_ID = DATA_TYPE.DATA_TYPE_ID
WHERE
DATA_TYPE.PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
+ packageIds,
)}) AND DATA_TYPE.NAME = ?)
ELSE
(SELECT
@@ -1505,7 +1517,7 @@ VALUES (
at.type,
at.type,
at.discriminator_ref,
- ])
+ ]),
)
}
@@ -1608,7 +1620,7 @@ AND
at.name,
at.value,
at.fieldIdentifier,
- ])
+ ]),
)
}
@@ -1634,7 +1646,7 @@ VALUES (
DATA_TYPE
WHERE PACKAGE_REF = ? AND NAME = ? AND DISCRIMINATOR_REF = ?),
?)`,
- data.map((at) => [packageId, at.name, at.discriminator_ref, at.size])
+ data.map((at) => [packageId, at.name, at.discriminator_ref, at.size]),
)
}
@@ -1657,18 +1669,18 @@ async function insertBitmap(db, packageIds, data) {
CASE
WHEN
(${SELECT_CLUSTER_SPECIFIC_DATA_TYPE} AND PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
- )}))
+ packageIds,
+ )}))
IS
NULL
THEN
(${SELECT_GENERIC_DATA_TYPE} AND PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
- )}))
+ packageIds,
+ )}))
ELSE
(${SELECT_CLUSTER_SPECIFIC_DATA_TYPE} AND PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
- )}))
+ packageIds,
+ )}))
END AS DATA_TYPE_ID),
(SELECT
CASE
@@ -1726,7 +1738,7 @@ async function insertBitmap(db, packageIds, data) {
at.type,
at.type,
at.discriminator_ref,
- ])
+ ]),
)
}
@@ -1833,7 +1845,7 @@ async function insertBitmapFields(db, packageId, knownPackages, data) {
at.mask,
at.fieldIdentifier,
at.type,
- ])
+ ]),
)
}
@@ -1855,18 +1867,18 @@ VALUES (
CASE
WHEN
(${SELECT_CLUSTER_SPECIFIC_DATA_TYPE} AND PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
- )}))
+ packageIds,
+ )}))
IS
NULL
THEN
(${SELECT_GENERIC_DATA_TYPE} AND PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
- )}))
+ packageIds,
+ )}))
ELSE
(${SELECT_CLUSTER_SPECIFIC_DATA_TYPE} AND PACKAGE_REF IN (${dbApi.toInClause(
- packageIds
- )}))
+ packageIds,
+ )}))
END AS DATA_TYPE_ID),
(SELECT
CASE
@@ -1927,7 +1939,7 @@ VALUES (
at.discriminator_ref,
dbApi.toDbBool(at.isFabricScoped),
at.apiMaturity,
- ])
+ ]),
)
}
@@ -2055,7 +2067,7 @@ async function insertStructItems(db, packageIds, data) {
at.isFabricSensitive,
at.size,
at.type,
- ])
+ ]),
)
}
diff --git a/src-electron/db/query-number.js b/src-electron/db/query-number.js
index 490f3f6313..ac07c43e66 100644
--- a/src-electron/db/query-number.js
+++ b/src-electron/db/query-number.js
@@ -44,7 +44,7 @@ async function selectNumberByName(db, packageIds, name) {
FROM NUMBER
INNER JOIN DATA_TYPE ON NUMBER.NUMBER_ID = DATA_TYPE.DATA_TYPE_ID
WHERE NAME = ? AND PACKAGE_REF IN (${dbApi.toInClause(packageIds)})`,
- [name]
+ [name],
)
.then(dbMapping.map.number)
}
@@ -61,12 +61,12 @@ async function selectNumberByNameAndClusterId(db, name, clusterId, packageIds) {
let queryWithoutClusterId = queryUtil.sqlQueryForDataTypeByNameAndClusterId(
'number',
null,
- packageIds
+ packageIds,
)
let queryWithClusterId = queryUtil.sqlQueryForDataTypeByNameAndClusterId(
'number',
clusterId,
- packageIds
+ packageIds,
)
let res = await dbApi
.dbAll(db, queryWithoutClusterId, [name])
@@ -101,7 +101,7 @@ async function selectNumberById(db, id) {
FROM NUMBER
INNER JOIN DATA_TYPE ON NUMBER.NUMBER_ID = DATA_TYPE.DATA_TYPE_ID
WHERE NUMBER.NUMBER_ID = ?`,
- [id]
+ [id],
)
.then(dbMapping.map.number)
}
@@ -126,14 +126,14 @@ async function selectAllNumbers(db, packageId) {
FROM NUMBER
INNER JOIN DATA_TYPE ON NUMBER.NUMBER_ID = DATA_TYPE.DATA_TYPE_ID
WHERE PACKAGE_REF = ?`,
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.number))
}
exports.selectNumberByName = dbCache.cacheQuery(selectNumberByName)
exports.selectNumberByNameAndClusterId = dbCache.cacheQuery(
- selectNumberByNameAndClusterId
+ selectNumberByNameAndClusterId,
)
exports.selectAllNumbers = selectAllNumbers
exports.selectNumberById = selectNumberById
diff --git a/src-electron/db/query-package-notification.js b/src-electron/db/query-package-notification.js
index f982cbb182..ebd6339e8f 100644
--- a/src-electron/db/query-package-notification.js
+++ b/src-electron/db/query-package-notification.js
@@ -36,7 +36,7 @@ async function setNotification(db, type, status, packageId, severity = 2) {
return dbApi.dbUpdate(
db,
'INSERT INTO PACKAGE_NOTICE ( PACKAGE_REF, NOTICE_TYPE, NOTICE_MESSAGE, NOTICE_SEVERITY) VALUES ( ?, ?, ?, ? )',
- [packageId, type, status, severity]
+ [packageId, type, status, severity],
)
}
@@ -53,7 +53,7 @@ async function deleteNotification(db, id) {
return dbApi.dbUpdate(
db,
'DELETE FROM PACKAGE_NOTICE WHERE ( NOTICE_ID ) = ( ? )',
- [id]
+ [id],
)
}
/**
@@ -77,7 +77,7 @@ async function getNotificationBySessionId(db, sessionId) {
SESSION_PACKAGE.SESSION_PARTITION_REF= SESSION_PARTITION.SESSION_PARTITION_ID
WHERE
SESSION_PARTITION.SESSION_REF = ( ? ) )`,
- [sessionId]
+ [sessionId],
)
return rows.map(dbMapping.map.packageNotification)
}
@@ -104,7 +104,7 @@ async function getNotificationByPackageId(db, packageId) {
rows = await dbApi.dbAll(
db,
'SELECT * FROM PACKAGE_NOTICE WHERE PACKAGE_REF = ( ? )',
- [packageId]
+ [packageId],
)
return rows.map(dbMapping.map.packageNotification)
}
diff --git a/src-electron/db/query-package.js b/src-electron/db/query-package.js
index 67fcb5ccec..a654a61307 100644
--- a/src-electron/db/query-package.js
+++ b/src-electron/db/query-package.js
@@ -51,7 +51,7 @@ async function getPackageByPathAndParent(db, path, parentId, isCustom) {
`${querySelectFromPackage} WHERE PATH = ? AND ${
isCustom ? 'PARENT_PACKAGE_REF IS NULL' : '(PARENT_PACKAGE_REF = ?)'
}`,
- isCustom ? [path] : [path, parentId]
+ isCustom ? [path] : [path, parentId],
)
.then(dbMapping.map.package)
}
@@ -84,8 +84,8 @@ async function getZclPropertiesPackage(db, packages) {
.dbAll(
db,
`${querySelectFromPackage} WHERE TYPE = 'zcl-properties' AND PACKAGE_ID in (${packageIds.join(
- ','
- )})`
+ ',',
+ )})`,
)
.then((rows) => rows.map(dbMapping.map.package))
}
@@ -103,7 +103,7 @@ async function getPackageByPathAndType(db, path, type) {
.dbGet(
db,
`${querySelectFromPackage} WHERE PATH = ? AND TYPE = ? AND IS_IN_SYNC = 1`,
- [path, type]
+ [path, type],
)
.then(dbMapping.map.package)
}
@@ -164,7 +164,7 @@ async function getPackagesByCategoryAndType(db, type, category = '') {
.dbAll(
db,
`${querySelectFromPackage} WHERE IS_IN_SYNC = 1 AND TYPE = ? AND (CATEGORY IN (${category}) OR CATEGORY IS NULL)`,
- [type]
+ [type],
)
.then((rows) => rows.map(dbMapping.map.package))
}
@@ -181,7 +181,7 @@ async function getPackagesByParentAndType(db, parentId, type) {
.dbAll(
db,
`${querySelectFromPackage} WHERE TYPE = ? AND PARENT_PACKAGE_REF = ?`,
- [type, parentId]
+ [type, parentId],
)
.then((rows) => rows.map(dbMapping.map.package))
}
@@ -213,8 +213,8 @@ async function getPackagesByPackageIds(db, packageIds) {
.dbAll(
db,
`${querySelectFromPackage} WHERE PACKAGE_ID IN (${dbApi.toInClause(
- packageIds
- )})`
+ packageIds,
+ )})`,
)
.then((rows) => rows.map(dbMapping.map.package))
}
@@ -230,7 +230,7 @@ async function getPackageRefByAttributeId(db, attributeId) {
let package_ref = await dbApi.dbAll(
db,
'SELECT PACKAGE_REF FROM ATTRIBUTE WHERE ATTRIBUTE_ID = ?',
- [attributeId]
+ [attributeId],
)
return package_ref[0].PACKAGE_REF
}
@@ -256,7 +256,7 @@ async function getPathCrc(db, path) {
} else {
resolve(row.CRC)
}
- })
+ }),
)
}
@@ -272,7 +272,7 @@ async function updateVersion(db, packageId, version, category, description) {
return dbApi.dbUpdate(
db,
'UPDATE PACKAGE SET VERSION = ?, CATEGORY = ?, DESCRIPTION = ? WHERE PACKAGE_ID = ?',
- [version, category, description, packageId]
+ [version, category, description, packageId],
)
}
@@ -292,12 +292,12 @@ async function insertPathCrc(
parentId = null,
version = null,
category = null,
- description = null
+ description = null,
) {
return dbApi.dbInsert(
db,
'INSERT INTO PACKAGE ( PATH, CRC, TYPE, PARENT_PACKAGE_REF, VERSION, CATEGORY, DESCRIPTION ) VALUES (?, ?, ?, ?, ?, ?, ?)',
- [path, crc, type, parentId, version, category, description]
+ [path, crc, type, parentId, version, category, description],
)
}
/**
@@ -318,7 +318,7 @@ async function registerTopLevelPackage(
version = null,
category = null,
description = null,
- isTopLevelPackageInSync = true
+ isTopLevelPackageInSync = true,
) {
let row = await getPackageByPathAndType(db, path, type)
if (row == null || !isTopLevelPackageInSync) {
@@ -329,7 +329,7 @@ async function registerTopLevelPackage(
INSERT INTO PACKAGE (
PATH, CRC, TYPE, PARENT_PACKAGE_REF, VERSION, CATEGORY, DESCRIPTION
) VALUES (?,?,?,?,?,?,?)`,
- [path, crc, type, null, version, category, description]
+ [path, crc, type, null, version, category, description],
)
return {
id: id,
@@ -357,7 +357,7 @@ async function updatePathCrc(db, path, crc, parentId) {
return dbApi.dbUpdate(
db,
'UPDATE PACKAGE SET CRC = ? WHERE PATH = ? AND PARENT_PACKAGE_REF = ?',
- [crc, path, parentId]
+ [crc, path, parentId],
)
}
@@ -372,7 +372,7 @@ async function updatePackageIsInSync(db, packageRef, isInSync) {
return dbApi.dbUpdate(
db,
'UPDATE PACKAGE SET IS_IN_SYNC = ? WHERE PACKAGE_ID = ?',
- [dbApi.toDbBool(isInSync), packageRef]
+ [dbApi.toDbBool(isInSync), packageRef],
)
}
@@ -389,12 +389,12 @@ async function insertSessionPackage(
db,
sessionPartitionId,
packageId,
- required = false
+ required = false,
) {
return dbApi.dbInsert(
db,
'INSERT OR REPLACE INTO SESSION_PACKAGE (SESSION_PARTITION_REF, PACKAGE_REF, REQUIRED, ENABLED) VALUES (?,?,?,1)',
- [sessionPartitionId, packageId, required]
+ [sessionPartitionId, packageId, required],
)
}
@@ -407,7 +407,7 @@ async function deleteSessionPackage(db, sessionPartitionId, packageId) {
return dbApi.dbRemove(
db,
`UPDATE SESSION_PACKAGE SET ENABLED = 0 WHERE SESSION_PARTITION_REF = ? AND PACKAGE_REF = ?`,
- [sessionPartitionId, packageId]
+ [sessionPartitionId, packageId],
)
}
@@ -422,14 +422,14 @@ async function deleteAllSessionPackages(db, sessionPartitionIds) {
await dbApi.dbRemove(
db,
`DELETE FROM SESSION_PACKAGE WHERE SESSION_PARTITION_REF IN (${dbApi.toInClause(
- sessionPartitionIds
- )})`
+ sessionPartitionIds,
+ )})`,
)
return dbApi.dbRemove(
db,
`DELETE FROM SESSION_PARTITION WHERE SESSION_PARTITION_ID IN (${dbApi.toInClause(
- sessionPartitionIds
- )})`
+ sessionPartitionIds,
+ )})`,
)
}
@@ -464,7 +464,7 @@ ON
WHERE SESSION_PARTITION.SESSION_REF = ?
AND PACKAGE.TYPE = ?
AND SESSION_PACKAGE.ENABLED = 1`,
- [sessionId, packageType]
+ [sessionId, packageType],
)
.then((rows) => rows.map(dbMapping.map.package))
}
@@ -510,7 +510,7 @@ async function getSessionGenTemplates(db, sessionId) {
dbEnum.packageType.genSingleTemplate,
sessionId,
dbEnum.packageType.genTemplatesJson,
- ]
+ ],
)
.then((rows) => rows.map(dbMapping.map.package))
}
@@ -545,7 +545,7 @@ ON
WHERE
SESSION_PARTITION.SESSION_REF = ? AND SP.ENABLED = 1 AND P.TYPE IN ${inList}
`,
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(dbMapping.map.sessionPackage))
}
@@ -557,7 +557,7 @@ WHERE
*/
async function getSessionZclPackageIds(db, sessionId) {
return getSessionZclPackages(db, sessionId).then((rows) =>
- rows.map((r) => r.packageRef)
+ rows.map((r) => r.packageRef),
)
}
@@ -584,7 +584,7 @@ async function getSessionPackages(db, sessionId) {
SESSION_PACKAGE.SESSION_PARTITION_REF= SESSION_PARTITION.SESSION_PARTITION_ID
WHERE
SESSION_PARTITION.SESSION_REF = ? AND SESSION_PACKAGE.ENABLED = 1`,
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(dbMapping.map.sessionPackage))
}
@@ -617,7 +617,7 @@ ON
SP.PACKAGE_REF = P.PACKAGE_ID
WHERE
SESSION_PARTITION.SESSION_REF = ? AND SP.ENABLED = 1`,
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(dbMapping.map.sessionPackage))
}
@@ -656,7 +656,7 @@ ON
WHERE
SESSION_PARTITION.SESSION_REF = ?
AND SP.ENABLED = 1`,
- [sessionId]
+ [sessionId],
)
return rows.map((x) => {
return {
@@ -686,7 +686,7 @@ async function getAllPackages(db) {
FROM
PACKAGE
WHERE
- IS_IN_SYNC = 1`
+ IS_IN_SYNC = 1`,
)
.then((rows) => rows.map(dbMapping.map.package))
}
@@ -766,7 +766,7 @@ async function insertOptionsKeyValues(
db,
packageId,
optionCategory,
- optionCodeLabels
+ optionCodeLabels,
) {
return dbApi.dbMultiInsert(
db,
@@ -779,7 +779,7 @@ async function insertOptionsKeyValues(
DO NOTHING`,
optionCodeLabels.map((optionValue) => {
return [packageId, optionCategory, optionValue.code, optionValue.label]
- })
+ }),
)
}
@@ -793,7 +793,7 @@ async function selectAllUiOptions(db, packageId) {
let rows = await selectAllOptionsValues(
db,
packageId,
- dbEnum.packageOptionCategory.ui
+ dbEnum.packageOptionCategory.ui,
)
let obj = rows.reduce((prev, cur) => {
prev[cur.optionCode] = cur.optionLabel
@@ -814,7 +814,7 @@ async function selectAllOptionsValues(db, packageId, optionCategory) {
.dbAll(
db,
`SELECT OPTION_ID, PACKAGE_REF, OPTION_CATEGORY, OPTION_CODE, OPTION_LABEL FROM PACKAGE_OPTION WHERE PACKAGE_REF = ? AND OPTION_CATEGORY = ?`,
- [packageId, optionCategory]
+ [packageId, optionCategory],
)
.then((rows) => rows.map(dbMapping.map.options))
}
@@ -832,13 +832,13 @@ async function selectSpecificOptionValue(
db,
packageId,
optionCategory,
- optionCode
+ optionCode,
) {
return dbApi
.dbGet(
db,
`SELECT OPTION_ID, PACKAGE_REF, OPTION_CATEGORY, OPTION_CODE, OPTION_LABEL FROM PACKAGE_OPTION WHERE PACKAGE_REF = ? AND OPTION_CATEGORY = ? AND OPTION_CODE = ?`,
- [packageId, optionCategory, optionCode]
+ [packageId, optionCategory, optionCode],
)
.then(dbMapping.map.options)
}
@@ -853,7 +853,7 @@ async function selectOptionValueByOptionDefaultId(db, optionDefaultId) {
.dbGet(
db,
`SELECT OPTION_ID, PACKAGE_REF, OPTION_CATEGORY, OPTION_CODE, OPTION_LABEL FROM PACKAGE_OPTION WHERE OPTION_ID = ?`,
- [optionDefaultId]
+ [optionDefaultId],
)
.then(dbMapping.map.options)
}
@@ -871,12 +871,12 @@ async function insertDefaultOptionValue(
db,
packageId,
optionCategory,
- optionRef
+ optionRef,
) {
return dbApi.dbInsert(
db,
'INSERT INTO PACKAGE_OPTION_DEFAULT ( PACKAGE_REF, OPTION_CATEGORY, OPTION_REF) VALUES (?, ?, ?) ON CONFLICT DO NOTHING',
- [packageId, optionCategory, optionRef]
+ [packageId, optionCategory, optionRef],
)
}
@@ -890,7 +890,7 @@ async function selectAllDefaultOptions(db, packageId) {
.dbAll(
db,
`SELECT OPTION_DEFAULT_ID, PACKAGE_REF, OPTION_CATEGORY, OPTION_REF FROM PACKAGE_OPTION_DEFAULT WHERE PACKAGE_REF = ?`,
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.optionDefaults))
}
@@ -906,7 +906,7 @@ async function selectAllDefaultOptions(db, packageId) {
async function insertPackageExtensionDefault(
db,
packageExtensionId,
- defaultArray
+ defaultArray,
) {
return dbApi.dbMultiInsert(
db,
@@ -930,7 +930,7 @@ ON CONFLICT DO NOTHING
d.manufacturerCode,
d.value,
]
- })
+ }),
)
}
@@ -947,7 +947,7 @@ async function insertPackageExtension(
packageId,
entity,
propertyArray,
- defaultsArrayOfArrays
+ defaultsArrayOfArrays,
) {
return dbApi
.dbMultiInsert(
@@ -973,7 +973,7 @@ ON CONFLICT DO NOTHING`,
p.label,
p.globalDefault,
]
- })
+ }),
)
.then((rowIds) => {
let promises = []
@@ -984,7 +984,7 @@ ON CONFLICT DO NOTHING`,
let defaultsArray = defaultsArrayOfArrays[i]
if (defaultsArray != null) {
promises.push(
- insertPackageExtensionDefault(db, rowId, defaultsArray)
+ insertPackageExtensionDefault(db, rowId, defaultsArray),
)
}
}
@@ -1004,7 +1004,7 @@ async function selectPackageExtensionByPropertyAndEntity(
db,
packageId,
property,
- entity
+ entity,
) {
let rows = await dbApi.dbAll(
db,
@@ -1033,7 +1033,7 @@ ORDER BY
PE.PROPERTY,
PED.PARENT_CODE,
PED.ENTITY_CODE`,
- [packageId, entity, property]
+ [packageId, entity, property],
)
if (rows != null && rows.length > 0) {
let res = {
@@ -1097,7 +1097,7 @@ ORDER BY
PE.PROPERTY,
PED.PARENT_CODE,
PED.ENTITY_CODE`,
- [packageId, entity]
+ [packageId, entity],
)
.then((rows) =>
rows.reduce((a, x) => {
@@ -1119,7 +1119,7 @@ ORDER BY
prop.defaults.push(dbMapping.map.packageExtensionDefault(x))
return a
- }, acc)
+ }, acc),
)
}
@@ -1138,13 +1138,13 @@ async function insertSessionKeyValuesFromPackageDefaults(db, sessionId) {
let promises = optionDefaultsArray.map(async (optionDefault) => {
let option = await selectOptionValueByOptionDefaultId(
db,
- optionDefault.optionRef
+ optionDefault.optionRef,
)
return querySession.insertSessionKeyValue(
db,
sessionId,
option.optionCategory,
- option.optionCode
+ option.optionCode,
)
})
return Promise.all(promises)
diff --git a/src-electron/db/query-session-notification.js b/src-electron/db/query-session-notification.js
index 4f340044a9..a9ed571c39 100644
--- a/src-electron/db/query-session-notification.js
+++ b/src-electron/db/query-session-notification.js
@@ -41,20 +41,20 @@ async function setNotification(
status,
sessionId,
severity = 2,
- display = 0
+ display = 0,
) {
let rows = []
let updateResp = Promise.resolve(true)
rows = await dbApi.dbAll(
db,
'SELECT SESSION_KEY FROM SESSION WHERE SESSION_ID = ?',
- [sessionId]
+ [sessionId],
)
if (rows && rows.length > 0) {
updateResp = dbApi.dbUpdate(
db,
'INSERT INTO SESSION_NOTICE ( SESSION_REF, NOTICE_TYPE, NOTICE_MESSAGE, NOTICE_SEVERITY, DISPLAY, SEEN) VALUES ( ?, ?, ?, ?, ?, ?)',
- [sessionId, type, status, severity, display, 0]
+ [sessionId, type, status, severity, display, 0],
)
let sessionKey = rows[0].SESSION_KEY
@@ -68,12 +68,12 @@ async function setNotification(
wsServer.sendWebSocketData(
socket,
dbEnum.wsCategory.notificationInfo,
- obj
+ obj,
)
wsServer.sendWebSocketData(
socket,
dbEnum.wsCategory.notificationCount,
- notificationCount
+ notificationCount,
)
}
}
@@ -93,7 +93,7 @@ async function deleteNotification(db, id) {
return dbApi.dbUpdate(
db,
'DELETE FROM SESSION_NOTICE WHERE ( NOTICE_ID ) = ( ? )',
- [id]
+ [id],
)
}
/**
@@ -108,7 +108,7 @@ async function getNotification(db, sessionId) {
rows = await dbApi.dbAll(
db,
'SELECT * FROM SESSION_NOTICE WHERE SESSION_REF = ?',
- [sessionId]
+ [sessionId],
)
let notifications = rows.map(dbMapping.map.sessionNotifications)
return notifications.reverse()
@@ -125,7 +125,7 @@ async function getUnseenNotificationCount(db, sessionId) {
let rows = await dbApi.dbAll(
db,
'SELECT COUNT(*) as unseenCount FROM SESSION_NOTICE WHERE SESSION_REF = ? AND SEEN = 0',
- [sessionId]
+ [sessionId],
)
return rows[0].unseenCount
}
@@ -143,7 +143,7 @@ async function markNotificationsAsSeen(db, unseenIds) {
await dbApi.dbUpdate(
db,
`UPDATE SESSION_NOTICE SET SEEN = 1 WHERE NOTICE_ID IN (${placeholders})`,
- unseenIds
+ unseenIds,
)
}
}
diff --git a/src-electron/db/query-session-zcl.js b/src-electron/db/query-session-zcl.js
index 00dfbbcb02..76ebde6f2b 100644
--- a/src-electron/db/query-session-zcl.js
+++ b/src-electron/db/query-session-zcl.js
@@ -71,7 +71,7 @@ WHERE
: 'C.MANUFACTURER_CODE = ?'
}
`,
- args
+ args,
)
.then(dbMapping.map.cluster)
}
@@ -112,7 +112,7 @@ ON
WHERE
SESSION_PARTITION.SESSION_REF = ?
`,
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(dbMapping.map.cluster))
}
@@ -134,7 +134,7 @@ async function selectSessionAttributeByCode(
clusterCode,
side,
attributeCode,
- mfgCode
+ mfgCode,
) {
return dbApi
.dbGet(
@@ -177,7 +177,7 @@ WHERE
((ATTRIBUTE.CLUSTER_REF = CLUSTER.CLUSTER_ID AND CLUSTER.CODE = ?) OR
(ATTRIBUTE.CLUSTER_REF IS NULL)) AND ATTRIBUTE.SIDE = ?
`,
- [sessionId, attributeCode, clusterCode, side]
+ [sessionId, attributeCode, clusterCode, side],
)
.then(dbMapping.map.attribute)
}
@@ -197,7 +197,7 @@ async function selectSessionCommandByCode(
sessionId,
clusterCode,
commandCode,
- source
+ source,
) {
return dbApi
.dbGet(
@@ -233,7 +233,7 @@ ON
WHERE
SESSION_PARTITION.SESSION_REF = ? AND C.CODE = ? AND CMD.CODE = ? AND CMD.SOURCE = ?
`,
- [sessionId, clusterCode, commandCode, source]
+ [sessionId, clusterCode, commandCode, source],
)
.then(dbMapping.map.command)
}
diff --git a/src-electron/db/query-session.js b/src-electron/db/query-session.js
index a595a61c99..ddb114db3c 100644
--- a/src-electron/db/query-session.js
+++ b/src-electron/db/query-session.js
@@ -35,7 +35,7 @@ async function getAllSessions(db) {
let rows = await dbApi.dbAll(
db,
'SELECT SESSION_ID, SESSION_KEY, CREATION_TIME FROM SESSION',
- []
+ [],
)
return rows.map(dbMapping.map.session)
}
@@ -54,7 +54,7 @@ async function reloadSession(db, sessionId, userRef, sessionKey) {
return dbApi.dbUpdate(
db,
'UPDATE SESSION SET DIRTY = ?, USER_REF = ? , SESSION_KEY = ? WHERE SESSION_ID = ?',
- [1, userRef, sessionKey, sessionId]
+ [1, userRef, sessionKey, sessionId],
)
}
@@ -87,7 +87,7 @@ SELECT
ON
SESSION_PACKAGE.SESSION_PARTITION_REF= SESSION_PARTITION.SESSION_PARTITION_ID
WHERE SESSION.DIRTY = 1`,
- []
+ [],
)
let sessions = []
rows.forEach((row) => {
@@ -118,7 +118,7 @@ async function setSessionClean(db, sessionId) {
return dbApi.dbUpdate(
db,
'UPDATE SESSION SET DIRTY = ? WHERE SESSION_ID = ?',
- [0, sessionId]
+ [0, sessionId],
)
}
@@ -134,7 +134,7 @@ async function setSessionNewNotificationClean(db, sessionId) {
return dbApi.dbUpdate(
db,
'UPDATE SESSION SET NEW_NOTIFICATION = ? WHERE SESSION_ID = ?',
- [0, sessionId]
+ [0, sessionId],
)
}
@@ -151,7 +151,7 @@ async function getSessionDirtyFlag(db, sessionId) {
db,
'SELECT DIRTY FROM SESSION WHERE SESSION_ID = ?',
[sessionId],
- false
+ false,
)
if (row == null) {
return undefined
@@ -171,7 +171,7 @@ async function getSessionFromSessionId(db, sessionId) {
.dbGet(
db,
'SELECT SESSION_ID, SESSION_KEY, CREATION_TIME, NEW_NOTIFICATION FROM SESSION WHERE SESSION_ID = ?',
- [sessionId]
+ [sessionId],
)
.then(dbMapping.map.session)
}
@@ -213,13 +213,13 @@ async function ensureZapSessionId(db, userKey, sessionId = null) {
let row = await dbApi.dbGet(
db,
'SELECT SESSION_ID FROM SESSION WHERE SESSION_KEY = ?',
- [userKey]
+ [userKey],
)
if (row == null) {
return dbApi.dbInsert(
db,
'INSERT INTO SESSION (SESSION_KEY, CREATION_TIME) VALUES (?,?)',
- [userKey, Date.now()]
+ [userKey, Date.now()],
)
} else {
return row.SESSION_ID
@@ -229,7 +229,7 @@ async function ensureZapSessionId(db, userKey, sessionId = null) {
await dbApi.dbUpdate(
db,
'UPDATE SESSION SET SESSION_KEY = ? WHERE SESSION_ID = ?',
- [userKey, sessionId]
+ [userKey, sessionId],
)
return sessionId
}
@@ -261,7 +261,7 @@ async function ensureZapUserAndSession(
sessionId: null,
userId: null,
partitions: null,
- }
+ },
) {
if (options.sessionId != null && options.userId != null) {
// if we're passed both IDs, we simply return them back.
@@ -288,7 +288,7 @@ async function ensureZapUserAndSession(
let sessionId = await ensureBlankSession(
db,
sessionUuid,
- options.partitions
+ options.partitions,
)
await linkSessionToUser(db, sessionId, options.userId)
return {
@@ -303,7 +303,7 @@ async function ensureZapUserAndSession(
let sessionId = await ensureBlankSession(
db,
sessionUuid,
- options.partitions
+ options.partitions,
)
await linkSessionToUser(db, sessionId, user.userId)
return {
@@ -327,13 +327,13 @@ async function ensureBlankSession(db, uuid, partitions) {
let sessionId = await dbApi.dbInsert(
db,
'INSERT OR IGNORE INTO SESSION (SESSION_KEY, CREATION_TIME, DIRTY) VALUES (?,?,?)',
- [uuid, Date.now(), 0]
+ [uuid, Date.now(), 0],
)
// An ignore in the above insert command can lead to false session Ids. Hence the additional check.
let sessionIdInserted = await dbApi.dbGet(
db,
`SELECT SESSION_ID FROM SESSION WHERE SESSION_ID = ?`,
- [sessionId]
+ [sessionId],
)
if (sessionIdInserted) {
let sessionPartitionPromises = []
@@ -342,8 +342,8 @@ async function ensureBlankSession(db, uuid, partitions) {
dbApi.dbInsert(
db,
'INSERT OR IGNORE INTO SESSION_PARTITION (SESSION_REF, SESSION_PARTITION_NUMBER) VALUES (?,?)',
- [sessionId, i + 1]
- )
+ [sessionId, i + 1],
+ ),
)
}
await Promise.all(sessionPartitionPromises)
@@ -367,8 +367,8 @@ async function insertSessionPartitions(db, sessionId, partitions) {
dbApi.dbInsert(
db,
'INSERT OR IGNORE INTO SESSION_PARTITION (SESSION_REF, SESSION_PARTITION_NUMBER) VALUES (?,?)',
- [sessionId, i + 1]
- )
+ [sessionId, i + 1],
+ ),
)
}
let sessionPartitions = await Promise.all(sessionPartitionPromises)
@@ -386,7 +386,7 @@ async function insertSessionPartition(db, sessionId, partitionNumber) {
let sessionPartition = await dbApi.dbInsert(
db,
'INSERT OR IGNORE INTO SESSION_PARTITION (SESSION_REF, SESSION_PARTITION_NUMBER) VALUES (?,?)',
- [sessionId, partitionNumber]
+ [sessionId, partitionNumber],
)
return sessionPartition
}
@@ -413,7 +413,7 @@ async function getSessionPartitionInfo(db, sessionId, partitionNumber) {
SESSION_REF = ?
AND
SESSION_PARTITION_NUMBER <= ?`,
- [sessionId, partitionNumber]
+ [sessionId, partitionNumber],
)
return rows.map(dbMapping.map.sessionPartition)
}
@@ -437,7 +437,7 @@ async function getAllSessionPartitionInfoForSession(db, sessionId) {
SESSION_PARTITION
WHERE
SESSION_REF = ?`,
- [sessionId]
+ [sessionId],
)
return rows.map(dbMapping.map.sessionPartition)
}
@@ -452,7 +452,7 @@ async function getAllSessionPartitionInfoForSession(db, sessionId) {
async function selectSessionPartitionInfoFromDeviceType(
db,
sessionId,
- deviceTypeIds
+ deviceTypeIds,
) {
let rows = await dbApi.dbAll(
db,
@@ -481,7 +481,7 @@ async function selectSessionPartitionInfoFromDeviceType(
DEVICE_TYPE.DEVICE_TYPE_ID IN (${dbApi.toInClause(deviceTypeIds)})
AND
SESSION_PACKAGE.ENABLED=1`,
- [sessionId]
+ [sessionId],
)
return rows.map(dbMapping.map.sessionPartition)
}
@@ -496,7 +496,7 @@ async function selectSessionPartitionInfoFromDeviceType(
async function selectSessionPartitionInfoFromPackageId(
db,
sessionId,
- packageIds
+ packageIds,
) {
let rows = await dbApi.dbAll(
db,
@@ -521,7 +521,7 @@ async function selectSessionPartitionInfoFromPackageId(
SESSION_PACKAGE.PACKAGE_REF IN (${packageIds})
AND
SESSION_PACKAGE.ENABLED=1`,
- [sessionId]
+ [sessionId],
)
return rows.map(dbMapping.map.sessionPartition)
}
@@ -550,7 +550,7 @@ async function selectDeviceTypePackageInfoFromDeviceTypeId(db, deviceTypeIds) {
ON
PACKAGE.PACKAGE_ID = DEVICE_TYPE.PACKAGE_REF
WHERE
- DEVICE_TYPE.DEVICE_TYPE_ID IN (${dbApi.toInClause(deviceTypeIds)})`
+ DEVICE_TYPE.DEVICE_TYPE_ID IN (${dbApi.toInClause(deviceTypeIds)})`,
)
return rows.map(dbMapping.map.deviceTypeExtended)
}
@@ -568,7 +568,7 @@ async function createBlankSession(db, uuid = null) {
return dbApi.dbInsert(
db,
'INSERT INTO SESSION (SESSION_KEY, CREATION_TIME, DIRTY) VALUES (?,?,?)',
- [newUuid, Date.now(), 0]
+ [newUuid, Date.now(), 0],
)
}
@@ -594,7 +594,7 @@ async function getUsers(db) {
async function getUsersSessions(db) {
let allUsers = await getUsers(db)
let sessionsPerUser = await Promise.all(
- allUsers.map((user) => getUserSessionsById(db, user.userId))
+ allUsers.map((user) => getUserSessionsById(db, user.userId)),
)
allUsers.forEach((user, i) => {
user.sessions = sessionsPerUser[i]
@@ -613,7 +613,7 @@ async function getUserSessionsById(db, userId) {
let rows = await dbApi.dbAll(
db,
'SELECT SESSION_ID, SESSION_KEY, CREATION_TIME, DIRTY FROM SESSION WHERE USER_REF = ?',
- [userId]
+ [userId],
)
return rows.map(dbMapping.map.session)
}
@@ -629,7 +629,7 @@ async function getUserByKey(db, userKey) {
let row = await dbApi.dbGet(
db,
'SELECT USER_ID, USER_KEY, CREATION_TIME FROM USER WHERE USER_KEY = ?',
- [userKey]
+ [userKey],
)
return dbMapping.map.user(row)
}
@@ -646,7 +646,7 @@ async function ensureUser(db, userKey) {
await dbApi.dbInsert(
db,
'INSERT OR IGNORE INTO USER ( USER_KEY, CREATION_TIME ) VALUES (?,?)',
- [userKey, Date.now()]
+ [userKey, Date.now()],
)
return getUserByKey(db, userKey)
}
@@ -663,7 +663,7 @@ async function linkSessionToUser(db, sessionId, userId) {
return dbApi.dbUpdate(
db,
`UPDATE SESSION SET USER_REF = ? WHERE SESSION_ID = ?`,
- [userId, sessionId]
+ [userId, sessionId],
)
}
/**
@@ -694,7 +694,7 @@ async function writeLog(db, sessionId, logArray) {
'INSERT INTO SESSION_LOG (SESSION_REF, TIMESTAMP, LOG) VALUES (?,?,?)',
logArray.map((logEntry) => {
return [sessionId, logEntry.timestamp, logEntry.log]
- })
+ }),
)
}
@@ -710,7 +710,7 @@ async function readLog(db, sessionId) {
.dbAll(
db,
'SELECT TIMESTAMP, LOG from SESSION_LOG WHERE SESSION_REF = ? ORDER BY TIMESTAMP',
- [sessionId]
+ [sessionId],
)
.then((rows) => rows.map(dbMapping.map.sessionLog))
}
@@ -729,7 +729,7 @@ async function updateSessionKeyValue(db, sessionId, key, value) {
return dbApi.dbInsert(
db,
'INSERT OR REPLACE INTO SESSION_KEY_VALUE (SESSION_REF, KEY, VALUE) VALUES (?,?,?)',
- [sessionId, key, value]
+ [sessionId, key, value],
)
}
@@ -747,7 +747,7 @@ async function insertSessionKeyValue(db, sessionId, key, value) {
return dbApi.dbInsert(
db,
'INSERT OR IGNORE INTO SESSION_KEY_VALUE (SESSION_REF, KEY, VALUE) VALUES (?,?,?)',
- [sessionId, key, value]
+ [sessionId, key, value],
)
}
@@ -768,7 +768,7 @@ async function insertSessionKeyValues(db, sessionId, object) {
return dbApi.dbMultiInsert(
db,
'INSERT OR REPLACE INTO SESSION_KEY_VALUE (SESSION_REF, KEY, VALUE) VALUES (?,?,?)',
- args
+ args,
)
}
@@ -783,7 +783,7 @@ async function getSessionKeyValue(db, sessionId, key) {
let row = await dbApi.dbGet(
db,
'SELECT VALUE FROM SESSION_KEY_VALUE WHERE SESSION_REF = ? AND KEY = ?',
- [sessionId, key]
+ [sessionId, key],
)
if (row == null) {
return undefined
@@ -804,7 +804,7 @@ async function getAllSessionKeyValues(db, sessionId) {
let rows = await dbApi.dbAll(
db,
'SELECT KEY, VALUE FROM SESSION_KEY_VALUE WHERE SESSION_REF = ? ORDER BY KEY',
- [sessionId]
+ [sessionId],
)
return rows.map((row) => {
return {
diff --git a/src-electron/db/query-string.js b/src-electron/db/query-string.js
index 6a1dbed701..19a6c9d70c 100644
--- a/src-electron/db/query-string.js
+++ b/src-electron/db/query-string.js
@@ -44,7 +44,7 @@ async function selectAllStrings(db, packageId) {
INNER JOIN DATA_TYPE
ON STRING.STRING_ID = DATA_TYPE.DATA_TYPE_ID
WHERE PACKAGE_REF = ?`,
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.string))
}
@@ -71,7 +71,7 @@ async function selectStringById(db, id) {
INNER JOIN DATA_TYPE
ON STRING.STRING_ID = DATA_TYPE.DATA_TYPE_ID
WHERE STRING.STRING_ID = ?`,
- [id]
+ [id],
)
.then(dbMapping.map.string)
}
@@ -104,7 +104,7 @@ async function selectStringByName(db, name, packageIds) {
WHERE
DATA_TYPE.NAME = ?
AND DATA_TYPE.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})`,
- [name]
+ [name],
)
.then(dbMapping.map.string)
}
diff --git a/src-electron/db/query-struct.js b/src-electron/db/query-struct.js
index af5776ecf7..51377b3f24 100644
--- a/src-electron/db/query-struct.js
+++ b/src-electron/db/query-struct.js
@@ -44,7 +44,7 @@ async function selectAllStructs(db, packageId) {
PACKAGE_REF = ?
ORDER BY
NAME`,
- [packageId]
+ [packageId],
)
return rows.map(dbMapping.map.struct)
}
@@ -68,7 +68,7 @@ ON
STRUCT.STRUCT_ID = DATA_TYPE.DATA_TYPE_ID
WHERE
STRUCT_ID = ?`,
- [id]
+ [id],
)
.then(dbMapping.map.struct)
}
@@ -94,7 +94,7 @@ WHERE
AND PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
ORDER BY
NAME`,
- [name]
+ [name],
)
.then(dbMapping.map.struct)
}
@@ -111,12 +111,12 @@ async function selectStructByNameAndClusterId(db, name, clusterId, packageIds) {
let queryWithoutClusterId = queryUtil.sqlQueryForDataTypeByNameAndClusterId(
'struct',
null,
- packageIds
+ packageIds,
)
let queryWithClusterId = queryUtil.sqlQueryForDataTypeByNameAndClusterId(
'struct',
clusterId,
- packageIds
+ packageIds,
)
let res = await dbApi
.dbAll(db, queryWithoutClusterId, [name])
@@ -143,7 +143,7 @@ async function selectStructByNameAndClusterId(db, name, clusterId, packageIds) {
async function selectStructsWithClusterAssociation(
db,
packageIds,
- groupByStructName
+ groupByStructName,
) {
let groupByClause = groupByStructName ? `GROUP BY DT.NAME` : ``
let rows = await dbApi.dbAll(
@@ -174,7 +174,7 @@ WHERE
DT.PACKAGE_REF IN (${dbApi.toInClause(packageIds)}) ` +
groupByClause +
` ORDER BY
- DT.NAME`
+ DT.NAME`,
)
return rows.map(dbMapping.map.struct)
}
@@ -183,7 +183,7 @@ exports.selectStructById = selectStructById
exports.selectAllStructs = selectAllStructs
exports.selectStructByName = dbCache.cacheQuery(selectStructByName)
exports.selectStructByNameAndClusterId = dbCache.cacheQuery(
- selectStructByNameAndClusterId
+ selectStructByNameAndClusterId,
)
exports.selectStructsWithClusterAssociation =
selectStructsWithClusterAssociation
diff --git a/src-electron/db/query-util.js b/src-electron/db/query-util.js
index 732ade4d02..dd0e85bb63 100644
--- a/src-electron/db/query-util.js
+++ b/src-electron/db/query-util.js
@@ -26,7 +26,7 @@ const dbApi = require('./db-api')
function sqlQueryForDataTypeByNameAndClusterId(
typeDiscriminator,
clusterId = null,
- packageIds
+ packageIds,
) {
let typeTableName = typeDiscriminator.toUpperCase()
let numberExtensionString =
diff --git a/src-electron/db/query-zcl.js b/src-electron/db/query-zcl.js
index bff1394982..adfd18d5d8 100644
--- a/src-electron/db/query-zcl.js
+++ b/src-electron/db/query-zcl.js
@@ -62,7 +62,7 @@ WHERE
DT.PACKAGE_REF = ?
AND DTC.CLUSTER_REF = ?
ORDER BY DT.NAME`,
- [packageId, clusterId]
+ [packageId, clusterId],
)
.then((rows) => rows.map(dbMapping.map.bitmap))
}
@@ -72,7 +72,7 @@ async function selectAllBitmapFieldsById(db, id) {
.dbAll(
db,
'SELECT NAME, MASK, TYPE FROM BITMAP_FIELD WHERE BITMAP_REF = ? ORDER BY FIELD_IDENTIFIER',
- [id]
+ [id],
)
.then((rows) => rows.map(dbMapping.map.bitmapField))
}
@@ -82,7 +82,7 @@ async function selectAllBitmapFields(db, packageId) {
.dbAll(
db,
'SELECT NAME, MASK, BITMAP_REF FROM BITMAP_FIELD WHERE PACKAGE_REF = ? ORDER BY BITMAP_REF, FIELD_IDENTIFIER',
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.bitmapField))
}
@@ -99,7 +99,7 @@ async function selectAllDomains(db, packageId) {
.dbAll(
db,
'SELECT DOMAIN_ID, NAME FROM DOMAIN WHERE PACKAGE_REF = ? ORDER BY NAME',
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.domain))
}
@@ -144,7 +144,7 @@ ON
WHERE
DATA_TYPE.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
GROUP BY DATA_TYPE.NAME
-ORDER BY DATA_TYPE.NAME`
+ORDER BY DATA_TYPE.NAME`,
)
.then((rows) => rows.map(dbMapping.map.struct))
}
@@ -185,7 +185,7 @@ WHERE
S.STRUCT_ID = ?
ORDER BY C.CODE
`,
- [structId]
+ [structId],
)
.then((rows) => rows.map(dbMapping.map.cluster))
}
@@ -226,7 +226,7 @@ WHERE
E.ENUM_ID = ?
ORDER BY C.CODE
`,
- [enumId]
+ [enumId],
)
.then((rows) => rows.map(dbMapping.map.cluster))
}
@@ -266,7 +266,7 @@ ON
WHERE
B.BITMAP_ID = ?
ORDER BY C.CODE `,
- [bitmapId]
+ [bitmapId],
)
.then((rows) => rows.map(dbMapping.map.cluster))
}
@@ -440,7 +440,7 @@ ON
WHERE STRUCT_REF = ?
ORDER BY
FIELD_IDENTIFIER`,
- [id]
+ [id],
)
.then((rows) => rows.map(dbMapping.map.structItem))
}
@@ -459,7 +459,7 @@ async function selectAllStructItemsByStructName(
db,
name,
packageIds,
- clusterName = null
+ clusterName = null,
) {
let clusterJoinQuery = ''
let clusterWhereQuery = ''
@@ -517,7 +517,7 @@ WHERE DT.NAME = ?
AND DT.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
${clusterWhereQuery}
ORDER BY FIELD_IDENTIFIER`,
- [name]
+ [name],
)
.then((rows) => rows.map(dbMapping.map.structItem))
}
@@ -550,7 +550,7 @@ FROM CLUSTER
WHERE
PACKAGE_REF = ?
ORDER BY CODE`,
- [packageId]
+ [packageId],
)
.then((rows) => rows.map(dbMapping.map.cluster))
}
@@ -622,7 +622,7 @@ FROM
CLUSTER
WHERE
CLUSTER_ID = ?`,
- [clusterId]
+ [clusterId],
)
.then(dbMapping.map.cluster)
}
@@ -645,7 +645,7 @@ WHERE
async function selectAttributesByClusterIdIncludingGlobal(
db,
clusterId,
- packageIds
+ packageIds,
) {
return dbApi
.dbAll(
@@ -685,7 +685,7 @@ FROM ATTRIBUTE
WHERE (CLUSTER_REF = ? OR CLUSTER_REF IS NULL)
AND PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
ORDER BY CODE`,
- [clusterId]
+ [clusterId],
)
.then((rows) => rows.map(dbMapping.map.attribute))
}
@@ -694,7 +694,7 @@ async function selectAttributesByClusterIdAndSideIncludingGlobal(
db,
clusterId,
packageIds,
- side
+ side,
) {
return dbApi
.dbAll(
@@ -735,7 +735,7 @@ WHERE
AND (CLUSTER_REF = ? OR CLUSTER_REF IS NULL)
AND PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
ORDER BY CODE`,
- [side, clusterId]
+ [side, clusterId],
)
.then((rows) => rows.map(dbMapping.map.attribute))
}
@@ -753,7 +753,7 @@ async function selectAttributesByClusterCodeAndManufacturerCode(
db,
packageId,
clusterCode,
- manufacturerCode
+ manufacturerCode,
) {
let manufacturerString
if (manufacturerCode == null) {
@@ -803,7 +803,7 @@ WHERE C.CODE = ?
AND C.CLUSTER_ID = A.CLUSTER_REF
AND A.PACKAGE_REF = ?
${manufacturerString}`,
- [clusterCode, packageId]
+ [clusterCode, packageId],
)
.then((rows) => rows.map(dbMapping.map.attribute))
}
@@ -845,7 +845,7 @@ SELECT
PERSISTENCE
FROM ATTRIBUTE
WHERE ATTRIBUTE_ID = ?`,
- [id]
+ [id],
)
.then(dbMapping.map.attribute)
}
@@ -858,7 +858,7 @@ WHERE ATTRIBUTE_ID = ?`,
async function selectAttributeByAttributeIdAndClusterRef(
db,
attributeId,
- clusterRef
+ clusterRef,
) {
return dbApi
.dbGet(
@@ -912,7 +912,7 @@ SELECT
A.PERSISTENCE
FROM ATTRIBUTE AS A
WHERE ATTRIBUTE_ID = ?`,
- [clusterRef, clusterRef, attributeId]
+ [clusterRef, clusterRef, attributeId],
)
.then(dbMapping.map.attribute)
}
@@ -962,7 +962,7 @@ WHERE
A.PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
ORDER BY
C.CODE, A.CODE`,
- []
+ [],
)
.then((rows) => rows.map(dbMapping.map.attribute))
}
@@ -1012,7 +1012,7 @@ FROM ATTRIBUTE
WHERE SIDE = ?
AND PACKAGE_REF IN (${dbApi.toInClause(packageIds)})
ORDER BY CODE`,
- [side]
+ [side],
)
return rows.map(dbMapping.map.attribute)
}
@@ -1033,7 +1033,7 @@ WHERE
ENDPOINT_TYPE_REF = ?
ORDER BY
CLUSTER_REF`,
- [endpointTypeId]
+ [endpointTypeId],
)
return rows.map(dbMapping.map.endpointTypeCluster)
}
@@ -1062,7 +1062,7 @@ WHERE
ETC.ENDPOINT_TYPE_REF = ?
AND ETA.ENDPOINT_TYPE_CLUSTER_REF = ETC.ENDPOINT_TYPE_CLUSTER_ID
ORDER BY ATTRIBUTE_REF`,
- [endpointTypeId]
+ [endpointTypeId],
)
return rows.map(dbMapping.map.endpointTypeAttribute)
}
@@ -1071,7 +1071,7 @@ async function selectEndpointTypeAttribute(
db,
endpointTypeId,
attributeRef,
- clusterRef
+ clusterRef,
) {
let row = await dbApi.dbGet(
db,
@@ -1097,7 +1097,7 @@ WHERE
AND ETA.ATTRIBUTE_REF = ?
AND ETA.ENDPOINT_TYPE_CLUSTER_REF = ETC.ENDPOINT_TYPE_CLUSTER_ID
AND ETC.CLUSTER_REF = ?`,
- [endpointTypeId, attributeRef, clusterRef]
+ [endpointTypeId, attributeRef, clusterRef],
)
return dbMapping.map.endpointTypeAttribute(row)
}
@@ -1137,7 +1137,7 @@ GROUP BY
CLUSTER_REF, COMMAND_REF
ORDER BY
COMMAND_REF`,
- [endpointTypeId]
+ [endpointTypeId],
)
return rows.map(dbMapping.map.endpointTypeCommand)
}
@@ -1159,7 +1159,7 @@ WHERE
AND ETE.ENDPOINT_TYPE_CLUSTER_REF = ETC.ENDPOINT_TYPE_CLUSTER_ID
ORDER BY
EVENT_REF`,
- [endpointTypeId]
+ [endpointTypeId],
)
return rows.map(dbMapping.map.endpointTypeEvent)
}
diff --git a/src-electron/generator/generation-engine.js b/src-electron/generator/generation-engine.js
index 3da4da1f01..5caba6a589 100644
--- a/src-electron/generator/generation-engine.js
+++ b/src-electron/generator/generation-engine.js
@@ -63,12 +63,12 @@ async function recordPackageIfNonexistent(
packageType,
version,
category,
- description
+ description,
) {
let pkg = await queryPackage.getPackageByPathAndParent(
db,
packagePath,
- parentId
+ parentId,
)
if (pkg == null) {
@@ -81,7 +81,7 @@ async function recordPackageIfNonexistent(
parentId,
version,
category,
- description
+ description,
)
} else {
// Already exists
@@ -93,7 +93,7 @@ async function loadTemplateOptionsFromJsonFile(
db,
packageId,
category,
- externalPath
+ externalPath,
) {
let content = await fsPromise.readFile(externalPath, 'utf8')
let jsonData = JSON.parse(content)
@@ -106,7 +106,7 @@ async function loadTemplateOptionsFromJsonFile(
db,
packageId,
category,
- codeLabels
+ codeLabels,
)
}
@@ -125,7 +125,7 @@ async function recordTemplatesPackage(context) {
context.templateData.version,
context.templateData.category,
context.templateData.description,
- true
+ true,
)
context.packageId = topLevel.id
if (topLevel.existedPreviously) return context
@@ -136,7 +136,7 @@ async function recordTemplatesPackage(context) {
env.logDebug(`Loading ${allTemplates.length} templates.`)
allTemplates.forEach((template) => {
let templatePath = path.resolve(
- path.join(path.dirname(context.path), template.path)
+ path.join(path.dirname(context.path), template.path),
)
if (!template.ignore) {
promises.push(
@@ -147,7 +147,7 @@ async function recordTemplatesPackage(context) {
dbEnum.packageType.genSingleTemplate,
0,
template.output,
- template.name
+ template.name,
).then((id) => {
// We loaded the individual file, now we add options
if (template.iterator) {
@@ -160,10 +160,10 @@ async function recordTemplatesPackage(context) {
code: 'iterator',
label: template.iterator,
},
- ]
+ ],
)
}
- })
+ }),
)
}
})
@@ -176,15 +176,15 @@ async function recordTemplatesPackage(context) {
if (_.isString(data)) {
// Data is a string, so we will treat it as a relative path to the JSON file.
let externalPath = path.resolve(
- path.join(path.dirname(context.path), data)
+ path.join(path.dirname(context.path), data),
)
promises.push(
loadTemplateOptionsFromJsonFile(
context.db,
context.packageId,
category,
- externalPath
- )
+ externalPath,
+ ),
)
} else {
// Treat this data as an object.
@@ -200,8 +200,8 @@ async function recordTemplatesPackage(context) {
context.db,
context.packageId,
category,
- codeLabelArray
- )
+ codeLabelArray,
+ ),
)
}
}
@@ -223,8 +223,8 @@ async function recordTemplatesPackage(context) {
context.db,
context.packageId,
dbEnum.packageOptionCategory.helperCategories,
- helperCategories
- )
+ helperCategories,
+ ),
)
}
@@ -252,8 +252,8 @@ async function recordTemplatesPackage(context) {
dbEnum.packageType.genHelper,
null,
null,
- null
- )
+ null,
+ ),
)
}
})
@@ -264,8 +264,8 @@ async function recordTemplatesPackage(context) {
context.db,
context.packageId,
dbEnum.packageOptionCategory.helperAliases,
- helperAliases
- )
+ helperAliases,
+ ),
)
}
@@ -275,7 +275,7 @@ async function recordTemplatesPackage(context) {
for (let key of Object.keys(context.templateData.resources)) {
let resourcePath = path.join(
path.dirname(context.path),
- context.templateData.resources[key]
+ context.templateData.resources[key],
)
if (!fs.existsSync(resourcePath))
throw new Error(`Resource not found: ${resourcePath}`)
@@ -291,8 +291,8 @@ async function recordTemplatesPackage(context) {
context.db,
context.packageId,
dbEnum.packageOptionCategory.resources,
- resources
- )
+ resources,
+ ),
)
}
@@ -300,7 +300,7 @@ async function recordTemplatesPackage(context) {
if (context.templateData.override != null) {
let overridePath = path.join(
path.dirname(context.path),
- context.templateData.override
+ context.templateData.override,
)
promises.push(
recordPackageIfNonexistent(
@@ -310,8 +310,8 @@ async function recordTemplatesPackage(context) {
dbEnum.packageType.genOverride,
null,
null,
- null
- )
+ null,
+ ),
)
}
// Deal with partials
@@ -327,8 +327,8 @@ async function recordTemplatesPackage(context) {
context.packageId,
0,
partial.name,
- ''
- )
+ '',
+ ),
)
})
}
@@ -341,8 +341,8 @@ async function recordTemplatesPackage(context) {
context.db,
context.packageId,
zclExtension,
- context.path
- )
+ context.path,
+ ),
)
}
await Promise.all(promises)
@@ -440,45 +440,45 @@ async function loadZclExtensions(db, packageId, zclExt, defaultsPath) {
) {
// Data is a string, so we will treat it as a relative path to the JSON file.
let externalPath = path.resolve(
- path.join(path.dirname(defaultsPath), prop.defaults)
+ path.join(path.dirname(defaultsPath), prop.defaults),
)
let data = await fsPromise
.readFile(externalPath, 'utf8')
.then((content) => JSON.parse(content))
.catch((err) => {
env.logWarning(
- `Invalid file! Failed to load defaults from: ${prop.defaults}`
+ `Invalid file! Failed to load defaults from: ${prop.defaults}`,
)
queryNotification.setNotification(
db,
'WARNING',
`Invalid file! Failed to load defaults from: ${prop.defaults}`,
packageId,
- 2
+ 2,
)
})
if (data) {
if (!Array.isArray(data)) {
env.logWarning(
- `Invalid file format! Failed to load defaults from: ${prop.defaults}`
+ `Invalid file format! Failed to load defaults from: ${prop.defaults}`,
)
queryNotification.setNotification(
db,
'WARNING',
`Invalid file format! Failed to load defaults from: ${prop.defaults}`,
packageId,
- 2
+ 2,
)
} else {
defaultArrayOfArrays.push(
- data.map((x) => decodePackageExtensionEntity(entity, x))
+ data.map((x) => decodePackageExtensionEntity(entity, x)),
)
}
}
} else {
defaultArrayOfArrays.push(
- prop.defaults.map((x) => decodePackageExtensionEntity(entity, x))
+ prop.defaults.map((x) => decodePackageExtensionEntity(entity, x)),
)
}
} else {
@@ -491,8 +491,8 @@ async function loadZclExtensions(db, packageId, zclExt, defaultsPath) {
packageId,
entity,
propertyArray,
- defaultArrayOfArrays
- )
+ defaultArrayOfArrays,
+ ),
)
}
return Promise.all(promises)
@@ -510,7 +510,7 @@ async function loadTemplates(
genTemplatesJsonArray,
options = {
failOnLoadingError: true,
- }
+ },
) {
if (Array.isArray(genTemplatesJsonArray)) {
let globalCtx = {
@@ -594,7 +594,7 @@ async function retrievePackageMetaInfo(db, genTemplatesPkgId) {
let aliases = await queryPackage.selectAllOptionsValues(
db,
genTemplatesPkgId,
- dbEnum.packageOptionCategory.helperAliases
+ dbEnum.packageOptionCategory.helperAliases,
)
for (let a of aliases) {
metaInfo.aliases.push(a.optionCode)
@@ -603,7 +603,7 @@ async function retrievePackageMetaInfo(db, genTemplatesPkgId) {
let categories = await queryPackage.selectAllOptionsValues(
db,
genTemplatesPkgId,
- dbEnum.packageOptionCategory.helperCategories
+ dbEnum.packageOptionCategory.helperCategories,
)
for (let c of categories) {
metaInfo.categories.push(c.optionCode)
@@ -612,7 +612,7 @@ async function retrievePackageMetaInfo(db, genTemplatesPkgId) {
let resources = await queryPackage.selectAllOptionsValues(
db,
genTemplatesPkgId,
- dbEnum.packageOptionCategory.resources
+ dbEnum.packageOptionCategory.resources,
)
for (let c of resources) {
metaInfo.resources[c.optionCode] = c.optionLabel
@@ -636,11 +636,11 @@ async function generateAllTemplates(
generateOnly: null,
disableDeprecationWarnings: false,
generateSequentially: false,
- }
+ },
) {
let packages = await queryPackage.getPackageByParent(
genResult.db,
- genTemplateJsonPkg.id
+ genTemplateJsonPkg.id,
)
let generationTemplates = []
let helperPromises = []
@@ -658,7 +658,7 @@ async function generateAllTemplates(
let outputOptions = await queryPackage.selectAllOptionsValues(
genResult.db,
pkg.id,
- dbEnum.packageOptionCategory.outputOptions
+ dbEnum.packageOptionCategory.outputOptions,
)
outputOptions.forEach((opt) => {
if (opt.optionCode == 'iterator') {
@@ -679,7 +679,7 @@ async function generateAllTemplates(
packages.forEach((singlePkg) => {
if (singlePkg.type == dbEnum.packageType.genPartial) {
partialPromises.push(
- templateEngine.loadPartial(hb, singlePkg.category, singlePkg.path)
+ templateEngine.loadPartial(hb, singlePkg.category, singlePkg.path),
)
}
})
@@ -687,7 +687,7 @@ async function generateAllTemplates(
// Let's collect the required list of helpers.
let metaInfo = await retrievePackageMetaInfo(
genResult.db,
- genTemplateJsonPkg.id
+ genTemplateJsonPkg.id,
)
// Initialize helpers package. This is based on the specific
@@ -698,7 +698,7 @@ async function generateAllTemplates(
packages.forEach((singlePkg) => {
if (singlePkg.type == dbEnum.packageType.genHelper) {
helperPromises.push(
- templateEngine.loadHelper(hb, singlePkg.path, context)
+ templateEngine.loadHelper(hb, singlePkg.path, context),
)
}
})
@@ -730,14 +730,14 @@ async function generateAllTemplates(
generateSingleTemplate(hb, metaInfo, genResult, t, genTemplateJsonPkg, {
overridePath: overridePath,
disableDeprecationWarnings: options.disableDeprecationWarnings,
- })
+ }),
)
} else {
let templates = generationTemplates.map((pkg) =>
generateSingleTemplate(hb, metaInfo, genResult, pkg, genTemplateJsonPkg, {
overridePath: overridePath,
disableDeprecationWarnings: options.disableDeprecationWarnings,
- })
+ }),
)
await Promise.all(templates)
}
@@ -762,7 +762,7 @@ async function generateSingleTemplate(
options = {
overridePath: null,
disableDeprecationWarnings: false,
- }
+ },
) {
let genStart = process.hrtime.bigint()
//console.log(`Start generating from template: ${singleTemplatePkg?.path}`)
@@ -781,7 +781,7 @@ async function generateSingleTemplate(
genResult.sessionId,
singleTemplatePkg,
genTemplateJsonPackage,
- options
+ options,
)
for (let result of resultArray) {
genResult.content[result.key] = result.content
@@ -793,7 +793,7 @@ async function generateSingleTemplate(
env.logInfo(
`Finish generating from template: ${
singleTemplatePkg?.path
- }: ${util.duration(nsDuration)}`
+ }: ${util.duration(nsDuration)}`,
)
return genResult
} catch (err) {
@@ -821,7 +821,7 @@ async function generate(
options = {
generateOnly: null,
disableDeprecationWarnings: false,
- }
+ },
) {
let pkg = await queryPackage.getPackageByPackageId(db, templatePackageId)
if (pkg == null) throw new Error(`Invalid packageId: ${templatePackageId}`)
@@ -905,7 +905,7 @@ async function generateAndWriteFiles(
skipPostGeneration: false,
appendGenerationSubdirectory: false,
generationLog: null,
- }
+ },
) {
// in case user customization has invalidated the cache
dbCache.clear()
@@ -921,7 +921,7 @@ async function generateAndWriteFiles(
let genOptions = await queryPackage.selectAllOptionsValues(
db,
templatePackageId,
- dbEnum.packageOptionCategory.generator
+ dbEnum.packageOptionCategory.generator,
)
// Reduce the long array from query into a single object
@@ -934,7 +934,7 @@ async function generateAndWriteFiles(
db,
sessionId,
templatePackageId,
- templateGeneratorOptions
+ templateGeneratorOptions,
)
// The path we append, assuming you specify the --appendGenerationSubdirectory, and a
@@ -989,7 +989,7 @@ async function generateAndWriteFiles(
} else {
return
}
- })
+ }),
)
if (options.generationLog) {
@@ -997,12 +997,12 @@ async function generateAndWriteFiles(
let filePath = await querySession.getSessionKeyValue(
db,
sessionId,
- dbEnum.sessionKey.filePath
+ dbEnum.sessionKey.filePath,
)
let zclPkg = await queryPackage.getSessionPackagesByType(
db,
sessionId,
- dbEnum.packageType.zclProperties
+ dbEnum.packageType.zclProperties,
)
promises.push(
createGenerationLog(options.generationLog, {
@@ -1010,7 +1010,7 @@ async function generateAndWriteFiles(
output: outputDirectory,
templatePath: pkg.path,
zclPath: zclPkg.path,
- })
+ }),
)
}
@@ -1052,7 +1052,7 @@ async function postProcessGeneratedFiles(
genResult,
logger = (msg) => {
// Empty logger is the default.
- }
+ },
) {
let doExecute = true
let isEnabledS = genResult.generatorOptions[dbEnum.generatorOptions.enabled]
@@ -1089,7 +1089,7 @@ async function postProcessGeneratedFiles(
rejectOnFail: false,
routeErrToOut:
genResult.generatorOptions[dbEnum.generatorOptions.routeErrToOut],
- })
+ }),
)
}
if (
@@ -1104,7 +1104,7 @@ async function postProcessGeneratedFiles(
postProcessPromises.push(
util.executeExternalProgram(singleCmd, genResult.templatePath, {
rejectOnFail: false,
- })
+ }),
)
}
}
@@ -1155,7 +1155,7 @@ async function generateSingleFileForPreview(db, sessionId, outFileName) {
.getSessionPackagesByType(
db,
sessionId,
- dbEnum.packageType.genTemplatesJson
+ dbEnum.packageType.genTemplatesJson,
)
.then((pkgs) => {
let promises = []
@@ -1169,8 +1169,8 @@ async function generateSingleFileForPreview(db, sessionId, outFileName) {
{
generateOnly: outFileName,
disableDeprecationWarnings: true,
- }
- )
+ },
+ ),
)
})
return Promise.all(promises)
diff --git a/src-electron/generator/helper-access.js b/src-electron/generator/helper-access.js
index 3cc1eb6158..9c388a91e5 100644
--- a/src-electron/generator/helper-access.js
+++ b/src-electron/generator/helper-access.js
@@ -30,7 +30,7 @@ async function collectDefaultAccessList(ctx, entityType) {
let defaultAccess = await queryAccess.selectDefaultAccess(
ctx.global.db,
packageIds,
- entityType
+ entityType,
)
return defaultAccess
}
@@ -51,7 +51,7 @@ async function collectAccesslist(ctx, options) {
if (entityType == null) {
throw new Error(
- 'Access helper requires entityType, either from context, or from the entity="