From 1fe79d8654f26d27e8601c3fea888667a9d4cf7f Mon Sep 17 00:00:00 2001 From: Bharat Raju Date: Thu, 15 Aug 2024 15:16:37 -0400 Subject: [PATCH] Code formating (#1404) * Code formating and API documentation update - Ran npx prettier --write . with latest prettier package in zap project - Update the API documentation by running npm run apidoc - Fixing the env.test.js because prettier changed the line numbers of the code --- .../e2e/attribute_validations/bitmap.cy.js | 6 +- .../e2e/attribute_validations/boolean.cy.js | 8 +- cypress/e2e/attribute_validations/enum8.cy.js | 6 +- cypress/e2e/attribute_validations/int16.cy.js | 8 +- cypress/e2e/attribute_validations/int8.cy.js | 6 +- .../check-required-attributes.cy.js | 10 +- cypress/e2e/attributes/check-search.cy.js | 4 +- cypress/e2e/clusters/cluster-filter.cy.js | 2 +- cypress/e2e/clusters/cluster-search.cy.js | 4 +- cypress/e2e/clusters/dimmable-light.cy.js | 2 +- cypress/e2e/endpoints/edit-endpoint.cy.js | 2 +- cypress/e2e/theme/theme.cy.js | 4 +- cypress/e2e/ui/notification-panel.cy.js | 6 +- cypress/support/commands.js | 2 +- docs/ZAP-on-Windows.md | 16 +- docs/access.md | 17 +- docs/api.md | 15989 ++++++++++------ docs/notifications.md | 14 +- src-electron/db/db-api.js | 12 +- src-electron/db/db-mapping.js | 2 +- src-electron/db/query-access.js | 20 +- src-electron/db/query-atomic.js | 8 +- src-electron/db/query-attribute.js | 76 +- src-electron/db/query-bitmap.js | 14 +- src-electron/db/query-cluster.js | 14 +- src-electron/db/query-command.js | 126 +- src-electron/db/query-config.js | 200 +- .../db/query-data-type-discriminator.js | 2 +- src-electron/db/query-data-type.js | 14 +- src-electron/db/query-device-type.js | 36 +- src-electron/db/query-endpoint-type.js | 44 +- src-electron/db/query-endpoint.js | 28 +- src-electron/db/query-enum.js | 20 +- src-electron/db/query-event.js | 8 +- src-electron/db/query-impexp.js | 64 +- src-electron/db/query-loader.js | 140 +- src-electron/db/query-number.js | 12 +- src-electron/db/query-package-notification.js | 8 +- src-electron/db/query-package.js | 106 +- src-electron/db/query-session-notification.js | 18 +- src-electron/db/query-session-zcl.js | 12 +- src-electron/db/query-session.js | 80 +- src-electron/db/query-string.js | 6 +- src-electron/db/query-struct.js | 16 +- src-electron/db/query-util.js | 2 +- src-electron/db/query-zcl.js | 60 +- src-electron/generator/generation-engine.js | 138 +- src-electron/generator/helper-access.js | 14 +- src-electron/generator/helper-attribute.js | 6 +- src-electron/generator/helper-c.js | 16 +- src-electron/generator/helper-command.js | 30 +- .../generator/helper-endpointconfig.js | 56 +- src-electron/generator/helper-sdkextension.js | 18 +- src-electron/generator/helper-session.js | 256 +- src-electron/generator/helper-tokens.js | 26 +- src-electron/generator/helper-zap.js | 12 +- src-electron/generator/helper-zcl.js | 350 +- src-electron/generator/helper-zigbee-zcl.js | 14 +- .../common/ClusterTestGeneration.js | 68 +- .../zap-templates/common/ClustersHelper.js | 122 +- .../common/attributes/Accessors.js | 4 +- .../clusters/CommissionerCommands.js | 6 +- .../clusters/EqualityCommands.js | 18 +- .../common/variables/Variables.js | 22 +- .../app/zap-templates/partials/helper.js | 4 +- .../app/zap-templates/templates/app/helper.js | 74 +- .../zap-templates/templates/chip/helper.js | 109 +- .../matter/chip-tool/templates/helper.js | 12 +- .../chip-tool/templates/tests/helper.js | 4 +- .../controller/java/templates/helper.js | 28 +- .../controller/python/templates/helper.js | 2 +- .../generator/matter/copy-from-sdk.js | 2 +- .../darwin/Framework/CHIP/templates/helper.js | 100 +- src-electron/generator/template-engine.js | 16 +- src-electron/generator/template-iterators.js | 6 +- src-electron/generator/template-util.js | 40 +- .../ide-integration/studio-rest-api.js | 28 +- .../ide-integration/zcl-components.js | 8 +- src-electron/importexport/export.js | 20 +- src-electron/importexport/import-isc.js | 60 +- src-electron/importexport/import-json.js | 292 +- src-electron/importexport/import.js | 20 +- src-electron/main-process/main.js | 2 +- src-electron/main-process/session-timers.js | 6 +- src-electron/main-process/startup.js | 46 +- src-electron/rest/endpoint.js | 14 +- src-electron/rest/file-ops.js | 24 +- src-electron/rest/generation.js | 10 +- src-electron/rest/ide-api-handler.js | 2 +- src-electron/rest/initialize.js | 22 +- src-electron/rest/static-zcl.js | 50 +- src-electron/rest/user-data.js | 92 +- src-electron/sdk/matter.js | 12 +- src-electron/server/http-server.js | 11 +- src-electron/server/ipc-server.js | 12 +- src-electron/server/ws-server.js | 4 +- src-electron/ui/browser-api.js | 14 +- src-electron/ui/main-ui.js | 6 +- src-electron/ui/menu.js | 19 +- src-electron/ui/ui-util.js | 2 +- src-electron/ui/window.js | 4 +- src-electron/util/args.js | 10 +- src-electron/util/async-reporting.js | 10 +- src-electron/util/env.js | 10 +- src-electron/util/external-helper-api.js | 8 +- src-electron/util/external-helper-register.js | 2 +- src-electron/util/iterator-util.js | 4 +- src-electron/util/post-import-api.js | 64 +- src-electron/util/sdk-util.js | 8 +- src-electron/util/types.js | 12 +- src-electron/util/util.js | 110 +- src-electron/util/zcl-util.js | 44 +- src-electron/validation/async-validation.js | 4 +- src-electron/validation/validation.js | 26 +- src-electron/zcl/zcl-loader-dotdot.js | 96 +- src-electron/zcl/zcl-loader-new-data-model.js | 4 +- src-electron/zcl/zcl-loader-silabs.js | 278 +- src-electron/zcl/zcl-loader.js | 40 +- src-script/build-backend.js | 2 +- src-script/download-artifact.js | 62 +- src-script/download-artifact.ts | 66 +- src-script/gen-log-parse | 4 +- src-script/gen-test-runner.js | 4 +- src-script/gsdk-public-regen.js | 8 +- src-script/license-check.js | 2 +- src-script/pack-apack-mac.js | 2 +- src-script/run-conditionally.js | 2 +- src-script/script-util.js | 18 +- src-script/zap-combine-reports.js | 12 +- src-script/zap-uitest.js | 2 +- src-script/zap-update-package-version.js | 4 +- src-script/zap-validate-metafiles.js | 4 +- src/App.vue | 34 +- src/api/renderer_api.js | 10 +- src/boot/axios.js | 2 +- src/boot/ws.js | 2 +- src/components/ZCLToolbar.vue | 8 +- src/components/ZclAttributeManager.vue | 42 +- .../ZclAttributeReportingManager.vue | 46 +- src/components/ZclClusterManager.vue | 6 +- src/components/ZclCommandManager.vue | 18 +- src/components/ZclCreateModifyEndpoint.vue | 28 +- src/components/ZclDomainClusterView.vue | 20 +- src/components/ZclEndpointCard.vue | 18 +- src/components/ZclEndpointManager.vue | 2 +- src/components/ZclEventManager.vue | 8 +- src/css/quasar.variables.scss | 19 +- src/css/zclTour.scss | 4 +- src/index.template.html | 2 +- src/pages/ExtensionsPage.vue | 12 +- src/pages/NotificationsPage.vue | 4 +- src/pages/OptionsPage.vue | 6 +- src/pages/ZapConfig.vue | 26 +- .../preferences/PreferenceGeneration.vue | 2 +- src/router/index.js | 6 +- src/store/zap/actions.js | 76 +- src/store/zap/mutations.js | 64 +- src/tutorials/CMPTour.vue | 14 +- src/tutorials/EndpointTour.vue | 20 +- src/util/common-mixin.js | 28 +- src/util/editable-attributes-mixin.js | 20 +- src/util/util.js | 4 +- test/arg.test.js | 8 +- test/bin.test.js | 28 +- test/conversion.test.js | 27 +- test/custom-cluster.test.js | 36 +- test/custom-matter-xml.test.js | 158 +- test/custom-zcl.test.js | 20 +- test/download-artifact.test.js | 6 +- test/endpoint-config.test.js | 42 +- test/env.test.js | 51 +- test/fileformat.test.js | 2 +- test/frontend.test.js | 8 +- test/gen-dotdot.test.js | 26 +- test/gen-matter-1.test.js | 40 +- test/gen-matter-2.test.js | 10 +- test/gen-matter-3-1.test.js | 136 +- test/gen-matter-3.test.js | 10 +- test/gen-matter-4.test.js | 10 +- test/gen-matter-api-maturity.test.js | 14 +- test/gen-meta.test.js | 28 +- .../matter/external-addon-helper.js | 10 +- .../zigbee/external-addon-helper.js | 10 +- test/gen-test.test.js | 20 +- test/gen-zigbee-1.test.js | 66 +- test/gen-zigbee-2.test.js | 52 +- test/gen-zigbee-3.test.js | 32 +- test/gen-zigbee-4.test.js | 52 +- test/gen-zigbee-5.test.js | 42 +- test/gen-zigbee-6.test.js | 56 +- test/gen-zigbee-7.test.js | 28 +- test/gen-zigbee-8.test.js | 44 +- test/gen-zigbee-9.test.js | 18 +- test/generation.test.js | 72 +- test/helper-api.test.js | 8 +- test/helpers.test.js | 126 +- test/ide-integration.test.js | 16 +- test/importexport.test.js | 58 +- test/ipc.test.js | 14 +- test/mapping.test.js | 2 +- test/matter.test.js | 8 +- test/mixin.test.js | 8 +- test/multi-package.test.js | 10 +- test/multi-protocol.test.js | 60 +- test/mutations.test.js | 42 +- test/new-matter-data-model.test.js | 4 +- test/notification.test.js | 26 +- test/parent-endpoint.test.js | 16 +- test/query.test.js | 170 +- test/rendererapi.test.js | 2 +- test/script-api.test.js | 16 +- test/server-bare.test.js | 88 +- test/server-session.test.js | 10 +- test/server-with-zcl.test.js | 54 +- test/spec-check.test.js | 174 +- test/startup.test.js | 20 +- test/string.test.js | 18 +- test/templates.test.js | 40 +- test/test-query.js | 16 +- test/test-util.js | 14 +- test/tokens.test.js | 166 +- test/util.test.js | 12 +- test/validation.test.js | 119 +- test/zcl-loader-consecutive.test.js | 22 +- test/zcl-loader.test.js | 68 +- test/zcl-properties-loader.test.js | 16 +- 226 files changed, 13934 insertions(+), 9731 deletions(-) diff --git a/cypress/e2e/attribute_validations/bitmap.cy.js b/cypress/e2e/attribute_validations/bitmap.cy.js index 591333f966..43e2f7d963 100644 --- a/cypress/e2e/attribute_validations/bitmap.cy.js +++ b/cypress/e2e/attribute_validations/bitmap.cy.js @@ -22,17 +22,17 @@ describe('Testing BITMAP type validation', () => { () => { cy.fixture('data').then((data) => { cy.get( - `:nth-child(${data.bitmapinputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input` + `:nth-child(${data.bitmapinputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input`, ) .clear({ force: true }) .type('test', { force: true }) }) - } + }, ) it('check if validation works properly', () => { cy.fixture('data').then((data) => { cy.get( - `:nth-child(${data.bitmapinputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div` + `:nth-child(${data.bitmapinputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div`, ).should('exist') }) }) diff --git a/cypress/e2e/attribute_validations/boolean.cy.js b/cypress/e2e/attribute_validations/boolean.cy.js index a5d32270b5..c4ca59dc9e 100644 --- a/cypress/e2e/attribute_validations/boolean.cy.js +++ b/cypress/e2e/attribute_validations/boolean.cy.js @@ -16,7 +16,7 @@ describe('Testing BOOLEAN type validation', () => { cy.gotoAttributePage( data.endpoint1, data.cluster1, - data.booleanclusterpath + data.booleanclusterpath, ) }) }) @@ -26,17 +26,17 @@ describe('Testing BOOLEAN type validation', () => { () => { cy.fixture('data').then((data) => { cy.get( - `:nth-child(${data.booleaninputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input` + `:nth-child(${data.booleaninputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input`, ) .clear({ force: true }) .type('test', { force: true }) }) - } + }, ) it('check if validation works properly', () => { cy.fixture('data').then((data) => { cy.get( - `:nth-child(${data.booleaninputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div` + `:nth-child(${data.booleaninputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div`, ).should('exist') }) }) diff --git a/cypress/e2e/attribute_validations/enum8.cy.js b/cypress/e2e/attribute_validations/enum8.cy.js index 8634fffa13..e966a5a9ae 100644 --- a/cypress/e2e/attribute_validations/enum8.cy.js +++ b/cypress/e2e/attribute_validations/enum8.cy.js @@ -22,17 +22,17 @@ describe('Testing ENUM8 type validation', () => { () => { cy.fixture('data').then((data) => { cy.get( - `:nth-child(${data.enum8inputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input` + `:nth-child(${data.enum8inputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input`, ) .clear({ force: true }) .type('test', { force: true }) }) - } + }, ) it('check if validation works properly', () => { cy.fixture('data').then((data) => { cy.get( - `:nth-child(${data.enum8inputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div` + `:nth-child(${data.enum8inputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div`, ).should('exist') }) }) diff --git a/cypress/e2e/attribute_validations/int16.cy.js b/cypress/e2e/attribute_validations/int16.cy.js index 01a27a5ce4..57d5da480e 100644 --- a/cypress/e2e/attribute_validations/int16.cy.js +++ b/cypress/e2e/attribute_validations/int16.cy.js @@ -22,12 +22,12 @@ describe('Testing INT16U type validation', () => { () => { cy.fixture('data').then((data) => { cy.get( - `:nth-child(${data.int16inputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input` + `:nth-child(${data.int16inputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input`, ) .clear({ force: true }) .type('test', { force: true }) }) - } + }, ) it( 'check if validation works properly', @@ -35,9 +35,9 @@ describe('Testing INT16U type validation', () => { () => { cy.fixture('data').then((data) => { cy.get( - `:nth-child(${data.int16inputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div` + `:nth-child(${data.int16inputpath}) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div`, ).should('exist') }) - } + }, ) }) diff --git a/cypress/e2e/attribute_validations/int8.cy.js b/cypress/e2e/attribute_validations/int8.cy.js index cf8a1408ec..ab5ce7b243 100644 --- a/cypress/e2e/attribute_validations/int8.cy.js +++ b/cypress/e2e/attribute_validations/int8.cy.js @@ -21,15 +21,15 @@ describe('Testing INT8U type validation', () => { { retries: { runMode: 2, openMode: 2 } }, () => { cy.get( - ':nth-child(1) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input' + ':nth-child(1) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input', ) .clear({ force: true }) .type('test', { force: true }) - } + }, ) it('check if validation works properly', () => { cy.get( - ':nth-child(1) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div' + ':nth-child(1) > [style="min-width: 180px;"] > .q-field > .q-field__inner > .q-field__bottom > .q-field__messages > div', ).should('exist') }) }) diff --git a/cypress/e2e/attributes/check-required-attributes.cy.js b/cypress/e2e/attributes/check-required-attributes.cy.js index 7790ed02ae..fe1ba2c7f2 100644 --- a/cypress/e2e/attributes/check-required-attributes.cy.js +++ b/cypress/e2e/attributes/check-required-attributes.cy.js @@ -21,17 +21,17 @@ describe('Testing disabling enabled attributes', () => { { retries: { runMode: 2, openMode: 2 } }, () => { cy.get( - '.attribute_table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner ' + '.attribute_table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner ', ).click() cy.get( - '.attribute_table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner' + '.attribute_table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner', ).should('be.visible') cy.get( - '.attribute_table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner' + '.attribute_table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner', ).click() cy.contains( - '.attribute_table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner' + '.attribute_table_body:first > :nth-child(2) > .q-mt-xs > .q-toggle__inner', ).should('not.exist') - } + }, ) }) diff --git a/cypress/e2e/attributes/check-search.cy.js b/cypress/e2e/attributes/check-search.cy.js index 28761fd3a9..41fc366031 100644 --- a/cypress/e2e/attributes/check-search.cy.js +++ b/cypress/e2e/attributes/check-search.cy.js @@ -26,12 +26,12 @@ describe('Testing attribute search', () => { .should('contain', data.attribute1) .and('contain', data.attribute2) }) - } + }, ) it('Search for application', () => { cy.fixture('data').then((data) => { cy.get( - '.col-auto > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input' + '.col-auto > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > input', ) .clear({ force: true }) .type(data.searchString1, { force: true }) diff --git a/cypress/e2e/clusters/cluster-filter.cy.js b/cypress/e2e/clusters/cluster-filter.cy.js index 0f9b01d451..5827d74422 100644 --- a/cypress/e2e/clusters/cluster-filter.cy.js +++ b/cypress/e2e/clusters/cluster-filter.cy.js @@ -27,6 +27,6 @@ describe('Testing cluster filters', () => { cy.fixture('data').then((data) => { cy.get('tbody').children().contains(data.cluster2).should('not.exist') }) - } + }, ) }) diff --git a/cypress/e2e/clusters/cluster-search.cy.js b/cypress/e2e/clusters/cluster-search.cy.js index 402e4ac33f..5cb88a2b36 100644 --- a/cypress/e2e/clusters/cluster-search.cy.js +++ b/cypress/e2e/clusters/cluster-search.cy.js @@ -48,12 +48,12 @@ describe('Testing cluster search', () => { cy.dataCy('cluster-general').children().children().eq(0).click() cy.dataCy('cluster-general').should( 'have.class', - 'q-expansion-item--collapsed' + 'q-expansion-item--collapsed', ) cy.dataCy('cluster-general').children().children().eq(0).click() cy.dataCy('cluster-general').should( 'have.class', - 'q-expansion-item--expanded' + 'q-expansion-item--expanded', ) cy.dataCy('cluster-btn-closeall').click() cy.get('[data-test=Cluster').each(($row) => { diff --git a/cypress/e2e/clusters/dimmable-light.cy.js b/cypress/e2e/clusters/dimmable-light.cy.js index 1453e29d9e..924c324dd1 100644 --- a/cypress/e2e/clusters/dimmable-light.cy.js +++ b/cypress/e2e/clusters/dimmable-light.cy.js @@ -25,5 +25,5 @@ describe( .type(data.cluster4) }) }) - } + }, ) diff --git a/cypress/e2e/endpoints/edit-endpoint.cy.js b/cypress/e2e/endpoints/edit-endpoint.cy.js index 9ae62ede52..e95fc8d1a8 100644 --- a/cypress/e2e/endpoints/edit-endpoint.cy.js +++ b/cypress/e2e/endpoints/edit-endpoint.cy.js @@ -35,6 +35,6 @@ describe('Testing Editing endpoints', () => { cy.fixture('data').then((data) => { cy.get('aside').children().should('contain', data.endpoint2) }) - } + }, ) }) diff --git a/cypress/e2e/theme/theme.cy.js b/cypress/e2e/theme/theme.cy.js index b8cfad139f..a3b7f5573d 100644 --- a/cypress/e2e/theme/theme.cy.js +++ b/cypress/e2e/theme/theme.cy.js @@ -22,7 +22,7 @@ describe('Check theme functionality', () => { cy.wait(500) cy.get('#darkTheme').find('input').uncheck({ force: true }) cy.get('body').should('have.class', 'body--light') - } + }, ) it( @@ -33,7 +33,7 @@ describe('Check theme functionality', () => { cy.wait(500) cy.get('#darkTheme').find('input').check({ force: true }) cy.get('body').should('have.class', 'body--dark') - } + }, ) it('RendererApi: set light theme', () => { diff --git a/cypress/e2e/ui/notification-panel.cy.js b/cypress/e2e/ui/notification-panel.cy.js index 790ab70079..2bcdd6b85c 100644 --- a/cypress/e2e/ui/notification-panel.cy.js +++ b/cypress/e2e/ui/notification-panel.cy.js @@ -22,7 +22,7 @@ describe('Check notification panel functionality', () => { cy.get('#NotificationPanel') .parent() .should('not.have.class', ' q-layout--prevent-focus') - } + }, ) it('Check active status on navbar', () => { cy.get('#Notifications').should('have.class', 'navmenu-item--active') @@ -36,7 +36,7 @@ describe('Check notification panel functionality', () => { cy.get('#NotificationPanel') .parent() .should('have.class', 'q-layout--prevent-focus') - } + }, ) it( 'Open notification panel and open preview panel', @@ -51,6 +51,6 @@ describe('Check notification panel functionality', () => { cy.get('#NotificationPanel') .parent() .should('have.class', 'q-layout--prevent-focus') - } + }, ) }) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 30587d3adb..747b6e4dc9 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -18,7 +18,7 @@ Cypress.Commands.add('gotoAttributePage', (endpoint, cluster, nth = 0) => { cy.get('div').contains(cluster).click({ force: true }) cy.wait(1000) cy.get( - `#${cluster} > .q-expansion-item__container > .q-expansion-item__content > .q-card > .q-card__section > .row > .q-table__container > .q-table__middle > .q-table > tbody > :nth-child(1) > :nth-child(7) > .q-btn ` + `#${cluster} > .q-expansion-item__container > .q-expansion-item__content > .q-card > .q-card__section > .row > .q-table__container > .q-table__middle > .q-table > tbody > :nth-child(1) > :nth-child(7) > .q-btn `, ) .eq(nth) .click({ force: true }) diff --git a/docs/ZAP-on-Windows.md b/docs/ZAP-on-Windows.md index 31501d87b4..1f1bbca51f 100644 --- a/docs/ZAP-on-Windows.md +++ b/docs/ZAP-on-Windows.md @@ -11,21 +11,26 @@ In desktop search bar, input `Windows Powershell` and run as administrator. Run Install from https://chocolatey.org/install Check if installed properly: + ``` choco -v ``` + Install pkgconfiglite package: + ``` choco install pkgconfiglite ``` ### 3. Install Node if you have not: + ``` choco install nodejs-lts ``` -*the version has to be 18 to pass version check test, after install, check with `node -v` -*if you install Node already, and fail some tests similar to `cannot find Node`, reinstall Node with chocolatey again +\*the version has to be 18 to pass version check test, after install, check with `node -v` + +\*if you install Node already, and fail some tests similar to `cannot find Node`, reinstall Node with chocolatey again ### 4. Follow the instruction page for other installation details @@ -36,6 +41,7 @@ https://github.com/project-chip/zap/blob/master/docs/development-instructions.md ### 1. sqlite3 When running ZAP (eg. `npm run zap`), if you see an error about `sqlite3.node` in a pop up window, run: + ``` npm rebuild sqlite3 ``` @@ -43,6 +49,7 @@ npm rebuild sqlite3 ### 2. electron-builder: When doing npm install, in post-install, if there is an error on the following command, related to `electron-builder install-app-deps`, `npx electron-rebuild canvas failed` or `node-pre-gyp`, it is because the current `canvas` version is not compatible with Windows, and the installation error will not cause a failure in running ZAP. node-canvas is working on the solution now and the issue will be solved in near future. + ``` "postinstall": "electron-builder install-app-deps && husky install && npm rebuild canvas --update-binary && npm run version-stamp" ``` @@ -52,6 +59,7 @@ When doing npm install, in post-install, if there is an error on the following c ### 1. Exceed Timeout If 'npm run test' fails due to `Exceeded timeout of 1500 ms for a test. Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test.`, set the following environment variables to increase timeouts for all tests. + ``` $env:ZAP_TEST_TIMEOUT = 50000000; $env:ZAP_TEST_TIMEOUT_SHORT = 50000000; $env:ZAP_TEST_TIMEOUT_MEDIUM = 50000000; $env:ZAP_TEST_TIMEOUT_LONG = 50000000 ``` @@ -59,6 +67,7 @@ $env:ZAP_TEST_TIMEOUT = 50000000; $env:ZAP_TEST_TIMEOUT_SHORT = 50000000; $env:Z ### 2. Test Suite failed to run (Canvas not found) If 'npm run test' fails due to `Test suite failed to run. Cannot find module '../build/Release/canvas.node'` or `\zap\node_modules\canvas\build\Release\canvas.node is not a valid Win32 application.`, rebuild canvas: + ``` npm rebuild canvas --update-binary ``` @@ -66,6 +75,7 @@ npm rebuild canvas --update-binary ### 3. get index.html or other server issue If `npm run test` fails due to `get index.html request failed with status code 404` in unit tests or having server connection issues in e2e-ci tests, run: + ``` npm run build ``` @@ -74,4 +84,4 @@ npm run build Check if node version is v18, and try to install it with Chocolatey -Also, you can check the faq doc for other known issues: https://github.com/project-chip/zap/blob/master/docs/faq.md \ No newline at end of file +Also, you can check the faq doc for other known issues: https://github.com/project-chip/zap/blob/master/docs/faq.md diff --git a/docs/access.md b/docs/access.md index 633b8507c0..3b11db2b6a 100644 --- a/docs/access.md +++ b/docs/access.md @@ -7,9 +7,9 @@ these features to the required and supported access control SDK features. ZAP ge ZAP access control defines three base terms: - 1. **operation** : it's something that can be done. Example: read, write, invoke. - 2. **role**: it's a privilege of an actor. Such as "View privilege", "Administrative rol", etc. - 3. **modifiers**: special access control conditions, such as _fabric sensitive_ data or _fabric scoped_ data. +1. **operation** : it's something that can be done. Example: read, write, invoke. +2. **role**: it's a privilege of an actor. Such as "View privilege", "Administrative rol", etc. +3. **modifiers**: special access control conditions, such as _fabric sensitive_ data or _fabric scoped_ data. The base terms are defined in the metadata XML under a top tag ``. Example of access control base term definitions: @@ -36,12 +36,14 @@ Each individual access condition can be defined with an access triplet in the XM Access triplet is a combination of an _operation_, _role_ and _modifier_. They are optional, so you can only have one of these. A missing part of triplet generally means permissivenes, but that's implementation specific for the given SDK. An entity, that defines it's access can have one or more access triplets. Example: + ``` at1 ``` + This is a definition of an attribute that has an access triplet, declaring it allows _write_ operation by a _manage_ role, with _fabric-scoped_ modifier applied. ## Default permissions @@ -51,6 +53,7 @@ ZCL entities can define their own individual permissions. However, there is also Default permissions are declared via a `` tag at the toplevel of the XML. Example: + ``` @@ -70,10 +73,12 @@ Example: The basic template helper to use is the `{{#access}} ... {{/access}}` iterator. This iterator iterates over all the given access triplets. It supports 2 options: - * `entity="attribute/command/event"` - if the entity can't be determined from context, this sets the entity type. - * `includeDefault="true/false"` - determines if default values are included or not. + +- `entity="attribute/command/event"` - if the entity can't be determined from context, this sets the entity type. +- `includeDefault="true/false"` - determines if default values are included or not. Example: + ``` {{#zcl_clusters}} Cluster: {{name}} [{{code}}] @@ -97,4 +102,4 @@ Cluster: {{name}} [{{code}}] {{/zcl_events}} {{/zcl_clusters}} -``` \ No newline at end of file +``` diff --git a/docs/api.md b/docs/api.md index 80a276f033..aecc38f078 100644 --- a/docs/api.md +++ b/docs/api.md @@ -59,11 +59,14 @@

This module provides queries for ZCL loading

DB API: session related queries.
-

This module provides notification related queries.

+

This module provides package notification related queries.

DB API: package-based 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

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.

DB API: zcl database access
+

This module provides a place for creating generic queries which are common +across different query files.

+
+
DB API: zcl database access

This module provides queries for ZCL static queries.

JS API: generator logic
@@ -103,6 +110,8 @@ inside a single session. Things like:
JS API: generator logic
+
JS API: template iterators.
+
JS API: generator logic
REST API: user data
@@ -154,6 +163,8 @@ scripting functionality.

JS API: SDK utilities
+
JS API: string utilities
+
JS API: type related utilities
JS API: random utilities
@@ -188,6 +199,23 @@ scripting functionality.

GLOBAL_SYMBOL_NOTIFY

Global function that can be overloaded by jxbrowser for notifications

+
ASYNC_DEFAULT_TIMER_INTERVAL_MS
+

This module provides the APIs for initializing timers specifically +for sessions.

+
+
watchDogId
+

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.

+
## Constants @@ -206,6 +234,19 @@ scripting functionality.

See the License for the specific language governing permissions and limitations under the License.

+
env
+

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.

+
dbApi

This module provides queries for discriminators

@@ -361,6 +402,19 @@ scripting functionality.

See the License for the specific language governing permissions and limitations under the License.

+
dbEnums
+

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.

+
queryPackage

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.

+
path

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.

+
dbApi
+

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.

+
+
ipc
+

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.

+
rendApi

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.

+
yargs
+

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.

+
+
path
+

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.

+
+
queryZcl
+

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.

+
+
path
+

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.

+
templateUtil

This module provides API to access various iterator utilities that can then be used to build iterator helpers.

+
path
+

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.

+
fs

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.

+
path
+

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.

+
queryZcl

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.

+
queryPackage
+

This module provides the APIs for validating inputs to the database, and returning flags indicating if +things were successful or not.

+
queryZcl

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.

+
fs

Copyright (c) 2020 Silicon Labs

Licensed under the Apache License, Version 2.0 (the "License"); @@ -523,6 +711,24 @@ things were successful or not.

## Functions
+
initAndConnectClient()
+

Initializes and connects a client.

+
+
on(eventType, handler)
+

Register a handler for the event type.

+
+
lastPongData()
+

Get the last pong data.

+
+
isClientConnected()
+

Returns true if client is connected.

+
+
disconnectClient()
+

Disconnects a client asynchronously.

+
+
emit(key, object)
+

Sends a message to server.

+
selectAllDiscriminators(db, packageIds)
selectDataTypeById(db, id)
@@ -659,6 +865,9 @@ created by ZAP.

endpoint_fixed_profile_id_array(options)

Creates array of profileId fields on endpoints

+
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.

+
endpoint_fixed_network_array(options)

Creates array of networkId fields on endpoints

@@ -766,6 +975,63 @@ or non-singleton.
zcl_command_argument_type_to_zcl_cli_data_type(typeName, options)

Helper that deals with the type of the argument.

+
integrationEnabled(db, sessionId)
+

Boolean deciding whether Studio integration logic should be enabled

+
+
isComponentTogglingDisabled(db, sessionId)
+

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.

+
+
restApiUrl(api, path, queryParams)
+

Studio REST API path helper/generator

+
+
wsApiUrl(api, path, queryParams)
+

Studio WebSocket API path helper/generator

+
+
getProjectInfo(db, sessionId)
+

Send HTTP GET request to Studio Jetty server for project information.

+
+
updateComponentByClusterIdAndComponentId(project, componentIds, add, db, sessionId, side)*
+

Send HTTP Post to update UC component state in Studio

+
+
updateComponentByComponentIds(project, componentIds, add)*
+

Send HTTP Post to update UC component state in Studio

+
+
wsMessageHandler(db, session, message)
+

Handles WebSocket messages from Studio server

+
+
initIdeIntegration()
+

Start the dirty flag reporting interval.

+
+
verifyWsConnection(db, sessionId)
+

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.

+
+
wsConnect(sessionId, path)
+

Utility function for making websocket connection to Studio server

+
+
isProjectActive(path)
+

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"
+
+
+
deinitIdeIntegration()
+

Clears up the reporting interval.

+
+
sendSessionCreationErrorStatus(err)
+

Notify front-end that current session failed to load.

+
+
sendComponentUpdateStatus(err)
+

Notify front-end that current session failed to load.

+
exportEndpointTypes(db, sessionId)

Resolves to an array of endpoint types.

@@ -779,6 +1045,16 @@ or non-singleton.

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.

+
convertToFile(state, fileFormat)
+

This function gets the state from database and converts it for a given file format.

+
+
updateCommands(cluster, clusterToCommandMap)
+

Updates the clusters with the new command format where there is isIncoming +and isEnabled instead of incoming and outgoing

+
+
convertFromFile()
+

This function gets the JSON from the file, and converts it to the correct database state

+
locateAttribute(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.

+
importSinglePackage(db, pkg, zapFilePath, packageMatch, defaultZclMetafile, defaultTemplateFile)
+

Resolves into a { packageId:, packageType:} +object, pkg haspath, version, type. It can ALSO have pathRelativity. If pathRelativity is missing +path is considered absolute.

+
convertPackageResult(data)

Convert the array of results into a more palatable value. Resolves an array of { packageId:, packageType:} objects into { zclPackageId: id, templateIds: [] }

-
jsonDataLoader(db, state, sessionId, packageMatch)
+
importPackages(db, packages, zapFilePath, packageMatch, defaultZclMetafile, defaultTemplateFile)
+
+
sortEndpoints(endpoints)
+

Sorts the list of endpoints

+
+
importClusters(db, allZclPackageIds, endpointTypeId, clusters)
+

Imports the clusters for an endpoint type along with attributes, commands +and events

+
+
importCommands(db, allZclPackageIds, endpointTypeId, endpointClusterId, commands)
+

Imports the list of commands from a cluster

+
+
importAttributes(db, allZclPackageIds, endpointTypeId, endpointClusterId, attributes, cluster)
+

Imports the list of attributes from a cluster

+
+
importEvents(db, allZclPackageIds, endpointClusterId, events)
+

Imports the list of events from a cluster

+
+
getMandatoryClusterAttributes(db, epc, cluster, allZclPackageIds)
+

Retrieves the mandatory attributes of a cluster

+
+
getMandatoryClusterCommands(db, epc, cluster, allZclPackageIds)
+

Retrieves the mandatory commands of a cluster

+
+
clusterComplianceForAttributes(db, sessionId, endpointTypeAttributes, allMandatoryAttributes, endpointId, clusterSpecCheckComplianceMessage, specMessageIndent)
+

Adds cluster compliance warnings for attributes to the console and the +session notification table

+
+
clusterComplianceForCommands(db, sessionId, endpointTypeCommands, allMandatoryCommands, endpointId, clusterSpecCheckComplianceMessage, specMessageIndent)
+

Adds cluster compliance warnings for commands to the console and the +session notification table

+
+
deviceTypeClustersAttributesAndCommands(db, endpointTypeId)
+

Retrieves deviceTypeClustersOnEndpointType, deviceTypeAttributesOnEndpointType +and deviceTypeCommandsOnEndpointType for an endpoint type

+
+
deviceTypeClusterToFeatureBits(deviceTypeFeaturesOnEndpointType)
+
+
deviceTypeComplianceForClusters(db, endpointId, sessionId, deviceTypeClustersOnEndpointType, endpointTypeClusterRefMap, deviceTypeSpecCheckComplianceMessage, specMessageIndent)
+

Adds device type compliance warnings for clusters to the console and the +session notification table

+
+
deviceTypeComplianceForAttributes(db, endpointId, sessionId, deviceTypeAttributesOnEndpointType, endpointTypeAttributeRefMap, deviceTypeSpecCheckComplianceMessage, specMessageIndent)
+

Adds device type compliance warnings for attributes to the console and the +session notification table

+
+
deviceTypeComplianceForCommands(db, endpointId, sessionId, deviceTypeCommandsOnEndpointType, endpointTypeCommandRefMap, deviceTypeSpecCheckComplianceMessage, specMessageIndent)
+

Adds device type compliance warnings for commands to the console and the +session notification table

+
+
importEndpointTypes(db, sessionId, allZclPackageIds, endpointTypes, endpoints)
+

Import endpointTypes

+
+
jsonDataLoader(db, state, sessionId, packageMatch, defaultZclMetafile, defaultTemplateFile)

Given a state object, this method returns a promise that resolves with the succesfull writing into the database.

-
readJsonData(filePath, data)
+
readJsonData(filePath, data, defaultZclMetafile, defaultTemplateFile)

Parses JSON file and creates a state object out of it, which is passed further down the chain.

-
readDataFromFile(filePath)
+
readDataFromFile(filePath, defaultZclMetafile, defaultTemplateFile)

Reads the data from the file and resolves with the state object if all is good.

importDataFromFile(db, filePath)
@@ -893,6 +1227,54 @@ NOTE: This function does NOT initialize session packages.

startUpMainInstance(quitFunction, argv)

Default startup method.

+
start(expirationInterval, triggerFunction)
+

Starts a zap watchdog.

+
+
reset()
+

Resets a zap watchdog.

+
+
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.

+
+
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.

+

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.

+
+
computeStorageOptionNewConfig(storagePolicy)
+

This asynchronous function computes and returns the new configuration for a storage option.

+
+
computeStoragePolicyNewConfig(db, clusterRef, storagePolicy, forcedExternal, attributeName)
+

This asynchronous function computes and returns the new configuration for a storage policy.

+
+
computeStorageImport(db, clusterName, storagePolicy, forcedExternal, attributeName)
+

This asynchronous function computes and returns the updated storage import policy.

+
+
socketPath()
+

Returns the socket path for the IPC.

+
+
preHandler()
+

Runs just before every time IPC request is processed.

+
+
initServer(options)
+

IPC initialization.

+
+
isServerRunning()
+

Returns true if server is running.

+
+
shutdownServerSync(isServer)
+

Shuts down the IPC server.

+
+
createOrShowAboutWindow(port)
+

Call this function to create a new or show an existing preference window.

+
+
hookMainInstanceEvents()
+

Hook up all the events for the electron app object.

+
doOpen(menuItem, browserWindow, event)

Perform a file->open operation.

@@ -914,48 +1296,241 @@ NOTE: This function does NOT initialize session packages.

initMenu(httpPort)

Initial menu show.

-
all_user_cluster_commands_helper()
-

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.

+
showErrorMessage(title, err)
+

Simple dialog to show error messages from electron renderer scope.

-
initAsyncValidation()
-

Start session specific validation.

+
openFileConfiguration(db, filePath, httpPort)
+

Process a single file, parsing it in as JSON and then possibly opening +a new window if all is good.

-
collectDataFromLibraryXml(ctx)
-

Promises to read the properties file, extract all the actual xml files, and resolve with the array of files.

+
openNewConfiguration(httpPort, options:)
+

Creates a new window with a blank configuration.

-
parseZclFiles(db, ctx)
-

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.

+
toggleDirtyFlag(browserWindow, dirty)
+

Toggles the dirty flag.

-
normalizeHexValue(value)
-

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?

+
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.

-
getNumBytesFromShortName(value)
-

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?

+
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.

-
prepareAttributes(attributes, side)
-

Prepare XML attributes for entry into the DB

+
windowCreate(port, filePath, [uiMode])
+

Create a window, possibly with a given file path.

-
prepareCommands(commands, side, types)
-

Prepare XML commands for entry into the DB

+
processCommandLineArguments(argv)
+

Process the command line arguments and resets the state in this file +to the specified values.

-
prepareCluster(cluster, isExtension, types)
-

Prepare XML cluster for insertion into the database. -This method can also prepare clusterExtensions.

+
int8ToHex(value)
+

Takes an int8 value and turns it into a hex.

-
prepareAtomic(type)
-

Parses xml type into the atomic object for insertion into the DB

+
int16ToHex(value)
+

Takes an int16 value and turns it into a hex.

-
prepareBitmap(type, isContained)
-

Parses xml type into the bitmap object for insertion into the DB

+
int32ToHex(value)
+

Takes an int32 value and turns it into a hex.

-
prepareEnum(type)
+
stringToHex(value)
+

Converts a string to the hex value.

+
+
bitCount(n)
+

Given a number, this function returns the number of bits set in the number

+
+
hexToCBytes(value)
+

Takes the raw hex string, such as abcd and +converts it into a C constant array, such as +0xAB, 0xCD.

+
+
bitOffset(binary)
+

Getting a binary string ("0001101010010") it returns the number of zero bits at the end.

+
+
hexToBinary(hex)
+

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".

+
+
stringToOneByteLengthPrefixCBytes(value, maxLength, pad)
+

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.

+
+
stringToTwoByteLengthPrefixCBytes(value, maxLength, pad)
+

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.

+
+
builtinSilabsZclMetafile()
+
+
builtinSilabsZclSpecialMetafile()
+

Used to retrive zcl-special.json by zcl reload test in zcl-loader.test.js

+
+
builtinSilabsZclGeneralXmlFile()
+
+
builtinSilabsSpecialZclGeneralSpecialXmlFile()
+

Used to retrive general-special.xml by zcl reload test in zcl-loader.test.js

+
+
setAppDirectory(path)
+

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.

+
+
appDirectory()
+

Returns an app directory. It creates it, if it doesn't exist

+
+
zapVersionAsString()
+

Returns a version as a single on-line string.

+
+
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.

+
+
zapVersion()
+

Returns the zap version.

+
+
printToStderr(msg)
+

Prints the data to stderr, without much fuss.

+
+
log(level, msg, err)
+

Base level common logger.

+
+
logInfo(msg, err)
+

Info level message.

+
+
logError(msg, err)
+

Error level message.

+
+
logWarning(msg, err)
+

Warning level message.

+
+
logSql(msg, err)
+

Sql level message.

+
+
logBrowser(msg, err)
+

Browser level message.

+
+
logIpc(msg, err)
+

IPC level message.

+
+
logDebug(msg, err)
+

Debug level message.

+
+
versionsCheck()
+

Returns true if versions of node and electron are matching. +If versions are not matching, it prints out a warhing +and returns false.

+
+
httpStaticContent()
+

Returns path to HTTP static content while taking into account DEV / PROD modes.

+
+
availableClusters(context)
+

Returns all available clusters.

+
+
availableEvents(context)
+

Returns all available events.

+
+
availableCommands(context)
+

Returns all available commands.

+
+
availableAttributes(context)
+

Returns all available attributes.

+
+
helperWrapper(wrappedHelper)function
+

Wraps a helper function to add usage tracking and error handling.

+
+
registerHelpers(singleHelper, registerHelper, context)
+

Registers a helper function.

+
+
executeHelperFunction(functionName, context, helper)Promise
+

Executes a helper function from a script file.

+
+
all_user_cluster_commands_helper()
+

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.

+
+
executeScriptFunction(functionName, db, sessionId, script)
+

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.

+
+
projectName(db, sessionId)
+

Extract project name from the Studio project path

+
+
initAsyncValidation()
+

Start session specific validation.

+
+
validateAttribute(db, endpointTypeId, attributeRef, clusterRef, zapSessionId)
+

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".

+
+
validateSpecificAttribute(endpointAttribute, attribute, db, zapSessionId)
+

Checks the attributes type then validates the incoming input string.

+
+
extractIntegerValue(value)
+

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.

+
+
unsignedToSignedInteger(value, typeSize)
+

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.

+
+
getIntegerFromAttribute(attribute, typeSize, isSigned)
+

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.

+
+
getIntegerAttributeSize(db, zapSessionId, attribType)*
+

Returns information about an integer type.

+
+
checkAttributeBoundsInteger(attribute, endpointAttribute, db, zapSessionId)
+

Checks if the incoming integer is within it's attributes bound while handling signed and unsigned cases.

+
+
collectDataFromLibraryXml(ctx)
+

Promises to read the properties file, extract all the actual xml files, and resolve with the array of files.

+
+
parseZclFiles(db, ctx)
+

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.

+
+
normalizeHexValue(value)
+

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?

+
+
getNumBytesFromShortName(value)
+

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?

+
+
prepareAttributes(attributes, side)
+

Prepare XML attributes for entry into the DB

+
+
prepareCommands(commands, side, types)
+

Prepare XML commands for entry into the DB

+
+
prepareCluster(cluster, isExtension, types)
+

Prepare XML cluster for insertion into the database. +This method can also prepare clusterExtensions.

+
+
prepareAtomic(type)
+

Parses xml type into the atomic object for insertion into the DB

+
+
prepareBitmap(type, isContained)
+

Parses xml type into the bitmap object for insertion into the DB

+
+
prepareEnum(type)

Parses xml type into the enum object for insertion into the DB

prepareStruct(type)
@@ -1034,10 +1609,15 @@ that will be resolved when all the XML files are done, or rejected if at least o
loadIndividualDotDotFile(db, filePath)*

TODO This is not supported at this time.

-
loadDotdotZcl(db, ctx)
+
loadToplevelXmlFile(db, ctx)

Toplevel function that loads the xml library file and orchestrates the promise chain.

+
parseNewXmlFiles(db, packageId, files, context)
+

Parses the new XML files. Returns an object containing +loaded data: + clusterIdsLoaded: array of cluster ids that were loaded

+
collectDataFromJsonFile(ctx)

Promises to read the JSON file and resolve all the data.

@@ -1150,8 +1730,13 @@ attributes and commands in a same way as cluster or clusterExtension

prepareDeviceType(deviceType)

Preparation step for the device types.

-
processDeviceTypes(db, filePath, packageId, data)
-

Process all device types.

+
processDeviceTypes(db, filePath, packageId, data, context)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.

processParsedZclData(db, argument)

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.

+
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.

+
parseZclFiles(db, packageId, zclFiles, context)

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.

parseBoolOptions(db, pkgRef, booleanCategories)

Parses the boolean options.

+
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

+
parseDefaults(db, ctx)

Parses the default values inside the options.

@@ -1204,16 +1802,22 @@ e.g. for ClusterExtensions.

processCustomZclDeviceType(db, ctx)

If custom device is supported, then this method creates it.

-
loadSilabsZcl(db, ctx)
+
loadZclJsonOrProperties(db, ctx)

Toplevel function that loads the toplevel metafile and orchestrates the promise chain.

-
recordToplevelPackage(db, metadataFile, crc)
+
recordToplevelPackage(db, metadataFile, crc, isTopLevelPackageInSync)

Records the toplevel package information and resolves into packageId

recordVersion(db, ctx)

Records the version into the database.

+
loadZclMetaFilesCommon(db, metadataFile, options)
+

Retrieve zcl package information

+
+
loadAttributeMappingForMultiProtocol(db, multiProtcolInfo, categoryToPackageIdMap)
+

Load attribute mapping table if there is multi-protocol information from a json file.

+
loadZclMetafiles(db, metadataFile)

Toplevel function that loads the zcl file and passes it off to the correct zcl loader.

@@ -1223,7 +1827,7 @@ and orchestrates the promise chain.

loadIndividualFile(db, filePath, sessionId)

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} 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: + +then newCmdResponse will be included in the list of commands returned here. + +There are two modes of this helper: + +- when used in a global context, it iterates over ALL command responses in + the database. +- when used inside a `zcl_cluster` block helper, it iterates only over the + commands responses for that cluster. + +**Kind**: inner method of [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="" option.' + 'Access helper requires entityType, either from context, or from the entity="" option.', ) } @@ -61,7 +61,7 @@ async function collectAccesslist(ctx, options) { case 'attribute': accessList = await queryAccess.selectAttributeAccess( ctx.global.db, - ctx.id + ctx.id, ) break case 'command': @@ -72,7 +72,7 @@ async function collectAccesslist(ctx, options) { break default: throw new Error( - `Entity type ${entityType} not supported. Requires: attribute/command/event.` + `Entity type ${entityType} not supported. Requires: attribute/command/event.`, ) } @@ -101,11 +101,11 @@ async function access_aggregate(options) { let allOps = await queryAccess.selectAccessOperations( this.global.db, - packageIds + packageIds, ) let allMods = await queryAccess.selectAccessModifiers( this.global.db, - packageIds + packageIds, ) let allRoles = await queryAccess.selectAccessRoles(this.global.db, packageIds) let roleLevels = {} @@ -196,7 +196,7 @@ async function default_access(options) { if (entityType == null) { throw new Error( - 'Access helper requires entityType, either from context, or from the entity="" option.' + 'Access helper requires entityType, either from context, or from the entity="" option.', ) } diff --git a/src-electron/generator/helper-attribute.js b/src-electron/generator/helper-attribute.js index 39eac9ca05..ec68e2daeb 100644 --- a/src-electron/generator/helper-attribute.js +++ b/src-electron/generator/helper-attribute.js @@ -44,7 +44,7 @@ async function attributeDefault(options) { packageIds, this.id, code, - this.mfgCode + this.mfgCode, ) if (attr == null) { // Check if it's global attribute @@ -53,13 +53,13 @@ async function attributeDefault(options) { packageIds, null, code, - this.mfgCode + this.mfgCode, ) } let defs = await queryAttribute.selectGlobalAttributeDefaults( this.global.db, this.id, - attr.id + attr.id, ) let p = templateUtil.collectBlocks([defs], options, this) return templateUtil.templatePromise(this.global, p) diff --git a/src-electron/generator/helper-c.js b/src-electron/generator/helper-c.js index e192abee0e..5dd9d194e0 100644 --- a/src-electron/generator/helper-c.js +++ b/src-electron/generator/helper-c.js @@ -90,7 +90,7 @@ async function asUnderlyingTypeHelper(dataType, context, packageIds) { let bt = await queryZcl.selectBitmapByName( context.global.db, packageIds, - dataType.name + dataType.name, ) return context.global.overridable.bitmapType(bt.size) } else if ( @@ -100,7 +100,7 @@ async function asUnderlyingTypeHelper(dataType, context, packageIds) { let et = await queryZcl.selectEnumByName( context.global.db, dataType.name, - packageIds + packageIds, ) return context.global.overridable.enumType(et.size, et.name) } else if ( @@ -110,12 +110,12 @@ async function asUnderlyingTypeHelper(dataType, context, packageIds) { let nt = await queryZcl.selectNumberByName( context.global.db, packageIds, - dataType.name + dataType.name, ) return context.global.overridable.numberType( nt.size, nt.isSigned, - nt.name + nt.name, ) } else if ( dataType && @@ -132,7 +132,7 @@ async function asUnderlyingTypeHelper(dataType, context, packageIds) { } } catch (err) { envConfig.logError( - 'Could not find the underlying type for ' + dataType.name + ' : ' + err + 'Could not find the underlying type for ' + dataType.name + ' : ' + err, ) } } @@ -153,7 +153,7 @@ async function asUnderlyingType(value) { dataType = await queryZcl.selectDataTypeByName( this.global.db, value, - packageIds + packageIds, ) } @@ -163,7 +163,7 @@ async function asUnderlyingType(value) { this.global.db, this.global.genTemplatePackageId, 'types', - dataType.name + dataType.name, ) if (typeOverride) { return typeOverride.optionLabel @@ -241,7 +241,7 @@ async function asBytes(value, type) { return templateUtil .ensureZclPackageIds(this) .then((packageIds) => - queryZcl.selectSizeFromType(this.global.db, packageIds, type) + queryZcl.selectSizeFromType(this.global.db, packageIds, type), ) .then((x) => { if (x == null) { diff --git a/src-electron/generator/helper-command.js b/src-electron/generator/helper-command.js index 735d122663..d382b85fa8 100644 --- a/src-electron/generator/helper-command.js +++ b/src-electron/generator/helper-command.js @@ -35,7 +35,7 @@ const types = require('../util/types.js') async function if_command_arguments_exist( commandId, argument_return, - no_argument_return + no_argument_return, ) { let promise = queryCommand .selectCommandArgumentsCountByCommandId(this.global.db, commandId) @@ -68,7 +68,7 @@ async function if_command_arguments_exist( async function if_command_args_exist(commandId, options) { let res = await queryCommand.selectCommandArgumentsCountByCommandId( this.global.db, - commandId + commandId, ) if (res > 0) { return options.fn(this) @@ -87,7 +87,7 @@ async function if_command_args_exist(commandId, options) { function if_ca_always_present_with_presentif( commandArg, trueReturn, - falseReturn + falseReturn, ) { if ( !(commandArg.introducedInRef || commandArg.removedInRef) && @@ -138,11 +138,11 @@ async function if_command_is_not_fixed_length_but_command_argument_is_always_pre commandId, commandArg, trueReturn, - falseReturn + falseReturn, ) { let commandArgs = await queryCommand.selectCommandArgumentsByCommandId( this.global.db, - commandId + commandId, ) let isFixedLengthCommand = true for (let ca of commandArgs) { @@ -192,11 +192,11 @@ async function if_command_is_not_fixed_length_but_command_argument_is_always_pre async function if_command_not_fixed_length_command_argument_always_present( command, commandArg, - options + options, ) { let commandArgs = await queryCommand.selectCommandArgumentsByCommandId( this.global.db, - command + command, ) let isFixedLengthCommand = true for (let ca of commandArgs) { @@ -238,7 +238,7 @@ async function if_command_not_fixed_length_command_argument_always_present( function if_ca_not_always_present_no_presentif( commandArg, trueReturn, - falseReturn + falseReturn, ) { if ( (commandArg.introducedInRef || commandArg.removedInRef) && @@ -286,7 +286,7 @@ function if_command_arg_not_always_present_no_presentif(commandArg, options) { function if_ca_not_always_present_with_presentif( commandArg, trueReturn, - falseReturn + falseReturn, ) { if ( (commandArg.introducedInRef || commandArg.removedInRef) && @@ -337,11 +337,11 @@ function if_command_arg_not_always_present_with_presentif(commandArg, options) { async function if_command_is_fixed_length( commandId, fixedLengthReturn, - notFixedLengthReturn + notFixedLengthReturn, ) { let commandArgs = await queryCommand.selectCommandArgumentsByCommandId( this.global.db, - commandId + commandId, ) let fixedLength = true @@ -383,7 +383,7 @@ async function if_command_is_fixed_length( async function if_command_fixed_length(commandId, options) { let commandArgs = await queryCommand.selectCommandArgumentsByCommandId( this.global.db, - commandId + commandId, ) for (let commandArg of commandArgs) { if ( @@ -414,7 +414,7 @@ exports.if_command_arguments_exist = dep(if_command_arguments_exist, { }) exports.if_ca_always_present_with_presentif = dep( if_ca_always_present_with_presentif, - { to: 'if_command_arg_always_present_with_presentif' } + { to: 'if_command_arg_always_present_with_presentif' }, ) exports.if_command_is_not_fixed_length_but_command_argument_is_always_present = dep(if_command_is_not_fixed_length_but_command_argument_is_always_present, { @@ -422,11 +422,11 @@ exports.if_command_is_not_fixed_length_but_command_argument_is_always_present = }) exports.if_ca_not_always_present_no_presentif = dep( if_ca_not_always_present_no_presentif, - { to: 'if_command_arg_not_always_present_no_presentif' } + { to: 'if_command_arg_not_always_present_no_presentif' }, ) exports.if_ca_not_always_present_with_presentif = dep( if_ca_not_always_present_with_presentif, - { to: 'if_command_arg_not_always_present_with_presentif' } + { to: 'if_command_arg_not_always_present_with_presentif' }, ) exports.if_command_fixed_length = if_command_fixed_length exports.if_command_not_fixed_length_command_argument_always_present = diff --git a/src-electron/generator/helper-endpointconfig.js b/src-electron/generator/helper-endpointconfig.js index 117f93cfe8..7fff8e3232 100644 --- a/src-electron/generator/helper-endpointconfig.js +++ b/src-electron/generator/helper-endpointconfig.js @@ -207,7 +207,7 @@ function endpoint_types_list(options) { let ret = '{ \\\n' this.endpointList.forEach((ep) => { ret = ret.concat( - ` { ZAP_CLUSTER_INDEX(${ep.clusterIndex}), ${ep.clusterCount}, ${ep.attributeSize} }, \\\n` + ` { ZAP_CLUSTER_INDEX(${ep.clusterIndex}), ${ep.clusterCount}, ${ep.attributeSize} }, \\\n`, ) }) return ret.concat('}\n') @@ -229,7 +229,7 @@ function endpoint_cluster_list(options) { .join(' | ') } ret = ret.concat( - ` { ${c.clusterId}, ZAP_ATTRIBUTE_INDEX(${c.attributeIndex}), ${c.attributeCount}, ${c.attributeSize}, ${mask}, ${c.functions} }, /* ${c.comment} */ \\\n` + ` { ${c.clusterId}, ZAP_ATTRIBUTE_INDEX(${c.attributeIndex}), ${c.attributeCount}, ${c.attributeSize}, ${mask}, ${c.functions} }, /* ${c.comment} */ \\\n`, ) }) return ret.concat('}\n') @@ -353,8 +353,8 @@ async function device_list(context, options) { endpointIdentifier: ept.endpointId, deviceId: dId, deviceVersion: ept.deviceVersions[index], - }) - ) + }), + ), ) return deviceList } @@ -462,7 +462,7 @@ function endpoint_attribute_min_max_list(options) { this.minMaxList.forEach((mm, index) => { if (mm.typeSize > 2) { throw new Error( - `Can't have min/max for attributes larger than 2 bytes like '${mm.name}'` + `Can't have min/max for attributes larger than 2 bytes like '${mm.name}'`, ) } if (mm.comment != comment) { @@ -651,7 +651,7 @@ async function determineAttributeDefaultValue( typeSize, isNullable, db, - sessionId + sessionId, ) { if (specifiedDefault !== null || !isNullable) { return specifiedDefault @@ -669,7 +669,7 @@ async function determineAttributeDefaultValue( if (types.isFloat(type)) { // Not supported yet. throw new Error( - "Don't know how to output a null default value for a float type" + "Don't know how to output a null default value for a float type", ) } @@ -769,7 +769,7 @@ async function collectAttributes(db, sessionId, endpointTypes, options) { typeSize, a.isNullable, db, - sessionId + sessionId, ) // Various types store the length of the actual content in bytes. // For those, we can size the default storage to be just big enough for @@ -838,7 +838,7 @@ async function collectAttributes(db, sessionId, endpointTypes, options) { def = types.longTypeDefaultValue( defaultSize, a.type, - attributeDefaultValue + attributeDefaultValue, ) } let longDef = { @@ -920,7 +920,7 @@ async function collectAttributes(db, sessionId, endpointTypes, options) { dbEnum.storageOption.ram, ] .map((s) => `"${s}"`) - .join(', ')}` + .join(', ')}`, ) } if (a.isSingleton) mask.push('singleton') @@ -1092,11 +1092,11 @@ async function collectAttributeSizes(db, zclPackageIds, endpointTypes) { db, zclPackageIds, at, - `ERROR: ${at.name}, invalid size, ${at.type}` + `ERROR: ${at.name}, invalid size, ${at.type}`, ) .then((size) => { at.typeSize = size - }) + }), ) }) }) @@ -1121,7 +1121,7 @@ async function collectAttributeTypeInfo(db, zclPackageIds, endpointTypes) { ps.push( zclUtil.determineType(db, at.type, zclPackageIds).then((typeInfo) => { at.typeInfo = typeInfo - }) + }), ) }) }) @@ -1162,17 +1162,17 @@ function endpoint_config(options) { .then(() => queryPackage.getPackageByPackageId( newContext.global.db, - newContext.global.genTemplatePackageId - ) + newContext.global.genTemplatePackageId, + ), ) .then((templatePackage) => templatePackage && templatePackage.category ? queryEndpoint.selectAllEndpointsBasedOnTemplateCategory( db, sessionId, - templatePackage.category + templatePackage.category, ) - : queryEndpoint.selectAllEndpoints(db, sessionId) + : queryEndpoint.selectAllEndpoints(db, sessionId), ) .then((endpoints) => { newContext.endpoints = endpoints @@ -1198,7 +1198,7 @@ function endpoint_config(options) { ept.deviceVersion = eptId.deviceVersion ept.deviceIdentifier = eptId.deviceIdentifier return ept - }) + }), ) }) return Promise.all(endpointTypePromises) @@ -1226,53 +1226,53 @@ function endpoint_config(options) { db, cl.clusterId, cl.side, - ept.id + ept.id, ) .then((attributes) => { // Keep only the enabled attributes, and not the global ones // we exclude from metadata. cl.attributes = attributes.filter( (a) => - a.isIncluded && !isGlobalAttrExcludedFromMetadata(a) + a.isIncluded && !isGlobalAttrExcludedFromMetadata(a), ) - }) + }), ) ps.push( queryEndpoint .selectEndpointClusterCommands(db, cl.clusterId, ept.id) .then((commands) => { cl.commands = commands - }) + }), ) ps.push( queryEndpoint .selectEndpointClusterEvents(db, cl.clusterId, ept.id) .then((events) => { cl.events = events - }) + }), ) }) return Promise.all(ps) - }) + }), ) }) return Promise.all(promises).then(() => endpointTypes) }) .then((endpointTypes) => - collectAttributeTypeInfo(db, this.global.zclPackageIds, endpointTypes) + collectAttributeTypeInfo(db, this.global.zclPackageIds, endpointTypes), ) .then((endpointTypes) => - collectAttributeSizes(db, this.global.zclPackageIds, endpointTypes) + collectAttributeSizes(db, this.global.zclPackageIds, endpointTypes), ) .then((endpointTypes) => - collectAttributes(db, sessionId, endpointTypes, collectAttributesOptions) + collectAttributes(db, sessionId, endpointTypes, collectAttributesOptions), ) .then((collection) => { Object.assign(newContext, collection) }) .then(() => options.fn(newContext)) .catch((err) => - console.log('Error in endpoint_config helper: ' + err.message) + console.log('Error in endpoint_config helper: ' + err.message), ) return templateUtil.templatePromise(this.global, promise) } diff --git a/src-electron/generator/helper-sdkextension.js b/src-electron/generator/helper-sdkextension.js index 395b772bfc..f0efd46ed5 100644 --- a/src-electron/generator/helper-sdkextension.js +++ b/src-electron/generator/helper-sdkextension.js @@ -29,10 +29,10 @@ async function clusterExtension(context, prop, clusterCode, role) { return templateUtil .ensureTemplatePackageId(context) .then((packageId) => - templateUtil.ensureZclClusterSdkExtensions(context, packageId) + templateUtil.ensureZclClusterSdkExtensions(context, packageId), ) .then((extensions) => - util.getClusterExtensionDefault(extensions, prop, clusterCode, role) + util.getClusterExtensionDefault(extensions, prop, clusterCode, role), ) } @@ -73,7 +73,7 @@ async function device_type_extension(options) { let packageId = await templateUtil.ensureTemplatePackageId(this) let extensions = await templateUtil.ensureZclDeviceTypeSdkExtensions( this, - packageId + packageId, ) let f = extensions.filter((x) => x.property == prop) @@ -106,7 +106,7 @@ async function attribute_type_extension(options) { let packageId = await templateUtil.ensureTemplatePackageId(this) let extensions = await templateUtil.ensureZclAttributeTypeSdkExtensions( this, - packageId + packageId, ) let f = extensions.filter((x) => x.property == prop) if (f.length == 0) { @@ -131,17 +131,17 @@ async function subentityExtension(context, prop, entityType) { if (entityType == dbEnum.packageExtensionEntity.attribute) { extensions = await templateUtil.ensureZclAttributeSdkExtensions( context, - packageId + packageId, ) } else if (entityType == dbEnum.packageExtensionEntity.command) { extensions = await templateUtil.ensureZclCommandSdkExtensions( context, - packageId + packageId, ) } else if (entityType == dbEnum.packageExtensionEntity.event) { extensions = await templateUtil.ensureZclEventSdkExtensions( context, - packageId + packageId, ) } else { throw new Error(`Invalid subentity: ${entityType}`) @@ -193,7 +193,7 @@ function if_command_extension_true(options) { return subentityExtension( this, prop, - dbEnum.packageExtensionEntity.command + dbEnum.packageExtensionEntity.command, ).then((val) => { if (val == true || val == 1) { return options.fn(this) @@ -210,7 +210,7 @@ function if_command_extension_false(options) { return subentityExtension( this, prop, - dbEnum.packageExtensionEntity.command + dbEnum.packageExtensionEntity.command, ).then((val) => { if (val == false || val == 0) { return options.fn(this) diff --git a/src-electron/generator/helper-session.js b/src-electron/generator/helper-session.js index a530f13349..1045733761 100644 --- a/src-electron/generator/helper-session.js +++ b/src-electron/generator/helper-session.js @@ -46,7 +46,7 @@ function user_endpoints(options) { Promise.all([ queryEndpointType.selectAllEndpointTypes( this.global.db, - this.global.sessionId + this.global.sessionId, ), templateUtil .ensureEndpointTypeIds(this) @@ -54,8 +54,8 @@ function user_endpoints(options) { queryImpexp.exportEndpoints( this.global.db, this.global.sessionId, - endpointTypes - ) + endpointTypes, + ), ), ]) .then( @@ -70,7 +70,7 @@ function user_endpoints(options) { deviceVersions: ept.deviceVersion, deviceIdentifiers: ept.deviceIdentifier, deviceCategories: ept.deviceCategory, - }) + }), ) // Adding device Identifiers and versions to endpoints from endpoint types endpoints.forEach((ep) => { @@ -82,7 +82,7 @@ function user_endpoints(options) { endpointTypeMap[ep.endpointTypeRef].deviceCategories }) resolve(endpoints) - }) + }), ) .then((endpoints) => packageInfoCategory @@ -90,19 +90,19 @@ function user_endpoints(options) { (ep) => ep.endpointCategories.includes(packageInfoCategory) || ep.endpointCategories.includes(undefined) || - ep.endpointCategories.includes(null) + ep.endpointCategories.includes(null), ) - : endpoints + : endpoints, ) .then((endpoints) => endpoints.map((x) => { x.endpointTypeId = x.endpointTypeRef return x - }) + }), ) .then((endpoints) => - templateUtil.collectBlocks(endpoints, options, this) - ) + templateUtil.collectBlocks(endpoints, options, this), + ), ) return templateUtil.templatePromise(this.global, promise) @@ -117,10 +117,10 @@ async function user_device_types(options) { let promise = queryDeviceType .selectDeviceTypesWithCompositionByEndpointTypeId( this.global.db, - this.endpointTypeId + this.endpointTypeId, ) .then((deviceTypes) => - templateUtil.collectBlocks(deviceTypes, options, this) + templateUtil.collectBlocks(deviceTypes, options, this), ) return templateUtil.templatePromise(this.global, promise) } @@ -135,7 +135,7 @@ function user_endpoint_types(options) { let promise = queryEndpointType .selectAllEndpointTypes(this.global.db, this.global.sessionId) .then((endpointTypes) => - templateUtil.collectBlocks(endpointTypes, options, this) + templateUtil.collectBlocks(endpointTypes, options, this), ) return templateUtil.templatePromise(this.global, promise) } @@ -150,7 +150,7 @@ function user_clusters(options) { let promise = queryImpexp .exportClustersFromEndpointType(this.global.db, this.endpointTypeId) .then((endpointClusters) => - templateUtil.collectBlocks(endpointClusters, options, this) + templateUtil.collectBlocks(endpointClusters, options, this), ) return templateUtil.templatePromise(this.global, promise) } @@ -166,10 +166,10 @@ function user_cluster_attributes(options) { let promise = queryImpexp .exportAttributesFromEndpointTypeCluster( this.global.db, - this.endpointClusterId + this.endpointClusterId, ) .then((endpointAttributes) => - templateUtil.collectBlocks(endpointAttributes, options, this) + templateUtil.collectBlocks(endpointAttributes, options, this), ) return templateUtil.templatePromise(this.global, promise) } @@ -186,10 +186,10 @@ function user_cluster_commands(options) { .exportCommandsFromEndpointTypeCluster( this.global.db, this.parent.endpointTypeId, - this.endpointClusterId + this.endpointClusterId, ) .then((endpointAttributes) => - templateUtil.collectBlocks(endpointAttributes, options, this) + templateUtil.collectBlocks(endpointAttributes, options, this), ) return templateUtil.templatePromise(this.global, promise) } @@ -205,7 +205,7 @@ function user_cluster_events(options) { let promise = queryImpexp .exportEventsFromEndpointTypeCluster(this.global.db, this.endpointClusterId) .then((endpointEvents) => - templateUtil.collectBlocks(endpointEvents, options, this) + templateUtil.collectBlocks(endpointEvents, options, this), ) return templateUtil.templatePromise(this.global, promise) } @@ -213,7 +213,7 @@ function user_cluster_events(options) { function user_endpoint_type_count() { let promise = queryConfig.selectEndpointTypeCount( this.global.db, - this.global.sessionId + this.global.sessionId, ) return templateUtil.templatePromise(this.global, promise) } @@ -230,7 +230,7 @@ function user_endpoint_count_by_cluster(clusterTypeId, side) { this.global.db, this.global.sessionId, clusterTypeId, - side + side, ) return templateUtil.templatePromise(this.global, promise) } @@ -259,7 +259,7 @@ function all_user_cluster_commands(options) { let promise = iteratorUtil.all_user_cluster_commands_helper .call(this, options) .then((endpointCommands) => - templateUtil.collectBlocks(endpointCommands, options, this) + templateUtil.collectBlocks(endpointCommands, options, this), ) return promise } @@ -281,14 +281,14 @@ async function all_user_cluster_command_util( options, currentContext, isManufacturingSpecific, - isIrrespectiveOfManufacturingSpecification = false + isIrrespectiveOfManufacturingSpecification = false, ) { let endpointTypes = await templateUtil.ensureEndpointTypeIds(currentContext) let packageIds = await templateUtil.ensureZclPackageIds(currentContext) let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( currentContext.global.db, - endpointTypes + endpointTypes, ) let endpointCommands if (isIrrespectiveOfManufacturingSpecification) { @@ -297,21 +297,21 @@ async function all_user_cluster_command_util( currentContext.global.db, endpointsAndClusters, true, - packageIds + packageIds, ) } else if (isManufacturingSpecific) { endpointCommands = await queryCommand.selectManufacturerSpecificCommandDetailsFromAllEndpointTypesAndClusters( currentContext.global.db, endpointsAndClusters, - packageIds + packageIds, ) } else { endpointCommands = await queryCommand.selectNonManufacturerSpecificCommandDetailsFromAllEndpointTypesAndClusters( currentContext.global.db, endpointsAndClusters, - packageIds + packageIds, ) } @@ -324,7 +324,7 @@ async function all_user_cluster_command_util( endpointCommands[i].incoming, endpointCommands[i].outgoing, endpointCommands[i].commandSource, - endpointCommands[i].name + endpointCommands[i].name, ) ) { availableCommands.push(endpointCommands[i]) @@ -340,14 +340,14 @@ async function all_user_cluster_attribute_util( options, currentContext, isManufacturingSpecific, - isIrrespectiveOfManufacturingSpecification = false + isIrrespectiveOfManufacturingSpecification = false, ) { let packageIds = await templateUtil.ensureZclPackageIds(currentContext) let endpointTypes = await templateUtil.ensureEndpointTypeIds(currentContext) let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( currentContext.global.db, - endpointTypes + endpointTypes, ) let endpointAttributes @@ -358,21 +358,21 @@ async function all_user_cluster_attribute_util( currentContext.global.db, endpointsAndClusters, packageIds, - side + side, ) } else if (isManufacturingSpecific) { endpointAttributes = await queryAttribute.selectManufacturerSpecificAttributeDetailsFromAllEndpointTypesAndClusters( currentContext.global.db, endpointsAndClusters, - packageIds + packageIds, ) } else { endpointAttributes = await queryAttribute.selectNonManufacturerSpecificAttributeDetailsFromAllEndpointTypesAndClusters( currentContext.global.db, endpointsAndClusters, - packageIds + packageIds, ) } if ('removeKeys' in options.hash) { @@ -389,7 +389,7 @@ async function all_user_cluster_attribute_util( return templateUtil.collectBlocks( availableAttributes, options, - currentContext + currentContext, ) } @@ -416,7 +416,7 @@ function all_user_cluster_manufacturer_specific_commands(name, side, options) { function all_user_cluster_non_manufacturer_specific_commands( name, side, - options + options, ) { return all_user_cluster_command_util(name, side, options, this, false) } @@ -432,7 +432,7 @@ function all_user_cluster_non_manufacturer_specific_commands( function all_user_cluster_manufacturer_specific_attributes( name, side, - options + options, ) { return all_user_cluster_attribute_util(name, side, options, this, true) } @@ -448,7 +448,7 @@ function all_user_cluster_manufacturer_specific_attributes( function all_user_cluster_non_manufacturer_specific_attributes( name, side, - options + options, ) { return all_user_cluster_attribute_util(name, side, options, this, false) } @@ -466,13 +466,13 @@ async function all_commands_for_user_enabled_clusters(options) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointCommands = await queryCommand.selectAllCommandDetailsFromEnabledClusters( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) return templateUtil.collectBlocks(endpointCommands, options, this) } @@ -490,14 +490,14 @@ async function all_cli_commands_for_user_enabled_clusters(options) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointCommands = await queryCommand.selectAllCliCommandDetailsFromEnabledClusters( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) return templateUtil.collectBlocks(endpointCommands, options, this) } @@ -520,7 +520,7 @@ async function all_user_clusters(options) { await queryEndpointType.selectAllClustersDetailsFromEndpointTypes( this.global.db, endpointTypes, - side + side, ) return templateUtil.collectBlocks(clusters, options, this) @@ -538,7 +538,7 @@ async function all_user_clusters_irrespective_of_side(options) { let clusters = await queryEndpointType.selectAllClustersDetailsIrrespectiveOfSideFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) return templateUtil.collectBlocks(clusters, options, this) @@ -556,7 +556,7 @@ async function all_user_clusters_names(options) { let clusters = await queryEndpointType.selectAllClustersNamesFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) return templateUtil.collectBlocks(clusters, options, this) @@ -573,7 +573,7 @@ async function user_cluster_command_count_with_cli() { this.global.db, endpointTypes, this.endpointClusterId, - packageIds + packageIds, ) } @@ -595,7 +595,7 @@ async function user_cluster_commands_with_cli(options) { let cliCommands = await queryCommand.selectCliCommandsFromCluster( this.global.db, this.id, - packageIds + packageIds, ) return templateUtil.collectBlocks(cliCommands, options, this) } @@ -615,12 +615,12 @@ async function user_cluster_commands_all_endpoints(options) { this.global.db, endpointTypes, this.endpointClusterId, - packageIds + packageIds, ) return endpointsAndClusterstemplateUtil.collectBlocks( endpointCommands, options, - this + this, ) } @@ -638,7 +638,7 @@ async function user_cluster_has_enabled_command(name, side) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointCommands = @@ -646,7 +646,7 @@ async function user_cluster_has_enabled_command(name, side) { this.global.db, endpointsAndClusters, false, - packageIds + packageIds, ) let cmdCount = 0 endpointCommands.forEach((command) => { @@ -657,7 +657,7 @@ async function user_cluster_has_enabled_command(name, side) { command.incoming, command.outgoing, command.commandSource, - command.name + command.name, ) ) { cmdCount++ @@ -679,7 +679,7 @@ async function user_cluster_has_enabled_command(name, side) { function all_user_cluster_commands_irrespective_of_manufaturing_specification( name, side, - options + options, ) { return all_user_cluster_command_util(name, side, options, this, false, true) } @@ -716,7 +716,7 @@ async function user_session_key(options) { let value = await querySession.getSessionKeyValue( this.global.db, this.global.sessionId, - key + key, ) if (options.hash.toupper == 'true' && value != null) return value.toUpperCase() @@ -738,7 +738,7 @@ async function if_command_discovery_enabled(options) { let value = await querySession.getSessionKeyValue( this.global.db, this.global.sessionId, - key + key, ) if (value == 1) { return options.fn(this) @@ -751,7 +751,7 @@ async function user_manufacturer_code(options) { let value = await querySession.getSessionKeyValue( this.global.db, this.global.sessionId, - dbEnum.sessionOption.manufacturerCodes + dbEnum.sessionOption.manufacturerCodes, ) if (options.hash.toupper == 'true' && value != null) return value.toUpperCase() @@ -762,7 +762,7 @@ async function user_default_response_policy(options) { let value = await querySession.getSessionKeyValue( this.global.db, this.global.sessionId, - dbEnum.sessionOption.defaultResponsePolicy + dbEnum.sessionOption.defaultResponsePolicy, ) if (options.hash.toupper == 'true' && value != null) return value.toUpperCase() @@ -781,7 +781,7 @@ async function is_command_default_response_enabled(command, options) { let defaultRespPolicy = await querySession.getSessionKeyValue( this.global.db, this.global.sessionId, - dbEnum.sessionOption.defaultResponsePolicy + dbEnum.sessionOption.defaultResponsePolicy, ) if ( defaultRespPolicy.toUpperCase() == 'ALWAYS' || @@ -806,7 +806,7 @@ async function is_command_default_response_disabled(command, options) { let defaultRespPolicy = await querySession.getSessionKeyValue( this.global.db, this.global.sessionId, - dbEnum.sessionOption.defaultResponsePolicy + dbEnum.sessionOption.defaultResponsePolicy, ) if ( defaultRespPolicy.toUpperCase() == 'NEVER' || @@ -828,7 +828,7 @@ async function endpoint_type_identifier(endpointTypeId) { let endpoints = await queryImpexp.exportEndpoints( this.global.db, this.global.sessionId, - endpointTypes + endpointTypes, ) for (let i = 0; i < endpoints.length; i++) { if (endpointTypeId == endpoints[i].endpointTypeRef) { @@ -852,7 +852,7 @@ async function endpoint_type_index(endpointTypeId) { let endpoints = await queryImpexp.exportEndpoints( this.global.db, this.global.sessionId, - endpointTypes + endpointTypes, ) for (let i = 0; i < endpoints.length; i++) { if (endpointTypeId == endpoints[i].endpointTypeRef) { @@ -878,12 +878,12 @@ async function all_user_cluster_attributes_for_generated_defaults(options) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointAttributes = await queryAttribute.selectAttributeBoundDetails( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) return templateUtil.collectBlocks(endpointAttributes, options, this) } @@ -901,13 +901,13 @@ async function all_user_cluster_generated_attributes(options) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointAttributes = await queryAttribute.selectAttributeDetailsFromEnabledClusters( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) return templateUtil.collectBlocks(endpointAttributes, options, this) } @@ -925,13 +925,13 @@ async function all_user_reportable_attributes(options) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointAttributes = await queryAttribute.selectReportableAttributeDetailsFromEnabledClustersAndEndpoints( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) return templateUtil.collectBlocks(endpointAttributes, options, this) } @@ -944,14 +944,14 @@ async function all_user_reportable_attributes(options) { async function all_user_cluster_generated_commands(options) { let endpointTypes = await queryEndpointType.selectUsedEndpointTypeIds( this.global.db, - this.global.sessionId + this.global.sessionId, ) let packageIds = await templateUtil.ensureZclPackageIds(this) let endpointCommands = await queryCommand.selectAllAvailableClusterCommandDetailsFromEndpointTypes( this.global.db, endpointTypes, - packageIds + packageIds, ) return templateUtil.collectBlocks(endpointCommands, options, this) } @@ -967,12 +967,12 @@ async function all_user_cluster_generated_commands(options) { async function all_user_clusters_with_incoming_or_outgoing_commands( options, currentContext, - isIncoming + isIncoming, ) { let packageIds = await templateUtil.ensureZclPackageIds(currentContext) let endpointTypes = await queryEndpointType.selectUsedEndpointTypeIds( currentContext.global.db, - currentContext.global.sessionId + currentContext.global.sessionId, ) if (isIncoming) { if ( @@ -984,12 +984,12 @@ async function all_user_clusters_with_incoming_or_outgoing_commands( currentContext.global.db, endpointTypes, true, - packageIds + packageIds, ) return templateUtil.collectBlocks( clustersWithIncomingCommands, options, - currentContext + currentContext, ) } else { let clustersWithIncomingCommands = @@ -997,12 +997,12 @@ async function all_user_clusters_with_incoming_or_outgoing_commands( currentContext.global.db, endpointTypes, false, - packageIds + packageIds, ) return templateUtil.collectBlocks( clustersWithIncomingCommands, options, - currentContext + currentContext, ) } } else { @@ -1015,12 +1015,12 @@ async function all_user_clusters_with_incoming_or_outgoing_commands( currentContext.global.db, endpointTypes, true, - packageIds + packageIds, ) return templateUtil.collectBlocks( clustersWithOutgoingCommands, options, - currentContext + currentContext, ) } else { let clustersWithOutgoingCommands = @@ -1028,12 +1028,12 @@ async function all_user_clusters_with_incoming_or_outgoing_commands( currentContext.global.db, endpointTypes, false, - packageIds + packageIds, ) return templateUtil.collectBlocks( clustersWithOutgoingCommands, options, - currentContext + currentContext, ) } } @@ -1049,7 +1049,7 @@ function all_user_clusters_with_incoming_commands(options) { return all_user_clusters_with_incoming_or_outgoing_commands( options, this, - true + true, ) } @@ -1063,7 +1063,7 @@ async function all_user_clusters_with_outgoing_commands(options) { return all_user_clusters_with_incoming_or_outgoing_commands( options, this, - false + false, ) } @@ -1077,7 +1077,7 @@ async function all_user_clusters_with_outgoing_commands(options) { */ async function manufacturing_clusters_with_incoming_commands( clusterCode, - options + options, ) { let packageIds = await templateUtil.ensureZclPackageIds(this) return queryEndpointType @@ -1087,11 +1087,11 @@ async function manufacturing_clusters_with_incoming_commands( this.global.db, endpointTypes, clusterCode, - packageIds - ) + packageIds, + ), ) .then((clustersWithIncomingCommands) => - templateUtil.collectBlocks(clustersWithIncomingCommands, options, this) + templateUtil.collectBlocks(clustersWithIncomingCommands, options, this), ) } @@ -1111,11 +1111,11 @@ async function all_user_clusters_with_incoming_commands_combined(options) { queryCommand.selectAllClustersWithIncomingCommandsCombined( this.global.db, endpointTypes, - packageIds - ) + packageIds, + ), ) .then((clustersWithIncomingCommands) => - templateUtil.collectBlocks(clustersWithIncomingCommands, options, this) + templateUtil.collectBlocks(clustersWithIncomingCommands, options, this), ) } @@ -1132,7 +1132,7 @@ async function all_incoming_commands_for_cluster_combined( clusterName, clientSide, serverSide, - options + options, ) { let packageIds = await templateUtil.ensureZclPackageIds(this) let isMfgSpec = @@ -1141,7 +1141,7 @@ async function all_incoming_commands_for_cluster_combined( : undefined let endpointTypes = await queryEndpointType.selectUsedEndpointTypeIds( this.global.db, - this.global.sessionId + this.global.sessionId, ) let clustersWithIncomingCommands = @@ -1152,7 +1152,7 @@ async function all_incoming_commands_for_cluster_combined( clientSide, serverSide, isMfgSpec, - packageIds + packageIds, ) return templateUtil.collectBlocks(clustersWithIncomingCommands, options, this) @@ -1167,7 +1167,7 @@ async function all_user_incoming_commands_for_all_clusters(options) { let endpointTypes = await queryEndpointType.selectUsedEndpointTypeIds( this.global.db, - this.global.sessionId + this.global.sessionId, ) let clustersWithIncomingCommands = @@ -1175,7 +1175,7 @@ async function all_user_incoming_commands_for_all_clusters(options) { this.global.db, endpointTypes, isMfgSpec, - packageIds + packageIds, ) return templateUtil.collectBlocks(clustersWithIncomingCommands, options, this) @@ -1196,7 +1196,7 @@ async function all_incoming_or_outgoing_commands_for_cluster( clusterSide, isIncoming, options, - currentContext + currentContext, ) { let packageIds = await templateUtil.ensureZclPackageIds(currentContext) let isMfgSpec = @@ -1206,7 +1206,7 @@ async function all_incoming_or_outgoing_commands_for_cluster( let endpointTypes = await queryEndpointType.selectUsedEndpointTypeIds( currentContext.global.db, - currentContext.global.sessionId + currentContext.global.sessionId, ) let clustersWithIncomingOrOutgoingCommands = isIncoming @@ -1216,7 +1216,7 @@ async function all_incoming_or_outgoing_commands_for_cluster( clusterName, clusterSide, isMfgSpec, - packageIds + packageIds, ) : await queryCommand.selectAllOutgoingCommandsForCluster( currentContext.global.db, @@ -1224,13 +1224,13 @@ async function all_incoming_or_outgoing_commands_for_cluster( clusterName, clusterSide, isMfgSpec, - packageIds + packageIds, ) return templateUtil.collectBlocks( clustersWithIncomingOrOutgoingCommands, options, - currentContext + currentContext, ) } @@ -1243,14 +1243,14 @@ async function all_incoming_or_outgoing_commands_for_cluster( async function all_incoming_commands_for_cluster( clusterName, clusterSide, - options + options, ) { return all_incoming_or_outgoing_commands_for_cluster( clusterName, clusterSide, true, options, - this + this, ) } @@ -1263,14 +1263,14 @@ async function all_incoming_commands_for_cluster( async function all_outgoing_commands_for_cluster( clusterName, clusterSide, - options + options, ) { return all_incoming_or_outgoing_commands_for_cluster( clusterName, clusterSide, false, options, - this + this, ) } @@ -1285,13 +1285,13 @@ async function generated_clustes_details(options) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let clusterDetails = await queryCluster.selectClusterDetailsFromEnabledClusters( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) return templateUtil.collectBlocks(clusterDetails, options, this) } @@ -1306,12 +1306,12 @@ async function generated_endpoint_type_details(options) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointDetails = await queryEndpointType.selectEndpointDetailsFromAddedEndpoints( this.global.db, - endpointsAndClusters + endpointsAndClusters, ) return templateUtil.collectBlocks(endpointDetails, options, this) } @@ -1331,13 +1331,13 @@ async function all_user_cluster_attributes_min_max_defaults(options) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointAttributes = await queryAttribute.selectAttributeDetailsWithABoundFromEnabledClusters( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) return templateUtil.collectBlocks(endpointAttributes, options, this) } @@ -1358,7 +1358,7 @@ async function checkAttributeMatch( attributeSide, attributeValue, attributeValueType, - endpointAttributes + endpointAttributes, ) { let dataPtr for (const ea of endpointAttributes) { @@ -1392,7 +1392,7 @@ async function generated_defaults_index( attributeValueType, attributeValue, prefixReturn, - postFixReturn + postFixReturn, ) { let packageIds = await templateUtil.ensureZclPackageIds(this) let endpointTypes = await templateUtil.ensureEndpointTypeIds(this) @@ -1400,13 +1400,13 @@ async function generated_defaults_index( let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointAttributes = await queryAttribute.selectAttributeBoundDetails( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) let dataPtr = attributeValue @@ -1446,7 +1446,7 @@ async function generated_default_index( attributeValueType, attributeValue, prefixReturn, - postFixReturn + postFixReturn, ) { let packageIds = await templateUtil.ensureZclPackageIds(this) let endpointTypes = await templateUtil.ensureEndpointTypeIds(this) @@ -1454,13 +1454,13 @@ async function generated_default_index( let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointAttributes = await queryAttribute.selectAttributeBoundDetails( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) let dataPtr = await checkAttributeMatch( @@ -1469,7 +1469,7 @@ async function generated_default_index( attributeSide, attributeValue, attributeValueType, - endpointAttributes + endpointAttributes, ) if (dataPtr === attributeValue) { dataPtr = dataPtr ? '(uint8_t*)' + dataPtr : 'NULL' @@ -1494,14 +1494,14 @@ async function generated_attributes_min_max_index(clusterName, attributeName) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointAttributes = await queryAttribute.selectAttributeDetailsWithABoundFromEnabledClusters( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) let dataPtr = 0 for (let i = 0; i < endpointAttributes.length; i++) { @@ -1528,21 +1528,21 @@ async function generated_attributes_min_max_index(clusterName, attributeName) { async function generated_attribute_min_max_index( clusterName, attributeName, - attributeSide + attributeSide, ) { let packageIds = await templateUtil.ensureZclPackageIds(this) let endpointTypes = await templateUtil.ensureEndpointTypeIds(this) let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) let endpointAttributes = await queryAttribute.selectAttributeDetailsWithABoundFromEnabledClusters( this.global.db, endpointsAndClusters, - packageIds + packageIds, ) let dataPtr = 0 for (let i = 0; i < endpointAttributes.length; i++) { @@ -1576,7 +1576,7 @@ async function if_enabled_clusters(options) { await queryEndpointType.selectAllClustersDetailsFromEndpointTypes( this.global.db, endpointTypes, - side + side, ) if (clusters.length > 0) { return options.fn(this) @@ -1593,13 +1593,13 @@ async function if_enabled_clusters(options) { async function if_multi_protocol_attributes_enabled(options) { let sessionPackageIds = await queryPackage.getSessionZclPackageIds( this.global.db, - this.global.sessionId + this.global.sessionId, ) // Get all attribute mappings which have both attributes belonging to one of the sessionPackages let attributeMappings = await queryAttribute.selectAttributeMappingsByPackageIds( this.global.db, - sessionPackageIds + sessionPackageIds, ) if (attributeMappings.length > 0) { return options.fn(this) @@ -1616,13 +1616,13 @@ async function if_multi_protocol_attributes_enabled(options) { async function all_multi_protocol_attributes(options) { let sessionPackageIds = await queryPackage.getSessionZclPackageIds( this.global.db, - this.global.sessionId + this.global.sessionId, ) // Get all attribute mappings which have both attributes belonging to one of the sessionPackages let attributeMappings = await queryAttribute.selectAttributeMappingsByPackageIds( this.global.db, - sessionPackageIds + sessionPackageIds, ) return templateUtil.collectBlocks(attributeMappings, options, this) } @@ -1700,7 +1700,7 @@ exports.generated_defaults_index = dep(generated_defaults_index, { exports.generated_default_index = generated_default_index exports.generated_attributes_min_max_index = dep( generated_attributes_min_max_index, - { to: 'generated_attribute_min_max_index' } + { to: 'generated_attribute_min_max_index' }, ) exports.generated_attribute_min_max_index = generated_attribute_min_max_index exports.all_user_clusters_with_incoming_commands = @@ -1711,14 +1711,14 @@ exports.all_user_clusters_with_incoming_commands_combined = all_user_clusters_with_incoming_commands_combined exports.all_user_clusters_with_incoming_commands_combined = dep( all_user_clusters_with_incoming_commands_combined, - { to: 'all_user_incoming_commands_for_all_clusters' } + { to: 'all_user_incoming_commands_for_all_clusters' }, ) exports.all_incoming_commands_for_cluster = all_incoming_commands_for_cluster exports.all_incoming_commands_for_cluster_combined = all_incoming_commands_for_cluster_combined exports.all_incoming_commands_for_cluster_combined = dep( all_incoming_commands_for_cluster_combined, - { to: 'all_user_incoming_commands_for_all_clusters' } + { to: 'all_user_incoming_commands_for_all_clusters' }, ) exports.if_command_discovery_enabled = if_command_discovery_enabled exports.manufacturing_clusters_with_incoming_commands = diff --git a/src-electron/generator/helper-tokens.js b/src-electron/generator/helper-tokens.js index 80f6fa5e07..fbbdcb744b 100644 --- a/src-electron/generator/helper-tokens.js +++ b/src-electron/generator/helper-tokens.js @@ -159,7 +159,7 @@ async function tokens_context(options) { this.global.db, packageIds, attribute, - `ERROR: ${attribute.name}, invalid size, ${attribute.type}` + `ERROR: ${attribute.name}, invalid size, ${attribute.type}`, ) .then((size) => { attr.typeSize = size @@ -167,13 +167,13 @@ async function tokens_context(options) { attr.longDefault = types.longTypeDefaultValue( attr.typeSize, attr.type, - attr.defaultValue + attr.defaultValue, ) } if (size > context.maxSize) { context.maxSize = size } - }) // then size + }), // then size ) // push(promise(type)) } // new attribute } // NVM @@ -212,7 +212,7 @@ async function tokens_context(options) { return templateUtil.templatePromise( this.global, - Promise.all(promises).then(() => options.fn(context)) + Promise.all(promises).then(() => options.fn(context)), ) } @@ -241,7 +241,7 @@ async function token_attribute_util(context, options) { context.global.db, context.global.sessionId, packageIds, - options + options, ) return res } @@ -269,7 +269,7 @@ async function token_attributes(endpointTypeRef, options) { this.global.db, packageIds, endpointTypeRef, - options + options, ) return templateUtil.collectBlocks(endpointTokenAttributes, options, this) } else { @@ -302,12 +302,12 @@ async function token_attribute_clusters(endpointTypeRef, options) { this.global.db, packageIds, endpointTypeRef, - options + options, ) return templateUtil.collectBlocks( endpointTokenAttributeClusters, options, - this + this, ) } else { // All token attribute clusters available in the configuration @@ -319,7 +319,7 @@ async function token_attribute_clusters(endpointTypeRef, options) { this.global.db, this.global.sessionId, packageIds, - options + options, ) return templateUtil.collectBlocks(allTokenAttributeClusters, options, this) } @@ -338,7 +338,7 @@ async function token_attribute_endpoints(options) { let allTokenAttributes = await token_attribute_util(this, options) if (isSingletonSpecific) { allTokenAttributes = allTokenAttributes.filter( - (item) => item.isSingleton == options.hash.isSingleton + (item) => item.isSingleton == options.hash.isSingleton, ) } let uniqueEndpoints = [ @@ -346,7 +346,7 @@ async function token_attribute_endpoints(options) { allTokenAttributes.map((item) => [ item['endpointId'], { endpointId: item.endpointId, endpointTypeRef: item.endpointTypeRef }, - ]) + ]), ).values(), ] uniqueEndpoints.sort((a, b) => (a.endpointId > b.endpointId ? 1 : -1)) @@ -363,11 +363,11 @@ const dep = templateUtil.deprecatedHelper exports.tokens_context = dep( tokens_context, - 'tokens_context has been deprecated. Use token_attributes, token_attribute_clusters and token_attribute_endpoints instead.' + 'tokens_context has been deprecated. Use token_attributes, token_attribute_clusters and token_attribute_endpoints instead.', ) exports.token_next = dep( token_next, - 'token_next has been deprecated. Use token_attributes, token_attribute_clusters and token_attribute_endpoints instead.' + 'token_next has been deprecated. Use token_attributes, token_attribute_clusters and token_attribute_endpoints instead.', ) exports.debug_object = debug_object exports.token_attributes = token_attributes diff --git a/src-electron/generator/helper-zap.js b/src-electron/generator/helper-zap.js index 47c286944d..699b527acd 100644 --- a/src-electron/generator/helper-zap.js +++ b/src-electron/generator/helper-zap.js @@ -71,8 +71,8 @@ async function template_options(options) { queryPackage.selectAllOptionsValues( this.global.db, packageId, - options.hash.category - ) + options.hash.category, + ), ) .then((ens) => templateUtil.collectBlocks(ens, options, this)) } @@ -169,8 +169,8 @@ async function template_option_with_code(options, key) { this.global.db, packageId, options, - key - ) + key, + ), ) } @@ -307,7 +307,7 @@ function waitForSynchronousPromise(pollInterval, promise, resolve, reject) { } else { setTimeout( () => waitForSynchronousPromise(pollInterval, promise, resolve, reject), - pollInterval + pollInterval, ) } } @@ -319,7 +319,7 @@ async function promiseToResolveAllPreviousPromises(globalPromises) { promises.push( new Promise((resolve, reject) => { waitForSynchronousPromise(100, promise, resolve, reject) - }) + }), ) }) await Promise.all(promises) diff --git a/src-electron/generator/helper-zcl.js b/src-electron/generator/helper-zcl.js index 597efef517..c9460f1f63 100644 --- a/src-electron/generator/helper-zcl.js +++ b/src-electron/generator/helper-zcl.js @@ -51,14 +51,14 @@ async function zcl_bitmaps(options) { if (this.id != null) { ens = await Promise.all( packageIds.map((packageId) => - queryZcl.selectClusterBitmaps(this.global.db, packageId, this.id) - ) + queryZcl.selectClusterBitmaps(this.global.db, packageId, this.id), + ), ).then((x) => x.flat()) } else { ens = await Promise.all( packageIds.map((packageId) => - queryZcl.selectAllBitmaps(this.global.db, packageId) - ) + queryZcl.selectAllBitmaps(this.global.db, packageId), + ), ).then((x) => x.flat()) } ens.forEach((en) => { @@ -103,9 +103,9 @@ async function zcl_enums(options) { .selectAllEnums(this.global.db, packageId) //Filtering out all atomic enums .then((es) => - es.filter((e) => !e.name.toLowerCase().match(/^enum\d+$/g)) - ) - ) + es.filter((e) => !e.name.toLowerCase().match(/^enum\d+$/g)), + ), + ), ).then((x) => x.flat()) } ens.forEach((en) => { @@ -135,12 +135,12 @@ async function zcl_structs(options) { structs = await queryZcl.selectClusterStructsWithItems( this.global.db, packageIds, - this.id + this.id, ) } else { structs = await queryZcl.selectAllStructsWithItems( this.global.db, - packageIds + packageIds, ) } structs = await zclUtil.sortStructsByDependency(structs) @@ -172,7 +172,7 @@ async function zcl_structs(options) { let sis = await queryZcl.selectAllStructItemsByStructName( this.global.db, i.type, - packageIds + packageIds, ) if (sis.length > 0) { for (const ss of sis) { @@ -203,7 +203,7 @@ async function zcl_enum_items(options) { } return templateUtil.templatePromise( this.global, - templateUtil.collectBlocks(items, options, this) + templateUtil.collectBlocks(items, options, this), ) } @@ -280,7 +280,7 @@ async function zcl_struct_items(options) { let structItems = await queryZcl.selectAllStructItemsByStructName( this.global.db, si.type, - packageIds + packageIds, ) if (structItems.length > 0) { for (const s of structItems) { @@ -323,14 +323,14 @@ async function zcl_struct_items_by_struct_name(name, options) { async function zcl_struct_items_by_struct_and_cluster_name( name, clusterName, - options + options, ) { let packageIds = await templateUtil.ensureZclPackageIds(this) // Check for a global struct first. const structObj = await queryZcl.selectStructByName( this.global.db, name, - packageIds + packageIds, ) if (structObj.structClusterCount == 0) { // Just ignore the cluster name. @@ -342,7 +342,7 @@ async function zcl_struct_items_by_struct_and_cluster_name( this.global.db, name, packageIds, - clusterName + clusterName, ) .then((st) => templateUtil.collectBlocks(st, options, this)) return templateUtil.templatePromise(this.global, promise) @@ -358,8 +358,8 @@ async function zcl_device_types(options) { let packageIds = await templateUtil.ensureZclPackageIds(this) let deviceTypes = await Promise.all( packageIds.map((packageId) => - queryDeviceType.selectAllDeviceTypes(this.global.db, packageId) - ) + queryDeviceType.selectAllDeviceTypes(this.global.db, packageId), + ), ) let promise = templateUtil.collectBlocks(deviceTypes.flat(), options, this) return templateUtil.templatePromise(this.global, promise) @@ -374,7 +374,7 @@ async function zcl_device_types(options) { async function zcl_device_type_clusters(options) { let clusters = await queryDeviceType.selectDeviceTypeClustersByDeviceTypeRef( this.global.db, - this.id + this.id, ) let promise = templateUtil.collectBlocks(clusters, options, this) @@ -390,7 +390,7 @@ async function zcl_device_type_clusters(options) { async function zcl_device_type_cluster_commands(options) { let commands = await queryDeviceType.selectDeviceTypeCommandsByDeviceTypeRef( this.global.db, - this.deviceTypeRef + this.deviceTypeRef, ) commands = commands.filter((x) => x.deviceTypeClusterRef == this.id) let promise = templateUtil.collectBlocks(commands, options, this) @@ -407,7 +407,7 @@ async function zcl_device_type_cluster_attributes(options) { let attributes = await queryDeviceType.selectDeviceTypeAttributesByDeviceTypeRef( this.global.db, - this.deviceTypeRef + this.deviceTypeRef, ) attributes = attributes.filter((x) => x.deviceTypeClusterRef == this.id) let promise = templateUtil.collectBlocks(attributes, options, this) @@ -423,7 +423,7 @@ async function zcl_device_type_cluster_attributes(options) { async function zcl_clusters(options) { let packageIds = await templateUtil.ensureZclPackageIds(this) let cl = await Promise.all( - packageIds.map((id) => queryZcl.selectAllClusters(this.global.db, id)) + packageIds.map((id) => queryZcl.selectAllClusters(this.global.db, id)), ) let promise = templateUtil.collectBlocks(cl.flat(), options, this) return templateUtil.templatePromise(this.global, promise) @@ -447,7 +447,7 @@ function zcl_commands(options) { return queryCommand.selectCommandsByClusterId( this.global.db, this.id, - packageIds + packageIds, ) } else { return queryCommand.selectAllCommands(this.global.db, packageIds) @@ -478,7 +478,7 @@ async function zcl_command_responses(options) { cmds = await queryCommand.selectCommandsByClusterId( this.global.db, this.id, - packageIds + packageIds, ) } else { cmds = await queryCommand.selectAllCommands(this.global.db, packageIds) @@ -499,7 +499,7 @@ async function zcl_commands_with_cluster_info(options) { let packageIds = await templateUtil.ensureZclPackageIds(this) let cmds = await queryCommand.selectAllCommandsWithClusterInfo( this.global.db, - packageIds + packageIds, ) let promise = templateUtil.collectBlocks(cmds, options, this) return templateUtil.templatePromise(this.global, promise) @@ -518,14 +518,14 @@ async function zcl_commands_with_arguments(options) { packageIds.map(async (packageId) => { let cmdsPerPackageId = await queryCommand.selectAllCommandsWithArguments( this.global.db, - packageId + packageId, ) if ('signature' == sortBy) { for (const cmd of cmdsPerPackageId) { let sig = await zclUtil.createCommandSignature( this.global.db, packageId, - cmd + cmd, ) cmd.signature = sig.signature cmd.isSignatureSimple = sig.isSimple @@ -538,7 +538,7 @@ async function zcl_commands_with_arguments(options) { } return cmdsPerPackageId - }) + }), ).then((x) => x.flat()) let promise = templateUtil.collectBlocks(cmds, options, this) @@ -566,13 +566,13 @@ function zcl_commands_by_source(options, source) { this.global.db, this.id, source, - packageIds + packageIds, ) } else { return queryCommand.selectAllCommandsBySource( this.global.db, source, - packageIds + packageIds, ) } }) @@ -623,7 +623,7 @@ async function zcl_events(options) { events = await queryEvent.selectEventsByClusterId( this.global.db, this.id, - packageIds + packageIds, ) } else { events = await queryEvent.selectAllEvents(this.global.db, packageIds) @@ -632,7 +632,7 @@ async function zcl_events(options) { let ps = events.map(async (ev) => { ev.items = await queryEvent.selectEventFieldsByEventId( this.global.db, - ev.id + ev.id, ) }) await Promise.all(ps) @@ -651,7 +651,7 @@ function zcl_command_tree(options) { let promise = templateUtil .ensureZclPackageIds(this) .then((packageIds) => - queryCommand.selectCommandTree(this.global.db, packageIds) + queryCommand.selectCommandTree(this.global.db, packageIds), ) .then((cmds) => { // Now reduce the array by collecting together arguments. @@ -721,7 +721,7 @@ function zcl_command_tree(options) { if (arg != null) { lastCommand.commandArgs.push(arg) lastCommand.argsstring = lastCommand.argsstring.concat( - arg.formatChar + arg.formatChar, ) } } @@ -742,7 +742,7 @@ function zcl_global_commands(options) { let promise = templateUtil .ensureZclPackageIds(this) .then((packageIds) => - queryCommand.selectAllGlobalCommands(this.global.db, packageIds) + queryCommand.selectAllGlobalCommands(this.global.db, packageIds), ) .then((cmds) => templateUtil.collectBlocks(cmds, options, this)) return templateUtil.templatePromise(this.global, promise) @@ -766,13 +766,13 @@ async function zcl_attributes(options) { attributes = await queryZcl.selectAttributesByClusterIdIncludingGlobal( this.global.db, this.id, - packageIds + packageIds, ) attributes = await upgrade.computeStoragePolicyForGlobalAttributes( this.global.db, this.id, attributes, - packageIds + packageIds, ) } else { attributes = await queryZcl.selectAllAttributes(this.global.db, packageIds) @@ -801,19 +801,19 @@ async function zcl_attributes_client(options) { this.global.db, this.id, packageIds, - dbEnum.side.client + dbEnum.side.client, ) clientAttributes = await upgrade.computeStoragePolicyForGlobalAttributes( this.global.db, this.id, clientAttributes, - packageIds + packageIds, ) } else { clientAttributes = await queryZcl.selectAllAttributesBySide( this.global.db, dbEnum.side.client, - packageIds + packageIds, ) } let promise = templateUtil.collectBlocks(clientAttributes, options, this) @@ -843,19 +843,19 @@ async function zcl_attributes_server(options) { this.global.db, this.id, packageIds, - dbEnum.side.server + dbEnum.side.server, ) serverAttributes = await upgrade.computeStoragePolicyForGlobalAttributes( this.global.db, this.id, serverAttributes, - packageIds + packageIds, ) } else { serverAttributes = await queryZcl.selectAllAttributesBySide( this.global.db, dbEnum.side.server, - packageIds + packageIds, ) } if ('removeKeys' in options.hash) { @@ -878,9 +878,9 @@ async function zcl_atomics(options) { .then((packageIds) => Promise.all( packageIds.map((packageId) => - queryZcl.selectAllAtomics(this.global.db, packageId) - ) - ) + queryZcl.selectAllAtomics(this.global.db, packageId), + ), + ), ) .then((x) => x.flat()) .then((ats) => templateUtil.collectBlocks(ats, options, this)) @@ -899,9 +899,9 @@ async function zcl_cluster_largest_label_length() { .then((packageIds) => Promise.all( packageIds.map((packageId) => - queryZcl.selectAllClusters(this.global.db, packageId) - ) - ) + queryZcl.selectAllClusters(this.global.db, packageId), + ), + ), ) .then((cls) => cls.flat()) .then((cl) => largestLabelLength(cl)) @@ -928,7 +928,7 @@ function largestLabelLength(arrayOfClusters) { function zcl_command_arguments_count(commandId) { let promise = queryCommand.selectCommandArgumentsCountByCommandId( this.global.db, - commandId + commandId, ) return templateUtil.templatePromise(this.global, promise) } @@ -946,11 +946,11 @@ async function ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, fixedLengthReturn, notFixedLengthReturn, - currentContext + currentContext, ) { let commandArgs = await queryCommand.selectCommandArgumentsByCommandId( currentContext.global.db, - commandId + commandId, ) let isFixedLength = true @@ -983,13 +983,13 @@ async function ifCommandArgumentsHaveFixedLengthWithCurrentContext( function if_command_arguments_have_fixed_length( commandId, fixedLengthReturn, - notFixedLengthReturn + notFixedLengthReturn, ) { return ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, fixedLengthReturn, notFixedLengthReturn, - this + this, ) } @@ -1009,7 +1009,7 @@ function as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument command, commandArg, appendString, - options + options, ) { return queryCommand .selectCommandArgumentsByCommandId(this.global.db, command) @@ -1028,7 +1028,7 @@ function as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument } } resolve(true) - }) + }), ) .then((isFixedLengthCommand) => { if (isFixedLengthCommand) { @@ -1048,8 +1048,8 @@ function as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument type, options, packageIds, - this - ) + this, + ), ) } return '' @@ -1058,7 +1058,7 @@ function as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument .catch((err) => { env.logError( 'Failure in as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present: ' + - err + err, ) }) } @@ -1077,13 +1077,13 @@ function as_underlying_zcl_type_if_command_is_not_fixed_length( type, commandId, appendString, - options + options, ) { let promise = ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, true, false, - this + this, ) .then((res) => { if (res) { @@ -1096,8 +1096,8 @@ function as_underlying_zcl_type_if_command_is_not_fixed_length( type, options, packageIds, - this - ) + this, + ), ) } }) @@ -1134,20 +1134,20 @@ function command_arguments_total_length(commandId) { argType, argOptions, packageIds, - this - ) + this, + ), ) argsLength.push(argLength) } resolve(argsLength) }).then((argsLength) => { return Promise.all(argsLength).then((lengths) => - lengths.reduce((a, b) => a + b, 0) + lengths.reduce((a, b) => a + b, 0), ) - }) + }), ) .catch((err) => - env.logError('Unable to get the length of the command arguments: ' + err) + env.logError('Unable to get the length of the command arguments: ' + err), ) } @@ -1170,12 +1170,12 @@ async function zcl_command_arguments(options) { // We're functioning inside a nested context with an id, so we will only query for this cluster. commandArgs = await queryCommand.selectCommandArgumentsByCommandId( this.global.db, - this.id + this.id, ) } else { commandArgs = await queryCommand.selectAllCommandArguments( this.global.db, - packageIds + packageIds, ) } } @@ -1185,7 +1185,7 @@ async function zcl_command_arguments(options) { this.global.db, commandArgs[i].type, packageIds, - options + options, ) commandArgs[i].typeSize = sizeAndSign.dataTypesize commandArgs[i].typeIsSigned = sizeAndSign.isTypeSigned @@ -1216,7 +1216,7 @@ function zcl_event_fields(options) { } let promise = p.then((fields) => - templateUtil.collectBlocks(fields, options, this) + templateUtil.collectBlocks(fields, options, this), ) return templateUtil.templatePromise(this.global, promise) } @@ -1246,7 +1246,7 @@ function zcl_command_argument_data_type(type, options) { } } resolve(dbEnum.zclType.unknown) - }) + }), ) .then((resType) => { switch (resType) { @@ -1254,13 +1254,13 @@ function zcl_command_argument_data_type(type, options) { return helperC.data_type_for_bitmap( this.global.db, type, - packageIds + packageIds, ) case dbEnum.zclType.enum: return helperC.data_type_for_enum( this.global.db, type, - packageIds + packageIds, ) case dbEnum.zclType.struct: return options.hash.struct @@ -1273,7 +1273,7 @@ function zcl_command_argument_data_type(type, options) { .catch((err) => { env.logError(err) throw err - }) + }), ) .catch((err) => { env.logError(err) @@ -1371,12 +1371,12 @@ async function if_is_number(type, options) { ? queryZcl.selectNumberByName( this.global.db, packageIds, - type.toLowerCase() + type.toLowerCase(), ) - : null + : null, ) .then((res) => - res ? res : queryZcl.selectNumberById(this.global.db, type) + res ? res : queryZcl.selectNumberById(this.global.db, type), ) .then((res) => (res ? options.fn(this) : options.inverse(this))) return templateUtil.templatePromise(this.global, promise) @@ -1403,12 +1403,12 @@ function if_is_string(type, options) { ? queryZcl.selectStringByName( this.global.db, type.toLowerCase(), - packageIds + packageIds, ) - : null + : null, ) .then((res) => - res ? res : queryZcl.selectStringById(this.global.db, type) + res ? res : queryZcl.selectStringById(this.global.db, type), ) .then((res) => (res ? options.fn(this) : options.inverse(this))) return templateUtil.templatePromise(this.global, promise) @@ -1436,17 +1436,17 @@ function if_is_char_string(type, options) { ? queryZcl.selectStringByName( this.global.db, type.toLowerCase(), - packageIds + packageIds, ) - : null + : null, ) .then((res) => - res ? res : queryZcl.selectStringById(this.global.db, type) + res ? res : queryZcl.selectStringById(this.global.db, type), ) .then((res) => res && res.name && characterStringTypes.includes(res.name.toUpperCase()) ? options.fn(this) - : options.inverse(this) + : options.inverse(this), ) return templateUtil.templatePromise(this.global, promise) } @@ -1473,17 +1473,17 @@ function if_is_octet_string(type, options) { ? queryZcl.selectStringByName( this.global.db, type.toLowerCase(), - packageIds + packageIds, ) - : null + : null, ) .then((res) => - res ? res : queryZcl.selectStringById(this.global.db, type) + res ? res : queryZcl.selectStringById(this.global.db, type), ) .then((res) => res && res.name && octetStringTypes.includes(res.name.toUpperCase()) ? options.fn(this) - : options.inverse(this) + : options.inverse(this), ) return templateUtil.templatePromise(this.global, promise) } @@ -1510,17 +1510,17 @@ function if_is_short_string(type, options) { ? queryZcl.selectStringByName( this.global.db, type.toLowerCase(), - packageIds + packageIds, ) - : null + : null, ) .then((res) => - res ? res : queryZcl.selectStringById(this.global.db, type) + res ? res : queryZcl.selectStringById(this.global.db, type), ) .then((res) => res && res.name && stringShortTypes.includes(res.name.toUpperCase()) ? options.fn(this) - : options.inverse(this) + : options.inverse(this), ) return templateUtil.templatePromise(this.global, promise) } @@ -1547,17 +1547,17 @@ function if_is_long_string(type, options) { ? queryZcl.selectStringByName( this.global.db, type.toLowerCase(), - packageIds + packageIds, ) - : null + : null, ) .then((res) => - res ? res : queryZcl.selectStringById(this.global.db, type) + res ? res : queryZcl.selectStringById(this.global.db, type), ) .then((res) => res && res.name && stringLongTypes.includes(res.name.toUpperCase()) ? options.fn(this) - : options.inverse(this) + : options.inverse(this), ) return templateUtil.templatePromise(this.global, promise) } @@ -1581,11 +1581,11 @@ async function if_is_atomic(type, options) { result = await templateUtil .ensureZclPackageIds(this) .then((packageIds) => - queryZcl.selectAtomicType(this.global.db, packageIds, type) + queryZcl.selectAtomicType(this.global.db, packageIds, type), ) } else { env.logWarning( - 'Passing a type which is invlaid for if_is_atomic helper: ' + type + 'Passing a type which is invlaid for if_is_atomic helper: ' + type, ) } if (result) { @@ -1614,15 +1614,15 @@ async function if_is_bitmap(type, options) { .then((packageIds) => type && typeof type === 'string' ? queryZcl.selectBitmapByName(this.global.db, packageIds, type) - : null + : null, ) .then((res) => - res ? res : queryZcl.selectBitmapById(this.global.db, type) + res ? res : queryZcl.selectBitmapById(this.global.db, type), ) .then((res) => res || (typeof type === 'string' && type.startsWith('map')) ? options.fn(this) - : options.inverse(this) + : options.inverse(this), ) return templateUtil.templatePromise(this.global, promise) } @@ -1646,7 +1646,7 @@ async function if_is_enum(type, options) { .then((packageIds) => type && typeof type === 'string' ? queryZcl.selectEnumByName(this.global.db, type, packageIds) - : null + : null, ) .then((res) => (res ? res : queryZcl.selectEnumById(this.global.db, type))) .then((res) => (res ? options.fn(this) : options.inverse(this))) @@ -1672,10 +1672,10 @@ async function if_is_struct(type, options) { .then((packageIds) => type && typeof type === 'string' ? queryZcl.selectStructByName(this.global.db, type, packageIds) - : null + : null, ) .then((res) => - res ? res : queryZcl.selectStructById(this.global.db, type) + res ? res : queryZcl.selectStructById(this.global.db, type), ) .then((res) => (res ? options.fn(this) : options.inverse(this))) return templateUtil.templatePromise(this.global, promise) @@ -1752,13 +1752,13 @@ function as_underlying_zcl_type_command_argument_always_present( introducedInRef, removedInRef, presentIf, - options + options, ) { let promise = ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, true, false, - this + this, ) .then((res) => { if (res) { @@ -1777,8 +1777,8 @@ function as_underlying_zcl_type_command_argument_always_present( type, options, packageIds, - this - ) + this, + ), ) } } @@ -1811,13 +1811,13 @@ function if_command_argument_always_present( removedInRef, presentIf, argumentPresentReturn, - argumentNotPresentReturn + argumentNotPresentReturn, ) { return ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, true, false, - this + this, ).then((res) => { if (res) { return '' // Return nothing since command is a fixed length command @@ -1856,13 +1856,13 @@ function as_underlying_zcl_type_command_argument_not_always_present_no_presentif introducedInRef, removedInRef, presentIf, - options + options, ) { let promise = ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, true, false, - this + this, ) .then((res) => { if (res) { @@ -1877,8 +1877,8 @@ function as_underlying_zcl_type_command_argument_not_always_present_no_presentif type, options, packageIds, - this - ) + this, + ), ) } else { return '' @@ -1906,7 +1906,7 @@ function as_underlying_zcl_type_command_argument_not_always_present_no_presentif function as_underlying_zcl_type_ca_not_always_present_no_presentif( commandArg, appendString, - options + options, ) { // Return the underlying zcl type since command argument is not always // present and there is no present if conditionality @@ -1921,14 +1921,14 @@ function as_underlying_zcl_type_ca_not_always_present_no_presentif( commandArg.type, options, packageIds, - this - ) + this, + ), ) // Adding the appendString for the underlying zcl type .then((res) => (res ? res + appendString : res)) .catch((err) => { env.logError( 'Error in as_underlying_zcl_type_ca_not_always_present_no_presentif ' + - err + err, ) throw err }) @@ -1957,13 +1957,13 @@ function if_command_argument_not_always_present_no_presentif( removedInRef, presentIf, argumentNotInAllVersionsReturn, - argumentInAllVersionsReturn + argumentInAllVersionsReturn, ) { return ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, true, false, - this + this, ).then((res) => { if (res) { return '' // Return nothing since it is a fixed length command @@ -2001,13 +2001,13 @@ function as_underlying_zcl_type_command_argument_not_always_present_with_present introducedInRef, removedInRef, presentIf, - options + options, ) { let promise = ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, true, false, - this + this, ) .then((res) => { if (res) { @@ -2022,8 +2022,8 @@ function as_underlying_zcl_type_command_argument_not_always_present_with_present type, options, packageIds, - this - ) + this, + ), ) } else { return '' @@ -2051,7 +2051,7 @@ function as_underlying_zcl_type_command_argument_not_always_present_with_present function as_underlying_zcl_type_ca_not_always_present_with_presentif( commandArg, appendString, - options + options, ) { // Return the underlying zcl type since command argument is not always // present and there is a present if conditionality @@ -2066,14 +2066,14 @@ function as_underlying_zcl_type_ca_not_always_present_with_presentif( commandArg.type, options, packageIds, - this - ) + this, + ), ) // Adding the appendString for the underlying zcl type .then((res) => (res ? res + appendString : res)) .catch((err) => { env.logError( 'Error in as_underlying_zcl_type_ca_not_always_present_with_presentif ' + - err + err, ) throw err }) @@ -2102,13 +2102,13 @@ function if_command_argument_not_always_present_with_presentif( removedInRef, presentIf, argumentNotInAllVersionsPresentIfReturn, - argumentInAllVersionsReturn + argumentInAllVersionsReturn, ) { return ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, true, false, - this + this, ).then((res) => { if (res) { return '' // Return nothing since it is a fixed length command @@ -2146,13 +2146,13 @@ function as_underlying_zcl_type_command_argument_always_present_with_presentif( introducedInRef, removedInRef, presentIf, - options + options, ) { let promise = ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, true, false, - this + this, ) .then((res) => { if (res) { @@ -2167,8 +2167,8 @@ function as_underlying_zcl_type_command_argument_always_present_with_presentif( type, options, packageIds, - this - ) + this, + ), ) } else { return '' @@ -2196,7 +2196,7 @@ function as_underlying_zcl_type_command_argument_always_present_with_presentif( function as_underlying_zcl_type_ca_always_present_with_presentif( commandArg, appendString, - options + options, ) { // Return the underlying zcl type since command argument is always // present and there is a present if conditionality @@ -2211,14 +2211,14 @@ function as_underlying_zcl_type_ca_always_present_with_presentif( commandArg.type, options, packageIds, - this - ) + this, + ), ) // Adding the appendString for the underlying zcl type .then((res) => (res ? res + appendString : res)) .catch((err) => { env.logError( 'Error in as_underlying_zcl_type_ca_always_present_with_presentif ' + - err + err, ) throw err }) @@ -2246,13 +2246,13 @@ async function if_command_argument_always_present_with_presentif( removedInRef, presentIf, argumentInAllVersionsPresentIfReturn, - argumentNotAlwaysThereReturn + argumentNotAlwaysThereReturn, ) { let res = await ifCommandArgumentsHaveFixedLengthWithCurrentContext( commandId, true, false, - this + this, ) if (res) { return '' // Return nothing since it is a fixed length command @@ -2277,7 +2277,7 @@ async function if_command_argument_always_present_with_presentif( function if_manufacturing_specific_cluster( clusterId, manufacturer_specific_return, - null_manufacturer_specific_return + null_manufacturer_specific_return, ) { let promise = templateUtil .ensureZclPackageIds(this) @@ -2339,7 +2339,7 @@ async function as_generated_default_macro(value, attributeSize, options) { return format_zcl_string_as_characters_for_generated_defaults( value, attributeSize, - options + options, ) } // Float value @@ -2405,7 +2405,7 @@ async function attribute_mask( isSingleton, prefixString, postfixString, - options + options, ) { let isClusterCodeMfgSpecific = options && 'isClusterCodeMfgSpecific' in options.hash @@ -2480,7 +2480,7 @@ async function command_mask( isIncomingEnabled, isOutgoingEnabled, manufacturingCode, - prefixForMask + prefixForMask, ) { let commandMask = '' if (isClient(commmandSource)) { @@ -2490,7 +2490,7 @@ async function command_mask( ) { commandMask += command_mask_sub_helper( commandMask, - prefixForMask + 'INCOMING_SERVER' + prefixForMask + 'INCOMING_SERVER', ) } if ( @@ -2499,7 +2499,7 @@ async function command_mask( ) { commandMask += command_mask_sub_helper( commandMask, - prefixForMask + 'OUTGOING_CLIENT' + prefixForMask + 'OUTGOING_CLIENT', ) } } else { @@ -2509,7 +2509,7 @@ async function command_mask( ) { commandMask += command_mask_sub_helper( commandMask, - prefixForMask + 'INCOMING_CLIENT' + prefixForMask + 'INCOMING_CLIENT', ) } if ( @@ -2518,14 +2518,14 @@ async function command_mask( ) { commandMask += command_mask_sub_helper( commandMask, - prefixForMask + 'OUTGOING_SERVER' + prefixForMask + 'OUTGOING_SERVER', ) } } if (manufacturingCode && commandMask) { commandMask += command_mask_sub_helper( commandMask, - prefixForMask + 'MANUFACTURER_SPECIFIC' + prefixForMask + 'MANUFACTURER_SPECIFIC', ) } return commandMask @@ -2565,14 +2565,14 @@ function command_mask_sub_helper(commandMask, str) { async function format_zcl_string_as_characters_for_generated_defaults( stringVal, sizeOfString, - options + options, ) { let isOctet = 'isOctet' in options.hash ? options.hash.isOctet : false let isCommaTerminated = 'isCommaTerminated' in options.hash ? options.hash.isCommaTerminated : true let lengthOfString = types.convertIntToBigEndian( stringVal.length, - sizeOfString < 255 ? 1 : 2 + sizeOfString < 255 ? 1 : 2, ) lengthOfString = lengthOfString.replace('0x', '').match(/.{1,2}/g) let lengthPrefix = '' @@ -2616,7 +2616,7 @@ async function as_type_min_value(type, options) { packageIds, { size: 'bits', - } + }, ) let isTypeSigned = signAndSize.isTypeSigned let dataTypesize = signAndSize.dataTypesize @@ -2639,7 +2639,7 @@ async function as_type_min_value(type, options) { } else { throw new Error( 'Minimum value cannot be determined by as_type_min_value \ -due to no language option specified in the template' +due to no language option specified in the template', ) } } @@ -2665,7 +2665,7 @@ async function as_type_max_value(type, options) { packageIds, { size: 'bits', - } + }, ) let isTypeSigned = signAndSize.isTypeSigned let dataTypesize = signAndSize.dataTypesize @@ -2693,7 +2693,7 @@ async function as_type_max_value(type, options) { } else { throw new Error( 'Maximum value cannot be determined by as_type_max_value \ -due to no language option specified in the template' +due to no language option specified in the template', ) } } @@ -2712,7 +2712,7 @@ async function structs_with_clusters(options) { let structs = await queryZcl.selectStructsWithClusterAssociation( this.global.db, packageIds, - options.hash.groupByStructName + options.hash.groupByStructName, ) let promise = templateUtil.collectBlocks(structs, options, this) return templateUtil.templatePromise(this.global, promise) @@ -2729,7 +2729,7 @@ async function as_zcl_type_size(type, options) { let signAndSize = await types.getSignAndSizeOfZclType( this.global.db, type, - packageIds + packageIds, ) let dataTypesize = signAndSize.dataTypesize if (dataTypesize != 0) { @@ -2756,7 +2756,7 @@ async function as_zcl_type_size(type, options) { function if_compare(leftValue, rightValue, options) { if (arguments.length != 3) { throw new Error( - 'if_compare needs left value, right value and a comparison operator under operator=' + 'if_compare needs left value, right value and a comparison operator under operator=', ) } let result = false @@ -2788,7 +2788,7 @@ function if_compare(leftValue, rightValue, options) { break default: throw new Error( - 'if_compare does not recognize the operator: ' + options.hash.operator + 'if_compare does not recognize the operator: ' + options.hash.operator, ) } @@ -2816,7 +2816,7 @@ async function if_is_data_type_signed(type, clusterId, options) { this.global.db, type, clusterId, - packageIds + packageIds, ) let sizeAndSign = await zclUtil.zcl_data_type_size_and_sign( @@ -2824,7 +2824,7 @@ async function if_is_data_type_signed(type, clusterId, options) { dataType, clusterId, packageIds, - this + this, ) if (sizeAndSign.isSigned) { return options.fn(this) @@ -2862,7 +2862,7 @@ async function as_zcl_data_type_size(type, clusterId, options) { this.global.db, type, clusterId, - packageIds + packageIds, ) let sizeAndSign = await zclUtil.zcl_data_type_size_and_sign( @@ -2870,7 +2870,7 @@ async function as_zcl_data_type_size(type, clusterId, options) { dataType, clusterId, packageIds, - this + this, ) result = sizeAndSign.size result = @@ -2967,7 +2967,7 @@ exports.isEvent = dep(zclUtil.isEvent, { to: 'is_event' }) exports.if_manufacturing_specific_cluster = dep( if_manufacturing_specific_cluster, - { to: 'if_mfg_specific_cluster' } + { to: 'if_mfg_specific_cluster' }, ) exports.zcl_string_type_return = zcl_string_type_return exports.is_zcl_string = is_zcl_string @@ -2980,17 +2980,17 @@ exports.if_command_argument_always_present = dep( if_command_argument_always_present, { to: 'if_command_is_not_fixed_length_but_command_argument_is_always_present', - } + }, ) exports.as_underlying_zcl_type_command_argument_always_present = dep( as_underlying_zcl_type_command_argument_always_present, { to: 'as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present', - } + }, ) exports.if_command_argument_always_present_with_presentif = dep( if_command_argument_always_present_with_presentif, - { to: 'if_ca_always_present_with_presentif' } + { to: 'if_ca_always_present_with_presentif' }, ) exports.as_underlying_zcl_type_command_argument_always_present_with_presentif = dep(as_underlying_zcl_type_command_argument_always_present_with_presentif, { @@ -2998,16 +2998,16 @@ exports.as_underlying_zcl_type_command_argument_always_present_with_presentif = }) exports.if_command_argument_not_always_present_with_presentif = dep( if_command_argument_not_always_present_with_presentif, - { to: 'if_ca_not_always_present_with_presentif' } + { to: 'if_ca_not_always_present_with_presentif' }, ) exports.as_underlying_zcl_type_command_argument_not_always_present_with_presentif = dep( as_underlying_zcl_type_command_argument_not_always_present_with_presentif, - { to: 'as_underlying_zcl_type_ca_not_always_present_with_presentif' } + { to: 'as_underlying_zcl_type_ca_not_always_present_with_presentif' }, ) exports.if_command_argument_not_always_present_no_presentif = dep( if_command_argument_not_always_present_no_presentif, - { to: 'if_ca_not_always_present_no_presentif' } + { to: 'if_ca_not_always_present_no_presentif' }, ) exports.as_underlying_zcl_type_command_argument_not_always_present_no_presentif = dep(as_underlying_zcl_type_command_argument_not_always_present_no_presentif, { @@ -3021,19 +3021,19 @@ exports.format_zcl_string_as_characters_for_generated_defaults = exports.as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present = dep( as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present, - 'as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present has been deprecated. Use as_underlying_zcl_type and if_command_not_fixed_length_command_argument_always_present instead' + 'as_underlying_zcl_type_command_is_not_fixed_length_but_command_argument_is_always_present has been deprecated. Use as_underlying_zcl_type and if_command_not_fixed_length_command_argument_always_present instead', ) exports.as_underlying_zcl_type_ca_not_always_present_no_presentif = dep( as_underlying_zcl_type_ca_not_always_present_no_presentif, - 'as_underlying_zcl_type_ca_not_always_present_no_presentif has been deprecated. Use as_underlying_zcl_type and if_command_arg_not_always_present_no_presentif instead' + 'as_underlying_zcl_type_ca_not_always_present_no_presentif has been deprecated. Use as_underlying_zcl_type and if_command_arg_not_always_present_no_presentif instead', ) exports.as_underlying_zcl_type_ca_not_always_present_with_presentif = dep( as_underlying_zcl_type_ca_not_always_present_with_presentif, - 'as_underlying_zcl_type_ca_not_always_present_with_presentif has been deprecated. Use as_underlying_zcl_type and if_command_arg_not_always_present_with_presentif instead' + 'as_underlying_zcl_type_ca_not_always_present_with_presentif has been deprecated. Use as_underlying_zcl_type and if_command_arg_not_always_present_with_presentif instead', ) exports.as_underlying_zcl_type_ca_always_present_with_presentif = dep( as_underlying_zcl_type_ca_always_present_with_presentif, - 'as_underlying_zcl_type_ca_always_present_with_presentif has been deprecated. Use as_underlying_zcl_type and if_command_arg_always_present_with_presentif instead.' + 'as_underlying_zcl_type_ca_always_present_with_presentif has been deprecated. Use as_underlying_zcl_type and if_command_arg_always_present_with_presentif instead.', ) exports.if_is_struct = if_is_struct exports.if_mfg_specific_cluster = if_mfg_specific_cluster diff --git a/src-electron/generator/helper-zigbee-zcl.js b/src-electron/generator/helper-zigbee-zcl.js index c92f53021c..b45782aa3a 100644 --- a/src-electron/generator/helper-zigbee-zcl.js +++ b/src-electron/generator/helper-zigbee-zcl.js @@ -53,7 +53,7 @@ async function zcl_command_argument_type_to_cli_data_type_util( cliPrefix, allowZclTypes, context, - options + options, ) { const packageIds = await templateUtil.ensureZclPackageIds(context) let optionalArgumentExtension = @@ -63,14 +63,14 @@ async function zcl_command_argument_type_to_cli_data_type_util( let dataType = await queryZcl.selectDataTypeByName( context.global.db, type, - packageIds + packageIds, ) if (dataType) { if (dataType.discriminatorName.toLowerCase() == dbEnum.zclType.bitmap) { let bitmap = await queryZcl.selectBitmapByName( context.global.db, packageIds, - dataType.name + dataType.name, ) let bitmapSize = await get_cli_size(bitmap.size, type, allowZclTypes) return cliPrefix + '_UINT' + bitmapSize + optionalArgumentExtension @@ -80,7 +80,7 @@ async function zcl_command_argument_type_to_cli_data_type_util( let en = await queryZcl.selectEnumByName( context.global.db, dataType.name, - packageIds + packageIds, ) let enumSize = await get_cli_size(en.size, type, allowZclTypes) return cliPrefix + '_UINT' + enumSize + optionalArgumentExtension @@ -90,7 +90,7 @@ async function zcl_command_argument_type_to_cli_data_type_util( let number = await queryZcl.selectNumberByName( context.global.db, packageIds, - dataType.name + dataType.name, ) let numSize = await get_cli_size(number.size, type, allowZclTypes) if (numSize > 32) { @@ -126,7 +126,7 @@ async function zcl_command_argument_type_to_cli_data_type(type, options) { 'SL_CLI_ARG', false, this, - options + options, ) } @@ -142,7 +142,7 @@ async function zcl_command_argument_type_to_zcl_cli_data_type(type, options) { 'SL_ZCL_CLI_ARG', true, this, - options + options, ) } diff --git a/src-electron/generator/matter/app/zap-templates/common/ClusterTestGeneration.js b/src-electron/generator/matter/app/zap-templates/common/ClusterTestGeneration.js index 332b08664a..f8d0e7d724 100644 --- a/src-electron/generator/matter/app/zap-templates/common/ClusterTestGeneration.js +++ b/src-electron/generator/matter/app/zap-templates/common/ClusterTestGeneration.js @@ -68,7 +68,7 @@ function throwError(test, errorStr) { test.filename + '.yaml for test with label: "' + test.label + - '"\n' + '"\n', ); console.error(errorStr); throw new Error(); @@ -212,7 +212,7 @@ function setDefaultTypeForCommand(test) { 'Wrong Yaml configuration. Action : ' + test.commandName + " can't be sent to group " + - test[kGroupId] + test[kGroupId], ); } @@ -412,7 +412,7 @@ function setDefaults( test, defaultConfig, useSynthesizeWaitForReport, - picsFilePath + picsFilePath, ) { const defaultIdentityName = kIdentityName in defaultConfig ? defaultConfig[kIdentityName] : 'alpha'; @@ -436,7 +436,7 @@ function parseYamlTest( useSynthesizeWaitForReport, picsFilePath, certificationDir, - testDir + testDir, ) { let filepath; const isCertificationTest = filename.startsWith('Test_TC_'); @@ -517,7 +517,7 @@ function assertCommandOrAttributeOrEvent(context) { 'Missing cluster "' + clusterName + '" in: \n\t* ' + - names.join('\n\t* ') + names.join('\n\t* '), ); } @@ -544,8 +544,8 @@ function assertCommandOrAttributeOrEvent(context) { const itemType = context.isCommand ? 'Command' : context.isAttribute - ? 'Attribute' - : 'Event'; + ? 'Attribute' + : 'Event'; // If the command/attribute/event is not found, it could be because of a typo in the test // description, or an attribute/event name not matching the spec, or a wrongly configured zap @@ -559,7 +559,7 @@ function assertCommandOrAttributeOrEvent(context) { ' "' + filterName + '" in: \n\t* ' + - names.join('\n\t* ') + names.join('\n\t* '), ); } @@ -568,7 +568,7 @@ function assertCommandOrAttributeOrEvent(context) { if (!item.response) { printErrorAndExit( context, - 'Missing ' + itemType + ' "' + filterName + '" response' + 'Missing ' + itemType + ' "' + filterName + '" response', ); } @@ -608,7 +608,7 @@ function chip_tests_pics(options) { return templateUtil.collectBlocks( retrievePICS(this.global.resource('pics-metafile')).getAll(), options, - this + this, ); } @@ -643,7 +643,7 @@ async function chip_tests(listOrJson, options) { if (options.hash.includeAllClusters) { // Trigger fetch of the cluster bits before some of the iterators inside us // try to do it and fail to pass includeAllClusters=true. - getClusters(this, /* includeAllClusters = */ true) + getClusters(this, /* includeAllClusters = */ true); } if (Array.isArray(listOrJson)) { @@ -664,8 +664,8 @@ async function chip_tests(listOrJson, options) { options.hash.useSynthesizeWaitForReport, global.resource('pics-metafile'), global.resource('certification-metadir'), - global.resource('test-metadir') - ) + global.resource('test-metadir'), + ), ); const context = this; @@ -678,12 +678,14 @@ async function chip_tests(listOrJson, options) { if (kResponseName in item) { await Promise.all( - item[kResponseName].map((response) => configureTestItem(response)) + item[kResponseName].map((response) => + configureTestItem(response), + ), ); } return item; - }) + }), ); const variables = await Variables(context, test); @@ -692,7 +694,7 @@ async function chip_tests(listOrJson, options) { tests: variables.tests, }; return test; - }) + }), ); return templateUtil.collectBlocks(tests, options, this); } @@ -821,7 +823,7 @@ function checkNumberSanity(value, errorContext) { if (Number.isInteger(value) && !Number.isSafeInteger(value)) { printErrorAndExit( errorContext.thisVal, - `${errorContext.name} value ${value} is too large to represent exactly as an integer in YAML. Put quotes around it to treat it as a string.\n\n` + `${errorContext.name} value ${value} is too large to represent exactly as an integer in YAML. Put quotes around it to treat it as a string.\n\n`, ); } } @@ -858,7 +860,7 @@ function chip_tests_item_parameters(options) { commandArg = JSON.parse(JSON.stringify(commandArg)); const expected = commandValues.find( - (value) => value.name.toLowerCase() == commandArg.name.toLowerCase() + (value) => value.name.toLowerCase() == commandArg.name.toLowerCase(), ); if (!expected) { if (commandArg.isOptional) { @@ -869,7 +871,7 @@ function chip_tests_item_parameters(options) { 'Missing "' + commandArg.name + '" in arguments list: \n\t* ' + - commandValues.map((command) => command.name).join('\n\t* ') + commandValues.map((command) => command.name).join('\n\t* '), ); } @@ -904,7 +906,7 @@ function chip_tests_item_response_parameters(options) { responseArg = JSON.parse(JSON.stringify(responseArg)); const expectedIndex = responseValues.findIndex( - (value) => value.name.toLowerCase() == responseArg.name.toLowerCase() + (value) => value.name.toLowerCase() == responseArg.name.toLowerCase(), ); if (expectedIndex != -1) { const expected = responseValues.splice(expectedIndex, 1)[0]; @@ -913,7 +915,7 @@ function chip_tests_item_response_parameters(options) { responseArg.expectedValue = attachGlobal( this.global, expected.value, - { thisVal: this, name: responseArg.name } + { thisVal: this, name: responseArg.name }, ); } @@ -922,7 +924,7 @@ function chip_tests_item_response_parameters(options) { responseArg.expectedConstraints = attachGlobal( this.global, expected.constraints, - { thisVal: this, name: responseArg.name } + { thisVal: this, name: responseArg.name }, ); } @@ -935,7 +937,7 @@ function chip_tests_item_response_parameters(options) { }); const unusedResponseValues = responseValues.filter( - (response) => 'value' in response + (response) => 'value' in response, ); unusedResponseValues.forEach((unusedResponseValue) => { printErrorAndExit( @@ -943,7 +945,7 @@ function chip_tests_item_response_parameters(options) { 'Missing "' + unusedResponseValue.name + '" in response arguments list:\n\t* ' + - responseArgs.map((response) => response.name).join('\n\t* ') + responseArgs.map((response) => response.name).join('\n\t* '), ); }); @@ -968,13 +970,13 @@ function octetStringFromHexString(value) { if (hexString.length % 2) { throw new Error( - 'The provided hexadecimal string contains an even number of characters' + 'The provided hexadecimal string contains an even number of characters', ); } if (!/^[0-9a-fA-F]+$/.test(hexString)) { throw new Error( - 'The provided hexadecimal string contains invalid hexadecimal character.' + 'The provided hexadecimal string contains invalid hexadecimal character.', ); } @@ -1006,7 +1008,7 @@ function if_include_struct_item_value(structValue, name, options) { if (!this.isOptional) { throw new Error( `Value not provided for ${name} where one is expected in ` + - JSON.stringify(structValue) + JSON.stringify(structValue), ); } @@ -1020,8 +1022,8 @@ function ensureIsArray(value, options) { printErrorAndExit( this, `Expected array but instead got ${typeof value}: ${JSON.stringify( - value - )}\n` + value, + )}\n`, ); } } @@ -1044,7 +1046,7 @@ function checkIsInsideTestOnlyClusterBlock(conditions, name) { async function chip_tests_only_clusters(options) { const clusters = await getClusters(this, options.hash.includeAllClusters); const testOnlyClusters = clusters.filter((cluster) => - isTestOnlyCluster(cluster.name) + isTestOnlyCluster(cluster.name), ); return asBlocks.call(this, Promise.resolve(testOnlyClusters), options); } @@ -1081,7 +1083,7 @@ async function chip_tests_only_cluster_command_parameters(options) { ]; checkIsInsideTestOnlyClusterBlock( conditions, - 'chip_tests_only_cluster_commands' + 'chip_tests_only_cluster_commands', ); return asBlocks.call(this, Promise.resolve(this.arguments), options); @@ -1111,7 +1113,7 @@ async function chip_tests_only_cluster_responses(options) { } const alreadyExists = responses.some( - (item) => item.responseName == command.responseName + (item) => item.responseName == command.responseName, ); if (alreadyExists) { return; @@ -1140,7 +1142,7 @@ async function chip_tests_only_cluster_response_parameters(options) { ]; checkIsInsideTestOnlyClusterBlock( conditions, - 'chip_tests_only_cluster_responses' + 'chip_tests_only_cluster_responses', ); return asBlocks.call(this, Promise.resolve(this.arguments), options); diff --git a/src-electron/generator/matter/app/zap-templates/common/ClustersHelper.js b/src-electron/generator/matter/app/zap-templates/common/ClustersHelper.js index 46baeadba8..82c2cbf548 100644 --- a/src-electron/generator/matter/app/zap-templates/common/ClustersHelper.js +++ b/src-electron/generator/matter/app/zap-templates/common/ClustersHelper.js @@ -55,7 +55,7 @@ function loadAtomics(packageIds) { atomic.chipType = zclType; return atomic; }); - }) + }), ); return zclQuery.selectAllAtomics(db, packageIds).then(resolveZclTypes); @@ -64,14 +64,14 @@ function loadAtomics(packageIds) { function loadBitmaps(packageIds) { const { db, sessionId } = this.global; return Promise.all( - packageIds.map((packageId) => zclQuery.selectAllBitmaps(db, packageId)) + packageIds.map((packageId) => zclQuery.selectAllBitmaps(db, packageId)), ).then((x) => x.flat()); } function loadEnums(packageIds) { const { db, sessionId } = this.global; return Promise.all( - packageIds.map((packageId) => zclQuery.selectAllEnums(db, packageId)) + packageIds.map((packageId) => zclQuery.selectAllEnums(db, packageId)), ).then((x) => x.flat()); } @@ -90,7 +90,7 @@ function loadStructs(packageIds) { return zclQuery .selectAllStructsWithItemCount(db, packageIds) .then((structs) => - Promise.all(structs.map((struct) => loadStructItems.call(this, struct))) + Promise.all(structs.map((struct) => loadStructItems.call(this, struct))), ); } @@ -155,12 +155,12 @@ async function loadClusters() { const endpointTypes = await queryEndpointType.selectEndpointTypeIds( db, - sessionId + sessionId, ); const clusters = await queryEndpointType.selectAllClustersDetailsFromEndpointTypes( db, - endpointTypes + endpointTypes, ); return clusters.filter((cluster) => cluster.enabled == 1); @@ -225,16 +225,16 @@ function loadCommands(packageIds) { .then((endpointTypes) => queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( db, - endpointTypes - ) + endpointTypes, + ), ) .then((endpointTypesAndClusters) => queryCommand.selectCommandDetailsFromAllEndpointTypesAndClusters( db, endpointTypesAndClusters, true, - packageIds - ) + packageIds, + ), ); return loadCommandsCommon.call(this, cmds); @@ -245,13 +245,13 @@ function loadCommandsCommon(commandsPromise) { return commandsPromise .then((commands) => Promise.all( - commands.map((command) => loadCommandResponse.call(this, command)) - ) + commands.map((command) => loadCommandResponse.call(this, command)), + ), ) .then((commands) => Promise.all( - commands.map((command) => loadCommandArguments.call(this, command)) - ) + commands.map((command) => loadCommandArguments.call(this, command)), + ), ); } @@ -272,8 +272,8 @@ async function loadAllAttributes(packageIds) { const clusters = await Promise.all( packageIds.map((packageId) => - zclQuery.selectAllClusters(this.global.db, packageId) - ) + zclQuery.selectAllClusters(this.global.db, packageId), + ), ).then((cls) => cls.flat()); for (let cluster of clusters) { @@ -303,9 +303,9 @@ function loadAttributes() { .then((endpointTypes) => Promise.all( endpointTypes.map(({ endpointTypeId }) => - queryEndpoint.selectEndpointClusters(db, endpointTypeId) - ) - ) + queryEndpoint.selectEndpointClusters(db, endpointTypeId), + ), + ), ) .then((clusters) => clusters.flat()) .then((clusters) => @@ -315,14 +315,14 @@ function loadAttributes() { db, clusterId, 'server', - endpointTypeId - ) - ) - ) + endpointTypeId, + ), + ), + ), ) .then((attributes) => attributes.flat()) .then((attributes) => - attributes.filter((attribute) => attribute.isIncluded) + attributes.filter((attribute) => attribute.isIncluded), ) .then((attributes) => attributes.sort((a, b) => a.code - b.code)); //.then(attributes => Promise.all(attributes.map(attribute => types.typeSizeAttribute(db, packageId, attribute)) @@ -331,7 +331,7 @@ function loadAttributes() { async function loadAllEvents(packageIds) { const { db, sessionId } = this.global; let clusters = await Promise.all( - packageIds.map((packageId) => zclQuery.selectAllClusters(db, packageId)) + packageIds.map((packageId) => zclQuery.selectAllClusters(db, packageId)), ).then((cls) => cls.flat()); return loadEventsCommon.call(this, packageIds, clusters); } @@ -343,9 +343,9 @@ async function loadEvents(packageIds) { .then((endpointTypes) => Promise.all( endpointTypes.map(({ endpointTypeId }) => - queryEndpoint.selectEndpointClusters(db, endpointTypeId) - ) - ) + queryEndpoint.selectEndpointClusters(db, endpointTypeId), + ), + ), ) .then((clusters) => clusters.flat(3)); return loadEventsCommon.call(this, packageIds, clusters); @@ -357,7 +357,7 @@ function loadEventsCommon(packageIds, clusters) { return queryEvent.selectAllEvents(db, packageIds).then((events) => { events.forEach((event) => { const cluster = clusters.find( - (cluster) => cluster.code == event.clusterCode + (cluster) => cluster.code == event.clusterCode, ); if (cluster) { event.clusterId = cluster.clusterId; @@ -365,7 +365,7 @@ function loadEventsCommon(packageIds, clusters) { } }); return events.filter((event) => - clusters.find((cluster) => cluster.code == event.clusterCode) + clusters.find((cluster) => cluster.code == event.clusterCode), ); }); } @@ -375,7 +375,7 @@ function loadGlobalAttributes(packageIds) { return zclQuery .selectAllAttributes(db, packageIds) .then((attributes) => - attributes.filter((attribute) => attribute.clusterRef == null) + attributes.filter((attribute) => attribute.clusterRef == null), ) .then((attributes) => attributes.map((attribute) => attribute.code)); } @@ -428,7 +428,7 @@ function asChipCallback(item) { function getAtomic(atomics, type) { return atomics.find( - (atomic) => atomic.name.toLowerCase() == type.toLowerCase() + (atomic) => atomic.name.toLowerCase() == type.toLowerCase(), ); } @@ -497,7 +497,7 @@ function handleStruct(item, [atomics, enums, bitmaps, structs]) { item.isStruct = true; struct.items.map((structItem) => - enhancedItem(structItem, [atomics, enums, bitmaps, structs]) + enhancedItem(structItem, [atomics, enums, bitmaps, structs]), ); item.items = struct.items; item.size = struct.items @@ -596,7 +596,7 @@ function enhancedCommands(commands, types) { const clusterName = command.clusterName; command.response = commands.find( (command) => - command.name == responseName && command.clusterName == clusterName + command.name == responseName && command.clusterName == clusterName, ); // We might have failed to find a response if our configuration is weird // in some way. @@ -680,7 +680,7 @@ function enhancedAttributes(attributes, globalAttributes, types) { const compare = (a, b) => a.name == b.name && a.clusterId == b.clusterId && a.side == b.side; return attributes.filter( - (att, index) => attributes.findIndex((att2) => compare(att, att2)) == index + (att, index) => attributes.findIndex((att2) => compare(att, att2)) == index, ); } @@ -735,7 +735,7 @@ class ClusterStructUsage { structuresUsedByMultipleClusters() { return Array.from(this.usedStructures.values()).filter( - (s) => this.clustersForStructure.get(s.label).size > 1 + (s) => this.clustersForStructure.get(s.label).size > 1, ); } } @@ -743,7 +743,7 @@ class ClusterStructUsage { Clusters._addUsedStructureNames = async function ( clusterName, startType, - allKnownStructs + allKnownStructs, ) { const struct = getStruct(allKnownStructs, startType.type); if (!struct) { @@ -784,7 +784,7 @@ Clusters._computeUsedStructureNames = async function (structs) { } this._used_structure_names = new Set( - this._cluster_structures.usedStructures.keys() + this._cluster_structures.usedStructures.keys(), ); }; @@ -795,7 +795,7 @@ Clusters._computeUsedStructureNames = async function (structs) { Clusters.init = async function ( context, includeAllClusterConstructs, - includeAllClusters + includeAllClusters, ) { try { if (this.ready.running) { @@ -832,7 +832,7 @@ Clusters.init = async function ( loadGlobalAttributes.call(context, packageIds), (includeAllClusterConstructs ? loadAllEvents : loadEvents).call( context, - packageIds + packageIds, ), ]; @@ -871,14 +871,14 @@ Clusters.init = async function ( // function asBlocks(promise, options) { return promise.then((data) => - templateUtil.collectBlocks(data, options, this) + templateUtil.collectBlocks(data, options, this), ); } function ensureClusters( context, includeAllClusterConstructs = false, - includeAllClusters = false + includeAllClusters = false, ) { // Kick off Clusters initialization. This is async, but that's fine: all the // getters on Clusters wait on that initialziation to complete. @@ -913,13 +913,13 @@ Clusters.getEndPoints = function () { Clusters.getCommands = function () { return this.ensureReady().then(() => - this._commands.filter(kResponseFilter.bind(null, false)) + this._commands.filter(kResponseFilter.bind(null, false)), ); }; Clusters.getResponses = function () { return this.ensureReady().then(() => - this._commands.filter(kResponseFilter.bind(null, true)) + this._commands.filter(kResponseFilter.bind(null, true)), ); }; @@ -939,13 +939,13 @@ const kNameFilter = (name, item) => Clusters.getCommandsByClusterName = function (name) { return this.getCommands().then((items) => - items.filter(kNameFilter.bind(null, name)) + items.filter(kNameFilter.bind(null, name)), ); }; Clusters.getResponsesByClusterName = function (name) { return this.getResponses().then((items) => - items.filter(kNameFilter.bind(null, name)) + items.filter(kNameFilter.bind(null, name)), ); }; @@ -959,7 +959,7 @@ Clusters.getAttributesByClusterName = function (name) { Clusters.getEventsByClusterName = function (name) { return this.getEvents().then((items) => - items.filter(kNameFilter.bind(null, name)) + items.filter(kNameFilter.bind(null, name)), ); }; @@ -974,25 +974,25 @@ const kSideFilter = (side, item) => Clusters.getCommandsByClusterSide = function (side) { return this.getCommands().then((items) => - items.filter(kSideFilter.bind(null, side)) + items.filter(kSideFilter.bind(null, side)), ); }; Clusters.getResponsesByClusterSide = function (side) { return this.getResponses().then((items) => - items.filter(kSideFilter.bind(null, side)) + items.filter(kSideFilter.bind(null, side)), ); }; Clusters.getAttributesByClusterSide = function (side) { return this.getAttributes().then((items) => - items.filter(kSideFilter.bind(null, side)) + items.filter(kSideFilter.bind(null, side)), ); }; Clusters.getEventsByClusterSide = function (side) { return this.getEvents().then((items) => - items.filter(kSideFilter.bind(null, side)) + items.filter(kSideFilter.bind(null, side)), ); }; @@ -1007,25 +1007,25 @@ Clusters.getClientClusters = function () { Clusters.getClientCommands = function (name) { return this.getCommandsByClusterName(name).then((items) => - items.filter(kClientSideFilter) + items.filter(kClientSideFilter), ); }; Clusters.getClientResponses = function (name) { return this.getResponsesByClusterName(name).then((items) => - items.filter(kClientSideFilter) + items.filter(kClientSideFilter), ); }; Clusters.getClientAttributes = function (name) { return this.getAttributesByClusterName(name).then((items) => - items.filter(kClientSideFilter) + items.filter(kClientSideFilter), ); }; Clusters.getClientEvents = function (name) { return this.getEventsByClusterName(name).then((items) => - items.filter(kClientSideFilter) + items.filter(kClientSideFilter), ); }; @@ -1040,19 +1040,19 @@ Clusters.getServerClusters = function () { Clusters.getServerCommands = function (name) { return this.getCommandsByClusterName(name).then((items) => - items.filter(kServerSideFilter) + items.filter(kServerSideFilter), ); }; Clusters.getServerResponses = function (name) { return this.getResponsesByClusterName(name).then((items) => - items.filter(kServerSideFilter) + items.filter(kServerSideFilter), ); }; Clusters.getServerAttributes = function (name) { return this.getAttributesByClusterName(name).then((items) => - items.filter(kServerSideFilter) + items.filter(kServerSideFilter), ); }; @@ -1062,19 +1062,19 @@ Clusters.getUsedStructureNames = function () { Clusters.getStructuresByClusterName = function (name) { return this.ensurePostProcessingDone().then(() => - this._cluster_structures.structuresSpecificToCluster(name) + this._cluster_structures.structuresSpecificToCluster(name), ); }; Clusters.getSharedStructs = function () { return this.ensurePostProcessingDone().then(() => - this._cluster_structures.structuresUsedByMultipleClusters() + this._cluster_structures.structuresUsedByMultipleClusters(), ); }; Clusters.getServerEvents = function (name) { return this.getEventsByClusterName(name).then((items) => - items.filter(kServerSideFilter) + items.filter(kServerSideFilter), ); }; diff --git a/src-electron/generator/matter/app/zap-templates/common/attributes/Accessors.js b/src-electron/generator/matter/app/zap-templates/common/attributes/Accessors.js index 9635599b29..37fb7f1e29 100644 --- a/src-electron/generator/matter/app/zap-templates/common/attributes/Accessors.js +++ b/src-electron/generator/matter/app/zap-templates/common/attributes/Accessors.js @@ -68,7 +68,7 @@ async function accessorGetterType(attr) { type = await appHelper.zapTypeToEncodableClusterObjectType.call( this, attr.type, - options + options, ); } @@ -105,7 +105,7 @@ async function accessorTraitType(type) { return appHelper.zapTypeToEncodableClusterObjectType.call( this, type, - options + options, ); } diff --git a/src-electron/generator/matter/app/zap-templates/common/simulated-clusters/clusters/CommissionerCommands.js b/src-electron/generator/matter/app/zap-templates/common/simulated-clusters/clusters/CommissionerCommands.js index d0a14240a0..462f4b1adc 100644 --- a/src-electron/generator/matter/app/zap-templates/common/simulated-clusters/clusters/CommissionerCommands.js +++ b/src-electron/generator/matter/app/zap-templates/common/simulated-clusters/clusters/CommissionerCommands.js @@ -44,9 +44,9 @@ const GetCommissionerNodeId = { response: { arguments: [ { name: 'nodeId', type: 'NODE_ID' }, // - ] - } -} + ], + }, +}; const name = 'CommissionerCommands'; const commands = [PairWithCode, Unpair, GetCommissionerNodeId]; diff --git a/src-electron/generator/matter/app/zap-templates/common/simulated-clusters/clusters/EqualityCommands.js b/src-electron/generator/matter/app/zap-templates/common/simulated-clusters/clusters/EqualityCommands.js index e289c23b92..36e85146f8 100644 --- a/src-electron/generator/matter/app/zap-templates/common/simulated-clusters/clusters/EqualityCommands.js +++ b/src-electron/generator/matter/app/zap-templates/common/simulated-clusters/clusters/EqualityCommands.js @@ -23,16 +23,14 @@ */ const kEqualityResponse = { - arguments: [ - { name: 'Equals', type: 'BOOLEAN' }, - ], + arguments: [{ name: 'Equals', type: 'BOOLEAN' }], }; const BooleanEquals = { name: 'BooleanEquals', arguments: [ - { name: "Value1", type: 'BOOLEAN' }, - { name: "Value2", type: 'BOOLEAN' }, + { name: 'Value1', type: 'BOOLEAN' }, + { name: 'Value2', type: 'BOOLEAN' }, ], responseName: 'EqualityResponse', response: kEqualityResponse, @@ -41,8 +39,8 @@ const BooleanEquals = { const SignedNumberEquals = { name: 'SignedNumberEquals', arguments: [ - { name: "Value1", type: 'INT64S' }, - { name: "Value2", type: 'INT64S' }, + { name: 'Value1', type: 'INT64S' }, + { name: 'Value2', type: 'INT64S' }, ], responseName: 'EqualityResponse', response: kEqualityResponse, @@ -51,8 +49,8 @@ const SignedNumberEquals = { const UnsignedNumberEquals = { name: 'UnsignedNumberEquals', arguments: [ - { name: "Value1", type: 'INT64U' }, - { name: "Value2", type: 'INT64U' }, + { name: 'Value1', type: 'INT64U' }, + { name: 'Value2', type: 'INT64U' }, ], responseName: 'EqualityResponse', response: kEqualityResponse, @@ -61,7 +59,7 @@ const UnsignedNumberEquals = { const EqualityCommands = { name: 'EqualityCommands', commands: [BooleanEquals, SignedNumberEquals, UnsignedNumberEquals], -} +}; // // Module exports diff --git a/src-electron/generator/matter/app/zap-templates/common/variables/Variables.js b/src-electron/generator/matter/app/zap-templates/common/variables/Variables.js index a8fa4b87e8..e9d8b93130 100644 --- a/src-electron/generator/matter/app/zap-templates/common/variables/Variables.js +++ b/src-electron/generator/matter/app/zap-templates/common/variables/Variables.js @@ -44,7 +44,7 @@ function throwError(test, errorStr) { test.filename + '.yaml for test with label: "' + test.label + - '"\n' + '"\n', ); console.error(errorStr); throw new Error(); @@ -53,13 +53,13 @@ function throwError(test, errorStr) { async function getItems(test, promise, itemName) { return promise.then((items) => { const item = items.find( - (item) => item.name.toLowerCase() == itemName.toLowerCase() + (item) => item.name.toLowerCase() == itemName.toLowerCase(), ); if (!item) { const names = items.map((item) => item.name); throwError( test, - 'Missing ' + itemName + '" in: \n\t* ' + names.join('\n\t* ') + 'Missing ' + itemName + '" in: \n\t* ' + names.join('\n\t* '), ); } @@ -71,10 +71,10 @@ async function getCommandInformationsFor(context, test, argumentName) { const command = await getItems( test, getCommands(context, test.cluster), - test.command + test.command, ); const argument = command.response.arguments.find( - (item) => item.name.toLowerCase() == argumentName.toLowerCase() + (item) => item.name.toLowerCase() == argumentName.toLowerCase(), ); return { type: argument.type, @@ -87,7 +87,7 @@ async function getAttributeInformationsFor(context, test, attributeName) { const attribute = await getItems( test, getAttributes(context, test.cluster), - attributeName + attributeName, ); return { type: attribute.type, @@ -119,7 +119,7 @@ async function extractVariablesFromConfig(context, suite) { if (!isKnownVariable && !('defaultValue' in target)) { throw new Error( - `${suite.filename}: No default value defined for config '${key}'` + `${suite.filename}: No default value defined for config '${key}'`, ); } @@ -131,13 +131,13 @@ async function extractVariablesFromConfig(context, suite) { !Number.isSafeInteger(value.defaultValue) ) { throw new Error( - `${suite.filename}: Default value defined for config '${key}' is too large to represent exactly as an integer in YAML. Put quotes around it to treat it as a string.` + `${suite.filename}: Default value defined for config '${key}' is too large to represent exactly as an integer in YAML. Put quotes around it to treat it as a string.`, ); } value.chipType = await zclHelper.asUnderlyingZclType.call( context, value.type, - { hash: {} } + { hash: {} }, ); value.name = key; variables.push(value); @@ -157,14 +157,14 @@ async function extractVariablesFromTests(context, suite) { if (key in variables) { throwError( test, - `Variable with name: ${key} is already registered.` + `Variable with name: ${key} is already registered.`, ); } if (!test.isCommand && !test.isAttribute) { throwError( test, - `Variable support for step ${test} is not supported. Only commands and attributes are supported.` + `Variable support for step ${test} is not supported. Only commands and attributes are supported.`, ); } diff --git a/src-electron/generator/matter/app/zap-templates/partials/helper.js b/src-electron/generator/matter/app/zap-templates/partials/helper.js index 6988363bd9..d78947970c 100644 --- a/src-electron/generator/matter/app/zap-templates/partials/helper.js +++ b/src-electron/generator/matter/app/zap-templates/partials/helper.js @@ -30,8 +30,8 @@ function concat() { } else { throw new TypeError( `Unexpected object in concat: ${arg}:${Object.prototype.toString.call( - arguments[arg] - )}, ${JSON.stringify(arguments)}` + arguments[arg], + )}, ${JSON.stringify(arguments)}`, ); } } diff --git a/src-electron/generator/matter/app/zap-templates/templates/app/helper.js b/src-electron/generator/matter/app/zap-templates/templates/app/helper.js index fcac5c5e40..e99faa4891 100644 --- a/src-electron/generator/matter/app/zap-templates/templates/app/helper.js +++ b/src-electron/generator/matter/app/zap-templates/templates/app/helper.js @@ -128,7 +128,7 @@ function chip_endpoint_generated_functions() { : endpointClusterWithAttributeChanged.includes(clusterName); let isClusterPreAttributeChangedFunctionIncluded = configData ? configData.ClustersWithPreAttributeChangeFunctions.includes( - clusterName + clusterName, ) : endpointClusterWithPreAttribute.includes(clusterName); if (isClusterInitFunctionIncluded) { @@ -136,8 +136,8 @@ function chip_endpoint_generated_functions() { functionList = functionList.concat( ` (EmberAfGenericClusterFunction) emberAf${cHelper.asCamelCased( clusterName, - false - )}ClusterServerInitCallback,\\\n` + false, + )}ClusterServerInitCallback,\\\n`, ); } @@ -145,8 +145,8 @@ function chip_endpoint_generated_functions() { functionList = functionList.concat( ` (EmberAfGenericClusterFunction) Matter${cHelper.asCamelCased( clusterName, - false - )}ClusterServerAttributeChangedCallback,\\\n` + false, + )}ClusterServerAttributeChangedCallback,\\\n`, ); hasFunctionArray = true; } @@ -160,8 +160,8 @@ function chip_endpoint_generated_functions() { functionList = functionList.concat( ` (EmberAfGenericClusterFunction) Matter${cHelper.asCamelCased( clusterName, - false - )}ClusterServerShutdownCallback,\\\n` + false, + )}ClusterServerShutdownCallback,\\\n`, ); } @@ -169,8 +169,8 @@ function chip_endpoint_generated_functions() { functionList = functionList.concat( ` (EmberAfGenericClusterFunction) Matter${cHelper.asCamelCased( clusterName, - false - )}ClusterServerPreAttributeChangedCallback,\\\n` + false, + )}ClusterServerPreAttributeChangedCallback,\\\n`, ); hasFunctionArray = true; } @@ -179,8 +179,8 @@ function chip_endpoint_generated_functions() { ret = ret.concat( `const EmberAfGenericClusterFunction chipFuncArray${cHelper.asCamelCased( clusterName, - false - )}Server[] = {\\\n` + false, + )}Server[] = {\\\n`, ); ret = ret.concat(functionList); ret = ret.concat(`};\\\n`); @@ -216,7 +216,7 @@ function chip_endpoint_generated_commands_list(options) { acceptedCommands.push('chip::kInvalidCommandId /* end of list */'); ret.push({ text: ` /* AcceptedCommandList (index=${index}) */ \\\n ${acceptedCommands.join( - ', \\\n ' + ', \\\n ', )}, \\`, }); index += acceptedCommands.length; @@ -225,7 +225,7 @@ function chip_endpoint_generated_commands_list(options) { generatedCommands.push('chip::kInvalidCommandId /* end of list */'); ret.push({ text: ` /* GeneratedCommandList (index=${index})*/ \\\n ${generatedCommands.join( - ', \\\n ' + ', \\\n ', )}, \\`, }); index += generatedCommands.length; @@ -367,7 +367,7 @@ function chip_endpoint_cluster_list(options) { break; case 'attributes': individualItems.push( - `.attributes = ZAP_ATTRIBUTE_INDEX(${c.attributeIndex})` + `.attributes = ZAP_ATTRIBUTE_INDEX(${c.attributeIndex})`, ); break; case 'attributeCount': @@ -384,12 +384,12 @@ function chip_endpoint_cluster_list(options) { break; case 'acceptedCommandList': individualItems.push( - `.acceptedCommandList = ${acceptedCommandsListVal}` + `.acceptedCommandList = ${acceptedCommandsListVal}`, ); break; case 'generatedCommandList': individualItems.push( - `.generatedCommandList = ${generatedCommandsListVal}` + `.generatedCommandList = ${generatedCommandsListVal}`, ); break; case 'eventList': @@ -421,7 +421,7 @@ function chip_endpoint_data_version_count() { let serverCount = 0; for (const ep of this.endpoints) { let epType = this.endpointTypes.find( - (type) => type.id == ep.endpointTypeRef + (type) => type.id == ep.endpointTypeRef, ); for (const cluster of epType.clusters) { if (cluster.side == 'server') { @@ -673,7 +673,7 @@ async function zapTypeToClusterObjectType(type, isDecodable, options) { async function fn(pkgId) { const typeChecker = async (method) => zclHelper[method](this.global.db, type, pkgId).then( - (zclType) => zclType != 'unknown' + (zclType) => zclType != 'unknown', ); const types = { @@ -704,7 +704,7 @@ async function zapTypeToClusterObjectType(type, isDecodable, options) { const enumObj = await zclQuery.selectEnumByName( this.global.db, type, - pkgId + pkgId, ); const ns = nsValueToNamespace(options.hash.ns, enumObj.enumClusterCount); return ns + asUpperCamelCase.call(this, type, options); @@ -720,11 +720,11 @@ async function zapTypeToClusterObjectType(type, isDecodable, options) { const bitmapObj = await zclQuery.selectBitmapByName( this.global.db, pkgId, - type + type, ); const ns = nsValueToNamespace( options.hash.ns, - bitmapObj.bitmapClusterCount + bitmapObj.bitmapClusterCount, ); return ( 'chip::BitMask<' + ns + asUpperCamelCase.call(this, type, options) + '>' @@ -736,11 +736,11 @@ async function zapTypeToClusterObjectType(type, isDecodable, options) { const structObj = await zclQuery.selectStructByName( this.global.db, type, - pkgId + pkgId, ); const ns = nsValueToNamespace( options.hash.ns, - structObj.structClusterCount + structObj.structClusterCount, ); return ( ns + @@ -767,7 +767,7 @@ async function zapTypeToClusterObjectType(type, isDecodable, options) { return zclHelper.asUnderlyingZclType.call( { global: this.global }, type, - options + options, ); } @@ -819,7 +819,7 @@ async function _zapTypeToPythonClusterObjectType(type, options) { async function fn(pkgId) { const typeChecker = async (method) => zclHelper[method](this.global.db, type, pkgId).then( - (zclType) => zclType != 'unknown' + (zclType) => zclType != 'unknown', ); if (await typeChecker('isEnum')) { @@ -831,12 +831,12 @@ async function _zapTypeToPythonClusterObjectType(type, options) { const enumObj = await zclQuery.selectEnumByName( this.global.db, type, - pkgId + pkgId, ); const ns = nsValueToPythonNamespace( options.hash.ns, - enumObj.enumClusterCount + enumObj.enumClusterCount, ); return ns + '.Enums.' + type; @@ -850,12 +850,12 @@ async function _zapTypeToPythonClusterObjectType(type, options) { const structObj = await zclQuery.selectStructByName( this.global.db, type, - pkgId + pkgId, ); const ns = nsValueToPythonNamespace( options.hash.ns, - structObj.structClusterCount + structObj.structClusterCount, ); return ns + '.Structs.' + type; @@ -893,7 +893,7 @@ async function _zapTypeToPythonClusterObjectType(type, options) { let resolvedType = await zclHelper.asUnderlyingZclType.call( { global: this.global }, type, - options + options, ); { let basicType = ChipTypesHelper.asBasicType(resolvedType); @@ -916,7 +916,7 @@ async function _zapTypeToPythonClusterObjectType(type, options) { if (isNull && isOptional) { promise = promise.then( - (typeStr) => `typing.Union[None, Nullable, ${typeStr}]` + (typeStr) => `typing.Union[None, Nullable, ${typeStr}]`, ); } else if (isNull) { promise = promise.then((typeStr) => `typing.Union[Nullable, ${typeStr}]`); @@ -935,7 +935,7 @@ async function _getPythonFieldDefault(type, options) { async function fn(pkgId) { const typeChecker = async (method) => zclHelper[method](this.global.db, type, pkgId).then( - (zclType) => zclType != 'unknown' + (zclType) => zclType != 'unknown', ); if (await typeChecker('isEnum')) { @@ -950,12 +950,12 @@ async function _getPythonFieldDefault(type, options) { const structObj = await zclQuery.selectStructByName( this.global.db, type, - pkgId + pkgId, ); const ns = nsValueToPythonNamespace( options.hash.ns, - structObj.structClusterCount + structObj.structClusterCount, ); return 'field(default_factory=lambda: ' + ns + '.Structs.' + type + '())'; @@ -989,7 +989,7 @@ async function _getPythonFieldDefault(type, options) { let resolvedType = await zclHelper.asUnderlyingZclType.call( { global: this.global }, type, - options + options, ); { let basicType = ChipTypesHelper.asBasicType(resolvedType); @@ -1110,7 +1110,7 @@ async function zcl_events_fields_by_event_name(name, options) { fields.map((field) => { field.label = field.name; return field; - }) + }), ) .then((fields) => templateUtil.collectBlocks(fields, options, this)); return templateUtil.templatePromise(this.global, promise); @@ -1123,7 +1123,7 @@ async function zcl_commands_that_need_timed_invoke(options) { let commands = await queryCommand.selectCommandsByClusterId( db, this.id, - packageIds + packageIds, ); commands = commands.filter((cmd) => cmd.mustUseTimedInvoke); return templateUtil.collectBlocks(commands, options, this); diff --git a/src-electron/generator/matter/app/zap-templates/templates/chip/helper.js b/src-electron/generator/matter/app/zap-templates/templates/chip/helper.js index bc83a07919..30853e2f5d 100644 --- a/src-electron/generator/matter/app/zap-templates/templates/chip/helper.js +++ b/src-electron/generator/matter/app/zap-templates/templates/chip/helper.js @@ -78,7 +78,7 @@ function checkIsChipType(context, name) { function getCommands(methodName) { const { clusterName, clusterSide } = checkIsInsideClusterBlock( this, - methodName + methodName, ); return clusterSide == 'client' ? ensureClusters(this).getClientCommands(clusterName) @@ -88,7 +88,7 @@ function getCommands(methodName) { function getAttributes(methodName) { const { clusterName, clusterSide } = checkIsInsideClusterBlock( this, - methodName + methodName, ); return ensureClusters(this).getAttributesByClusterName(clusterName); } @@ -96,7 +96,7 @@ function getAttributes(methodName) { function getResponses(methodName) { const { clusterName, clusterSide } = checkIsInsideClusterBlock( this, - methodName + methodName, ); return clusterSide == 'client' ? ensureClusters(this).getClientResponses(clusterName) @@ -112,7 +112,7 @@ function chip_server_clusters(options) { return asBlocks.call( this, ensureClusters(this, options.hash.includeAll).getServerClusters(), - options + options, ); } @@ -135,7 +135,7 @@ function chip_client_clusters(options) { return asBlocks.call( this, ensureClusters(this, options.hash.includeAll).getClientClusters(), - options + options, ); } @@ -158,7 +158,7 @@ function chip_clusters(options) { return asBlocks.call( this, ensureClusters(this, options.hash.includeAll).getClusters(), - options + options, ); } @@ -190,7 +190,7 @@ async function if_basic_global_response(options) { attribute.isStruct || attribute.isArray; const responseTypeExists = globalResponses.find( - (item) => item.chipType == attribute.chipType + (item) => item.chipType == attribute.chipType, ); if (!complexType && responseTypeExists) { @@ -277,18 +277,18 @@ function chip_cluster_responses(options) { function chip_cluster_command_arguments(options) { const commandId = checkIsInsideCommandBlock( this, - 'chip_cluster_command_arguments' + 'chip_cluster_command_arguments', ); const commands = getCommands.call( this.parent, - 'chip_cluster_commands_argments' + 'chip_cluster_commands_argments', ); const filter = (command) => command.id == commandId; return asBlocks.call( this, commands.then((items) => items.find(filter).arguments), - options + options, ); } @@ -314,11 +314,11 @@ function chip_cluster_command_arguments(options) { function chip_cluster_command_arguments_with_structs_expanded(options) { const commandId = checkIsInsideCommandBlock( this, - 'chip_cluster_command_arguments' + 'chip_cluster_command_arguments', ); const commands = getCommands.call( this.parent, - 'chip_cluster_command_arguments_with_structs_expanded' + 'chip_cluster_command_arguments_with_structs_expanded', ); const filter = (command) => command.id == commandId; @@ -331,7 +331,7 @@ function chip_cluster_command_arguments_with_structs_expanded(options) { } return item.expandedArguments || item.arguments; }), - options + options, ); } @@ -346,18 +346,18 @@ function chip_cluster_command_arguments_with_structs_expanded(options) { function chip_cluster_response_arguments(options) { const commandId = checkIsInsideCommandBlock( this, - 'chip_cluster_response_arguments' + 'chip_cluster_response_arguments', ); const responses = getResponses.call( this.parent, - 'chip_cluster_responses_argments' + 'chip_cluster_responses_argments', ); const filter = (command) => command.id == commandId; return asBlocks.call( this, responses.then((items) => items.find(filter).arguments), - options + options, ); } @@ -372,7 +372,7 @@ function chip_cluster_response_arguments(options) { function chip_server_has_list_attributes(options) { const { clusterName } = checkIsInsideClusterBlock( this, - 'chip_server_has_list_attributes' + 'chip_server_has_list_attributes', ); const attributes = ensureClusters(this).getServerAttributes(clusterName); @@ -391,7 +391,7 @@ function chip_server_has_list_attributes(options) { function chip_client_has_list_attributes(options) { const { clusterName } = checkIsInsideClusterBlock( this, - 'chip_client_has_list_attributes' + 'chip_client_has_list_attributes', ); const attributes = ensureClusters(this).getClientAttributes(clusterName); @@ -410,7 +410,7 @@ function chip_client_has_list_attributes(options) { function chip_server_has_reportable_attributes(options) { const { clusterName } = checkIsInsideClusterBlock( this, - 'chip_server_has_reportable_attributes' + 'chip_server_has_reportable_attributes', ); const attributes = ensureClusters(this).getServerAttributes(clusterName); @@ -430,7 +430,7 @@ function chip_server_has_reportable_attributes(options) { function chip_server_cluster_attributes(options) { const { clusterName } = checkIsInsideClusterBlock( this, - 'chip_server_cluster_attributes' + 'chip_server_cluster_attributes', ); const attributes = ensureClusters(this).getServerAttributes(clusterName); @@ -449,7 +449,7 @@ function chip_server_cluster_attributes(options) { function chip_server_cluster_events(options) { const { clusterName } = checkIsInsideClusterBlock( this, - 'chip_server_cluster_events' + 'chip_server_cluster_events', ); const events = ensureClusters(this).getServerEvents(clusterName); @@ -471,7 +471,7 @@ function chip_attribute_list_entryTypes(options) { function chip_available_cluster_commands(options) { const { clusterName, clusterSide } = checkIsInsideClusterBlock( this, - 'chip_available_cluster_commands' + 'chip_available_cluster_commands', ); let promise = iteratorUtil.all_user_cluster_commands_helper .call(this, options) @@ -484,14 +484,14 @@ function chip_available_cluster_commands(options) { command.incoming, command.outgoing, command.commandSource, - command.name + command.name, ) && /* exclude MfgSpecificPing */ !command.mfgCode ); - }) + }), ) .then((filteredCommands) => - templateUtil.collectBlocks(filteredCommands, options, this) + templateUtil.collectBlocks(filteredCommands, options, this), ); return promise; } @@ -502,12 +502,11 @@ function chip_available_cluster_commands(options) { async function chip_cluster_specific_structs(options) { const { clusterName, clusterSide } = checkIsInsideClusterBlock( this, - 'chip_cluster_specific_structs' + 'chip_cluster_specific_structs', ); - const structs = await ensureClusters(this).getStructuresByClusterName( - clusterName - ); + const structs = + await ensureClusters(this).getStructuresByClusterName(clusterName); return templateUtil.collectBlocks(structs, options, this); } @@ -551,7 +550,7 @@ async function if_is_strongly_typed_bitmap(type, options) { bitmap = await queryZcl.selectBitmapByName( this.global.db, packageIds, - type + type, ); } else { bitmap = await queryZcl.selectBitmapById(this.global.db, type); @@ -561,7 +560,7 @@ async function if_is_strongly_typed_bitmap(type, options) { let a = await queryZcl.selectAtomicType( this.global.db, packageIds, - bitmap.name + bitmap.name, ); if (a) { // If this is an atomic type, it's a generic, weakly typed, bitmap. @@ -600,7 +599,7 @@ async function if_is_strongly_typed_chip_enum(type, options) { enumRes = await queryZcl.selectEnumByName( this.global.db, type, - packageIds + packageIds, ); } else { enumRes = await queryZcl.selectEnumById(this.global.db, type); @@ -612,7 +611,7 @@ async function if_is_strongly_typed_chip_enum(type, options) { let a = await queryZcl.selectAtomicType( this.global.db, packageIds, - enumRes.name + enumRes.name, ); if (a) { // if an enum has an atomic type that means it's a weakly-typed enum. @@ -677,7 +676,7 @@ async function chip_access_elements(options) { if (entityType == null) { throw new Error( - 'Access helper requires entityType, either from context, or from the entity="" option.' + 'Access helper requires entityType, either from context, or from the entity="" option.', ); } @@ -698,7 +697,7 @@ async function chip_access_elements(options) { case 'attribute': accessList = await queryAccess.selectAttributeAccess( this.global.db, - this.id + this.id, ); accessDefaults.set('read', 'view'); accessDefaults.set('write', 'operate'); @@ -706,7 +705,7 @@ async function chip_access_elements(options) { case 'command': accessList = await queryAccess.selectCommandAccess( this.global.db, - this.id + this.id, ); accessDefaults.set('invoke', 'operate'); break; @@ -716,7 +715,7 @@ async function chip_access_elements(options) { break; default: throw new Error( - `Entity type ${entityType} not supported. Requires: attribute/command/event.` + `Entity type ${entityType} not supported. Requires: attribute/command/event.`, ); } @@ -752,39 +751,39 @@ const dep = templateUtil.deprecatedHelper; // exports.chip_clusters = dep( chip_clusters, - 'chip_clusters has been deprecated. Use all_user_clusters.' + 'chip_clusters has been deprecated. Use all_user_clusters.', ); exports.chip_has_clusters = dep( chip_has_clusters, - 'Use first/last block helper within all_user_clusters.' + 'Use first/last block helper within all_user_clusters.', ); exports.chip_client_clusters = dep( chip_client_clusters, 'chip_client_clusters has been deprecated. Use all_user_clusters with the \ - side option as client.' + side option as client.', ); exports.chip_has_client_clusters = dep( chip_has_client_clusters, - 'chip_has_client_clusters has been deprecated. Use if_enabled_clusters with side option as client.' + 'chip_has_client_clusters has been deprecated. Use if_enabled_clusters with side option as client.', ); exports.chip_server_clusters = dep( chip_server_clusters, - 'chip_server_clusters has been deprecated. Use all_user_clusters with the side option as server.' + 'chip_server_clusters has been deprecated. Use all_user_clusters with the side option as server.', ); exports.chip_has_server_clusters = dep( chip_has_server_clusters, - 'chip_has_server_clusters has been deprecated. Use if_enabled_clusters with side option as server.' + 'chip_has_server_clusters has been deprecated. Use if_enabled_clusters with side option as server.', ); exports.chip_cluster_commands = dep( chip_cluster_commands, - 'chip_cluster_commands has been deprecated. Use zcl_commands with source attribute as client.' + 'chip_cluster_commands has been deprecated. Use zcl_commands with source attribute as client.', ); exports.chip_cluster_command_arguments = dep(chip_cluster_command_arguments, { to: 'zcl_command_arguments', }); exports.chip_cluster_command_arguments_with_structs_expanded = dep( chip_cluster_command_arguments_with_structs_expanded, - 'chip_cluster_command_arguments_with_structs_expanded has been deprecated. Use if_is_struct and zcl_struct_items_by_struct_name to expand the structs.' + 'chip_cluster_command_arguments_with_structs_expanded has been deprecated. Use if_is_struct and zcl_struct_items_by_struct_name to expand the structs.', ); exports.chip_server_global_responses = chip_server_global_responses; exports.chip_cluster_responses = dep(chip_cluster_responses, { @@ -792,38 +791,38 @@ exports.chip_cluster_responses = dep(chip_cluster_responses, { }); exports.chip_cluster_response_arguments = dep( chip_cluster_response_arguments, - 'chip_cluster_response_arguments has been deprecated. Use zcl_command_arguments.' + 'chip_cluster_response_arguments has been deprecated. Use zcl_command_arguments.', ); exports.chip_attribute_list_entryTypes = chip_attribute_list_entryTypes; exports.chip_server_cluster_attributes = dep( chip_server_cluster_attributes, 'chip_server_cluster_attributes has been deprecated. Use \ enabled_attributes_for_cluster_and_side and \ - zcl_attributes_server to get enabled and all server attributes respectively.' + zcl_attributes_server to get enabled and all server attributes respectively.', ); exports.chip_server_cluster_events = dep( chip_server_cluster_events, - 'chip_server_cluster_events has been deprecated. Use zcl_events.' + 'chip_server_cluster_events has been deprecated. Use zcl_events.', ); exports.chip_server_has_list_attributes = dep( chip_server_has_list_attributes, - 'chip_server_has_list_attributes has been deprecated. Use isArray option to fiter array type attributes and use first/last blocks for one time checks.' + 'chip_server_has_list_attributes has been deprecated. Use isArray option to fiter array type attributes and use first/last blocks for one time checks.', ); exports.chip_server_has_reportable_attributes = dep( chip_server_has_reportable_attributes, - 'chip_server_has_reportable_attributes has been deprecated. Use isReportableAttribute option to fiter reportable attributes and use first/last blocks for one time checks.' + 'chip_server_has_reportable_attributes has been deprecated. Use isReportableAttribute option to fiter reportable attributes and use first/last blocks for one time checks.', ); exports.chip_available_cluster_commands = dep( chip_available_cluster_commands, - 'chip_available_cluster_commands has been deprecated. Use zcl_commands or all_user_cluster_generated_commands.' + 'chip_available_cluster_commands has been deprecated. Use zcl_commands or all_user_cluster_generated_commands.', ); exports.chip_endpoints = dep( chip_endpoints, - 'chip_endpoints has been deprecated. Use user_endpoints.' + 'chip_endpoints has been deprecated. Use user_endpoints.', ); exports.chip_endpoint_clusters = dep( chip_endpoint_clusters, - 'chip_endpoint_clusters has been deprecated. Use user_clusters or all_user_clusters.' + 'chip_endpoint_clusters has been deprecated. Use user_clusters or all_user_clusters.', ); exports.if_chip_enum = if_chip_enum; exports.if_chip_complex = if_chip_complex; @@ -832,11 +831,11 @@ exports.if_basic_global_response = dep(if_basic_global_response, { }); exports.chip_cluster_specific_structs = dep( chip_cluster_specific_structs, - 'chip_cluster_specific_structs has been deprecated. Use zcl_structs.' + 'chip_cluster_specific_structs has been deprecated. Use zcl_structs.', ); exports.chip_shared_structs = dep( chip_shared_structs, - 'chip_shared_structs has been deprecated. Use zcl_structs along with has_more_than_one_cluster attribute.' + 'chip_shared_structs has been deprecated. Use zcl_structs along with has_more_than_one_cluster attribute.', ); exports.chip_access_elements = chip_access_elements; exports.if_is_strongly_typed_chip_enum = if_is_strongly_typed_chip_enum; diff --git a/src-electron/generator/matter/chip-tool/templates/helper.js b/src-electron/generator/matter/chip-tool/templates/helper.js index 700b964063..fd58d8b6bf 100644 --- a/src-electron/generator/matter/chip-tool/templates/helper.js +++ b/src-electron/generator/matter/chip-tool/templates/helper.js @@ -117,7 +117,7 @@ async function structs_with_cluster_name(options) { const structs = await zclQuery.selectAllStructsWithItems( this.global.db, - packageIds + packageIds, ); let blocks = []; @@ -129,7 +129,7 @@ async function structs_with_cluster_name(options) { if (s.struct_cluster_count == 1) { const clusters = await zclQuery.selectStructClusters( this.global.db, - s.id + s.id, ); blocks.push({ id: s.id, @@ -170,19 +170,19 @@ const dep = templateUtil.deprecatedHelper; // exports.asDelimitedCommand = dep( asDelimitedCommand, - 'asDelimitedCommand has been deprecated. Use cleanse_label_as_kebab_case instead' + 'asDelimitedCommand has been deprecated. Use cleanse_label_as_kebab_case instead', ); exports.asTypeMinValue = dep( asTypeMinValue, - 'asTypeMinValue has been deprecated. Use as_type_min_value instead' + 'asTypeMinValue has been deprecated. Use as_type_min_value instead', ); exports.asTypeMaxValue = dep( asTypeMaxValue, - 'asTypeMaxValue has been deprecated. Use as_type_max_value instead' + 'asTypeMaxValue has been deprecated. Use as_type_max_value instead', ); exports.structs_with_cluster_name = dep( structs_with_cluster_name, - 'structs_with_cluster_name has been deprecated. Use structs_with_clusters instead' + 'structs_with_cluster_name has been deprecated. Use structs_with_clusters instead', ); exports.assertSameTestType = assertSameTestType; diff --git a/src-electron/generator/matter/chip-tool/templates/tests/helper.js b/src-electron/generator/matter/chip-tool/templates/tests/helper.js index d406af4eb8..79386d3f03 100644 --- a/src-electron/generator/matter/chip-tool/templates/tests/helper.js +++ b/src-electron/generator/matter/chip-tool/templates/tests/helper.js @@ -73,7 +73,7 @@ async function asEncodableType() { if (isTestOnlyCluster(this.cluster) || 'commandObject' in this) { return `chip::app::Clusters::${asUpperCamelCase( - this.cluster + this.cluster, )}::Commands::${asUpperCamelCase(type)}::Type`; } @@ -101,7 +101,7 @@ async function asDecodableType() { if (isTestOnlyCluster(this.cluster) || 'commandObject' in this) { return `chip::app::Clusters::${asUpperCamelCase( - this.cluster + this.cluster, )}::Commands::${asUpperCamelCase(type)}::DecodableType`; } diff --git a/src-electron/generator/matter/controller/java/templates/helper.js b/src-electron/generator/matter/controller/java/templates/helper.js index 47632fedae..51bf0f6c1d 100644 --- a/src-electron/generator/matter/controller/java/templates/helper.js +++ b/src-electron/generator/matter/controller/java/templates/helper.js @@ -97,7 +97,7 @@ function asJavaBoxedType(type, zclType) { } else { try { return convertBasicCTypeToJavaBoxedType( - ChipTypesHelper.asBasicType(zclType) + ChipTypesHelper.asBasicType(zclType), ); } catch (error) { // Unknown type, default to Object. @@ -123,7 +123,7 @@ function asJniBasicType(type, useBoxedTypes) { .then((zclType) => { return convertBasicCTypeToJniType( ChipTypesHelper.asBasicType(zclType), - false + false, ); }); } @@ -146,7 +146,7 @@ function asJniSignatureBasic(type, useBoxedTypes) { .then((zclType) => { return convertCTypeToJniSignature( ChipTypesHelper.asBasicType(zclType), - useBoxedTypes + useBoxedTypes, ); }); } @@ -224,7 +224,7 @@ async function as_underlying_java_zcl_type_util( type, clusterId, options, - context + context, ) { let hash = options.hash; // Overwrite any type with the one coming from the template options @@ -240,7 +240,7 @@ async function as_underlying_java_zcl_type_util( context.global.db, type, clusterId, - packageIds + packageIds, ); if (!dataType) { @@ -266,7 +266,7 @@ async function as_underlying_java_zcl_type_util( dataType, clusterId, packageIds, - context + context, ); if (sizeAndSign.size >= 3) { return 'Long'; @@ -329,7 +329,7 @@ async function asJavaType(type, zclType, cluster, options) { classType += 'String'; } else if (isStruct) { classType += `ChipStructs.${appHelper.asUpperCamelCase( - cluster + cluster, )}Cluster${appHelper.asUpperCamelCase(type)}`; } else { let javaBoxedType = asJavaBoxedType(type, zclType); @@ -338,7 +338,7 @@ async function asJavaType(type, zclType, cluster, options) { type, options.hash.clusterId, options, - this + this, ); } classType += javaBoxedType; @@ -431,7 +431,7 @@ async function asJniHelper(type, zclType, cluster, options) { if (isStruct) { const signature = `Lchip/devicecontroller/ChipStructs$${appHelper.asUpperCamelCase( - cluster + cluster, )}Cluster${appHelper.asUpperCamelCase(type)};`; return { jniType: 'jobject', @@ -455,7 +455,7 @@ async function asJniHelper(type, zclType, cluster, options) { // Example: Ljava/lang/Integer; -> java/lang/Integer, needed for JNI class lookup let jniClassName = jniBoxedSignature.substring( 1, - jniBoxedSignature.length - 1 + jniBoxedSignature.length - 1, ); return { jniType: asJniBasicType(type, true), @@ -497,7 +497,7 @@ async function if_basic_attribute(type, clusterId, options) { this.global.db, type, clusterId, - packageIds + packageIds, ); if (struct) { return options.inverse(this); @@ -524,7 +524,7 @@ async function if_unsupported_attribute_callback( type, isArray, clusterId, - options + options, ) { let struct = null; if (isArray) { @@ -535,7 +535,7 @@ async function if_unsupported_attribute_callback( this.global.db, type, clusterId, - packageIds + packageIds, ); if (struct) { return options.fn(this); @@ -565,7 +565,7 @@ exports.convertCTypeToJniSignature = convertCTypeToJniSignature; exports.convertBasicCTypeToJavaBoxedType = convertBasicCTypeToJavaBoxedType; exports.convertAttributeCallbackTypeToJavaName = dep( convertAttributeCallbackTypeToJavaName, - { to: 'as_underlying_java_zcl_type' } + { to: 'as_underlying_java_zcl_type' }, ); exports.incrementDepth = incrementDepth; diff --git a/src-electron/generator/matter/controller/python/templates/helper.js b/src-electron/generator/matter/controller/python/templates/helper.js index de12a955c8..f3ab84ee60 100644 --- a/src-electron/generator/matter/controller/python/templates/helper.js +++ b/src-electron/generator/matter/controller/python/templates/helper.js @@ -77,7 +77,7 @@ async function as_underlying_python_zcl_type(type, clusterId, options) { this.global.db, type, clusterId, - packageIds + packageIds, ); if (type && type.toLowerCase() == 'boolean') { return 'bool'; diff --git a/src-electron/generator/matter/copy-from-sdk.js b/src-electron/generator/matter/copy-from-sdk.js index 3229b323e8..ab8bf60d75 100644 --- a/src-electron/generator/matter/copy-from-sdk.js +++ b/src-electron/generator/matter/copy-from-sdk.js @@ -27,7 +27,7 @@ let args = process.argv.slice(2); if (args[0] == null) { console.log( - 'Usage: node copy-from-sdk.js [all|examples|src]' + 'Usage: node copy-from-sdk.js [all|examples|src]', ); process.exit(1); } diff --git a/src-electron/generator/matter/darwin/Framework/CHIP/templates/helper.js b/src-electron/generator/matter/darwin/Framework/CHIP/templates/helper.js index f521834792..fdc3e72562 100644 --- a/src-electron/generator/matter/darwin/Framework/CHIP/templates/helper.js +++ b/src-electron/generator/matter/darwin/Framework/CHIP/templates/helper.js @@ -65,13 +65,13 @@ async function asTypedExpressionFromObjectiveC(value, type) { } else { const variableType = TestHelper.chip_tests_variables_get_type.call( this, - token + token, ); const asType = await asObjectiveCNumberType.call( this, token, variableType, - true + true, ); expr[i] = `[${token} ${asType}Value]`; } @@ -124,7 +124,7 @@ function asObjectiveCNumberType(label, type, asLowerCased) { .then((typeName) => asLowerCased ? typeName[0].toLowerCase() + typeName.substring(1) - : typeName + : typeName, ); } @@ -243,7 +243,7 @@ async function asObjectiveCClass(type, cluster, options) { const structObj = await zclQuery.selectStructByName( this.global.db, type, - pkgIds + pkgIds, ); if (structObj.structClusterCount == 0) { // This is a global struct. @@ -414,7 +414,7 @@ function fetchAvailabilityData(global) { availabilityData = YAML.parse(rawData); } else { throw new Error( - `Resource availability-data not found among the context resources. Check your template.json file.` + `Resource availability-data not found among the context resources. Check your template.json file.`, ); } } @@ -436,7 +436,7 @@ function findDataForPath(availabilityData, path) { if (foundData !== undefined) { throw new Error( - `Found two releases matching path: ${JSON.stringify(path)}` + `Found two releases matching path: ${JSON.stringify(path)}`, ); } @@ -497,7 +497,7 @@ function findReleaseForPath(availabilityData, path, options) { if (currentContainer.includes(item)) { if (foundRelease !== undefined) { throw new Error( - `Found two releases matching path: ${JSON.stringify(path)}` + `Found two releases matching path: ${JSON.stringify(path)}`, ); } @@ -630,7 +630,7 @@ function findPathToContainer(availabilityPath) { default: throw `Don't know how to find container for path '${JSON.stringify( - availabilityPath + availabilityPath, )}'`; } } @@ -652,14 +652,14 @@ function findDeprecationRelease(global, path, options) { deprecatedRelease = findReleaseForPath( data, ['deprecated', ...deprecationPath], - options + options, ); deprecationPath = findPathToContainer(deprecationPath); } if (options.hash.deprecatedRelease) { let minimalDeprecatedRelease = findReleaseByName( data, - options.hash.deprecatedRelease + options.hash.deprecatedRelease, ); if ( deprecatedRelease === undefined || @@ -684,14 +684,14 @@ async function availabilityHelper(clusterName, language, options) { // depends on the type. if (options.hash.deprecationMessage) { throw new Error( - `Should not specify deprecationMessage along with fabricScopedDeprecationMessage and nonFabricScopedDeprecationMessage` + `Should not specify deprecationMessage along with fabricScopedDeprecationMessage and nonFabricScopedDeprecationMessage`, ); } let packageIds = await templateUtil.ensureZclPackageIds(this); let st = await zclQuery.selectStructByName( this.global.db, options.hash.type, - packageIds + packageIds, ); if (st && st.isFabricScoped) { options.hash.deprecationMessage = @@ -705,7 +705,7 @@ async function availabilityHelper(clusterName, language, options) { let introducedRelease = findReleaseForPath( data, ['introduced', ...path], - options + options, ); if (introducedRelease !== undefined && options.hash.minimalRelease) { let minimalRelease = findReleaseByName(data, options.hash.minimalRelease); @@ -724,8 +724,8 @@ async function availabilityHelper(clusterName, language, options) { if (introducedVersions === undefined && deprecatedVersions !== undefined) { throw new Error( `Found deprecation but no introduction for: '${clusterName}' '${JSON.stringify( - options.hash - )}'` + options.hash, + )}'`, ); } @@ -734,13 +734,13 @@ async function availabilityHelper(clusterName, language, options) { this.global, clusterName, options, - 'provisional' + 'provisional', ); if (!provisionalRelease) { console.log( `WARNING: Missing "introduced" or "provisional" entry for: '${clusterName}' '${JSON.stringify( - options.hash - )}'` + options.hash, + )}'`, ); } } @@ -764,7 +764,7 @@ async function availabilityHelper(clusterName, language, options) { } throw new Error( - `Unknown language ${language}; cannot determine availability syntax.` + `Unknown language ${language}; cannot determine availability syntax.`, ); })(); @@ -795,14 +795,14 @@ async function availabilityHelper(clusterName, language, options) { if (deprecatedVersions === undefined) { if (language == 'ObjC') { let availabilityStrings = Object.entries(introducedVersions).map( - ([os, version]) => `${os.toLowerCase()}(${version})` + ([os, version]) => `${os.toLowerCase()}(${version})`, ); return `MTR_AVAILABLE(${availabilityStrings.join(', ')})`; } if (language == 'Swift') { let availabilityStrings = Object.entries(introducedVersions).map( - ([os, version]) => `${os} ${version}` + ([os, version]) => `${os} ${version}`, ); // For now, we are stuck with Swift versions in Matter CI that do not // support wrapping attributes in conditional compilation. @@ -824,17 +824,17 @@ async function availabilityHelper(clusterName, language, options) { if (!options.hash.deprecationMessage) { throw new Error( `Deprecation needs a deprecation message for ${clusterName} and ${JSON.stringify( - options.hash - )} (${this.global.templatePath}:${options.loc.start.line})` + options.hash, + )} (${this.global.templatePath}:${options.loc.start.line})`, ); } if (deprecatedVersions === 'future') { let availabilityStrings = Object.entries(introducedVersions).map( - ([os, version]) => `${os.toLowerCase()}(${version})` + ([os, version]) => `${os.toLowerCase()}(${version})`, ); return `MTR_AVAILABLE(${availabilityStrings.join( - ', ' + ', ', )})\nMTR_NEWLY_DEPRECATED("${options.hash.deprecationMessage}")`; } @@ -845,10 +845,10 @@ async function availabilityHelper(clusterName, language, options) { if (!introducedOSes.includes(os)) { throw new Error( `Deprecation versions '${JSON.stringify( - deprecatedVersions + deprecatedVersions, )}' include an OS that introduction versions '${JSON.stringify( - introducedVersions - )}' do not include: '${os}'.` + introducedVersions, + )}' do not include: '${os}'.`, ); } } @@ -856,10 +856,10 @@ async function availabilityHelper(clusterName, language, options) { if (!deprecatedOSes.includes(os)) { throw new Error( `Deprecation versions '${JSON.stringify( - deprecatedVersions + deprecatedVersions, )}' do not include an OS that introduction versions '${JSON.stringify( - introducedVersions - )}' include: '${os}'.` + introducedVersions, + )}' include: '${os}'.`, ); } } @@ -867,7 +867,7 @@ async function availabilityHelper(clusterName, language, options) { let swiftUnavailableRelease = findReleaseForPath( data, ['swiftUnavailable', ...path], - options + options, ); let swiftUnavailable; if (swiftUnavailableRelease == undefined) { @@ -878,7 +878,7 @@ async function availabilityHelper(clusterName, language, options) { let availabilityStrings = Object.entries(introducedVersions).map( ([os, version]) => - `${os.toLowerCase()}(${version}, ${deprecatedVersions[os]})` + `${os.toLowerCase()}(${version}, ${deprecatedVersions[os]})`, ); return `MTR_DEPRECATED("${ options.hash.deprecationMessage @@ -906,7 +906,7 @@ function compareIntroductionToReferenceRelease( global, path, options, - referenceRelease + referenceRelease, ) { if (referenceRelease === undefined) { throw new Error("Can't compare to non-existent release"); @@ -917,7 +917,7 @@ function compareIntroductionToReferenceRelease( let introducedRelease = findReleaseForPath( data, ['introduced', ...path], - options + options, ); if (introducedRelease === undefined) { return undefined; @@ -949,7 +949,7 @@ function wasIntroducedBeforeRelease(releaseName, clusterName, options) { this.global, makeAvailabilityPath(clusterName, options), options, - referenceRelease + referenceRelease, ); if (comparisonStatus === undefined) { // Not introduced yet, so not introduced before anything in particular. @@ -969,7 +969,7 @@ function findReleaseForPathOrAncestorAndSection( global, cluster, options, - section + section, ) { const data = fetchAvailabilityData(global); let path = makeAvailabilityPath(cluster, options); @@ -990,7 +990,7 @@ function wasRemoved(cluster, options) { this.global, cluster, options, - 'removed' + 'removed', ) !== undefined ); } @@ -1021,14 +1021,14 @@ function isSupported(cluster, options) { let deprecationRelease = findDeprecationRelease( this.global, findPathToContainer(path), - options + options, ); if (deprecationRelease !== undefined) { let comparisonStatus = compareIntroductionToReferenceRelease( this.global, path, options, - deprecationRelease + deprecationRelease, ); // The only case where we might be supported is if we have an explicit // introduction and the introduction comes before the ancestor deprecation. @@ -1045,7 +1045,7 @@ function findProvisionalRelease(global, cluster, options) { global, cluster, options, - 'provisional' + 'provisional', ); if (provisionalRelease !== undefined) { return provisionalRelease; @@ -1073,7 +1073,7 @@ function findProvisionalRelease(global, cluster, options) { globalAttribute: attrName, }, }, - 'provisional' + 'provisional', ); } @@ -1084,7 +1084,7 @@ function isProvisional(cluster, options) { let introducedRelease = findReleaseForPath( data, ['introduced', ...path], - options + options, ); if (introducedRelease == undefined) { @@ -1095,7 +1095,7 @@ function isProvisional(cluster, options) { let provisionalRelease = findProvisionalRelease( this.global, cluster, - options + options, ); if (provisionalRelease === undefined) { return false; @@ -1106,7 +1106,7 @@ function isProvisional(cluster, options) { this.global, path, options, - provisionalRelease.release + provisionalRelease.release, ); // If we have an explicit introduction for something that is at the scope of @@ -1159,8 +1159,8 @@ function hasRenamedFields(cluster, options) { } else { throw new Error( `hasRenamedFields called for a non-container object: ${cluster} '${JSON.stringify( - options.hash - )}'` + options.hash, + )}'`, ); } @@ -1186,7 +1186,7 @@ function and() { return args.reduce((running, current) => { if (current instanceof Promise) { throw new Error( - "Promise passed as argument to 'and'. You probably want to use async_if/async_and" + "Promise passed as argument to 'and'. You probably want to use async_if/async_and", ); } return running && current; @@ -1201,7 +1201,7 @@ function or() { return args.reduce((running, current) => { if (current instanceof Promise) { throw new Error( - "Promise passed as argument to 'or'. You probably want to use async_if/async_or" + "Promise passed as argument to 'or'. You probably want to use async_if/async_or", ); } return running || current; @@ -1211,7 +1211,7 @@ function or() { function not(value) { if (value instanceof Promise) { throw new Error( - "Promise passed as argument to 'not'. You probably want to use async_if/async_not" + "Promise passed as argument to 'not'. You probably want to use async_if/async_not", ); } diff --git a/src-electron/generator/template-engine.js b/src-electron/generator/template-engine.js index 4695b58db9..ed0bc8c739 100644 --- a/src-electron/generator/template-engine.js +++ b/src-electron/generator/template-engine.js @@ -109,12 +109,12 @@ async function produceIterativeContent( options = { overridePath: null, disableDeprecationWarnings: false, - } + }, ) { let iterationArray = await templateIterators.getIterativeObject( singleTemplatePkg.iterator, db, - sessionId + sessionId, ) let res = [] for (let it of iterationArray) { @@ -127,7 +127,7 @@ async function produceIterativeContent( sessionId, singleTemplatePkg, genTemplateJsonPackage, - options + options, ) res.push(...r) } @@ -157,7 +157,7 @@ async function produceContent( overrideKey: null, disableDeprecationWarnings: false, initialContext: null, - } + }, ) { let template = await produceCompiledTemplate(hb, singleTemplatePkg) let context = { @@ -180,7 +180,7 @@ async function produceContent( 'UPGRADE', 'Resource "${key}" not found among the context resources. Check your template.json file. You may need a Matter SDK upgrade.', sessionId, - 1 + 1, ) return null } @@ -313,7 +313,7 @@ function loadHelper(hb, helpers, context = null) { helper.executeHelperFunction( helper.functions.initialize_helpers, context, - helpers + helpers, ) helpers = nativeRequire(helpers) } @@ -400,7 +400,7 @@ function initializeBuiltInHelpersForPackage( included = { aliases: [], categories: [], - } + }, ) { includedHelpers.forEach((helperPkg) => { let hasMatchingCategory = false @@ -413,7 +413,7 @@ function initializeBuiltInHelpersForPackage( // Let's check if category matches. if (helperPkg.meta.category != null) { hasMatchingCategory = included.categories.includes( - helperPkg.meta.category + helperPkg.meta.category, ) } if (helperPkg.meta.alias != null && helperPkg.meta.alias.length > 0) { diff --git a/src-electron/generator/template-iterators.js b/src-electron/generator/template-iterators.js index c886617094..12154136d3 100644 --- a/src-electron/generator/template-iterators.js +++ b/src-electron/generator/template-iterators.js @@ -49,7 +49,7 @@ async function selectedClientClusterIterator(db, sessionId) { return queryEndpointType.selectAllClustersDetailsFromEndpointTypes( db, epts, - dbEnums.side.client + dbEnums.side.client, ) } @@ -59,7 +59,7 @@ async function selectedServerClusterIterator(db, sessionId) { return queryEndpointType.selectAllClustersDetailsFromEndpointTypes( db, epts, - dbEnums.side.server + dbEnums.side.server, ) } @@ -71,7 +71,7 @@ async function getIterativeObject(iteratorName, db, sessionId) { } else { let validValues = Object.keys(iterators).join(', ') throw new Error( - `Invalid value for iterator: ${iteratorName}. Valid values: ${validValues}` + `Invalid value for iterator: ${iteratorName}. Valid values: ${validValues}`, ) } } diff --git a/src-electron/generator/template-util.js b/src-electron/generator/template-util.js index 8a4d8a5541..c058493a20 100644 --- a/src-electron/generator/template-util.js +++ b/src-electron/generator/template-util.js @@ -51,7 +51,7 @@ function makeSynchronizablePromise(promise) { isRejected = true isPending = false throw rejectionError - } + }, ) // Inject check functions. @@ -98,7 +98,7 @@ async function collectBlocks(resultArray, options, context) { options.inverse({ global: context.global, parent: context, - }) + }), ) } @@ -124,7 +124,7 @@ async function ensureZclPackageId(context) { let pkgs = await queryPackage.getSessionPackagesByType( context.global.db, context.global.sessionId, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) if (pkgs.length == 0) { return null @@ -161,7 +161,7 @@ async function ensureZclPackageIds(context) { if (zclPkg == null) { zclPkg = await queryPackage.getPackageByPackageId( context.global.db, - pkgIds[i] + pkgIds[i], ) context.global.packageCache.set(pkgIds[i], zclPkg) } @@ -179,7 +179,7 @@ async function ensureZclPackageIds(context) { } else { let pkgs = await queryPackage.getSessionZclPackageIds( context.global.db, - context.global.sessionId + context.global.sessionId, ) if (!packageCategory) { context.global.zclPackageIds = pkgs @@ -188,7 +188,7 @@ async function ensureZclPackageIds(context) { for (let i = 0; i < pkgs.length; i++) { let zclPkg = await queryPackage.getPackageByPackageId( context.global.db, - pkgs[i] + pkgs[i], ) // Checking for category match or custom xml if ( @@ -239,7 +239,7 @@ async function ensureTemplatePackageId(context) { let pkgs = await queryPackage.getSessionPackagesByType( context.global.db, context.global.sessionId, - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) if (pkgs.length == 0) { return null @@ -272,7 +272,7 @@ async function ensureEndpointTypeIds(context) { let deviceTypes = await queryDeviceType.selectDeviceTypesByEndpointTypeId( context.global.db, - eptIds[i].endpointTypeId + eptIds[i].endpointTypeId, ) // Sometimes a device type cannot be found for an endpoint type(undefined) if (deviceTypes.length == 0) { @@ -282,12 +282,12 @@ async function ensureEndpointTypeIds(context) { // Get device info let deviceType = await queryDeviceType.selectDeviceTypeById( context.global.db, - deviceTypes[j].deviceTypeRef + deviceTypes[j].deviceTypeRef, ) // Get package information to see the category of the device type let packageInfo = await queryPackage.getPackageByPackageId( context.global.db, - deviceType.packageRef + deviceType.packageRef, ) // Check for package category match based on gen template category and add it to relevant endpoint types if ( @@ -306,7 +306,7 @@ async function ensureEndpointTypeIds(context) { } else { let eptIds = await queryEndpointType.selectEndpointTypeIds( context.global.db, - context.global.sessionId + context.global.sessionId, ) if (!packageCategory) { context.global.endpointTypeIds = eptIds @@ -316,7 +316,7 @@ async function ensureEndpointTypeIds(context) { let deviceTypes = await queryDeviceType.selectDeviceTypesByEndpointTypeId( context.global.db, - eptIds[i].endpointTypeId + eptIds[i].endpointTypeId, ) // Sometimes a device type cannot be found for an endpoint type(undefined) if (deviceTypes.length == 0) { @@ -326,11 +326,11 @@ async function ensureEndpointTypeIds(context) { for (let j = 0; j < deviceTypes.length; j++) { let deviceType = await queryDeviceType.selectDeviceTypeById( context.global.db, - deviceTypes[j].deviceTypeRef + deviceTypes[j].deviceTypeRef, ) let packageInfo = await queryPackage.getPackageByPackageId( context.global.db, - deviceType.packageRef + deviceType.packageRef, ) if ( packageInfo.category == packageCategory || @@ -364,7 +364,7 @@ async function ensureZclClusterSdkExtensions(context, templatePackageId) { let extensions = await queryPackage.selectPackageExtension( context.global.db, templatePackageId, - dbEnum.packageExtensionEntity.cluster + dbEnum.packageExtensionEntity.cluster, ) context.global.zclClusterSdkExtension = extensions return extensions @@ -386,7 +386,7 @@ async function ensureZclDeviceTypeSdkExtensions(context, templatePackageId) { let extensions = await queryPackage.selectPackageExtension( context.global.db, templatePackageId, - dbEnum.packageExtensionEntity.deviceType + dbEnum.packageExtensionEntity.deviceType, ) context.global.zclDeviceTypeExtension = extensions return extensions @@ -408,7 +408,7 @@ async function ensureZclAttributeSdkExtensions(context, templatePackageId) { let extensions = await queryPackage.selectPackageExtension( context.global.db, templatePackageId, - dbEnum.packageExtensionEntity.attribute + dbEnum.packageExtensionEntity.attribute, ) context.global.zclAttributeSdkExtension = extensions return extensions @@ -430,7 +430,7 @@ async function ensureZclAttributeTypeSdkExtensions(context, templatePackageId) { let extensions = await queryPackage.selectPackageExtension( context.global.db, templatePackageId, - dbEnum.packageExtensionEntity.attributeType + dbEnum.packageExtensionEntity.attributeType, ) context.global.zclAttributeTypeSdkExtension = extensions return extensions @@ -452,7 +452,7 @@ async function ensureZclCommandSdkExtensions(context, templatePackageId) { let extensions = await queryPackage.selectPackageExtension( context.global.db, templatePackageId, - dbEnum.packageExtensionEntity.command + dbEnum.packageExtensionEntity.command, ) context.global.zclCommandSdkExtension = extensions return extensions @@ -474,7 +474,7 @@ async function ensureZclEventSdkExtensions(context, templatePackageId) { let extensions = await queryPackage.selectPackageExtension( context.global.db, templatePackageId, - dbEnum.packageExtensionEntity.event + dbEnum.packageExtensionEntity.event, ) context.global.zclEventSdkExtension = extensions return extensions diff --git a/src-electron/ide-integration/studio-rest-api.js b/src-electron/ide-integration/studio-rest-api.js index 752abff116..0457f5db5a 100644 --- a/src-electron/ide-integration/studio-rest-api.js +++ b/src-electron/ide-integration/studio-rest-api.js @@ -56,7 +56,7 @@ async function projectPath(db, sessionId) { return querySession.getSessionKeyValue( db, sessionId, - dbEnum.sessionKey.ideProjectPath + dbEnum.sessionKey.ideProjectPath, ) } @@ -70,7 +70,7 @@ async function integrationEnabled(db, sessionId) { let path = await querySession.getSessionKeyValue( db, sessionId, - dbEnum.sessionKey.ideProjectPath + dbEnum.sessionKey.ideProjectPath, ) return typeof path !== 'undefined' } @@ -89,7 +89,7 @@ async function isComponentTogglingDisabled(db, sessionId) { let disableComponentToggling = await querySession.getSessionKeyValue( db, sessionId, - dbEnum.sessionKey.disableComponentToggling + dbEnum.sessionKey.disableComponentToggling, ) // We may have an empty row or a 0 or a 1. Only 1 means that this is disabled. return disableComponentToggling === 1 @@ -161,7 +161,7 @@ async function getProjectInfo(db, sessionId) { } else { if (!isUserDisabled) env.logWarning( - `StudioUC(): Invalid Studio project path specified via project info API!` + `StudioUC(): Invalid Studio project path specified via project info API!`, ) return { data: [] } } @@ -186,13 +186,13 @@ async function updateComponentByClusterIdAndComponentId( componentIds, clusterId, add, - side + side, ) { if (!integrationEnabled(db, sessionId)) { let isUserDisabled = await isComponentTogglingDisabled(db, sessionId) if (!isUserDisabled) { env.logWarning( - `StudioUC(): Failed to update component due to invalid Studio project path.` + `StudioUC(): Failed to update component due to invalid Studio project path.`, ) queryNotification.setNotification( db, @@ -200,7 +200,7 @@ async function updateComponentByClusterIdAndComponentId( `StudioUC(): Failed to update component due to invalid Studio project path.`, sessionId, 2, - 0 + 0, ) } return Promise.resolve({ componentIds: [], added: add }) @@ -213,7 +213,7 @@ async function updateComponentByClusterIdAndComponentId( db, sessionId, clusterId, - side + side, ) promises.push(...ids.map((x) => Promise.resolve(x))) @@ -251,7 +251,7 @@ async function updateComponentByComponentIds(db, sessionId, componentIds, add) { if (Object.keys(componentIds).length) { promises = componentIds.map((componentId) => - httpPostComponentUpdate(project, componentId, add) + httpPostComponentUpdate(project, componentId, add), ) } @@ -263,7 +263,7 @@ async function updateComponentByComponentIds(db, sessionId, componentIds, add) { status: resp.status, data: resp.data, } - }) + }), ) } @@ -322,14 +322,14 @@ async function wsMessageHandler(db, session, message) { if (resp.msgType == 'updateComponents') { env.logInfo( `StudioUC(${name}): Received WebSocket message: ${JSON.stringify( - resp.delta - )}` + resp.delta, + )}`, ) sendSelectedUcComponents(db, session, JSON.parse(resp.tree)) } } catch (error) { env.logError( - `StudioUC(${name}): Failed to process WebSocket notification message.` + `StudioUC(${name}): Failed to process WebSocket notification message.`, ) } } @@ -493,7 +493,7 @@ function sendSessionCreationErrorStatus(db, err, sessionId) { }) } } - }) + }), ) } diff --git a/src-electron/ide-integration/zcl-components.js b/src-electron/ide-integration/zcl-components.js index bfb2c9a72e..7c9fcb6ca9 100644 --- a/src-electron/ide-integration/zcl-components.js +++ b/src-electron/ide-integration/zcl-components.js @@ -40,7 +40,7 @@ async function getComponentIdsByCluster(db, sessionId, clusterId, side) { let pkgs = await queryPackage.getSessionPackagesByType( db, sessionId, - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) let id = pkgs.length == 0 ? null : pkgs[0].id if (id == null) { @@ -50,7 +50,7 @@ async function getComponentIdsByCluster(db, sessionId, clusterId, side) { let extensions = await queryPackage.selectPackageExtension( db, id, - dbEnum.packageExtensionEntity.cluster + dbEnum.packageExtensionEntity.cluster, ) try { let cluster = await queryZcl.selectClusterById(db, clusterId) @@ -61,7 +61,7 @@ async function getComponentIdsByCluster(db, sessionId, clusterId, side) { let ids = util.getClusterExtensionDefault( extensions, 'component', - clusterKey + clusterKey, ) if (ids) { ids = ids.split(',').map((x) => x.trim()) @@ -76,7 +76,7 @@ async function getComponentIdsByCluster(db, sessionId, clusterId, side) { } catch (err) { env.logWarning( `Failed to retrieve component ids required by clusterId(${clusterId}) from cluster extension mapping.`, - err + err, ) return [] } diff --git a/src-electron/importexport/export.js b/src-electron/importexport/export.js index a1559adc31..3b70c02eeb 100644 --- a/src-electron/importexport/export.js +++ b/src-electron/importexport/export.js @@ -32,7 +32,7 @@ const ff = require('./file-format') async function exportEndpointType(db, endpointType) { let data = await queryImpExp.exportClustersFromEndpointType( db, - endpointType.endpointTypeId + endpointType.endpointTypeId, ) endpointType.clusters = data @@ -44,7 +44,7 @@ async function exportEndpointType(db, endpointType) { await queryImpExp.exportCommandsFromEndpointTypeCluster( db, endpointType.endpointTypeId, - endpointClusterId + endpointClusterId, ) if (endpointCluster.commands.length == 0) { delete endpointCluster.commands @@ -52,7 +52,7 @@ async function exportEndpointType(db, endpointType) { endpointCluster.attributes = await queryImpExp.exportAttributesFromEndpointTypeCluster( db, - endpointClusterId + endpointClusterId, ) if (endpointCluster.attributes.length == 0) { delete endpointCluster.attributes @@ -60,7 +60,7 @@ async function exportEndpointType(db, endpointType) { endpointCluster.events = await queryImpExp.exportEventsFromEndpointTypeCluster( db, - endpointClusterId + endpointClusterId, ) if (endpointCluster.events.length == 0) { delete endpointCluster.events @@ -81,7 +81,7 @@ async function exportEndpointTypes(db, sessionId) { let endpointTypes = await queryImpExp.exportEndpointTypes(db, sessionId) let promises = endpointTypes.map((endpointType) => - exportEndpointType(db, endpointType) + exportEndpointType(db, endpointType), ) await Promise.all(promises) @@ -89,7 +89,7 @@ async function exportEndpointTypes(db, sessionId) { let endpoints = await queryImpExp.exportEndpoints( db, sessionId, - endpointTypes + endpointTypes, ) endpointTypes.forEach((ept) => { @@ -155,7 +155,7 @@ async function exportDataIntoFile( options = { removeLog: false, createBackup: false, - } + }, ) { let fileFormat = env.defaultFileFormat() @@ -169,7 +169,7 @@ async function exportDataIntoFile( // avoid unncessary Studio integration id from being saved in file. if (state.keyValuePairs) { state.keyValuePairs = state.keyValuePairs.filter( - (x) => x.key != dbEnum.sessionKey.ideProjectPath + (x) => x.key != dbEnum.sessionKey.ideProjectPath, ) } state = ff.convertToFile(state) @@ -195,7 +195,7 @@ async function getSessionKeyValues(db, sessionId, excludedKeys) { env.logDebug(`Retrieved session keys: ${keyValues.length}`) let zapFilePath = null let storedKeyValuePairs = keyValues.filter( - (datum) => !excludedKeys.includes(datum.key) + (datum) => !excludedKeys.includes(datum.key), ) let x = keyValues.filter((datum) => datum.key == dbEnum.sessionKey.filePath) if (x.length > 0) zapFilePath = x[0].value @@ -209,7 +209,7 @@ async function getSessionKeyValues(db, sessionId, excludedKeys) { let d = await exportSessionPackages( db, sessionId, - exportedKeyValues.zapFilePath + exportedKeyValues.zapFilePath, ) return [exportedKeyValues, { key: 'package', data: d }] diff --git a/src-electron/importexport/import-isc.js b/src-electron/importexport/import-isc.js index 10b444146f..caec85c3e1 100644 --- a/src-electron/importexport/import-isc.js +++ b/src-electron/importexport/import-isc.js @@ -324,7 +324,7 @@ async function readIscData(filePath, data, zclMetafile) { delete state.parseState if (errorLines.length > 0) { throw new Error( - 'Error while importing the file:\n - ' + errorLines.join('\n - ') + 'Error while importing the file:\n - ' + errorLines.join('\n - '), ) } else { return state @@ -355,14 +355,14 @@ async function loadEndpointType(db, sessionId, packageId, endpointType) { db, packageId, dbEnum.customDevice.code, - dbEnum.customDevice.name + dbEnum.customDevice.name, ) } else { dev = await queryDeviceType.selectDeviceTypeByCodeAndName( db, packageId, deviceCode, - deviceName + deviceName, ) } @@ -373,7 +373,7 @@ async function loadEndpointType(db, sessionId, packageId, endpointType) { await querySession.selectSessionPartitionInfoFromDeviceType( db, sessionId, - dev.id + dev.id, ) return queryConfig.insertEndpointType( db, @@ -382,7 +382,7 @@ async function loadEndpointType(db, sessionId, packageId, endpointType) { dev.id, dev.code, deviceVersion, - false + false, ) } @@ -398,7 +398,7 @@ async function loadSingleAttribute(db, endpointTypeId, packageId, at) { at.clusterCode, at.attributeCode, at.side, - at.mfgCode + at.mfgCode, ) if (id == null) { @@ -408,14 +408,14 @@ async function loadSingleAttribute(db, endpointTypeId, packageId, at) { db, packageId, at.clusterCode, - at.mfgCode + at.mfgCode, ) let attribute = await queryAttribute.selectAttributeByCode( db, packageId, at.clusterCode, at.attributeCode, - at.mfgCode + at.mfgCode, ) if (cluster == null || attribute == null) { let message = `Could not resolve attribute ${at.clusterCode} / ${at.attributeCode}` @@ -425,7 +425,7 @@ async function loadSingleAttribute(db, endpointTypeId, packageId, at) { 'WARNING', message, packageId, - 2 + 2, ) return } @@ -440,7 +440,7 @@ async function loadSingleAttribute(db, endpointTypeId, packageId, at) { [{ key: restApi.updateKey.attributeSelected, value: 1 }], attribute.reportMinInterval, attribute.reportMaxInterval, - attribute.reportableChange + attribute.reportableChange, ) } else { // This is ok: we are iterating over all endpoint type ids, @@ -501,7 +501,7 @@ async function loadImplementedCommandsForEndpoint( zclPackageId, state, commandExtensions, - endpointTypeId + endpointTypeId, ) { let codes = {} for (const ext of commandExtensions.defaults) { @@ -520,14 +520,14 @@ async function loadImplementedCommandsForEndpoint( let cluster = await queryZcl.selectClusterByCode( db, zclPackageId, - clusterCode + clusterCode, ) for (const commandCode of Object.keys(commandIds)) { let command = await queryCommand.selectCommandByCode( db, zclPackageId, clusterCode, - commandCode + commandCode, ) if (cluster != null && command != null) { // Inject the corresponding cluster command combo into endpoint @@ -538,7 +538,7 @@ async function loadImplementedCommandsForEndpoint( command.source, command.id, 1, - true + true, ) insertionPromises.push(p) } @@ -562,7 +562,7 @@ async function loadImplementedCommandsExtensions( zclPackageId, state, commandExtensions, - endpointTypeIdArray + endpointTypeIdArray, ) { let promises = [] for (let endpointTypeId of endpointTypeIdArray) { @@ -572,8 +572,8 @@ async function loadImplementedCommandsExtensions( zclPackageId, state, commandExtensions, - endpointTypeId - ) + endpointTypeId, + ), ) } return Promise.all(promises) @@ -592,7 +592,7 @@ async function loadCommands( state, zclPackageId, genPackageId, - endpointTypeIdArray + endpointTypeIdArray, ) { if (genPackageId != null) { let commandExtensions = @@ -600,7 +600,7 @@ async function loadCommands( db, genPackageId, 'implementedCommands', - dbEnum.packageExtensionEntity.command + dbEnum.packageExtensionEntity.command, ) if ( commandExtensions != null && @@ -612,7 +612,7 @@ async function loadCommands( zclPackageId, state, commandExtensions, - endpointTypeIdArray + endpointTypeIdArray, ) } } @@ -668,7 +668,7 @@ async function iscDataLoader(db, state, sessionId) { 'UPGRADE', 'ISC FILE UPGRADED TO ZAP FILE. PLEASE SAVE AS TO SAVE OFF NEWLY CREATED ZAP FILE.', sessionId, - 2 + 2, ) // We don't have the package info inside ISC file, so we @@ -680,13 +680,13 @@ async function iscDataLoader(db, state, sessionId) { let zclPackages = await queryPackage.getSessionPackagesByType( db, sessionId, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) let genPackages = await queryPackage.getSessionPackagesByType( db, sessionId, - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) if (zclPackages.length == 0) { @@ -702,7 +702,7 @@ async function iscDataLoader(db, state, sessionId) { 'No gen packages, missing the extensions matching.', sessionId, 2, - 0 + 0, ) } else { genPackageId = genPackages[0].id @@ -740,14 +740,14 @@ async function iscDataLoader(db, state, sessionId) { endpointTypeIds.endpointTypeId, clusterCode, isIncluded, - side - ) + side, + ), ) }) return Promise.all(clusterOverridePromises).then( - () => endpointTypeIds + () => endpointTypeIds, ) - }) + }), ) } @@ -783,9 +783,9 @@ async function iscDataLoader(db, state, sessionId) { ep.endpoint, endpointTypeId, ep.network, - ep.profileId + ep.profileId, ) - .then(() => endpointTypeId) + .then(() => endpointTypeId), ) } }) diff --git a/src-electron/importexport/import-json.js b/src-electron/importexport/import-json.js index e9240dd2f5..5a59c07569 100644 --- a/src-electron/importexport/import-json.js +++ b/src-electron/importexport/import-json.js @@ -49,8 +49,8 @@ async function importSessionKeyValues(db, sessionId, keyValuePairs) { db, sessionId, element.key, - element.value - ) + element.value, + ), ) }) } @@ -92,7 +92,7 @@ async function autoLoadPackage(db, pkg, absPath) { } } else { throw new Error( - `Auto-loading of package type "${pkg.type}" is not implemented.` + `Auto-loading of package type "${pkg.type}" is not implemented.`, ) } } @@ -115,7 +115,7 @@ async function importSinglePackage( zapFilePath, packageMatch, defaultZclMetafile = null, - defaultTemplateFile = null + defaultTemplateFile = null, ) { let autoloading = true let absPath = getPkgPath(pkg, zapFilePath) @@ -123,7 +123,7 @@ async function importSinglePackage( db, absPath, pkg.type, - pkg.version + pkg.version, ) if (pkgId != null) { @@ -141,15 +141,15 @@ async function importSinglePackage( let zclFile = Array.isArray(defaultZclMetafile) ? defaultZclMetafile.find((f) => f != null && f.includes(filePathToSearch)) : typeof defaultZclMetafile === 'string' && - defaultZclMetafile.includes(filePathToSearch) - ? defaultZclMetafile - : null + defaultZclMetafile.includes(filePathToSearch) + ? defaultZclMetafile + : null let templateFile = Array.isArray(defaultTemplateFile) ? defaultTemplateFile.find((f) => f != null && f.includes(filePathToSearch)) : typeof defaultTemplateFile === 'string' && - defaultTemplateFile.includes(filePathToSearch) - ? defaultTemplateFile - : null + defaultTemplateFile.includes(filePathToSearch) + ? defaultTemplateFile + : null if (zclFile != null) { // removing any double / since that can fail the search @@ -159,7 +159,7 @@ async function importSinglePackage( db, zclFile, pkg.type, - pkg.version + pkg.version, ) } else if (templateFile != null) { // removing any double / since that can fail the search @@ -169,7 +169,7 @@ async function importSinglePackage( db, templateFile, pkg.type, - pkg.version + pkg.version, ) } @@ -178,7 +178,7 @@ async function importSinglePackage( env.logError( `Package match found for ${pkg.path} from the passed arguments: ${ zclFile ? zclFile : templateFile - }` + }`, ) return { packageId: pkgId, @@ -200,7 +200,7 @@ async function importSinglePackage( // Now we have to perform the guessing logic. env.logDebug( - 'Packages from the file did not match loaded packages making best bet.' + 'Packages from the file did not match loaded packages making best bet.', ) let packages = await queryPackage.getPackagesByType(db, pkg.type) @@ -216,7 +216,7 @@ async function importSinglePackage( } } else if (packages.length == 1) { env.logDebug( - `Only one package of given type ${pkg.type} present. Using it.` + `Only one package of given type ${pkg.type} present. Using it.`, ) return { packageId: packages[0].id, @@ -232,7 +232,7 @@ async function importSinglePackage( let categoryMatch = packages.filter((p) => p.category == pkg.category) if (categoryMatch.length == 1) { env.logDebug( - `Only one package of given type ${pkg.type} and category ${pkg.category} present. Using it.` + `Only one package of given type ${pkg.type} and category ${pkg.category} present. Using it.`, ) return { packageId: categoryMatch[0].id, @@ -254,7 +254,7 @@ async function importSinglePackage( } } else if (versionMatch.length == 1) { env.logDebug( - `Only one package of given type ${pkg.type} and version ${pkg.version} present. Using it.` + `Only one package of given type ${pkg.type} and version ${pkg.version} present. Using it.`, ) return { packageId: versionMatch[0].id, @@ -266,7 +266,7 @@ async function importSinglePackage( // We now know we have more than 1 matching package. Find best bet. let existingPackages = packages.filter( - (p) => fs.existsSync(p.path) && p.path === absPath + (p) => fs.existsSync(p.path) && p.path === absPath, ) if (existingPackages.length == 1) { @@ -281,7 +281,7 @@ async function importSinglePackage( // More than one exists. Use the first one. let p = existingPackages[0] env.logWarning( - `Using first package that exists out of ${existingPackages.length}: ${p.id}.` + `Using first package that exists out of ${existingPackages.length}: ${p.id}.`, ) return { packageId: p.id, @@ -291,17 +291,17 @@ async function importSinglePackage( let p = packages[0] let pkgPaths = packages.map((p) => p.path) let packageNameMatch = packages.find( - (p) => p.path.includes(filePathToSearch) && fs.existsSync(p.path) + (p) => p.path.includes(filePathToSearch) && fs.existsSync(p.path), ) if (packageMatch) { p = packageNameMatch env.logError( - `None of packages exist for ${pkg.path}, so using one which matches the file name: ${p.path} from ${pkgPaths}.` + `None of packages exist for ${pkg.path}, so using one which matches the file name: ${p.path} from ${pkgPaths}.`, ) } else { // None exists, so use the first one from 'packages'. env.logError( - `None of packages exist for ${pkg.path}, so using first one overall: ${p.path} from ${pkgPaths}.` + `None of packages exist for ${pkg.path}, so using first one overall: ${p.path} from ${pkgPaths}.`, ) } return { @@ -363,7 +363,7 @@ async function importPackages( zapFilePath, packageMatch, defaultZclMetafile = null, - defaultTemplateFile = null + defaultTemplateFile = null, ) { let allQueries = [] if (packages != null) { @@ -376,8 +376,8 @@ async function importPackages( zapFilePath, packageMatch, defaultZclMetafile, - defaultTemplateFile - ) + defaultTemplateFile, + ), ) }) } @@ -415,20 +415,20 @@ async function importClusters(db, allZclPackageIds, endpointTypeId, clusters) { // Get all custom xml packages since they will be relevant packages as well. let packageInfo = await queryPackage.getPackagesByPackageIds( db, - allZclPackageIds + allZclPackageIds, ) let customPackageInfo = packageInfo.filter( - (pkg) => pkg.type === dbEnum.packageType.zclXmlStandalone + (pkg) => pkg.type === dbEnum.packageType.zclXmlStandalone, ) let endpointTypeDeviceTypesInfo = await queryDeviceType.selectDeviceTypesByEndpointTypeId(db, endpointTypeId) let deviceTypeRefs = endpointTypeDeviceTypesInfo.map( - (etd) => etd.deviceTypeRef + (etd) => etd.deviceTypeRef, ) if (deviceTypeRefs.length > 0) { let deviceTypeInfo = await queryDeviceType.selectDeviceTypeById( db, - deviceTypeRefs[0] + deviceTypeRefs[0], ) relevantZclPackageIds = [deviceTypeInfo.packageRef] @@ -444,7 +444,7 @@ async function importClusters(db, allZclPackageIds, endpointTypeId, clusters) { db, relevantZclPackageIds, endpointTypeId, - clusters[k] + clusters[k], ) await importCommands( @@ -452,7 +452,7 @@ async function importClusters(db, allZclPackageIds, endpointTypeId, clusters) { relevantZclPackageIds, endpointTypeId, endpointClusterId, - clusters[k].commands + clusters[k].commands, ) await importAttributes( @@ -461,14 +461,14 @@ async function importClusters(db, allZclPackageIds, endpointTypeId, clusters) { endpointTypeId, endpointClusterId, clusters[k].attributes, - clusters[k] + clusters[k], ) await importEvents( db, relevantZclPackageIds, endpointClusterId, - clusters[k].events + clusters[k].events, ) } } @@ -487,7 +487,7 @@ async function importCommands( allZclPackageIds, endpointTypeId, endpointClusterId, - commands + commands, ) { if (commands) { for (let l = 0; l < commands.length; l++) { @@ -496,7 +496,7 @@ async function importCommands( allZclPackageIds, endpointTypeId, endpointClusterId, - commands[l] + commands[l], ) } } @@ -517,7 +517,7 @@ async function importAttributes( endpointTypeId, endpointClusterId, attributes, - cluster + cluster, ) { if (attributes) { for (let m = 0; m < attributes.length; m++) { @@ -526,7 +526,7 @@ async function importAttributes( allZclPackageIds, endpointClusterId, attributes[m], - cluster + cluster, ) } } @@ -546,7 +546,7 @@ async function importEvents(db, allZclPackageIds, endpointClusterId, events) { db, allZclPackageIds, endpointClusterId, - events[n] + events[n], ) } } @@ -564,17 +564,17 @@ async function getMandatoryClusterAttributes( db, epc, cluster, - allZclPackageIds + allZclPackageIds, ) { let clusterAttributes = await queryZcl.selectAttributesByClusterIdAndSideIncludingGlobal( db, epc.clusterRef, allZclPackageIds, - epc.side + epc.side, ) let mandatoryClusterAttributes = clusterAttributes.filter( - (ca) => !ca.isOptional && ca.clusterRef != null + (ca) => !ca.isOptional && ca.clusterRef != null, ) // ignoring global attributes mandatoryClusterAttributes.forEach((ma) => (ma.clusterName = cluster.name)) return mandatoryClusterAttributes @@ -592,7 +592,7 @@ async function getMandatoryClusterCommands(db, epc, cluster, allZclPackageIds) { let clusterCommands = await queryCommand.selectCommandsByClusterId( db, epc.clusterRef, - allZclPackageIds + allZclPackageIds, ) let mandatoryClusterCommands = clusterCommands.filter((cc) => !cc.isOptional) for (let i = 0; i < mandatoryClusterCommands.length; i++) { @@ -624,13 +624,13 @@ function clusterComplianceForAttributes( allMandatoryAttributes, endpointId, clusterSpecCheckComplianceMessage, - specMessageIndent + specMessageIndent, ) { let endpointTypeAttributeIds = endpointTypeAttributes.map( - (eta) => eta.attributeRef + (eta) => eta.attributeRef, ) let mandatoryAttributesNotEnabled = allMandatoryAttributes.filter( - (ma) => !endpointTypeAttributeIds.includes(ma.id) + (ma) => !endpointTypeAttributeIds.includes(ma.id), ) for (let i = 0; i < mandatoryAttributesNotEnabled.length; i++) { let clusterSpecComplianceMessageForAttributes = @@ -645,7 +645,7 @@ function clusterComplianceForAttributes( clusterSpecCheckComplianceMessage = clusterSpecCheckComplianceMessage.concat( specMessageIndent, - clusterSpecComplianceMessageForAttributes + clusterSpecComplianceMessageForAttributes, ) querySessionNotice.setNotification( @@ -654,7 +654,7 @@ function clusterComplianceForAttributes( clusterSpecComplianceMessageForAttributes, sessionId, 1, - 0 + 0, ) } @@ -681,7 +681,7 @@ function clusterComplianceForCommands( allMandatoryCommands, endpointId, clusterSpecCheckComplianceMessage, - specMessageIndent + specMessageIndent, ) { for (let i = 0; i < allMandatoryCommands.length; i++) { let isIncoming = allMandatoryCommands[i].isIncoming @@ -711,7 +711,7 @@ function clusterComplianceForCommands( clusterSpecCheckComplianceMessage = clusterSpecCheckComplianceMessage.concat( specMessageIndent, - clusterSpecComplianceMessageForCommands + clusterSpecComplianceMessageForCommands, ) querySessionNotice.setNotification( @@ -720,7 +720,7 @@ function clusterComplianceForCommands( clusterSpecComplianceMessageForCommands, sessionId, 1, - 0 + 0, ) } if (!isIncoming && !isCommandEnabled) { @@ -738,7 +738,7 @@ function clusterComplianceForCommands( clusterSpecCheckComplianceMessage = clusterSpecCheckComplianceMessage.concat( specMessageIndent, - clusterSpecComplianceMessageForCommands + clusterSpecComplianceMessageForCommands, ) querySessionNotice.setNotification( @@ -747,7 +747,7 @@ function clusterComplianceForCommands( clusterSpecComplianceMessageForCommands, sessionId, 1, - 0 + 0, ) } } @@ -781,7 +781,7 @@ async function deviceTypeClustersAttributesAndCommands(db, endpointTypeId) { await queryDeviceType.selectDeviceTypeFeaturesByEndpointTypeIdAndClusterId( db, endpointTypeId, - 'all' + 'all', ) // Initialize the device type clusters, attributes and commands based on @@ -794,29 +794,29 @@ async function deviceTypeClustersAttributesAndCommands(db, endpointTypeId) { let deviceTypeClusters = await queryDeviceType.selectDeviceTypeClustersByDeviceTypeRef( db, - endpointTypeDeviceTypes[eptDtIndex].deviceTypeRef + endpointTypeDeviceTypes[eptDtIndex].deviceTypeRef, ) deviceTypeClustersOnEndpointType = deviceTypeClustersOnEndpointType.concat(deviceTypeClusters) let deviceTypeAttributes = await queryDeviceType.selectDeviceTypeAttributesByDeviceTypeRef( db, - endpointTypeDeviceTypes[eptDtIndex].deviceTypeRef + endpointTypeDeviceTypes[eptDtIndex].deviceTypeRef, ) deviceTypeAttributes.forEach( (da) => - (da.deviceTypeRef = endpointTypeDeviceTypes[eptDtIndex].deviceTypeRef) + (da.deviceTypeRef = endpointTypeDeviceTypes[eptDtIndex].deviceTypeRef), ) deviceTypeAttributesOnEndpointType = deviceTypeAttributesOnEndpointType.concat(deviceTypeAttributes) let deviceTypeCommands = await queryDeviceType.selectDeviceTypeCommandsByDeviceTypeRef( db, - endpointTypeDeviceTypes[eptDtIndex].deviceTypeRef + endpointTypeDeviceTypes[eptDtIndex].deviceTypeRef, ) deviceTypeCommands.forEach( (dc) => - (dc.deviceTypeRef = endpointTypeDeviceTypes[eptDtIndex].deviceTypeRef) + (dc.deviceTypeRef = endpointTypeDeviceTypes[eptDtIndex].deviceTypeRef), ) deviceTypeCommandsOnEndpointType = deviceTypeCommandsOnEndpointType.concat(deviceTypeCommands) @@ -840,7 +840,7 @@ function deviceTypeClusterToFeatureBits(deviceTypeFeaturesOnEndpointType) { let clusterId = deviceTypeFeaturesOnEndpointType[i].clusterId if (clusterId in deviceTypeClustersToFeatureBitMap) { deviceTypeClustersToFeatureBitMap[clusterId].push( - deviceTypeFeaturesOnEndpointType[i] + deviceTypeFeaturesOnEndpointType[i], ) } else { deviceTypeClustersToFeatureBitMap[clusterId] = [ @@ -873,11 +873,11 @@ async function deviceTypeComplianceForClusters( endpointTypeClusterRefMap, endpointTypeClusterRefMapDetailed, deviceTypeSpecCheckComplianceMessage, - specMessageIndent + specMessageIndent, ) { // Create a map keyed by device type cluster associated to device type cluster feature Bits let deviceTypeClustersToFeatureBitMap = deviceTypeClusterToFeatureBits( - deviceTypeFeaturesOnEndpointType + deviceTypeFeaturesOnEndpointType, ) for (let dtc = 0; dtc < deviceTypeClustersOnEndpointType.length; dtc++) { let isDeviceTypeClientClusterFound = @@ -891,7 +891,7 @@ async function deviceTypeComplianceForClusters( let clusterSpecComplianceMessage = '' let deviceType = await queryDeviceType.selectDeviceTypeById( db, - deviceTypeClustersOnEndpointType[dtc].deviceTypeRef + deviceTypeClustersOnEndpointType[dtc].deviceTypeRef, ) if ( deviceTypeClustersOnEndpointType[dtc].includeClient && @@ -909,7 +909,7 @@ async function deviceTypeComplianceForClusters( deviceTypeSpecCheckComplianceMessage = deviceTypeSpecCheckComplianceMessage.concat( specMessageIndent, - clusterSpecComplianceMessage + clusterSpecComplianceMessage, ) querySessionNotice.setNotification( db, @@ -917,7 +917,7 @@ async function deviceTypeComplianceForClusters( clusterSpecComplianceMessage, sessionId, 1, - 0 + 0, ) } if ( @@ -936,7 +936,7 @@ async function deviceTypeComplianceForClusters( deviceTypeClustersOnEndpointType[dtc].clusterRef ]['client'].endpointTypeClusterId, '0xFFFC', - null + null, ) for (let i = 0; i < deviceTypeClusterFeatureBitsInfo.length; i++) { if ( @@ -961,7 +961,7 @@ async function deviceTypeComplianceForClusters( deviceTypeSpecCheckComplianceMessage = deviceTypeSpecCheckComplianceMessage.concat( specMessageIndent, - featureMapComplianceMessage + featureMapComplianceMessage, ) querySessionNotice.setNotification( db, @@ -969,7 +969,7 @@ async function deviceTypeComplianceForClusters( featureMapComplianceMessage, sessionId, 1, - 0 + 0, ) } } @@ -991,7 +991,7 @@ async function deviceTypeComplianceForClusters( deviceTypeSpecCheckComplianceMessage = deviceTypeSpecCheckComplianceMessage.concat( specMessageIndent, - clusterSpecComplianceMessage + clusterSpecComplianceMessage, ) querySessionNotice.setNotification( db, @@ -999,7 +999,7 @@ async function deviceTypeComplianceForClusters( clusterSpecComplianceMessage, sessionId, 1, - 0 + 0, ) } @@ -1019,7 +1019,7 @@ async function deviceTypeComplianceForClusters( deviceTypeClustersOnEndpointType[dtc].clusterRef ]['server'].endpointTypeClusterId, '0xFFFC', - null + null, ) for (let i = 0; i < deviceTypeClusterFeatureBitsInfo.length; i++) { if ( @@ -1044,7 +1044,7 @@ async function deviceTypeComplianceForClusters( deviceTypeSpecCheckComplianceMessage = deviceTypeSpecCheckComplianceMessage.concat( specMessageIndent, - featureMapComplianceMessage + featureMapComplianceMessage, ) querySessionNotice.setNotification( db, @@ -1052,7 +1052,7 @@ async function deviceTypeComplianceForClusters( featureMapComplianceMessage, sessionId, 1, - 0 + 0, ) } } @@ -1082,7 +1082,7 @@ async function deviceTypeComplianceForAttributes( deviceTypeAttributesOnEndpointType, endpointTypeAttributeRefMap, deviceTypeSpecCheckComplianceMessage, - specMessageIndent + specMessageIndent, ) { for (let dta = 0; dta < deviceTypeAttributesOnEndpointType.length; dta++) { let isAttributeFound = @@ -1093,7 +1093,7 @@ async function deviceTypeComplianceForAttributes( let queryDeviceTypeClusterInfo = await queryDeviceType.selectDeviceTypeClusterByDeviceTypeClusterId( db, - deviceTypeAttributesOnEndpointType[dta].deviceTypeClusterRef + deviceTypeAttributesOnEndpointType[dta].deviceTypeClusterRef, ) if ( queryDeviceTypeClusterInfo.includeClient || @@ -1102,11 +1102,11 @@ async function deviceTypeComplianceForAttributes( if (deviceTypeAttributesOnEndpointType[dta].attributeRef != null) { let cluster = await queryZcl.selectClusterById( db, - queryDeviceTypeClusterInfo.clusterRef + queryDeviceTypeClusterInfo.clusterRef, ) let deviceType = await queryDeviceType.selectDeviceTypeById( db, - deviceTypeAttributesOnEndpointType[dta].deviceTypeRef + deviceTypeAttributesOnEndpointType[dta].deviceTypeRef, ) // Not throwing attribute warnings for an optional cluster's attributes when it is not enabled if (endpointId) { @@ -1116,7 +1116,7 @@ async function deviceTypeComplianceForAttributes( db, sessionId, endpointId, - deviceTypeAttributesOnEndpointType[dta].attributeRef + deviceTypeAttributesOnEndpointType[dta].attributeRef, ) if ( !(endpointTypeCluster?.enabled == true) && @@ -1145,7 +1145,7 @@ async function deviceTypeComplianceForAttributes( deviceTypeSpecCheckComplianceMessage = deviceTypeSpecCheckComplianceMessage.concat( specMessageIndent, - attributeSpecComplianceMessage + attributeSpecComplianceMessage, ) querySessionNotice.setNotification( db, @@ -1153,7 +1153,7 @@ async function deviceTypeComplianceForAttributes( attributeSpecComplianceMessage, sessionId, 1, - 0 + 0, ) } } @@ -1182,7 +1182,7 @@ async function deviceTypeComplianceForCommands( deviceTypeCommandsOnEndpointType, endpointTypeCommandRefMap, deviceTypeSpecCheckComplianceMessage, - specMessageIndent + specMessageIndent, ) { for (let dtc = 0; dtc < deviceTypeCommandsOnEndpointType.length; dtc++) { let isCommandIncomingFound = @@ -1198,15 +1198,15 @@ async function deviceTypeComplianceForCommands( let queryDeviceTypeClusterInfo = await queryDeviceType.selectDeviceTypeClusterByDeviceTypeClusterId( db, - deviceTypeCommandsOnEndpointType[dtc].deviceTypeClusterRef + deviceTypeCommandsOnEndpointType[dtc].deviceTypeClusterRef, ) let cluster = await queryZcl.selectClusterById( db, - queryDeviceTypeClusterInfo.clusterRef + queryDeviceTypeClusterInfo.clusterRef, ) let deviceType = await queryDeviceType.selectDeviceTypeById( db, - deviceTypeCommandsOnEndpointType[dtc].deviceTypeRef + deviceTypeCommandsOnEndpointType[dtc].deviceTypeRef, ) let commandSpecComplianceMessage = '' if ( @@ -1227,7 +1227,7 @@ async function deviceTypeComplianceForCommands( deviceTypeSpecCheckComplianceMessage = deviceTypeSpecCheckComplianceMessage.concat( specMessageIndent, - commandSpecComplianceMessage + commandSpecComplianceMessage, ) querySessionNotice.setNotification( db, @@ -1235,7 +1235,7 @@ async function deviceTypeComplianceForCommands( commandSpecComplianceMessage, sessionId, 1, - 0 + 0, ) } @@ -1257,7 +1257,7 @@ async function deviceTypeComplianceForCommands( deviceTypeSpecCheckComplianceMessage = deviceTypeSpecCheckComplianceMessage.concat( specMessageIndent, - commandSpecComplianceMessage + commandSpecComplianceMessage, ) querySessionNotice.setNotification( db, @@ -1265,7 +1265,7 @@ async function deviceTypeComplianceForCommands( commandSpecComplianceMessage, sessionId, 1, - 0 + 0, ) } @@ -1287,7 +1287,7 @@ async function deviceTypeComplianceForCommands( deviceTypeSpecCheckComplianceMessage = deviceTypeSpecCheckComplianceMessage.concat( specMessageIndent, - commandSpecComplianceMessage + commandSpecComplianceMessage, ) querySessionNotice.setNotification( db, @@ -1295,7 +1295,7 @@ async function deviceTypeComplianceForCommands( commandSpecComplianceMessage, sessionId, 1, - 0 + 0, ) } @@ -1317,7 +1317,7 @@ async function deviceTypeComplianceForCommands( deviceTypeSpecCheckComplianceMessage = deviceTypeSpecCheckComplianceMessage.concat( specMessageIndent, - commandSpecComplianceMessage + commandSpecComplianceMessage, ) querySessionNotice.setNotification( db, @@ -1325,7 +1325,7 @@ async function deviceTypeComplianceForCommands( commandSpecComplianceMessage, sessionId, 1, - 0 + 0, ) } } @@ -1346,7 +1346,7 @@ async function importEndpointTypes( sessionId, allZclPackageIds, endpointTypes, - endpoints + endpoints, ) { const sortedEndpoints = sortEndpoints(endpoints) @@ -1366,7 +1366,7 @@ async function importEndpointTypes( await querySession.selectSessionPartitionInfoFromPackageId( db, sessionId, - allZclPackageIds + allZclPackageIds, ) for (let i = 0; i < endpointTypes.length; i++) { let endpointTypeId = await queryImpexp.importEndpointType( @@ -1374,7 +1374,7 @@ async function importEndpointTypes( sessionPartitionInfo[0].sessionPartitionId, allZclPackageIds, endpointTypes[i], - sessionId + sessionId, ) let endpointId = '' if (sortedEndpoints[i]) { @@ -1384,7 +1384,7 @@ async function importEndpointTypes( db, sessionId, sortedEndpoints[i][j], - endpointTypeId + endpointTypeId, ) } } @@ -1393,7 +1393,7 @@ async function importEndpointTypes( db, allZclPackageIds, endpointTypeId, - endpointTypes[i].clusters + endpointTypes[i].clusters, ) /** @@ -1405,7 +1405,7 @@ async function importEndpointTypes( let endpointTypeClusters = await queryZcl.selectEndpointTypeClustersByEndpointTypeId( db, - endpointTypeId + endpointTypeId, ) let endpointTypeClusterRefMap = {} let endpointTypeClusterRefMapDetailed = {} @@ -1426,10 +1426,10 @@ async function importEndpointTypes( db, epc, cluster, - allZclPackageIds + allZclPackageIds, ) allMandatoryAttributes = allMandatoryAttributes.concat( - mandatoryClusterAttributes + mandatoryClusterAttributes, ) // Mandatory Cluster Commands @@ -1437,10 +1437,10 @@ async function importEndpointTypes( db, epc, cluster, - allZclPackageIds + allZclPackageIds, ) allMandatoryCommands = allMandatoryCommands.concat( - mandatoryClusterCommands + mandatoryClusterCommands, ) } @@ -1448,14 +1448,14 @@ async function importEndpointTypes( let endpointTypeAttributes = await queryZcl.selectEndpointTypeAttributesByEndpointId( db, - endpointTypeId + endpointTypeId, ) // Commands on an endpoint type let endpointTypeCommands = await queryZcl.selectEndpointTypeCommandsByEndpointId( db, - endpointTypeId + endpointTypeId, ) // Adding cluster compliance messages for attributes @@ -1466,7 +1466,7 @@ async function importEndpointTypes( allMandatoryAttributes, endpointId, clusterSpecCheckComplianceMessage, - specMessageIndent + specMessageIndent, ) // Adding cluster compliance messages for commands @@ -1477,7 +1477,7 @@ async function importEndpointTypes( allMandatoryCommands, endpointId, clusterSpecCheckComplianceMessage, - specMessageIndent + specMessageIndent, ) // Having a map of attributeIds and enabled value @@ -1519,7 +1519,7 @@ async function importEndpointTypes( endpointTypeClusterRefMap, endpointTypeClusterRefMapDetailed, deviceTypeSpecCheckComplianceMessage, - specMessageIndent + specMessageIndent, ) // Attribute compliance as per the spec. Checking if a device type requires @@ -1532,7 +1532,7 @@ async function importEndpointTypes( deviceTypeAttributesOnEndpointType, endpointTypeAttributeRefMap, deviceTypeSpecCheckComplianceMessage, - specMessageIndent + specMessageIndent, ) // Command compliance as per the spec. Checking if a device type requires @@ -1545,7 +1545,7 @@ async function importEndpointTypes( deviceTypeCommandsOnEndpointType, endpointTypeCommandRefMap, deviceTypeSpecCheckComplianceMessage, - specMessageIndent + specMessageIndent, ) } @@ -1556,13 +1556,13 @@ async function importEndpointTypes( parentRef = await queryEndpoint.getParentEndpointRef( db, sortedEndpoints[i][j].parentEndpointIdentifier, - sessionId + sessionId, ) await queryImpexp.importParentEndpoint( db, sessionId, sortedEndpoints[i][j].endpointId, - parentRef + parentRef, ) } } @@ -1574,7 +1574,7 @@ async function importEndpointTypes( deviceTypeSpecCheckComplianceMessage, clusterSpecCheckComplianceFailureTitle, clusterSpecCheckComplianceMessage, - dottedLine + dottedLine, ) if (!process.env.TEST) { console.log(deviceTypeSpecCheckComplianceMessage) @@ -1603,7 +1603,7 @@ async function jsonDataLoader( sessionId, packageMatch, defaultZclMetafile, - defaultTemplateFile + defaultTemplateFile, ) { // Initially clean up all the packages from the session. let sessionPartitions = @@ -1616,7 +1616,7 @@ async function jsonDataLoader( (pkg) => pkg.type == dbEnum.packageType.zclProperties || pkg.type == dbEnum.packageType.genTemplatesJson || - pkg.type == dbEnum.packageType.zclXmlStandalone + pkg.type == dbEnum.packageType.zclXmlStandalone, ) // Loading all packages before custom xml to make sure clusterExtensions are @@ -1624,7 +1624,7 @@ async function jsonDataLoader( let topLevelPackages = state.package.filter( (pkg) => pkg.type == dbEnum.packageType.zclProperties || - pkg.type == dbEnum.packageType.genTemplatesJson + pkg.type == dbEnum.packageType.genTemplatesJson, ) let mainPackageData = await importPackages( db, @@ -1632,18 +1632,18 @@ async function jsonDataLoader( state.filePath, packageMatch, defaultZclMetafile, - defaultTemplateFile + defaultTemplateFile, ) await querySession.insertSessionPartitions( db, sessionId, - allPartitionPackages.length + allPartitionPackages.length, ) let sessionPartitionInfo = await querySession.getSessionPartitionInfo( db, sessionId, - allPartitionPackages.length + allPartitionPackages.length, ) mainPackageData.sessionId = sessionId @@ -1654,8 +1654,8 @@ async function jsonDataLoader( queryPackage.insertSessionPackage( db, sessionPartitionInfo[sessionPartitionIndex].sessionPartitionId, - mainPackageData.zclPackageIds[i] - ) + mainPackageData.zclPackageIds[i], + ), ) sessionPartitionIndex++ } @@ -1666,8 +1666,8 @@ async function jsonDataLoader( queryPackage.insertSessionPackage( db, sessionPartitionInfo[sessionPartitionIndex].sessionPartitionId, - templateId - ) + templateId, + ), ) sessionPartitionIndex++ }) @@ -1679,8 +1679,8 @@ async function jsonDataLoader( queryPackage.insertSessionPackage( db, sessionPartitionInfo[sessionPartitionIndex].sessionPartitionId, - optionalId - ) + optionalId, + ), ) sessionPartitionIndex++ }) @@ -1690,7 +1690,7 @@ async function jsonDataLoader( // Loading custom xml after the basic xml packages have been loaded let zclXmlStandAlonePackages = state.package.filter( - (pkg) => pkg.type == dbEnum.packageType.zclXmlStandalone + (pkg) => pkg.type == dbEnum.packageType.zclXmlStandalone, ) // First gather all package Ids... @@ -1700,13 +1700,13 @@ async function jsonDataLoader( db, getPkgPath(pkg, state.filePath), pkg.type, - pkg.version + pkg.version, ) return { packageId: packageId, packageType: pkg.type, } - }) + }), ) // ... some are null, which means that they need to be loaded, some are not null. @@ -1726,7 +1726,7 @@ async function jsonDataLoader( .filter( (p) => p.packageType === dbEnum.packageType.zclXmlStandalone && - p.packageId != null + p.packageId != null, ) .map((p) => p.packageId) @@ -1740,7 +1740,7 @@ async function jsonDataLoader( } else { return {} } - }) + }), ) ) .filter((p) => p.succeeded) @@ -1752,7 +1752,7 @@ async function jsonDataLoader( db, zclXmlStandAlonePackages, state.filePath, - packageMatch + packageMatch, ) standAlonePackageData.sessionId = sessionId @@ -1768,7 +1768,7 @@ async function jsonDataLoader( await querySession.selectSessionPartitionInfoFromPackageId( db, sessionId, - optionalIds[i] + optionalIds[i], ) // Loading only those packages which have not been loaded if (sessionPartitionInfoForNewPackage.length == 0) { @@ -1776,8 +1776,8 @@ async function jsonDataLoader( queryPackage.insertSessionPackage( db, sessionPartitionInfo[sessionPartitionIndex].sessionPartitionId, - optionalIds[i] - ) + optionalIds[i], + ), ) sessionPartitionIndex++ } @@ -1790,7 +1790,7 @@ async function jsonDataLoader( if ('keyValuePairs' in state) { promisesStage1.push( - importSessionKeyValues(db, sessionId, state.keyValuePairs) + importSessionKeyValues(db, sessionId, state.keyValuePairs), ) } @@ -1805,8 +1805,8 @@ async function jsonDataLoader( sessionId, allZclPackageIds, state.endpointTypes, - state.endpoints - ) + state.endpoints, + ), ) } @@ -1822,19 +1822,19 @@ async function jsonDataLoader( let sessionPkgs = await queryPackage.getSessionPackagesByType( db, sessionId, - pkg.type + pkg.type, ) let invalidSessionPkgs = sessionPkgs.filter( (x) => x.path !== pkgFilePath && - !newlyLoadedCustomPackageIds.includes(x.id) // newly added packages are already verified. + !newlyLoadedCustomPackageIds.includes(x.id), // newly added packages are already verified. ) let validSessionPkgId = await queryPackage.getPackageIdByPathAndTypeAndVersion( db, pkgFilePath, pkg.type, - pkg.version + pkg.version, ) if (validSessionPkgId != null && invalidSessionPkgs.length > 0) { @@ -1843,32 +1843,32 @@ async function jsonDataLoader( await querySession.selectSessionPartitionInfoFromPackageId( db, sessionId, - invalidSessionPkgs[i].id + invalidSessionPkgs[i].id, ) env.logDebug( - `Disabling/removing invalid session package. sessionId(${sessionId}), packageId(${invalidSessionPkgs[i].id}), path(${invalidSessionPkgs[i].path})` + `Disabling/removing invalid session package. sessionId(${sessionId}), packageId(${invalidSessionPkgs[i].id}), path(${invalidSessionPkgs[i].path})`, ) if (sessionPartitionInfoCurrent.length > 0) { await queryPackage.deleteSessionPackage( db, sessionPartitionInfoCurrent[0].sessionPartitionId, - invalidSessionPkgs[i].id + invalidSessionPkgs[i].id, ) sessionPartitionIndex-- } } env.logDebug( - `Enabling session package. sessionId(${sessionId}), packageId(${validSessionPkgId})` + `Enabling session package. sessionId(${sessionId}), packageId(${validSessionPkgId})`, ) await queryPackage.insertSessionPackage( db, sessionPartitionInfo[sessionPartitionIndex].sessionPartitionId, - validSessionPkgId + validSessionPkgId, ) sessionPartitionIndex++ } - }) + }), ) } @@ -1902,7 +1902,7 @@ async function readJsonData( filePath, data, defaultZclMetafile, - defaultTemplateFile + defaultTemplateFile, ) { let state = JSON.parse(data) diff --git a/src-electron/importexport/import.js b/src-electron/importexport/import.js index 17f60d20cb..99543ced80 100644 --- a/src-electron/importexport/import.js +++ b/src-electron/importexport/import.js @@ -41,7 +41,7 @@ const util = require('../util/util.js') async function readDataFromFile( filePath, defaultZclMetafile, - defaultTemplateFile + defaultTemplateFile, ) { let data = await fsp.readFile(filePath) @@ -51,7 +51,7 @@ async function readDataFromFile( filePath, data, defaultZclMetafile, - defaultTemplateFile + defaultTemplateFile, ) } else if (stringData.startsWith('#ISD')) { return importIsc.readIscData( @@ -59,11 +59,11 @@ async function readDataFromFile( data, defaultZclMetafile == null ? env.builtinSilabsZclMetafile() - : defaultZclMetafile + : defaultZclMetafile, ) } else { throw new Error( - 'Invalid file format. Only .zap JSON files and ISC file format are supported.' + 'Invalid file format. Only .zap JSON files and ISC file format are supported.', ) } } @@ -76,7 +76,7 @@ async function executePostImportScript(db, sessionId, scriptFile) { return script.executeScriptFunction( script.functions.postLoad, context, - scriptFile + scriptFile, ) } @@ -97,12 +97,12 @@ async function importDataFromFile( defaultZclMetafile: env.builtinSilabsZclMetafile(), postImportScript: null, packageMatch: dbEnum.packageMatch.fuzzy, - } + }, ) { let state = await readDataFromFile( filePath, options.defaultZclMetafile, - options.defaultTemplateFile + options.defaultTemplateFile, ) state = ff.convertFromFile(state) try { @@ -118,7 +118,7 @@ async function importDataFromFile( template: env.builtinTemplateMetafile(), }, null, - null + null, ) } else { sid = options.sessionId @@ -151,13 +151,13 @@ async function importDataFromFile( sid, options.packageMatch, options.defaultZclMetafile, - options.defaultTemplateFile + options.defaultTemplateFile, ) if (options.postImportScript != null) { await executePostImportScript( db, loaderResult.sessionId, - options.postImportScript + options.postImportScript, ) } return loaderResult diff --git a/src-electron/main-process/main.js b/src-electron/main-process/main.js index e13a3ae07d..4a63dc67c0 100644 --- a/src-electron/main-process/main.js +++ b/src-electron/main-process/main.js @@ -37,7 +37,7 @@ util.mainOrSecondaryInstance( }, () => { startup.startUpSecondaryInstance(argv, { quitFunction: null }) - } + }, ) // If the code is executed via 'node' and not via 'electron', then this diff --git a/src-electron/main-process/session-timers.js b/src-electron/main-process/session-timers.js index 962a8ebd27..d3559fc6ca 100644 --- a/src-electron/main-process/session-timers.js +++ b/src-electron/main-process/session-timers.js @@ -37,8 +37,8 @@ function initSessionTimers(db, session, sessionTimersSetupArray) { sessionTimerIdArrayMap[session.sessionId].push( setInterval( setup.func, - setup.timerInterval || ASYNC_DEFAULT_TIMER_INTERVAL_MS - ) + setup.timerInterval || ASYNC_DEFAULT_TIMER_INTERVAL_MS, + ), ) }) } @@ -51,7 +51,7 @@ function initSessionTimers(db, session, sessionTimersSetupArray) { function deinitSessionTimers(session) { let asyncIdArray = sessionTimerIdArrayMap[session.sessionId] Object.keys(asyncIdArray).forEach((timer) => - clearInterval(asyncIdArray[timer]) + clearInterval(asyncIdArray[timer]), ) } diff --git a/src-electron/main-process/startup.js b/src-electron/main-process/startup.js index c3c6646db7..1cc7ff4b9a 100644 --- a/src-electron/main-process/startup.js +++ b/src-electron/main-process/startup.js @@ -55,7 +55,7 @@ async function startNormal(quitFunction, argv) { let db = await dbApi.initDatabaseAndLoadSchema( env.sqliteFile(), env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) watchdog.start(argv.watchdogTimer, () => { @@ -211,7 +211,7 @@ async function startConvert(argv, options) { let db = await dbApi.initDatabaseAndLoadSchema( dbFile, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) options.logger(' 🐝 database and schema initialized') await zclLoader.loadZclMetafiles(db, argv.zclProperties, { @@ -246,7 +246,7 @@ async function startConvert(argv, options) { await importJs.executePostImportScript( db, importResult.sessionId, - argv.postImportScript + argv.postImportScript, ) } @@ -261,7 +261,7 @@ async function startConvert(argv, options) { db, sessionId, dbEnum.sessionKey.filePath, - of + of, ) let outputPath = await exportJs.exportDataIntoFile(db, sessionId, of, { removeLog: argv.noZapFileLog, @@ -297,7 +297,7 @@ async function writeConversionResultsFile(file) { status: 'automatic', }, ], - }) + }), ) } @@ -317,7 +317,7 @@ async function startRegenerateSdk(argv, options) { let db = await dbApi.initDatabaseAndLoadSchema( dbFile, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) let sdk = await sdkUtil.readSdkJson(sdkPath, options) @@ -371,7 +371,7 @@ async function startRegenerateSdk(argv, options) { skipPostGeneration: false, appendGenerationSubdirectory: argv.appendGenerationSubdirectory, generationLog: argv.generationLog, - } + }, ) } } @@ -397,7 +397,7 @@ async function startAnalyze(argv, options) { let db = await dbApi.initDatabaseAndLoadSchema( dbFile, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) options.logger(' 👉 database and schema initialized') await zclLoader.loadZclMetafiles(db, argv.zclProperties, { @@ -414,7 +414,7 @@ async function startAnalyze(argv, options) { .then((report) => { options.logger(`🤖 File: ${singlePath}\n`) options.logger(report) - }) + }), ) options.logger('😎 Analysis done!') if (options.quitFunction != null) options.quitFunction() @@ -430,7 +430,7 @@ async function startServer(argv, quitFunction) { let db = await dbApi.initDatabaseAndLoadSchema( env.sqliteFile(), env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) watchdog.start(argv.watchdogTimer, () => { @@ -472,7 +472,7 @@ async function startSelfCheck( options = { quitFunction: null, logger: console.log, - } + }, ) { env.logInitStdout() options.logger('🤖 Starting self-check') @@ -484,7 +484,7 @@ async function startSelfCheck( let mainDb = await dbApi.initDatabaseAndLoadSchema( dbFile, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) options.logger(' 👉 database and schema initialized') let zclPackageIds = await zclLoader.loadZclMetafiles( @@ -492,7 +492,7 @@ async function startSelfCheck( argv.zclProperties, { failOnLoadingError: !argv.noLoadingFailure, - } + }, ) options.logger(` 👉 zcl metadata packages loaded: ${zclPackageIds.length}`) let ctx = await generatorEngine.loadTemplates( @@ -500,7 +500,7 @@ async function startSelfCheck( argv.generationTemplate, { failOnLoadingError: !argv.noLoadingFailure, - } + }, ) if (ctx.nop) { options.logger(` 👉 no generation template packages loaded`) @@ -508,7 +508,7 @@ async function startSelfCheck( options.logger(` ⚠️ ${ctx.error}`) } else { options.logger( - ` 👉 generation template packages loaded: ${ctx.packageIds.length}` + ` 👉 generation template packages loaded: ${ctx.packageIds.length}`, ) } @@ -535,7 +535,7 @@ async function generateSingleFile( postImportScript: null, packageMatch: dbEnum.packageMatch.fuzzy, generationLog: null, - } + }, ) { let hrstart = process.hrtime.bigint() let sessionId @@ -551,7 +551,7 @@ async function generateSingleFile( template: env.builtinTemplateMetafile(), }, null, - null + null, ) output = outputPattern } else { @@ -570,7 +570,7 @@ async function generateSingleFile( let sessPkg = await util.ensurePackagesAndPopulateSessionOptions( db, sessionId, - options + options, ) let usedTemplatePackageIds = [] for (let pkg of sessPkg) { @@ -594,7 +594,7 @@ async function generateSingleFile( sessionId, usedTemplatePackageIds[i], output, - options + options, ) if (genResult.hasErrors) { @@ -627,7 +627,7 @@ async function startGeneration(argv, options) { 🔍 output pattern: ${output} 🔍 using templates: ${templateMetafile} 🔍 using zcl data: ${zclProperties} - 🔍 zap version: ${env.zapVersionAsString()}` + 🔍 zap version: ${env.zapVersionAsString()}`, ) let dbFile = env.sqliteFile('generate') @@ -635,7 +635,7 @@ async function startGeneration(argv, options) { let mainDb = await dbApi.initDatabaseAndLoadSchema( dbFile, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) await zclLoader.loadZclMetafiles(mainDb, zclProperties, { @@ -676,8 +676,8 @@ async function startGeneration(argv, options) { globalTemplatePackageId, output, index, - options - ) + options, + ), ) await dbApi.closeDatabase(mainDb) diff --git a/src-electron/rest/endpoint.js b/src-electron/rest/endpoint.js index c6b9f80e4a..6c81c324d7 100644 --- a/src-electron/rest/endpoint.js +++ b/src-electron/rest/endpoint.js @@ -84,7 +84,7 @@ function httpPostEndpoint(db) { let parentEndpointRef = await queryEndpoint.getParentEndpointRef( db, parentEndpointIdentifier, - sessionId + sessionId, ) if (parentEndpointRef == null && parentEndpointIdentifier != null) { parentEndpointIdentifier = null @@ -96,7 +96,7 @@ function httpPostEndpoint(db) { endpointType, networkId, profileId, - parentEndpointRef + parentEndpointRef, ) try { let validationData = await validation.validateEndpoint(db, newId) @@ -130,7 +130,7 @@ function httpPatchEndpoint(db) { let parentEndpointRef = await queryEndpoint.getParentEndpointRef( db, parentEndpointIdentifier, - sessionIdexport + sessionIdexport, ) if (parentEndpointRef == null && parentEndpointIdentifier != null) { parentEndpointIdentifier = null @@ -139,7 +139,7 @@ function httpPatchEndpoint(db) { db, sessionIdexport, context.id, - parentEndpointRef + parentEndpointRef, ) let changes = context.changes.map((data) => { let paramType = '' @@ -175,7 +175,7 @@ function httpPostEndpointType(db) { await querySession.selectSessionPartitionInfoFromDeviceType( db, sessionId, - deviceTypeRef + deviceTypeRef, ) try { let newId = await queryConfig.insertEndpointType( @@ -184,7 +184,7 @@ function httpPostEndpointType(db) { name, deviceTypeRef, deviceIdentifier, - deviceVersion + deviceVersion, ) response.status(StatusCodes.OK).json({ @@ -224,7 +224,7 @@ function httpPatchEndpointType(db) { db, sessionId, context.endpointTypeId, - changes + changes, ) response.status(StatusCodes.OK).json({ diff --git a/src-electron/rest/file-ops.js b/src-electron/rest/file-ops.js index 92ba9127b2..3f543c518f 100644 --- a/src-electron/rest/file-ops.js +++ b/src-electron/rest/file-ops.js @@ -53,7 +53,7 @@ function httpPostFileOpen(db) { let p if (studio.integrationEnabled(db, req.zapSessionId)) { p = path.posix.dirname( - path.posix.dirname(path.posix.dirname(zapFilePath)) + path.posix.dirname(path.posix.dirname(zapFilePath)), ) } else { p = path.posix.basename(zapFilePath) @@ -66,7 +66,7 @@ function httpPostFileOpen(db) { // set path before importDataFromFile() to avoid triggering DIRTY flag if (ideProjectPath) { env.logInfo( - `StudioUC(${name}): Setting project path to ${ideProjectPath}` + `StudioUC(${name}): Setting project path to ${ideProjectPath}`, ) } // store studio project path @@ -74,7 +74,7 @@ function httpPostFileOpen(db) { db, req.zapSessionId, dbEnum.sessionKey.ideProjectPath, - ideProjectPath + ideProjectPath, ) let importResult = await importJs.importDataFromFile(db, zapFilePath, { @@ -87,8 +87,8 @@ function httpPostFileOpen(db) { } env.logInfo( `Loaded project(${name}) into database. RESP: ${JSON.stringify( - response - )}` + response, + )}`, ) res.status(StatusCodes.OK).json(response) @@ -102,7 +102,7 @@ function httpPostFileOpen(db) { studio.sendSessionCreationErrorStatus( db, errMsg.message, - req.zapSessionId + req.zapSessionId, ) env.logError(e.message) queryNotification.setNotification( @@ -111,7 +111,7 @@ function httpPostFileOpen(db) { errMsg.message, req.zapSessionId, 1, - 0 + 0, ) res.status(StatusCodes.INTERNAL_SERVER_ERROR).json(errMsg) } @@ -124,7 +124,7 @@ function httpPostFileOpen(db) { errMsg.message, req.zapSessionId, 2, - 0 + 0, ) res.status(StatusCodes.BAD_REQUEST).send({ error: msg }) } @@ -147,7 +147,7 @@ function httpPostFileSave(db) { actualPath = await querySession.getSessionKeyValue( db, req.zapSessionId, - dbEnum.sessionKey.filePath + dbEnum.sessionKey.filePath, ) } else { actualPath = await querySession @@ -155,7 +155,7 @@ function httpPostFileSave(db) { db, req.zapSessionId, dbEnum.sessionKey.filePath, - zapPath + zapPath, ) .then(() => zapPath) } @@ -165,7 +165,7 @@ function httpPostFileSave(db) { let filePath = await exportJs.exportDataIntoFile( db, req.zapSessionId, - actualPath + actualPath, ) res.status(StatusCodes.OK).send({ filePath: filePath }) } catch (err) { @@ -177,7 +177,7 @@ function httpPostFileSave(db) { msg, req.zapSessionId, 1, - 0 + 0, ) res.status(StatusCodes.INTERNAL_SERVER_ERROR).json(err) } diff --git a/src-electron/rest/generation.js b/src-electron/rest/generation.js index d4a9f82d92..590d4cbc5a 100644 --- a/src-electron/rest/generation.js +++ b/src-electron/rest/generation.js @@ -39,7 +39,7 @@ function httpGetPreviewNameIndex(db) { let previewObject = await generationEngine.generateSingleFileForPreview( db, sessionId, - request.params.name + request.params.name, ) if (request.params.index in previewObject) { @@ -65,7 +65,7 @@ function httpGetPreviewName(db) { let previewObject = await generationEngine.generateSingleFileForPreview( db, sessionId, - request.params.name + request.params.name, ) response.status(StatusCodes.OK).json(previewObject) } @@ -98,7 +98,7 @@ function httpPutGenerate(db) { let pkgs = await queryPackage.getSessionPackagesByType( db, sessionId, - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) let promises = [] @@ -108,8 +108,8 @@ function httpPutGenerate(db) { db, sessionId, pkg.id, - generationDirectory - ) + generationDirectory, + ), ) }) await Promise.all(promises) diff --git a/src-electron/rest/ide-api-handler.js b/src-electron/rest/ide-api-handler.js index e0035c5483..d7f357c151 100644 --- a/src-electron/rest/ide-api-handler.js +++ b/src-electron/rest/ide-api-handler.js @@ -51,7 +51,7 @@ async function httpPostComponentUpdateHandler(db, request, response, add) { componentIds, clusterId, add, - side + side, ) await studio.sendComponentUpdateStatus(db, request.zapSessionId, { data: res, diff --git a/src-electron/rest/initialize.js b/src-electron/rest/initialize.js index fa81f643c3..35988f4293 100644 --- a/src-electron/rest/initialize.js +++ b/src-electron/rest/initialize.js @@ -56,13 +56,13 @@ function sessionAttempt(db) { const zclProperties = await queryPackage.getPackagesByCategoryAndType( db, dbEnum.packageType.zclProperties, - category + category, ) const zclGenTemplates = await queryPackage.getPackagesByCategoryAndType( db, dbEnum.packageType.genTemplatesJson, - category + category, ) const sessions = await querySession.getDirtySessionsWithPackages(db) return res.send({ @@ -77,11 +77,11 @@ function sessionAttempt(db) { let open = true const zclProperties = await queryPackage.getPackagesByType( db, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) const zclGenTemplates = await queryPackage.getPackagesByType( db, - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) const sessions = await querySession.getDirtySessionsWithPackages(db) return res.send({ @@ -95,11 +95,11 @@ function sessionAttempt(db) { let open = true const zclProperties = await queryPackage.getPackagesByType( db, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) const zclGenTemplates = await queryPackage.getPackagesByType( db, - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) const sessions = await querySession.getDirtySessionsWithPackages(db) return res.send({ @@ -113,11 +113,11 @@ function sessionAttempt(db) { let open = false const zclProperties = await queryPackage.getPackagesByType( db, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) const zclGenTemplates = await queryPackage.getPackagesByType( db, - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) const sessions = await querySession.getDirtySessionsWithPackages(db) return res.send({ @@ -182,7 +182,7 @@ function sessionCreate(db) { result.sessionId, { partitions: result.partitions }, pkgArray, - genTemplate + genTemplate, ) }) } @@ -205,7 +205,7 @@ function initializeSession(db) { req.body.sessionId, {}, req.body.zclProperties, - req.body.genTemplate + req.body.genTemplate, ) return res.send({ message: 'Session created successfully', @@ -227,7 +227,7 @@ function loadPreviousSessions(db) { db, req.body.sessionId, user.userId, - sessionUuid + sessionUuid, ) return res.send({ message: 'Session reloaded successfully', diff --git a/src-electron/rest/static-zcl.js b/src-electron/rest/static-zcl.js index be2011c066..6ce27f164a 100644 --- a/src-electron/rest/static-zcl.js +++ b/src-electron/rest/static-zcl.js @@ -51,19 +51,19 @@ async function returnZclEntitiesForClusterId(db, clusterId, packageId) { return zclEntityQuery(queryZcl.selectAllClusters, queryZcl.selectClusterById)( db, clusterId, - packageId + packageId, ).then((x) => zclEntityQuery( queryZcl.selectAllAttributes, - queryZcl.selectAttributesByClusterIdIncludingGlobal + queryZcl.selectAttributesByClusterIdIncludingGlobal, )(db, clusterId, [packageId]).then((y) => zclEntityQuery( queryCommand.selectAllCommands, - queryCommand.selectCommandsByClusterId + queryCommand.selectCommandsByClusterId, )(db, clusterId, packageId).then((z) => zclEntityQuery( queryEvent.selectAllEvents, - queryEvent.selectEventsByClusterId + queryEvent.selectEventsByClusterId, )(db, clusterId, packageId).then((g) => { return { clusterData: x, @@ -71,9 +71,9 @@ async function returnZclEntitiesForClusterId(db, clusterId, packageId) { commandData: z, eventData: g, } - }) - ) - ) + }), + ), + ), ) } @@ -83,7 +83,7 @@ function mergeZclClusterAttributeCommandEventData(accumulated, currentValue) { clusterData: [accumulated.clusterData, currentValue.clusterData].flat(1), commandData: [accumulated.commandData, currentValue.commandData].flat(1), attributeData: [accumulated.attributeData, currentValue.attributeData].flat( - 1 + 1, ), eventData: [accumulated.eventData, currentValue.eventData].flat(1), } @@ -97,13 +97,13 @@ function reduceAndConcatenateZclEntity( mergeFunction = (accumulated, currentValue) => { return [accumulated, currentValue].flat(1) }, - defaultValue = [] + defaultValue = [], ) { let dataArray = packageIdArray.map((packageId) => - zclQueryCallback(db, id, packageId) + zclQueryCallback(db, id, packageId), ) return Promise.all(dataArray).then((x) => - x.reduce(mergeFunction, defaultValue) + x.reduce(mergeFunction, defaultValue), ) } @@ -111,10 +111,10 @@ async function parseForZclData(db, entity, id, packageIdArray) { // Retrieve all the standalone custom xml packages let packageData = await queryPackage.getPackagesByPackageIds( db, - packageIdArray + packageIdArray, ) let standalonePackages = packageData.filter( - (pd) => pd.type === dbEnum.packageType.zclXmlStandalone + (pd) => pd.type === dbEnum.packageType.zclXmlStandalone, ) let standAlonePackageIds = standalonePackages.map((sp) => sp.id) @@ -124,7 +124,7 @@ async function parseForZclData(db, entity, id, packageIdArray) { db, id, packageIdArray, - zclEntityQuery(queryZcl.selectAllAtomics, queryZcl.selectAtomicById) + zclEntityQuery(queryZcl.selectAllAtomics, queryZcl.selectAtomicById), ) case 'cluster': // Making sure that global attributes are being collected from packages @@ -145,7 +145,7 @@ async function parseForZclData(db, entity, id, packageIdArray) { attributeData: [], commandData: [], eventData: [], - } + }, ) : reduceAndConcatenateZclEntity( db, @@ -160,8 +160,8 @@ async function parseForZclData(db, entity, id, packageIdArray) { attributeData: [], commandData: [], eventData: [], - } - ) + }, + ), ) .then((data) => { return { @@ -176,21 +176,21 @@ async function parseForZclData(db, entity, id, packageIdArray) { db, id, packageIdArray, - zclEntityQuery(queryZcl.selectAllDomains, queryZcl.selectDomainById) + zclEntityQuery(queryZcl.selectAllDomains, queryZcl.selectDomainById), ) case 'bitmap': return reduceAndConcatenateZclEntity( db, id, packageIdArray, - zclEntityQuery(queryZcl.selectAllBitmaps, queryZcl.selectBitmapById) + zclEntityQuery(queryZcl.selectAllBitmaps, queryZcl.selectBitmapById), ) case 'enum': return reduceAndConcatenateZclEntity( db, id, packageIdArray, - zclEntityQuery(queryZcl.selectAllEnums, queryZcl.selectEnumById) + zclEntityQuery(queryZcl.selectAllEnums, queryZcl.selectEnumById), ) case 'struct': return reduceAndConcatenateZclEntity( @@ -199,7 +199,7 @@ async function parseForZclData(db, entity, id, packageIdArray) { packageIdArray, zclEntityQuery(queryZcl.selectAllStructsWithItemCount, [ queryZcl.selectStructById, - ]) + ]), ) case 'deviceType': return reduceAndConcatenateZclEntity( @@ -208,8 +208,8 @@ async function parseForZclData(db, entity, id, packageIdArray) { packageIdArray, zclEntityQuery( queryDeviceType.selectAllDeviceTypes, - queryDeviceType.selectDeviceTypeById - ) + queryDeviceType.selectDeviceTypeById, + ), ) case 'endpointTypeClusters': return queryZcl.selectEndpointTypeClustersByEndpointTypeId(db, id) @@ -244,7 +244,7 @@ function httpGetZclEntity(db) { let packageIdArray = await queryPackage.getSessionZclPackageIds( db, - sessionId + sessionId, ) let resultData = await parseForZclData(db, entity, id, packageIdArray) response.status(StatusCodes.OK).json(resultData) @@ -272,7 +272,7 @@ function httpGetZclExtension(db) { .getSessionPackagesByType( db, sessionId, - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) .then((pkgs) => (pkgs.length == 0 ? null : pkgs[0].id)) .then((packageId) => { diff --git a/src-electron/rest/user-data.js b/src-electron/rest/user-data.js index 7ecb67b975..d7fc6489d3 100644 --- a/src-electron/rest/user-data.js +++ b/src-electron/rest/user-data.js @@ -50,7 +50,7 @@ function httpGetSessionKeyValues(db) { let sessionId = request.zapSessionId let sessionKeyValues = await querySession.getAllSessionKeyValues( db, - sessionId + sessionId, ) response.status(StatusCodes.OK).json(sessionKeyValues) } @@ -83,7 +83,7 @@ function httpGetSessionNotifications(db) { let sessionId = request.zapSessionId let notifications = await querySessionNotification.getNotification( db, - sessionId + sessionId, ) response.status(StatusCodes.OK).json(notifications) } @@ -171,7 +171,7 @@ function httpGetUnseenNotificationAndUpdate(db) { let unseenIds = request.query.unseenIds let resp = await querySessionNotification.markNotificationsAsSeen( db, - unseenIds + unseenIds, ) response.status(StatusCodes.OK).json(resp) } @@ -212,7 +212,7 @@ function httpPostCluster(db) { .getSessionPackagesByType( db, sessionId, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) .then((pkgs) => pkgs?.shift()?.id) // default to always picking first package @@ -229,7 +229,7 @@ function httpPostCluster(db) { endpointTypeId, id, side, - flag + flag, ) if (insertDefault) { @@ -271,7 +271,7 @@ function httpPostForcedExternal(db) { let sessionId = request.zapSessionId let packages = await queryPackage.getPackageSessionPackagePairBySessionId( db, - sessionId + sessionId, ) let packageIds = packages.map((pkg) => pkg.id) let forcedExternal = await upgrade.getForcedExternalStorage(db, packageIds) @@ -330,9 +330,9 @@ function httpPostAttributeUpdate(db) { paramArray, reportMinInterval, reportMaxInterval, - reportableChange - ) - ) + reportableChange, + ), + ), ) // send latest value to frontend to update UI @@ -340,7 +340,7 @@ function httpPostAttributeUpdate(db) { db, endpointTypeIdList[0], id, - clusterRef + clusterRef, ) // only return 1 validation result. @@ -351,7 +351,7 @@ function httpPostAttributeUpdate(db) { endpointTypeIdList[0], id, clusterRef, - request.zapSessionId + request.zapSessionId, ) response.status(StatusCodes.OK).json({ @@ -406,9 +406,9 @@ function httpPostCommandUpdate(db) { commandSide, id, value, - isIncoming - ) - ) + isIncoming, + ), + ), ) response.status(StatusCodes.OK).json({ @@ -439,7 +439,7 @@ function httpPostEventUpdate(db) { clusterRef, eventSide, id, - value + value, ) response.status(StatusCodes.OK).json({ @@ -498,7 +498,7 @@ function httpGetOption(db) { let sessionId = request.zapSessionId let packages = await queryPackage.getSessionPackages(db, sessionId) let p = packages.map((pkg) => - queryPackage.selectAllOptionsValues(db, pkg.packageRef, category) + queryPackage.selectAllOptionsValues(db, pkg.packageRef, category), ) let data = await Promise.all(p) data = data.flat(1) @@ -566,24 +566,24 @@ function httpPostAddNewPackage(db) { await querySession.selectSessionPartitionInfoFromPackageId( db, sessionId, - data.packageId + data.packageId, ) if (sessionPartitionInfoForNewPackage.length == 0) { let sessionPartitionInfo = await querySession.getAllSessionPartitionInfoForSession( db, - sessionId + sessionId, ) let sessionPartitionId = await querySession.insertSessionPartition( db, sessionId, - sessionPartitionInfo.length + 1 + sessionPartitionInfo.length + 1, ) await queryPackage.insertSessionPackage( db, sessionPartitionId, data.packageId, - true + true, ) } status = { @@ -619,7 +619,7 @@ function httpPostShareClusterStatesAcrossEndpoints(db) { let packageIds = await queryPackage.getSessionPackagesByType( db, sessionId, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) packageIds = packageIds.map(function getId(item) { return item.id @@ -634,7 +634,7 @@ function httpPostShareClusterStatesAcrossEndpoints(db) { db, endpointTypeIdList.map((id) => { return { endpointTypeId: id } - }) + }), ) .then((list) => list.filter((entry) => entry.endpointCount > 1)) @@ -642,7 +642,7 @@ function httpPostShareClusterStatesAcrossEndpoints(db) { db, endpointTypeIdList, sharedClusterList, - packageIds + packageIds, ) await writeAttributeDefaults(db, attrDefaults) @@ -650,7 +650,7 @@ function httpPostShareClusterStatesAcrossEndpoints(db) { db, endpointTypeIdList, sharedClusterList, - packageIds + packageIds, ) await writeCommandDefaults(db, cmdDefaults) @@ -665,7 +665,7 @@ async function commandDefaults( db, endpointTypeIdList, sharedClusterList, - packageIds + packageIds, ) { let sharedCmdDefaults = {} let clusCmdToCmdObj = {} @@ -675,7 +675,7 @@ async function commandDefaults( sharedClusterList.map((c) => { return { endpointTypeClusterRef: c.endpointClusterId } }), - packageIds + packageIds, ) for (const endpointTypeId of endpointTypeIdList) { @@ -698,7 +698,7 @@ async function commandDefaults( let cmds = await queryEndpoint.selectEndpointClusterCommands( db, sharedCmd.clusterId, - endpointTypeId + endpointTypeId, ) // find attr @@ -727,8 +727,8 @@ async function writeCommandDefaults(db, defaults) { cmd.source, cmd.id, cmd.isIncoming, - true - ) + true, + ), ) promises.push( @@ -739,8 +739,8 @@ async function writeCommandDefaults(db, defaults) { cmd.source, cmd.id, cmd.isOutgoing, - false - ) + false, + ), ) } } @@ -751,7 +751,7 @@ async function attributeDefaults( db, endpointTypeIdList, sharedClusterList, - packageIds + packageIds, ) { let sharedAttributeDefaults = {} let clusterIdnSideToAttrCache = {} @@ -759,7 +759,7 @@ async function attributeDefaults( await queryAttribute.selectAttributeDetailsFromEnabledClusters( db, sharedClusterList, - packageIds + packageIds, ) for (const endpointTypeId of endpointTypeIdList) { @@ -779,19 +779,19 @@ async function attributeDefaults( !(endpointTypeId in sharedAttributeDefaults) && (sharedAttributeDefaults[endpointTypeId] = []) sharedAttributeDefaults[endpointTypeId].push( - clusterIdnSideToAttrCache[clusAttrCacheKey] + clusterIdnSideToAttrCache[clusAttrCacheKey], ) } else { let attributes = await queryEndpoint.selectEndpointClusterAttributes( db, sharedAttr.clusterId, sharedAttr.side, - endpointTypeId + endpointTypeId, ) // find attr let matched = attributes.filter((attr) => - attributeEquals(attr, sharedAttr) + attributeEquals(attr, sharedAttr), ) if (matched.length) { let m = matched.shift() @@ -843,8 +843,8 @@ async function writeAttributeDefaults(db, defaults) { ], attr.min, attr.max, - attr.reportableChange - ) + attr.reportableChange, + ), ) } } @@ -881,12 +881,12 @@ function httpDeleteSessionPackage(db) { await querySession.selectSessionPartitionInfoFromPackageId( db, sessionRef, - packageRef + packageRef, ) let removed = await queryPackage.deleteSessionPackage( db, sessionPartitionInfo[0].sessionPartitionId, - packageRef + packageRef, ) response.status(StatusCodes.OK).json({ @@ -912,7 +912,7 @@ function httpPostDuplicateEndpoint(db) { db, endpointId, endpointIdentifier, - endpointTypeId + endpointTypeId, ) res.status(StatusCodes.OK).json({ id: id }) } @@ -947,11 +947,11 @@ function httpPostDuplicateEndpointType(db) { async function duplicateEndpointTypeClusters( db, oldEndpointTypeId, - newEndpointTypeId + newEndpointTypeId, ) { let oldEndpointTypeClusters = await queryConfig.selectEndpointClusters( db, - oldEndpointTypeId + oldEndpointTypeId, ) oldEndpointTypeClusters.forEach(async (endpointTypeCluster) => { let newEndpointTypeClusterId = @@ -960,19 +960,19 @@ async function duplicateEndpointTypeClusters( newEndpointTypeId, endpointTypeCluster.clusterRef, endpointTypeCluster.side, - endpointTypeCluster.enabled + endpointTypeCluster.enabled, ) let oldAttributes = await queryAttribute.selectEndpointTypeAttributesByEndpointTypeRefAndClusterRef( db, oldEndpointTypeId, - endpointTypeCluster.endpointTypeClusterId + endpointTypeCluster.endpointTypeClusterId, ) oldAttributes.forEach(async (attrubute) => { await queryAttribute.duplicateEndpointTypeAttribute( db, newEndpointTypeClusterId, - attrubute + attrubute, ) }) }) diff --git a/src-electron/sdk/matter.js b/src-electron/sdk/matter.js index 875f259f8b..2a804518e4 100644 --- a/src-electron/sdk/matter.js +++ b/src-electron/sdk/matter.js @@ -40,7 +40,7 @@ async function getForcedExternalStorage(db, packageIds) { let forcedExternal = await queryPackage.getAttributeAccessInterface( db, dbEnum.storagePolicy.attributeAccessInterface, - packageIdsArray + packageIdsArray, ) return forcedExternal } catch (error) { @@ -70,7 +70,7 @@ async function computeStoragePolicyForGlobalAttributes( db, clusterId, attributes, - packageIds + packageIds, ) { try { let forcedExternal @@ -91,12 +91,12 @@ async function computeStoragePolicyForGlobalAttributes( }) } return attribute - }) + }), ) } catch (error) { console.error( 'Failed to compute storage policy for global attributes:', - error + error, ) throw error // Rethrow the error if you want to handle it further up the call stack } @@ -148,7 +148,7 @@ async function computeStoragePolicyNewConfig( clusterRef, storagePolicy, forcedExternal, - attributeName + attributeName, ) { try { let clusterName = await queryCluster.selectClusterName(db, clusterRef) @@ -189,7 +189,7 @@ async function computeStorageImport( clusterName, storagePolicy, forcedExternal, - attributeName + attributeName, ) { try { let updatedStoragePolicy = storagePolicy diff --git a/src-electron/server/http-server.js b/src-electron/server/http-server.js index 46e4bdbe0a..c8ac128cc1 100644 --- a/src-electron/server/http-server.js +++ b/src-electron/server/http-server.js @@ -35,7 +35,6 @@ const initialize = require('../rest/initialize') const dirtyFlag = require('../util/async-reporting') const notification = require('../db/query-session-notification.js') - const restApiModules = [ require('../rest/admin.js'), require('../rest/static-zcl.js'), @@ -114,7 +113,7 @@ async function initHttpServer( allowCors: false, zcl: env.builtinSilabsZclMetafile(), template: env.builtinTemplateMetafile(), - } + }, ) { return new Promise((resolve, reject) => { const app = express() @@ -125,11 +124,11 @@ async function initHttpServer( res.setHeader('Access-Control-Allow-Origin', '*') res.setHeader( 'Access-Control-Allow-Methods', - 'GET,POST,PUT,PATCH,DELETE,OPTIONS' + 'GET,POST,PUT,PATCH,DELETE,OPTIONS', ) res.setHeader( 'Access-Control-Allow-Headers', - 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With' + 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With', ) next() }) @@ -142,7 +141,7 @@ async function initHttpServer( secret: 'Zap@Watt@SiliconLabs', resave: true, saveUninitialized: true, - }) + }), ) app.use(userSessionHandler(db, options)) @@ -221,7 +220,7 @@ function userSessionHandler(db, options) { } studio.sendSessionCreationErrorStatus(db, resp, zapSessionId) env.logError(resp) - if(req.sessionId) { + if (req.sessionId) { notification.setNotification(db, 'ERROR', resp, zapSessionId, 1, 0) } }) diff --git a/src-electron/server/ipc-server.js b/src-electron/server/ipc-server.js index 100dde4fbd..24254116ff 100644 --- a/src-electron/server/ipc-server.js +++ b/src-electron/server/ipc-server.js @@ -81,7 +81,7 @@ function handlerStop(context, data) { server.ipc.server.emit( context.socket, eventType.overAndOut, - 'Shutting down server.' + 'Shutting down server.', ) startup.shutdown() util.waitFor(1000).then(() => startup.quit()) @@ -92,7 +92,7 @@ async function handlerGenerate(context, data) { let ps = [] let packages = await queryPackage.getPackagesByType( context.db, - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) let templatePackageId = packages[0].id @@ -109,15 +109,15 @@ async function handlerGenerate(context, data) { server.ipc.server.emit(context.socket, eventType.over, x), zcl: env.builtinSilabsZclMetafile(), template: env.builtinTemplateMetafile(), - } - ) + }, + ), ) }) return Promise.all(ps).then(() => { server.ipc.server.emit( context.socket, eventType.overAndOut, - 'Generation done.' + 'Generation done.', ) }) } @@ -189,7 +189,7 @@ async function initServer(db = null, httpPort = 0) { socket: socket, httpPort: httpPort, }, - data + data, ) }) }) diff --git a/src-electron/server/ws-server.js b/src-electron/server/ws-server.js index a5c84b56a0..0462f78f98 100644 --- a/src-electron/server/ws-server.js +++ b/src-electron/server/ws-server.js @@ -49,7 +49,7 @@ function initializeWebSocket(httpServer) { const indexOf = url.indexOf(token) if (indexOf == -1) { throw new Error( - `WebSockets require a ${restApi.param.sessionId} parameter` + `WebSockets require a ${restApi.param.sessionId} parameter`, ) } @@ -88,7 +88,7 @@ function initializeWebSocket(httpServer) { sendWebSocketData( socket, dbEnum.wsCategory.init, - 'WebSocket initialized handshake response.' + 'WebSocket initialized handshake response.', ) }) } diff --git a/src-electron/ui/browser-api.js b/src-electron/ui/browser-api.js index 3e356a5931..03d375e1b1 100644 --- a/src-electron/ui/browser-api.js +++ b/src-electron/ui/browser-api.js @@ -30,7 +30,7 @@ const env = require('../util/env') */ async function getSessionUuidFromBrowserWindow(browserWindow) { let sessionUuid = await browserWindow.webContents.executeJavaScript( - 'window.sessionStorage.getItem("session_uuid")' + 'window.sessionStorage.getItem("session_uuid")', ) return sessionUuid } @@ -43,7 +43,7 @@ async function getSessionUuidFromBrowserWindow(browserWindow) { */ async function getRendererApiInformation(browserWindow) { const info = await browserWindow.webContents.executeJavaScript( - `window.${rendApi.GLOBAL_SYMBOL_INFO}` + `window.${rendApi.GLOBAL_SYMBOL_INFO}`, ) let msg = ` Prefix: ${info.prefix} @@ -53,7 +53,7 @@ Functions:` msg = msg.concat( `\n - ${fn.id}: ${fn.description} ${ 'type' in fn ? '[' + fn.type + ']' : '' - }` + }`, ) }) return msg @@ -68,18 +68,18 @@ Functions:` async function execRendererApi(browserWindow, rendererApiCommand, ...theArgs) { const info = await browserWindow?.webContents.executeJavaScript( - `window.${rendApi.GLOBAL_SYMBOL_INFO}` + `window.${rendApi.GLOBAL_SYMBOL_INFO}`, ) let apiFound = info?.functions.filter((x) => x.id === rendererApiCommand) if (!apiFound?.length) { env.logBrowser( - `Unhandled renderer API function id invoked: ${rendererApiCommand}` + `Unhandled renderer API function id invoked: ${rendererApiCommand}`, ) return } else { return browserWindow.webContents.executeJavaScript( - `window.${rendApi.GLOBAL_SYMBOL_EXECUTE}('${rendererApiCommand}', "${theArgs}")` + `window.${rendApi.GLOBAL_SYMBOL_EXECUTE}('${rendererApiCommand}', "${theArgs}")`, ) } } @@ -129,7 +129,7 @@ function processRendererNotify(browserWindow, message) { async function reportFiles(browserWindow, result) { let resultJson = JSON.stringify(result) await browserWindow.webContents.executeJavaScript( - `window.${rendApi.GLOBAL_SYMBOL_EXECUTE}('${rendApi.id.reportFiles}', '${resultJson}')` + `window.${rendApi.GLOBAL_SYMBOL_EXECUTE}('${rendApi.id.reportFiles}', '${resultJson}')`, ) } diff --git a/src-electron/ui/main-ui.js b/src-electron/ui/main-ui.js index 12933f7d1f..85def03798 100644 --- a/src-electron/ui/main-ui.js +++ b/src-electron/ui/main-ui.js @@ -33,7 +33,7 @@ function hookSecondInstanceEvents(argv) { app .whenReady() .then(() => - startup.startUpSecondaryInstance(argv, { quitFunction: app.quit }) + startup.startUpSecondaryInstance(argv, { quitFunction: app.quit }), ) } @@ -47,7 +47,7 @@ function hookMainInstanceEvents(argv) { startup.startUpMainInstance(argv, { quitFunction: app.quit, uiEnableFunction: uiUtil.enableUi, - }) + }), ) .catch((err) => { console.log(err) @@ -80,5 +80,5 @@ let argv = args.processCommandLineArguments(process.argv) util.mainOrSecondaryInstance( argv.reuseZapInstance, () => hookMainInstanceEvents(argv), - () => hookSecondInstanceEvents(argv) + () => hookSecondInstanceEvents(argv), ) diff --git a/src-electron/ui/menu.js b/src-electron/ui/menu.js index 7302f41f3b..bc9e2f7a8b 100644 --- a/src-electron/ui/menu.js +++ b/src-electron/ui/menu.js @@ -84,7 +84,7 @@ const template = (httpPort) => [ browserApi.execRendererApi( browserWindow, rendApi.id.setDarkTheme, - true + true, ) }, }, @@ -94,7 +94,7 @@ const template = (httpPort) => [ browserApi.execRendererApi( browserWindow, rendApi.id.setDarkTheme, - false + false, ) }, }, @@ -169,7 +169,7 @@ const template = (httpPort) => [ browserApi.execRendererApi( browserWindow, rendApi.id.progressStart, - 'Test progress indication.' + 'Test progress indication.', ) }, }, @@ -204,9 +204,8 @@ const template = (httpPort) => [ async function getUserSessionInfoMessage(browserWindow) { let userKey = await browserApi.getUserKeyFromBrowserWindow(browserWindow) - let sessionUuid = await browserApi.getSessionUuidFromBrowserWindow( - browserWindow - ) + let sessionUuid = + await browserApi.getSessionUuidFromBrowserWindow(browserWindow) return ` Browser session UUID: ${sessionUuid} Browser user key: ${userKey} @@ -225,7 +224,7 @@ function doOpen(browserWindow, httpPort) { .execRendererApi( browserWindow, rendApi.id.getStorageItem, - rendApi.storageKey.fileSave + rendApi.storageKey.fileSave, ) .then((filePath) => { let opts = { @@ -244,7 +243,7 @@ function doOpen(browserWindow, httpPort) { browserWindow, rendApi.id.setStorageItem, rendApi.storageKey.fileSave, - result.filePaths[0] + result.filePaths[0], ) } }) @@ -276,7 +275,7 @@ function doSaveAs(browserWindow) { .execRendererApi( browserWindow, rendApi.id.getStorageItem, - rendApi.storageKey.fileSave + rendApi.storageKey.fileSave, ) .then((filePath) => { let opts = { @@ -308,7 +307,7 @@ function doSaveAs(browserWindow) { browserWindow, rendApi.id.setStorageItem, rendApi.storageKey.fileSave, - filePath + filePath, ) } }) diff --git a/src-electron/ui/ui-util.js b/src-electron/ui/ui-util.js index 6afd9336ac..0e530d0efa 100644 --- a/src-electron/ui/ui-util.js +++ b/src-electron/ui/ui-util.js @@ -141,7 +141,7 @@ function enableUi(port, zapFiles, uiMode, standalone) { }) } else { return util.executePromisesSequentially(zapFiles, (f) => - openFileConfiguration(f, port) + openFileConfiguration(f, port), ) } } diff --git a/src-electron/ui/window.js b/src-electron/ui/window.js index 73b8ac464d..b5d111d48a 100644 --- a/src-electron/ui/window.js +++ b/src-electron/ui/window.js @@ -125,7 +125,7 @@ export function windowCreate(port, args) { args?.standalone, args?.new, args?.filePath, - httpServer.httpServerPort() + httpServer.httpServerPort(), ) // @ts-ignore @@ -162,7 +162,7 @@ export function windowCreate(port, args) { if (!browserApi.processRendererNotify(w, message)) { env.logBrowser(message) } - } + }, ) w.webContents.on('before-input-event', (e, input) => { if (input.type === 'keyUp' && input.key.toLowerCase() === 'alt') { diff --git a/src-electron/util/args.js b/src-electron/util/args.js index 4368580cff..48f251b7d9 100644 --- a/src-electron/util/args.js +++ b/src-electron/util/args.js @@ -226,7 +226,7 @@ export function processCommandLineArguments(argv) { zapVersion.featureLevel }\nHash: ${zapVersion.hash}\nDate: ${zapVersion.date}${ zapVersion.source ? '\nMode: source' : '\nMode: binary' - }${zapVersion.source ? '' : `\nExecutable: ${process.argv0}`} ` + }${zapVersion.source ? '' : `\nExecutable: ${process.argv0}`} `, ) .help() .alias({ @@ -235,7 +235,7 @@ export function processCommandLineArguments(argv) { .epilogue( `Environment variables: ${environmentVariablesDescription()} -For more information, see ${commonUrl.projectUrl}` +For more information, see ${commonUrl.projectUrl}`, ) .wrap(null) .parse(argv) @@ -243,7 +243,7 @@ For more information, see ${commonUrl.projectUrl}` // Apply Jenkins logic. if (ret.jenkins) { console.log( - '🔧 Detected Jenkins environment. Making necessary adjustments.' + '🔧 Detected Jenkins environment. Making necessary adjustments.', ) if (process.env[env.environmentVariable.skipPostGen.name] == null) { ret.skipPostGen = true @@ -269,11 +269,11 @@ For more information, see ${commonUrl.projectUrl}` if (ret.tempState) { let tempDir = fs.mkdtempSync(`${os.tmpdir()}${path.sep}zap.`) console.log( - `🔧 Using temporary state directory: ${env.setAppDirectory(tempDir)}` + `🔧 Using temporary state directory: ${env.setAppDirectory(tempDir)}`, ) } else { console.log( - `🔧 Using state directory: ${env.setAppDirectory(ret.stateDirectory)}` + `🔧 Using state directory: ${env.setAppDirectory(ret.stateDirectory)}`, ) } diff --git a/src-electron/util/async-reporting.js b/src-electron/util/async-reporting.js index 249dbcacf8..05857fa66a 100644 --- a/src-electron/util/async-reporting.js +++ b/src-electron/util/async-reporting.js @@ -67,7 +67,7 @@ async function sendDirtyFlagStatus(db, session) { let msg = err.toString() if (!msg.includes('SQLITE_MISUSE')) { env.logWarning( - `Error reading dirty flag status: ${session.sessionKey} => ${err}` + `Error reading dirty flag status: ${session.sessionKey} => ${err}`, ) notification.setNotification( db, @@ -75,7 +75,7 @@ async function sendDirtyFlagStatus(db, session) { `Error reading dirty flag status: ${session.sessionKey} => ${err}`, session.sessionId, 2, - 0 + 0, ) } } @@ -92,17 +92,17 @@ async function sendNotificationUpdate(db, session) { if (socket) { let currentSession = await querySession.getSessionFromSessionId( db, - session.sessionId + session.sessionId, ) if (currentSession.newNotification) { let notificationCount = await notification.getUnseenNotificationCount( db, - session.sessionId + session.sessionId, ) wsServer.sendWebSocketData( socket, dbEnum.wsCategory.notificationCount, - notificationCount + notificationCount, ) await querySession.setSessionNewNotificationClean(db, session.sessionId) } diff --git a/src-electron/util/env.js b/src-electron/util/env.js index a11e3bf3c6..5aa1da2448 100644 --- a/src-electron/util/env.js +++ b/src-electron/util/env.js @@ -80,7 +80,7 @@ export function builtinDotdotZclMetafile() { export function builtinMatterZclMetafile2() { return locateProjectResource( - './zcl-builtin/matter/zcl-with-test-extensions.json' + './zcl-builtin/matter/zcl-with-test-extensions.json', ) } @@ -192,7 +192,7 @@ export function logInitLogFile() { if (!explicit_logger_set) { pino_logger = pino( pinoOptions, - pino.destination(path.join(appDirectory(), 'zap.log')) + pino.destination(path.join(appDirectory(), 'zap.log')), ) explicit_logger_set = true } @@ -287,7 +287,7 @@ export function locateProjectResource(filePath) { return path.join(__dirname, '../../../', filePath) } else { throw new Error( - `Zap integrity error: can not locate resource: ${filePath}.` + `Zap integrity error: can not locate resource: ${filePath}.`, ) } } @@ -484,7 +484,7 @@ export function versionsCheck() { console.log(`Expected node versions: ${expectedNodeVersion}`) console.log(`Provided node version: ${nodeVersion}`) console.log( - 'WARNING: you are using different node version than recommended.' + 'WARNING: you are using different node version than recommended.', ) } if ( @@ -495,7 +495,7 @@ export function versionsCheck() { console.log(`Expected electron version: ${expectedElectronVersion}`) console.log(`Provided electron version: ${electronVersion}`) console.log( - 'WARNING: you are using different electron version that recommended.' + 'WARNING: you are using different electron version that recommended.', ) } return ret diff --git a/src-electron/util/external-helper-api.js b/src-electron/util/external-helper-api.js index 4c5ec93a06..eed080016a 100644 --- a/src-electron/util/external-helper-api.js +++ b/src-electron/util/external-helper-api.js @@ -29,7 +29,7 @@ const querySessionZcl = require('../db/query-session-zcl.js') async function availableClusters(context) { let clusters = querySessionZcl.selectAllSessionClusters( context.db, - context.sessionId + context.sessionId, ) return clusters } @@ -43,7 +43,7 @@ async function availableClusters(context) { async function availableEvents(context) { let packageIds = await queryPackage.getSessionZclPackageIds( context.db, - context.sessionId + context.sessionId, ) let events = await queryEvent.selectAllEvents(context.db, packageIds) return events @@ -58,7 +58,7 @@ async function availableEvents(context) { async function availableCommands(context) { let packageIds = await queryPackage.getSessionZclPackageIds( context.db, - context.sessionId + context.sessionId, ) let commands = await queryCommand.selectAllCommands(context.db, packageIds) return commands @@ -73,7 +73,7 @@ async function availableCommands(context) { async function availableAttributes(context) { let packageIds = await queryPackage.getSessionZclPackageIds( context.db, - context.sessionId + context.sessionId, ) let attributes = await queryZcl.selectAllAttributes(context.db, packageIds) return attributes diff --git a/src-electron/util/external-helper-register.js b/src-electron/util/external-helper-register.js index 2159a13c34..93023277e9 100644 --- a/src-electron/util/external-helper-register.js +++ b/src-electron/util/external-helper-register.js @@ -78,7 +78,7 @@ function registerHelpers(singleHelper, registerHelper, context) { // Register the helper function with Handlebars context.hb.registerHelper( singleHelper, - helperWrapper(registerHelper, context) + helperWrapper(registerHelper, context), ) } diff --git a/src-electron/util/iterator-util.js b/src-electron/util/iterator-util.js index 81bf188ae4..3547373084 100644 --- a/src-electron/util/iterator-util.js +++ b/src-electron/util/iterator-util.js @@ -35,14 +35,14 @@ async function all_user_cluster_commands_helper(options) { let endpointsAndClusters = await queryEndpointType.selectClustersAndEndpointDetailsFromEndpointTypes( this.global.db, - endpointTypes + endpointTypes, ) return queryCommand.selectCommandDetailsFromAllEndpointTypesAndClusters( this.global.db, endpointsAndClusters, true, - packageIds + packageIds, ) } diff --git a/src-electron/util/post-import-api.js b/src-electron/util/post-import-api.js index ce2e5fc80c..1b9bc3ed67 100644 --- a/src-electron/util/post-import-api.js +++ b/src-electron/util/post-import-api.js @@ -73,7 +73,7 @@ function deleteEndpoint(context, endpoint) { function clusters(context, endpoint) { return queryEndpoint.selectEndpointClusters( context.db, - endpoint.endpointTypeRef + endpoint.endpointTypeRef, ) } @@ -90,7 +90,7 @@ function attributes(context, endpoint, cluster) { context.db, cluster.clusterId, cluster.side, - endpoint.endpointTypeRef + endpoint.endpointTypeRef, ) } @@ -106,7 +106,7 @@ function commands(context, endpoint, cluster) { return queryEndpoint.selectEndpointClusterCommands( context.db, cluster.clusterId, - endpoint.endpointTypeRef + endpoint.endpointTypeRef, ) } @@ -149,7 +149,7 @@ async function findCluster(context, code, mfgCode = null) { context.db, context.sessionId, code, - mfgCode + mfgCode, ) } @@ -158,7 +158,7 @@ async function findAttribute( clusterCode, side, attributeCode, - mfgCode = null + mfgCode = null, ) { return querySessionZcl.selectSessionAttributeByCode( context.db, @@ -166,7 +166,7 @@ async function findAttribute( clusterCode, side, attributeCode, - mfgCode + mfgCode, ) } @@ -176,7 +176,7 @@ async function findCommand(context, clusterCode, commandCode, source) { context.sessionId, clusterCode, commandCode, - source + source, ) } @@ -192,7 +192,7 @@ async function modifyCluster(context, endpoint, code, side, enabled) { endpoint.endpointTypeRef, cluster.id, side, - enabled + enabled, ) } @@ -203,7 +203,7 @@ async function modifyAttribute( clusterCode, attributeCode, side, - enable + enable, ) { let cluster = await findCluster(context, clusterCode) if (cluster == null) { @@ -214,8 +214,8 @@ async function modifyAttribute( if (attribute == null) { printError( `Attribute 0x${attributeCode.toString( - 16 - )} in cluster 0x${clusterCode.toString(16)} does not exist.` + 16, + )} in cluster 0x${clusterCode.toString(16)} does not exist.`, ) return null } @@ -235,7 +235,7 @@ async function modifyAttribute( params, attribute.reportMinInterval, attribute.reportMaxInterval, - attribute.reportableChange + attribute.reportableChange, ) } @@ -247,7 +247,7 @@ async function modifyCommand( commandCode, source, isIncoming, - enable + enable, ) { let cluster = await findCluster(context, clusterCode) if (cluster == null) { @@ -258,8 +258,8 @@ async function modifyCommand( if (command == null) { printError( `Command 0x${commandCode.toString( - 16 - )} in cluster 0x${clusterCode.toString(16)} does not exist.` + 16, + )} in cluster 0x${clusterCode.toString(16)} does not exist.`, ) return null } @@ -270,7 +270,7 @@ async function modifyCommand( command.source, command.id, enable ? 1 : 0, - isIncoming + isIncoming, ) } @@ -326,7 +326,7 @@ async function disableClientAttribute( context, endpoint, clusterCode, - attributeCode + attributeCode, ) { return modifyAttribute( context, @@ -334,7 +334,7 @@ async function disableClientAttribute( clusterCode, attributeCode, dbEnum.side.client, - false + false, ) } @@ -350,7 +350,7 @@ async function enableClientAttribute( context, endpoint, clusterCode, - attributeCode + attributeCode, ) { return modifyAttribute( context, @@ -358,7 +358,7 @@ async function enableClientAttribute( clusterCode, attributeCode, dbEnum.side.client, - true + true, ) } @@ -374,7 +374,7 @@ async function disableServerAttribute( context, endpoint, clusterCode, - attributeCode + attributeCode, ) { return modifyAttribute( context, @@ -382,7 +382,7 @@ async function disableServerAttribute( clusterCode, attributeCode, dbEnum.side.server, - false + false, ) } @@ -398,7 +398,7 @@ async function enableServerAttribute( context, endpoint, clusterCode, - attributeCode + attributeCode, ) { return modifyAttribute( context, @@ -406,7 +406,7 @@ async function enableServerAttribute( clusterCode, attributeCode, dbEnum.side.server, - true + true, ) } @@ -425,7 +425,7 @@ async function disableIncomingCommand( endpoint, clusterCode, commandCode, - source + source, ) { return modifyCommand( context, @@ -434,7 +434,7 @@ async function disableIncomingCommand( commandCode, source, true, - false + false, ) } @@ -453,7 +453,7 @@ async function enableIncomingCommand( endpoint, clusterCode, commandCode, - source + source, ) { return modifyCommand( context, @@ -462,7 +462,7 @@ async function enableIncomingCommand( commandCode, source, true, - true + true, ) } @@ -481,7 +481,7 @@ async function disableOutgoingCommand( endpoint, clusterCode, commandCode, - source + source, ) { return modifyCommand( context, @@ -490,7 +490,7 @@ async function disableOutgoingCommand( commandCode, source, false, - false + false, ) } @@ -509,7 +509,7 @@ async function enableOutgoingCommand( endpoint, clusterCode, commandCode, - source + source, ) { return modifyCommand( context, @@ -518,7 +518,7 @@ async function enableOutgoingCommand( commandCode, source, false, - true + true, ) } diff --git a/src-electron/util/sdk-util.js b/src-electron/util/sdk-util.js index 37d4d594ce..8026850ad7 100644 --- a/src-electron/util/sdk-util.js +++ b/src-electron/util/sdk-util.js @@ -36,7 +36,7 @@ async function readSdkJson( sdkPath, options = { logger: (msg) => {}, - } + }, ) { options.logger(` 👈 read in: ${sdkPath}`) let data = await fsp.readFile(sdkPath) @@ -51,7 +51,7 @@ async function readSdkJson( options.logger(` 👉 sdk location: ${sdkRoot}`) let featureLevelMatch = util.matchFeatureLevel( sdk.meta.requiredFeatureLevel, - sdk.meta.description + sdk.meta.description, ) if (!featureLevelMatch.match) { options.logger(`⛔ ${featureLevelMatch.message}`) @@ -85,12 +85,12 @@ async function readSdkJson( let output = gen.output output = output.replace( '{zapFileBasename}', - path.basename(inputFile, '.zap') + path.basename(inputFile, '.zap'), ) output = output.replace( '{zapFileLastDirname}', - path.basename(path.dirname(inputFile)) + path.basename(path.dirname(inputFile)), ) output = output.replace('{zapFileGlobIndex}', `${index}`) diff --git a/src-electron/util/types.js b/src-electron/util/types.js index 806eaac4bd..b45ef23cf9 100644 --- a/src-electron/util/types.js +++ b/src-electron/util/types.js @@ -54,7 +54,7 @@ async function typeSizeAttribute(db, zclPackageIds, at, defaultValue = null) { if (!at.typeInfo.atomicType && !at.typeInfo.size) { if (at.storage != dbEnum.storageOption.external) { throw new Error( - `ERROR: Unknown size for non-external attribute: ${at.name} / ${at.code}` + `ERROR: Unknown size for non-external attribute: ${at.name} / ${at.code}`, ) } return 0 @@ -74,7 +74,7 @@ async function typeSizeAttribute(db, zclPackageIds, at, defaultValue = null) { return defaultValue } else { throw new Error( - `ERROR: Unknown size for attribute: ${at.label} / ${at.code}` + `ERROR: Unknown size for attribute: ${at.label} / ${at.code}`, ) } } @@ -286,7 +286,7 @@ async function isSignedInteger(db, sessionId, type) { return await queryAtomic.isTypeSignedByNameAndPackage( db, type, - sessionPackages + sessionPackages, ) } @@ -372,7 +372,7 @@ async function getSignAndSizeOfZclType(db, type, packageIds, options) { let number = await queryZcl.selectNumberByName( db, packageIds, - dataType.name + dataType.name, ) if (number.isSigned) { isTypeSigned = true @@ -385,7 +385,7 @@ async function getSignAndSizeOfZclType(db, type, packageIds, options) { let bitmap = await queryZcl.selectBitmapByName( db, packageIds, - dataType.name + dataType.name, ) dataTypesize = Math.pow(2, Math.ceil(Math.log2(bitmap.size))) } else if ( @@ -399,7 +399,7 @@ async function getSignAndSizeOfZclType(db, type, packageIds, options) { let number = await queryZcl.selectNumberByName( db, packageIds, - dataType.name + dataType.name, ) dataTypesize = Math.pow(2, Math.ceil(Math.log2(number.size))) } diff --git a/src-electron/util/util.js b/src-electron/util/util.js index f0b6bc4526..e0308ac6e9 100644 --- a/src-electron/util/util.js +++ b/src-electron/util/util.js @@ -64,7 +64,7 @@ async function ensurePackagesAndPopulateSessionOptions( sessionId, options = null, selectedZclPropertyPackage = [], - selectedGenTemplatePackages = [] + selectedGenTemplatePackages = [], ) { let promises = [] // This is the desired ZCL properties file. Because it is possible @@ -100,7 +100,7 @@ async function ensurePackagesAndPopulateSessionOptions( if (selectedZclPropertyPackage && selectedZclPropertyPackage.length > 1) { console.log( `Multiple zcl.properties selected, using them for a multiprotocol configuration: ` + - JSON.stringify(selectedZclPropertyPackage) + JSON.stringify(selectedZclPropertyPackage), ) for (let i = 0; i < selectedZclPropertyPackage.length; i++) { promises.push( @@ -108,8 +108,8 @@ async function ensurePackagesAndPopulateSessionOptions( db, sessionPartitionInfo[sessionPartitionIndex].sessionPartitionId, selectedZclPropertyPackage[i].id, - true - ) + true, + ), ) sessionPartitionIndex++ } @@ -126,7 +126,7 @@ async function ensurePackagesAndPopulateSessionOptions( } else if (rows.length == 1) { packageId = rows[0].id env.logDebug( - `Single zcl.properties found, using it for the session: ${packageId}` + `Single zcl.properties found, using it for the session: ${packageId}`, ) } else if (rows.length == 0) { env.logError(`No zcl.properties found for session.`) @@ -136,7 +136,7 @@ async function ensurePackagesAndPopulateSessionOptions( `No zcl.properties found for session.`, sessionId, 2, - 0 + 0, ) packageId = null } else { @@ -150,7 +150,7 @@ async function ensurePackagesAndPopulateSessionOptions( } }) env.logWarning( - `${sessionId}, ${zclFile}: Multiple toplevel zcl.properties found. Using the first one from args: ${packageId}` + `${sessionId}, ${zclFile}: Multiple toplevel zcl.properties found. Using the first one from args: ${packageId}`, ) queryNotification.setNotification( db, @@ -158,7 +158,7 @@ async function ensurePackagesAndPopulateSessionOptions( `${sessionId}, ${zclFile}: Multiple toplevel zcl.properties found. Using the first one from args: ${packageId}`, sessionId, 2, - 0 + 0, ) } if (packageId != null) { @@ -171,8 +171,8 @@ async function ensurePackagesAndPopulateSessionOptions( db, sessionPartitionId, packageId, - true - ) + true, + ), ) } else { sessionPartitionIndex++ @@ -184,8 +184,8 @@ async function ensurePackagesAndPopulateSessionOptions( sessionPartitionInfo[sessionPartitionIndex - 1] .sessionPartitionId, packageId, - true - ) + true, + ), ) } } @@ -199,7 +199,7 @@ async function ensurePackagesAndPopulateSessionOptions( if (selectedGenTemplatePackages && selectedGenTemplatePackages.length > 1) { console.log( `Multiple generation templates selected, using them for a multiprotocol configuration: ` + - JSON.stringify(selectedGenTemplatePackages) + JSON.stringify(selectedGenTemplatePackages), ) for (let i = 0; i < selectedGenTemplatePackages.length; i++) { promises.push( @@ -207,15 +207,15 @@ async function ensurePackagesAndPopulateSessionOptions( db, sessionPartitionInfo[sessionPartitionIndex].sessionPartitionId, selectedGenTemplatePackages[i], - true - ) + true, + ), ) sessionPartitionIndex++ } } else { let rows = await queryPackage.getPackagesByType( db, - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) let packageId if ( @@ -228,7 +228,7 @@ async function ensurePackagesAndPopulateSessionOptions( } else if (rows.length == 1) { packageId = rows[0].id env.logDebug( - `Single generation template metafile found, using it for the session: ${packageId}` + `Single generation template metafile found, using it for the session: ${packageId}`, ) } else if (rows.length == 0) { env.logDebug(`No generation template metafile found for session.`) @@ -244,7 +244,7 @@ async function ensurePackagesAndPopulateSessionOptions( }) if (packageId != null) { env.logWarning( - `Multiple toplevel generation template metafiles found. Using the one from args: ${packageId}` + `Multiple toplevel generation template metafiles found. Using the one from args: ${packageId}`, ) queryNotification.setNotification( db, @@ -252,12 +252,12 @@ async function ensurePackagesAndPopulateSessionOptions( `Multiple toplevel generation template metafiles found. Using the one from args: ${packageId}`, sessionId, 2, - 0 + 0, ) } else { packageId = rows[0].id env.logWarning( - `Multiple toplevel generation template metafiles found. Using the first one.` + `Multiple toplevel generation template metafiles found. Using the first one.`, ) queryNotification.setNotification( db, @@ -265,7 +265,7 @@ async function ensurePackagesAndPopulateSessionOptions( `Multiple toplevel generation template metafiles found. Using the first one.`, sessionId, 2, - 0 + 0, ) } } @@ -276,27 +276,27 @@ async function ensurePackagesAndPopulateSessionOptions( await querySession.insertSessionPartition( db, sessionId, - sessionPartitionIndex + sessionPartitionIndex, ) await queryPackage.insertSessionPackage( db, sessionPartitionId, packageId, - true + true, ) } else { sessionPartitionIndex++ const sessionPartitionInfo = await querySession.getAllSessionPartitionInfoForSession( db, - sessionId + sessionId, ) await queryPackage.insertSessionPackage( db, sessionPartitionInfo[sessionPartitionIndex - 1] .sessionPartitionId, packageId, - true + true, ) } } @@ -312,7 +312,7 @@ async function ensurePackagesAndPopulateSessionOptions( selectedZclPropertyPackage.length > 0 ) { const matchBySelectedCategory = rows.find( - (r) => r?.category === selectedZclPropertyPackage[0].category + (r) => r?.category === selectedZclPropertyPackage[0].category, ) packageId = matchBySelectedCategory?.id || rows[0].id } else { @@ -324,13 +324,13 @@ async function ensurePackagesAndPopulateSessionOptions( const sessionPartitionId = await querySession.insertSessionPartition( db, sessionId, - sessionPartitionIndex + sessionPartitionIndex, ) await queryPackage.insertSessionPackage( db, sessionPartitionId, packageId, - true + true, ) } else { sessionPartitionIndex++ @@ -339,7 +339,7 @@ async function ensurePackagesAndPopulateSessionOptions( db, sessionPartitionInfo[sessionPartitionIndex - 1].sessionPartitionId, packageId, - true + true, ) } } @@ -369,12 +369,12 @@ async function populateSessionPackageOptions(db, sessionId, packages) { db, sessionId, option.optionCategory, - option.optionCode + option.optionCode, ) }) - }) - ) - ) + }), + ), + ), ) return Promise.all(p) @@ -443,12 +443,12 @@ async function sessionReport(db, sessionId) { db, c.clusterId, c.side, - ept.id + ept.id, ) .then((attrs) => { for (let at of attrs) { rpt = rpt.concat( - ` - ${at.hexCode}: attribute: ${at.name} [${at.type}] [bound: ${at.isBound}]\n` + ` - ${at.hexCode}: attribute: ${at.name} [${at.type}] [bound: ${at.isBound}]\n`, ) } }) @@ -456,23 +456,23 @@ async function sessionReport(db, sessionId) { queryEndpoint.selectEndpointClusterCommands( db, c.clusterId, - ept.id - ) + ept.id, + ), ) .then((cmds) => { for (let cmd of cmds) { rpt = rpt.concat( - ` - ${cmd.hexCode}: command: ${cmd.name}\n` + ` - ${cmd.hexCode}: command: ${cmd.name}\n`, ) } return rpt - }) + }), ) } return Promise.all(ps2) .then((rpts) => rpts.join('')) .then((r) => s.concat(r)) - }) + }), ) }) return Promise.all(ps).then((results) => results.join('\n')) @@ -524,18 +524,18 @@ async function sessionDump(db, sessionId) { queryEndpoint.selectEndpointClusterCommands( db, c.clusterId, - ept.id - ) + ept.id, + ), ) .then((cmds) => { c.commands = cmds ept.commands.push(...cmds) dump.commands.push(...cmds) - }) + }), ) } return Promise.all(ps2) - }) + }), ) }) await Promise.all(ps) @@ -604,14 +604,14 @@ function createAbsolutePath(relativePath, relativity, zapFilePath) { relativePath = relativePath.replaceAll('$' + key, process.env[key]) relativePath = relativePath.replaceAll( '${' + key + '}', - process.env[key] + process.env[key], ) } } if (relativePath.indexOf('$') !== -1) { throw new Error( 'resolveEnvVars: unable to resolve environment variables completely: ' + - relativePath + relativePath, ) } } @@ -635,7 +635,7 @@ function locateRelativeFilePath(rootFileLocations, relativeFilePath) { for (let i = 0; i < rootFileLocations.length; i++) { let resolvedFile = path.resolve( rootFileLocations[i], - relativeFilePath.trim() + relativeFilePath.trim(), ) if (fs.existsSync(resolvedFile)) { return resolvedFile @@ -656,7 +656,7 @@ function executeExternalProgram( options = { rejectOnFail: true, routeErrToOut: false, - } + }, ) { return new Promise((resolve, reject) => { childProcess.exec( @@ -684,7 +684,7 @@ function executeExternalProgram( } resolve() } - } + }, ) }) } @@ -702,7 +702,7 @@ function getClusterExtensionDefault( extensions, extensionId, clusterCode, - clusterRole = null + clusterRole = null, ) { let f = getClusterExtension(extensions, extensionId) if (f.length == 0) { @@ -802,7 +802,7 @@ function duration(nsDifference) { function mainOrSecondaryInstance( allowSecondary, mainInstanceCallback, - secondaryInstanceCallback + secondaryInstanceCallback, ) { if (allowSecondary) { let lock = new singleInstance('zap') @@ -852,7 +852,7 @@ async function collectJsonData(jsonFile, recursiveLevel = 0) { } if ('disable' in jsonData) { collectedData = collectedData.filter( - (test) => !jsonData.disable.includes(test) + (test) => !jsonData.disable.includes(test), ) } collectedData.disable = disable.bind(collectedData) @@ -879,15 +879,15 @@ function patternFormat(pattern, data) { out = out.replace(`{${key}:touppercase}`, value.toString().toUpperCase()) out = out.replace( `{${key}:tocamelcase}`, - string.toCamelCase(value.toString()) + string.toCamelCase(value.toString()), ) out = out.replace( `{${key}:tosnakecase}`, - string.toSnakeCase(value.toString()) + string.toSnakeCase(value.toString()), ) out = out.replace( `{${key}:tosnakecaseallcaps}`, - string.toSnakeCaseAllCaps(value.toString()) + string.toSnakeCaseAllCaps(value.toString()), ) // Note: if you add more of these, add the documentation to sdk-integration.md } diff --git a/src-electron/util/zcl-util.js b/src-electron/util/zcl-util.js index 6330643f6a..4382499cc3 100644 --- a/src-electron/util/zcl-util.js +++ b/src-electron/util/zcl-util.js @@ -263,7 +263,7 @@ function calculateBytesForTypes(res, options, db, packageIds) { env.logError( 'Could not find size of the given type in' + ' calculateBytesForTypes: ' + - err + err, ) }) } @@ -283,14 +283,14 @@ async function calculateBytesForStructs(res, options, db, packageIds) { packageIds, item, options, - item.discriminatorName.toLowerCase() - ) - ) + item.discriminatorName.toLowerCase(), + ), + ), ) return Promise.all(promises) }) .then((resolvedPromises) => - resolvedPromises.reduce((acc, cur) => acc + cur, 0) + resolvedPromises.reduce((acc, cur) => acc + cur, 0), ) .catch((err) => { env.logError( @@ -298,7 +298,7 @@ async function calculateBytesForStructs(res, options, db, packageIds) { res + ' in' + ' calculate_size_for_structs: ' + - err + err, ) return 0 }) @@ -380,7 +380,7 @@ function returnOptionsForTypes(size, res, options) { env.logError( 'Could not find size of the given type in' + ' returnOptionsForTypes: ' + - err + err, ) }) } @@ -399,7 +399,7 @@ async function dataTypeCharacterFormatter( packageIds, type, options, - resType + resType, ) { switch (resType) { case dbEnum.zclType.array: @@ -540,7 +540,7 @@ function dataTypeHelper( packageIds, db, resolvedType, - overridable + overridable, ) { let no_warning = { no_warning: 0 } if ('no_warning' in options.hash) { @@ -552,7 +552,7 @@ function dataTypeHelper( return defaultMessageForTypeConversion( `${type} array`, options.hash.array, - options.hash.no_warning + options.hash.no_warning, ) } else { return queryZcl @@ -564,7 +564,7 @@ function dataTypeHelper( return defaultMessageForTypeConversion( `${type}`, options.hash.bitmap, - options.hash.no_warning + options.hash.no_warning, ) } else { return queryZcl @@ -576,7 +576,7 @@ function dataTypeHelper( return defaultMessageForTypeConversion( `${type}`, options.hash.enum, - options.hash.no_warning + options.hash.no_warning, ) } else { return queryZcl @@ -588,7 +588,7 @@ function dataTypeHelper( return defaultMessageForTypeConversion( `${type}`, options.hash.struct, - options.hash.no_warning + options.hash.no_warning, ) } else { return type @@ -620,13 +620,13 @@ async function asUnderlyingZclTypeWithPackageId( type, options, packageIds, - currentInstance + currentInstance, ) { let actualType = type if (typeof type === 'number') { let numberType = await queryZcl.selectDataTypeById( currentInstance.global.db, - type + type, ) actualType = numberType.name } @@ -651,7 +651,7 @@ async function asUnderlyingZclTypeWithPackageId( } } resolve(dbEnum.zclType.unknown) - }) + }), ) .then((resType) => { if (dbEnum.zclType.zclCharFormatter in options.hash) { @@ -660,7 +660,7 @@ async function asUnderlyingZclTypeWithPackageId( packageIds, actualType, options, - resType + resType, ) } else { return dataTypeHelper( @@ -669,7 +669,7 @@ async function asUnderlyingZclTypeWithPackageId( packageIds, currentInstance.global.db, resType, - currentInstance.global.overridable + currentInstance.global.overridable, ) } }) @@ -811,7 +811,7 @@ async function zcl_data_type_size_and_sign( dataType, clusterId, packageIds, - context + context, ) { let result = 0 let isSigned = false @@ -820,7 +820,7 @@ async function zcl_data_type_size_and_sign( context.global.db, dataType.name, clusterId, - packageIds + packageIds, ) result = bitmap.size } else if (dataType.discriminatorName.toLowerCase() == dbEnum.zclType.enum) { @@ -828,7 +828,7 @@ async function zcl_data_type_size_and_sign( context.global.db, dataType.name, clusterId, - packageIds + packageIds, ) result = en.size } else if ( @@ -838,7 +838,7 @@ async function zcl_data_type_size_and_sign( context.global.db, dataType.name, clusterId, - packageIds + packageIds, ) isSigned = number.isSigned result = number.size diff --git a/src-electron/validation/async-validation.js b/src-electron/validation/async-validation.js index db86b3845d..16430033d2 100644 --- a/src-electron/validation/async-validation.js +++ b/src-electron/validation/async-validation.js @@ -40,8 +40,8 @@ export async function initAsyncValidation(db, session) { queryPackage.selectAllOptionsValues( db, pkg.packageRef, - dbEnum.packageOptionCategory.validationTimersFlags - ) + dbEnum.packageOptionCategory.validationTimersFlags, + ), ) return Promise.all(p).then((data) => data.flat(1)) }) diff --git a/src-electron/validation/validation.js b/src-electron/validation/validation.js index 2838a18cc2..089f7d7e46 100644 --- a/src-electron/validation/validation.js +++ b/src-electron/validation/validation.js @@ -43,20 +43,20 @@ async function validateAttribute( endpointTypeId, attributeRef, clusterRef, - zapSessionId + zapSessionId, ) { let endpointAttribute = await queryZcl.selectEndpointTypeAttribute( db, endpointTypeId, attributeRef, - clusterRef + clusterRef, ) let attribute = await queryZcl.selectAttributeById(db, attributeRef) return validateSpecificAttribute( endpointAttribute, attribute, db, - zapSessionId + zapSessionId, ) } @@ -66,7 +66,7 @@ async function validateEndpoint(db, endpointId) { let noDuplicates = await validateNoDuplicateEndpoints( db, endpoint.endpointId, - endpoint.sessionRef + endpoint.sessionRef, ) if (!noDuplicates) { currentIssues.endpointId.push('Duplicate EndpointIds Exist') @@ -77,13 +77,13 @@ async function validateEndpoint(db, endpointId) { async function validateNoDuplicateEndpoints( db, endpointIdentifier, - sessionRef + sessionRef, ) { let count = await queryConfig.selectCountOfEndpointsWithGivenEndpointIdentifier( db, endpointIdentifier, - sessionRef + sessionRef, ) return count.length <= 1 } @@ -100,7 +100,7 @@ async function validateSpecificAttribute( endpointAttribute, attribute, db, - zapSessionId + zapSessionId, ) { let defaultAttributeIssues = [] if (attribute.isNullable && endpointAttribute.defaultValue == null) { @@ -121,7 +121,7 @@ async function validateSpecificAttribute( attribute, endpointAttribute, db, - zapSessionId + zapSessionId, )) ) { defaultAttributeIssues.push('Out of range') @@ -135,7 +135,7 @@ async function validateSpecificAttribute( attribute, endpointAttribute, db, - zapSessionId + zapSessionId, )) ) { defaultAttributeIssues.push('Out of range') @@ -294,7 +294,7 @@ async function getIntegerAttributeSize(db, zapSessionId, attribType) { const attribData = await types.getSignAndSizeOfZclType( db, attribType, - packageIds + packageIds, ) if (attribData) { return { @@ -318,12 +318,12 @@ async function checkAttributeBoundsInteger( attribute, endpointAttribute, db, - zapSessionId + zapSessionId, ) { const { size, isSigned } = await getIntegerAttributeSize( db, zapSessionId, - attribute.type + attribute.type, ) if (size === undefined || isSigned === undefined) { return false @@ -332,7 +332,7 @@ async function checkAttributeBoundsInteger( let defaultValue = await getIntegerFromAttribute( endpointAttribute.defaultValue, size, - isSigned + isSigned, ) return checkBoundsInteger(defaultValue, min, max) } diff --git a/src-electron/zcl/zcl-loader-dotdot.js b/src-electron/zcl/zcl-loader-dotdot.js index 7e1d2b0515..1b9ec0d45e 100644 --- a/src-electron/zcl/zcl-loader-dotdot.js +++ b/src-electron/zcl/zcl-loader-dotdot.js @@ -41,7 +41,7 @@ async function collectDataFromLibraryXml(ctx) { let zclLib = result['zcl:library'] ctx.version = '1.0' ctx.zclFiles = zclLib['xi:include'].map((f) => - path.join(path.dirname(ctx.metadataFile), f.$.href) + path.join(path.dirname(ctx.metadataFile), f.$.href), ) ctx.zclFiles.push(ctx.metadataFile) return ctx @@ -81,7 +81,7 @@ async function parseSingleZclFile(db, ctx, file) { db, data, ctx.packageId, - dbEnum.packageType.zclXml + dbEnum.packageType.zclXml, ) if (!res.data) { return [] @@ -137,13 +137,13 @@ async function parseZclFiles(db, ctx) { //referenced by other types let typesFiles = ctx.zclFiles.filter((file) => file.includes('library.xml')) let typeFilePromise = typesFiles.map((file) => - parseSingleZclFile(db, ctx, file) + parseSingleZclFile(db, ctx, file), ) await Promise.all(typeFilePromise) // Load everything apart from atomic data types let nonTypesFiles = ctx.zclFiles.filter( - (file) => !file.includes('library.xml') + (file) => !file.includes('library.xml'), ) nonTypesFiles.map((file) => { let p = parseSingleZclFile(db, ctx, file) @@ -230,8 +230,8 @@ function prepareAttributes(attributes, side, types, cluster = null) { a.$.reportRequired === undefined ? dbEnum.reportingPolicy.optional : a.$.reportRequired == 'true' - ? dbEnum.reportingPolicy.mandatory - : dbEnum.reportingPolicy.prohibited, + ? dbEnum.reportingPolicy.mandatory + : dbEnum.reportingPolicy.prohibited, isSceneRequired: a.$.sceneRequired == undefined ? false : a.$.sceneRequired == 'true', } @@ -253,8 +253,8 @@ function prepareAttributes(attributes, side, types, cluster = null) { a.$.reportRequired === undefined ? dbEnum.reportingPolicy.optional : a.$.reportRequired == 'true' - ? dbEnum.reportingPolicy.mandatory - : dbEnum.reportingPolicy.prohibited, + ? dbEnum.reportingPolicy.mandatory + : dbEnum.reportingPolicy.prohibited, isSceneRequired: a.$.sceneRequired == undefined ? false : a.$.sceneRequired == 'true', } @@ -287,8 +287,8 @@ function prepareAttributes(attributes, side, types, cluster = null) { a.$.reportRequired === undefined ? dbEnum.reportingPolicy.optional : a.$.reportRequired == 'true' - ? dbEnum.reportingPolicy.mandatory - : dbEnum.reportingPolicy.prohibited, + ? dbEnum.reportingPolicy.mandatory + : dbEnum.reportingPolicy.prohibited, isSceneRequired: a.$.sceneRequired == undefined ? false : a.$.sceneRequired == 'true', } @@ -396,14 +396,14 @@ function prepareCluster(cluster, types, isExtension = false) { if ('attributes' in side.value[0]) { side.value[0].attributes.forEach((attributes) => { ret.attributes = ret.attributes.concat( - prepareAttributes(attributes, side.name, types, cluster) + prepareAttributes(attributes, side.name, types, cluster), ) }) } if ('commands' in side.value[0]) { side.value[0].commands.forEach((commands) => { ret.commands = ret.commands.concat( - prepareCommands(commands, side.name, types) + prepareCommands(commands, side.name, types), ) }) } @@ -450,7 +450,7 @@ function prepareBitmap( typeContainer, type, isContained = false, - namePrefix = null + namePrefix = null, ) { let ret if (isContained) { @@ -585,7 +585,7 @@ function prepareAttributeType(attribute, types, cluster) { types.bitmaps.push(prepareBitmap(types, attribute, true, cluster.$.name)) } else if (tagContainsEnum(attribute)) { types.enums.push( - prepareEnum(attribute, true, cluster == null ? null : cluster.$.name) + prepareEnum(attribute, true, cluster == null ? null : cluster.$.name), ) } } @@ -666,7 +666,7 @@ async function processDataTypeDiscriminator(db, packageId, zclDataTypes) { return queryLoader.insertDataTypeDiscriminator( db, packageId, - types.map((x) => prepareDataTypeDiscriminator(x)) + types.map((x) => prepareDataTypeDiscriminator(x)), ) } @@ -725,7 +725,7 @@ async function processDataType(db, filePath, packageId, data, dataType) { return queryLoader.insertDataType( db, packageId, - data.map((x) => prepareDataType(x, 0, typeMap)) + data.map((x) => prepareDataType(x, 0, typeMap)), ) } else if (dataType == dbEnum.zclType.enum) { env.logDebug(`${filePath}, ${packageId}: ${data.length} Enum Data Types.`) @@ -733,8 +733,8 @@ async function processDataType(db, filePath, packageId, data, dataType) { db, packageId, data.map((x) => - prepareDataType(x, typeMap.get(dbEnum.zclType.enum), typeMap) - ) + prepareDataType(x, typeMap.get(dbEnum.zclType.enum), typeMap), + ), ) } else if (dataType == dbEnum.zclType.bitmap) { env.logDebug(`${filePath}, ${packageId}: ${data.length} Bitmap Data Types.`) @@ -742,8 +742,8 @@ async function processDataType(db, filePath, packageId, data, dataType) { db, packageId, data.map((x) => - prepareDataType(x, typeMap.get(dbEnum.zclType.bitmap), typeMap) - ) + prepareDataType(x, typeMap.get(dbEnum.zclType.bitmap), typeMap), + ), ) } else if (dataType == dbEnum.zclType.struct) { env.logDebug(`${filePath}, ${packageId}: ${data.length} Struct Data Types.`) @@ -751,8 +751,8 @@ async function processDataType(db, filePath, packageId, data, dataType) { db, packageId, data.map((x) => - prepareDataType(x, typeMap.get(dbEnum.zclType.struct), typeMap) - ) + prepareDataType(x, typeMap.get(dbEnum.zclType.struct), typeMap), + ), ) } else if (dataType == dbEnum.zclType.string) { env.logDebug(`${filePath}, ${packageId}: ${data.length} String Data Types.`) @@ -760,19 +760,19 @@ async function processDataType(db, filePath, packageId, data, dataType) { db, packageId, data.map((x) => - prepareDataType(x, typeMap.get(dbEnum.zclType.string), typeMap) - ) + prepareDataType(x, typeMap.get(dbEnum.zclType.string), typeMap), + ), ) } else { env.logError( - 'Could not find the discriminator for the data type: ' + dataType + 'Could not find the discriminator for the data type: ' + dataType, ) queryNotification.setNotification( db, 'ERROR', 'Could not find the discriminator for the data type: ' + dataType, packageId, - 1 + 1, ) } } @@ -817,7 +817,7 @@ async function processNumber(db, filePath, packageId, data) { return queryLoader.insertNumber( db, packageId, - numbers.map((x) => prepareNumber(x, typeMap.get(dbEnum.zclType.number))) + numbers.map((x) => prepareNumber(x, typeMap.get(dbEnum.zclType.number))), ) } @@ -857,7 +857,7 @@ async function processString(db, filePath, packageId, data) { return queryLoader.insertString( db, packageId, - strings.map((x) => prepareString(x, typeMap.get(dbEnum.zclType.string))) + strings.map((x) => prepareString(x, typeMap.get(dbEnum.zclType.string))), ) } @@ -892,7 +892,7 @@ async function processEnums(db, filePath, packageId, data) { return queryLoader.insertEnum( db, [packageId], - data.map((x) => prepareEnumsOrBitmaps(x, typeMap.get(dbEnum.zclType.enum))) + data.map((x) => prepareEnumsOrBitmaps(x, typeMap.get(dbEnum.zclType.enum))), ) } @@ -945,8 +945,8 @@ async function processBitmaps(db, filePath, packageId, data) { db, [packageId], data.map((x) => - prepareEnumsOrBitmaps(x, typeMap.get(dbEnum.zclType.bitmap)) - ) + prepareEnumsOrBitmaps(x, typeMap.get(dbEnum.zclType.bitmap)), + ), ) } @@ -985,7 +985,7 @@ async function processBitmapFields(db, filePath, packageId, data) { db, packageId, [packageId], - bitmapFields + bitmapFields, ) } @@ -1019,7 +1019,7 @@ async function processStruct(db, filePath, packageId, data) { return queryLoader.insertStruct( db, [packageId], - data.map((x) => prepareStruct2(x, typeMap.get(dbEnum.zclType.struct))) + data.map((x) => prepareStruct2(x, typeMap.get(dbEnum.zclType.struct))), ) } @@ -1102,8 +1102,8 @@ async function processEnumsFromAtomics(db, filePath, packageId, data) { db, packageId, enums.map((x) => - prepareEnumsOrBitmapsAtomic(x, typeMap.get(dbEnum.zclType.enum)) - ) + prepareEnumsOrBitmapsAtomic(x, typeMap.get(dbEnum.zclType.enum)), + ), ) } @@ -1122,14 +1122,14 @@ async function processBitmapsFromAtomics(db, filePath, packageId, data) { return item.name.toLowerCase().includes('map') }) env.logDebug( - `${filePath}, ${packageId}: ${data.length} Baseline Bitmap Types.` + `${filePath}, ${packageId}: ${data.length} Baseline Bitmap Types.`, ) return queryLoader.insertBitmapAtomic( db, packageId, bitmaps.map((x) => - prepareEnumsOrBitmapsAtomic(x, typeMap.get(dbEnum.zclType.bitmap)) - ) + prepareEnumsOrBitmapsAtomic(x, typeMap.get(dbEnum.zclType.bitmap)), + ), ) } @@ -1144,7 +1144,7 @@ async function processBitmapsFromAtomics(db, filePath, packageId, data) { */ async function loadZclData(db, ctx) { env.logDebug( - `Starting to load Dotdot ZCL data in to DB for: ${ctx.metadataFile}, clusters length=${ctx.zclClusters.length}` + `Starting to load Dotdot ZCL data in to DB for: ${ctx.metadataFile}, clusters length=${ctx.zclClusters.length}`, ) let types = { atomics: [], enums: [], bitmaps: [], structs: [] } prepareTypes(ctx.zclTypes, types) @@ -1181,7 +1181,7 @@ async function loadZclData(db, ctx) { ctx.zclManufacturers.map((data) => { let mfgPair = data['$'] return { code: mfgPair['code'], label: mfgPair['translation'] } - }) + }), ) await queryLoader.insertDeviceTypes(db, ctx.packageId, ds) await queryLoader.insertGlobals(db, ctx.packageId, gs) @@ -1193,41 +1193,41 @@ async function loadZclData(db, ctx) { ctx.metadataFile, ctx.packageId, types.atomics, - dbEnum.zclType.atomic + dbEnum.zclType.atomic, ) await processDataType( db, ctx.metadataFile, ctx.packageId, types.enums, - dbEnum.zclType.enum + dbEnum.zclType.enum, ) await processDataType( db, ctx.metadataFile, ctx.packageId, types.bitmaps, - dbEnum.zclType.bitmap + dbEnum.zclType.bitmap, ) await processDataType( db, ctx.metadataFile, ctx.packageId, types.structs, - dbEnum.zclType.struct + dbEnum.zclType.struct, ) await processEnumsFromAtomics( db, ctx.metadataFile, ctx.packageId, - types.atomics + types.atomics, ) await processBitmapsFromAtomics( db, ctx.metadataFile, ctx.packageId, - types.atomics + types.atomics, ) await processNumber(db, ctx.metadataFile, ctx.packageId, types.atomics) await processString(db, ctx.metadataFile, ctx.packageId, types.atomics) @@ -1275,7 +1275,7 @@ async function loadToplevelXmlFile(db, metafile) { ctx.packageId = await zclLoader.recordToplevelPackage( db, ctx.metadataFile, - ctx.crc + ctx.crc, ) await collectDataFromLibraryXml(ctx) if (ctx.version != null) { @@ -1284,7 +1284,7 @@ async function loadToplevelXmlFile(db, metafile) { ctx.packageId, ctx.version, ctx.category, - ctx.description + ctx.description, ) } await parseZclFiles(db, ctx) diff --git a/src-electron/zcl/zcl-loader-new-data-model.js b/src-electron/zcl/zcl-loader-new-data-model.js index 5c2727cb4e..010f4b78cf 100644 --- a/src-electron/zcl/zcl-loader-new-data-model.js +++ b/src-electron/zcl/zcl-loader-new-data-model.js @@ -47,12 +47,12 @@ async function parseNewXmlFiles(db, packageId, files, context) { let cluster = await parseSingleNewXmlFile(f) if (cluster == null) { env.logWarning( - `Invalid XML file: ${f}, missing toplevel 'cluster' element.` + `Invalid XML file: ${f}, missing toplevel 'cluster' element.`, ) ret.errorFiles.push({ file: f, error: 'missing cluster element' }) } else if (Number.isNaN(cluster.code)) { env.logWarning( - `Invalid XML file: ${f}, missing or invalid 'id' attribute in 'cluster' element.` + `Invalid XML file: ${f}, missing or invalid 'id' attribute in 'cluster' element.`, ) ret.errorFiles.push({ file: f, error: 'missing id attribute' }) } else { diff --git a/src-electron/zcl/zcl-loader-silabs.js b/src-electron/zcl/zcl-loader-silabs.js index ce012c4ce5..dcf51b1332 100644 --- a/src-electron/zcl/zcl-loader-silabs.js +++ b/src-electron/zcl/zcl-loader-silabs.js @@ -49,7 +49,7 @@ async function collectDataFromJsonFile(metadataFile, data) { let fileLocations if (Array.isArray(obj.xmlRoot)) { fileLocations = obj.xmlRoot.map((p) => - path.join(path.dirname(metadataFile), p) + path.join(path.dirname(metadataFile), p), ) } else { fileLocations = [path.join(path.dirname(metadataFile), obj.xmlRoot)] @@ -107,7 +107,7 @@ async function collectDataFromJsonFile(metadataFile, data) { // If it's missing, 'optional' is a default reporting policy. if ('defaultReportingPolicy' in obj) { returnObject.defaultReportingPolicy = dbEnum.reportingPolicy.resolve( - obj.defaultReportingPolicy + obj.defaultReportingPolicy, ) } returnObject.version = obj.version @@ -170,14 +170,14 @@ async function collectDataFromJsonFile(metadataFile, data) { if ('newXmlFile' in obj) { returnObject.newXmlFile = obj.newXmlFile.map((f) => - path.join(path.dirname(metadataFile), f) + path.join(path.dirname(metadataFile), f), ) } else { returnObject.newXmlFile = [] } env.logDebug( - `Resolving: ${returnObject.zclFiles}, version: ${returnObject.version}` + `Resolving: ${returnObject.zclFiles}, version: ${returnObject.version}`, ) return returnObject @@ -211,7 +211,7 @@ async function collectDataFromPropertiesFile(metadataFile, data) { zclProps.xmlFile.split(',').forEach((singleXmlFile) => { let fullPath = util.locateRelativeFilePath( fileLocations, - singleXmlFile + singleXmlFile, ) if (fullPath != null) zclFiles.push(fullPath) }) @@ -220,7 +220,7 @@ async function collectDataFromPropertiesFile(metadataFile, data) { // Manufacturers XML file. f = util.locateRelativeFilePath( fileLocations, - zclProps.manufacturersXml + zclProps.manufacturersXml, ) if (f != null) returnObject.manufacturersXml = f @@ -257,7 +257,7 @@ async function collectDataFromPropertiesFile(metadataFile, data) { automaticallyCreateFields: false, } env.logDebug( - `Resolving: ${returnObject.zclFiles}, version: ${returnObject.version}` + `Resolving: ${returnObject.zclFiles}, version: ${returnObject.version}`, ) resolve(returnObject) } @@ -319,7 +319,7 @@ async function processAtomics(db, filePath, packageId, data) { return queryLoader.insertAtomics( db, packageId, - types.map((x) => prepareAtomic(x)) + types.map((x) => prepareAtomic(x)), ) } @@ -359,10 +359,10 @@ function prepareClusterGlobalAttribute(cluster) { if (ga.$.side == dbEnum.side.either) { ret.globalAttribute.push( - Object.assign({ side: dbEnum.side.client }, at) + Object.assign({ side: dbEnum.side.client }, at), ) ret.globalAttribute.push( - Object.assign({ side: dbEnum.side.server }, at) + Object.assign({ side: dbEnum.side.server }, at), ) } else { ret.globalAttribute.push(Object.assign({ side: ga.$.side }, at)) @@ -576,7 +576,7 @@ function prepareCluster(cluster, context, isExtension = false) { reportingPolicy = dbEnum.reportingPolicy.optional } else if (attribute.$.reportingPolicy != null) { reportingPolicy = dbEnum.reportingPolicy.resolve( - attribute.$.reportingPolicy + attribute.$.reportingPolicy, ) } let storagePolicy = dbEnum.storagePolicy.any @@ -648,7 +648,7 @@ function prepareCluster(cluster, context, isExtension = false) { att.name + ' in xml. \ Currently defaulting to a max length of 253 for long strings instead of 65534 \ - for space conservation and no support available for long strings in zigbee pro.' + for space conservation and no support available for long strings in zigbee pro.', ) att.maxLength = 253 } else { @@ -659,7 +659,7 @@ function prepareCluster(cluster, context, isExtension = false) { att.name + ' in xml. \ Currently defaulting to a max length of 1024 for long strings instead of 65534 \ - for space conservation.' + for space conservation.', ) att.maxLength = 1024 } @@ -717,7 +717,7 @@ async function processClusters(db, filePath, packageId, data, context) { context.clustersLoadedFromNewFiles.includes(cluster.code) ) { env.logDebug( - `Bypassing loading of cluster ${cluster.code} from old files.` + `Bypassing loading of cluster ${cluster.code} from old files.`, ) return false } else { @@ -767,16 +767,16 @@ async function processClusterExtensions( dataPackageId, knownPackages, data, - context + context, ) { env.logDebug( - `${filePath}, ${dataPackageId}: ${data.length} cluster extensions.` + `${filePath}, ${dataPackageId}: ${data.length} cluster extensions.`, ) return queryLoader.insertClusterExtensions( db, dataPackageId, knownPackages, - data.map((x) => prepareCluster(x, context, true)) + data.map((x) => prepareCluster(x, context, true)), ) } @@ -795,7 +795,7 @@ async function processGlobals(db, filePath, packageId, data, context) { return queryLoader.insertGlobals( db, packageId, - data.map((x) => prepareCluster(x, context, true)) + data.map((x) => prepareCluster(x, context, true)), ) } @@ -817,7 +817,7 @@ async function processDefaultAccess( db, filePath, packageId, - defaultAccessList + defaultAccessList, ) { let p = [] for (const da of defaultAccessList) { @@ -844,7 +844,7 @@ async function processAccessControl( db, filePath, packageId, - accessControlList + accessControlList, ) { let operations = [] let roles = [] @@ -987,7 +987,7 @@ async function processDataTypeDiscriminator(db, packageId, zclDataTypes) { return queryLoader.insertDataTypeDiscriminator( db, packageId, - types.map((x) => prepareDataTypeDiscriminator(x)) + types.map((x) => prepareDataTypeDiscriminator(x)), ) } @@ -1030,8 +1030,8 @@ function prepareDataType(a, dataType, typeMap) { cluster_code: a.cluster ? a.cluster : a.$.cluster_code - ? [{ $: { code: a.$.cluster_code[0] } }] - : null, // else case: Treating features in a cluster as a bitmap + ? [{ $: { code: a.$.cluster_code[0] } }] + : null, // else case: Treating features in a cluster as a bitmap } } @@ -1052,7 +1052,7 @@ async function processDataType( packageId, knownPackages, data, - dataType + dataType, ) { let typeMap = await zclLoader.getDiscriminatorMap(db, knownPackages) @@ -1062,7 +1062,7 @@ async function processDataType( return queryLoader.insertDataType( db, packageId, - types.map((x) => prepareDataType(x, 0, typeMap)) + types.map((x) => prepareDataType(x, 0, typeMap)), ) } else if (dataType == dbEnum.zclType.enum) { env.logDebug(`${filePath}, ${packageId}: ${data.length} Enum Data Types.`) @@ -1070,8 +1070,8 @@ async function processDataType( db, packageId, data.map((x) => - prepareDataType(x, typeMap.get(dbEnum.zclType.enum), typeMap) - ) + prepareDataType(x, typeMap.get(dbEnum.zclType.enum), typeMap), + ), ) } else if (dataType == dbEnum.zclType.bitmap) { env.logDebug(`${filePath}, ${packageId}: ${data.length} Bitmap Data Types.`) @@ -1079,8 +1079,8 @@ async function processDataType( db, packageId, data.map((x) => - prepareDataType(x, typeMap.get(dbEnum.zclType.bitmap), typeMap) - ) + prepareDataType(x, typeMap.get(dbEnum.zclType.bitmap), typeMap), + ), ) } else if (dataType == dbEnum.zclType.struct) { env.logDebug(`${filePath}, ${packageId}: ${data.length} Struct Data Types.`) @@ -1088,8 +1088,8 @@ async function processDataType( db, packageId, data.map((x) => - prepareDataType(x, typeMap.get(dbEnum.zclType.struct), typeMap) - ) + prepareDataType(x, typeMap.get(dbEnum.zclType.struct), typeMap), + ), ) } else if (dataType == dbEnum.zclType.string) { env.logDebug(`${filePath}, ${packageId}: ${data.length} String Data Types.`) @@ -1097,19 +1097,19 @@ async function processDataType( db, packageId, data.map((x) => - prepareDataType(x, typeMap.get(dbEnum.zclType.string), typeMap) - ) + prepareDataType(x, typeMap.get(dbEnum.zclType.string), typeMap), + ), ) } else { env.logError( - 'Could not find the discriminator for the data type: ' + dataType + 'Could not find the discriminator for the data type: ' + dataType, ) queryPackageNotification.setNotification( dnb, 'ERROR', 'Could not find the discriminator for the data type: ' + dataType, packageId, - 1 + 1, ) } } @@ -1138,8 +1138,8 @@ function prepareNumber(a, dataType) { ? 1 : 0 : isSignedException || /^int[0-9]{1,2}s?$/.test(a.$.name) - ? 1 - : 0, + ? 1 + : 0, name: a.$.name, cluster_code: a.cluster ? a.cluster : null, discriminator_ref: dataType, @@ -1170,7 +1170,7 @@ async function processNumber(db, filePath, packageId, knownPackages, data) { return queryLoader.insertNumber( db, packageId, - numbers.map((x) => prepareNumber(x, typeMap.get(dbEnum.zclType.number))) + numbers.map((x) => prepareNumber(x, typeMap.get(dbEnum.zclType.number))), ) } @@ -1214,7 +1214,7 @@ async function processString(db, filePath, packageId, knownPackages, data) { return queryLoader.insertString( db, packageId, - strings.map((x) => prepareString(x, typeMap.get(dbEnum.zclType.string))) + strings.map((x) => prepareString(x, typeMap.get(dbEnum.zclType.string))), ) } @@ -1254,8 +1254,8 @@ async function processEnumAtomic(db, filePath, packageId, knownPackages, data) { db, packageId, enums.map((x) => - prepareEnumOrBitmapAtomic(x, typeMap.get(dbEnum.zclType.enum)) - ) + prepareEnumOrBitmapAtomic(x, typeMap.get(dbEnum.zclType.enum)), + ), ) } @@ -1286,7 +1286,7 @@ function prepareEnumOrBitmap(db, packageId, a, dataType, typeMap) { 'WARNING', message, packageId, - 2 + 2, ) a.$.type = 'enum' + a.$.type.toLowerCase().match(/\d+/g).join('') } @@ -1296,8 +1296,8 @@ function prepareEnumOrBitmap(db, packageId, a, dataType, typeMap) { cluster_code: a.cluster ? a.cluster : a.$.cluster_code - ? [{ $: { code: a.$.cluster_code[0] } }] - : null, // else case: Treating features in a cluster as a bitmap + ? [{ $: { code: a.$.cluster_code[0] } }] + : null, // else case: Treating features in a cluster as a bitmap discriminator_ref: dataType, } } @@ -1324,9 +1324,9 @@ async function processEnum(db, filePath, packageId, knownPackages, data) { packageId, x, typeMap.get(dbEnum.zclType.enum), - typeMap - ) - ) + typeMap, + ), + ), ) } @@ -1377,21 +1377,21 @@ async function processBitmapAtomic( filePath, packageId, knownPackages, - data + data, ) { let typeMap = await zclLoader.getDiscriminatorMap(db, knownPackages) let bitmaps = data[0].type.filter(function (item) { return item.$.name.toLowerCase().includes(dbEnum.zclType.bitmap) }) env.logDebug( - `${filePath}, ${packageId}: ${data.length} Baseline Bitmap Types.` + `${filePath}, ${packageId}: ${data.length} Baseline Bitmap Types.`, ) return queryLoader.insertBitmapAtomic( db, packageId, bitmaps.map((x) => - prepareEnumOrBitmapAtomic(x, typeMap.get(dbEnum.zclType.bitmap)) - ) + prepareEnumOrBitmapAtomic(x, typeMap.get(dbEnum.zclType.bitmap)), + ), ) } @@ -1417,9 +1417,9 @@ async function processBitmap(db, filePath, packageId, knownPackages, data) { packageId, x, typeMap.get(dbEnum.zclType.bitmap), - typeMap - ) - ) + typeMap, + ), + ), ) } @@ -1438,7 +1438,7 @@ async function processBitmapFields( filePath, packageId, knownPackages, - data + data, ) { env.logDebug(`${filePath}, ${packageId}: ${data.length} Bitmap Fields.`) let bitmapFields = [] @@ -1481,7 +1481,7 @@ async function processBitmapFields( db, packageId, knownPackages, - bitmapFields + bitmapFields, ) } @@ -1518,7 +1518,7 @@ async function processStruct(db, filePath, packageId, knownPackages, data) { return queryLoader.insertStruct( db, knownPackages, - data.map((x) => prepareStruct(x, typeMap.get(dbEnum.zclType.struct))) + data.map((x) => prepareStruct(x, typeMap.get(dbEnum.zclType.struct))), ) } @@ -1683,7 +1683,7 @@ async function processDeviceTypes(db, filePath, packageId, data, context) { await queryLoader.insertDeviceComposition( db, deviceType, - endpointCompositionId + endpointCompositionId, ) } } @@ -1703,7 +1703,7 @@ async function processParsedZclData( db, argument, previouslyKnownPackages, - context + context, ) { let filePath = argument.filePath let data = argument.result @@ -1735,7 +1735,7 @@ async function processParsedZclData( let batch1 = [] if ('accessControl' in toplevel) { batch1.push( - processAccessControl(db, filePath, packageId, toplevel.accessControl) + processAccessControl(db, filePath, packageId, toplevel.accessControl), ) } if ('tag' in toplevel) { @@ -1755,19 +1755,19 @@ async function processParsedZclData( filePath, packageId, toplevel.deviceType, - context - ) + context, + ), ) } if ('global' in toplevel) { batch2.push( - processGlobals(db, filePath, packageId, toplevel.global, context) + processGlobals(db, filePath, packageId, toplevel.global, context), ) } if ('cluster' in toplevel) { featureClusters = toplevel.cluster.filter((c) => 'features' in c) batch2.push( - processClusters(db, filePath, packageId, toplevel.cluster, context) + processClusters(db, filePath, packageId, toplevel.cluster, context), ) } await Promise.all(batch2) @@ -1781,8 +1781,8 @@ async function processParsedZclData( packageId, knownPackages, toplevel.atomic, - dbEnum.zclType.atomic - ) + dbEnum.zclType.atomic, + ), ) } @@ -1794,8 +1794,8 @@ async function processParsedZclData( packageId, knownPackages, toplevel.bitmap, - dbEnum.zclType.bitmap - ) + dbEnum.zclType.bitmap, + ), ) } @@ -1817,8 +1817,8 @@ async function processParsedZclData( }, }, ], - dbEnum.zclType.bitmap - ) + dbEnum.zclType.bitmap, + ), ) }) } @@ -1831,8 +1831,8 @@ async function processParsedZclData( packageId, knownPackages, toplevel.enum, - dbEnum.zclType.enum - ) + dbEnum.zclType.enum, + ), ) } if (dbEnum.zclType.struct in toplevel) { @@ -1843,8 +1843,8 @@ async function processParsedZclData( packageId, knownPackages, toplevel.struct, - dbEnum.zclType.struct - ) + dbEnum.zclType.struct, + ), ) } await Promise.all(batch3) @@ -1854,10 +1854,10 @@ async function processParsedZclData( let Batch4 = [] if (dbEnum.zclType.atomic in toplevel) { Batch4.push( - processNumber(db, filePath, packageId, knownPackages, toplevel.atomic) + processNumber(db, filePath, packageId, knownPackages, toplevel.atomic), ) Batch4.push( - processString(db, filePath, packageId, knownPackages, toplevel.atomic) + processString(db, filePath, packageId, knownPackages, toplevel.atomic), ) Batch4.push( processEnumAtomic( @@ -1865,8 +1865,8 @@ async function processParsedZclData( filePath, packageId, knownPackages, - toplevel.atomic - ) + toplevel.atomic, + ), ) Batch4.push( processBitmapAtomic( @@ -1874,8 +1874,8 @@ async function processParsedZclData( filePath, packageId, knownPackages, - toplevel.atomic - ) + toplevel.atomic, + ), ) } await Promise.all(Batch4) @@ -1883,12 +1883,12 @@ async function processParsedZclData( let Batch5 = [] if (dbEnum.zclType.enum in toplevel) { Batch5.push( - processEnum(db, filePath, packageId, knownPackages, toplevel.enum) + processEnum(db, filePath, packageId, knownPackages, toplevel.enum), ) } if (dbEnum.zclType.bitmap in toplevel) { Batch5.push( - processBitmap(db, filePath, packageId, knownPackages, toplevel.bitmap) + processBitmap(db, filePath, packageId, knownPackages, toplevel.bitmap), ) } // Treating features in a cluster as a bitmap @@ -1903,13 +1903,13 @@ async function processParsedZclData( cluster_code: [fc.code[0]], }, }, - ]) + ]), ) }) } if (dbEnum.zclType.struct in toplevel) { Batch5.push( - processStruct(db, filePath, packageId, knownPackages, toplevel.struct) + processStruct(db, filePath, packageId, knownPackages, toplevel.struct), ) } await Promise.all(Batch5) @@ -1918,7 +1918,7 @@ async function processParsedZclData( let batch6 = [] if (dbEnum.zclType.enum in toplevel) { batch6.push( - processEnumItems(db, filePath, packageId, knownPackages, toplevel.enum) + processEnumItems(db, filePath, packageId, knownPackages, toplevel.enum), ) } if (dbEnum.zclType.bitmap in toplevel) { @@ -1928,15 +1928,15 @@ async function processParsedZclData( filePath, packageId, knownPackages, - toplevel.bitmap - ) + toplevel.bitmap, + ), ) } // Treating features in a cluster as a bitmap if (featureClusters.length > 0) { featureClusters.forEach((fc) => { batch6.push( - processBitmapFields(db, filePath, packageId, knownPackages, fc) + processBitmapFields(db, filePath, packageId, knownPackages, fc), ) }) } @@ -1947,8 +1947,8 @@ async function processParsedZclData( filePath, knownPackages, toplevel.struct, - context - ) + context, + ), ) } await Promise.all(batch6) @@ -1957,7 +1957,7 @@ async function processParsedZclData( let Batch7 = [] if ('defaultAccess' in toplevel) { Batch7.push( - processDefaultAccess(db, filePath, packageId, toplevel.defaultAccess) + processDefaultAccess(db, filePath, packageId, toplevel.defaultAccess), ) } if ('atomic' in toplevel) { @@ -1977,8 +1977,8 @@ async function processParsedZclData( db, filePath, packageId, - toplevel.cluster - ) + toplevel.cluster, + ), ) } if ('clusterExtension' in toplevel) { @@ -1989,8 +1989,8 @@ async function processParsedZclData( packageId, knownPackages, toplevel.clusterExtension, - context - ) + context, + ), ) } return Promise.all(delayedPromises) @@ -2018,7 +2018,7 @@ async function parseSingleZclFile(db, packageId, file, context) { data, packageId, dbEnum.packageType.zclXml, - false + false, ) if (result.data) { result.result = await util.parseXml(fileContent) @@ -2054,13 +2054,13 @@ async function isCrcMismatchOrPackageDoesNotExist(db, packageId, files) { db, filePath, packageId, - false + false, ) if (pkg != null && pkg.crc != actualCrc) { env.logDebug( `CRC missmatch for file ${pkg.path}, (${pkg.crc} vs ${actualCrc}) package id ${pkg.id}, parsing. - Mismatch with package id: ${packageId}` + Mismatch with package id: ${packageId}`, ) result.isCrcMismatch = true return result @@ -2068,7 +2068,7 @@ async function isCrcMismatchOrPackageDoesNotExist(db, packageId, files) { // This is executed if there is no CRC in the database. packagesNotFound++ env.logDebug( - `No CRC in the database for file ${filePath}. Package needs to be loaded` + `No CRC in the database for file ${filePath}. Package needs to be loaded`, ) } else if (pkg != null && pkg.crc == actualCrc) { packagesFound++ @@ -2101,14 +2101,14 @@ async function parseZclFiles(db, packageId, zclFiles, context) { // referenced by other types let typesFiles = zclFiles.filter((file) => file.includes('types.xml')) let typeFilePromise = typesFiles.map((file) => - parseSingleZclFile(db, packageId, file, context) + parseSingleZclFile(db, packageId, file, context), ) await Promise.all(typeFilePromise) // Load everything apart from atomic data types let nonTypesFiles = zclFiles.filter((file) => !file.includes('types.xml')) let individualFilePromise = nonTypesFiles.map((file) => - parseSingleZclFile(db, packageId, file, context) + parseSingleZclFile(db, packageId, file, context), ) let individualResults = await Promise.all(individualFilePromise) let laterPromises = individualResults.flat(2) @@ -2137,7 +2137,7 @@ async function parseManufacturerData(db, packageId, manufacturersXml) { manufacturerMap.map.mapping.map((datum) => { let mfgPair = datum['$'] return { code: mfgPair['code'], label: mfgPair['translation'] } - }) + }), ) } @@ -2160,7 +2160,7 @@ async function parseProfilesData(db, packageId, profilesXml) { profilesMap.map.mapping.map((datum) => { let profilePair = datum['$'] return { code: profilePair['code'], label: profilePair['translation'] } - }) + }), ) } @@ -2187,9 +2187,9 @@ async function parseFeatureFlags(db, packageId, featureFlags) { code: data, label: featureFlags[featureCategory][data] == '1' ? true : false, } - }) + }), ) - }) + }), ) } @@ -2216,7 +2216,7 @@ async function parseUiOptions(db, packageId, uiOptions) { db, packageId, dbEnum.packageOptionCategory.ui, - data + data, ) } /** @@ -2256,7 +2256,7 @@ async function parseTextOptions(db, pkgRef, textOptions) { optionKey, optionValues.map((optionValue) => { return { code: optionValue.toLowerCase(), label: optionValue } - }) + }), ) }) return Promise.all(promises) @@ -2286,7 +2286,7 @@ async function parseBoolOptions(db, pkgRef, booleanCategories) { queryPackage.insertOptionsKeyValues(db, pkgRef, optionCategory, [ { code: 1, label: 'True' }, { code: 0, label: 'False' }, - ]) + ]), ) }) return Promise.all(promises) @@ -2311,7 +2311,7 @@ async function parseBoolOptions(db, pkgRef, booleanCategories) { async function parseattributeAccessInterfaceAttributes( db, pkgRef, - attributeAccessInterfaceAttributes + attributeAccessInterfaceAttributes, ) { const clusters = Object.keys(attributeAccessInterfaceAttributes) for (let i = 0; i < clusters.length; i++) { @@ -2328,7 +2328,7 @@ async function parseattributeAccessInterfaceAttributes( db, pkgRef, cluster, - optionsKeyValues + optionsKeyValues, ) } catch (error) { console.error(`Error inserting attributes for cluster ${cluster}:`, error) @@ -2368,7 +2368,7 @@ async function parseTextDefaults(db, pkgRef, textDefaults) { db, pkgRef, optionCategory, - hex + hex, ) } else { return specificValue @@ -2378,17 +2378,17 @@ async function parseTextDefaults(db, pkgRef, textDefaults) { if (specificValue == null) { env.logWarning( 'Default value for: ${optionCategory}/${txt} does not match an option for packageId: ' + - pkgRef + pkgRef, ) } else { return queryPackage.insertDefaultOptionValue( db, pkgRef, optionCategory, - specificValue.id + specificValue.id, ) } - }) + }), ) } return Promise.all(promises) @@ -2405,16 +2405,16 @@ async function parseBoolDefaults(db, pkgRef, booleanCategories) { db, pkgRef, optionCategory, - booleanCategories[optionCategory] ? 1 : 0 + booleanCategories[optionCategory] ? 1 : 0, ) .then((specificValue) => queryPackage.insertDefaultOptionValue( db, pkgRef, optionCategory, - specificValue.id - ) - ) + specificValue.id, + ), + ), ) } return Promise.all(promises) @@ -2444,7 +2444,7 @@ async function loadIndividualSilabsFile(db, filePath, sessionId) { data, null, dbEnum.packageType.zclXmlStandalone, - true + true, ) let pkgId = result.packageId if (result.data) { @@ -2468,14 +2468,14 @@ async function loadIndividualSilabsFile(db, filePath, sessionId) { !result.result.configurator.clusterExtension ) { env.logDebug( - `CRC match for file ${result.filePath} (${result.crc}), skipping parsing.` + `CRC match for file ${result.filePath} (${result.crc}), skipping parsing.`, ) delete result.result } } let sessionPackages = await queryPackage.getSessionZclPackages( db, - sessionId + sessionId, ) let packageSet = new Set() sessionPackages.map((sessionPackage) => { @@ -2486,14 +2486,14 @@ async function loadIndividualSilabsFile(db, filePath, sessionId) { await Promise.all( laterPromises.flat(1).map((promise) => { if (promise != null && promise != undefined) return promise() - }) + }), ) // Check if session partition for package exists. If not then add it. let sessionPartitionInfoForNewPackage = await querySession.selectSessionPartitionInfoFromPackageId( db, sessionId, - pkgId + pkgId, ) if (sessionPartitionInfoForNewPackage.length == 0) { let sessionPartitionInfo = @@ -2501,13 +2501,13 @@ async function loadIndividualSilabsFile(db, filePath, sessionId) { let sessionPartitionId = await querySession.insertSessionPartition( db, sessionId, - sessionPartitionInfo.length + 1 + sessionPartitionInfo.length + 1, ) await queryPackage.insertSessionPackage( db, sessionPartitionId, pkgId, - true + true, ) } await zclLoader.processZclPostLoading(db, pkgId) @@ -2520,7 +2520,7 @@ async function loadIndividualSilabsFile(db, filePath, sessionId) { `Error reading xml file: ${filePath}, Error Message: ` + err.message, sessionId, 1, - 0 + 0, ) return { succeeded: false, err: err } } @@ -2547,7 +2547,7 @@ async function processCustomZclDeviceType(db, packageId) { db, packageId, dbEnum.customDevice.code, - dbEnum.customDevice.name + dbEnum.customDevice.name, ) if (existingCustomDevice == null) await queryLoader.insertDeviceTypes(db, packageId, customDeviceTypes) @@ -2596,12 +2596,12 @@ async function loadZclJsonOrProperties(db, metafile, isJson = false) { db, ctx.metadataFile, ctx.crc, - true + true, ) let packageStatus = await isCrcMismatchOrPackageDoesNotExist( db, ctx.packageId, - ctx.zclFiles + ctx.zclFiles, ) if (packageStatus.isCrcMismatch || packageStatus.areSomePackagesNotLoaded) { await queryPackage.updatePackageIsInSync(db, ctx.packageId, 0) @@ -2609,7 +2609,7 @@ async function loadZclJsonOrProperties(db, metafile, isJson = false) { db, ctx.metadataFile, ctx.crc, - false + false, ) } @@ -2623,7 +2623,7 @@ async function loadZclJsonOrProperties(db, metafile, isJson = false) { ctx.packageId, ctx.version, ctx.category, - ctx.description + ctx.description, ) } @@ -2632,7 +2632,7 @@ async function loadZclJsonOrProperties(db, metafile, isJson = false) { let newFileResult = await newDataModel.parseNewXmlFiles( db, ctx.packageId, - ctx.newXmlFile + ctx.newXmlFile, ) ctx.clustersLoadedFromNewFiles = newFileResult.clusterIdsLoaded ctx.newFileErrors = newFileResult.errorFiles @@ -2642,31 +2642,31 @@ async function loadZclJsonOrProperties(db, metafile, isJson = false) { if (ctx.attributeAccessInterfaceAttributes) { let all_known_clusters = await queryZcl.selectAllClusters( db, - ctx.packageId + ctx.packageId, ) for (let clusterName of Object.keys( - ctx.attributeAccessInterfaceAttributes + ctx.attributeAccessInterfaceAttributes, )) { let known_cluster = all_known_clusters.find( - (c) => c.name == clusterName + (c) => c.name == clusterName, ) if (!known_cluster) { throw new Error( - `\n\nUnknown cluster "${clusterName}" in attributeAccessInterfaceAttributes\n\n` + `\n\nUnknown cluster "${clusterName}" in attributeAccessInterfaceAttributes\n\n`, ) } let known_cluster_attributes = await queryZcl.selectAttributesByClusterIdIncludingGlobal( db, known_cluster.id, - ctx.packageId + ctx.packageId, ) for (let attrName of ctx.attributeAccessInterfaceAttributes[ clusterName ]) { if (!known_cluster_attributes.find((a) => a.name == attrName)) { throw new Error( - `\n\nUnknown attribute "${attrName}" in attributeAccessInterfaceAttributes["${clusterName}"]\n\n` + `\n\nUnknown attribute "${attrName}" in attributeAccessInterfaceAttributes["${clusterName}"]\n\n`, ) } } @@ -2692,7 +2692,7 @@ async function loadZclJsonOrProperties(db, metafile, isJson = false) { await parseattributeAccessInterfaceAttributes( db, ctx.packageId, - ctx.attributeAccessInterfaceAttributes + ctx.attributeAccessInterfaceAttributes, ) } if (ctx.featureFlags) { diff --git a/src-electron/zcl/zcl-loader.js b/src-electron/zcl/zcl-loader.js index 03a27da91f..bcad535a4c 100644 --- a/src-electron/zcl/zcl-loader.js +++ b/src-electron/zcl/zcl-loader.js @@ -43,7 +43,7 @@ async function recordToplevelPackage( db, metadataFile, crc, - isTopLevelPackageInSync + isTopLevelPackageInSync, ) { let topLevel = await queryPackage.registerTopLevelPackage( db, @@ -53,7 +53,7 @@ async function recordToplevelPackage( null, null, null, - isTopLevelPackageInSync + isTopLevelPackageInSync, ) return topLevel.id } @@ -70,7 +70,7 @@ async function recordVersion(db, packageId, version, category, description) { packageId, version, category, - description + description, ) } @@ -104,7 +104,7 @@ async function loadZclMetaFilesCommon(db, metadataFile, options) { async function loadAttributeMappingForMultiProtocol( db, multiProtcolInfo, - categoryToPackageIdMap + categoryToPackageIdMap, ) { let attributeMapRes = [] for (const mi of multiProtcolInfo) { @@ -112,17 +112,17 @@ async function loadAttributeMappingForMultiProtocol( let metaDataDir = path.dirname(resolvedMetafile) let multiProtocolFileName = path.join( metaDataDir, - mi.multiProtocolInfo.defaults + mi.multiProtocolInfo.defaults, ) // Check if this package exists in the db. Add it to package table if it does not exist let pkgInfo = await queryPackage.getPackageByPathAndType( db, multiProtocolFileName, - dbEnum.packageType.jsonExtension + dbEnum.packageType.jsonExtension, ) let multiProtocolData = await fsPromise.readFile( multiProtocolFileName, - 'utf8' + 'utf8', ) let actualMultiProtocolFileCrc = util.checksum(multiProtocolData) if (!pkgInfo) { @@ -133,7 +133,7 @@ async function loadAttributeMappingForMultiProtocol( dbEnum.packageType.jsonExtension, mi.packageId, null, - mi.category + mi.category, ) } else if (pkgInfo.crc == actualMultiProtocolFileCrc) { // No need to load the file again if already loaded once @@ -153,22 +153,22 @@ async function loadAttributeMappingForMultiProtocol( attributeMapEntry.push( ai[category].code ? types.hexStringToInt(ai[category].code) - : null + : null, ) attributeMapEntry.push( ai[category].manufacturerCode ? types.hexStringToInt(ai[category].manufacturerCode) - : null + : null, ) attributeMapEntry.push( ci[category].code ? types.hexStringToInt(ci[category].code) - : null + : null, ) attributeMapEntry.push( ci[category].manufacturerCode ? types.hexStringToInt(ci[category].manufacturerCode) - : null + : null, ) attributeMapEntry.push(categoryToPackageIdMap[category]) attributeMapEntry.push(categoryToPackageIdMap[category]) @@ -196,7 +196,7 @@ async function loadZclMetafiles( metadataFiles, options = { failOnLoadingError: true, - } + }, ) { let packageIds = [] let multiProtcolInfo = [] @@ -222,7 +222,7 @@ async function loadZclMetafiles( await loadAttributeMappingForMultiProtocol( db, multiProtcolInfo, - categoryToPackageIdMap + categoryToPackageIdMap, ) } return packageIds @@ -263,7 +263,7 @@ async function loadIndividualFile(db, filePath, sessionId) { return sLoad.loadIndividualSilabsFile(db, filePath, sessionId) } else { let err = new Error( - `Unable to read file: ${filePath}. Expecting an XML file with ZCL clusters.` + `Unable to read file: ${filePath}. Expecting an XML file with ZCL clusters.`, ) env.logWarning(err) queryNotification.setNotification(db, 'WARNING', err, sessionId, 2, 0) @@ -287,7 +287,7 @@ async function qualifyZclFile( info, parentPackageId, packageType, - isCustom + isCustom, ) { let filePath = info.filePath let data = info.data @@ -297,7 +297,7 @@ async function qualifyZclFile( db, filePath, parentPackageId, - isCustom + isCustom, ) if (pkg == null) { @@ -308,7 +308,7 @@ async function qualifyZclFile( filePath, actualCrc, packageType, - parentPackageId + parentPackageId, ) return { filePath: filePath, @@ -329,7 +329,7 @@ async function qualifyZclFile( } } env.logDebug( - `CRC match for file ${pkg.path} (${pkg.crc}), skipping parsing.` + `CRC match for file ${pkg.path} (${pkg.crc}), skipping parsing.`, ) return { error: `${pkg.path} skipped`, @@ -337,7 +337,7 @@ async function qualifyZclFile( } } else { env.logDebug( - `CRC missmatch for file ${pkg.path}, (${pkg.crc} vs ${actualCrc}) package id ${pkg.id}, parsing.` + `CRC missmatch for file ${pkg.path}, (${pkg.crc} vs ${actualCrc}) package id ${pkg.id}, parsing.`, ) await queryPackage.updatePathCrc(db, filePath, actualCrc, parentPackageId) return { diff --git a/src-script/build-backend.js b/src-script/build-backend.js index 422c9c19b4..e57866a809 100644 --- a/src-script/build-backend.js +++ b/src-script/build-backend.js @@ -27,7 +27,7 @@ scriptUtil .then(() => { let endTime = process.hrtime(startTime) console.log( - `😎 All done: ${endTime[0]}s, ${Math.round(endTime[1] / 1000000)}ms.` + `😎 All done: ${endTime[0]}s, ${Math.round(endTime[1] / 1000000)}ms.`, ) }) .catch((err) => { diff --git a/src-script/download-artifact.js b/src-script/download-artifact.js index 4d354e9519..1d373b0130 100755 --- a/src-script/download-artifact.js +++ b/src-script/download-artifact.js @@ -89,8 +89,8 @@ var __generator = op[0] & 2 ? y['return'] : op[0] - ? y['throw'] || ((t = y['return']) && t.call(y), 0) - : y.next) && + ? y['throw'] || ((t = y['return']) && t.call(y), 0) + : y.next) && !(t = t.call(y, op[1])).done) ) return t @@ -172,7 +172,7 @@ exports.__esModule = true var octokit_1 = require('octokit') var http_status_codes_1 = require('http-status-codes') var nodejs_file_downloader_1 = __importDefault( - require('nodejs-file-downloader') + require('nodejs-file-downloader'), ) var yargs_1 = __importDefault(require('yargs')) var node_os_1 = __importDefault(require('node:os')) @@ -275,7 +275,7 @@ function artifactoryStorageGet(dlOptions, uri) { url = '' .concat( artifactoryServerUrl(dlOptions), - '/artifactory/api/storage/gsdk-generic-production/' + '/artifactory/api/storage/gsdk-generic-production/', ) .concat(ARTIFACTORY_REPO_NAME, '/') .concat(dlOptions.owner, '/') @@ -344,7 +344,7 @@ function verifyPlatformAndFormat(name, platforms, formats) { function githubDownloadArtifacts( artifacts, dlOptions, - verifyPlatformAndFormat + verifyPlatformAndFormat, ) { return __awaiter(this, void 0, void 0, function () { var outputDir, @@ -380,7 +380,7 @@ function githubDownloadArtifacts( 'Repo: https://github.com/' .concat(owner, '/') .concat(repo, '/tree/') - .concat(branch) + .concat(branch), ) console.log( 'Commit: https://github.com/' @@ -389,8 +389,8 @@ function githubDownloadArtifacts( .concat( commit === null || commit === void 0 ? void 0 - : commit.substring(0, 7) - ) + : commit.substring(0, 7), + ), ) if (!artifacts.length) return [3 /*break*/, 4] if (dlOptions.mirror) { @@ -398,7 +398,7 @@ function githubDownloadArtifacts( outputDir, 'artifacts', dlOptions.branch, - artifacts[0].created_at + artifacts[0].created_at, ) } console.log('Output directory: '.concat(outputDir)) @@ -420,7 +420,7 @@ function githubDownloadArtifacts( archive_download_url, outputDir, githubToken, - ''.concat(name_1, '.zip') + ''.concat(name_1, '.zip'), ), // download metadata file. ] @@ -430,7 +430,7 @@ function githubDownloadArtifacts( try { fs_1['default'].writeFileSync( path_1['default'].join(outputDir, ''.concat(name_1, '.json')), - JSON.stringify(artifact, null, 4) + JSON.stringify(artifact, null, 4), ) } catch (err) { console.error(err) @@ -480,19 +480,19 @@ function githubListArtifacts(artifacts, dlOptions, verifyPlatformAndFormat) { artifactPath = path_1['default'].join( branch, artifacts[0].created_at, - ''.concat(name_2, '.zip') + ''.concat(name_2, '.zip'), ) if (DEBUG) console.log(''.concat(artifactPath)) artifactsList.push(artifactPath) } try { dir = path_1['default'].dirname( - path_1['default'].join(outputDir, ''.concat(branch, '.txt')) + path_1['default'].join(outputDir, ''.concat(branch, '.txt')), ) fs_1['default'].mkdirSync(dir, { recursive: true }) fs_1['default'].writeFileSync( path_1['default'].join(outputDir, ''.concat(branch, '.txt')), - artifactsList.join('\n') + artifactsList.join('\n'), ) } catch (err) { console.error(err) @@ -531,7 +531,7 @@ function download(archive_download_url, outDir, githubToken, name) { case 1: _a.trys.push([1, 3, , 4]) process.stdout.write( - 'Downloading '.concat(path_1['default'].basename(name), '...') + 'Downloading '.concat(path_1['default'].basename(name), '...'), ) return [4 /*yield*/, downloader.download()] //Downloader.download() returns a promise. case 2: @@ -609,7 +609,7 @@ function getExistingGithubBranches(options) { function artifactoryDownloadArtifacts( latest, dlOptions, - verifyPlatformAndFormat + verifyPlatformAndFormat, ) { var _a return __awaiter(this, void 0, void 0, function () { @@ -655,14 +655,16 @@ function artifactoryDownloadArtifacts( baseUri = latest.paths.join('').replace('/api/storage', '') baseUri = baseUri.replace( ARTIFACTORY_URL_DOMAIN_DEFAULT, - dlOptions.artifactoryUrl + dlOptions.artifactoryUrl, ) console.log('Repo: '.concat(baseUri)) return [4 /*yield*/, httpGet(baseUri + json)] case 2: jsonContent = _c.sent() console.log( - 'Commit: '.concat(jsonContent.workflow_run.head_sha.substring(0, 7)) + 'Commit: '.concat( + jsonContent.workflow_run.head_sha.substring(0, 7), + ), ) console.log('Output directory: '.concat(outputDir)) ;(_i = 0), (_b = __spreadArray([json], artifacts, true)) @@ -678,7 +680,7 @@ function artifactoryDownloadArtifacts( null, artifact, platforms, - __spreadArray(__spreadArray([], formats, true), ['.json'], false) + __spreadArray(__spreadArray([], formats, true), ['.json'], false), ) ) { return [3 /*break*/, 5] @@ -750,7 +752,7 @@ function githubGetArtifacts(options) { res = _g.sent() if (res.status != http_status_codes_1.StatusCodes.OK) { console.error( - 'Failed to query Github Artifacts API to download artifacts' + 'Failed to query Github Artifacts API to download artifacts', ) return [2 /*return*/, []] } @@ -795,7 +797,7 @@ function githubGetArtifacts(options) { ? void 0 : artifacts.filter(function (artifact) { return artifact.workflow_run.head_sha.startsWith( - refCommit + refCommit, ) }) // multiple builds can correspond to the same commit id @@ -947,8 +949,8 @@ function main() { console.log( 'Unable to reach Artifactory server ('.concat( artifactoryServerUrl(dlOptions), - '). Defaulting to Github instead.' - ) + '). Defaulting to Github instead.', + ), ) dlOptions.src = 'github' /* GITHUB */ } else if ( @@ -958,16 +960,16 @@ function main() { console.log( 'Branch '.concat( dlOptions.branch, - ' is not cached on Artifactory. Defaulting to Github instead.' - ) + ' is not cached on Artifactory. Defaulting to Github instead.', + ), ) dlOptions.src = 'github' /* GITHUB */ } else if (!cachedBranches.includes(dlOptions.branch)) { console.log( 'Branch '.concat( dlOptions.branch, - ' is not cached on Artifactory. Defaulting to master branch instead.' - ) + ' is not cached on Artifactory. Defaulting to master branch instead.', + ), ) dlOptions.branch = 'master' } @@ -983,7 +985,7 @@ function main() { artifactoryDownloadArtifacts( latest, dlOptions, - verifyPlatformAndFormat + verifyPlatformAndFormat, ), ] case 5: @@ -994,7 +996,7 @@ function main() { return [ 2 /*return*/, console.error( - 'Missing GITHUB_TOKEN env variable for Github.com access!\nFind more information at https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret' + 'Missing GITHUB_TOKEN env variable for Github.com access!\nFind more information at https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret', ), ] } @@ -1015,7 +1017,7 @@ function main() { githubDownloadArtifacts( artifacts, dlOptions, - verifyPlatformAndFormat + verifyPlatformAndFormat, ), ] case 10: diff --git a/src-script/download-artifact.ts b/src-script/download-artifact.ts index fa26eab9e4..a61a48c75a 100755 --- a/src-script/download-artifact.ts +++ b/src-script/download-artifact.ts @@ -54,7 +54,7 @@ function artifactoryServerUrl(opts: DlOptions) { } async function artifactoryGetLatestFolder( - opt: DlOptions + opt: DlOptions, ): Promise { const { folders, paths } = await artifactoryGetFolders(opt) const folder = folders.shift() @@ -64,7 +64,7 @@ async function artifactoryGetLatestFolder( async function artifactoryGetFolders( opt: DlOptions, - uri: string = '' + uri: string = '', ): Promise { const resp = await artifactoryStorageGet(opt, uri) const folders = resp?.children @@ -97,10 +97,10 @@ async function artifactoryGetFolders( async function artifactoryStorageGet( dlOptions: DlOptions, - uri: string = '' + uri: string = '', ): Promise { const url = `${artifactoryServerUrl( - dlOptions + dlOptions, )}/artifactory/api/storage/gsdk-generic-production/${ARTIFACTORY_REPO_NAME}/${ dlOptions.owner }/${dlOptions.repo}/${dlOptions.branch}/${uri}` @@ -127,17 +127,17 @@ async function httpGet(url: string) { function verifyPlatformAndFormat( name: string, platforms: string[], - formats: string[] + formats: string[], ) { // verify platform const verifyPlatform = platforms.reduce( (prev, cur) => prev || name.includes(cur), - false + false, ) const verifyFormat = formats.reduce( (prev, cur) => prev || name.endsWith(cur), - false + false, ) if (!verifyPlatform || !verifyFormat) { @@ -150,7 +150,7 @@ function verifyPlatformAndFormat( async function githubDownloadArtifacts( artifacts: any, dlOptions: DlOptions, - verifyPlatformAndFormat: Function + verifyPlatformAndFormat: Function, ) { let { outputDir, @@ -171,8 +171,8 @@ async function githubDownloadArtifacts( console.log( `Commit: https://github.com/${owner}/${repo}/commit/${commit?.substring( 0, - 7 - )}` + 7, + )}`, ) if (artifacts.length) { @@ -181,7 +181,7 @@ async function githubDownloadArtifacts( outputDir, 'artifacts', dlOptions.branch, - artifacts[0].created_at + artifacts[0].created_at, ) } @@ -196,14 +196,14 @@ async function githubDownloadArtifacts( archive_download_url, outputDir, githubToken, - `${name}.zip` + `${name}.zip`, ) // download metadata file. try { fs.writeFileSync( path.join(outputDir, `${name}.json`), - JSON.stringify(artifact, null, 4) + JSON.stringify(artifact, null, 4), ) } catch (err) { console.error(err) @@ -215,7 +215,7 @@ async function githubDownloadArtifacts( async function githubListArtifacts( artifacts: any, dlOptions: DlOptions, - verifyPlatformAndFormat: Function + verifyPlatformAndFormat: Function, ) { let { branch, outputDir, platforms, formats } = dlOptions @@ -238,7 +238,7 @@ async function githubListArtifacts( let artifactPath = path.join( branch, artifacts[0].created_at, - `${name}.zip` + `${name}.zip`, ) if (DEBUG) console.log(`${artifactPath}`) @@ -251,7 +251,7 @@ async function githubListArtifacts( fs.mkdirSync(dir, { recursive: true }) fs.writeFileSync( path.join(outputDir, `${branch}.txt`), - artifactsList.join('\n') + artifactsList.join('\n'), ) } catch (err) { console.error(err) @@ -263,7 +263,7 @@ async function download( archive_download_url: string, outDir: string, githubToken: string | undefined, - name: string + name: string, ) { let chunkCount = 0 const chunkSize = 200 @@ -317,7 +317,7 @@ function platforms(argv: any) { } async function getExistingGithubBranches( - options: DlOptions + options: DlOptions, ): Promise { const url = `https://api.github.com/repos/${options.owner}/${options.repo}/branches` let branches = [] @@ -336,7 +336,7 @@ async function getExistingGithubBranches( async function artifactoryDownloadArtifacts( latest: LatestFolder, dlOptions: DlOptions, - verifyPlatformAndFormat: Function + verifyPlatformAndFormat: Function, ) { let { owner, repo, branch, outputDir, platforms, formats } = dlOptions @@ -350,12 +350,12 @@ async function artifactoryDownloadArtifacts( let baseUri = latest.paths.join('').replace('/api/storage', '') baseUri = baseUri.replace( ARTIFACTORY_URL_DOMAIN_DEFAULT, - dlOptions.artifactoryUrl + dlOptions.artifactoryUrl, ) console.log(`Repo: ${baseUri}`) const jsonContent = await httpGet(baseUri + json) console.log( - `Commit: ${jsonContent.workflow_run.head_sha.substring(0, 7)}` + `Commit: ${jsonContent.workflow_run.head_sha.substring(0, 7)}`, ) console.log(`Output directory: ${outputDir}`) @@ -402,7 +402,7 @@ async function githubGetArtifacts(options: DlOptions) { { owner, repo, - } + }, ) if (res.status != StatusCodes.OK) { @@ -414,7 +414,7 @@ async function githubGetArtifacts(options: DlOptions) { // filter all artifact with current branch artifacts = artifacts?.filter( - (e: any) => e.workflow_run.head_branch === branch + (e: any) => e.workflow_run.head_branch === branch, ) if (artifacts && artifacts.length) { @@ -426,13 +426,13 @@ async function githubGetArtifacts(options: DlOptions) { return artifacts.filter( (artifact: any) => artifact.workflow_run.head_sha === refCommit && - artifact.workflow_run.id === refWorkflowRunId + artifact.workflow_run.id === refWorkflowRunId, ) } else { refCommit = commit artifacts = artifacts?.filter((artifact: any) => - artifact.workflow_run.head_sha.startsWith(refCommit) + artifact.workflow_run.head_sha.startsWith(refCommit), ) // multiple builds can correspond to the same commit id @@ -440,7 +440,7 @@ async function githubGetArtifacts(options: DlOptions) { if (artifacts?.length) { refWorkflowRunId = artifacts[0]?.workflow_run?.id artifacts = artifacts.filter( - (artifact: any) => artifact.workflow_run.id == refWorkflowRunId + (artifact: any) => artifact.workflow_run.id == refWorkflowRunId, ) } @@ -575,8 +575,8 @@ async function main() { ) { console.log( `Unable to reach Artifactory server (${artifactoryServerUrl( - dlOptions - )}). Defaulting to Github instead.` + dlOptions, + )}). Defaulting to Github instead.`, ) dlOptions.src = DownloadSources.GITHUB } else if ( @@ -584,12 +584,12 @@ async function main() { !cachedBranches.includes(dlOptions.branch) ) { console.log( - `Branch ${dlOptions.branch} is not cached on Artifactory. Defaulting to Github instead.` + `Branch ${dlOptions.branch} is not cached on Artifactory. Defaulting to Github instead.`, ) dlOptions.src = DownloadSources.GITHUB } else if (!cachedBranches.includes(dlOptions.branch)) { console.log( - `Branch ${dlOptions.branch} is not cached on Artifactory. Defaulting to master branch instead.` + `Branch ${dlOptions.branch} is not cached on Artifactory. Defaulting to master branch instead.`, ) dlOptions.branch = 'master' } @@ -601,13 +601,13 @@ async function main() { await artifactoryDownloadArtifacts( latest, dlOptions, - verifyPlatformAndFormat + verifyPlatformAndFormat, ) } else { if (!dlOptions.githubToken) { return console.error( `Missing GITHUB_TOKEN env variable for Github.com access! -Find more information at https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret` +Find more information at https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret`, ) } @@ -618,7 +618,7 @@ Find more information at https://docs.github.com/en/actions/security-guides/auto await githubDownloadArtifacts( artifacts, dlOptions, - verifyPlatformAndFormat + verifyPlatformAndFormat, ) } } diff --git a/src-script/gen-log-parse b/src-script/gen-log-parse index 1e4e6ec5d8..70a0b7b616 100755 --- a/src-script/gen-log-parse +++ b/src-script/gen-log-parse @@ -111,13 +111,13 @@ async function read() { for (let one of allParsed) { let out = one.output let input = Object.keys(final.zapFiles).find( - (key) => final.zapFiles[key] === one.input + (key) => final.zapFiles[key] === one.input, ) let zcl = Object.keys(final.zcl).find((key) => final.zcl[key] === one.zcl) let template = Object.keys(final.templates).find( - (key) => final.templates[key] === one.gen + (key) => final.templates[key] === one.gen, ) let thisOne = { diff --git a/src-script/gen-test-runner.js b/src-script/gen-test-runner.js index c7efb3ea0b..c3307a6e1d 100755 --- a/src-script/gen-test-runner.js +++ b/src-script/gen-test-runner.js @@ -55,7 +55,7 @@ async function main() { if (fs.existsSync(argv.apps) && fs.lstatSync(argv.apps).isDirectory()) { let sampleAppsPaths = find.fileSync(/\.zap$/, argv.apps) let sampleAppsNames = sampleAppsPaths.map((x) => - getSampleAppNamefromPath(x) + getSampleAppNamefromPath(x), ) sampleAppsNames.forEach((name, index) => { sampleApps.push({ name, path: sampleAppsPaths[index] }) @@ -89,7 +89,7 @@ async function main() { if (TEST_RUN_COUNT) console.log( - `Average generation time: ${totalGenerationTimeSec / TEST_RUN_COUNT}s` + `Average generation time: ${totalGenerationTimeSec / TEST_RUN_COUNT}s`, ) } diff --git a/src-script/gsdk-public-regen.js b/src-script/gsdk-public-regen.js index e661225536..a3c2b6c3b2 100755 --- a/src-script/gsdk-public-regen.js +++ b/src-script/gsdk-public-regen.js @@ -29,13 +29,13 @@ async function run(argv) { if (gsdkDir == null) { throw Error( - `Missing argument. Usage: gsdk-public-regen ` + `Missing argument. Usage: gsdk-public-regen `, ) } if (outputDir == null) { throw Error( - `Missing argument. Usage: gsdk-public-regen ` + `Missing argument. Usage: gsdk-public-regen `, ) } fs.mkdirSync(outputDir, { recursive: true }) @@ -43,7 +43,7 @@ async function run(argv) { console.log(`👉 Detecting GSDK at directory ${gsdkDir} ...`) if (!fs.existsSync(path.join(gsdkDir, 'gecko_sdk.slcs'))) { throw Error( - `Invalid location. Directory ${gsdkDir} does not look like a gecko sdk.` + `Invalid location. Directory ${gsdkDir} does not look like a gecko sdk.`, ) } console.log(`👍 Gecko SDK detected.`) @@ -57,7 +57,7 @@ async function run(argv) { let templateJson = path.join( gsdkDir, - 'protocol/zigbee/app/framework/gen-template/gen-templates.json' + 'protocol/zigbee/app/framework/gen-template/gen-templates.json', ) if (!fs.existsSync(templateJson)) { throw Error(`Invalid template.json. File ${templateJson} does not exist.`) diff --git a/src-script/license-check.js b/src-script/license-check.js index baba7fb225..a7aeb1505b 100644 --- a/src-script/license-check.js +++ b/src-script/license-check.js @@ -36,7 +36,7 @@ checker.init(args, (err, json) => { x + ' license:"' + json[x].licenses + - '"' + '"', ) fail = true } diff --git a/src-script/pack-apack-mac.js b/src-script/pack-apack-mac.js index a2856cc284..acbe0f8adc 100644 --- a/src-script/pack-apack-mac.js +++ b/src-script/pack-apack-mac.js @@ -18,7 +18,7 @@ exports.default = async function (buildResult) { { $progress: true, $bin: pathTo7zip, - } + }, ) // myStream.on('end', function () { // console.log(myStream.info) diff --git a/src-script/run-conditionally.js b/src-script/run-conditionally.js index 3e575f5bed..ce81d43cd9 100755 --- a/src-script/run-conditionally.js +++ b/src-script/run-conditionally.js @@ -52,7 +52,7 @@ async function runConditionally(condition, command) { return scriptUtil.executeCmd(null, command[0], command.slice(1)) } else { console.log( - `Condition is not met: ${condition}. Skipping the execution of: ${command}` + `Condition is not met: ${condition}. Skipping the execution of: ${command}`, ) return true } diff --git a/src-script/script-util.js b/src-script/script-util.js index 5c75730656..4ffcc7a1b3 100644 --- a/src-script/script-util.js +++ b/src-script/script-util.js @@ -51,7 +51,7 @@ async function executeCmd(ctx, cmd, args) { reject(code) } else { console.log( - `👎 Program ${cmd} exited with signal code: ${c.signalCode}` + `👎 Program ${cmd} exited with signal code: ${c.signalCode}`, ) reject(c.signalCode) } @@ -106,12 +106,12 @@ async function getStdout(onError, cmd, args) { async function rebuildSpaIfNeeded() { let srcHash = await folderHash.hashElement( path.join(__dirname, '../src'), - hashOptions + hashOptions, ) console.log(`🔍 Current src hash: ${srcHash.hash}`) let srcSharedHash = await folderHash.hashElement( path.join(__dirname, '../src-shared'), - hashOptions + hashOptions, ) console.log(`🔍 Current src-shared hash: ${srcSharedHash.hash}`) let ctx = { @@ -133,7 +133,7 @@ async function rebuildSpaIfNeeded() { oldHash = JSON.parse(data) console.log(`🔍 Previous src hash: ${oldHash.srcHash}`) console.log( - `🔍 Previous src-shared hash: ${oldHash.srcSharedHash}` + `🔍 Previous src-shared hash: ${oldHash.srcSharedHash}`, ) ctx.needsRebuild = oldHash.srcSharedHash != ctx.hash.srcSharedHash || @@ -141,16 +141,16 @@ async function rebuildSpaIfNeeded() { } if (ctx.needsRebuild) { console.log( - `🐝 Front-end code changed, so we need to rebuild SPA.` + `🐝 Front-end code changed, so we need to rebuild SPA.`, ) } else { console.log( - `👍 There were no changes to front-end code, so we don't have to rebuild the SPA.` + `👍 There were no changes to front-end code, so we don't have to rebuild the SPA.`, ) } resolve(ctx) }) - }) + }), ) .then((ctx) => { if (ctx.needsRebuild) @@ -169,7 +169,7 @@ async function rebuildSpaIfNeeded() { } else { resolve(ctx) } - }) + }), ) } @@ -182,7 +182,7 @@ async function rebuildBackendIfNeeded() { './src-electron/**/*.sql', './src-electron/icons/*', './dist/', - ]) + ]), ) } diff --git a/src-script/zap-combine-reports.js b/src-script/zap-combine-reports.js index 5d4220b873..555ee2bad0 100755 --- a/src-script/zap-combine-reports.js +++ b/src-script/zap-combine-reports.js @@ -30,14 +30,14 @@ async function executeScript() { if (fsExtra.existsSync('cypress-coverage/coverage-final.json')) { await fsExtra.copy( 'cypress-coverage/coverage-final.json', - 'reports/from-cypress.json' + 'reports/from-cypress.json', ) } if (fsExtra.existsSync('jest-coverage/coverage-final.json')) { await fsExtra.copy( 'jest-coverage/coverage-final.json', - 'reports/from-jest.json' + 'reports/from-jest.json', ) } @@ -51,17 +51,17 @@ async function executeScript() { {}, 'npx', 'nyc report --reporter lcov --reporter text --report-dir coverage'.split( - ' ' - ) + ' ', + ), ) console.log( - `✅ Please find the combined report (Jest & Cypress) at ./coverage/lcov-report/index.html` + `✅ Please find the combined report (Jest & Cypress) at ./coverage/lcov-report/index.html`, ) } catch (err) { console.log( 'Error in generating reports at zap-combine-reports.js file and executeScript function: ' + - err + err, ) } } diff --git a/src-script/zap-uitest.js b/src-script/zap-uitest.js index 4997246cfb..68c9f76cf8 100755 --- a/src-script/zap-uitest.js +++ b/src-script/zap-uitest.js @@ -91,7 +91,7 @@ svr.then(() => { process.exit(0) } else if (ignoreErrorCode) { console.log( - '⚠️ There was an error code, but will be ignored. Please check logs.' + '⚠️ There was an error code, but will be ignored. Please check logs.', ) process.exit(0) } else { diff --git a/src-script/zap-update-package-version.js b/src-script/zap-update-package-version.js index d5af8c791f..57424893b1 100755 --- a/src-script/zap-update-package-version.js +++ b/src-script/zap-update-package-version.js @@ -47,11 +47,11 @@ scriptUtil .then((result) => { if (result.wasChanged) { console.log( - `⛔ Version in package.json was not set correctly. It was automatically updated to ${result.version}. Review and commit again, please.` + `⛔ Version in package.json was not set correctly. It was automatically updated to ${result.version}. Review and commit again, please.`, ) } else { console.log( - `😎 Version in package.json was not changed from ${result.version}.` + `😎 Version in package.json was not changed from ${result.version}.`, ) } process.exit(result.wasChanged ? 1 : 0) diff --git a/src-script/zap-validate-metafiles.js b/src-script/zap-validate-metafiles.js index d4953b34f0..c05393f7b6 100755 --- a/src-script/zap-validate-metafiles.js +++ b/src-script/zap-validate-metafiles.js @@ -36,7 +36,7 @@ console.log(`Lockfile version: ${packageLock.lockfileVersion}`) if (packageLock.lockfileVersion != expectedLockfileVersion) { console.error( `package-lock.json is expected to have lockfileVersion ${expectedLockfileVersion}. Found: ${packageLock.lockfileVersion}. -Check your npm version.` +Check your npm version.`, ) process.exit(1) } @@ -44,7 +44,7 @@ Check your npm version.` console.log(`Application version: ${packageLock.version}`) if (packageLock.version != expectedVersion) { console.error( - `package-lock.json is expected to have version ${expectedVersion}. Found: ${packageLock.version}` + `package-lock.json is expected to have version ${expectedVersion}. Found: ${packageLock.version}`, ) process.exit(1) } diff --git a/src/App.vue b/src/App.vue index bc07879787..4985150849 100644 --- a/src/App.vue +++ b/src/App.vue @@ -51,7 +51,7 @@ window.addEventListener( case 'theme': window[rendApi.GLOBAL_SYMBOL_EXECUTE]( rendApi.id.setDarkTheme, - eventData.theme === 'dark' + eventData.theme === 'dark', ) break case 'save': @@ -62,12 +62,12 @@ window.addEventListener( case 'open-file': observable.setObservableAttribute( rendApi.observable.reported_files, - eventData + eventData, ) break } }, - false + false, ) async function initLoad(store) { @@ -77,43 +77,43 @@ async function initLoad(store) { store.dispatch('zap/loadOptions', { key: 'coreSpecification', type: 'string', - }) + }), ) promises.push( store.dispatch('zap/loadOptions', { key: 'clusterSpecification', type: 'string', - }) + }), ) promises.push( store.dispatch('zap/loadOptions', { key: 'deviceTypeSpecification', type: 'string', - }) + }), ) promises.push( store.dispatch('zap/loadOptions', { key: 'defaultResponsePolicy', type: 'string', - }) + }), ) promises.push( store.dispatch('zap/loadOptions', { key: 'manufacturerCodes', type: 'object', - }) + }), ) promises.push( store.dispatch('zap/loadOptions', { key: 'profileCodes', type: 'object', - }) + }), ) promises.push( store.dispatch('zap/loadOptions', { key: 'generator', type: 'object', - }) + }), ) promises.push(store.dispatch('zap/loadSessionKeyValues')) @@ -184,7 +184,7 @@ export default defineComponent({ setTheme() { window[rendApi.GLOBAL_SYMBOL_EXECUTE]( rendApi.id.setDarkTheme, - storage.getItem(rendApi.storageKey.isDarkThemeActive) + storage.getItem(rendApi.storageKey.isDarkThemeActive), ) }, @@ -224,7 +224,7 @@ export default defineComponent({ this.$serverGet(restApi.uri.uiOptions).then((res) => { this.$store.commit( 'zap/updateIsProfileIdShown', - res.data.showProfileId + res.data.showProfileId, ) }) } @@ -244,7 +244,7 @@ export default defineComponent({ if (`debugNavBar` in query) { this.$store.dispatch( 'zap/setDebugNavBar', - query[`debugNavBar`] === 'true' + query[`debugNavBar`] === 'true', ) } else { // If we don't specify it, default is on. @@ -258,7 +258,7 @@ export default defineComponent({ if (`setSaveButtonVisible` in query) { this.$store.dispatch( 'zap/setSaveButtonVisible', - query[`setSaveButtonVisible`] === 'true' + query[`setSaveButtonVisible`] === 'true', ) } else { // If we don't specify it, default is off. @@ -274,7 +274,7 @@ export default defineComponent({ rendApi.observable.progress_attribute, (message) => { this.setGenerationInProgress(message) - } + }, ) initLoad(this.$store).then(() => { @@ -289,7 +289,7 @@ export default defineComponent({ dbEnum.wsCategory.updateSelectedUcComponents, (resp) => { this.$store.dispatch('zap/updateSelectedUcComponentState', resp) - } + }, ) this.$onWebSocket(dbEnum.wsCategory.dirtyFlag, (resp) => { @@ -316,7 +316,7 @@ export default defineComponent({ hasMounted: true, }, }, - '*' + '*', ) }, unmounted() { diff --git a/src/api/renderer_api.js b/src/api/renderer_api.js index d02a0ef114..36faa4ef96 100644 --- a/src/api/renderer_api.js +++ b/src/api/renderer_api.js @@ -73,19 +73,19 @@ export function renderer_api_execute(id, ...args) { case rendApi.id.progressStart: observable.setObservableAttribute( rendApi.observable.progress_attribute, - args[0] + args[0], ) break case rendApi.id.progressEnd: observable.setObservableAttribute( rendApi.observable.progress_attribute, - '' + '', ) break case rendApi.id.reportFiles: observable.setObservableAttribute( rendApi.observable.reported_files, - JSON.parse(args[0]) + JSON.parse(args[0]), ) break case rendApi.id.debugNavBarOn: @@ -138,13 +138,13 @@ export function renderer_api_execute(id, ...args) { */ export function renderer_api_notify(key, value) { console.log( - `${rendApi.jsonPrefix}${JSON.stringify({ key: key, value: value })}` + `${rendApi.jsonPrefix}${JSON.stringify({ key: key, value: value })}`, ) window?.parent?.postMessage( { eventId: key, eventData: value, }, - '*' + '*', ) } diff --git a/src/boot/axios.js b/src/boot/axios.js index 0c6e8b9a3e..bfda4ed4a4 100644 --- a/src/boot/axios.js +++ b/src/boot/axios.js @@ -136,7 +136,7 @@ function serverPost(url, data, config = null) { zapUpdateExceptions( data, error.response.status, - error.response.data.message + error.response.data.message, ) }) } diff --git a/src/boot/ws.js b/src/boot/ws.js index 80d0fb8d7e..35dbb3bd92 100644 --- a/src/boot/ws.js +++ b/src/boot/ws.js @@ -99,7 +99,7 @@ client.onmessage = (event) => { } onWebSocket(dbEnum.wsCategory.init, (data) => - console.log(`Init message received: ${data}`) + console.log(`Init message received: ${data}`), ) //commented unnecessary logs and listeners diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index 48c279fa16..956f14d39b 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -16,7 +16,7 @@ v-for="(image, index) in getLogos( $store.state.zap.selectedZapConfig ? $store.state.zap.selectedZapConfig.zclProperties - : null + : null, )" :key="index" :src="image" @@ -311,7 +311,7 @@ export default { this.$store.state.zap.genericOptions[ dbEnum.sessionOption.coreSpecification ][0]['optionLabel'], - '_blank' + '_blank', ) } }, @@ -342,7 +342,7 @@ export default { doGeneration(path) { window[rendApi.GLOBAL_SYMBOL_EXECUTE]( rendApi.id.progressStart, - 'Generating files...' + 'Generating files...', ) this.$serverPut(restApi.uri.generate, { generationDirectory: path, @@ -369,7 +369,7 @@ export default { dbEnum.wsCategory.notificationCount, (notificationCount) => { this.$store.commit('zap/updateNotificationCount', notificationCount) - } + }, ) } diff --git a/src/components/ZclAttributeManager.vue b/src/components/ZclAttributeManager.vue index 2ec47e1c94..288e7d8731 100644 --- a/src/components/ZclAttributeManager.vue +++ b/src/components/ZclAttributeManager.vue @@ -71,7 +71,7 @@ limitations under the License. selection, 'selectedAttributes', props.row, - selectedCluster.id + selectedCluster.id, ) " /> @@ -92,8 +92,8 @@ limitations under the License. selectedCluster.manufacturerCode ? asHex(selectedCluster.manufacturerCode, 4) : props.row.manufacturerCode - ? asHex(props.row.manufacturerCode, 4) - : '' + ? asHex(props.row.manufacturerCode, 4) + : '' }} @@ -141,7 +141,7 @@ limitations under the License. $event, 'selectedSingleton', props.row, - selectedCluster.id + selectedCluster.id, ) " /> @@ -159,7 +159,7 @@ limitations under the License. $event, 'selectedBounded', props.row, - selectedCluster.id + selectedCluster.id, ) " /> @@ -189,12 +189,12 @@ limitations under the License. " :error=" !isDefaultValueValid( - hashAttributeIdClusterId(props.row.id, selectedCluster.id) + hashAttributeIdClusterId(props.row.id, selectedCluster.id), ) " :error-message=" getDefaultValueErrorMessage( - hashAttributeIdClusterId(props.row.id, selectedCluster.id) + hashAttributeIdClusterId(props.row.id, selectedCluster.id), ) " @update:model-value=" @@ -202,7 +202,7 @@ limitations under the License. $event, 'defaultValue', props.row, - selectedCluster.id + selectedCluster.id, ) " > @@ -217,7 +217,7 @@ limitations under the License. null, 'defaultValue', props.row, - selectedCluster.id + selectedCluster.id, ) " /> @@ -260,7 +260,7 @@ export default { isDisabledDefault(id, selectedClusterId) { return ( !this.selection.includes( - this.hashAttributeIdClusterId(id, selectedClusterId) + this.hashAttributeIdClusterId(id, selectedClusterId), ) || this.selectionStorageOption[ this.hashAttributeIdClusterId(id, selectedClusterId) @@ -271,14 +271,14 @@ export default { isDisabledStorage(id, name, selectedClusterId) { return ( !this.selection.includes( - this.hashAttributeIdClusterId(id, selectedClusterId) + this.hashAttributeIdClusterId(id, selectedClusterId), ) || this.checkForcedExternal(name) ) }, //return true and disable if attribute is not enabled isDisabled(id, selectedClusterId) { return !this.selection.includes( - this.hashAttributeIdClusterId(id, selectedClusterId) + this.hashAttributeIdClusterId(id, selectedClusterId), ) }, //if disabled return null to be set as the default value @@ -301,7 +301,7 @@ export default { return ( this.isAttributeRequired(row) && !this.selection.includes( - this.hashAttributeIdClusterId(row.id, this.selectedCluster.id) + this.hashAttributeIdClusterId(row.id, this.selectedCluster.id), ) ) }, @@ -334,7 +334,7 @@ export default { y['side'], a, b, - this.sortByClusterAndManufacturerCode + this.sortByClusterAndManufacturerCode, ) case 'storageOption': { let i = @@ -352,7 +352,7 @@ export default { j, a, b, - this.sortByClusterAndManufacturerCode + this.sortByClusterAndManufacturerCode, ) } case 'singleton': @@ -362,7 +362,7 @@ export default { a, b, this.selectionSingleton, - this.sortByClusterAndManufacturerCode + this.sortByClusterAndManufacturerCode, ) case 'bounded': return this.sortByBoolean( @@ -371,7 +371,7 @@ export default { a, b, this.selectionBounded, - this.sortByClusterAndManufacturerCode + this.sortByClusterAndManufacturerCode, ) case 'type': return this.sortByText( @@ -379,7 +379,7 @@ export default { y['type'], a, b, - this.sortByClusterAndManufacturerCode + this.sortByClusterAndManufacturerCode, ) case 'default': return 0 @@ -399,7 +399,7 @@ export default { .filter( (attribute) => !attribute.isOptional || - this.requiredDeviceTypeAttributes.includes(attribute.id) + this.requiredDeviceTypeAttributes.includes(attribute.id), ) .map((attribute) => attribute.id) }, diff --git a/src/components/ZclAttributeReportingManager.vue b/src/components/ZclAttributeReportingManager.vue index 894ddece82..0a397b165c 100644 --- a/src/components/ZclAttributeReportingManager.vue +++ b/src/components/ZclAttributeReportingManager.vue @@ -70,7 +70,7 @@ limitations under the License. selectedReporting, 'selectedReporting', props.row, - selectedCluster.id + selectedCluster.id, ) " /> @@ -91,8 +91,8 @@ limitations under the License. selectedCluster.manufacturerCode ? asHex(selectedCluster.manufacturerCode, 4) : props.row.manufacturerCode - ? asHex(props.row.manufacturerCode, 4) - : '' + ? asHex(props.row.manufacturerCode, 4) + : '' }} @@ -129,7 +129,7 @@ limitations under the License. $event, 'reportingMax', props.row, - selectedCluster.id + selectedCluster.id, ) " /> @@ -152,12 +152,12 @@ limitations under the License. " :error=" !isDefaultValueValid( - hashAttributeIdClusterId(props.row.id, selectedCluster.id) + hashAttributeIdClusterId(props.row.id, selectedCluster.id), ) " :error-message=" getDefaultValueErrorMessage( - hashAttributeIdClusterId(props.row.id, selectedCluster.id) + hashAttributeIdClusterId(props.row.id, selectedCluster.id), ) " @update:model-value=" @@ -165,7 +165,7 @@ limitations under the License. $event, 'reportableChange', props.row, - selectedCluster.id + selectedCluster.id, ) " type="number" @@ -203,8 +203,8 @@ export default { return this.$store.state.zap.attributeView.selectedAttributes.includes( this.hashAttributeIdClusterId( attribute.id, - this.selectedCluster.id - ) + this.selectedCluster.id, + ), ) }) .filter((a) => { @@ -234,14 +234,14 @@ export default { this.relevantAttributeData.filter( (attribute) => !attribute.isOptional || - this.requiredDeviceTypeAttributes.includes(attribute.id) - ) + this.requiredDeviceTypeAttributes.includes(attribute.id), + ), ) return this.relevantAttributeData .filter( (attribute) => !attribute.isOptional || - this.requiredDeviceTypeAttributes.includes(attribute.id) + this.requiredDeviceTypeAttributes.includes(attribute.id), ) .map((attribute) => attribute.id) }, @@ -353,7 +353,7 @@ export default { }, displayAttrWarning(row) { let indexOfValue = this.selectedReporting.indexOf( - this.hashAttributeIdClusterId(row.id, this.selectedCluster.id) + this.hashAttributeIdClusterId(row.id, this.selectedCluster.id), ) let isDisabled if (indexOfValue === -1) { @@ -394,7 +394,7 @@ export default { a, b, this.selectedReporting, - this.sortByClusterAndManufacturerCode + this.sortByClusterAndManufacturerCode, ) } else if (sortBy === 'attrName') { return this.sortByText(x['label'], y['label'], a, b) @@ -404,7 +404,7 @@ export default { y['side'], a, b, - this.sortByClusterAndManufacturerCode + this.sortByClusterAndManufacturerCode, ) } }) @@ -413,14 +413,20 @@ export default { }, updateSelectedReporting() { this.attributeData.forEach((attribute) => { - if(attribute.reportingPolicy == "mandatory" || attribute.reportingPolicy == "suggested") { - let hashValue = this.hashAttributeIdClusterId(attribute.id, this.selectedCluster.id) - if(!this.selectedReporting.includes(hashValue)) { + if ( + attribute.reportingPolicy == 'mandatory' || + attribute.reportingPolicy == 'suggested' + ) { + let hashValue = this.hashAttributeIdClusterId( + attribute.id, + this.selectedCluster.id, + ) + if (!this.selectedReporting.includes(hashValue)) { this.selectedReporting.push(hashValue) } } }) - } + }, }, } diff --git a/src/components/ZclClusterManager.vue b/src/components/ZclClusterManager.vue index 14364fdfad..1d27e7c992 100644 --- a/src/components/ZclClusterManager.vue +++ b/src/components/ZclClusterManager.vue @@ -191,7 +191,7 @@ export default { ? true : cluster.label .toLowerCase() - .includes(this.filterString.toLowerCase()) + .includes(this.filterString.toLowerCase()), ) } else { return this.clusters.filter((cluster) => @@ -199,7 +199,7 @@ export default { ? true : cluster.label .toLowerCase() - .includes(this.filterString.toLowerCase()) + .includes(this.filterString.toLowerCase()), ) } }, @@ -270,7 +270,7 @@ export default { this.$store.state.zap.genericOptions[ dbEnum.sessionOption.clusterSpecification ][0]['optionLabel'], - '_blank' + '_blank', ) } }, diff --git a/src/components/ZclCommandManager.vue b/src/components/ZclCommandManager.vue index 096790ec1a..d3c6dc51d7 100644 --- a/src/components/ZclCommandManager.vue +++ b/src/components/ZclCommandManager.vue @@ -71,7 +71,7 @@ limitations under the License. selectionOut, 'selectedOut', props.row, - selectedCluster.id + selectedCluster.id, ) " /> @@ -95,7 +95,7 @@ limitations under the License. selectionIn, 'selectedIn', props.row, - selectedCluster.id + selectedCluster.id, ) " /> @@ -104,8 +104,8 @@ limitations under the License. props.row.source === 'client' ? 'Client ➞ Server' : props.row.source === 'server' - ? 'Server ➞ Client' - : 'Client ↔ Server' + ? 'Server ➞ Client' + : 'Client ↔ Server' }} {{ asHex(props.row.code, 2) @@ -121,8 +121,8 @@ limitations under the License. selectedCluster.manufacturerCode ? asHex(selectedCluster.manufacturerCode, 4) : props.row.manufacturerCode - ? asHex(props.row.manufacturerCode, 4) - : '-' + ? asHex(props.row.manufacturerCode, 4) + : '-' }} @@ -177,7 +177,7 @@ export default { (this.selectionServers.includes(this.selectedCluster.id) && row.source == 'server')) && !this.selectionOut.includes( - this.hashCommandIdClusterId(row.id, this.selectedCluster.id) + this.hashCommandIdClusterId(row.id, this.selectedCluster.id), )) || (this.isCommandRequired(row) && ((this.selectionClients.includes(this.selectedCluster.id) && @@ -185,7 +185,7 @@ export default { (this.selectionServers.includes(this.selectedCluster.id) && row.source == 'client')) && !this.selectionIn.includes( - this.hashCommandIdClusterId(row.id, this.selectedCluster.id) + this.hashCommandIdClusterId(row.id, this.selectedCluster.id), )) ) }, @@ -193,7 +193,7 @@ export default { // We determine the ID that we need to toggle within the list. // This ID comes from hashing the base Command ID and cluster data. let indexOfValue = list.indexOf( - this.hashCommandIdClusterId(commandData.id, clusterId) + this.hashCommandIdClusterId(commandData.id, clusterId), ) let addedValue diff --git a/src/components/ZclCreateModifyEndpoint.vue b/src/components/ZclCreateModifyEndpoint.vue index 5d6c0b7b8a..db80578b0f 100644 --- a/src/components/ZclCreateModifyEndpoint.vue +++ b/src/components/ZclCreateModifyEndpoint.vue @@ -286,17 +286,17 @@ export default { mounted() { if (this.endpointReference != null) { this.shownEndpoint.endpointIdentifier = parseInt( - this.endpointId[this.endpointReference] + this.endpointId[this.endpointReference], ) this.shownEndpoint.networkIdentifier = parseInt( - this.networkId[this.endpointReference] + this.networkId[this.endpointReference], ) this.shownEndpoint.parentReference = parseInt( - this.parentEndpointIdentifier[this.endpointReference] + this.parentEndpointIdentifier[this.endpointReference], ) this.shownEndpoint.profileIdentifier = this.asHex( parseInt(this.profileId[this.endpointReference]), - 4 + 4, ) const deviceVersion = @@ -421,7 +421,7 @@ export default { this.profileCodesOptions == null ? null : this.profileCodesOptions.find( - (o) => o.optionCode === this.shownEndpoint.profileIdentifier + (o) => o.optionCode === this.shownEndpoint.profileIdentifier, ) return profileOption @@ -493,7 +493,7 @@ export default { deviceType.deviceTypeRef === this.primaryDeviceTypeTmp.deviceTypeRef && deviceType.deviceIdentifier === - this.primaryDeviceTypeTmp.deviceIdentifier + this.primaryDeviceTypeTmp.deviceIdentifier, ) ) { this.primaryDeviceTypeTmp = newPrimaryDeviceType @@ -513,7 +513,7 @@ export default { const newPrimaryDevice = value let tempDeviceType = this.deviceType tempDeviceType = tempDeviceType.filter( - (d) => d.deviceTypeRef !== newPrimaryDevice.deviceTypeRef + (d) => d.deviceTypeRef !== newPrimaryDevice.deviceTypeRef, ) tempDeviceType.unshift(newPrimaryDevice) this.deviceType = tempDeviceType @@ -523,7 +523,7 @@ export default { methods: { setSelectOption(val) { const i = this.tmpSelectedOptions.findIndex( - (e) => e.deviceTypeRef === val.deviceTypeRef + (e) => e.deviceTypeRef === val.deviceTypeRef, ) if (i > -1) { this.tmpSelectedOptions.splice(i, 1) @@ -548,7 +548,7 @@ export default { this.$store.state.zap.genericOptions[ dbEnum.sessionOption.deviceTypeSpecification ][0]['optionLabel'], - '_blank' + '_blank', ) } }, @@ -580,7 +580,7 @@ export default { } else { profileId = this.asHex( this.zclDeviceTypes[deviceTypeRef].profileId, - 4 + 4, ) } this.shownEndpoint.profileIdentifier = profileId @@ -645,7 +645,7 @@ export default { .then((response) => { const deviceIdentifier = [] this.deviceTypeTmp.forEach((dt) => - deviceIdentifier.push(dt.deviceIdentifier) + deviceIdentifier.push(dt.deviceIdentifier), ) this.$store .dispatch(`zap/addEndpoint`, { @@ -671,13 +671,13 @@ export default { this.$store .dispatch( `zap/endpointTypeClustersInfo`, - this.endpointType[res.id] + this.endpointType[res.id], ) .then((res) => { if (res?.data) { const clusterStates = res.data const enabledClusterStates = clusterStates.filter( - (x) => x.enabled + (x) => x.enabled, ) for (const states of enabledClusterStates) { const { endpointTypeRef, clusterRef, side, enabled } = @@ -690,7 +690,7 @@ export default { } console.log( - `Enabling UC component ${JSON.stringify(arg)}` + `Enabling UC component ${JSON.stringify(arg)}`, ) this.updateSelectedComponentRequest(arg) } diff --git a/src/components/ZclDomainClusterView.vue b/src/components/ZclDomainClusterView.vue index 5e19c5753c..424bad9a38 100644 --- a/src/components/ZclDomainClusterView.vue +++ b/src/components/ZclDomainClusterView.vue @@ -309,7 +309,7 @@ export default { }, missingClusterMessage(clusterData) { let missingRequiredClusterPair = this.getMissingRequiredClusterPair( - clusterData.id + clusterData.id, ) let msg = '' if ( @@ -414,7 +414,7 @@ export default { role: ZclClusterRole.client, action: this.zclClusterRoleAction( this.selectionClients.includes(id), - event.client + event.client, ), state: event.client, }, @@ -422,7 +422,7 @@ export default { role: ZclClusterRole.server, action: this.zclClusterRoleAction( this.selectionServers.includes(id), - event.server + event.server, ), state: event.server, }, @@ -494,7 +494,7 @@ export default { added: server.state, listType: 'selectedServers', view: 'clustersView', - }) + }), ) this.$store.commit('zap/updateIsClusterOptionChanged', true) @@ -523,16 +523,16 @@ export default { let endpointsClusterInfo = await Promise.all( Object.keys(this.endpointId).map((id) => this.$serverGet(`${restApi.uri.endpointTypeClusters}${id}`).then( - (res) => res.data - ) - ) + (res) => res.data, + ), + ), ) endpointsClusterInfo = endpointsClusterInfo.flat() if (endpointsClusterInfo?.length) { for (const role of removeRoles) { let endpoints = endpointsClusterInfo.filter( - (x) => x.clusterRef == id && x.side == role && x.enabled + (x) => x.clusterRef == id && x.side == role && x.enabled, ) if (endpoints.length == 0) { @@ -552,14 +552,14 @@ export default { this.$store.dispatch('zap/updateSelectedCluster', cluster).then(() => { this.$store.dispatch( 'zap/refreshEndpointTypeCluster', - this.selectedEndpointTypeId + this.selectedEndpointTypeId, ) this.$store.dispatch('zap/setLastSelectedDomain', this.domainName) }) }, ucLabel(id) { let list = this.$store.state.zap.studio.ucComponents.filter( - (x) => x.name === id + (x) => x.name === id, ) return list && list.length ? list[0].label : '' }, diff --git a/src/components/ZclEndpointCard.vue b/src/components/ZclEndpointCard.vue index 82de32d63b..95b4492bca 100644 --- a/src/components/ZclEndpointCard.vue +++ b/src/components/ZclEndpointCard.vue @@ -32,7 +32,7 @@ limitations under the License. createLogoSrc( true, getDeviceCategory(deviceType[0]?.packageRef), - isSelectedEndpoint + isSelectedEndpoint, ) " alt="" @@ -147,7 +147,7 @@ limitations under the License. {{ `${deviceType[0]?.description} (${asHex( deviceType[0]?.code, - 4 + 4, )})` }} @@ -161,7 +161,7 @@ limitations under the License. {{ `${deviceType[0]?.description} (${asHex( deviceType[0]?.code, - 4 + 4, )})` }} @@ -310,7 +310,7 @@ export default { this.$store.state.zap.genericOptions[ dbEnum.sessionOption.deviceTypeSpecification ][0]['optionLabel'], - '_blank' + '_blank', ) } }, @@ -340,7 +340,7 @@ export default { updateDialogStateAndDeleteEndpoint() { Storage.setItem( 'confirmDeleteEndpointDialog', - this.confirmDeleteEndpointDialog + this.confirmDeleteEndpointDialog, ) this.deleteEpt() }, @@ -363,7 +363,7 @@ export default { this.$store.dispatch('zap/deleteEndpoint', endpointReference).then(() => { this.$store.dispatch( 'zap/deleteEndpointType', - this.endpointType[endpointReference] + this.endpointType[endpointReference], ) }) }, @@ -377,7 +377,7 @@ export default { this.$serverGet( `${restApi.uri.endpointTypeClusters}${ this.endpointType[this.endpointReference] - }` + }`, ).then((res) => { let enabledClients = [] let enabledServers = [] @@ -396,14 +396,14 @@ export default { this.$serverGet( `${restApi.uri.endpointTypeAttributes}${ this.endpointType[this.endpointReference] - }` + }`, ).then((res) => { this.selectedAttributes = [] this.selectedReporting = [] res.data.forEach((record) => { let resolvedReference = Util.cantorPair( record.attributeRef, - record.clusterRef + record.clusterRef, ) if (record.included) this.selectedAttributes.push(resolvedReference) if (record.includedReportable) diff --git a/src/components/ZclEndpointManager.vue b/src/components/ZclEndpointManager.vue index 4b8beedea6..fa838f4c3b 100644 --- a/src/components/ZclEndpointManager.vue +++ b/src/components/ZclEndpointManager.vue @@ -62,7 +62,7 @@ export default { // initialize ZclClusterManager with first endpoint info. if (this.endpointIdListSorted.size && !this.selectedEndpointId) { this.setSelectedEndpointType( - this.endpointIdListSorted.keys().next().value + this.endpointIdListSorted.keys().next().value, ) } }, diff --git a/src/components/ZclEventManager.vue b/src/components/ZclEventManager.vue index 318be5abce..8f5b296e40 100644 --- a/src/components/ZclEventManager.vue +++ b/src/components/ZclEventManager.vue @@ -48,7 +48,7 @@ limitations under the License. selectedEvents, 'selectedEvents', props.row, - selectedCluster.id + selectedCluster.id, ) " /> @@ -61,8 +61,8 @@ limitations under the License. selectedCluster.manufacturerCode ? asHex(selectedCluster.manufacturerCode, 4) : props.row.manufacturerCode - ? asHex(props.row.manufacturerCode, 4) - : '-' + ? asHex(props.row.manufacturerCode, 4) + : '-' }} {{ @@ -120,7 +120,7 @@ export default { // We determine the ID that we need to toggle within the list. // This ID comes from hashing the base event ID and cluster data. let indexOfValue = list.indexOf( - this.hashEventIdClusterId(eventData.id, clusterId) + this.hashEventIdClusterId(eventData.id, clusterId), ) let addedValue diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss index da9cdf2348..173334c9e8 100644 --- a/src/css/quasar.variables.scss +++ b/src/css/quasar.variables.scss @@ -141,7 +141,8 @@ $warning: #f2c037; background: url('/bg-layout.png'); } .linear-border-wrap { - background: linear-gradient(#fff, #fff) padding-box, + background: + linear-gradient(#fff, #fff) padding-box, linear-gradient(90deg, var(--q-primary), var(--q-secondary)) border-box !important; } .cluster-list { @@ -149,14 +150,16 @@ $warning: #f2c037; &.q-expansion-item--collapsed { .q-expansion-item__container { .q-item { - background: linear-gradient(#fff, #fff) padding-box, + background: + linear-gradient(#fff, #fff) padding-box, linear-gradient(90deg, var(--q-primary), var(--q-secondary)) border-box !important; } } } .q-expansion-item__content { - background: linear-gradient(#fff, #fff) padding-box, + background: + linear-gradient(#fff, #fff) padding-box, linear-gradient(90deg, var(--q-primary), var(--q-secondary)) border-box !important; } @@ -181,7 +184,8 @@ $warning: #f2c037; background: #202020; } .linear-border-wrap { - background: linear-gradient(#000, #000) padding-box, + background: + linear-gradient(#000, #000) padding-box, linear-gradient(90deg, var(--q-primary), var(--q-secondary)) border-box !important; } .cluster-list { @@ -189,8 +193,8 @@ $warning: #f2c037; &.q-expansion-item--collapsed { .q-expansion-item__container { .q-item { - background: linear-gradient(var(--q-dark), var(--q-dark)) - padding-box, + background: + linear-gradient(var(--q-dark), var(--q-dark)) padding-box, linear-gradient(90deg, var(--q-color-primary), var(--q-secondary)) border-box !important; @@ -201,7 +205,8 @@ $warning: #f2c037; } } .q-expansion-item__content { - background: linear-gradient(var(--q-dark), var(--q-dark)) padding-box, + background: + linear-gradient(var(--q-dark), var(--q-dark)) padding-box, linear-gradient(90deg, var(--q-color-primary), var(--q-secondary)) border-box !important; } diff --git a/src/css/zclTour.scss b/src/css/zclTour.scss index adfeb780e2..aafdc0a7c0 100644 --- a/src/css/zclTour.scss +++ b/src/css/zclTour.scss @@ -22,7 +22,9 @@ background-color: var(--tour-dialog-background-color-primary); color: var(--tour-dialog-text-color); border: 2px solid var(--q-primary); - box-shadow: 0 1px 5px rgb(0 0 0 / 20%), 0 2px 2px rgb(0 0 0 / 14%), + box-shadow: + 0 1px 5px rgb(0 0 0 / 20%), + 0 2px 2px rgb(0 0 0 / 14%), 0 3px 1px -2px rgb(0 0 0 / 12%); border-radius: 12px; padding: 12px !important; diff --git a/src/index.template.html b/src/index.template.html index da908ec450..ca965c6f01 100644 --- a/src/index.template.html +++ b/src/index.template.html @@ -1,4 +1,4 @@ - + ZAP - ZCL Advanced Platform diff --git a/src/pages/ExtensionsPage.vue b/src/pages/ExtensionsPage.vue index 5838935e38..9c745e37c5 100644 --- a/src/pages/ExtensionsPage.vue +++ b/src/pages/ExtensionsPage.vue @@ -134,7 +134,7 @@ limitations under the License.
  • { let notifications = res.data || [] let currentPackage = { @@ -304,7 +304,7 @@ export default { enableExtensionsWarning() { let categories = this.$store.state.zap.selectedZapConfig?.zclProperties.map( - (zclProp) => zclProp.category + (zclProp) => zclProp.category, ) // Showing extensions when the zcl packages have less than 1 category return categories.length > 1 @@ -319,7 +319,7 @@ export default { if (value.context == 'customXml') { this.packageToLoad = value.filePaths[0] } - } + }, ) } }, diff --git a/src/pages/NotificationsPage.vue b/src/pages/NotificationsPage.vue index 543420114c..b372758ba3 100644 --- a/src/pages/NotificationsPage.vue +++ b/src/pages/NotificationsPage.vue @@ -207,7 +207,7 @@ export default { (resp) => { this.notis = this.notis.filter((row) => row.id !== id) this.getUnseenNotificationCount() - } + }, ) }, // load package notification data after global var updates @@ -223,7 +223,7 @@ export default { }, async getPackageNotifications(packageId) { this.$serverGet( - restApi.uri.packageNotificationById.replace(':packageId', packageId) + restApi.uri.packageNotificationById.replace(':packageId', packageId), ).then((res) => { let notifications = res.data || [] let currentPackage = { diff --git a/src/pages/OptionsPage.vue b/src/pages/OptionsPage.vue index 40aa9b1072..3e38fcad46 100644 --- a/src/pages/OptionsPage.vue +++ b/src/pages/OptionsPage.vue @@ -51,7 +51,7 @@ limitations under the License. @update:model-value=" handleEnumeratedOptionChange( DbEnum.sessionOption.defaultResponsePolicy, - $event + $event, ) " outlined @@ -144,7 +144,7 @@ export default { o.optionCode === this.$store.state.zap.selectedGenericOptions[ DbEnum.sessionOption.defaultResponsePolicy - ] + ], ) } }, @@ -154,7 +154,7 @@ export default { return this.getMfgOptionLabel( this.$store.state.zap.selectedGenericOptions[ DbEnum.sessionOption.manufacturerCodes - ] + ], ) }, }, diff --git a/src/pages/ZapConfig.vue b/src/pages/ZapConfig.vue index 8dbb8cc606..ee6ade5b88 100644 --- a/src/pages/ZapConfig.vue +++ b/src/pages/ZapConfig.vue @@ -570,13 +570,13 @@ export default { // Updating this.selectedZclPropertiesData based on UI selections selectedZclPropertiesDataIds() { this.selectedZclPropertiesData = this.zclPropertiesRow.filter((zpr) => - this.selectedZclPropertiesDataIds.includes(zpr.id) + this.selectedZclPropertiesDataIds.includes(zpr.id), ) }, // Updating this.selectZclGenInfo based on UI selections selectedZclGenData() { this.selectZclGenInfo = this.zclGenRow.filter((zgr) => - this.selectedZclGenData.includes(zgr.id) + this.selectedZclGenData.includes(zgr.id), ) }, }, @@ -641,7 +641,7 @@ export default { map[key][row.ref].push(row.message) return map }, - { warningMap: {}, errorMap: {} } + { warningMap: {}, errorMap: {} }, ) }, // then assign classfied notifications to proper packages @@ -695,21 +695,21 @@ export default { let currentTemplatePackagesAbsolutePaths = [] if (this.currentZapFilePackages) { currentTopLevelZapFilePackages = this.currentZapFilePackages.filter( - (zfp) => zfp.type != dbEnum.packageType.zclXmlStandalone + (zfp) => zfp.type != dbEnum.packageType.zclXmlStandalone, ) currentZapFileZclPackages = this.currentZapFilePackages.filter( - (zfp) => zfp.type == dbEnum.packageType.zclProperties + (zfp) => zfp.type == dbEnum.packageType.zclProperties, ) currentZapFileTemplatePackages = this.currentZapFilePackages.filter( - (zfp) => zfp.type == dbEnum.packageType.genTemplatesJson + (zfp) => zfp.type == dbEnum.packageType.genTemplatesJson, ) currentZclPackagesAbsolutePaths = currentZapFileZclPackages.map((zfp) => - this.createAbsolutePath(this.filePath, zfp.path) + this.createAbsolutePath(this.filePath, zfp.path), ) currentTemplatePackagesAbsolutePaths = currentZapFileTemplatePackages.map((zfp) => - this.createAbsolutePath(this.filePath, zfp.path) + this.createAbsolutePath(this.filePath, zfp.path), ) } @@ -723,7 +723,7 @@ export default { ) { this.selectedZclGenData = this.zclGenRow.map((zgr) => zgr.id) this.selectedZclPropertiesDataIds = this.zclPropertiesRow.map( - (zpr) => zpr.id + (zpr) => zpr.id, ) this.selectedZclPropertiesData = this.zclPropertiesRow } @@ -731,13 +731,13 @@ export default { this.submitForm() } else { let selectableZclPackages = this.zclPropertiesRow.filter((zp) => - currentZclPackagesAbsolutePaths.includes(zp.path) + currentZclPackagesAbsolutePaths.includes(zp.path), ) let selectableTemplatePackages = this.zclGenRow.filter((zt) => - currentTemplatePackagesAbsolutePaths.includes(zt.path) + currentTemplatePackagesAbsolutePaths.includes(zt.path), ) this.selectedZclPropertiesDataIds = selectableZclPackages.map( - (zp) => zp.id + (zp) => zp.id, ) this.selectedZclPropertiesData = selectableTemplatePackages this.selectedZclGenData = selectableTemplatePackages.map((zt) => zt.id) @@ -780,7 +780,7 @@ export default { this.assignWarningsAndErrors( this.zclPropertiesRow, warningMap, - errorMap + errorMap, ) this.assignWarningsAndErrors(this.zclGenRow, warningMap, errorMap) }) diff --git a/src/pages/preferences/PreferenceGeneration.vue b/src/pages/preferences/PreferenceGeneration.vue index 91e5287134..97979fd86a 100644 --- a/src/pages/preferences/PreferenceGeneration.vue +++ b/src/pages/preferences/PreferenceGeneration.vue @@ -70,7 +70,7 @@ export default { packages: { get() { return this.$store.state.zap.allPackages.filter( - (singlePackage) => singlePackage.TYPE == 'gen-template' + (singlePackage) => singlePackage.TYPE == 'gen-template', ) }, }, diff --git a/src/router/index.js b/src/router/index.js index cad6688902..5eeca67f9d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -36,8 +36,8 @@ export default route(function (/* { store, ssrContext } */) { const createHistory = process.env.SERVER ? createMemoryHistory : process.env.VUE_ROUTER_MODE === 'history' - ? createWebHistory - : createWebHashHistory + ? createWebHistory + : createWebHashHistory const Router = createRouter({ scrollBehavior: () => ({ left: 0, top: 0 }), @@ -47,7 +47,7 @@ export default route(function (/* { store, ssrContext } */) { // quasar.conf.js -> build -> vueRouterMode // quasar.conf.js -> build -> publicPath history: createHistory( - process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE + process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE, ), }) diff --git a/src/store/zap/actions.js b/src/store/zap/actions.js index d228f3f546..18b9019ab2 100644 --- a/src/store/zap/actions.js +++ b/src/store/zap/actions.js @@ -44,7 +44,7 @@ export function updateInformationText(context, text) { export async function updateClusters(context) { let deviceTypes = await axiosRequests.$serverGet( - restApi.uri.zclDeviceType + 'all' + restApi.uri.zclDeviceType + 'all', ) axiosRequests.$serverGet(restApi.uri.zclCluster + 'all').then((response) => { response.data.deviceTypes = deviceTypes @@ -60,7 +60,7 @@ export function updateAtomics(context) { export async function updateSelectedCluster(context, cluster) { let res = await axiosRequests.$serverGet( - restApi.uri.zclCluster + `${cluster.id}` + restApi.uri.zclCluster + `${cluster.id}`, ) context.commit('updateSelectedCluster', [cluster]) updateAttributes(context, res.data.attributeData || []) @@ -150,7 +150,7 @@ export function updateSelectedAttribute(context, selectionContext) { export async function updateSelectedCommands(context, selectionContext) { let res = await axiosRequests.$serverPost( restApi.uri.commandUpdate, - selectionContext + selectionContext, ) let arg = res.data if (arg.action === 'boolean') { @@ -222,7 +222,7 @@ export function initializeDefaultEndpoints(context, defaultEndpoints) { } export function initializeDefaultEndpointsTypes( context, - defaultEndpointsTypes + defaultEndpointsTypes, ) { context.commit('initializeDefaultEndpointsTypes', defaultEndpointsTypes) } @@ -254,25 +254,25 @@ export function updateEndpointType(context, endpointType) { export function setDeviceTypeReference( context, - endpointTypeIdDeviceTypeRefPair + endpointTypeIdDeviceTypeRefPair, ) { axiosRequests .$serverGet( - `${restApi.uri.deviceTypeClusters}${endpointTypeIdDeviceTypeRefPair.deviceTypeRef}` + `${restApi.uri.deviceTypeClusters}${endpointTypeIdDeviceTypeRefPair.deviceTypeRef}`, ) .then((res) => { setRecommendedClusterList(context, res.data) }) axiosRequests .$serverGet( - `${restApi.uri.deviceTypeAttributes}${endpointTypeIdDeviceTypeRefPair.deviceTypeRef}` + `${restApi.uri.deviceTypeAttributes}${endpointTypeIdDeviceTypeRefPair.deviceTypeRef}`, ) .then((res) => { setRequiredAttributes(context, res.data) }) axiosRequests .$serverGet( - `${restApi.uri.deviceTypeCommands}${endpointTypeIdDeviceTypeRefPair.deviceTypeRef}` + `${restApi.uri.deviceTypeCommands}${endpointTypeIdDeviceTypeRefPair.deviceTypeRef}`, ) .then((res) => { setRequiredCommands(context, res.data) @@ -280,28 +280,28 @@ export function setDeviceTypeReference( axiosRequests .$serverGet( - `${restApi.uri.endpointTypeClusters}${endpointTypeIdDeviceTypeRefPair.endpointTypeId}` + `${restApi.uri.endpointTypeClusters}${endpointTypeIdDeviceTypeRefPair.endpointTypeId}`, ) .then((res) => { setClusterList(context, res.data) }) axiosRequests .$serverGet( - `${restApi.uri.endpointTypeAttributes}${endpointTypeIdDeviceTypeRefPair.endpointTypeId}` + `${restApi.uri.endpointTypeAttributes}${endpointTypeIdDeviceTypeRefPair.endpointTypeId}`, ) .then((res) => { setAttributeStateLists(context, res.data || []) }) axiosRequests .$serverGet( - `${restApi.uri.endpointTypeCommands}${endpointTypeIdDeviceTypeRefPair.endpointTypeId}` + `${restApi.uri.endpointTypeCommands}${endpointTypeIdDeviceTypeRefPair.endpointTypeId}`, ) .then((res) => { setCommandStateLists(context, res.data || []) }) axiosRequests .$serverGet( - `${restApi.uri.endpointTypeEvents}${endpointTypeIdDeviceTypeRefPair.endpointTypeId}` + `${restApi.uri.endpointTypeEvents}${endpointTypeIdDeviceTypeRefPair.endpointTypeId}`, ) .then((res) => { setEventStateLists(context, res.data || []) @@ -383,7 +383,7 @@ export function deleteEndpoint(context, endpointId) { export function duplicateEndpoint( context, - { endpointId, endpointIdentifier, endpointTypeId } + { endpointId, endpointIdentifier, endpointTypeId }, ) { return axiosRequests .$serverPost(restApi.uri.duplicateEndpoint, { @@ -428,13 +428,13 @@ export function refreshEndpointTypeCluster(context, endpointType) { export async function endpointTypeClustersInfo(context, endpointTypeId) { return axiosRequests.$serverGet( - `${restApi.uri.endpointTypeClusters}${endpointTypeId}` + `${restApi.uri.endpointTypeClusters}${endpointTypeId}`, ) } export async function updateSelectedEndpointType( context, - endpointTypeDeviceTypeRefPair + endpointTypeDeviceTypeRefPair, ) { const p = [] @@ -442,71 +442,71 @@ export async function updateSelectedEndpointType( p.push( axiosRequests .$serverGet( - `${restApi.uri.endpointTypeClusters}${endpointTypeDeviceTypeRefPair.endpointType}` + `${restApi.uri.endpointTypeClusters}${endpointTypeDeviceTypeRefPair.endpointType}`, ) .then((res) => { setClusterList(context, res.data) - }) + }), ) p.push( axiosRequests .$serverGet( - `${restApi.uri.endpointTypeAttributes}${endpointTypeDeviceTypeRefPair.endpointType}` + `${restApi.uri.endpointTypeAttributes}${endpointTypeDeviceTypeRefPair.endpointType}`, ) .then((res) => { setAttributeStateLists(context, res.data || []) - }) + }), ) p.push( axiosRequests .$serverGet( - `${restApi.uri.endpointTypeCommands}${endpointTypeDeviceTypeRefPair.endpointType}` + `${restApi.uri.endpointTypeCommands}${endpointTypeDeviceTypeRefPair.endpointType}`, ) .then((res) => { setCommandStateLists(context, res.data || []) - }) + }), ) p.push( axiosRequests .$serverGet( - `${restApi.uri.endpointTypeEvents}${endpointTypeDeviceTypeRefPair.endpointType}` + `${restApi.uri.endpointTypeEvents}${endpointTypeDeviceTypeRefPair.endpointType}`, ) .then((res) => { setEventStateLists(context, res.data || []) - }) + }), ) p.push( axiosRequests .$serverGet( - `${restApi.uri.deviceTypeClusters}${endpointTypeDeviceTypeRefPair.deviceTypeRef}` + `${restApi.uri.deviceTypeClusters}${endpointTypeDeviceTypeRefPair.deviceTypeRef}`, ) .then((res) => { setRecommendedClusterList(context, res.data) - }) + }), ) p.push( axiosRequests .$serverGet( - `${restApi.uri.deviceTypeAttributes}${endpointTypeDeviceTypeRefPair.deviceTypeRef}` + `${restApi.uri.deviceTypeAttributes}${endpointTypeDeviceTypeRefPair.deviceTypeRef}`, ) .then((res) => { setRequiredAttributes(context, res.data) - }) + }), ) p.push( axiosRequests .$serverGet( - `${restApi.uri.deviceTypeCommands}${endpointTypeDeviceTypeRefPair.deviceTypeRef}` + `${restApi.uri.deviceTypeCommands}${endpointTypeDeviceTypeRefPair.deviceTypeRef}`, ) .then((res) => { setRequiredCommands(context, res.data) - }) + }), ) context.commit( 'updateSelectedEndpointType', - endpointTypeDeviceTypeRefPair.endpointType + endpointTypeDeviceTypeRefPair.endpointType, ) } return await Promise.all(p) @@ -532,7 +532,7 @@ export function setClusterList(context, selectionContext) { export function setAttributeState(context, selectionContext) { let resolvedReference = Util.cantorPair( selectionContext.attributeRef, - selectionContext.clusterRef + selectionContext.clusterRef, ) context.commit('setEndpointTypeAttribute', { id: resolvedReference, @@ -563,7 +563,7 @@ export function setAttributeStateLists(context, selectionContext) { selectionContext.forEach((record) => { let resolvedReference = Util.cantorPair( record.attributeRef, - record.clusterRef + record.clusterRef, ) if (record.included) includedAttributes.push(resolvedReference) if (record.singleton) singletonAttributes.push(resolvedReference) @@ -606,7 +606,7 @@ export function setCommandStateLists(context, selectionContext) { selectionContext.forEach((record) => { let resolvedReference = Util.cantorPair( record.commandRef, - record.clusterRef + record.clusterRef, ) if (record.incoming) incoming.push(resolvedReference) if (record.outgoing) outgoing.push(resolvedReference) @@ -681,7 +681,7 @@ export function loadInitialData(context, data) { if ('sessionKeyValues' in initialState) { context.commit( 'initializeSessionKeyValues', - initialState.sessionKeyValues + initialState.sessionKeyValues, ) } }) @@ -716,14 +716,14 @@ export function loadOptions(context, option) { export async function setSelectedGenericKey(context, data) { let response = await axiosRequests.$serverPost( restApi.uri.saveSessionKeyValue, - data + data, ) context.commit('setSelectedGenericOption', response.data) } export async function loadSessionKeyValues(context) { let response = await axiosRequests.$serverGet( - restApi.uri.getAllSessionKeyValues + restApi.uri.getAllSessionKeyValues, ) context.commit('loadSessionKeyValues', response) } @@ -844,7 +844,7 @@ export function loadZclClusterToUcComponentDependencyMap(context) { .then((response) => { context.commit( 'loadZclClusterToUcComponentDependencyMap', - response?.data?.defaults + response?.data?.defaults, ) }) } @@ -887,7 +887,7 @@ export function generateAllEndpointsData(context, endpointData) { res.data.forEach((record) => { let resolvedReference = Util.cantorPair( record.attributeRef, - record.clusterRef + record.clusterRef, ) if (record.included) { attr.push(resolvedReference) diff --git a/src/store/zap/mutations.js b/src/store/zap/mutations.js index bc33acc9ac..0a8efbff11 100644 --- a/src/store/zap/mutations.js +++ b/src/store/zap/mutations.js @@ -96,7 +96,7 @@ export function updateClusters(state, responseData) { if (responseData.clusterData) { state.clusters = responseData.clusterData.filter((c) => - packageRefs.includes(c.packageRef) + packageRefs.includes(c.packageRef), ) state.domains = [...new Set(state.clusters.map((a) => a.domainName))] } @@ -120,14 +120,14 @@ export function updateAttributes(state, attributes) { vue3Set( state.attributeView.defaultValue, attribute.id, - attribute.defaultValue + attribute.defaultValue, ) } if (state.attributeView.reportingMin[attribute.id] === undefined) { vue3Set( state.attributeView.reportingMin, attribute.id, - reportingMinDefault + reportingMinDefault, ) } if (state.attributeView.reportingMax[attribute.id] === undefined) { @@ -171,19 +171,19 @@ export function setEndpointTypeAttribute(state, endpointTypeAttribute) { vue3Set( state.attributeView.defaultValue, attribute.id, - attribute.defaultValue + attribute.defaultValue, ) vue3Set( state.attributeView.storageOption, attribute.id, - attribute.storageOption + attribute.storageOption, ) vue3Set(state.attributeView.reportingMin, attribute.id, attribute.minInterval) vue3Set(state.attributeView.reportingMax, attribute.id, attribute.maxInterval) vue3Set( state.attributeView.reportableChange, attribute.id, - attribute.reportableChange + attribute.reportableChange, ) } @@ -196,7 +196,7 @@ export function initializeDefaultEndpoints(state, defaultEndpoints) { vue3Set( state.endpointView.endpointType, endpoint.id, - endpoint.endpointTypeRef + endpoint.endpointTypeRef, ) } if (state.endpointView.networkId[endpoint.id] === undefined) { @@ -208,7 +208,7 @@ export function initializeDefaultEndpoints(state, defaultEndpoints) { vue3Set( state.endpointView.parentEndpointIdentifier, endpoint.id, - endpoint.parentEndpointIdentifier + endpoint.parentEndpointIdentifier, ) } @@ -223,24 +223,24 @@ export function addEndpoint(state, endpoint) { vue3Set( state.endpointView.endpointType, endpoint.id, - endpoint.endpointTypeRef + endpoint.endpointTypeRef, ) vue3Set(state.endpointView.networkId, endpoint.id, endpoint.networkId) vue3Set( state.endpointView.parentEndpointIdentifier, endpoint.id, - endpoint.parentEndpointIdentifier + endpoint.parentEndpointIdentifier, ) vue3Set(state.endpointView.profileId, endpoint.id, endpoint.profileId) vue3Set( state.endpointView.endpointIdValidationIssues, endpoint.id, - endpoint.endpointIdValidationIssues + endpoint.endpointIdValidationIssues, ) vue3Set( state.endpointView.networkIdValidationIssues, endpoint.id, - endpoint.networkIdValidationIssues + endpoint.networkIdValidationIssues, ) } @@ -248,7 +248,7 @@ export function updateEndpoint(state, context) { vue3Set( state.endpointView.parentEndpointIdentifier, context.id, - context.parentEndpointIdentifier + context.parentEndpointIdentifier, ) context.changes.forEach((data) => { vue3Set(state.endpointView[data.updatedKey], context.id, data.value) @@ -256,12 +256,12 @@ export function updateEndpoint(state, context) { vue3Set( state.endpointView.endpointIdValidationIssues, context.id, - context.endpointIdValidationIssues + context.endpointIdValidationIssues, ) vue3Set( state.endpointView.networkIdValidationIssues, context.id, - context.networkIdValidationIssues + context.networkIdValidationIssues, ) } @@ -274,14 +274,14 @@ export function initializeDefaultEndpointsTypes(state, defaultEndpointsTypes) { vue3Set( state.endpointTypeView.deviceTypeRef, endpointType.id, - endpointType.deviceTypeRef + endpointType.deviceTypeRef, ) } if (state.endpointTypeView.deviceVersion[endpointType.id] === undefined) { vue3Set( state.endpointTypeView.deviceVersion, endpointType.id, - endpointType.deviceVersion + endpointType.deviceVersion, ) } }) @@ -292,17 +292,17 @@ export function addEndpointType(state, endpointType) { vue3Set( state.endpointTypeView.deviceTypeRef, endpointType.id, - endpointType.deviceTypeRef + endpointType.deviceTypeRef, ) vue3Set( state.endpointTypeView.deviceIdentifier, endpointType.id, - endpointType.deviceIdentifier + endpointType.deviceIdentifier, ) vue3Set( state.endpointTypeView.deviceVersion, endpointType.id, - endpointType.deviceVersion + endpointType.deviceVersion, ) } @@ -310,17 +310,17 @@ export function updateAttributeDefaults(state, selectionContext) { vue3Set( state.attributeView[selectionContext.listType], selectionContext.id, - selectionContext.newDefaultValue + selectionContext.newDefaultValue, ) vue3Set( state.attributeView.defaultValueValidationIssues, selectionContext.id, - selectionContext.defaultValueValidationIssues + selectionContext.defaultValueValidationIssues, ) vue3Set( state.attributeView.nullValues, selectionContext.id, - selectionContext.isNull + selectionContext.isNull, ) } @@ -362,19 +362,19 @@ export function setDeviceTypeReference(state, endpointTypeIdDeviceTypeRefPair) { vue3Set( state.endpointTypeView.deviceTypeRef, endpointTypeIdDeviceTypeRefPair.endpointTypeId, - endpointTypeIdDeviceTypeRefPair.deviceTypeRef + endpointTypeIdDeviceTypeRefPair.deviceTypeRef, ) vue3Set( state.endpointTypeView.deviceVersion, endpointTypeIdDeviceTypeRefPair.endpointTypeId, - endpointTypeIdDeviceTypeRefPair.deviceVersion + endpointTypeIdDeviceTypeRefPair.deviceVersion, ) vue3Set( state.endpointTypeView.deviceIdentifier, endpointTypeIdDeviceTypeRefPair.endpointTypeId, - endpointTypeIdDeviceTypeRefPair.deviceIdentifier + endpointTypeIdDeviceTypeRefPair.deviceIdentifier, ) } @@ -413,7 +413,7 @@ export function resetAttributeDefaults(state) { vue3Set( state.attributeView.defaultValue, attribute.id, - attribute.defaultValue + attribute.defaultValue, ) vue3Set(state.attributeView.storageOption, attribute.id, 'ram') vue3Set(state.attributeView.reportingMin, attribute.id, reportingMinDefault) @@ -435,7 +435,7 @@ export function setAttributeLists(state, data) { Object.entries(data.storageOption).forEach( ([attributeRef, storageOption]) => { vue3Set(state.attributeView.storageOption, attributeRef, storageOption) - } + }, ) Object.entries(data.minInterval).forEach(([attributeRef, defaultVal]) => { @@ -448,7 +448,7 @@ export function setAttributeLists(state, data) { Object.entries(data.reportableChange).forEach( ([attributeRef, defaultVal]) => { vue3Set(state.attributeView.reportableChange, attributeRef, defaultVal) - } + }, ) } @@ -506,7 +506,7 @@ export function setOptions(state, data) { .filter((d) => d.optionCategory === data.option) .map((d) => { return { optionCode: d.optionCode, optionLabel: d.optionLabel } - }) + }), ), ]) } @@ -569,7 +569,7 @@ export function doActionFilter(state, filterEnabledClusterPair) { state.clusterManager.openDomains, { enabledClusters: filterEnabledClusterPair.enabledClusters, - } + }, ), }) }) @@ -726,7 +726,7 @@ export function setDirtyState(state, isDirty) { state.isDirty = isDirty window.parent?.postMessage( { eventId: 'dirty', eventData: { isDirty: isDirty } }, - '*' + '*', ) } } diff --git a/src/tutorials/CMPTour.vue b/src/tutorials/CMPTour.vue index 8b32437b32..817438d653 100644 --- a/src/tutorials/CMPTour.vue +++ b/src/tutorials/CMPTour.vue @@ -110,7 +110,7 @@ export default { return new Promise((resolve) => { document .getElementsByClassName( - ' q-icon material-icons q-select__dropdown-icon' + ' q-icon material-icons q-select__dropdown-icon', )[0] .click() this.$store.dispatch('zap/setDomainFilter', { @@ -136,7 +136,7 @@ export default { deviceTypeRef.push(selectedDevice.deviceTypeRef) deviceIdentifier.push(selectedDevice.deviceIdentifier) deviceVersion.push( - selectedDevice.deviceVersion ? selectedDevice.deviceVersion : 1 + selectedDevice.deviceVersion ? selectedDevice.deviceVersion : 1, ) this.$store .dispatch(`zap/addEndpointType`, { @@ -149,7 +149,7 @@ export default { let profileId = this.asHex( this.zclDeviceTypes[this.zclDeviceTypeOptions[0].deviceTypeRef] .profileId, - 4 + 4, ) this.tourEndpointType = response.id @@ -176,13 +176,13 @@ export default { this.$store .dispatch( `zap/endpointTypeClustersInfo`, - this.endpointType[res.id] + this.endpointType[res.id], ) .then((res) => { if (res?.data) { const clusterStates = res.data const enabledClusterStates = clusterStates.filter( - (x) => x.enabled + (x) => x.enabled, ) for (const states of enabledClusterStates) { const { endpointTypeRef, clusterRef, side, enabled } = @@ -195,7 +195,7 @@ export default { } console.log( - `Enabling UC component ${JSON.stringify(arg)}` + `Enabling UC component ${JSON.stringify(arg)}`, ) this.updateSelectedComponentRequest(arg) } @@ -208,7 +208,7 @@ export default { }, filteredZclDeviceTypes(deviceId, index) { const possibleDevices = this.zclDeviceTypeOptions.filter( - (endpoint) => endpoint.deviceIdentifier === deviceId + (endpoint) => endpoint.deviceIdentifier === deviceId, ) const selectedDevice = possibleDevices[index ? index : 0] return selectedDevice diff --git a/src/tutorials/EndpointTour.vue b/src/tutorials/EndpointTour.vue index 59b66a08f4..e98fe11707 100644 --- a/src/tutorials/EndpointTour.vue +++ b/src/tutorials/EndpointTour.vue @@ -103,7 +103,7 @@ export default { deviceVersion.push( this.zclDeviceTypeOptions[0].deviceVersion ? this.zclDeviceTypeOptions[0].deviceVersion - : 1 + : 1, ) // if (this.endpoints.length < 1) { this.$store @@ -117,7 +117,7 @@ export default { let profileId = this.asHex( this.zclDeviceTypes[this.zclDeviceTypeOptions[0].deviceTypeRef] .profileId, - 4 + 4, ) this.tourEndpointType = response.id @@ -144,13 +144,13 @@ export default { this.$store .dispatch( `zap/endpointTypeClustersInfo`, - this.endpointType[res.id] + this.endpointType[res.id], ) .then((res) => { if (res?.data) { const clusterStates = res.data const enabledClusterStates = clusterStates.filter( - (x) => x.enabled + (x) => x.enabled, ) for (const states of enabledClusterStates) { const { endpointTypeRef, clusterRef, side, enabled } = @@ -163,7 +163,7 @@ export default { } console.log( - `Enabling UC component ${JSON.stringify(arg)}` + `Enabling UC component ${JSON.stringify(arg)}`, ) this.updateSelectedComponentRequest(arg) } @@ -185,7 +185,7 @@ export default { await this.$store.dispatch('zap/deleteEndpoint', this.tourEndpointId) await this.$store.dispatch( 'zap/deleteEndpointType', - this.endpointType[this.tourEndpointId] + this.endpointType[this.tourEndpointId], ) this.exitTour() }, @@ -263,7 +263,7 @@ export default { this.$store.commit('zap/triggerExpanded', true) document .getElementsByClassName( - ' q-icon notranslate material-icons q-expansion-item__toggle-icon' + ' q-icon notranslate material-icons q-expansion-item__toggle-icon', )[1] .click() resolve() @@ -273,7 +273,7 @@ export default { return new Promise((resolve) => { document .getElementsByClassName( - ' q-icon material-icons q-select__dropdown-icon' + ' q-icon material-icons q-select__dropdown-icon', )[0] .click() resolve() @@ -304,11 +304,11 @@ export default { .then(() => { this.$store.dispatch( 'zap/refreshEndpointTypeCluster', - this.selectedEndpointTypeId + this.selectedEndpointTypeId, ) this.$store.dispatch( 'zap/setLastSelectedDomain', - this.$store.state.zap.domains[0] + this.$store.state.zap.domains[0], ) }) this.$router.push('/cluster').then(() => { diff --git a/src/util/common-mixin.js b/src/util/common-mixin.js index 41a1906d3b..980eadd23b 100644 --- a/src/util/common-mixin.js +++ b/src/util/common-mixin.js @@ -56,13 +56,13 @@ export default { // NOTE: a Map is returned to maintain the order of the keys. // coversion to an Object will reshuffle the entries. const endpointIds = new Map( - Object.entries(this.$store.state.zap.endpointView.endpointId) + Object.entries(this.$store.state.zap.endpointView.endpointId), ) return new Map( [...endpointIds.entries()].sort((a, b) => { return parseInt(a[1], 16) - parseInt(b[1], 16) - }) + }), ) }, }, @@ -124,8 +124,8 @@ export default { _.isNil( _.find( Object.values(this.endpointId), - (existingEndpointId) => id == existingEndpointId - ) + (existingEndpointId) => id == existingEndpointId, + ), ) ) { return id @@ -174,7 +174,7 @@ export default { let res = this.$store.state.zap.genericOptions?.generator?.filter( (x) => x.optionCode == - DbEnum.generatorOptions.shareClusterStatesAcrossEndpoints + DbEnum.generatorOptions.shareClusterStatesAcrossEndpoints, ) if (res?.length) { @@ -201,7 +201,7 @@ export default { let res = this.$store.state.zap.genericOptions?.generator?.filter( (x) => x.optionCode == - DbEnum.generatorOptions.disableUcComponentOnZclClusterUpdate + DbEnum.generatorOptions.disableUcComponentOnZclClusterUpdate, ) if (res?.length) { @@ -247,23 +247,23 @@ export default { for (const role of roles) { let components = this.ucComponentRequiredByCluster(cluster, role) requiredComponentIdList.push( - ...components.map((c) => this.sdkExtUcComponentId(c)) + ...components.map((c) => this.sdkExtUcComponentId(c)), ) } let selectedUcComponentIds = Util.getClusterIdsByUcComponents( - this.$store.state.zap.studio.selectedUcComponents + this.$store.state.zap.studio.selectedUcComponents, ) return requiredComponentIdList.filter( - (id) => !selectedUcComponentIds.includes(id) + (id) => !selectedUcComponentIds.includes(id), ) }, ucComponentRequiredByCluster(cluster, role) { let clusterRoleName = cluster.label.toLowerCase() + '-' + role return this.$store.state.zap.studio.zclSdkExtClusterToUcComponentMap.filter( - (x) => this.sdkExtClusterCode(x) === clusterRoleName + (x) => this.sdkExtClusterCode(x) === clusterRoleName, ) }, /** @@ -298,8 +298,8 @@ export default { logos.push( this.createLogoSrc( this.$store.state.zap.isMultiConfig, - selectedZapConfig[i].category - ) + selectedZapConfig[i].category, + ), ) } else { logos.push('/logo/zap_logo.png') @@ -322,12 +322,12 @@ export default { if (this.$store.state.zap.isMultiConfig) { zclProperty = this.$store.state.zap.selectedZapConfig.zclProperties.find( - (item) => item.id === packageRef && item.category + (item) => item.id === packageRef && item.category, ) return zclProperty.category } else { zclProperty = this.$store.state.zap.packages.find( - (item) => item.pkg.id === packageRef && item.pkg.category + (item) => item.pkg.id === packageRef && item.pkg.category, ) return zclProperty.pkg?.category } diff --git a/src/util/editable-attributes-mixin.js b/src/util/editable-attributes-mixin.js index 540f5551db..500b02ef3f 100644 --- a/src/util/editable-attributes-mixin.js +++ b/src/util/editable-attributes-mixin.js @@ -114,7 +114,7 @@ export default { localChanges, listType, attributeData, - clusterId + clusterId, ) }, handleLocalSelection(selectedList, listType, attributeData, clusterId) { @@ -124,7 +124,7 @@ export default { selectedList.includes(hash), listType, attributeData, - clusterId + clusterId, ) }, setAttributeSelection(enable, listType, attributeData, clusterId) { @@ -153,14 +153,14 @@ export default { (validationIssueString, currentVal) => { return validationIssueString + '\n' + currentVal }, - '' + '', ) : '' }, initializeBooleanEditableList( originatingList, editableList, - attrClusterHash + attrClusterHash, ) { if (originatingList.includes(attrClusterHash)) { if (!editableList.includes(attrClusterHash)) { @@ -191,7 +191,7 @@ export default { // We determine the ID that we need to toggle within the list. // This ID comes from hashing the base ZCL attribute and cluster data. let indexOfValue = list.indexOf( - this.hashAttributeIdClusterId(attributeData.id, clusterId) + this.hashAttributeIdClusterId(attributeData.id, clusterId), ) let addedValue if (indexOfValue === -1) { @@ -272,8 +272,8 @@ export default { return x.toLowerCase() > y.toLowerCase() ? 1 : x.toLowerCase() < y.toLowerCase() - ? -1 - : callback(ascendingA, ascendingB) + ? -1 + : callback(ascendingA, ascendingB) }, sortByBoolean( x, @@ -281,7 +281,7 @@ export default { ascendingA, ascendingB, singletonList, - callback = (i, j) => 0 + callback = (i, j) => 0, ) { let i = this.hashAttributeIdClusterId(x.id, this.selectedCluster.id) let j = this.hashAttributeIdClusterId(y.id, this.selectedCluster.id) @@ -301,8 +301,8 @@ export default { return x['manufacturerCode'] > y['manufacturerCode'] ? 1 : x['manufacturerCode'] < y['manufacturerCode'] - ? -1 - : 0 + ? -1 + : 0 } }, }, diff --git a/src/util/util.js b/src/util/util.js index 5370269a65..0d21d837ba 100644 --- a/src/util/util.js +++ b/src/util/util.js @@ -49,10 +49,10 @@ export function notifyComponentUpdateStatus(componentIdStates, added) { let updated = false if (componentIdStates.length) { let success = componentIdStates.filter( - (x) => x.status == http.StatusCodes.OK + (x) => x.status == http.StatusCodes.OK, ) let failure = componentIdStates.filter( - (x) => x.status != http.StatusCodes.OK + (x) => x.status != http.StatusCodes.OK, ) if (failure.length) { diff --git a/test/arg.test.js b/test/arg.test.js index 0a75494f28..728dd45b11 100644 --- a/test/arg.test.js +++ b/test/arg.test.js @@ -31,7 +31,7 @@ function y( arg = { a: 1, b: 2, - } + }, ) { return arg.a + arg.b } @@ -60,7 +60,7 @@ test( expect(a.arglessArg).toBeTruthy() expect(a.xmlRoot).toBe('XmlRoot') }, - timeout.short() + timeout.short(), ) test( @@ -73,7 +73,7 @@ test( expect(argv.y).toBe(2) expect(argv.tst).toBe(42) }, - timeout.short() + timeout.short(), ) test( @@ -88,5 +88,5 @@ test( expect(y({ a: 22, b: 34 })).toBe(56) expect(y({ a: 22 })).toBe(NaN) // A missing options key is just missing }, - timeout.short() + timeout.short(), ) diff --git a/test/bin.test.js b/test/bin.test.js index 6d020f258d..e8817a31be 100644 --- a/test/bin.test.js +++ b/test/bin.test.js @@ -33,7 +33,7 @@ test( expect(bin.int32ToHex(xN)).toEqual('1234ABCD') expect(bin.int32ToHex(xN, true)).toEqual('CDAB3412') }, - timeout.short() + timeout.short(), ) test( @@ -43,7 +43,7 @@ test( expect(bin.int16ToHex(xN)).toEqual('ABCD') expect(bin.int16ToHex(xN, true)).toEqual('CDAB') }, - timeout.short() + timeout.short(), ) test( @@ -53,7 +53,7 @@ test( expect(bin.int8ToHex(xN)).toEqual('AB') expect(bin.int8ToHex(xN, true)).toEqual('AB') }, - timeout.short() + timeout.short(), ) test( @@ -61,7 +61,7 @@ test( () => { expect(bin.hexToCBytes('1234abcd')).toEqual('0x12, 0x34, 0xAB, 0xCD') }, - timeout.short() + timeout.short(), ) test( @@ -71,12 +71,12 @@ test( let xS = bin.stringToHex(xN) expect(xS).toEqual('616263644142434400') expect(bin.hexToCBytes(xS)).toEqual( - '0x61, 0x62, 0x63, 0x64, 0x41, 0x42, 0x43, 0x44, 0x00' + '0x61, 0x62, 0x63, 0x64, 0x41, 0x42, 0x43, 0x44, 0x00', ) expect(bin.stringToHex('')).toEqual('00') expect(bin.hexToCBytes('00')).toEqual('0x00') }, - timeout.short() + timeout.short(), ) test( @@ -92,7 +92,7 @@ test( expect(bin.hexToBinary('ABCD')).toBe('1010101111001101') expect(bin.hexToBinary('AB CD')).toBe('1010101111001101') }, - timeout.short() + timeout.short(), ) test( @@ -103,7 +103,7 @@ test( expect(bin.bitOffset(bin.hexToBinary(bin.int8ToHex(2)))).toBe(1) expect(bin.bitOffset(bin.hexToBinary(bin.int8ToHex(4)))).toBe(2) }, - timeout.short() + timeout.short(), ) test( @@ -113,24 +113,24 @@ test( r = bin.stringToOneByteLengthPrefixCBytes('Test string') expect(r.content).toBe( - "11, 'T', 'e', 's', 't', ' ', 's', 't', 'r', 'i', 'n', 'g', " + "11, 'T', 'e', 's', 't', ' ', 's', 't', 'r', 'i', 'n', 'g', ", ) r = bin.stringToTwoByteLengthPrefixCBytes('Test string') expect(r.content).toContain( - "11, 0, 'T', 'e', 's', 't', ' ', 's', 't', 'r', 'i', 'n', 'g'," + "11, 0, 'T', 'e', 's', 't', ' ', 's', 't', 'r', 'i', 'n', 'g',", ) expect(r.length).toBe(13) r = bin.stringToTwoByteLengthPrefixCBytes('x'.repeat(300), 400, false) expect(r.content).toContain( - "44, 1, 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x'," + "44, 1, 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x',", ) expect(r.length).toBe(302) r = bin.stringToOneByteLengthPrefixCBytes('Test', 10, true) expect(r.content).toBe( - "4, 'T', 'e', 's', 't', 0x00, 0x00, 0x00, 0x00, 0x00, " + "4, 'T', 'e', 's', 't', 0x00, 0x00, 0x00, 0x00, 0x00, ", ) expect(r.length).toBe(10) @@ -138,7 +138,7 @@ test( expect(r.content).toBe("4, 'T', 'e', 's', 't', ") expect(r.length).toBe(5) }, - timeout.short() + timeout.short(), ) test( @@ -151,5 +151,5 @@ test( expect(bin.bitCount(0x4210)).toBe(3) expect(bin.bitCount(0xf0f0)).toBe(8) }, - timeout.short() + timeout.short(), ) diff --git a/test/conversion.test.js b/test/conversion.test.js index 60443b5dd5..60bd077d02 100644 --- a/test/conversion.test.js +++ b/test/conversion.test.js @@ -33,7 +33,7 @@ let db let haLightIsc = path.join(__dirname, 'resource/isc/ha-light.isc') let haCombinedIsc = path.join( __dirname, - 'resource/isc/ha-combined-interface.isc' + 'resource/isc/ha-combined-interface.isc', ) beforeAll(async () => { @@ -42,7 +42,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) await zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) await zclLoader.loadZcl(db, env.builtinDotdotZclMetafile()) @@ -61,7 +61,7 @@ test.skip( let pkgs = await queryPackage.getSessionPackagesByType( db, sid, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) expect(pkgs.length).toBe(1) expect(pkgs[0].description).toBe('ZigbeePro test data') @@ -81,32 +81,35 @@ test.skip( expect(attributeCounts).toStrictEqual([26, 11]) let reportableCounts = dump.endpointTypes.map((ept) => - ept.attributes.reduce((ac, at) => ac + (at.includedReportable ? 1 : 0), 0) + ept.attributes.reduce( + (ac, at) => ac + (at.includedReportable ? 1 : 0), + 0, + ), ) expect(reportableCounts).toStrictEqual([2, 0]) let boundedCounts = dump.endpointTypes.map((ept) => - ept.attributes.reduce((ac, at) => ac + (at.isBound ? 1 : 0), 0) + ept.attributes.reduce((ac, at) => ac + (at.isBound ? 1 : 0), 0), ) expect(boundedCounts).toStrictEqual([11, 2]) let singletonCounts = dump.endpointTypes.map((ept) => - ept.attributes.reduce((ac, at) => ac + (at.isSingleton ? 1 : 0), 0) + ept.attributes.reduce((ac, at) => ac + (at.isSingleton ? 1 : 0), 0), ) expect(singletonCounts).toStrictEqual([7, 11]) let serverAttributesCount = dump.attributes.reduce( (ac, at) => (ac += at.side == dbEnum.side.server ? 1 : 0), - 0 + 0, ) expect(serverAttributesCount).toBe(35) let clientAttributesCount = dump.attributes.reduce( (ac, at) => (ac += at.side == dbEnum.side.client ? 1 : 0), - 0 + 0, ) expect(clientAttributesCount).toBe(2) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -120,7 +123,7 @@ test( zcl: env.builtinSilabsZclMetafile(), template: env.builtinTemplateMetafile(), }, - null + null, ) await importJs.importDataFromFile(db, haCombinedIsc, { sessionId: sid }) expect(sid).not.toBeUndefined() @@ -128,7 +131,7 @@ test( let pkgs = await queryPackage.getSessionPackagesByType( db, sid, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) expect(pkgs.length).toBe(1) expect(pkgs[0].description).toBe('ZigbeePro test data') @@ -139,5 +142,5 @@ test( expect(dump.endpointTypes.length).toBe(1) expect(dump.endpoints.length).toBe(1) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/custom-cluster.test.js b/test/custom-cluster.test.js index ef5247fa53..c564f95ba0 100644 --- a/test/custom-cluster.test.js +++ b/test/custom-cluster.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) await zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) sid = await testQuery.createSession( @@ -48,7 +48,7 @@ beforeAll(async () => { 'USER', 'SESSION', env.builtinSilabsZclMetafile(), - env.builtinTemplateMetafile() + env.builtinTemplateMetafile(), ) }, testUtil.timeout.medium()) @@ -60,25 +60,25 @@ test( x = await dbApi.dbAll( db, 'SELECT * FROM CLUSTER WHERE MANUFACTURER_CODE = ?', - [mfgCode] + [mfgCode], ) expect(x.length).toEqual(0) x = await dbApi.dbAll( db, 'SELECT * FROM ATTRIBUTE WHERE MANUFACTURER_CODE = ?', - [mfgCode] + [mfgCode], ) expect(x.length).toEqual(0) x = await dbApi.dbAll( db, 'SELECT * FROM COMMAND WHERE MANUFACTURER_CODE = ?', - [mfgCode] + [mfgCode], ) expect(x.length).toEqual(0) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -87,7 +87,7 @@ test( let result = await zclLoader.loadIndividualFile( db, testUtil.customClusterXml, - sid + sid, ) expect(result.succeeded).toBeTruthy() expect(result.packageId).not.toBeNull() @@ -98,16 +98,16 @@ test( await querySession.selectSessionPartitionInfoFromPackageId( db, sid, - result.packageId + result.packageId, ) await queryPackage.insertSessionPackage( db, sessionPartitionInfo[0].sessionPartitionId, result.packageId, - false + false, ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -116,21 +116,21 @@ test( x = await dbApi.dbAll( db, 'SELECT * FROM CLUSTER WHERE MANUFACTURER_CODE = ?', - [mfgCode] + [mfgCode], ) expect(x.length).toEqual(1) x = await dbApi.dbAll( db, 'SELECT * FROM ATTRIBUTE WHERE MANUFACTURER_CODE = ?', - [mfgCode] + [mfgCode], ) expect(x.length).toEqual(2) x = await dbApi.dbAll( db, 'SELECT * FROM COMMAND WHERE MANUFACTURER_CODE = ?', - [mfgCode] + [mfgCode], ) expect(x.length).toEqual(1) @@ -138,7 +138,7 @@ test( expect(x.length).toEqual(2) expect( - x[0].packageRef == customPackageId || x[1].packageRef == customPackageId + x[0].packageRef == customPackageId || x[1].packageRef == customPackageId, ).toBeTruthy() if (x[0].packageRef == customPackageId) mainPackageId = x[1].packageRef @@ -148,14 +148,14 @@ test( db, mainPackageId, 0x0000, - 'ZLL-onofflight' + 'ZLL-onofflight', ) expect(onOffDevice).not.toBeNull() let sessionPartitionInfo = await querySession.selectSessionPartitionInfoFromDeviceType( db, sid, - onOffDevice.id + onOffDevice.id, ) let eptId = await queryConfig.insertEndpointType( db, @@ -164,9 +164,9 @@ test( onOffDevice.id, onOffDevice.code, 0, - true + true, ) expect(eptId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) diff --git a/test/custom-matter-xml.test.js b/test/custom-matter-xml.test.js index 5140158471..67204a224a 100644 --- a/test/custom-matter-xml.test.js +++ b/test/custom-matter-xml.test.js @@ -51,7 +51,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) ctx = await zclLoader.loadZcl(db, env.builtinMatterZclMetafile()) mainPackageId = ctx.packageId @@ -60,12 +60,12 @@ beforeAll(async () => { db, 'USER', uuid, - env.builtinMatterZclMetafile() + env.builtinMatterZclMetafile(), ) // loading templates templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.matter + testUtil.testTemplate.matter, ) }, testUtil.timeout.medium()) @@ -95,21 +95,21 @@ test( x = await dbApi.dbAll( db, 'SELECT * FROM ATTRIBUTE WHERE CLUSTER_REF = ?', - extendedClusterId + extendedClusterId, ) numAttributes = x.length x = await dbApi.dbAll( db, 'SELECT * FROM COMMAND WHERE CLUSTER_REF = ?', - extendedClusterId + extendedClusterId, ) numCommands = x.length let result = await zclLoader.loadIndividualFile( db, testUtil.testMattterCustomXml, - sid + sid, ) if (!result.succeeded) { console.log(`Test failure: ${result.err}`) @@ -128,7 +128,7 @@ test( x = await dbApi.dbAll( db, 'SELECT * FROM ATTRIBUTE WHERE CLUSTER_REF = ?', - clusterId + clusterId, ) expect(x.length).toEqual(1) attrId = x[0].ATTRIBUTE_ID @@ -136,25 +136,25 @@ test( x = await dbApi.dbAll( db, 'SELECT * FROM COMMAND WHERE CLUSTER_REF = ?', - clusterId + clusterId, ) expect(x.length).toEqual(3) x = await dbApi.dbAll( db, 'SELECT * FROM ATTRIBUTE WHERE CLUSTER_REF = ?', - extendedClusterId + extendedClusterId, ) expect(x.length).toEqual(numAttributes + 2) x = await dbApi.dbAll( db, 'SELECT * FROM COMMAND WHERE CLUSTER_REF = ?', - extendedClusterId + extendedClusterId, ) expect(x.length).toEqual(numCommands + 2) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -164,7 +164,7 @@ test( let result = await zclLoader.loadIndividualFile( db, testUtil.testMattterCustomXml2, - sid + sid, ) if (!result.succeeded) { console.log(`Test failure: ${result.err}`) @@ -176,18 +176,18 @@ test( x = await dbApi.dbAll( db, 'SELECT * FROM ATTRIBUTE WHERE CLUSTER_REF = ?', - extendedClusterId + extendedClusterId, ) expect(x.length).toEqual(numAttributes + 4) x = await dbApi.dbAll( db, 'SELECT * FROM COMMAND WHERE CLUSTER_REF = ?', - extendedClusterId + extendedClusterId, ) expect(x.length).toEqual(numCommands + 4) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -199,7 +199,7 @@ test( let result = await zclLoader.loadIndividualFile( db, testUtil.testMattterCustomXml, - sid + sid, ) //validate that the package is not duplicated @@ -207,7 +207,7 @@ test( sessionPackages = await queryPackage.getSessionPackages(db, sid) expect(sessionPackages.length).toEqual(sessionPackagesCount) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -217,14 +217,14 @@ test( let onOffDevice = await queryDeviceType.selectDeviceTypeByCode( db, mainPackageId, - 0x0102 + 0x0102, ) expect(onOffDevice).not.toBeNull() let sessionPartitionInfo = await querySession.selectSessionPartitionInfoFromDeviceType( db, sid, - onOffDevice.id + onOffDevice.id, ) let eptTypeId = await queryConfig.insertEndpointType( db, @@ -233,7 +233,7 @@ test( onOffDevice.id, onOffDevice.code, 0, - true + true, ) expect(eptTypeId).not.toBeNull() @@ -242,7 +242,7 @@ test( eptTypeId, clusterId, 'server', - 1 + 1, ) expect(eptTypeClusterId).not.toBeNull() @@ -260,7 +260,7 @@ test( ], null, null, - null + null, ) expect(eptAttrId).not.toBeNull() @@ -270,7 +270,7 @@ test( 1, eptTypeId, 0, - 0x0102 + 0x0102, ) expect(eptId).not.toBeNull() @@ -280,43 +280,43 @@ test( sid, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) let sdkExt = genResult.content['sdk-ext.txt'] expect(sdkExt).not.toBeNull() expect(sdkExt).toContain( - "// cluster: 0xFFF1FC20 Sample Custom Cluster, text extension: ''" + "// cluster: 0xFFF1FC20 Sample Custom Cluster, text extension: ''", ) expect(sdkExt).toContain( - "// attribute: 0x0006 / 0xFFF10000 => Sample Mfg Specific Attribute 2, extensions: '', '', scene: false" + "// attribute: 0x0006 / 0xFFF10000 => Sample Mfg Specific Attribute 2, extensions: '', '', scene: false", ) expect(sdkExt).toContain( - "// attribute: 0x0006 / 0xFFF10001 => Sample Mfg Specific Attribute 4, extensions: '', '', scene: false" + "// attribute: 0x0006 / 0xFFF10001 => Sample Mfg Specific Attribute 4, extensions: '', '', scene: false", ) expect(sdkExt).toContain( - "// attribute: 0x0006 / 0xFFF20000 => Sample Mfg Specific Attribute 6, extensions: '', '', scene: false" + "// attribute: 0x0006 / 0xFFF20000 => Sample Mfg Specific Attribute 6, extensions: '', '', scene: false", ) expect(sdkExt).toContain( - "// attribute: 0x0006 / 0xFFF20001 => Sample Mfg Specific Attribute 8, extensions: '', '', scene: false" + "// attribute: 0x0006 / 0xFFF20001 => Sample Mfg Specific Attribute 8, extensions: '', '', scene: false", ) expect(sdkExt).toContain( - "// command: 0x0006 / 0xFFF100 => SampleMfgSpecificOnWithTransition2, test extension: ''" + "// command: 0x0006 / 0xFFF100 => SampleMfgSpecificOnWithTransition2, test extension: ''", ) expect(sdkExt).toContain( - "// command: 0x0006 / 0xFFF101 => SampleMfgSpecificToggleWithTransition2, test extension: ''" + "// command: 0x0006 / 0xFFF101 => SampleMfgSpecificToggleWithTransition2, test extension: ''", ) expect(sdkExt).toContain( - "// command: 0x0006 / 0xFFF200 => SampleMfgSpecificOnWithTransition2, test extension: ''" + "// command: 0x0006 / 0xFFF200 => SampleMfgSpecificOnWithTransition2, test extension: ''", ) expect(sdkExt).toContain( - "/ command: 0x0006 / 0xFFF201 => SampleMfgSpecificToggleWithTransition2, test extension: ''" + "/ command: 0x0006 / 0xFFF201 => SampleMfgSpecificToggleWithTransition2, test extension: ''", ) let endpointConfig = genResult.content['endpoint-config.c'] expect(sdkExt).not.toBeNull() expect(endpointConfig).toContain( - ' /* Endpoint: 1, Cluster: Sample Custom Cluster (server) */ \\' + ' /* Endpoint: 1, Cluster: Sample Custom Cluster (server) */ \\', ) // delete custom xml and generate again @@ -324,12 +324,12 @@ test( await querySession.selectSessionPartitionInfoFromPackageId( db, sid, - testPackageId + testPackageId, ) await queryPackage.deleteSessionPackage( db, sessionPartitionInfo[0].sessionPartitionId, - testPackageId + testPackageId, ) // verify first custom xml is deleted @@ -338,19 +338,19 @@ test( sid, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) sdkExt = genResult.content['sdk-ext.txt'] expect(sdkExt).not.toBeNull() expect(sdkExt).not.toContain( - "// cluster: 0xFFF1FC20 Sample Custom Cluster, text extension: ''" + "// cluster: 0xFFF1FC20 Sample Custom Cluster, text extension: ''", ) expect(sdkExt).not.toContain( - "// attribute: 0x0006 / 0xFFF10000 => Sample Mfg Specific Attribute 2, extensions: '', '', scene: false" + "// attribute: 0x0006 / 0xFFF10000 => Sample Mfg Specific Attribute 2, extensions: '', '', scene: false", ) expect(sdkExt).not.toContain( - "// attribute: 0x0006 / 0xFFF10001 => Sample Mfg Specific Attribute 4, extensions: '', '', scene: false" + "// attribute: 0x0006 / 0xFFF10001 => Sample Mfg Specific Attribute 4, extensions: '', '', scene: false", ) endpointConfig = genResult.content['endpoint-config.c'] @@ -366,14 +366,14 @@ test( try { const modifiedData = originalData.replace( 'Sample Custom Cluster', - 'Sample Custom Changed' + 'Sample Custom Changed', ) fs.writeFileSync(testUtil.testMattterCustomXml, modifiedData, 'utf8') const result = await zclLoader.loadIndividualFile( db, testUtil.testMattterCustomXml, - sid + sid, ) expect(result.succeeded).toBeTruthy() @@ -383,7 +383,7 @@ test( sid, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) // verify custom xml is updated @@ -394,7 +394,7 @@ test( expect(endpointConfig).not.toBeNull() expect(sdkExt).toContain( - "// cluster: 0xFFF1FC20 Sample Custom Changed, text extension: ''" + "// cluster: 0xFFF1FC20 Sample Custom Changed, text extension: ''", ) // Not working as expected possibly due to bug - https://github.com/project-chip/zap/issues/1387 @@ -427,7 +427,7 @@ test( fs.writeFileSync(testUtil.testMattterCustomXml, originalData, 'utf8') } }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -437,20 +437,22 @@ test( let result = await zclLoader.loadIndividualFile( db, testUtil.testBadMattterCustomXml, - sid + sid, ) expect(result.succeeded).toBeTruthy() let packageNotif = await queryPackageNotification.getNotificationByPackageId( db, - result.packageId + result.packageId, ) expect( - packageNotif.some((notif) => notif.message.includes('type contradiction')) + packageNotif.some((notif) => + notif.message.includes('type contradiction'), + ), ).toBeTruthy() // checks if the correct warning is thrown }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -462,27 +464,27 @@ test( db, 'USER', uuid, - env.builtinMatterZclMetafile() + env.builtinMatterZclMetafile(), ) let result = await zclLoader.loadIndividualFile( db, testUtil.testMattterCustomXml, - conflictSid + conflictSid, ) expect(result.succeeded).toBeTruthy() result = await zclLoader.loadIndividualFile( db, testUtil.testMatterConflict, - conflictSid + conflictSid, ) expect(result.succeeded).toBeTruthy() let conflictPackageId = result.packageId let sessionNotif = await querySessionNotification.getNotification( db, - conflictSid + conflictSid, ) expect( sessionNotif.some( @@ -490,8 +492,8 @@ test( notif.type === 'ERROR' && notif.message.includes('Cluster code conflict') && notif.message.includes('matter-custom.xml') && - notif.message.includes('matter-conflict.xml') - ) + notif.message.includes('matter-conflict.xml'), + ), ).toBeTruthy() expect( sessionNotif.some( @@ -499,8 +501,8 @@ test( notif.type === 'ERROR' && notif.message.includes('Command code conflict') && notif.message.includes('matter-custom.xml') && - notif.message.includes('matter-conflict.xml') - ) + notif.message.includes('matter-conflict.xml'), + ), ).toBeTruthy() expect( sessionNotif.some( @@ -508,8 +510,8 @@ test( notif.type === 'ERROR' && notif.message.includes('Attribute code conflict') && notif.message.includes('matter-custom.xml') && - notif.message.includes('matter-conflict.xml') - ) + notif.message.includes('matter-conflict.xml'), + ), ).toBeTruthy() // delete the conflicting package and verify that the notifications are removed @@ -517,21 +519,21 @@ test( await querySession.selectSessionPartitionInfoFromPackageId( db, conflictSid, - conflictPackageId + conflictPackageId, ) await queryPackage.deleteSessionPackage( db, sessionPartitionInfo[0].sessionPartitionId, - conflictPackageId + conflictPackageId, ) sessionNotif = await querySessionNotification.getNotification( db, - conflictSid + conflictSid, ) expect(sessionNotif.length).toEqual(0) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -542,7 +544,7 @@ test( db, 'USER', 'SESSION3', - env.builtinMatterZclMetafile() + env.builtinMatterZclMetafile(), ) // importing a zap file with custom xml that does not exist @@ -551,7 +553,7 @@ test( testUtil.testMatterMissingCustomZap, { sessionId: newSid, - } + }, ) let allNotif = await querySessionNotification.getNotification(db, newSid) @@ -561,11 +563,11 @@ test( expect( allNotif.some((notif) => - notif.message.includes('Error reading xml file:') - ) + notif.message.includes('Error reading xml file:'), + ), ).toBeTruthy() }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -576,7 +578,7 @@ test( await dbApi.loadSchema(newDb, env.schemaFile(), env.zapVersion()) let newTemplateContext = await genEngine.loadTemplates( newDb, - testUtil.testTemplate.matter + testUtil.testTemplate.matter, ) // creating a new session @@ -588,7 +590,7 @@ test( testUtil.testMatterCustomZap, { sessionId: newSid, - } + }, ) // generating @@ -597,33 +599,33 @@ test( newSid, newTemplateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) // verifying generated content let sdkExt = genResult.content['sdk-ext.txt'] expect(sdkExt).not.toBeNull() expect(sdkExt).toContain( - "// cluster: 0xFFF1FC20 Sample Custom Cluster, text extension: ''" + "// cluster: 0xFFF1FC20 Sample Custom Cluster, text extension: ''", ) expect(sdkExt).toContain( - "// attribute: 0x0006 / 0xFFF10000 => Sample Mfg Specific Attribute 2, extensions: '', '', scene: false" + "// attribute: 0x0006 / 0xFFF10000 => Sample Mfg Specific Attribute 2, extensions: '', '', scene: false", ) expect(sdkExt).toContain( - "// attribute: 0x0006 / 0xFFF10001 => Sample Mfg Specific Attribute 4, extensions: '', '', scene: false" + "// attribute: 0x0006 / 0xFFF10001 => Sample Mfg Specific Attribute 4, extensions: '', '', scene: false", ) expect(sdkExt).toContain( - "// command: 0x0006 / 0xFFF100 => SampleMfgSpecificOnWithTransition2, test extension: ''" + "// command: 0x0006 / 0xFFF100 => SampleMfgSpecificOnWithTransition2, test extension: ''", ) expect(sdkExt).toContain( - "// command: 0x0006 / 0xFFF101 => SampleMfgSpecificToggleWithTransition2, test extension: ''" + "// command: 0x0006 / 0xFFF101 => SampleMfgSpecificToggleWithTransition2, test extension: ''", ) let endpointConfig = genResult.content['endpoint-config.c'] expect(sdkExt).not.toBeNull() expect(endpointConfig).toContain( - ' /* Endpoint: 1, Cluster: Sample Custom Cluster (server) */ \\' + ' /* Endpoint: 1, Cluster: Sample Custom Cluster (server) */ \\', ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) diff --git a/test/custom-zcl.test.js b/test/custom-zcl.test.js index 363edccfb9..350d303f80 100644 --- a/test/custom-zcl.test.js +++ b/test/custom-zcl.test.js @@ -34,7 +34,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) await zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) sid = await testQuery.createSession( @@ -42,7 +42,7 @@ beforeAll(async () => { 'USER', 'SESSION', env.builtinSilabsZclMetafile(), - env.builtinTemplateMetafile() + env.builtinTemplateMetafile(), ) }, testUtil.timeout.medium()) @@ -55,27 +55,27 @@ test( x = await dbApi.dbAll( db, 'SELECT * FROM CLUSTER WHERE MANUFACTURER_CODE = ?', - [testClusterCode] + [testClusterCode], ) expect(x.length).toEqual(0) x = await dbApi.dbAll( db, 'SELECT * FROM ATTRIBUTE WHERE MANUFACTURER_CODE = ?', - [testClusterCode] + [testClusterCode], ) expect(x.length).toEqual(0) x = await dbApi.dbAll( db, 'SELECT * FROM COMMAND WHERE MANUFACTURER_CODE = ?', - [testClusterCode] + [testClusterCode], ) expect(x.length).toEqual(0) let result = await zclLoader.loadIndividualFile( db, testUtil.testCustomXml, - sid + sid, ) if (!result.succeeded) { console.log(`Test failure: ${result.err}`) @@ -85,23 +85,23 @@ test( x = await dbApi.dbAll( db, 'SELECT * FROM CLUSTER WHERE MANUFACTURER_CODE = ?', - [testClusterCode] + [testClusterCode], ) expect(x.length).toEqual(1) x = await dbApi.dbAll( db, 'SELECT * FROM ATTRIBUTE WHERE MANUFACTURER_CODE = ?', - [testClusterCode] + [testClusterCode], ) expect(x.length).toEqual(4) x = await dbApi.dbAll( db, 'SELECT * FROM COMMAND WHERE MANUFACTURER_CODE = ?', - [testClusterCode] + [testClusterCode], ) expect(x.length).toEqual(3) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) diff --git a/test/download-artifact.test.js b/test/download-artifact.test.js index c057ce7b8a..f361832e56 100644 --- a/test/download-artifact.test.js +++ b/test/download-artifact.test.js @@ -22,7 +22,7 @@ const { exec, execSync, execFile } = require('child_process') const path = require('node:path') const download_artifact_script = path.join( __dirname, - '../src-script/download-artifact.js' + '../src-script/download-artifact.js', ) beforeAll(() => { @@ -46,7 +46,7 @@ test('Downloading from Github', async () => { test('Default back to master branch if unknown branch is specified', async () => { let output = execSync( - `${download_artifact_script} -b random_unknown_branch_name` + `${download_artifact_script} -b random_unknown_branch_name`, ) console.log(output.toString()) expect(output.toString()).toMatch(/.Defaulting to master branch instead.*/) @@ -56,6 +56,6 @@ test('Download from Github if specified branch is available on Github but not Ne let output = execSync(`${download_artifact_script} -b unit_test_branch`) console.log(output.toString()) expect(output.toString()).toMatch( - /.*Defaulting to master branch on Github instead.*/ + /.*Defaulting to master branch on Github instead.*/, ) }) diff --git a/test/endpoint-config.test.js b/test/endpoint-config.test.js index 2bc79f9146..54e311eb37 100644 --- a/test/endpoint-config.test.js +++ b/test/endpoint-config.test.js @@ -44,7 +44,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) @@ -55,7 +55,7 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) expect(templateContext.crc).not.toBeNull() expect(templateContext.templateData).not.toBeNull() @@ -64,7 +64,7 @@ test( expect(templateContext.templateData.templates.length).toEqual(templateCount) expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -72,7 +72,7 @@ test( async () => { zclContext = await zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -85,15 +85,15 @@ test( await querySession.selectSessionPartitionInfoFromPackageId( db, sessionId, - zclContext.packageId + zclContext.packageId, ) await queryPackage.insertSessionPackage( db, sessionPartitionInfo[0].sessionPartitionId, - zclContext.packageId + zclContext.packageId, ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -121,15 +121,15 @@ test( db, cluster.clusterId, cluster.side, - cluster.endpointTypeId - ) + cluster.endpointTypeId, + ), ) promiseCommands.push( queryEndpoint.selectEndpointClusterCommands( db, cluster.clusterId, - cluster.endpointTypeId - ) + cluster.endpointTypeId, + ), ) }) }) @@ -165,7 +165,7 @@ test( }) expect(cmdSums[0]).toBe(16) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -174,7 +174,7 @@ test( let size = await types.typeSize(db, zclContext.packageId, 'bitmap8') expect(size).toBe(1) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -185,7 +185,7 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult).not.toBeNull() @@ -199,26 +199,26 @@ test( let epc = genResult.content['zap-config.h'] let epcLines = epc.split(/\r?\n/) expect(epc).toContain( - '#define FIXED_ENDPOINT_ARRAY { 0x0029, 0x002A, 0x002B }' + '#define FIXED_ENDPOINT_ARRAY { 0x0029, 0x002A, 0x002B }', ) expect(epc).toContain( - "17, 'V', 'e', 'r', 'y', ' ', 'l', 'o', 'n', 'g', ' ', 'u', 's', 'e', 'r', ' ', 'i', 'd'," + "17, 'V', 'e', 'r', 'y', ' ', 'l', 'o', 'n', 'g', ' ', 'u', 's', 'e', 'r', ' ', 'i', 'd',", ) expect(epc).toContain( - '{ ZAP_REPORT_DIRECTION(REPORTED), 0x0029, 0x00000101, 0x00000000, ZAP_CLUSTER_MASK(SERVER), 0x0000, {{ 0, 65534, 0 }} }, /* lock state */' + '{ ZAP_REPORT_DIRECTION(REPORTED), 0x0029, 0x00000101, 0x00000000, ZAP_CLUSTER_MASK(SERVER), 0x0000, {{ 0, 65534, 0 }} }, /* lock state */', ) expect(epc).toContain( - '{ 0x00000004, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(TOKENIZE), ZAP_LONG_DEFAULTS_INDEX(0) }' + '{ 0x00000004, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(TOKENIZE), ZAP_LONG_DEFAULTS_INDEX(0) }', ) expect(epc.includes(bin.hexToCBytes(bin.stringToHex('Very long user id')))) expect(epc).toContain('#define FIXED_NETWORKS { 1, 1, 2 }') expect(epc).toContain( - '#define FIXED_PROFILE_IDS { 0x0107, 0x0104, 0x0104 }' + '#define FIXED_PROFILE_IDS { 0x0107, 0x0104, 0x0104 }', ) expect(epc).toContain('#define FIXED_ENDPOINT_TYPES { 0, 1, 2 }') expect(epc).toContain('#define GENERATED_DEFAULTS_COUNT (12)') expect(epc).toContain( - `17, 'T', 'e', 's', 't', ' ', 'm', 'a', 'n', 'u', 'f', 'a', 'c', 't', 'u', 'r', 'e', 'r',` + `17, 'T', 'e', 's', 't', ' ', 'm', 'a', 'n', 'u', 'f', 'a', 'c', 't', 'u', 'r', 'e', 'r',`, ) expect(epcLines.length).toBeGreaterThan(100) let cnt = 0 @@ -232,5 +232,5 @@ test( expect(epc).toContain('#define EMBER_AF_MANUFACTURER_CODE 0x1002') expect(epc).toContain('#define EMBER_AF_DEFAULT_RESPONSE_POLICY_ALWAYS') }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/env.test.js b/test/env.test.js index 1152879a44..817748fe84 100644 --- a/test/env.test.js +++ b/test/env.test.js @@ -46,13 +46,13 @@ describe( () => { let f = util.createAbsolutePath( 'file', - dbEnum.pathRelativity.relativeToUserHome + dbEnum.pathRelativity.relativeToUserHome, ) expect(path.resolve(f)).toBe( - path.resolve(path.join(os.homedir(), 'file')) + path.resolve(path.join(os.homedir(), 'file')), ) }, - timeout.short() + timeout.short(), ) test( @@ -64,7 +64,7 @@ describe( expect(x.match).toBeFalsy() expect(x.message).not.toBeNull() }, - timeout.short() + timeout.short(), ) test( @@ -76,18 +76,18 @@ describe( util.createBackupFile(filePath) expect(fs.existsSync(backupPath)).toBeTruthy() expect( - fs.readFileSync(backupPath, { encoding: 'utf8', flag: 'r' }) + fs.readFileSync(backupPath, { encoding: 'utf8', flag: 'r' }), ).toEqual('foo') fs.writeFileSync(filePath, 'bar') util.createBackupFile(filePath) expect( - fs.readFileSync(backupPath, { encoding: 'utf8', flag: 'r' }) + fs.readFileSync(backupPath, { encoding: 'utf8', flag: 'r' }), ).toEqual('bar') resolve() }) }) }, - timeout.short() + timeout.short(), ) test( @@ -95,19 +95,19 @@ describe( () => { let testCookie = { 'connect.sid': 's%3Atest.abra' } expect(browserApi.getUserKeyFromBrowserCookie(testCookie)).toEqual( - 'test' + 'test', ) expect(browserApi.getUserKeyFromBrowserCookie({})).toBeNull() testCookie['connect.sid'] = 'tester.abra' expect(browserApi.getUserKeyFromBrowserCookie(testCookie)).toEqual( - 'tester' + 'tester', ) testCookie['connect.sid'] = 's%3Aabra' expect(browserApi.getUserKeyFromBrowserCookie(testCookie)).toEqual( - 'abra' + 'abra', ) }, - timeout.short() + timeout.short(), ) let array = [] @@ -117,17 +117,20 @@ describe( let args = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] let fn = (arg) => { return new Promise((resolve, reject) => { - setTimeout(() => { - array.push(arg) - resolve() - }, 50 - 3 * arg) + setTimeout( + () => { + array.push(arg) + resolve() + }, + 50 - 3 * arg, + ) }) } return util.executePromisesSequentially(args, fn).then(() => { expect(array).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) }) }, - timeout.short() + timeout.short(), ) test('Type conversion', () => { @@ -149,7 +152,7 @@ describe( expect(x == false).toBeTruthy() // ... unlike comparing to false, which is truthy. }) }, - timeout.short() + timeout.short(), ) describe('Environment Tests', () => { @@ -160,7 +163,7 @@ describe('Environment Tests', () => { expect(env.sqliteFile().length).toBeGreaterThan(10) expect(env.iconsDirectory().length).toBeGreaterThan(10) }, - timeout.short() + timeout.short(), ) test( @@ -174,7 +177,7 @@ describe('Environment Tests', () => { env.logIpc('Ipc level test.') env.logIpc('Error logging test', new Error('Simple test')) }, - timeout.short() + timeout.short(), ) test( @@ -182,7 +185,7 @@ describe('Environment Tests', () => { () => { expect(env.versionsCheck()).toBeTruthy() }, - timeout.short() + timeout.short(), ) test( @@ -190,7 +193,7 @@ describe('Environment Tests', () => { () => { expect(env.zapVersion().featureLevel).toBeGreaterThan(0) }, - timeout.short() + timeout.short(), ) test( @@ -202,7 +205,7 @@ describe('Environment Tests', () => { expect('timestamp' in v).toBeTruthy() expect('date' in v).toBeTruthy() }, - timeout.short() + timeout.short(), ) test( @@ -214,7 +217,7 @@ describe('Environment Tests', () => { expect(uuid2).not.toBeNull() expect(uuid1).not.toEqual(uuid2) }, - timeout.short() + timeout.short(), ) test('Stack traces', () => { @@ -223,7 +226,7 @@ describe('Environment Tests', () => { } catch (e) { // Test that the stack trace is coming from // line of 218 in this file. - expect(e.stack.includes('env.test.js:222')).toBeTruthy() + expect(e.stack.includes('env.test.js:225')).toBeTruthy() } }) }) diff --git a/test/fileformat.test.js b/test/fileformat.test.js index 8cc2aebad6..db4e23726a 100644 --- a/test/fileformat.test.js +++ b/test/fileformat.test.js @@ -47,7 +47,7 @@ test('Conversion of format 0 to format 1', async () => { test('Read format 1', async () => { let state = await importJs.readDataFromFile( - testUtil.otherTestFile.fileFormat1 + testUtil.otherTestFile.fileFormat1, ) expect(state).not.toBeNull() expect(state.endpointTypes.length).toEqual(1) diff --git a/test/frontend.test.js b/test/frontend.test.js index f54b459aa4..65f4420fec 100644 --- a/test/frontend.test.js +++ b/test/frontend.test.js @@ -37,7 +37,7 @@ test( expect(window[rendApi.GLOBAL_SYMBOL_INFO]).not.toBeNull() expect(window[rendApi.GLOBAL_SYMBOL_NOTIFY]).not.toBeNull() }, - timeout.short() + timeout.short(), ) test( @@ -45,7 +45,7 @@ test( () => { expect(window.sessionStorage.getItem('session_uuid')).not.toBeNull() }, - timeout.short() + timeout.short(), ) test( @@ -53,7 +53,7 @@ test( () => { expect(app.config.globalProperties.$onWebSocket).not.toBeNull() }, - timeout.short() + timeout.short(), ) test( @@ -63,5 +63,5 @@ test( let router = index() expect(router).not.toBeNull() }, - timeout.short() + timeout.short(), ) diff --git a/test/gen-dotdot.test.js b/test/gen-dotdot.test.js index 1db402a567..5606a736ce 100644 --- a/test/gen-dotdot.test.js +++ b/test/gen-dotdot.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) @@ -51,19 +51,19 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.dotdot + testUtil.testTemplate.dotdot, ) expect(context.crc).not.toBeNull() expect(context.templateData).not.toBeNull() expect(context.templateData.name).toEqual('Dotdot templates') expect(context.templateData.version).toEqual('test-dotdot-v1') expect(context.templateData.templates.length).toEqual( - testUtil.testTemplate.dotdotCount + testUtil.testTemplate.dotdotCount, ) expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -71,7 +71,7 @@ test( async () => { zclContext = await zclLoader.loadZcl(db, env.builtinDotdotZclMetafile()) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -85,10 +85,10 @@ test( await queryPackage.insertSessionPackage( db, sessionPartitionInfo[0].sessionPartitionId, - zclContext.packageId + zclContext.packageId, ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -101,7 +101,7 @@ test( {}, { disableDeprecationWarnings: true, - } + }, ) expect(genResult).not.toBeNull() expect(genResult.partial).toBeFalsy() @@ -111,10 +111,10 @@ test( let epc = genResult.content['test1.h'] expect(epc).not.toBeNull() expect(epc).toContain( - 'EmberAfDrlkOperMode OperatingModeDuringHoliday // command type' + 'EmberAfDrlkOperMode OperatingModeDuringHoliday // command type', ) expect(epc).toContain( - 'EmberAfDrlkOperMode OperatingMode; // attribute type' + 'EmberAfDrlkOperMode OperatingMode; // attribute type', ) let mqtt = genResult.content['mqtt.cpp'] @@ -128,15 +128,15 @@ test( expect(types).not.toBeNull() expect(types).toContain('// Bitmap: LevelOptions, size: 1') expect(types).toContain( - '#define EMBER_AF_COLOR_CONTROL_COLOR_CAPABILITIES_COLOR_LOOP_SUPPORTED (4) // type: bool' + '#define EMBER_AF_COLOR_CONTROL_COLOR_CAPABILITIES_COLOR_LOOP_SUPPORTED (4) // type: bool', ) expect(types).toContain( - '#define EMBER_AF_RESTART_DEVICE_OPTIONS_STARTUP_MODE (7) // type: enum8' + '#define EMBER_AF_RESTART_DEVICE_OPTIONS_STARTUP_MODE (7) // type: enum8', ) let clusters = genResult.content['dotdot-cluster.xml'] expect(clusters).not.toBeNull() expect(clusters).toContain('') }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-matter-1.test.js b/test/gen-matter-1.test.js index 159f7816a4..d16b424d73 100644 --- a/test/gen-matter-1.test.js +++ b/test/gen-matter-1.test.js @@ -46,7 +46,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) let ctx = await zclLoader.loadZcl(db, env.builtinMatterZclMetafile()) zclPackageId = ctx.packageId @@ -65,7 +65,7 @@ test('Validate loading', async () => { zclPackageId, null, 0xfffc, - null + null, ) expect(attr).not.toBe(null) @@ -73,7 +73,7 @@ test('Validate loading', async () => { db, zclPackageId, 0x0029, - null + null, ) expect(cluster).not.toBe(null) expect(cluster.name).toBe('OTA Software Update Provider') @@ -101,7 +101,7 @@ test('Validate loading of features as bitmap', async () => { db, 'Feature', clusterInfo.id, - [zclPackageId] + [zclPackageId], ) expect(dataType).not.toBeNull() expect(dataType.name).toEqual('Feature') @@ -112,7 +112,7 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.matter + testUtil.testTemplate.matter, ) expect(templateContext.crc).not.toBeNull() @@ -122,7 +122,7 @@ test( expect(templateContext.templateData.templates.length).toEqual(templateCount) expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -139,12 +139,12 @@ test( .then((generatorConfigurations) => { expect(generatorConfigurations.length).toBe(1) expect(generatorConfigurations[0].optionCode).toBe( - 'disableUcComponentOnZclClusterUpdate' + 'disableUcComponentOnZclClusterUpdate', ) expect(generatorConfigurations[0].optionLabel).toBe('true') }) }), - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -161,7 +161,7 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult).not.toBeNull() @@ -171,24 +171,24 @@ test( expect(sdkExt).not.toBeNull() expect( sdkExt.includes( - "// cluster: 0x0029 OTA Software Update Provider, text extension: ''" - ) + "// cluster: 0x0029 OTA Software Update Provider, text extension: ''", + ), ).toBeTruthy() let simpleTest = genResult.content['simple-test.h'] expect(simpleTest).toContain( - 'Cluster Name : OnOff+Command Name : OnWithRecallGlobalScene' + 'Cluster Name : OnOff+Command Name : OnWithRecallGlobalScene', ) expect(simpleTest).toContain('ExternalAddon : 72') expect(simpleTest).toContain('ExternalAddon : 784') expect(simpleTest).toContain('ExternalAddon : 248') expect(simpleTest).toContain('ExternalAddon : 60') expect(simpleTest).toContain( - 'ExternalAddon : This is example of test external addon helper.' + 'ExternalAddon : This is example of test external addon helper.', ) let deviceType = genResult.content['device-types.txt'] expect(deviceType).toContain( - '// device type: CHIP / 0x0105 => MA-colordimmerswitch // extension: ' + '// device type: CHIP / 0x0105 => MA-colordimmerswitch // extension: ', ) expect(deviceType).toContain('>> Attribute: StartUpCurrentLevel [16384]') expect(deviceType).toContain('>> Command: MoveToLevelWithOnOff [4]') @@ -202,17 +202,17 @@ test( expect(chipToolHelper).toContain('0,1// actual type: BOOLEAN') expect(chipToolHelper).toContain('0,UINT16_MAX// actual type: INT16U') expect(chipToolHelper).toContain( - '0,UINT0_MAX// actual type: ThermostatScheduleTransition' + '0,UINT0_MAX// actual type: ThermostatScheduleTransition', ) // Testing attribute's scene loading expect( sdkExt.includes( - "// attribute: 0x0300 / 0x4001 => EnhancedColorMode, extensions: '', '', scene: true" - ) + "// attribute: 0x0300 / 0x4001 => EnhancedColorMode, extensions: '', '', scene: true", + ), ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -229,7 +229,7 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult).not.toBeNull() @@ -243,5 +243,5 @@ test( expect(endpoints).toContain('- ShortRelease: 1') expect(endpoints).toContain('- MultiPressOngoing: 1') }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-matter-2.test.js b/test/gen-matter-2.test.js index 1d0057d2fc..d3af3b00cd 100644 --- a/test/gen-matter-2.test.js +++ b/test/gen-matter-2.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) let ctx = await zclLoader.loadZcl(db, env.builtinMatterZclMetafile()) zclPackageId = ctx.packageId @@ -53,7 +53,7 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.matter2 + testUtil.testTemplate.matter2, ) expect(templateContext.crc).not.toBeNull() @@ -63,7 +63,7 @@ test( expect(templateContext.templateData.templates.length).toEqual(templateCount) expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -80,9 +80,9 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult.hasErrors).not.toBeTruthy() }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-matter-3-1.test.js b/test/gen-matter-3-1.test.js index e2852a55f0..26ff2ba00b 100644 --- a/test/gen-matter-3-1.test.js +++ b/test/gen-matter-3-1.test.js @@ -49,7 +49,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) let ctx = await zclLoader.loadZcl(db, env.builtinMatterZclMetafile()) zclPackageId = ctx.packageId @@ -62,7 +62,7 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.matter3 + testUtil.testTemplate.matter3, ) expect(templateContext.crc).not.toBeNull() @@ -72,7 +72,7 @@ test( expect(templateContext.templateData.templates.length).toEqual(templateCount) expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -89,7 +89,7 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult.hasErrors).toEqual(false) @@ -121,14 +121,14 @@ test( { ZAP_CLUSTER_INDEX(80), 1, 0 }, \\ }`) expect(ept).toContain( - `{ 0x00000005, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* LastNetworkingStatus */` + `{ 0x00000005, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* LastNetworkingStatus */`, ) expect(ept).toContain( - '{ (uint16_t)0xFF, (uint16_t)0x64, (uint16_t)0xFFFF }, /* BallastFactorAdjustment */' + '{ (uint16_t)0xFF, (uint16_t)0x64, (uint16_t)0xFFFF }, /* BallastFactorAdjustment */', ) expect(ept).toContain(`6, 'C', 'o', 'f', 'f', 'e', 'e', \\`) expect(ept).toContain( - '{ (uint16_t)-0x64, (uint16_t)-0x96, (uint16_t)0xC8 }' + '{ (uint16_t)-0x64, (uint16_t)-0x96, (uint16_t)0xC8 }', ) expect(ept).toContain('#define GENERATED_MIN_MAX_DEFAULT_COUNT 51') expect(ept).toContain('#define GENERATED_ATTRIBUTE_COUNT 739') @@ -154,19 +154,19 @@ test( expect(ept).toContain('#define ATTRIBUTE_MAX_SIZE (3988)') expect(ept).toContain('#define FIXED_ENDPOINT_COUNT (4)') expect(ept).toContain( - '#define FIXED_ENDPOINT_ARRAY { 0x0000, 0x0001, 0x0002, 0xFFFE }' + '#define FIXED_ENDPOINT_ARRAY { 0x0000, 0x0001, 0x0002, 0xFFFE }', ) expect(ept).toContain( - '#define FIXED_PROFILE_IDS { 0x0103, 0x0103, 0x0103, 0x0103 }' + '#define FIXED_PROFILE_IDS { 0x0103, 0x0103, 0x0103, 0x0103 }', ) expect(ept).toContain( - '#define FIXED_PARENT_IDS { kInvalidEndpointId, 0, 1, kInvalidEndpointId }' + '#define FIXED_PARENT_IDS { kInvalidEndpointId, 0, 1, kInvalidEndpointId }', ) expect(ept).toContain( - '#define FIXED_DEVICE_TYPES {{0x00000016,1},{0x00000100,1},{0x00000100,1},{0x0000F002,1}}' + '#define FIXED_DEVICE_TYPES {{0x00000016,1},{0x00000100,1},{0x00000100,1},{0x0000F002,1}}', ) expect(ept).toContain( - '#define FIXED_DEVICE_TYPES_WITH_ENDPOINT {{0x00000016,1,0},{0x00000100,1,1},{0x00000100,1,2},{0x0000F002,1,65534}}' + '#define FIXED_DEVICE_TYPES_WITH_ENDPOINT {{0x00000016,1,0},{0x00000100,1,1},{0x00000100,1,2},{0x0000F002,1,65534}}', ) expect(ept).toContain('#define FIXED_DEVICE_TYPE_OFFSETS { 0,1,2,3}') expect(ept).toContain('#define FIXED_DEVICE_TYPE_LENGTHS { 1,1,1,1}') @@ -181,7 +181,7 @@ test( .clusterId = 0x00000028, \\ },\\`) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -198,7 +198,7 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult.hasErrors).toEqual(false) @@ -230,17 +230,17 @@ test( { ZAP_CLUSTER_INDEX(80), 1, 0 }, \\ }`) expect(ept).toContain( - `{ 0x00000005, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* LastNetworkingStatus */` + `{ 0x00000005, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* LastNetworkingStatus */`, ) expect(ept).toContain( - ' { 0x00000000, ZAP_TYPE(TEMPERATURE), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x8000) },' + ' { 0x00000000, ZAP_TYPE(TEMPERATURE), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x8000) },', ) expect(ept).toContain( - '{ (uint16_t)0xFF, (uint16_t)0x64, (uint16_t)0xFFFF }, /* BallastFactorAdjustment */' + '{ (uint16_t)0xFF, (uint16_t)0x64, (uint16_t)0xFFFF }, /* BallastFactorAdjustment */', ) expect(ept).toContain(`6, 'C', 'o', 'f', 'f', 'e', 'e', \\`) expect(ept).toContain( - '{ (uint16_t)-0x64, (uint16_t)-0x96, (uint16_t)0xC8 }' + '{ (uint16_t)-0x64, (uint16_t)-0x96, (uint16_t)0xC8 }', ) expect(ept).toContain('#define GENERATED_MIN_MAX_DEFAULT_COUNT 51') expect(ept).toContain('#define GENERATED_ATTRIBUTE_COUNT 739') @@ -266,19 +266,19 @@ test( expect(ept).toContain('#define ATTRIBUTE_MAX_SIZE (3988)') expect(ept).toContain('#define FIXED_ENDPOINT_COUNT (4)') expect(ept).toContain( - '#define FIXED_ENDPOINT_ARRAY { 0x0000, 0x0001, 0x0002, 0xFFFE }' + '#define FIXED_ENDPOINT_ARRAY { 0x0000, 0x0001, 0x0002, 0xFFFE }', ) expect(ept).toContain( - '#define FIXED_PROFILE_IDS { 0x0103, 0x0103, 0x0103, 0x0103 }' + '#define FIXED_PROFILE_IDS { 0x0103, 0x0103, 0x0103, 0x0103 }', ) expect(ept).toContain( - '#define FIXED_PARENT_IDS { kInvalidEndpointId, kInvalidEndpointId, kInvalidEndpointId, kInvalidEndpointId }' + '#define FIXED_PARENT_IDS { kInvalidEndpointId, kInvalidEndpointId, kInvalidEndpointId, kInvalidEndpointId }', ) expect(ept).toContain( - '#define FIXED_DEVICE_TYPES {{0x00000016,1},{0x00000100,1},{0x00000100,1},{0x0000F002,1}}' + '#define FIXED_DEVICE_TYPES {{0x00000016,1},{0x00000100,1},{0x00000100,1},{0x0000F002,1}}', ) expect(ept).toContain( - '#define FIXED_DEVICE_TYPES_WITH_ENDPOINT {{0x00000016,1,0},{0x00000100,1,1},{0x00000100,1,2},{0x0000F002,1,65534}}' + '#define FIXED_DEVICE_TYPES_WITH_ENDPOINT {{0x00000016,1,0},{0x00000100,1,1},{0x00000100,1,2},{0x0000F002,1,65534}}', ) expect(ept).toContain('#define FIXED_DEVICE_TYPE_OFFSETS { 0,1,2,3}') expect(ept).toContain('#define FIXED_DEVICE_TYPE_LENGTHS { 1,1,1,1}') @@ -293,13 +293,13 @@ test( .clusterId = 0x00000028, \\ },\\`) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( `Zap multiple device type per endpoint file generation: ${path.relative( __dirname, - multipleDeviceTypePerEndpointTestFile + multipleDeviceTypePerEndpointTestFile, )}`, async () => { let sessionId = await querySession.createBlankSession(db) @@ -309,7 +309,7 @@ test( multipleDeviceTypePerEndpointTestFile, { sessionId: sessionId, - } + }, ) let genResult = await genEngine.generate( @@ -317,17 +317,17 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult.hasErrors).toEqual(false) let ept = genResult.content['endpoint_config.h'] expect(ept).toContain( - '#define FIXED_DEVICE_TYPES {{0x00000016,1},{0x00000101,2},{0x00000100,1},{0x00000101,1},{0x00000100,1},{0x0000F002,1}}' + '#define FIXED_DEVICE_TYPES {{0x00000016,1},{0x00000101,2},{0x00000100,1},{0x00000101,1},{0x00000100,1},{0x0000F002,1}}', ) expect(ept).toContain( - '#define FIXED_DEVICE_TYPES_WITH_ENDPOINT {{0x00000016,1,0},{0x00000101,2,1},{0x00000100,1,1},{0x00000101,1,2},{0x00000100,1,2},{0x0000F002,1,65534}}' + '#define FIXED_DEVICE_TYPES_WITH_ENDPOINT {{0x00000016,1,0},{0x00000101,2,1},{0x00000100,1,1},{0x00000101,1,2},{0x00000100,1,2},{0x0000F002,1,65534}}', ) expect(ept).toContain('#define FIXED_DEVICE_TYPE_OFFSETS { 0,1,3,5}') expect(ept).toContain('#define FIXED_DEVICE_TYPE_LENGTHS { 1,2,2,1}') @@ -341,13 +341,13 @@ test( expect(ept).toContain('Endpoint 2, DeviceId: 257, DeviceVersion: 1') expect(ept).toContain('Endpoint 65534, DeviceId: 61442, DeviceVersion: 1') }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( `Zap testing miscellaneouos type specific helpers: ${path.relative( __dirname, - testFile + testFile, )}`, async () => { let sessionId = await querySession.createBlankSession(db) @@ -361,7 +361,7 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult.hasErrors).toEqual(false) @@ -377,94 +377,94 @@ test( // Testing if_unsupported_attribute_callback helper expect(ept).toContain( - 'attribute callback for OnOff of boolean type is supported in java' + 'attribute callback for OnOff of boolean type is supported in java', ) expect(ept).toContain( - 'attribute callback for GlobalSceneControl of boolean type is supported in java' + 'attribute callback for GlobalSceneControl of boolean type is supported in java', ) expect(ept).toContain( - 'attribute callback for GeneratedCommandList of command_id type is supported in java' + 'attribute callback for GeneratedCommandList of command_id type is supported in java', ) // Testing if_basic_attribute helper expect(ept).toContain( - 'attribute OnTime of int16u type is basic type in java' + 'attribute OnTime of int16u type is basic type in java', ) expect(ept).toContain( - 'attribute EventList of event_id type is not basic type in java' + 'attribute EventList of event_id type is not basic type in java', ) expect(ept).toContain( - 'attribute StartUpOnOff of OnOffStartUpOnOff type is not basic type in java' + 'attribute StartUpOnOff of OnOffStartUpOnOff type is not basic type in java', ) // Testing as_underlying_java_zcl_type helper expect(ept).toContain( - 'Underlying Java type for attribute OnOff of boolean type: Boolean' + 'Underlying Java type for attribute OnOff of boolean type: Boolean', ) expect(ept).toContain( - 'Underlying Java type for attribute OnTime of int16u type: Integer' + 'Underlying Java type for attribute OnTime of int16u type: Integer', ) expect(ept).toContain( - 'Underlying Java type for attribute GeneratedCommandList of command_id type: Long' + 'Underlying Java type for attribute GeneratedCommandList of command_id type: Long', ) // Testing as_underlying_python_zcl_type helper expect(ept).toContain( - 'Underlying Python type for attribute OnOff of boolean type: bool' + 'Underlying Python type for attribute OnOff of boolean type: bool', ) expect(ept).toContain( - 'Underlying Python type for attribute OnTime of int16u type: int' + 'Underlying Python type for attribute OnTime of int16u type: int', ) expect(ept).toContain( - 'Underlying Python type for attribute GeneratedCommandList of command_id type: int' + 'Underlying Python type for attribute GeneratedCommandList of command_id type: int', ) // Testing if_is_data_type_signed and as_zcl_data_type_size expect(ept).toContain( - 'attribute OnOff of type boolean is unsigned. The size of this attribute is: 8 bits' + 'attribute OnOff of type boolean is unsigned. The size of this attribute is: 8 bits', ) expect(ept).toContain( - 'attribute OnTime of type int16u is unsigned. The size of this attribute is: 16 bits' + 'attribute OnTime of type int16u is unsigned. The size of this attribute is: 16 bits', ) expect(ept).toContain( - 'attribute StartUpOnOff of type OnOffStartUpOnOff is unsigned. The size of this attribute is: 8 bits' + 'attribute StartUpOnOff of type OnOffStartUpOnOff is unsigned. The size of this attribute is: 8 bits', ) expect(ept).toContain( - 'attribute GeneratedCommandList of type command_id is unsigned. The size of this attribute is: 32 bits' + 'attribute GeneratedCommandList of type command_id is unsigned. The size of this attribute is: 32 bits', ) // Testing cluster specific structs expect(ept).toContain( - 'TargetStruct item 0 from Access Control cluster: Cluster' + 'TargetStruct item 0 from Access Control cluster: Cluster', ) expect(ept).toContain( - 'TargetStruct item 1 from Access Control cluster: Endpoint' + 'TargetStruct item 1 from Access Control cluster: Endpoint', ) expect(ept).toContain( - 'TargetStruct item 2 from Access Control cluster: DeviceType' + 'TargetStruct item 2 from Access Control cluster: DeviceType', ) expect(ept).toContain('TargetStruct item 0 from Binding cluster: Node') expect(ept).toContain('TargetStruct item 1 from Binding cluster: Group') expect(ept).toContain('TargetStruct item 2 from Binding cluster: Endpoint') expect(ept).toContain('TargetStruct item 3 from Binding cluster: Cluster') expect(ept).toContain( - 'TargetStruct item 4 from Binding cluster: FabricIndex' + 'TargetStruct item 4 from Binding cluster: FabricIndex', ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( `Zap file generation for multiple zcl device types per endpoint: ${path.relative( __dirname, - testFile + testFile, )}`, async () => { // Creating a session with matter specific session packages let userSession = await querySession.ensureZapUserAndSession( db, 'USER', - 'SESSION' + 'SESSION', ) let sid = userSession.sessionId await util.ensurePackagesAndPopulateSessionOptions( @@ -476,17 +476,17 @@ test( partitions: 2, }, null, - [templateContext.packageId] + [templateContext.packageId], ) // Extract device types for insertion into an endpoint let allDeviceTypes = await queryDeviceType.selectAllDeviceTypes( db, - zclPackageId + zclPackageId, ) let matterLightDevices = allDeviceTypes.filter( (data) => - data.label === 'MA-onofflight' || data.label === 'MA-dimmablelight' + data.label === 'MA-onofflight' || data.label === 'MA-dimmablelight', ) let matterLightDeviceRefs = matterLightDevices.map((dt) => dt.id) let matterLightDeviceIds = matterLightDevices.map((dt) => dt.code) @@ -496,7 +496,7 @@ test( await querySession.selectSessionPartitionInfoFromDeviceType( db, sid, - matterLightDeviceRefs[0] + matterLightDeviceRefs[0], ) await queryConfig.insertEndpointType( db, @@ -505,7 +505,7 @@ test( matterLightDeviceRefs, matterLightDeviceIds, [1, 2], //device type version - true + true, ) // Getting the endpoint cluster information and making sure clusters from both @@ -533,20 +533,20 @@ test( db, levelControlCluster.endpointTypeClusterId, '0xFFFC', - null + null, ) expect(levelControlClusterFeatureMapAttribute.defaultValue).toEqual('3') // Edit the endpoint type and add another device type and test the update let additionalMatterLightDevice = allDeviceTypes.filter( - (data) => data.label === 'MA-colortemperaturelight' + (data) => data.label === 'MA-colortemperaturelight', ) let matterLightDevicesExtended = matterLightDeviceRefs.concat( - additionalMatterLightDevice.map((dt) => dt.id) + additionalMatterLightDevice.map((dt) => dt.id), ) let matterLightDeviceIdsExtended = matterLightDeviceIds.concat( - additionalMatterLightDevice.map((dt) => dt.code) + additionalMatterLightDevice.map((dt) => dt.code), ) let changesArray = [ { key: 'deviceTypeRef', value: matterLightDevicesExtended }, @@ -563,11 +563,11 @@ test( // Cluster coming from just MA-colortemperaturelight expect(clusterNames.includes('Color Control')).toEqual(true) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test(`Zap file generation: ${path.relative( __dirname, - endpointComposition + endpointComposition, )}`, async () => { let sessionId = await querySession.createBlankSession(db) @@ -580,7 +580,7 @@ test(`Zap file generation: ${path.relative( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult.hasErrors).toEqual(false) @@ -594,6 +594,6 @@ test(`Zap file generation: ${path.relative( // let ept = genResult.content['endpoint_config.h'] expect(ept).toContain( - 'Endpoint 1, DeviceId: 112, DeviceVersion: 1, Composition: tree' + 'Endpoint 1, DeviceId: 112, DeviceVersion: 1, Composition: tree', ) }) diff --git a/test/gen-matter-3.test.js b/test/gen-matter-3.test.js index b442377b3c..54ad8153b9 100644 --- a/test/gen-matter-3.test.js +++ b/test/gen-matter-3.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) let ctx = await zclLoader.loadZcl(db, env.builtinMatterZclMetafile()) zclPackageId = ctx.packageId @@ -53,7 +53,7 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.matter3 + testUtil.testTemplate.matter3, ) expect(templateContext.crc).not.toBeNull() @@ -63,7 +63,7 @@ test( expect(templateContext.templateData.templates.length).toEqual(templateCount) expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -80,9 +80,9 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult.hasErrors).toEqual(false) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-matter-4.test.js b/test/gen-matter-4.test.js index 59888e46f8..c78cbb7d72 100644 --- a/test/gen-matter-4.test.js +++ b/test/gen-matter-4.test.js @@ -48,7 +48,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) let ctx = await zclLoader.loadZcl(db, env.builtinMatterZclMetafile()) zclPackageId = ctx.packageId @@ -61,7 +61,7 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.matter4 + testUtil.testTemplate.matter4, ) expect(templateContext.crc).not.toBeNull() @@ -71,7 +71,7 @@ test( expect(templateContext.templateData.templates.length).toEqual(templateCount) expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -88,12 +88,12 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult.hasErrors).toEqual(false) let content = genResult.content['cluster-objects.out'] expect(content.length).toBeGreaterThan(2000) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-matter-api-maturity.test.js b/test/gen-matter-api-maturity.test.js index 6fccc4337a..bcb07d8fc8 100644 --- a/test/gen-matter-api-maturity.test.js +++ b/test/gen-matter-api-maturity.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) let ctx = await zclLoader.loadZcl(db, env.builtinMatterZclMetafile()) zclPackageId = ctx.packageId @@ -53,19 +53,19 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.matterApiMaturity + testUtil.testTemplate.matterApiMaturity, ) expect(templateContext.crc).not.toBeNull() expect(templateContext.templateData).not.toBeNull() expect(templateContext.templateData.name).toEqual('CHIP Tests templates') expect(templateContext.templateData.version).toEqual( - 'matter-matter-api-maturity' + 'matter-matter-api-maturity', ) expect(templateContext.templateData.templates.length).toEqual(templateCount) expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -82,7 +82,7 @@ test( sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult.hasErrors).toEqual(false) @@ -100,12 +100,12 @@ test( // attribute tagging expect(ept).toContain('optional int8u attribute stableAttribute = 0;') expect(ept).toContain( - 'optional int8u attribute provisionalAttribute = 1 (provisional);' + 'optional int8u attribute provisionalAttribute = 1 (provisional);', ) // Maturity for structures should be correct expect(ept).toContain('struct StableStruct {') expect(ept).toContain('struct ProvisionalStruct (provisional) {') }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-meta.test.js b/test/gen-meta.test.js index 5be7b37e7b..6f72f9a678 100644 --- a/test/gen-meta.test.js +++ b/test/gen-meta.test.js @@ -41,7 +41,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) @@ -52,7 +52,7 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.meta + testUtil.testTemplate.meta, ) expect(templateContext.crc).not.toBeNull() expect(templateContext.templateData).not.toBeNull() @@ -60,7 +60,7 @@ test( expect(templateContext.templateData.version).toEqual('meta-test') expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -151,14 +151,14 @@ test( const ops = await queryAccess.selectAccessOperations( db, - zclContext.packageId + zclContext.packageId, ) expect(ops.length).toBe(3) const roles = await queryAccess.selectAccessRoles(db, zclContext.packageId) expect(roles.length).toBe(4) const mods = await queryAccess.selectAccessModifiers( db, - zclContext.packageId + zclContext.packageId, ) expect(mods.length).toBe(2) @@ -167,7 +167,7 @@ test( d = await queryAccess.selectDefaultAccess( db, zclContext.packageId, - 'command' + 'command', ) expect(d[0].operation).toBe('invoke') expect(d[0].role).toBeNull() @@ -177,7 +177,7 @@ test( d = await queryAccess.selectDefaultAccess( db, zclContext.packageId, - 'cluster' + 'cluster', ) expect(d.length).toBe(2) expect(d[0].operation).toBe('read') @@ -186,7 +186,7 @@ test( d = await queryAccess.selectDefaultAccess( db, zclContext.packageId, - 'attribute' + 'attribute', ) expect(d.length).toBe(2) expect(d[0].operation).toBe('read') @@ -194,7 +194,7 @@ test( expect(d[0].role).toBe('view') expect(d[1].role).toBe('operate') }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -204,7 +204,7 @@ test( sessionId = importResult.sessionId expect(sessionId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -217,7 +217,7 @@ test( {}, { disableDeprecationWarnings: true, - } + }, ) expect(genResult).not.toBeNull() @@ -250,11 +250,11 @@ test( epc = genResult.content['access.out'] expect(epc).not.toBeNull() expect(epc).toContain( - '* Op: write / Role: manage / Modifier: fabric-scoped' + '* Op: write / Role: manage / Modifier: fabric-scoped', ) expect(epc).toContain('* Op: / Role: / Modifier: fabric-sensitive') expect(epc).toContain( - '* Aggregates [3]: fScope=true/fSensitive=false/read=view/write=[operate - manage]/invoke=NONE' + '* Aggregates [3]: fScope=true/fSensitive=false/read=view/write=[operate - manage]/invoke=NONE', ) expect(epc).toContain('HelloEvent is a fabric-sensitive event') @@ -267,7 +267,7 @@ test( expect(c).not.toBeNull() expect(c).toContain('Cluster desc: Test 2 description') }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test('Package options test', async () => { diff --git a/test/gen-template/matter/external-addon-helper.js b/test/gen-template/matter/external-addon-helper.js index 0cdfcf8a0a..bd0cba1675 100644 --- a/test/gen-template/matter/external-addon-helper.js +++ b/test/gen-template/matter/external-addon-helper.js @@ -59,35 +59,35 @@ function initialize_helpers(helperRegister, context) { helperRegister.registerHelpers( 'test_external_addon_helper', test_external_addon_helper, - context + context, ) // Register the 'test_external_addon_all_events_helper' function helperRegister.registerHelpers( 'test_external_addon_all_events_helper', test_external_addon_all_events_helper, - context + context, ) // Register the 'test_external_addon_all_attributes_helper' function helperRegister.registerHelpers( 'test_external_addon_all_attributes_helper', test_external_addon_all_attributes_helper, - context + context, ) // Register the 'test_external_addon_all_commands_helper' function helperRegister.registerHelpers( 'test_external_addon_all_commands_helper', test_external_addon_all_commands_helper, - context + context, ) // Register the 'test_external_addon_all_clusters_helper' function helperRegister.registerHelpers( 'test_external_addon_all_clusters_helper', test_external_addon_all_clusters_helper, - context + context, ) } diff --git a/test/gen-template/zigbee/external-addon-helper.js b/test/gen-template/zigbee/external-addon-helper.js index ad2a2015e0..e972260947 100644 --- a/test/gen-template/zigbee/external-addon-helper.js +++ b/test/gen-template/zigbee/external-addon-helper.js @@ -59,35 +59,35 @@ function initialize_helpers(helperRegister, context) { helperRegister.registerHelpers( 'test_external_addon_helper', test_external_addon_helper, - context + context, ) // Register the 'test_external_addon_all_events_helper' function helperRegister.registerHelpers( 'test_external_addon_all_events_helper', test_external_addon_all_events_helper, - context + context, ) // Register the 'test_external_addon_all_attributes_helper' function helperRegister.registerHelpers( 'test_external_addon_all_attributes_helper', test_external_addon_all_attributes_helper, - context + context, ) // Register the 'test_external_addon_all_commands_helper' function helperRegister.registerHelpers( 'test_external_addon_all_commands_helper', test_external_addon_all_commands_helper, - context + context, ) // Register the 'test_external_addon_all_clusters_helper' function helperRegister.registerHelpers( 'test_external_addon_all_clusters_helper', test_external_addon_all_clusters_helper, - context + context, ) } diff --git a/test/gen-test.test.js b/test/gen-test.test.js index dcc63e5bc6..e3aa460205 100644 --- a/test/gen-test.test.js +++ b/test/gen-test.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) @@ -51,18 +51,18 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.unittest + testUtil.testTemplate.unittest, ) expect(templateContext.crc).not.toBeNull() expect(templateContext.templateData).not.toBeNull() expect(templateContext.templateData.name).toEqual('Unit test templates') expect(templateContext.templateData.version).toEqual('unit-test') expect(templateContext.templateData.templates.length).toEqual( - testUtil.testTemplate.testCount + testUtil.testTemplate.testCount, ) expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -70,7 +70,7 @@ test( async () => { zclContext = await zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -83,15 +83,15 @@ test( await querySession.selectSessionPartitionInfoFromPackageId( db, sessionId, - zclContext.packageId + zclContext.packageId, ) await queryPackage.insertSessionPackage( db, sessionPartitionInfo[0].sesssionPartitionId, - zclContext.packageId + zclContext.packageId, ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -104,7 +104,7 @@ test( {}, { disableDeprecationWarnings: true, - } + }, ) expect(genResult).not.toBeNull() @@ -131,5 +131,5 @@ test( expect(testFutures).toContain('x=1') expect(testFutures).not.toContain('y=1') }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) diff --git a/test/gen-zigbee-1.test.js b/test/gen-zigbee-1.test.js index d4a3a31949..d3435f027e 100644 --- a/test/gen-zigbee-1.test.js +++ b/test/gen-zigbee-1.test.js @@ -37,7 +37,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) return zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, testUtil.timeout.medium()) @@ -52,7 +52,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) templatePkgId = context.packageId expect(context.crc).not.toBeNull() @@ -63,7 +63,7 @@ test( expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -71,11 +71,11 @@ test( async () => { templateContext.packages = await queryPackage.getPackageByParent( templateContext.db, - templateContext.packageId + templateContext.packageId, ) expect(templateContext.packages.length).toBe(templateCount - 1 + 3) // -1 for ignored one, two for helpers and one for overridable }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -85,7 +85,7 @@ test( expect(sessionId).not.toBeNull() templateContext.sessionId = sessionId }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -99,12 +99,12 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) expect(packages.length).toBe(2) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -115,7 +115,7 @@ test( templateContext.sessionId, templateContext.packageId, {}, - { disableDeprecationWarnings: true } + { disableDeprecationWarnings: true }, ) expect(genResult).not.toBeNull() @@ -128,7 +128,7 @@ test( expect(simpleTest).toContain(`SessionId: ${genResult.sessionId}`) expect(simpleTest).toContain('Addon: This is example of test addon helper') expect(simpleTest).toContain( - 'External Addon: This is example of test external addon helper' + 'External Addon: This is example of test external addon helper', ) let zclId = genResult.content['zcl-test.out'] @@ -142,14 +142,14 @@ test( expect(zclId).toContain( `// ${testUtil.totalNonAtomicEnumCount - 1}/${ testUtil.totalNonAtomicEnumCount - }: label=>ZllStatus caption=>Enum of size 1 byte` + }: label=>ZllStatus caption=>Enum of size 1 byte`, ) expect(zclId).toContain(`Label count: ${testUtil.totalNonAtomicEnumCount}`) expect(zclId).toContain( - `// 129/${testUtil.totalNonAtomicEnumCount}: label=>MeteringBlockEnumerations caption=>Enum of size 1 byte` + `// 129/${testUtil.totalNonAtomicEnumCount}: label=>MeteringBlockEnumerations caption=>Enum of size 1 byte`, ) expect(zclId).toContain( - '// struct: ReadReportingConfigurationAttributeRecord' + '// struct: ReadReportingConfigurationAttributeRecord', ) expect(zclId).toContain('cluster: 0x0700 Price') expect(zclId).toContain('cmd: 0x0A GetUserStatusResponse') @@ -173,44 +173,44 @@ test( let zapCommand = genResult.content['zap-command.h'] expect(zapCommand).not.toBeNull() expect(zapCommand).toContain( - '#define emberAfFillCommandGlobalReadAttributesResponse(clusterId,' + '#define emberAfFillCommandGlobalReadAttributesResponse(clusterId,', ) let zapPrint = genResult.content['zap-print.h'] expect(zapPrint).toContain( - '#define SILABS_PRINTCLUSTER_POWER_CONFIG_CLUSTER {ZCL_POWER_CONFIG_CLUSTER_ID, 0x0000, "Power Configuration" },' + '#define SILABS_PRINTCLUSTER_POWER_CONFIG_CLUSTER {ZCL_POWER_CONFIG_CLUSTER_ID, 0x0000, "Power Configuration" },', ) let sdkExtension = genResult.content['sdk-extension.out'] expect(sdkExtension).toContain( - "// cluster: 0x0000 Basic, text extension: 'Extension to basic cluster'" + "// cluster: 0x0000 Basic, text extension: 'Extension to basic cluster'", ) expect(sdkExtension).toContain( - "// cluster: 0x0002 Device Temperature Configuration, text extension: 'Extension to temperature config cluster'" + "// cluster: 0x0002 Device Temperature Configuration, text extension: 'Extension to temperature config cluster'", ) expect(sdkExtension).toContain( - "// server cluster: 0x0001 Power Configuration, text extension: 'Extension to power cluster'" + "// server cluster: 0x0001 Power Configuration, text extension: 'Extension to power cluster'", ) expect(sdkExtension).toContain( - "// client cluster: 0x0001 Power Configuration, text extension: ''" + "// client cluster: 0x0001 Power Configuration, text extension: ''", ) expect(sdkExtension).toContain( - "// attribute: 0x0000 / 0x0000 => ZCL version, extensions: '42', '99'" + "// attribute: 0x0000 / 0x0000 => ZCL version, extensions: '42', '99'", ) expect(sdkExtension).toContain( - "attribute: 0x0015 / 0x0015 => network key sequence number, extensions: '0', '1', [int8u:666]" + "attribute: 0x0015 / 0x0015 => network key sequence number, extensions: '0', '1', [int8u:666]", ) expect(sdkExtension).toContain( - "// cluster: 0x0003 Identify, text extension: ''" + "// cluster: 0x0003 Identify, text extension: ''", ) expect(sdkExtension).toContain( - "// command: 0x0000 / 0x00 => ResetToFactoryDefaults, test extension: '1'" + "// command: 0x0000 / 0x00 => ResetToFactoryDefaults, test extension: '1'", ) expect(sdkExtension).toContain( - "// device type: HA / 0x0006 => HA-remote // extension: 'path/to/remote.c'" + "// device type: HA / 0x0006 => HA-remote // extension: 'path/to/remote.c'", ) expect(sdkExtension).toContain( - 'IMPLEMENTED_COMMANDS>ResetToFactoryDefaults,IdentifyQueryResponse,IdentifyQuery,EZModeInvoke,UpdateCommissionState,ResetToFactoryDefaults,IdentifyQueryResponse,IdentifyQuery,EZModeInvoke,UpdateCommissionState, { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) return zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, testUtil.timeout.medium()) @@ -52,7 +52,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) expect(context.crc).not.toBeNull() expect(context.templateData).not.toBeNull() @@ -62,7 +62,7 @@ test( expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -70,11 +70,11 @@ test( async () => { templateContext.packages = await queryPackage.getPackageByParent( templateContext.db, - templateContext.packageId + templateContext.packageId, ) expect(templateContext.packages.length).toBe(templateCount - 1 + 3) // -1 for ignored one, two for helpers and one for overridable }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -82,7 +82,7 @@ test( async () => { let { sessionId, errors, warnings } = await importJs.importDataFromFile( db, - testFile + testFile, ) expect(errors.length).toBe(0) expect(warnings.length).toBe(0) @@ -95,7 +95,7 @@ test( { generateOnly: 'sdk-extension.out', disableDeprecationWarnings: true, - } + }, ) expect(genResult.hasErrors).toBeFalsy() @@ -106,11 +106,11 @@ test( expect(sdkExtension).not.toBeNull() expect( sdkExtension.includes( - 'IMPLEMENTED_COMMANDS2>IdentifyQueryResponse,IdentifyQuery,IdentifyQueryResponse,IdentifyQuery,IdentifyQueryResponse,IdentifyQuery,IdentifyQueryResponse,IdentifyQuery, { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) return zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, testUtil.timeout.medium()) @@ -54,7 +54,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) templatePkgId = context.packageId expect(context.crc).not.toBeNull() @@ -65,7 +65,7 @@ test( expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -73,11 +73,11 @@ test( async () => { templateContext.packages = await queryPackage.getPackageByParent( templateContext.db, - templateContext.packageId + templateContext.packageId, ) expect(templateContext.packages.length).toBe(templateCount - 1 + 3) // -1 for ignored one, two for helpers and one for overridable }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -87,7 +87,7 @@ test( expect(sessionId).not.toBeNull() templateContext.sessionId = sessionId }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -101,12 +101,12 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) expect(packages.length).toBe(2) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -124,7 +124,7 @@ test( {}, { disableDeprecationWarnings: true, - } + }, ) expect(genResult).not.toBeNull() expect(genResult.partial).toBeFalsy() @@ -133,29 +133,29 @@ test( let cfgVer2 = genResult.content['zap-config-version-2.h'] // Test GENERATED_DEFAULTS expect(cfgVer2).toContain( - '0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0,DEFAULT value for cluster: Over the Air Bootloading, attribute: OTA Upgrade Server ID, side: client*/' + '0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0,DEFAULT value for cluster: Over the Air Bootloading, attribute: OTA Upgrade Server ID, side: client*/', ) // Test GENERATED_ATTRIBUTE_COUNT expect(cfgVer2).toContain('#define GENERATED_ATTRIBUTE_COUNT 81') // Test GENERATED_ATTRIBUTES expect(cfgVer2).toContain( - '{ 0x000F, ZCL_BITMAP8_ATTRIBUTE_TYPE, 1, (ATTRIBUTE_MASK_WRITABLE), { (uint8_t*)0x00 } }, /* 46 Cluster: Color Control, Attribute: color control options, Side: server*/' + '{ 0x000F, ZCL_BITMAP8_ATTRIBUTE_TYPE, 1, (ATTRIBUTE_MASK_WRITABLE), { (uint8_t*)0x00 } }, /* 46 Cluster: Color Control, Attribute: color control options, Side: server*/', ) // Test is_number_greater_than within GENERATED_ATTRIBUTES expect(cfgVer2).toContain( - '{ 0x0000, ZCL_IEEE_ADDRESS_ATTRIBUTE_TYPE, 8, (ATTRIBUTE_MASK_CLIENT), { (uint8_t*)&(generatedDefaults[0]) } }, /* 35 Cluster: Over the Air Bootloading, Attribute: OTA Upgrade Server ID, Side: client*/' + '{ 0x0000, ZCL_IEEE_ADDRESS_ATTRIBUTE_TYPE, 8, (ATTRIBUTE_MASK_CLIENT), { (uint8_t*)&(generatedDefaults[0]) } }, /* 35 Cluster: Over the Air Bootloading, Attribute: OTA Upgrade Server ID, Side: client*/', ) // Test GENERATED_CLUSTER_COUNT expect(cfgVer2).toContain('#define GENERATED_CLUSTER_COUNT 18') // Test GENERATED_CLUSTERS expect(cfgVer2).toContain( - '0x0019, (EmberAfAttributeMetadata*)&(generatedAttributes[35]), 4, 15, CLUSTER_MASK_CLIENT, NULL }, /* 15, Endpoint Id: 2, Cluster: Over the Air Bootloading, Side: client*/' + '0x0019, (EmberAfAttributeMetadata*)&(generatedAttributes[35]), 4, 15, CLUSTER_MASK_CLIENT, NULL }, /* 15, Endpoint Id: 2, Cluster: Over the Air Bootloading, Side: client*/', ) // Test GENERATED_ENDPOINT_TYPE_COUNT expect(cfgVer2).toContain('#define GENERATED_ENDPOINT_TYPE_COUNT (2)') // Test GENERATED_ENDPOINT_TYPES expect(cfgVer2).toContain( - '{ ((EmberAfCluster*)&(generatedClusters[0])), 9, 50 },' + '{ ((EmberAfCluster*)&(generatedClusters[0])), 9, 50 },', ) // Test ATTRIBUTE_LARGEST expect(cfgVer2).toContain('#define ATTRIBUTE_LARGEST (65)') @@ -169,8 +169,8 @@ test( expect(cfgVer2).toContain('#define EMBER_AF_GENERATED_COMMAND_COUNT (88)') // Test GENERATED_COMMANDS expect(cfgVer2).toContain( - '{ 0x0004, 0x01, COMMAND_MASK_OUTGOING_SERVER }, /* 7, Cluster: Groups, Command: ViewGroupResponse*/' + '{ 0x0004, 0x01, COMMAND_MASK_OUTGOING_SERVER }, /* 7, Cluster: Groups, Command: ViewGroupResponse*/', ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-zigbee-4.test.js b/test/gen-zigbee-4.test.js index 9eacd6b848..9b5817db63 100644 --- a/test/gen-zigbee-4.test.js +++ b/test/gen-zigbee-4.test.js @@ -39,7 +39,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) return zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, testUtil.timeout.medium()) @@ -54,7 +54,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) templatePkgId = context.packageId expect(context.crc).not.toBeNull() @@ -65,7 +65,7 @@ test( expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -73,11 +73,11 @@ test( async () => { templateContext.packages = await queryPackage.getPackageByParent( templateContext.db, - templateContext.packageId + templateContext.packageId, ) expect(templateContext.packages.length).toBe(templateCount - 1 + 3) // -1 for ignored one, two for helpers and one for overridable }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -87,7 +87,7 @@ test( expect(sessionId).not.toBeNull() templateContext.sessionId = sessionId }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -101,12 +101,12 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) expect(packages.length).toBe(2) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -122,7 +122,7 @@ test( {}, { disableDeprecationWarnings: true, - } + }, ) expect(genResult).not.toBeNull() @@ -130,45 +130,45 @@ test( expect(genResult.content).not.toBeNull() let cfg = genResult.content['zap-config.h'] expect(cfg).toContain( - '{ ZAP_REPORT_DIRECTION(REPORTED), 0x0002, 0x00000000, 0x00000000, ZAP_CLUSTER_MASK(SERVER), 0x0000, {{ 0, 65534, 0 }} }, /* ZCL version */' + '{ ZAP_REPORT_DIRECTION(REPORTED), 0x0002, 0x00000000, 0x00000000, ZAP_CLUSTER_MASK(SERVER), 0x0000, {{ 0, 65534, 0 }} }, /* ZCL version */', ) expect(cfg).toContain( - '{ ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x00000300, 0x00000003, ZAP_CLUSTER_MASK(SERVER), 0x0000, {{ 0, 65534, 0 }} }, /* current x */' + '{ ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x00000300, 0x00000003, ZAP_CLUSTER_MASK(SERVER), 0x0000, {{ 0, 65534, 0 }} }, /* current x */', ) let cfgVer2 = genResult.content['zap-config-version-2.h'] // Test GENERATED_DEFAULTS big endian expect(cfgVer2).toContain( - '0x0F, 0xAE, 0x2F, /* 0,DEFAULT value for cluster: Green Power, attribute: gps functionality, side: server */' + '0x0F, 0xAE, 0x2F, /* 0,DEFAULT value for cluster: Green Power, attribute: gps functionality, side: server */', ) // Test GENERATED_DEFAULTS little endian expect(cfgVer2).toContain( - '0x2F, 0xAE, 0x0F, /* 0,DEFAULT value for cluster: Green Power, attribute: gps functionality, side: server*/' + '0x2F, 0xAE, 0x0F, /* 0,DEFAULT value for cluster: Green Power, attribute: gps functionality, side: server*/', ) // Test GENERATED_DEFAULTS big endian for attribute of size > 8 expect(cfgVer2).toContain( - '0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0F, 0x0F, 0x0F, /* 6,DEFAULT value for cluster: Green Power, attribute: gp link key, side: server */' + '0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0F, 0x0F, 0x0F, /* 6,DEFAULT value for cluster: Green Power, attribute: gp link key, side: server */', ) // Test GENERATED_DEFAULTS for same attribute name but different side of cluster, compare it to above test expect(cfgVer2).toContain( - '0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0F, 0x0F, 0x0F, /* 28,DEFAULT value for cluster: Green Power, attribute: gp link key, side: client */' + '0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0F, 0x0F, 0x0F, /* 28,DEFAULT value for cluster: Green Power, attribute: gp link key, side: client */', ) // Test GENERATED_DEFAULTS little endian for attribute of size > 8 is same as big endian. Bytes are not inverted expect(cfgVer2).not.toContain( - `0x0F, 0x0F, 0x0F, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* 12,DEFAULT value for cluster: Green Power, attribute: gp link key, side: client*/` + `0x0F, 0x0F, 0x0F, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, /* 12,DEFAULT value for cluster: Green Power, attribute: gp link key, side: client*/`, ) // Testing GENERATED ATTRIBUTES to see that they are refering to the correct generation defaults expect(cfgVer2).toContain( - `0x0022, ZCL_SECURITY_KEY_ATTRIBUTE_TYPE, 16, (ATTRIBUTE_MASK_WRITABLE| ATTRIBUTE_MASK_CLIENT), { (uint8_t*)&(generatedDefaults[28]) } }, /* 25 Cluster: Green Power, Attribute: gp link key, Side: client*/` + `0x0022, ZCL_SECURITY_KEY_ATTRIBUTE_TYPE, 16, (ATTRIBUTE_MASK_WRITABLE| ATTRIBUTE_MASK_CLIENT), { (uint8_t*)&(generatedDefaults[28]) } }, /* 25 Cluster: Green Power, Attribute: gp link key, Side: client*/`, ) expect(cfgVer2).toContain( - `0x0022, ZCL_SECURITY_KEY_ATTRIBUTE_TYPE, 16, (ATTRIBUTE_MASK_WRITABLE), { (uint8_t*)&(generatedDefaults[6]) } }, /* 37 Cluster: Green Power, Attribute: gp link key, Side: server*/` + `0x0022, ZCL_SECURITY_KEY_ATTRIBUTE_TYPE, 16, (ATTRIBUTE_MASK_WRITABLE), { (uint8_t*)&(generatedDefaults[6]) } }, /* 37 Cluster: Green Power, Attribute: gp link key, Side: server*/`, ) // Test EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS to see that it generates reporting for singleton attributes correctly @@ -176,29 +176,29 @@ test( // In this case: Basic Server Cluster, ZCL version is enabled on enpoint 2 and 242 expect(cfgVer2).toContain(`EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS`) expect(cfgVer2).toContain( - `{ EMBER_ZCL_REPORTING_DIRECTION_REPORTED, 0x0002, 0x0000, 0x0000, CLUSTER_MASK_SERVER, 0x0000, 0, 65534, 0 }, /* Endpoint Id: 2, Cluster: Basic, Attribute: ZCL version */` + `{ EMBER_ZCL_REPORTING_DIRECTION_REPORTED, 0x0002, 0x0000, 0x0000, CLUSTER_MASK_SERVER, 0x0000, 0, 65534, 0 }, /* Endpoint Id: 2, Cluster: Basic, Attribute: ZCL version */`, ) expect(cfgVer2).not.toContain( - `{ EMBER_ZCL_REPORTING_DIRECTION_REPORTED, 0x0001, 0x0000, 0x0000, CLUSTER_MASK_SERVER, 0x0000, 0, 65534, 0 }, /* Endpoint Id: 1, Cluster: Basic, Attribute: ZCL version */` + `{ EMBER_ZCL_REPORTING_DIRECTION_REPORTED, 0x0001, 0x0000, 0x0000, CLUSTER_MASK_SERVER, 0x0000, 0, 65534, 0 }, /* Endpoint Id: 1, Cluster: Basic, Attribute: ZCL version */`, ) expect(cfgVer2).not.toContain( - `{ EMBER_ZCL_REPORTING_DIRECTION_REPORTED, 0x00F2, 0x0000, 0x0000, CLUSTER_MASK_SERVER, 0x0000, 0, 65534, 0 }, /* Endpoint Id: 242, Cluster: Basic, Attribute: ZCL version */` + `{ EMBER_ZCL_REPORTING_DIRECTION_REPORTED, 0x00F2, 0x0000, 0x0000, CLUSTER_MASK_SERVER, 0x0000, 0, 65534, 0 }, /* Endpoint Id: 242, Cluster: Basic, Attribute: ZCL version */`, ) // Testing zap cli helpers expect(genResult.content['zap-cli.c']).toContain( - 'static const sl_cli_command_entry_t zcl_identify_cluster_command_table[]' + 'static const sl_cli_command_entry_t zcl_identify_cluster_command_table[]', ) expect(genResult.content['zap-cli.c']).toContain( - 'static const sl_cli_command_info_t cli_cmd_identify_group' + 'static const sl_cli_command_info_t cli_cmd_identify_group', ) expect(genResult.content['zap-cli.c']).toContain( - 'SL_CLI_COMMAND_GROUP(zcl_identify_cluster_command_table, "ZCL identify cluster commands");' + 'SL_CLI_COMMAND_GROUP(zcl_identify_cluster_command_table, "ZCL identify cluster commands");', ) expect(genResult.content['zap-cli.c']).toContain( - '{ "identify", &cli_cmd_identify_group, false },' + '{ "identify", &cli_cmd_identify_group, false },', ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-zigbee-5.test.js b/test/gen-zigbee-5.test.js index 2864583783..22ad3906d4 100644 --- a/test/gen-zigbee-5.test.js +++ b/test/gen-zigbee-5.test.js @@ -39,7 +39,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) return zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, testUtil.timeout.medium()) @@ -54,7 +54,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) templatePkgId = context.packageId expect(context.crc).not.toBeNull() @@ -65,7 +65,7 @@ test( expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -73,11 +73,11 @@ test( async () => { templateContext.packages = await queryPackage.getPackageByParent( templateContext.db, - templateContext.packageId + templateContext.packageId, ) expect(templateContext.packages.length).toBe(templateCount - 1 + 3) // -1 for ignored one, two for helpers and one for overridable }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -87,7 +87,7 @@ test( expect(sessionId).not.toBeNull() templateContext.sessionId = sessionId }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -101,12 +101,12 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) expect(packages.length).toBe(2) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -123,7 +123,7 @@ test( { generateOnly: 'zap-config-version-3.h', disableDeprecationWarnings: true, - } + }, ) expect(genResult).not.toBeNull() @@ -133,45 +133,45 @@ test( // Test GENERATED_ATTRIBUTES for the same attribute name but different attribute code expect(cfgVer3).toContain( - '{ 0x0000, ZCL_INT16U_ATTRIBUTE_TYPE, 2, (ATTRIBUTE_MASK_WRITABLE| ATTRIBUTE_MASK_MANUFACTURER_SPECIFIC), { (uint8_t*)0x0000 } }, /* 51 Cluster: Sample Mfg Specific Cluster 2, Attribute: ember sample attribute 2, Side: server*/' + '{ 0x0000, ZCL_INT16U_ATTRIBUTE_TYPE, 2, (ATTRIBUTE_MASK_WRITABLE| ATTRIBUTE_MASK_MANUFACTURER_SPECIFIC), { (uint8_t*)0x0000 } }, /* 51 Cluster: Sample Mfg Specific Cluster 2, Attribute: ember sample attribute 2, Side: server*/', ) expect(cfgVer3).toContain( - '{ 0x0001, ZCL_INT16U_ATTRIBUTE_TYPE, 2, (ATTRIBUTE_MASK_WRITABLE| ATTRIBUTE_MASK_MANUFACTURER_SPECIFIC), { (uint8_t*)0x0000 } }, /* 52 Cluster: Sample Mfg Specific Cluster 2, Attribute: ember sample attribute 2, Side: server*/' + '{ 0x0001, ZCL_INT16U_ATTRIBUTE_TYPE, 2, (ATTRIBUTE_MASK_WRITABLE| ATTRIBUTE_MASK_MANUFACTURER_SPECIFIC), { (uint8_t*)0x0000 } }, /* 52 Cluster: Sample Mfg Specific Cluster 2, Attribute: ember sample attribute 2, Side: server*/', ) // Test GENERATED_CLUSTERS for attribute index and size on endpoint 1 and endpoint 2 expect(cfgVer3).toContain( - '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[43]), 2, 3, CLUSTER_MASK_CLIENT, NULL }, /* 9, Endpoint Id: 1, Cluster: Sample Mfg Specific Cluster, Side: client*/' + '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[43]), 2, 3, CLUSTER_MASK_CLIENT, NULL }, /* 9, Endpoint Id: 1, Cluster: Sample Mfg Specific Cluster, Side: client*/', ) expect(cfgVer3).toContain( - '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[45]), 4, 5, CLUSTER_MASK_SERVER, NULL }, /* 10, Endpoint Id: 1, Cluster: Sample Mfg Specific Cluster, Side: server*/' + '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[45]), 4, 5, CLUSTER_MASK_SERVER, NULL }, /* 10, Endpoint Id: 1, Cluster: Sample Mfg Specific Cluster, Side: server*/', ) expect(cfgVer3).toContain( - '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[43]), 2, 3, CLUSTER_MASK_CLIENT, NULL }, /* 15, Endpoint Id: 2, Cluster: Sample Mfg Specific Cluster, Side: client*/' + '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[43]), 2, 3, CLUSTER_MASK_CLIENT, NULL }, /* 15, Endpoint Id: 2, Cluster: Sample Mfg Specific Cluster, Side: client*/', ) expect(cfgVer3).toContain( - '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[49]), 2, 3, CLUSTER_MASK_CLIENT, NULL }, /* 16, Endpoint Id: 2, Cluster: Sample Mfg Specific Cluster 2, Side: client*/' + '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[49]), 2, 3, CLUSTER_MASK_CLIENT, NULL }, /* 16, Endpoint Id: 2, Cluster: Sample Mfg Specific Cluster 2, Side: client*/', ) expect(cfgVer3).toContain( - '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[45]), 4, 5, CLUSTER_MASK_SERVER, NULL }, /* 17, Endpoint Id: 2, Cluster: Sample Mfg Specific Cluster, Side: server*/' + '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[45]), 4, 5, CLUSTER_MASK_SERVER, NULL }, /* 17, Endpoint Id: 2, Cluster: Sample Mfg Specific Cluster, Side: server*/', ) expect(cfgVer3).toContain( - '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[51]), 3, 5, CLUSTER_MASK_SERVER, NULL } /* 18, Endpoint Id: 2, Cluster: Sample Mfg Specific Cluster 2, Side: server*/' + '{ 0xFC00, (EmberAfAttributeMetadata*)&(generatedAttributes[51]), 3, 5, CLUSTER_MASK_SERVER, NULL } /* 18, Endpoint Id: 2, Cluster: Sample Mfg Specific Cluster 2, Side: server*/', ) // Test GENERATED_COMMANDS and its mask expect(cfgVer3).toContain( - '{ 0xFC00, 0x00, COMMAND_MASK_INCOMING_SERVER | COMMAND_MASK_OUTGOING_CLIENT | COMMAND_MASK_MANUFACTURER_SPECIFIC }, /* 69, Cluster: Sample Mfg Specific Cluster, Command: CommandOne*/' + '{ 0xFC00, 0x00, COMMAND_MASK_INCOMING_SERVER | COMMAND_MASK_OUTGOING_CLIENT | COMMAND_MASK_MANUFACTURER_SPECIFIC }, /* 69, Cluster: Sample Mfg Specific Cluster, Command: CommandOne*/', ) expect(cfgVer3).toContain( - '{ 0xFC00, 0x00, COMMAND_MASK_INCOMING_SERVER | COMMAND_MASK_OUTGOING_CLIENT | COMMAND_MASK_MANUFACTURER_SPECIFIC }, /* 70, Cluster: Sample Mfg Specific Cluster 2, Command: CommandTwo*/' + '{ 0xFC00, 0x00, COMMAND_MASK_INCOMING_SERVER | COMMAND_MASK_OUTGOING_CLIENT | COMMAND_MASK_MANUFACTURER_SPECIFIC }, /* 70, Cluster: Sample Mfg Specific Cluster 2, Command: CommandTwo*/', ) // Test GENERATED_COMMAND_MANUFACTURER_CODES @@ -195,11 +195,11 @@ test( // Making sure that the multi-protocol config is not generated for zigbee only generation expect(cfgVer3).not.toContain( - '#define GENERATED_MULTI_PROTOCOL_ATTRIBUTE_MAPPING' + '#define GENERATED_MULTI_PROTOCOL_ATTRIBUTE_MAPPING', ) expect(cfgVer3).not.toContain('{ 6, 0, 6, 0, 0, 0, 0, 0 },') expect(cfgVer3).not.toContain('{ 8, 0, 8, 0, 0, 0, 0, 0 },') expect(cfgVer3).not.toContain('{ 8, 0, 8, 0, 1, 0, 1, 0 },') }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-zigbee-6.test.js b/test/gen-zigbee-6.test.js index b53b82105f..a32c6e277d 100644 --- a/test/gen-zigbee-6.test.js +++ b/test/gen-zigbee-6.test.js @@ -38,7 +38,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) return zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, testUtil.timeout.medium()) @@ -52,7 +52,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) expect(context.crc).not.toBeNull() expect(context.templateData).not.toBeNull() @@ -62,7 +62,7 @@ test( expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -70,11 +70,11 @@ test( async () => { templateContext.packages = await queryPackage.getPackageByParent( templateContext.db, - templateContext.packageId + templateContext.packageId, ) expect(templateContext.packages.length).toBe(templateCount - 1 + 3) // -1 for ignored one, two for helpers and one for overridable }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -95,42 +95,42 @@ test( 'zap-outgoing-command.out', ], disableDeprecationWarnings: true, - } + }, ) expect(genResult.hasErrors).toBeFalsy() let pv3 = genResult.content['zap-command-parser-ver-3.c'] // Test Cluster command parsers that should be defined expect(pv3).toContain( - 'EmberAfStatus emberAfGroupsClusterClientCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfGroupsClusterClientCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv3).toContain( - 'EmberAfStatus emberAfGroupsClusterServerCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfGroupsClusterServerCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv3).toContain( - 'EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv3).toContain( - 'EmberAfStatus emberAfIdentifyClusterServerCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfIdentifyClusterServerCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv3).toContain( - 'EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv3).toContain( - 'EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv3).toContain( - 'EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv3).toContain( - 'EmberAfStatus emberAfZllCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfZllCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd);', ) // Test Command callback expect(pv3).toContain( - 'wasHandled = emberAfIdentifyClusterIdentifyCallback(identifyTime);' + 'wasHandled = emberAfIdentifyClusterIdentifyCallback(identifyTime);', ) expect(pv3).toContain( - 'wasHandled = emberAfLevelControlClusterMoveToLevelWithOnOffCallback(level, transitionTime);' + 'wasHandled = emberAfLevelControlClusterMoveToLevelWithOnOffCallback(level, transitionTime);', ) // Test command argument declarations for data types greater than 4 // bytes and make sure they are declared as pointers @@ -142,35 +142,35 @@ test( // Test Cluster command parsers that should be defined let pv5 = genResult.content['zap-command-parser-ver-5.c'] expect(pv5).toContain( - 'EmberAfStatus emberAfGroupsClusterClientCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfGroupsClusterClientCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv5).toContain( - 'EmberAfStatus emberAfGroupsClusterServerCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfGroupsClusterServerCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv5).toContain( - 'EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfIdentifyClusterClientCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv5).toContain( - 'EmberAfStatus emberAfIdentifyClusterServerCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfIdentifyClusterServerCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv5).toContain( - 'EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfLevelControlClusterServerCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv5).toContain( - 'EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfOnOffClusterServerCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv5).toContain( - 'EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfScenesClusterServerCommandParse(EmberAfClusterCommand * cmd);', ) expect(pv5).toContain( - 'EmberAfStatus emberAfZllCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd);' + 'EmberAfStatus emberAfZllCommissioningClusterClientCommandParse(EmberAfClusterCommand * cmd);', ) // Test Command callback expect(pv5).toContain( - 'wasHandled = emberAfIdentifyClusterIdentifyCallback(identifyTime);' + 'wasHandled = emberAfIdentifyClusterIdentifyCallback(identifyTime);', ) expect(pv5).toContain( - 'wasHandled = emberAfLevelControlClusterMoveToLevelWithOnOffCallback(level, transitionTime);' + 'wasHandled = emberAfLevelControlClusterMoveToLevelWithOnOffCallback(level, transitionTime);', ) // Test command argument declarations for data types greater than 4 // bytes and make sure they are declared as pointers @@ -189,8 +189,8 @@ test( .join('\n') expect(zapOutgoingCommands).not.toBeNull() expect(zapOutgoingCommands).toContain( - 'Groups client Cluster Outgoing commands\nOutgoing Command: AddGroup\nOutgoing Command: ViewGroup\nOutgoing Command: GetGroupMembership\nOutgoing Command: RemoveGroup\nOutgoing Command: RemoveAllGroups\nOutgoing Command: AddGroupIfIdentifying\nGroups server Cluster Outgoing commands\nOutgoing Command: AddGroupResponse\nOutgoing Command: ViewGroupResponse\nOutgoing Command: GetGroupMembershipResponse\nOutgoing Command: RemoveGroupResponse\nIdentify client Cluster Outgoing commands\nOutgoing Command: Identify\nOutgoing Command: IdentifyQuery\nIdentify server Cluster Outgoing commands\nOutgoing Command: IdentifyQueryResponse\nLevel Control client Cluster Outgoing commands\nOutgoing Command: MoveToLevel\nOutgoing Command: Move\nOutgoing Command: Step\nOutgoing Command: Stop\nOutgoing Command: MoveToLevelWithOnOff\nOutgoing Command: MoveWithOnOff\nOutgoing Command: StepWithOnOff\nOutgoing Command: StopWithOnOff\nOn/off client Cluster Outgoing commands\nOutgoing Command: Off\nOutgoing Command: On\nOutgoing Command: Toggle\nScenes server Cluster Outgoing commands\nOutgoing Command: AddSceneResponse\nOutgoing Command: ViewSceneResponse\nOutgoing Command: RemoveSceneResponse\nOutgoing Command: RemoveAllScenesResponse\nOutgoing Command: StoreSceneResponse\nOutgoing Command: GetSceneMembershipResponse\nZLL Commissioning client Cluster Outgoing commands\nOutgoing Command: ScanRequest\nOutgoing Command: DeviceInformationRequest\nOutgoing Command: IdentifyRequest\nOutgoing Command: ResetToFactoryNewRequest\nOutgoing Command: NetworkStartRequest\nOutgoing Command: NetworkJoinRouterRequest\nOutgoing Command: NetworkJoinEndDeviceRequest\nOutgoing Command: NetworkUpdateRequest\nZLL Commissioning server Cluster Outgoing commands\nOutgoing Command: ScanResponse\nOutgoing Command: DeviceInformationResponse\nOutgoing Command: NetworkStartResponse\nOutgoing Command: NetworkJoinRouterResponse\nOutgoing Command: NetworkJoinEndDeviceResponse\nOutgoing Command: EndpointInformation\nOutgoing Command: GetGroupIdentifiersResponse\nOutgoing Command: GetEndpointListResponse' + 'Groups client Cluster Outgoing commands\nOutgoing Command: AddGroup\nOutgoing Command: ViewGroup\nOutgoing Command: GetGroupMembership\nOutgoing Command: RemoveGroup\nOutgoing Command: RemoveAllGroups\nOutgoing Command: AddGroupIfIdentifying\nGroups server Cluster Outgoing commands\nOutgoing Command: AddGroupResponse\nOutgoing Command: ViewGroupResponse\nOutgoing Command: GetGroupMembershipResponse\nOutgoing Command: RemoveGroupResponse\nIdentify client Cluster Outgoing commands\nOutgoing Command: Identify\nOutgoing Command: IdentifyQuery\nIdentify server Cluster Outgoing commands\nOutgoing Command: IdentifyQueryResponse\nLevel Control client Cluster Outgoing commands\nOutgoing Command: MoveToLevel\nOutgoing Command: Move\nOutgoing Command: Step\nOutgoing Command: Stop\nOutgoing Command: MoveToLevelWithOnOff\nOutgoing Command: MoveWithOnOff\nOutgoing Command: StepWithOnOff\nOutgoing Command: StopWithOnOff\nOn/off client Cluster Outgoing commands\nOutgoing Command: Off\nOutgoing Command: On\nOutgoing Command: Toggle\nScenes server Cluster Outgoing commands\nOutgoing Command: AddSceneResponse\nOutgoing Command: ViewSceneResponse\nOutgoing Command: RemoveSceneResponse\nOutgoing Command: RemoveAllScenesResponse\nOutgoing Command: StoreSceneResponse\nOutgoing Command: GetSceneMembershipResponse\nZLL Commissioning client Cluster Outgoing commands\nOutgoing Command: ScanRequest\nOutgoing Command: DeviceInformationRequest\nOutgoing Command: IdentifyRequest\nOutgoing Command: ResetToFactoryNewRequest\nOutgoing Command: NetworkStartRequest\nOutgoing Command: NetworkJoinRouterRequest\nOutgoing Command: NetworkJoinEndDeviceRequest\nOutgoing Command: NetworkUpdateRequest\nZLL Commissioning server Cluster Outgoing commands\nOutgoing Command: ScanResponse\nOutgoing Command: DeviceInformationResponse\nOutgoing Command: NetworkStartResponse\nOutgoing Command: NetworkJoinRouterResponse\nOutgoing Command: NetworkJoinEndDeviceResponse\nOutgoing Command: EndpointInformation\nOutgoing Command: GetGroupIdentifiersResponse\nOutgoing Command: GetEndpointListResponse', ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-zigbee-7.test.js b/test/gen-zigbee-7.test.js index c8242528df..d4a3a85f54 100644 --- a/test/gen-zigbee-7.test.js +++ b/test/gen-zigbee-7.test.js @@ -37,7 +37,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) return zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, testUtil.timeout.medium()) @@ -51,7 +51,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) expect(context.crc).not.toBeNull() expect(context.templateData).not.toBeNull() @@ -61,7 +61,7 @@ test( expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -69,11 +69,11 @@ test( async () => { templateContext.packages = await queryPackage.getPackageByParent( templateContext.db, - templateContext.packageId + templateContext.packageId, ) expect(templateContext.packages.length).toBe(templateCount - 1 + 3) // -1 for ignored one, two for helpers and one for overridable }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -81,7 +81,7 @@ test( async () => { let { sessionId, errors, warnings } = await importJs.importDataFromFile( db, - testFile + testFile, ) expect(errors.length).toBe(0) expect(warnings.length).toBe(0) @@ -90,7 +90,7 @@ test( let result = await zclLoader.loadIndividualFile( db, testUtil.testCustomXml2, - sessionId + sessionId, ) if (!result.succeeded) { console.log(result) @@ -105,7 +105,7 @@ test( { generateOnly: 'zap-command-parser-ver-4.c', disableDeprecationWarnings: true, - } + }, ) let pv4 = genResult.content['zap-command-parser-ver-4.c'] @@ -113,19 +113,19 @@ test( expect(pv4).toContain('case 0xFC57: //Manufacturing Specific cluster') expect(pv4).toContain('case 0x1217: // Cluster: SL Works With All Hubs') expect(pv4).toContain( - 'result = emberAfSlWorksWithAllHubsClusterClientCommandParse(cmd);' + 'result = emberAfSlWorksWithAllHubsClusterClientCommandParse(cmd);', ) expect(pv4).toContain('case 0xFC02: //Manufacturing Specific cluster') expect(pv4).toContain('case 0x1002: // Cluster: MFGLIB Cluster') expect(pv4).toContain( - 'result = emberAfMfglibClusterClusterServerCommandParse(cmd);' + 'result = emberAfMfglibClusterClusterServerCommandParse(cmd);', ) // Load a custom xml with device types result = await zclLoader.loadIndividualFile( db, testUtil.testCustomXmlDeviceType, - sessionId + sessionId, ) if (!result.succeeded) { console.log(result) @@ -137,7 +137,7 @@ test( db, result.packageId, 0x0002, - 'DUT-Server' + 'DUT-Server', ) expect(customDeviceType).not.toBeNull() expect(customDeviceType.name).toBe('DUT-Server') @@ -146,9 +146,9 @@ test( let deviceTypeClusters = await queryDeviceType.selectDeviceTypeClustersByDeviceTypeRef( db, - customDeviceType.id + customDeviceType.id, ) expect(deviceTypeClusters.length).toBe(2) // 2 device type clusters associated with this device type. }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/gen-zigbee-8.test.js b/test/gen-zigbee-8.test.js index c221440fc7..9146706aa0 100644 --- a/test/gen-zigbee-8.test.js +++ b/test/gen-zigbee-8.test.js @@ -38,7 +38,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) return zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, testUtil.timeout.medium()) @@ -52,7 +52,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) expect(context.crc).not.toBeNull() expect(context.templateData).not.toBeNull() @@ -62,7 +62,7 @@ test( expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -70,11 +70,11 @@ test( async () => { templateContext.packages = await queryPackage.getPackageByParent( templateContext.db, - templateContext.packageId + templateContext.packageId, ) expect(templateContext.packages.length).toBe(templateCount - 1 + 3) // -1 for ignored one, two for helpers and one for overridable }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -83,7 +83,7 @@ test( // Import a zap file which already has a custom xml file reference let { sessionId, errors, warnings } = await importJs.importDataFromFile( db, - testFile + testFile, ) expect(errors.length).toBe(0) expect(warnings.length).toBe(0) @@ -102,7 +102,7 @@ test( 'zap-id.h', ], disableDeprecationWarnings: true, - } + }, ) // Check if the types are generated correctly // Test custom enum generation @@ -125,13 +125,13 @@ test( // Test custom command coming from standard cluster extensions(identify cluster extension) expect(commands).toContain( - '#define emberAfFillCommandIdentifyClusterSampleMfgSpecificIdentifyCommand1' + '#define emberAfFillCommandIdentifyClusterSampleMfgSpecificIdentifyCommand1', ) // Test command structs genereted let structs = genResult.content['zap-command-structs.h'] expect(structs).toContain( - 'typedef struct __zcl_custom_cluster_cluster_c14_command' + 'typedef struct __zcl_custom_cluster_cluster_c14_command', ) expect(structs).toContain('sl_zcl_custom_cluster_cluster_c5_command_t;') @@ -160,25 +160,27 @@ test( expect( splitIds[1] .trimStart() - .startsWith('#define ZCL_CLUSTER_REVISION_SERVER_ATTRIBUTE_ID (0xFFFD)') + .startsWith( + '#define ZCL_CLUSTER_REVISION_SERVER_ATTRIBUTE_ID (0xFFFD)', + ), ).toBeTruthy() // Test custom attributes coming from standard cluster extensions(identify cluster extension) expect(ids).toContain( - '#define ZCL_SAMPLE_MFG_SPECIFIC_IDENTIFY_1_ATTRIBUTE_ID (0x0000)' + '#define ZCL_SAMPLE_MFG_SPECIFIC_IDENTIFY_1_ATTRIBUTE_ID (0x0000)', ) // Delete the custom xml packageId from the existing session and test generation again let allSessionPackages = await queryPackage.getSessionPackages( db, - sessionId + sessionId, ) let packageInfoPromises = allSessionPackages.map((pkg) => - queryPackage.getPackageByPackageId(db, pkg.packageRef) + queryPackage.getPackageByPackageId(db, pkg.packageRef), ) let zclCustomXmlPackages = await Promise.all(packageInfoPromises).then( (sessionPackages) => - sessionPackages.filter((pkg) => pkg.type == 'zcl-xml-standalone') + sessionPackages.filter((pkg) => pkg.type == 'zcl-xml-standalone'), ) let xmlPackageRemovalPromises = [] for (let i = 0; i < zclCustomXmlPackages.length; i++) { @@ -186,14 +188,14 @@ test( await querySession.selectSessionPartitionInfoFromPackageId( db, sessionId, - zclCustomXmlPackages[i].id + zclCustomXmlPackages[i].id, ) xmlPackageRemovalPromises.push( queryPackage.deleteSessionPackage( db, sessionPartitionInfo[0].sessionPartitionId, - zclCustomXmlPackages[i].id - ) + zclCustomXmlPackages[i].id, + ), ) } await Promise.all(xmlPackageRemovalPromises) @@ -214,20 +216,20 @@ test( 'zap-id.h', ], disableDeprecationWarnings: true, - } + }, ) ids = genResult.content['zap-id.h'] commands = genResult.content['zap-command-ver-2.h'] // Test custom attributes removal coming from standard cluster extensions(identify cluster extension) expect(ids).not.toContain( - '#define ZCL_SAMPLE_MFG_SPECIFIC_IDENTIFY_1_ATTRIBUTE_ID (0x0000)' + '#define ZCL_SAMPLE_MFG_SPECIFIC_IDENTIFY_1_ATTRIBUTE_ID (0x0000)', ) // Test custom command removal coming from standard cluster extensions(identify cluster extension) expect(commands).not.toContain( - '#define emberAfFillCommandIdentifyClusterSampleMfgSpecificIdentifyCommand1' + '#define emberAfFillCommandIdentifyClusterSampleMfgSpecificIdentifyCommand1', ) }, - testUtil.timeout.long() * 2 + testUtil.timeout.long() * 2, ) diff --git a/test/gen-zigbee-9.test.js b/test/gen-zigbee-9.test.js index 7563c71fc5..90cc884156 100644 --- a/test/gen-zigbee-9.test.js +++ b/test/gen-zigbee-9.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) return zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, testUtil.timeout.medium()) @@ -52,7 +52,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee2 + testUtil.testTemplate.zigbee2, ) expect(context.crc).not.toBeNull() expect(context.templateData).not.toBeNull() @@ -62,7 +62,7 @@ test( expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -70,11 +70,11 @@ test( async () => { templateContext.packages = await queryPackage.getPackageByParent( templateContext.db, - templateContext.packageId + templateContext.packageId, ) expect(templateContext.packages.length).toBe(templateCount) // -1 for ignored one, one for helper and one for overridable }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -85,12 +85,12 @@ test( let { sid, errors, warnings } = await importJs.importDataFromFile( db, testFile, - { sessionId: sessionId } + { sessionId: sessionId }, ) expect(errors.length).toBe(0) expect(warnings.length).toBe(0) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) // We here generate each one separatelly in a separate test case. @@ -120,10 +120,10 @@ test.each([ { generateOnly: item, disableDeprecationWarnings: true, - } + }, ) expect(genResult.hasErrors).not.toBeTruthy() }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/generation.test.js b/test/generation.test.js index 6fe40cd5f0..808a4e5663 100644 --- a/test/generation.test.js +++ b/test/generation.test.js @@ -41,7 +41,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) @@ -57,7 +57,7 @@ describe('Content indexer', () => { let preview = await generationEngine.contentIndexer('Short example') expect(preview['1']).toBe('Short example\n') }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -65,13 +65,13 @@ describe('Content indexer', () => { async () => { let preview = await generationEngine.contentIndexer( 'Short example\nwith three\nlines of text', - 1 + 1, ) expect(preview['1']).toBe('Short example\n') expect(preview['2']).toBe('with three\n') expect(preview['3']).toBe('lines of text\n') }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -88,7 +88,7 @@ describe('Content indexer', () => { expect(preview['3'].startsWith('line 100')).toBeTruthy() expect(preview['20'].startsWith('line 950')).toBeTruthy() }, - testUtil.timeout.short() + testUtil.timeout.short(), ) }) @@ -99,13 +99,13 @@ describe('Session specific tests', () => { let cnt = await testQuery.selectCountFrom(db, 'SESSION') expect(cnt).toBe(0) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( 'Now actually load the static data.', () => zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -113,7 +113,7 @@ describe('Session specific tests', () => { async () => { let context = await generationEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) let packageId = context.packageId templatePkgId = packageId @@ -124,7 +124,7 @@ describe('Session specific tests', () => { let extensions = await queryPackage.selectPackageExtension( db, packageId, - dbEnum.packageExtensionEntity.cluster + dbEnum.packageExtensionEntity.cluster, ) expect(extensions.length).toBe(2) @@ -136,26 +136,26 @@ describe('Session specific tests', () => { expect(extensions[0].globalDefault).toBe(null) expect(extensions[0].defaults.length).toBe(3) expect(extensions[1].label).toBe( - 'Test cluster extension with external defaults values' + 'Test cluster extension with external defaults values', ) expect(extensions[1].globalDefault).toBe(null) expect(extensions[1].defaults.length).toBe(2) expect(extensions[1].defaults[0].value).toBe( - 'Extension value loaded via external default JSON file.' + 'Extension value loaded via external default JSON file.', ) // Test for command package extensions extensions = await queryPackage.selectPackageExtension( db, packageId, - dbEnum.packageExtensionEntity.command + dbEnum.packageExtensionEntity.command, ) expect(extensions.length).toBe(2) let tcIndex = 1 let icIndex = 0 expect(extensions[tcIndex].entity).toBe( - dbEnum.packageExtensionEntity.command + dbEnum.packageExtensionEntity.command, ) expect(extensions[tcIndex].property).toBe('testCommandExtension') expect(extensions[tcIndex].type).toBe('boolean') @@ -168,7 +168,7 @@ describe('Session specific tests', () => { extensions = await queryPackage.selectPackageExtension( db, packageId, - dbEnum.packageExtensionEntity.attribute + dbEnum.packageExtensionEntity.attribute, ) expect(extensions.length).toBe(2) @@ -192,7 +192,7 @@ describe('Session specific tests', () => { extensions = await queryPackage.selectPackageExtension( db, packageId, - dbEnum.packageExtensionEntity.attributeType + dbEnum.packageExtensionEntity.attributeType, ) expect(extensions.length).toBe(1) @@ -201,13 +201,13 @@ describe('Session specific tests', () => { db, packageId, 'implementedCommands', - dbEnum.packageExtensionEntity.command + dbEnum.packageExtensionEntity.command, ) expect(extensions.type).toBe('boolean') expect(extensions.globalDefault).toBe('0') expect(extensions.defaults.length).toBe(5) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -220,10 +220,10 @@ describe('Session specific tests', () => { 'USER', uuid, env.builtinSilabsZclMetafile(), - env.builtinTemplateMetafile() + env.builtinTemplateMetafile(), ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) let templateCount = 0 @@ -231,42 +231,42 @@ describe('Session specific tests', () => { 'test retrieval of all preview template files', async () => { let response = await axios.get( - `${baseUrl}/preview/?sessionId=${uuid}&templatePackageId=${templatePkgId}` + `${baseUrl}/preview/?sessionId=${uuid}&templatePackageId=${templatePkgId}`, ) templateCount = response.data['length'] for (let i = 0; i < response.data['length']; i++) { expect(response.data[i]['version']).toBeDefined() } }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( 'test that zcl extension is loaded and exists', async () => { let response = await axios.get( - `${baseUrl}/zclExtension/cluster/testClusterExtension1?sessionId=${uuid}` + `${baseUrl}/zclExtension/cluster/testClusterExtension1?sessionId=${uuid}`, ) expect(response.data.entity).toBe('cluster') expect(response.data.property).toBe('testClusterExtension1') expect(response.data.label).toBe( - 'Test cluster extension with external defaults values' + 'Test cluster extension with external defaults values', ) expect(response.data.defaults[0].entityCode).toBe('0x0003') expect(response.data.defaults[0].value).toBe( - 'Extension value loaded via external default JSON file.' + 'Extension value loaded via external default JSON file.', ) expect(response.data.defaults[1].entityCode).toBe( - 'clusterCode mixed with strings' + 'clusterCode mixed with strings', ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( 'Load a second set of templates.', () => generationEngine.loadTemplates(db, testUtil.testTemplate.matter), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) // Make sure all templates are loaded @@ -275,11 +275,11 @@ describe('Session specific tests', () => { async () => { let pkgs = await queryPackage.getPackagesByType( db, - dbEnum.packageType.genSingleTemplate + dbEnum.packageType.genSingleTemplate, ) expect(templateCount).toBeLessThan(pkgs.length) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -288,39 +288,39 @@ describe('Session specific tests', () => { let response = await axios.get(`${baseUrl}/preview/?sessionId=${uuid}`) expect(templateCount).toEqual(response.data['length']) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( 'test that there is generation data in the simple-test.out preview file. Index 1', async () => { let response = await axios.get( - `${baseUrl}/preview/simple-test.out/1?sessionId=${uuid}` + `${baseUrl}/preview/simple-test.out/1?sessionId=${uuid}`, ) expect(response.data['result']).toMatch('Test template file.') }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( 'No generation test, incorrect file name', async () => { let response = await axios.get( - `${baseUrl}/preview/no-file?sessionId=${uuid}` + `${baseUrl}/preview/no-file?sessionId=${uuid}`, ) expect(response.data['result']).toBeUndefined() }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( 'No generation test, incorrect file name and incorrect index', async () => { let response = await axios.get( - `${baseUrl}/preview/no-file/1?sessionId=${uuid}` + `${baseUrl}/preview/no-file/1?sessionId=${uuid}`, ) expect(response.data['result']).toBeUndefined() }, - testUtil.timeout.short() + testUtil.timeout.short(), ) }) diff --git a/test/helper-api.test.js b/test/helper-api.test.js index 08ace9b0c1..c7a7024587 100644 --- a/test/helper-api.test.js +++ b/test/helper-api.test.js @@ -35,7 +35,7 @@ test( } } }, - timeout.short() + timeout.short(), ) test( @@ -46,14 +46,14 @@ test( let dups = api.duplicates.join(', ') expect(dups).toBe('') }, - timeout.short() + timeout.short(), ) test( 'Compare APIs against the baseline.', () => { let apiFromFile = JSON.parse( - fs.readFileSync(path.join(__dirname, 'helper-api-baseline.json')) + fs.readFileSync(path.join(__dirname, 'helper-api-baseline.json')), ) let api = templateEngine.allBuiltInHelpers() @@ -71,5 +71,5 @@ test( }) expect(errorMessage).toEqual('') }, - timeout.short() + timeout.short(), ) diff --git a/test/helpers.test.js b/test/helpers.test.js index fb2f5e1d74..b2680f24a7 100644 --- a/test/helpers.test.js +++ b/test/helpers.test.js @@ -39,7 +39,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) @@ -50,7 +50,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) expect(context.crc).not.toBeNull() @@ -58,11 +58,11 @@ test( expect(context.templateData.name).toEqual('Test templates') expect(context.templateData.version).toEqual('test-v1') expect(context.templateData.templates.length).toEqual( - testUtil.testTemplate.zigbeeCount + testUtil.testTemplate.zigbeeCount, ) expect(context.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -80,7 +80,7 @@ test( global: globalCtx, } }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) /* @@ -92,7 +92,7 @@ test( () => { expect(cHelper.add_one(52)).toEqual(53) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -101,7 +101,7 @@ test( expect(cHelper.is_number_greater_than(3, 2)).toBeTruthy expect(cHelper.is_number_greater_than(1, 2)).toBeFalsy }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -110,19 +110,19 @@ test( let result = await cHelper.data_type_for_enum( db, 'patate', - zclContext.packageId + zclContext.packageId, ) expect(result).toBe('!!Invalid enum: patate') result = await cHelper.data_type_for_enum( db, 'Status', - zclContext.packageId + zclContext.packageId, ) expect(result).toBe('SL_CLI_ARG_UINT8') }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -131,37 +131,37 @@ test( let result = await cHelper.dataTypeForBitmap( db, 'patate', - zclContext.packageId + zclContext.packageId, ) expect(result).toBe('!!Invalid bitmap: patate') result = await cHelper.dataTypeForBitmap( db, 'LocationType', - zclContext.packageId + zclContext.packageId, ) expect(result).toBe('SL_CLI_ARG_UINT8') }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( 'Various String helper', () => { expect(cHelper.cleanseLabelAsKebabCase('Very Simple:Label')).toEqual( - 'very-simple-label' + 'very-simple-label', ) // Might want to add CamelCased string expect(cHelper.asUnderscoreLowercase('testString')).toBe('test_string') expect(cHelper.asSpacedLowercase('testString')).toBe('test string') expect(cHelper.asUnderscoreUppercase('bigTestString')).toBe( - 'BIG_TEST_STRING' + 'BIG_TEST_STRING', ) expect(cHelper.asUnderscoreUppercase('BigTestString')).toBe( - 'BIG_TEST_STRING' + 'BIG_TEST_STRING', ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -181,7 +181,7 @@ test( .then((result) => expect(result).toBe('0x39, 0x00')) ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -194,7 +194,7 @@ test( expect(cHelper.formatValue('42', 1)).toBe('0x2A') expect(cHelper.formatValue('g', 1)).toBe('0x00') }, - testUtil.timeout.short() + testUtil.timeout.short(), ) /* @@ -231,7 +231,7 @@ test( expect(result).toBe(dbEnum.zclType.struct) }) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -244,7 +244,7 @@ test( return expect(res).toBe('0x40, 0x38, 0x00, ') }) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -257,7 +257,7 @@ test( return expect(res).toBe(' 0x00, 0x38, 0x40,') }) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -268,7 +268,7 @@ test( .as_generated_default_macro('0x00003840', 4, options) .then((res) => expect(res).toBe('0x40, 0x38, 0x00, 0x00, ')) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -279,7 +279,7 @@ test( .as_generated_default_macro('0x00003840', 4, options) .then((res) => expect(res).toBe(' 0x00, 0x00, 0x38, 0x40,')) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -289,10 +289,10 @@ test( return zclHelper .as_generated_default_macro('-5', 8, options) .then((res) => - expect(res).toBe(' 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB,') + expect(res).toBe(' 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB,'), ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -302,10 +302,10 @@ test( return zclHelper .as_generated_default_macro('-5', 8, options) .then((res) => - expect(res).toBe('0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, ') + expect(res).toBe('0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, '), ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -316,7 +316,7 @@ test( .as_generated_default_macro('-5', 5, options) .then((res) => expect(res).toBe(' 0xFF, 0xFF, 0xFF, 0xFF, 0xFB,')) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -327,7 +327,7 @@ test( .as_generated_default_macro('-5', 5, options) .then((res) => expect(res).toBe('0xFB, 0xFF, 0xFF, 0xFF, 0xFF, ')) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -337,10 +337,10 @@ test( return zclHelper .as_generated_default_macro('17.0', 8, options) .then((res) => - expect(res).toBe('0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x40, ') + expect(res).toBe('0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x40, '), ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -350,10 +350,10 @@ test( return zclHelper .as_generated_default_macro('17.0', 8, options) .then((res) => - expect(res).toBe(' 0x40, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,') + expect(res).toBe(' 0x40, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,'), ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -363,10 +363,10 @@ test( return zclHelper .as_generated_default_macro('-17.0', 8, options) .then((res) => - expect(res).toBe('0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0xC0, ') + expect(res).toBe('0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0xC0, '), ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -376,10 +376,10 @@ test( return zclHelper .as_generated_default_macro('-17.0', 8, options) .then((res) => - expect(res).toBe(' 0xC0, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,') + expect(res).toBe(' 0xC0, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,'), ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -390,7 +390,7 @@ test( .as_generated_default_macro('549755813887', 5, options) .then((res) => expect(res).toBe(' 0x7F, 0xFF, 0xFF, 0xFF, 0xFF,')) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -401,7 +401,7 @@ test( .as_generated_default_macro('549755813887', 5, options) .then((res) => expect(res).toBe('0xFF, 0xFF, 0xFF, 0xFF, 0x7F, ')) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -412,7 +412,7 @@ test( .as_generated_default_macro('140737488355327', 6, options) .then((res) => expect(res).toBe(' 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,')) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -423,7 +423,7 @@ test( .as_generated_default_macro('140737488355327', 6, options) .then((res) => expect(res).toBe('0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, ')) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -433,10 +433,10 @@ test( return zclHelper .as_generated_default_macro('140737488355327', 7, options) .then((res) => - expect(res).toBe('0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,') + expect(res).toBe('0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,'), ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -446,10 +446,10 @@ test( return zclHelper .as_generated_default_macro('140737488355327', 7, options) .then((res) => - expect(res).toBe('0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00,') + expect(res).toBe('0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00,'), ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -459,10 +459,10 @@ test( return zclHelper .as_generated_default_macro('140737488355327', 8, options) .then((res) => - expect(res).toBe('0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,') + expect(res).toBe('0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,'), ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -472,10 +472,10 @@ test( return zclHelper .as_generated_default_macro('140737488355327', 8, options) .then((res) => - expect(res).toBe('0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,') + expect(res).toBe('0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00,'), ) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -486,7 +486,7 @@ test( .as_generated_default_macro('abc', 5, options) .then((res) => expect(res).toBe("0x03, 'a', 'b', 'c', 0, ")) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -499,7 +499,7 @@ test( .as_generated_default_macro('abc', 259, options) .then((res) => expect(res).toContain("0x03, 0x00, 'a', 'b', 'c', 0, ")) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -518,13 +518,13 @@ test( 'server', 0, 'ATTRIBUTE_MASK_', - '' - ) + '', + ), ) .then((res) => - expect(res).toBe('ATTRIBUTE_MASK_WRITABLE| ATTRIBUTE_MASK_MIN_MAX') + expect(res).toBe('ATTRIBUTE_MASK_WRITABLE| ATTRIBUTE_MASK_MIN_MAX'), ), - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -534,10 +534,10 @@ test( .command_mask('client', 'either', 1, 1, 0, 'COMMAND_MASK_') .then((res) => expect(res).toBe( - 'COMMAND_MASK_INCOMING_SERVER | COMMAND_MASK_OUTGOING_CLIENT' - ) + 'COMMAND_MASK_INCOMING_SERVER | COMMAND_MASK_OUTGOING_CLIENT', + ), ), - testUtil.timeout.short() + testUtil.timeout.short(), ) /* @@ -548,7 +548,7 @@ test( () => { expect(zapHelper.is_lowercase_equal('A', 'a')).toBeTruthy() }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -558,7 +558,7 @@ test( expect(zapHelper.is_num_equal(2, 1)).toBeFalsy() expect(zapHelper.is_num_equal('1', 1)).toBeTruthy() }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -569,7 +569,7 @@ test( expect(zapHelper.is_defined(null)).toBeFalsy() expect(zapHelper.is_defined(undefined)).toBeFalsy() }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -577,5 +577,5 @@ test( () => { expect(zapHelper.replace_string('testString', 'test', '')).toBe('String') }, - testUtil.timeout.short() + testUtil.timeout.short(), ) diff --git a/test/ide-integration.test.js b/test/ide-integration.test.js index e703ec1559..4174840330 100644 --- a/test/ide-integration.test.js +++ b/test/ide-integration.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) let zclContext = await zclLoader.loadZcl(db, testUtil.testZclMetafile) zclPackageId = zclContext.packageId @@ -53,7 +53,7 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.meta + testUtil.testTemplate.meta, ) expect(templateContext.crc).not.toBeNull() expect(templateContext.templateData).not.toBeNull() @@ -61,7 +61,7 @@ test( expect(templateContext.templateData.version).toEqual('meta-test') expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -69,11 +69,11 @@ test( async () => { templateContext.packages = await queryPackage.getPackageByParent( templateContext.db, - templateContext.packageId + templateContext.packageId, ) expect(templateContext.packages.length).toBeGreaterThan(0) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -81,7 +81,7 @@ test( async () => { let { sessionId, errors, warnings } = await importJs.importDataFromFile( db, - testFile + testFile, ) expect(errors.length).toBe(0) expect(warnings.length).toBe(0) @@ -98,10 +98,10 @@ test( db, sessionId, cluster.id, - ['server'] + ['server'], ) expect(ids.length).toBe(1) expect(ids[0]).toEqual('test-1-component') }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/importexport.test.js b/test/importexport.test.js index ebb5274c26..0192b33e23 100644 --- a/test/importexport.test.js +++ b/test/importexport.test.js @@ -43,7 +43,7 @@ let testDoorLockIsc = path.join(__dirname, 'resource/isc/ha-door-lock.isc') let haLightIsc = path.join(__dirname, 'resource/isc/ha-light.isc') let haCombinedInterfaceIsc = path.join( __dirname, - 'resource/isc/ha-combined-interface.isc' + 'resource/isc/ha-combined-interface.isc', ) // Due to future plans to rework how we handle global attributes, @@ -73,14 +73,14 @@ test( async () => { let context = await generationEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) templatePkgId = context.packageId expect(context.crc).not.toBeNull() expect(context.templateData).not.toBeNull() templateContext = context }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -94,7 +94,7 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) let importResult = await importJs.importDataFromFile(db, testFile1) @@ -125,7 +125,7 @@ test( await querySession.deleteSession(db, sid) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -159,7 +159,7 @@ test( // This flag exists for this test due to planned global attribute rework. expect(attributeCount).toBe(bypassGlobalAttributes ? 16 : 28) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -179,7 +179,7 @@ test( x = await testQuery.selectCountFrom(db, 'ENDPOINT_TYPE_EVENT') expect(x).toBe(3) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -190,7 +190,7 @@ test( let endpoints = await queryEndpoint.selectAllEndpoints(db, sid) expect(endpoints.length).toBe(1) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -205,7 +205,7 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) await importJs.importDataFromFile(db, sleepyGenericIsc, { sessionId: sid }) let endpoints = await queryEndpoint.selectAllEndpoints(db, sid) @@ -213,7 +213,7 @@ test( expect(endpoints.length).toBe(1) expect(endpointTypes[0].deviceIdentifier[0]).toBe(1281) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -221,7 +221,7 @@ test( async () => { let state = await importJs.readDataFromFile( testLightIsc, - env.builtinSilabsZclMetafile() + env.builtinSilabsZclMetafile(), ) expect(Object.keys(state.endpointTypes).length).toBe(4) expect(Object.keys(state.endpoint).length).toBe(3) @@ -229,7 +229,7 @@ test( expect(state).not.toHaveProperty('parseState') expect(state.attributeType.length).toBe(6) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -244,7 +244,7 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) await importJs.importDataFromFile(db, testLightIsc, { sessionId: sid }) expect(sid).not.toBeUndefined() @@ -258,11 +258,11 @@ test( let drp = await querySession.getSessionKeyValue( db, sid, - dbEnum.sessionOption.defaultResponsePolicy + dbEnum.sessionOption.defaultResponsePolicy, ) expect(drp).toBe('always') }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -277,7 +277,7 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) await importJs.importDataFromFile(db, testDoorLockIsc, { sessionId: sid }) expect(sid).not.toBeUndefined() @@ -288,18 +288,18 @@ test( expect(endpointTypes[0].deviceIdentifier[0]).toBe(10) let clusterState = await testQuery.getAllEndpointTypeClusterState( db, - endpointTypes[0].id + endpointTypes[0].id, ) expect(clusterState.length).toBe(106) // Reduced by one because Key Establishment had 3 entries with one entry showing up as either side even though it had the client and server side entries {"endpointTypeClusterId":2176,"clusterName":"Key Establishment","clusterCode":2048,"side":"either","enabled":false} let drp = await querySession.getSessionKeyValue( db, sid, - dbEnum.sessionOption.defaultResponsePolicy + dbEnum.sessionOption.defaultResponsePolicy, ) expect(drp).toBe('conditional') }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -314,7 +314,7 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) await importJs.importDataFromFile(db, haLightIsc, { sessionId: sid }) expect(sid).not.toBeUndefined() @@ -334,20 +334,20 @@ test( expect(attributeCounts).toStrictEqual([28, 14]) let reportableCounts = attributes.map((atArray) => - atArray.reduce((ac, at) => ac + (at.includedReportable ? 1 : 0), 0) + atArray.reduce((ac, at) => ac + (at.includedReportable ? 1 : 0), 0), ) expect(reportableCounts).toStrictEqual([2, 0]) let boundedCounts = attributes.map((atArray) => - atArray.reduce((ac, at) => ac + (at.bounded ? 1 : 0), 0) + atArray.reduce((ac, at) => ac + (at.bounded ? 1 : 0), 0), ) expect(boundedCounts).toStrictEqual([13, 4]) let singletonCounts = attributes.map((atArray) => - atArray.reduce((ac, at) => ac + (at.singleton ? 1 : 0), 0) + atArray.reduce((ac, at) => ac + (at.singleton ? 1 : 0), 0), ) expect(singletonCounts).toStrictEqual([8, 11]) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -362,7 +362,7 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) await importJs.importDataFromFile(db, haCombinedInterfaceIsc, { sessionId: sid, @@ -383,21 +383,21 @@ test( expect(attributeCounts).toStrictEqual([9]) let reportableCounts = attributes.map((atArray) => - atArray.reduce((ac, at) => ac + (at.includedReportable ? 1 : 0), 0) + atArray.reduce((ac, at) => ac + (at.includedReportable ? 1 : 0), 0), ) expect(reportableCounts).toStrictEqual([0]) let boundedCounts = attributes.map((atArray) => - atArray.reduce((ac, at) => ac + (at.bounded ? 1 : 0), 0) + atArray.reduce((ac, at) => ac + (at.bounded ? 1 : 0), 0), ) expect(boundedCounts).toStrictEqual([3]) let singletonCounts = attributes.map((atArray) => - atArray.reduce((ac, at) => ac + (at.singleton ? 1 : 0), 0) + atArray.reduce((ac, at) => ac + (at.singleton ? 1 : 0), 0), ) expect(singletonCounts).toStrictEqual([5]) let sessionDump = await util.sessionDump(db, sid) expect(sessionDump.usedPackages.length).toBe(1) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) diff --git a/test/ipc.test.js b/test/ipc.test.js index 1f68d3dfa9..8e1b8fecc7 100644 --- a/test/ipc.test.js +++ b/test/ipc.test.js @@ -42,7 +42,7 @@ test( await ipcServer.initServer() expect(ipcServer.isServerRunning()).toBeTruthy() }, - timeout.medium() + timeout.medium(), ) test('test no client', () => expect(ipcClient.isClientConnected()).toBeFalsy()) @@ -53,7 +53,7 @@ test( await ipcClient.initAndConnectClient() expect(ipcClient.isClientConnected()).toBeTruthy() }, - timeout.medium() + timeout.medium(), ) test( @@ -61,7 +61,7 @@ test( () => { expect(ipcClient.lastPongData()).toBeFalsy() }, - timeout.medium() + timeout.medium(), ) test( @@ -70,14 +70,14 @@ test( await ipcClient.emit(ipcServer.eventType.ping, 'hello') await util.waitFor(responseWaitPeriod) }, - timeout.medium() + timeout.medium(), ) test( 'pong data received', () => { expect(ipcClient.lastPongData()).toEqual('hello') }, - timeout.medium() + timeout.medium(), ) test( @@ -93,7 +93,7 @@ test( let myVersion = env.zapVersion() expect(response.hash).toEqual(myVersion.hash) }, - timeout.medium() + timeout.medium(), ) test('disconnect client', () => ipcClient.disconnectClient(), timeout.short()) @@ -104,5 +104,5 @@ test( ipcServer.shutdownServerSync() expect(ipcServer.isServerRunning()).toBeFalsy() }, - timeout.medium() + timeout.medium(), ) diff --git a/test/mapping.test.js b/test/mapping.test.js index e7619669d6..c492c5b548 100644 --- a/test/mapping.test.js +++ b/test/mapping.test.js @@ -28,5 +28,5 @@ test( dbMapping.map[k]({ a: 1 }) }) }, - timeout.short() + timeout.short(), ) diff --git a/test/matter.test.js b/test/matter.test.js index 6de2021188..64cf87d6cf 100644 --- a/test/matter.test.js +++ b/test/matter.test.js @@ -11,7 +11,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) let ctx = await zclLoader.loadZcl(db, env.builtinMatterZclMetafile()) zclPackageId = ctx.packageId @@ -27,15 +27,15 @@ test( expect(item).toHaveProperty('optionCategory') }) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test('compute storage policy new config', async () => { const result1 = await matter.computeStorageOptionNewConfig( - dbEnum.storagePolicy.attributeAccessInterface + dbEnum.storagePolicy.attributeAccessInterface, ) expect(result1).toEqual(dbEnum.storageOption.external) const result2 = await matter.computeStorageOptionNewConfig( - dbEnum.storagePolicy.any + dbEnum.storagePolicy.any, ) expect(result2).toEqual(dbEnum.storageOption.ram) }) diff --git a/test/mixin.test.js b/test/mixin.test.js index 3d33a5f860..e0a8758278 100644 --- a/test/mixin.test.js +++ b/test/mixin.test.js @@ -25,14 +25,14 @@ test( 'hashAttributeIdClusterId test', () => { expect(CommonMixin.default.methods.hashAttributeIdClusterId(50, 50)).toBe( - 5100 + 5100, ) expect(CommonMixin.default.methods.hashAttributeIdClusterId(50, 35)).toBe( - 3690 + 3690, ) expect(CommonMixin.default.methods.hashAttributeIdClusterId(17, 9)).toBe( - 360 + 360, ) }, - timeout.short() + timeout.short(), ) diff --git a/test/multi-package.test.js b/test/multi-package.test.js index e9742cbccd..562753a365 100644 --- a/test/multi-package.test.js +++ b/test/multi-package.test.js @@ -45,7 +45,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) await zclLoader.loadZcl(db, env.builtinMatterZclMetafile()) await zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) @@ -59,14 +59,14 @@ test('Validate loaded packages', async () => { expect( await testQuery.selectCountFrom( db, - "PACKAGE WHERE PACKAGE.TYPE = 'zcl-properties'" - ) + "PACKAGE WHERE PACKAGE.TYPE = 'zcl-properties'", + ), ).toBe(2) expect( await testQuery.selectCountFrom( db, - "PACKAGE WHERE PACKAGE.TYPE = 'gen-templates-json'" - ) + "PACKAGE WHERE PACKAGE.TYPE = 'gen-templates-json'", + ), ).toBe(2) }) diff --git a/test/multi-protocol.test.js b/test/multi-protocol.test.js index 075a7440a9..1048948e1d 100644 --- a/test/multi-protocol.test.js +++ b/test/multi-protocol.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) // Loading both matter and zigbee zcl files for multi-protocol use case return zclLoader.loadZclMetafiles(db, [ @@ -67,17 +67,17 @@ test( expect(context.templateData[1].name).toEqual('CHIP Tests templates') expect(context.templateData[1].version).toEqual('chip-v1') expect(context.templateData[0].templates.length).toEqual( - zigbeeTemplateCount + zigbeeTemplateCount, ) expect(context.templateData[1].templates.length).toEqual( - matterTemplateCount + matterTemplateCount, ) expect(context.packageIds).not.toBeNull() expect(context.packageIds.length).toEqual(2) expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -86,7 +86,7 @@ test( let importRes = await importJs.importDataFromFile( db, multiProtocolTestFile, - { sessionId: null } + { sessionId: null }, ) expect(importRes.errors.length).toBe(0) expect(importRes.warnings.length).toBe(0) @@ -99,7 +99,7 @@ test( { generateOnly: ['zap-config-version-3.h', 'zap-event.h'], disableDeprecationWarnings: true, - } + }, ) let genResultMatter = await genEngine.generate( db, @@ -109,7 +109,7 @@ test( { generateOnly: 'endpoint-config.c', disableDeprecationWarnings: true, - } + }, ) expect(genResultZigbee.hasErrors).toBeFalsy() expect(genResultMatter.hasErrors).toBeFalsy() @@ -120,43 +120,43 @@ test( // Positive tests endpoint config expect(matterEndpointConfigGen).toContain( - '/* Endpoint: 0, Cluster: Basic Information (server) */' + '/* Endpoint: 0, Cluster: Basic Information (server) */', ) expect(matterEndpointConfigGen).toContain( - '/* Endpoint: 0, Cluster: Descriptor (server) */' + '/* Endpoint: 0, Cluster: Descriptor (server) */', ) expect(zigbeeEndpointConfigGen).toContain( - '#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1)' + '#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1)', ) expect(zigbeeEndpointConfigGen).toContain( - '#define EMBER_AF_ZLL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1)' + '#define EMBER_AF_ZLL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1)', ) // Negative Tests endpoint config expect(matterEndpointConfigGen).not.toContain( - '/* Endpoint: 1, Cluster: Basic (server)' + '/* Endpoint: 1, Cluster: Basic (server)', ) expect(matterEndpointConfigGen).not.toContain( - '/* Endpoint: 1, Cluster: ZLL Commissioning (server) */' + '/* Endpoint: 1, Cluster: ZLL Commissioning (server) */', ) expect(zigbeeEndpointConfigGen).not.toContain( - '#define EMBER_AF_DESCRIPTOR_CLUSTER_SERVER_ENDPOINT_COUNT (1)' + '#define EMBER_AF_DESCRIPTOR_CLUSTER_SERVER_ENDPOINT_COUNT (1)', ) // Global attribute test expect(zigbeeEndpointConfigGen).toContain( - '{ 0xFFFD, ZCL_INT16U_ATTRIBUTE_TYPE, 2, (ATTRIBUTE_MASK_SINGLETON), { (uint8_t*)3 } }, /* 13 Cluster: Basic, Attribute: cluster revision, Side: server*/' + '{ 0xFFFD, ZCL_INT16U_ATTRIBUTE_TYPE, 2, (ATTRIBUTE_MASK_SINGLETON), { (uint8_t*)3 } }, /* 13 Cluster: Basic, Attribute: cluster revision, Side: server*/', ) expect(matterEndpointConfigGen).toContain( - '{ 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */' + '{ 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_SIMPLE_DEFAULT(0) }, /* FeatureMap */', ) expect(matterEndpointConfigGen).toContain( - '{ 0x0000FFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ClusterRevision */' + '{ 0x0000FFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* ClusterRevision */', ) // Test Multi-protocol attribute mapping generation expect(zigbeeEndpointConfigGen).toContain( - '#define GENERATED_MULTI_PROTOCOL_ATTRIBUTE_MAPPING' + '#define GENERATED_MULTI_PROTOCOL_ATTRIBUTE_MAPPING', ) expect(zigbeeEndpointConfigGen).toContain('{ 6, 0, 6, 0, 0, 0, 0, 0 },') expect(zigbeeEndpointConfigGen).toContain('{ 8, 0, 8, 0, 0, 0, 0, 0 },') @@ -165,35 +165,35 @@ test( // Notifications test when opening multi-protocol zap file let sessionNotifications = await querySessionNotice.getNotification( db, - importRes.sessionId + importRes.sessionId, ) let sessionNotificationMessages = sessionNotifications.map( - (sn) => sn.message + (sn) => sn.message, ) // Tests for the feature Map attribute compliance based on device type cluster features expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-onofflight, cluster: On/Off server needs bit 0 enabled in the Feature Map attribute' - ) + '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-onofflight, cluster: On/Off server needs bit 0 enabled in the Feature Map attribute', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-dimmablelight, cluster: Level Control server needs bit 0 enabled in the Feature Map attribute' - ) + '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-dimmablelight, cluster: Level Control server needs bit 0 enabled in the Feature Map attribute', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-dimmablelight, cluster: Level Control server needs bit 1 enabled in the Feature Map attribute' - ) + '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-dimmablelight, cluster: Level Control server needs bit 1 enabled in the Feature Map attribute', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-dimmablelight, cluster: On/Off server needs bit 0 enabled in the Feature Map attribute' - ) + '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-dimmablelight, cluster: On/Off server needs bit 0 enabled in the Feature Map attribute', + ), ).toBeTruthy() // Just one notification regarding multiple top level zcl propertoes and 4 @@ -203,8 +203,8 @@ test( // Test Accumulators in templates let zigbeeEndpointEvents = genResultZigbee.content['zap-event.h'] expect(zigbeeEndpointEvents).toContain( - '#define SL_ZIGBEE_AF_GENERATED_UC_EVENT_CONTEXT_COUNT 1' + '#define SL_ZIGBEE_AF_GENERATED_UC_EVENT_CONTEXT_COUNT 1', ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/mutations.test.js b/test/mutations.test.js index 6a22439752..efbffae5f8 100644 --- a/test/mutations.test.js +++ b/test/mutations.test.js @@ -31,7 +31,7 @@ test( mutations.updateInformationText(state, text) expect(state.informationText).toEqual(text) }, - timeout.short() + timeout.short(), ) test( @@ -47,7 +47,7 @@ test( expect(state.clusters).toEqual(clusters) expect(state.domains).toEqual(domains) }, - timeout.short() + timeout.short(), ) test( @@ -58,7 +58,7 @@ test( mutations.updateSelectedCluster(state, cluster) expect(state.clustersView.selected).toEqual(cluster) }, - timeout.short() + timeout.short(), ) test( @@ -73,13 +73,13 @@ test( let state = ZapState() mutations.updateAttributeDefaults(state, selectionContext) expect(state.attributeView.defaultValue[selectionContext.id]).toEqual( - selectionContext.newDefaultValue + selectionContext.newDefaultValue, ) expect( - state.attributeView.defaultValueValidationIssues[selectionContext.id] + state.attributeView.defaultValueValidationIssues[selectionContext.id], ).toEqual(selectionContext.defaultValueValidationIssues) }, - timeout.short() + timeout.short(), ) test( @@ -90,7 +90,7 @@ test( mutations.updateSelectedEndpoint(state, endpoint) expect(state.endpointView.selectedEndpoint).toEqual(endpoint) }, - timeout.short() + timeout.short(), ) test( @@ -101,7 +101,7 @@ test( mutations.updateAttributes(state, attributes) expect(state.attributes).toEqual(attributes) }, - timeout.short() + timeout.short(), ) test( @@ -112,7 +112,7 @@ test( mutations.updateCommands(state, commands) expect(state.commands).toEqual(commands) }, - timeout.short() + timeout.short(), ) test( @@ -124,7 +124,7 @@ test( expect(state.commandView.selectedIn).toEqual(data.incoming) expect(state.commandView.selectedOut).toEqual(data.outgoing) }, - timeout.short() + timeout.short(), ) test( @@ -135,7 +135,7 @@ test( mutations.initializeDefaultEndpoints(state, endpoints) expect(state.endpointView.endpointId[0]).toEqual(1) }, - timeout.short() + timeout.short(), ) test( @@ -146,7 +146,7 @@ test( mutations.addEndpoint(state, endpoints) expect(state.endpointView.endpointType[0]).toEqual('foo') }, - timeout.short() + timeout.short(), ) test( @@ -162,7 +162,7 @@ test( mutations.updateEndpoint(state, context) expect(state.endpointView['endpointType'][0]).toEqual('bar') }, - timeout.short() + timeout.short(), ) test( @@ -175,7 +175,7 @@ test( mutations.initializeDefaultEndpointsTypes(state, endpointTypes) expect(state.endpointTypeView.name[0]).toEqual(endpointTypes[0].name) }, - timeout.short() + timeout.short(), ) test( @@ -186,7 +186,7 @@ test( mutations.addEndpointType(state, endpointType) expect(state.endpointTypeView.name[0]).toEqual('foo') }, - timeout.short() + timeout.short(), ) test( @@ -201,7 +201,7 @@ test( expect(state.clusterManager.filter.label).toEqual(restApi.noFilter) expect(Object.keys(state.clusterManager.openDomains).length).toBe(0) }, - timeout.short() + timeout.short(), ) test( @@ -222,16 +222,16 @@ test( } mutations.setEndpointTypeAttribute(state, eptAttr) expect( - state.attributeView.selectedAttributes.find((a) => a == eptAttr.id) + state.attributeView.selectedAttributes.find((a) => a == eptAttr.id), ).toBe(5) expect( - state.attributeView.selectedSingleton.find((a) => a == eptAttr.id) + state.attributeView.selectedSingleton.find((a) => a == eptAttr.id), ).toBe(5) expect( - state.attributeView.selectedBounded.find((a) => a == eptAttr.id) + state.attributeView.selectedBounded.find((a) => a == eptAttr.id), ).toBeUndefined() expect( - state.attributeView.selectedReporting.find((a) => a == eptAttr.id) + state.attributeView.selectedReporting.find((a) => a == eptAttr.id), ).toBe(5) expect(state.attributeView.defaultValue[eptAttr.id]).toBe('423') expect(state.attributeView.storageOption[eptAttr.id]).toBe('ram') @@ -239,5 +239,5 @@ test( expect(state.attributeView.reportingMax[eptAttr.id]).toBe(532) expect(state.attributeView.reportableChange[eptAttr.id]).toBe(40) }, - timeout.short() + timeout.short(), ) diff --git a/test/new-matter-data-model.test.js b/test/new-matter-data-model.test.js index 4200056c4f..78d9873358 100644 --- a/test/new-matter-data-model.test.js +++ b/test/new-matter-data-model.test.js @@ -37,7 +37,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) @@ -61,5 +61,5 @@ test( ]) expect(attributes.length).toBeGreaterThanOrEqual(4) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) diff --git a/test/notification.test.js b/test/notification.test.js index 2755eda68c..f1f3e16037 100644 --- a/test/notification.test.js +++ b/test/notification.test.js @@ -38,7 +38,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) @@ -60,7 +60,7 @@ test( message, sessionId, severity, - display + display, ) let notifications = await sessionNotification.getNotification(db, sessionId) @@ -99,7 +99,7 @@ test( } expect(isNotificationDeleted).toBeTruthy() }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test('Notification: mark notification as seen and get unseen count', async () => { @@ -117,7 +117,7 @@ test('Notification: mark notification as seen and get unseen count', async () => message, sessionId, severity, - display + display, ) let notifications = await sessionNotification.getNotification(db, sessionId) @@ -128,7 +128,7 @@ test('Notification: mark notification as seen and get unseen count', async () => // should have 1 unseen notification let unseenCount = await sessionNotification.getUnseenNotificationCount( db, - sessionId + sessionId, ) expect(unseenCount).toBe(1) @@ -138,7 +138,7 @@ test('Notification: mark notification as seen and get unseen count', async () => // should have 0 unseen now unseenCount = await sessionNotification.getUnseenNotificationCount( db, - sessionId + sessionId, ) expect(unseenCount).toBe(0) }) @@ -162,17 +162,17 @@ test( template: env.builtinTemplateMetafile(), }, packageId, - null + null, ) let sessionPartitionInfo = await querySession.getSessionPartitionInfo( db, sessionId, - 2 + 2, ) await queryPackage.insertSessionPackage( db, sessionPartitionInfo[0].sessionPartitionId, - packageId + packageId, ) await packageNotification.setNotification( @@ -180,12 +180,12 @@ test( type, message, packageId, - severity + severity, ) let notifications = await packageNotification.getNotificationBySessionId( db, - sessionId + sessionId, ) let id = 0 @@ -211,7 +211,7 @@ test( notifications = await packageNotification.getNotificationByPackageId( db, - packageId + packageId, ) // check if the notification was successfully deleted @@ -224,5 +224,5 @@ test( } expect(isNotificationDeleted).toBeTruthy() }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/parent-endpoint.test.js b/test/parent-endpoint.test.js index 348984a3aa..275ff25038 100644 --- a/test/parent-endpoint.test.js +++ b/test/parent-endpoint.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) @@ -51,19 +51,19 @@ test( async () => { templateContext = await genEngine.loadTemplates( db, - testUtil.testTemplate.matter + testUtil.testTemplate.matter, ) expect(templateContext.crc).not.toBeNull() expect(templateContext.packageId).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( 'Load ZCL stuff', async () => { zclContext = await zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( 'Test file import', @@ -75,15 +75,15 @@ test( await querySession.selectSessionPartitionInfoFromPackageId( db, sessionId, - zclContext.packageId + zclContext.packageId, ) await queryPackage.insertSessionPackage( db, sessionPartitionInfo[0].sessionPartitionId, - zclContext.packageId + zclContext.packageId, ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( 'Test endpoint config queries', @@ -93,5 +93,5 @@ test( expect(epts[1].parentEndpointIdentifier).toBe(0) expect(epts[2].parentEndpointIdentifier).toBe(1) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/query.test.js b/test/query.test.js index 4b713956a4..912e5db658 100644 --- a/test/query.test.js +++ b/test/query.test.js @@ -61,7 +61,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) @@ -73,7 +73,7 @@ test( let result = await querySession.getSessionDirtyFlag(db, sid) expect(result).toBeFalsy() }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -85,7 +85,7 @@ test( let c = await queryPackage.getPathCrc(db, path) expect(c).toBe(crc) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -94,14 +94,14 @@ test( let rowId = await dbApi.dbInsert( db, 'REPLACE INTO SETTING (CATEGORY, KEY, VALUE) VALUES (?,?,?)', - ['cat', 'key', 12] + ['cat', 'key', 12], ) expect(rowId).toBeGreaterThan(0) let result = await dbApi.dbGet( db, 'SELECT VALUE FROM SETTING WHERE CATEGORY = ? AND KEY = ?', - ['cat', 'key'] + ['cat', 'key'], ) expect(result.VALUE).toBe('12') @@ -109,7 +109,7 @@ test( rowId = await dbApi.dbInsert( db, 'REPLACE INTO SETTING (CATEGORY, KEY, VALUE) VALUES (?,?,?)', - ['cat', 'key', 13] + ['cat', 'key', 13], ) expect(rowId).toBeGreaterThan(0) @@ -117,12 +117,12 @@ test( result = await dbApi.dbGet( db, 'SELECT VALUE FROM SETTING WHERE CATEGORY = ? AND KEY = ?', - ['cat', 'key'] + ['cat', 'key'], ) expect(result.VALUE).toBe('13') }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -152,19 +152,19 @@ test( rows = await queryZcl.selectAttributesByClusterIdIncludingGlobal( db, rowid, - pkgId + pkgId, ) expect(rows.length).toBe(0) rows = await queryCommand.selectCommandsByClusterId(db, rowid, pkgId) expect(rows.length).toBe(0) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( 'Now actually load the static data.', () => zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -172,11 +172,11 @@ test( async () => { let x = await generationEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) templatePkgId = x.packageId }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) describe('Session specific queries', () => { @@ -184,7 +184,7 @@ describe('Session specific queries', () => { let userSession = await querySession.ensureZapUserAndSession( db, 'USER', - 'SESSION' + 'SESSION', ) sid = userSession.sessionId await util.ensurePackagesAndPopulateSessionOptions( @@ -195,7 +195,7 @@ describe('Session specific queries', () => { template: testUtil.testTemplate.zigbee, }, null, - [templatePkgId] + [templatePkgId], ) }, testUtil.timeout.medium()) @@ -205,7 +205,7 @@ describe('Session specific queries', () => { queryPackage .getSessionPackages(db, sid) .then((ids) => expect(ids.length).toBe(2)), - testUtil.timeout.short() + testUtil.timeout.short(), ) // One for zclpropertie and one for gen template test( @@ -222,12 +222,12 @@ describe('Session specific queries', () => { .then((generatorConfigurations) => { expect(generatorConfigurations.length).toBe(1) expect(generatorConfigurations[0].optionCode).toBe( - 'shareClusterStatesAcrossEndpoints' + 'shareClusterStatesAcrossEndpoints', ) expect(generatorConfigurations[0].optionLabel).toBe('true') }) }), - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -236,7 +236,7 @@ describe('Session specific queries', () => { queryPackage .getSessionZclPackages(db, sid) .then((packages) => expect(packages.length).toBe(1)), - testUtil.timeout.short() + testUtil.timeout.short(), ) // One for zclpropertie test( @@ -251,7 +251,7 @@ describe('Session specific queries', () => { value = await querySession.getSessionKeyValue(db, sid, 'nonexistent') expect(value).toBeUndefined() }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -263,7 +263,7 @@ describe('Session specific queries', () => { result = await querySession.getSessionDirtyFlag(db, sid) expect(result).toBeFalsy() }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -275,7 +275,7 @@ describe('Session specific queries', () => { pkgId = ctx.packageId let dts = await queryDeviceType.selectAllDeviceTypes(db, pkgId) let haOnOffDeviceTypeArray = dts.filter( - (data) => data.label === 'HA-onoff' + (data) => data.label === 'HA-onoff', ) let haOnOffDeviceType = haOnOffDeviceTypeArray[0] let deviceTypeId = haOnOffDeviceType.id @@ -288,7 +288,7 @@ describe('Session specific queries', () => { deviceTypeId, haOnOffDeviceType.code, 0, - true + true, ) result = await querySession.getSessionDirtyFlag(db, sid) expect(result).toBeTruthy() @@ -301,7 +301,7 @@ describe('Session specific queries', () => { result = await querySession.getSessionDirtyFlag(db, sid) expect(result).toBeTruthy() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -311,7 +311,7 @@ describe('Session specific queries', () => { let value = await querySession.getSessionKeyValue(db, sid, 'testKey') expect(value).toBe('testValue') }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -322,7 +322,7 @@ describe('Session specific queries', () => { pkgId = ctx.packageId let dts = await queryDeviceType.selectAllDeviceTypes(db, pkgId) let haOnOffDeviceTypeArray = dts.filter( - (data) => data.label === 'HA-onoff' + (data) => data.label === 'HA-onoff', ) let haOnOffDeviceType = haOnOffDeviceTypeArray[0] let deviceTypeId = haOnOffDeviceType.id @@ -336,7 +336,7 @@ describe('Session specific queries', () => { deviceTypeId, haOnOffDeviceType.code, 0, - true + true, ) .then((id) => { endpointTypeId = id @@ -348,7 +348,7 @@ describe('Session specific queries', () => { expect(state.keyValuePairs[0].key).toBe('commandDiscovery') expect(state.keyValuePairs[0].value).toBe('1') expect(state.keyValuePairs[1].key).toBe( - dbEnum.sessionOption.defaultResponsePolicy + dbEnum.sessionOption.defaultResponsePolicy, ) expect(state.keyValuePairs[1].value).toBe('always') expect(state.keyValuePairs[2].key).toBe('key1') @@ -369,16 +369,16 @@ describe('Session specific queries', () => { genIndex = 0 } expect(state.package[zclIndex].type).toBe( - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) expect(state.package[zclIndex].version).toBe(1) expect(state.package[genIndex].type).toBe( - dbEnum.packageType.genTemplatesJson + dbEnum.packageType.genTemplatesJson, ) expect(state.package[genIndex].version).toBe('test-v1') }) }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -387,7 +387,7 @@ describe('Session specific queries', () => { queryEndpoint.deleteEndpoint(db, 123).then((data) => { expect(data).toBe(0) }), - testUtil.timeout.short() + testUtil.timeout.short(), ) }) @@ -403,13 +403,13 @@ describe('Endpoint Type Config Queries', () => { queryPackage.getSessionPackagesByType( db, sid, - dbEnum.packageType.zclProperties - ) + dbEnum.packageType.zclProperties, + ), ) .then((packages) => { pkgId = packages[0].id }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) let endpointTypeIdOnOff @@ -421,10 +421,10 @@ describe('Endpoint Type Config Queries', () => { () => queryDeviceType.selectAllDeviceTypes(db, pkgId).then((rows) => { let haOnOffDeviceTypeArray = rows.filter( - (data) => data.label === 'HA-onoff' + (data) => data.label === 'HA-onoff', ) let zllOnOffLightDeviceTypeArray = rows.filter( - (data) => data.label === 'ZLL-onofflight' + (data) => data.label === 'ZLL-onofflight', ) expect(haOnOffDeviceTypeArray.length > 0).toBeTruthy() expect(zllOnOffLightDeviceTypeArray.length > 0).toBeTruthy() @@ -433,7 +433,7 @@ describe('Endpoint Type Config Queries', () => { expect(typeof haOnOffDeviceType).toBe('object') expect(typeof zllOnOffLightDevice).toBe('object') }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( 'Insert Endpoint Type', @@ -448,8 +448,8 @@ describe('Endpoint Type Config Queries', () => { haOnOffDeviceType.id, 43, 22, - true - ) + true, + ), ) .then((rowId) => { endpointTypeIdOnOff = rowId @@ -462,7 +462,7 @@ describe('Endpoint Type Config Queries', () => { expect(endpointType.deviceVersions[0]).toBe(22) expect(endpointType.deviceIdentifiers[0]).toBe(43) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -483,19 +483,19 @@ describe('Endpoint Type Config Queries', () => { endpointTypeIdOnOff, levelControlCluster.id, 'CLIENT', - true + true, ) }) .then((rowId) => { expect(typeof rowId).toBe('number') }) .then(() => - testQuery.getAllEndpointTypeClusterState(db, endpointTypeIdOnOff) + testQuery.getAllEndpointTypeClusterState(db, endpointTypeIdOnOff), ) .then((clusters) => { expect(clusters.length).toBe(5) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -506,7 +506,7 @@ describe('Endpoint Type Config Queries', () => { .then((attributes) => { expect(attributes.length).toBe(7) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -517,7 +517,7 @@ describe('Endpoint Type Config Queries', () => { .then((commands) => { expect(commands.length).toBe(6) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( 'Test Enpoint ID related query', @@ -527,7 +527,7 @@ describe('Endpoint Type Config Queries', () => { let attributeDefaultValue = 0 let x = await queryZcl.selectEndpointTypeClustersByEndpointTypeId( db, - endpointTypeIdOnOff + endpointTypeIdOnOff, ) expect(x.length).toBe(5) x.forEach((element) => { @@ -539,7 +539,7 @@ describe('Endpoint Type Config Queries', () => { x = await queryZcl.selectEndpointTypeAttributesByEndpointId( db, - endpointTypeIdOnOff + endpointTypeIdOnOff, ) expect(x.length).toBe(7) @@ -554,19 +554,19 @@ describe('Endpoint Type Config Queries', () => { db, endpointTypeIdOnOff, attributeRef, - clusterRef + clusterRef, ) expect(x.defaultValue).toBe(attributeDefaultValue) x = await queryZcl.selectEndpointTypeCommandsByEndpointId( db, - endpointTypeIdOnOff + endpointTypeIdOnOff, ) expect(x.length).toBe(6) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( 'Get all cluster names', @@ -582,10 +582,10 @@ describe('Endpoint Type Config Queries', () => { names.forEach((element) => { expect(expectedNames.includes(element.name)).toBeTruthy() }) - }) + }), ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -597,23 +597,23 @@ describe('Endpoint Type Config Queries', () => { endpointTypeIdOnOff, levelControlCluster.id, 'CLIENT', - true + true, ) .then(() => queryConfig.insertClusterDefaults(db, endpointTypeIdOnOff, pkgId, { clusterRef: levelControlCluster.id, side: 'CLIENT', - }) + }), ) .then(() => testQuery .getEndpointTypeAttributes(db, endpointTypeIdOnOff) .then((attributes) => { expect(attributes.length).toBe(7) - }) + }), ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -630,7 +630,7 @@ describe('Endpoint Type Config Queries', () => { expect(endpoint.networkId).toBe(9) expect(endpoint.endpointTypeRef).toBe(endpointTypeIdOnOff) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -640,16 +640,16 @@ describe('Endpoint Type Config Queries', () => { expect(report.includes('Endpoint: Test endpoint')).toBeTruthy() expect(report.includes('0x0000: cluster: Basic (server)')).toBeTruthy() expect( - report.includes('0x0000: attribute: ZCL version [int8u]') + report.includes('0x0000: attribute: ZCL version [int8u]'), ).toBeTruthy() expect( - report.includes('0x0007: attribute: power source [enum8]') + report.includes('0x0007: attribute: power source [enum8]'), ).toBeTruthy() expect(report.includes('0x0006: cluster: On/off (client)')).toBeTruthy() expect(report.includes('0x0030: cluster: On/off')).toBeFalsy() expect(report.includes('0x00: command: MoveToLevel')).toBeTruthy() }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test('Test session clusters', async () => { @@ -669,7 +669,7 @@ describe('Endpoint Type Config Queries', () => { expect(clusters.length).toBe(undefined) return Promise.resolve() }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -691,7 +691,7 @@ describe('Endpoint Type Config Queries', () => { expect(data.length).toBe(3) }) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) }) @@ -699,54 +699,62 @@ test( 'Test Rest Key to DB Column Test', () => { expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.endpointId) + queryConfig.convertRestKeyToDbColumn(restApi.updateKey.endpointId), ).toEqual('ENDPOINT_IDENTIFIER') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.endpointType) + queryConfig.convertRestKeyToDbColumn(restApi.updateKey.endpointType), ).toEqual('ENDPOINT_TYPE_REF') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.networkId) + queryConfig.convertRestKeyToDbColumn(restApi.updateKey.networkId), ).toEqual('NETWORK_IDENTIFIER') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.profileId) + queryConfig.convertRestKeyToDbColumn(restApi.updateKey.profileId), ).toEqual('PROFILE') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.deviceTypeRef) + queryConfig.convertRestKeyToDbColumn(restApi.updateKey.deviceTypeRef), ).toEqual('DEVICE_TYPE_REF') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.name) + queryConfig.convertRestKeyToDbColumn(restApi.updateKey.name), ).toEqual('NAME') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeSelected) + queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeSelected), ).toEqual('INCLUDED') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeSingleton) + queryConfig.convertRestKeyToDbColumn( + restApi.updateKey.attributeSingleton, + ), ).toEqual('SINGLETON') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeBounded) + queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeBounded), ).toEqual('BOUNDED') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeDefault) + queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeDefault), ).toEqual('DEFAULT_VALUE') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeReporting) + queryConfig.convertRestKeyToDbColumn( + restApi.updateKey.attributeReporting, + ), ).toEqual('INCLUDED_REPORTABLE') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeReportMin) + queryConfig.convertRestKeyToDbColumn( + restApi.updateKey.attributeReportMin, + ), ).toEqual('MIN_INTERVAL') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeReportMax) + queryConfig.convertRestKeyToDbColumn( + restApi.updateKey.attributeReportMax, + ), ).toEqual('MAX_INTERVAL') expect( queryConfig.convertRestKeyToDbColumn( - restApi.updateKey.attributeReportChange - ) + restApi.updateKey.attributeReportChange, + ), ).toEqual('REPORTABLE_CHANGE') expect( - queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeStorage) + queryConfig.convertRestKeyToDbColumn(restApi.updateKey.attributeStorage), ).toEqual('STORAGE_OPTION') }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -765,5 +773,5 @@ test( type = await zclUtil.determineType(db, 'int8u', pkgId) expect(type.type).toEqual(dbEnum.zclType.atomic) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) diff --git a/test/rendererapi.test.js b/test/rendererapi.test.js index bae3fa6fa7..721a2dd34b 100644 --- a/test/rendererapi.test.js +++ b/test/rendererapi.test.js @@ -29,5 +29,5 @@ test( expect(api.prefix).toEqual('zap') expect(api.functions.length).toBeGreaterThanOrEqual(2) }, - timeout.short() + timeout.short(), ) diff --git a/test/script-api.test.js b/test/script-api.test.js index 027c8042b3..29f348e96a 100644 --- a/test/script-api.test.js +++ b/test/script-api.test.js @@ -63,7 +63,7 @@ test( expect(endpoints.length).toBe(2) expect(endpoints[0].endpointIdentifier).toBe(42) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -79,12 +79,12 @@ test( // get clusters on first endpoint let clusters = await queryEndpoint.selectEndpointClusters( db, - endpoints[0].endpointTypeRef + endpoints[0].endpointTypeRef, ) // Script 3 is supposed to remove that cluster client with code // 2 so verify that this in fact happened. let deviceTemps = clusters.filter( - (cl) => cl.code == 2 && cl.side == dbEnum.side.client + (cl) => cl.code == 2 && cl.side == dbEnum.side.client, ) expect(deviceTemps.length).toBe(0) @@ -96,11 +96,11 @@ test( db, basicCluster.clusterId, dbEnum.side.server, - endpoints[0].endpointTypeRef + endpoints[0].endpointTypeRef, ) expect(basicAttributes.length).toBe(5) let manufName = basicAttributes.filter( - (at) => at.code == 4 && at.isIncluded == 1 + (at) => at.code == 4 && at.isIncluded == 1, ) expect(manufName.length).toBe(0) @@ -108,11 +108,11 @@ test( let groupsCommands = await queryEndpoint.selectEndpointClusterCommands( db, groupsCluster.clusterId, - endpoints[0].endpointTypeRef + endpoints[0].endpointTypeRef, ) expect(groupsCommands.length).toBe(10) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -130,5 +130,5 @@ test( expect(endpoints.length).toBe(3) expect(endpoints[0].endpointIdentifier).toBe(41) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) diff --git a/test/server-bare.test.js b/test/server-bare.test.js index 7406aa63a3..5f0fef72e8 100644 --- a/test/server-bare.test.js +++ b/test/server-bare.test.js @@ -51,13 +51,13 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) }, testUtil.timeout.medium()) afterAll( () => httpServer.shutdownHttpServer().then(() => dbApi.closeDatabase(db)), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) describe('Session specific tests', () => { @@ -67,7 +67,7 @@ describe('Session specific tests', () => { testQuery.selectCountFrom(db, 'SESSION').then((cnt) => { expect(cnt).toBe(0) }), - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -75,7 +75,7 @@ describe('Session specific tests', () => { async () => { await httpServer.initHttpServer(db, port) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -86,11 +86,11 @@ describe('Session specific tests', () => { axiosInstance.defaults.headers.Cookie = sessionCookie expect( response.data.includes( - 'Configuration tool for the Zigbee Cluster Library' - ) + 'Configuration tool for the Zigbee Cluster Library', + ), ).toBeTruthy() }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -103,10 +103,10 @@ describe('Session specific tests', () => { }) .then(async () => { await axiosInstance.post( - `${restApi.uri.sessionCreate}?sessionId=${uuid}` + `${restApi.uri.sessionCreate}?sessionId=${uuid}`, ) }), - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -117,7 +117,7 @@ describe('Session specific tests', () => { .then((response) => { expect(response.data.clusterData.length).toBe(0) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -126,7 +126,7 @@ describe('Session specific tests', () => { testQuery.selectCountFrom(db, 'SESSION').then((cnt) => { expect(cnt).toBe(1) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -135,7 +135,7 @@ describe('Session specific tests', () => { querySession.getAllSessions(db).then((results) => { sessionId = results[0].sessionId }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -157,24 +157,24 @@ describe('Session specific tests', () => { partitions: 2, }, null, - null - ) + null, + ), ) .then(() => querySession.selectSessionPartitionInfoFromPackageId( db, sessionId, - packageId - ) + packageId, + ), ) .then((sessionPartitionInfo) => queryPackage.insertSessionPackage( db, sessionPartitionInfo[0].sessionPartitionId, - packageId - ) + packageId, + ), ), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -194,7 +194,7 @@ describe('Session specific tests', () => { define: 'TWO', }, ]), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -205,7 +205,7 @@ describe('Session specific tests', () => { .then((response) => { expect(response.data.clusterData.length).toBe(2) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -214,7 +214,7 @@ describe('Session specific tests', () => { testQuery.selectCountFrom(db, 'SESSION').then((cnt) => { expect(cnt).toBe(1) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -226,7 +226,7 @@ describe('Session specific tests', () => { { name: 'three' }, { name: 'four' }, ]), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -237,7 +237,7 @@ describe('Session specific tests', () => { .then((response) => { expect(response.data.length).toBe(4) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) // We save and then load, which creates a new session. @@ -255,7 +255,7 @@ describe('Session specific tests', () => { secondSessionId = importResult.sessionId fs.unlinkSync(f) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) // After a new file is loaded a new session will be created. @@ -266,7 +266,7 @@ describe('Session specific tests', () => { testQuery.selectCountFrom(db, 'SESSION').then((cnt) => { expect(cnt).toBe(2) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -278,7 +278,7 @@ describe('Session specific tests', () => { .then((cnt) => { expect(cnt).toBe(1) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -290,7 +290,7 @@ describe('Session specific tests', () => { .then((cnt) => { expect(cnt).toBe(0) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) }) @@ -304,7 +304,7 @@ describe('Miscelaneous REST API tests', () => { expect('endpointTypes' in response.data).toBeTruthy() expect('sessionKeyValues' in response.data).toBeTruthy() }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) }) @@ -319,7 +319,7 @@ describe('Admin tests', () => { expect(response.data.result).not.toBeNull() expect(response.data.result.length).toBeGreaterThan(1) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( 'test version interface', @@ -327,7 +327,7 @@ describe('Admin tests', () => { axiosInstance.get('version').then((response) => { expect(response.data).toEqual(env.zapVersion()) }), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) }) @@ -341,7 +341,7 @@ describe('User and session tests', () => { let userSession = await querySession.ensureZapUserAndSession( db, 'user1', - 'session1' + 'session1', ) userId = userSession.userId sessionId = userSession.sessionId @@ -350,7 +350,7 @@ describe('User and session tests', () => { let sessions = await querySession.getUserSessionsById(db, userId) expect(sessions.length).toBe(1) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -362,7 +362,7 @@ describe('User and session tests', () => { 'session2', { userId: userId, - } + }, ) expect(userSession.userId).toEqual(userId) expect(userSession.sessionId).not.toBeNull() @@ -370,7 +370,7 @@ describe('User and session tests', () => { let sessions = await querySession.getUserSessionsById(db, userId) expect(sessions.length).toBe(2) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -382,7 +382,7 @@ describe('User and session tests', () => { 'session1', { sessionId: sessionId, - } + }, ) expect(userSession.userId).not.toBeNull() expect(userSession.userId).not.toEqual(userId) @@ -392,7 +392,7 @@ describe('User and session tests', () => { sessions = await querySession.getUserSessionsById(db, userSession.userId) expect(sessions.length).toBe(1) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -405,14 +405,14 @@ describe('User and session tests', () => { { sessionId: sessionId, userId: userId, - } + }, ) expect(userSession.userId).toEqual(userId) expect(userSession.sessionId).toEqual(sessionId) let sessions = await querySession.getUserSessionsById(db, userId) expect(sessions.length).toBe(1) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -426,21 +426,21 @@ describe('User and session tests', () => { let usersSessions = await querySession.getUsersSessions(db) let user1Rows = usersSessions.filter( - (userSession) => userSession.userKey === 'user1' + (userSession) => userSession.userKey === 'user1', ) expect(user1Rows.length).toBeGreaterThan(0) expect(user1Rows[0].sessions.map((s) => s.sessionKey)).toContain( - 'session2' + 'session2', ) let user2Rows = usersSessions.filter( - (userSession) => userSession.userKey === 'user2' + (userSession) => userSession.userKey === 'user2', ) expect(user2Rows.length).toBeGreaterThan(0) expect(user2Rows[0].sessions.map((s) => s.sessionKey)).toContain( - 'session1' + 'session1', ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) }) diff --git a/test/server-session.test.js b/test/server-session.test.js index c2f7ea4747..b5465669c4 100644 --- a/test/server-session.test.js +++ b/test/server-session.test.js @@ -40,7 +40,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) await zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) await httpServer.initHttpServer(db, port) @@ -48,7 +48,7 @@ beforeAll(async () => { afterAll( () => httpServer.shutdownHttpServer().then(() => dbApi.closeDatabase(db)), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -58,10 +58,10 @@ test( let sessionCookie = response.headers['set-cookie'][0] axiosInstance.defaults.headers.Cookie = sessionCookie expect(response.data).toContain( - 'Configuration tool for the Zigbee Cluster Library' + 'Configuration tool for the Zigbee Cluster Library', ) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test.each([ @@ -80,5 +80,5 @@ test.each([ let response = await axiosInstance.get(uri) expect(response.data).not.toBeNull() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) diff --git a/test/server-with-zcl.test.js b/test/server-with-zcl.test.js index bfae206c1e..d8d2d0a950 100644 --- a/test/server-with-zcl.test.js +++ b/test/server-with-zcl.test.js @@ -42,7 +42,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) await zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) await httpServer.initHttpServer(db, port) @@ -51,13 +51,13 @@ beforeAll(async () => { 'USER', sessionUuid, env.builtinSilabsZclMetafile(), - env.builtinTemplateMetafile() + env.builtinTemplateMetafile(), ) }, testUtil.timeout.long()) afterAll( () => httpServer.shutdownHttpServer().then(() => dbApi.closeDatabase(db)), - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -68,11 +68,11 @@ test( axiosInstance.defaults.headers.Cookie = sessionCookie expect( response.data.includes( - 'Configuration tool for the Zigbee Cluster Library' - ) + 'Configuration tool for the Zigbee Cluster Library', + ), ).toBeTruthy() }), - testUtil.timeout.long() + testUtil.timeout.long(), ) describe('Miscelaneous REST API tests', () => { @@ -84,7 +84,7 @@ describe('Miscelaneous REST API tests', () => { .then((response) => { expect(response.data.length).toBeGreaterThan(100) }), - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -97,7 +97,7 @@ describe('Miscelaneous REST API tests', () => { .then((response) => { expect(response.status).toBe(StatusCodes.OK) }), - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -115,7 +115,7 @@ describe('Miscelaneous REST API tests', () => { expect(data.filePath).toContain('three-endpoint-device.zap') expect(data.manufacturerCodes).toEqual('0x1002') }), - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -128,8 +128,8 @@ describe('Miscelaneous REST API tests', () => { }) .then(() => axiosInstance.get( - `${restApi.uri.getAllSessionKeyValues}?sessionId=${sessionUuid}` - ) + `${restApi.uri.getAllSessionKeyValues}?sessionId=${sessionUuid}`, + ), ) .then((response) => { let data = response.data.reduce((accumulator, current) => { @@ -142,7 +142,7 @@ describe('Miscelaneous REST API tests', () => { expect(data.manufacturerCodes).toEqual('0x1002') expect(data.testKey).toEqual('testValue') }), - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -152,17 +152,17 @@ describe('Miscelaneous REST API tests', () => { .get(`${restApi.uri.zclCluster}all?sessionId=${sessionUuid}`) .then((response) => { expect(response.data.clusterData.length).toBe( - testUtil.totalClusterCount + testUtil.totalClusterCount, ) }), - testUtil.timeout.long() + testUtil.timeout.long(), ) test( 'all device types', async () => { let response = await axiosInstance.get( - `${restApi.uri.zclDeviceType}all?sessionId=${sessionUuid}` + `${restApi.uri.zclDeviceType}all?sessionId=${sessionUuid}`, ) expect(response.data.length).toBe(175) @@ -171,37 +171,37 @@ describe('Miscelaneous REST API tests', () => { expect(haOnOff).not.toBeNull() let clusters = await axiosInstance.get( - `${restApi.uri.deviceTypeClusters}${haOnOff.id}` + `${restApi.uri.deviceTypeClusters}${haOnOff.id}`, ) expect(clusters.data.length).toBe(14) let attributes = await axiosInstance.get( - `${restApi.uri.deviceTypeAttributes}${haOnOff.id}` + `${restApi.uri.deviceTypeAttributes}${haOnOff.id}`, ) expect(attributes.data.length).toBe(0) let commands = await axiosInstance.get( - `${restApi.uri.deviceTypeCommands}${haOnOff.id}` + `${restApi.uri.deviceTypeCommands}${haOnOff.id}`, ) expect(commands.data.length).toBe(0) let zllNcsr = response.data.find( - (d) => d.label == 'ZLL-noncolorsceneremote' + (d) => d.label == 'ZLL-noncolorsceneremote', ) expect(zllNcsr).not.toBeNull() clusters = await axiosInstance.get( - `${restApi.uri.deviceTypeClusters}${zllNcsr.id}` + `${restApi.uri.deviceTypeClusters}${zllNcsr.id}`, ) expect(clusters.data.length).toBe(8) attributes = await axiosInstance.get( - `${restApi.uri.deviceTypeAttributes}${zllNcsr.id}` + `${restApi.uri.deviceTypeAttributes}${zllNcsr.id}`, ) expect(attributes.data.length).toBe(9) commands = await axiosInstance.get( - `${restApi.uri.deviceTypeCommands}${zllNcsr.id}` + `${restApi.uri.deviceTypeCommands}${zllNcsr.id}`, ) expect(commands.data.length).toBe(32) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -212,7 +212,7 @@ describe('Miscelaneous REST API tests', () => { .then((response) => { expect(response.data.length).toBe(testUtil.totalDomainCount) }), - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -223,7 +223,7 @@ describe('Miscelaneous REST API tests', () => { .then((response) => { expect(response.data.length).toBe(129) }), - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -234,7 +234,7 @@ describe('Miscelaneous REST API tests', () => { .then((response) => { expect(response.data.length).toBe(testUtil.totalEnumCount) }), - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -245,6 +245,6 @@ describe('Miscelaneous REST API tests', () => { .then((response) => { expect(response.data.length).toBe(54) }), - testUtil.timeout.short() + testUtil.timeout.short(), ) }) diff --git a/test/spec-check.test.js b/test/spec-check.test.js index b12ed7c118..5eaac2da3d 100644 --- a/test/spec-check.test.js +++ b/test/spec-check.test.js @@ -37,7 +37,7 @@ const restApi = require('../src-shared/rest-api.js') let db let specCheckAllClustersApp = path.join( __dirname, - 'resource/spec-check-all-clusters-app-matter.zap' + 'resource/spec-check-all-clusters-app-matter.zap', ) let templateContext @@ -63,14 +63,14 @@ test( async () => { let context = await generationEngine.loadTemplates( db, - testUtil.testTemplate.matter3 + testUtil.testTemplate.matter3, ) templatePkgId = context.packageId expect(context.crc).not.toBeNull() expect(context.templateData).not.toBeNull() templateContext = context }, - testUtil.timeout.short() + testUtil.timeout.short(), ) test( @@ -84,74 +84,74 @@ test( template: env.builtinTemplateMetafile(), }, null, - [templatePkgId] + [templatePkgId], ) let importResult = await importJs.importDataFromFile( db, - specCheckAllClustersApp + specCheckAllClustersApp, ) let sid = importResult.sessionId let sessionNotifications = await testQuery.getAllSessionNotifications( db, - sid + sid, ) let sessionNotificationMessages = sessionNotifications.map( - (sn) => sn.message + (sn) => sn.message, ) expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-rootdevice, cluster: Descriptor server needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-rootdevice, cluster: Descriptor server needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor server needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor server needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-rootdevice, cluster: Descriptor, attribute: ServerList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-rootdevice, cluster: Descriptor, attribute: ServerList needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ServerList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ServerList needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-rootdevice, cluster: Descriptor, attribute: ClientList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-rootdevice, cluster: Descriptor, attribute: ClientList needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ClientList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ClientList needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: PartsList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: PartsList needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ServerList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ServerList needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-onofflight, cluster: Identify, attribute: IdentifyTime needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-onofflight, cluster: Identify, attribute: IdentifyTime needs to be enabled', + ), ).toBeTruthy() let endpointTypes = await queryEndpointType.selectAllEndpointTypes(db, sid) let endpoint0 = endpointTypes.find( - (ep) => ep.name === 'MA-rootdevice' && ep.deviceIdentifier.length === 2 + (ep) => ep.name === 'MA-rootdevice' && ep.deviceIdentifier.length === 2, ) let endpoint1 = endpointTypes.find( - (ep) => ep.name === 'MA-onofflight' && ep.deviceIdentifier.length === 2 + (ep) => ep.name === 'MA-onofflight' && ep.deviceIdentifier.length === 2, ) let allClusters = await testQuery.getAllSessionClusters(db, sid) let descriptorCluster = allClusters.find((c) => c.code === 0x001d) // Finding the descriptor cluster by code @@ -169,12 +169,12 @@ test( endpoint0.endpointTypeId, onOffCluster.id, 'SERVER', - true + true, ) sessionNotifications = await testQuery.getAllSessionNotifications(db, sid) let sessionNotificationCountAfterOnOffEnabled = sessionNotifications.length expect(sessionNotificationCountBeforeOnOffEnabled).toEqual( - sessionNotificationCountAfterOnOffEnabled + sessionNotificationCountAfterOnOffEnabled, ) // Disable on off server cluster @@ -183,12 +183,12 @@ test( endpoint0.endpointTypeId, onOffCluster.id, 'SERVER', - false + false, ) sessionNotifications = await testQuery.getAllSessionNotifications(db, sid) let sessionNotificationCountAfterOnOffDisabled = sessionNotifications.length expect(sessionNotificationCountBeforeOnOffEnabled).toEqual( - sessionNotificationCountAfterOnOffDisabled + sessionNotificationCountAfterOnOffDisabled, ) // Insert the descriptor cluster and check for session notice warnings again @@ -197,7 +197,7 @@ test( endpoint0.endpointTypeId, descriptorCluster.id, 'SERVER', - true + true, ) sessionNotifications = await testQuery.getAllSessionNotifications(db, sid) @@ -205,34 +205,34 @@ test( expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-rootdevice, cluster: Descriptor server needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-rootdevice, cluster: Descriptor server needs to be enabled', + ), ).toBeFalsy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor server needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor server needs to be enabled', + ), ).toBeFalsy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ServerList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ServerList needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ClientList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ClientList needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-onofflight, cluster: Identify, attribute: IdentifyTime needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-onofflight, cluster: Identify, attribute: IdentifyTime needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Cluster Compliance on endpoint: 1, cluster: Identify, mandatory attribute: IdentifyTime needs to be enabled' - ) + '⚠ Check Cluster Compliance on endpoint: 1, cluster: Identify, mandatory attribute: IdentifyTime needs to be enabled', + ), ).toBeTruthy() // Get Descriptor cluster attributes and enable them. Check for warnings in the session notice table after @@ -243,13 +243,13 @@ test( db, descriptorCluster.id, sessionPackageIds, - 'server' + 'server', ) let serviceListAttribute = descriptorClusterAttributes.find( - (dca) => dca.name === 'ServerList' + (dca) => dca.name === 'ServerList', ) let clientListAttribute = descriptorClusterAttributes.find( - (dca) => dca.name === 'ClientList' + (dca) => dca.name === 'ClientList', ) let identifyClusterAttributes = @@ -257,11 +257,11 @@ test( db, identifyCluster.id, sessionPackageIds, - 'server' + 'server', ) let identifyTimeAttribute = identifyClusterAttributes.find( - (ica) => ica.name === 'IdentifyTime' + (ica) => ica.name === 'IdentifyTime', ) await queryConfig.insertOrUpdateAttributeState( @@ -278,7 +278,7 @@ test( ], null, null, - null + null, ) await queryConfig.insertOrUpdateAttributeState( @@ -295,7 +295,7 @@ test( ], null, null, - null + null, ) await queryConfig.insertOrUpdateAttributeState( @@ -312,7 +312,7 @@ test( ], null, null, - null + null, ) sessionNotifications = await testQuery.getAllSessionNotifications(db, sid) @@ -320,24 +320,24 @@ test( expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ServerList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ServerList needs to be enabled', + ), ).toBeFalsy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ClientList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, device type: MA-powersource, cluster: Descriptor, attribute: ClientList needs to be enabled', + ), ).toBeFalsy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-onofflight, cluster: Identify, attribute: IdentifyTime needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 1, device type: MA-onofflight, cluster: Identify, attribute: IdentifyTime needs to be enabled', + ), ).toBeFalsy() expect( sessionNotificationMessages.includes( - '⚠ Check Cluster Compliance on endpoint: 1, cluster: Identify, mandatory attribute: IdentifyTime needs to be enabled' - ) + '⚠ Check Cluster Compliance on endpoint: 1, cluster: Identify, mandatory attribute: IdentifyTime needs to be enabled', + ), ).toBeFalsy() // Disabling a cluster and attribute to check if the notification messages come back up @@ -346,7 +346,7 @@ test( endpoint0.endpointTypeId, descriptorCluster.id, 'server', - false + false, ) await queryConfig.insertOrUpdateAttributeState( db, @@ -362,7 +362,7 @@ test( ], null, null, - null + null, ) await queryConfig.insertOrUpdateAttributeState( @@ -379,37 +379,37 @@ test( ], null, null, - null + null, ) sessionNotifications = await testQuery.getAllSessionNotifications(db, sid) sessionNotificationMessages = sessionNotifications.map((sn) => sn.message) expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, cluster: Descriptor, attribute: ServerList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, cluster: Descriptor, attribute: ServerList needs to be enabled', + ), ).toBeFalsy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, cluster: Descriptor, attribute: ClientList needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, cluster: Descriptor, attribute: ClientList needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, cluster: Descriptor server needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, cluster: Descriptor server needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 1, cluster: Identify, attribute: IdentifyTime needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 1, cluster: Identify, attribute: IdentifyTime needs to be enabled', + ), ).toBeTruthy() expect( sessionNotificationMessages.includes( - '⚠ Check Cluster Compliance on endpoint: 1, cluster: Identify, mandatory attribute: IdentifyTime needs to be enabled' - ) + '⚠ Check Cluster Compliance on endpoint: 1, cluster: Identify, mandatory attribute: IdentifyTime needs to be enabled', + ), ).toBeTruthy() // Testing the compliance warnings for optional clusters of the device type. @@ -420,10 +420,10 @@ test( db, localConfigCluster.id, sessionPackageIds, - 'server' + 'server', ) let activeLocaleAttribute = localConfigClusterAttributes.find( - (ica) => ica.name === 'ActiveLocale' + (ica) => ica.name === 'ActiveLocale', ) // Disable active Local attribute of an optional cluster to a device type await queryConfig.insertOrUpdateAttributeState( @@ -440,15 +440,15 @@ test( ], null, null, - null + null, ) sessionNotifications = await testQuery.getAllSessionNotifications(db, sid) sessionNotificationMessages = sessionNotifications.map((sn) => sn.message) expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, cluster: Localization Configuration, attribute: ActiveLocale needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, cluster: Localization Configuration, attribute: ActiveLocale needs to be enabled', + ), ).toBeTruthy() // Enable active Local attribute of an optional cluster to a device type @@ -466,15 +466,15 @@ test( ], null, null, - null + null, ) sessionNotifications = await testQuery.getAllSessionNotifications(db, sid) sessionNotificationMessages = sessionNotifications.map((sn) => sn.message) expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, cluster: Localization Configuration, attribute: ActiveLocale needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, cluster: Localization Configuration, attribute: ActiveLocale needs to be enabled', + ), ).toBeFalsy() // Disable the optional cluster to a device type and none of the optional cluster or its attribute warnings should show up. @@ -483,18 +483,18 @@ test( endpoint0.endpointTypeId, localConfigCluster.id, 'SERVER', - false + false, ) expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, cluster: Localization Configuration server needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, cluster: Localization Configuration server needs to be enabled', + ), ).toBeFalsy() expect( sessionNotificationMessages.includes( - '⚠ Check Device Type Compliance on endpoint: 0, cluster: Localization Configuration, attribute: ActiveLocale needs to be enabled' - ) + '⚠ Check Device Type Compliance on endpoint: 0, cluster: Localization Configuration, attribute: ActiveLocale needs to be enabled', + ), ).toBeFalsy() }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) diff --git a/test/startup.test.js b/test/startup.test.js index 85a8dc9573..266e0b3c9c 100644 --- a/test/startup.test.js +++ b/test/startup.test.js @@ -47,10 +47,10 @@ test( { quitFunction: null, logger: (msg) => {}, - } + }, ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -60,10 +60,10 @@ test( { zclProperties: env.builtinSilabsZclMetafile(), }, - { logger: (msg) => {}, quit: false } + { logger: (msg) => {}, quit: false }, ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -74,11 +74,11 @@ test( let output = '{basename}.conversion' let testOutputFile = path.join( __dirname, - 'resource/isc/test-light.conversion' + 'resource/isc/test-light.conversion', ) let testConversionResults = path.join( __dirname, - 'resource/isc/test-light.conversion.results.yaml' + 'resource/isc/test-light.conversion.results.yaml', ) return startup @@ -93,7 +93,7 @@ test( { quitFunction: null, logger: (msg) => {}, - } + }, ) .then(() => { expect(fs.existsSync(testOutputFile)).toBeTruthy() @@ -103,7 +103,7 @@ test( fs.unlinkSync(testConversionResults) }) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -120,8 +120,8 @@ test( quitFunction: null, cleanDb: false, logger: (msg) => {}, - } + }, ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/string.test.js b/test/string.test.js index 7063970828..2901d8aa9e 100644 --- a/test/string.test.js +++ b/test/string.test.js @@ -28,18 +28,18 @@ test( expect(string.toCleanSymbol('a:b-c')).toEqual('a_b_c') expect(string.toCleanSymbol('a____:___c')).toEqual('a_c') }, - timeout.short() + timeout.short(), ) test( 'Snake case', () => { expect(string.toSnakeCaseAllCaps('VerySimpleLabel')).toEqual( - 'VERY_SIMPLE_LABEL' + 'VERY_SIMPLE_LABEL', ) expect(string.toSnakeCase('My-String')).toEqual('my_string') }, - timeout.short() + timeout.short(), ) test( @@ -47,27 +47,27 @@ test( () => { expect(string.toCamelCase('some random string')).toEqual('someRandomString') expect(string.toCamelCase('some random string', false)).toEqual( - 'SomeRandomString' + 'SomeRandomString', ) expect(string.toCamelCase('ZLL Commissioning')).toEqual('zllCommissioning') expect(string.toCamelCase('AddGroup')).toEqual('addGroup') expect(string.toCamelCase('AddGroup', false)).toEqual('AddGroup') expect(string.toCamelCase('long string with an ACRONYM inside')).toEqual( - 'longStringWithAnAcronymInside' + 'longStringWithAnAcronymInside', ) expect(string.toCamelCase('longStringWithAnAcronymInside')).toEqual( - 'longStringWithAnAcronymInside' + 'longStringWithAnAcronymInside', ) }, - timeout.short() + timeout.short(), ) test( 'Kebab case', () => { expect(string.toCleanSymbolAsKebabCase('Very Simple:Label')).toEqual( - 'very-simple-label' + 'very-simple-label', ) }, - timeout.short() + timeout.short(), ) diff --git a/test/templates.test.js b/test/templates.test.js index 7164ce0e0e..d6c9a49ace 100644 --- a/test/templates.test.js +++ b/test/templates.test.js @@ -29,19 +29,19 @@ test( let output = template({ a: 'Very', b: 'simple', c: 'test' }) expect(output).toEqual('Very simple test!') }, - timeout.short() + timeout.short(), ) test( 'handlebars: comment test', () => { let template = handlebars.compile( - '{{!-- some random comment --}}{{a}} {{b}} {{c}}!' + '{{!-- some random comment --}}{{a}} {{b}} {{c}}!', ) let output = template({ a: 'Very', b: 'simple', c: 'test' }) expect(output).toEqual('Very simple test!') }, - timeout.short() + timeout.short(), ) test( @@ -51,7 +51,7 @@ test( let output = template({ in: { a: 'Very', b: 'simple', c: 'test' } }) expect(output).toEqual('Very simple test!') }, - timeout.short() + timeout.short(), ) test( @@ -61,7 +61,7 @@ test( let output = template({ in: { a: 'Very', b: 'simple', c: 'test' } }) expect(output).toEqual('Very simple test!') }, - timeout.short() + timeout.short(), ) test( @@ -71,7 +71,7 @@ test( let output = template({ in: ['Very', 'simple', 'test'] }) expect(output).toEqual('Very simple test !') }, - timeout.short() + timeout.short(), ) test( @@ -82,7 +82,7 @@ test( let output = template() expect(output).toEqual('Very simple test!') }, - timeout.short() + timeout.short(), ) test( @@ -90,33 +90,33 @@ test( () => { handlebars.registerHelper( 'supreme_leader', - (name) => `His most evil excelency, Mr. ${name}` + (name) => `His most evil excelency, Mr. ${name}`, ) let template = handlebars.compile( - '{{#each list_of_lunatics}}{{supreme_leader this}} {{/each}}' + '{{#each list_of_lunatics}}{{supreme_leader this}} {{/each}}', ) let output = template({ list_of_lunatics: ['Stalin', 'Trotsky', 'Genghis Khan'], }) expect(output).toEqual( - 'His most evil excelency, Mr. Stalin His most evil excelency, Mr. Trotsky His most evil excelency, Mr. Genghis Khan ' + 'His most evil excelency, Mr. Stalin His most evil excelency, Mr. Trotsky His most evil excelency, Mr. Genghis Khan ', ) }, - timeout.short() + timeout.short(), ) test( 'handlebars: if helper', () => { let template = handlebars.compile( - '{{#if flag}}Yes flag!{{else}}No flag!{{/if}}' + '{{#if flag}}Yes flag!{{else}}No flag!{{/if}}', ) let output = template({ flag: true }) expect(output).toEqual('Yes flag!') output = template({ flag: false }) expect(output).toEqual('No flag!') }, - timeout.short() + timeout.short(), ) test( @@ -132,7 +132,7 @@ test( }) expect(output).toEqual('Got example text, returned EXAMPLE TEXT') }, - timeout.short() + timeout.short(), ) test( @@ -150,7 +150,7 @@ test( }) expect(output).toEqual('0123456789') }, - timeout.short() + timeout.short(), ) test( @@ -164,7 +164,7 @@ test( let output = template({ data: 0 }) expect(output).toEqual('12345') }, - timeout.short() + timeout.short(), ) test( @@ -184,7 +184,7 @@ test( let output = template({ prefix: 'PRE:', postfix: ':ERP' }) expect(output).toEqual('PRE:0123456789:ERP') }, - timeout.short() + timeout.short(), ) test( @@ -194,11 +194,11 @@ test( expect(helperC.as_delimited_macro('Very_simple')).toEqual('VERY_SIMPLE') expect(helperC.as_delimited_macro('Very_Simple')).toEqual('VERY_SIMPLE') expect(helperC.as_delimited_macro('Very_123_Simple')).toEqual( - 'VERY_123_SIMPLE' + 'VERY_123_SIMPLE', ) expect(helperC.as_delimited_macro('MfrDefGpdCmd0')).toEqual( - 'MFR_DEF_GPD_CMD0' + 'MFR_DEF_GPD_CMD0', ) }, - timeout.short() + timeout.short(), ) diff --git a/test/test-query.js b/test/test-query.js index c5c7a1d381..92d8217bca 100644 --- a/test/test-query.js +++ b/test/test-query.js @@ -49,7 +49,7 @@ FROM INNER JOIN CLUSTER ON ENDPOINT_TYPE_CLUSTER.CLUSTER_REF = CLUSTER.CLUSTER_ID WHERE ENDPOINT_TYPE_CLUSTER.ENDPOINT_TYPE_REF = ?`, - [endpointTypeId] + [endpointTypeId], ) if (rows == null) return [] @@ -108,7 +108,7 @@ async function getEndpointTypeCommands(db, endpointTypeId) { ENDPOINT_TYPE_CLUSTER.ENDPOINT_TYPE_REF = ? GROUP BY COMMAND_REF`, - [endpointTypeId] + [endpointTypeId], ) .then((rows) => rows.map((row) => { @@ -117,7 +117,7 @@ async function getEndpointTypeCommands(db, endpointTypeId) { isIncoming: row.IS_INCOMING, isEnabled: row.IS_ENABLED, } - }) + }), ) } @@ -153,7 +153,7 @@ ON ETA.ENDPOINT_TYPE_CLUSTER_REF = ETC.ENDPOINT_TYPE_CLUSTER_ID WHERE ETC.ENDPOINT_TYPE_REF = ?`, - [endpointTypeId] + [endpointTypeId], ) .then((rows) => rows.map(dbMapping.map.endpointTypeAttribute)) } @@ -175,7 +175,7 @@ async function createSession(db, user, sessionUuid, zclFile, genTemplatesFile) { sessionUuid, { partitions: 2, - } + }, ) await util.ensurePackagesAndPopulateSessionOptions( db, @@ -185,7 +185,7 @@ async function createSession(db, user, sessionUuid, zclFile, genTemplatesFile) { template: genTemplatesFile, partitions: 2, }, - null + null, ) return userSession.sessionId } @@ -207,7 +207,7 @@ FROM SESSION_NOTICE WHERE SESSION_REF = ?`, - [sessionId] + [sessionId], ) .then((rows) => rows.map(dbMapping.map.sessionNotifications)) } @@ -237,7 +237,7 @@ ON SESSION_PACKAGE.SESSION_PARTITION_REF = SESSION_PARTITION.SESSION_PARTITION_ID WHERE SESSION_PARTITION.SESSION_REF = ?`, - [sessionId] + [sessionId], ) .then((rows) => rows.map(dbMapping.map.cluster)) } diff --git a/test/test-util.js b/test/test-util.js index 69e7b76b2c..e3c9e28fe7 100644 --- a/test/test-util.js +++ b/test/test-util.js @@ -29,7 +29,7 @@ function testServer(fileName) { testPort = 9076 } else { let msg = new Error( - `You must manually assign a port for the given test file: ${fileName}` + `You must manually assign a port for the given test file: ${fileName}`, ) console.log(msg) throw msg @@ -103,7 +103,7 @@ exports.otherTestFile = { fileFormat1: path.join(__dirname, 'resource/file-format/file-format-1.zap'), fileFormatFuture: path.join( __dirname, - 'resource/file-format/file-format-future.zap' + 'resource/file-format/file-format-future.zap', ), } @@ -115,7 +115,7 @@ exports.zigbeeTestFile = { onOff: path.join(__dirname, 'resource/zll-on-off-switch-test.zap'), mfgClusters: path.join( __dirname, - 'resource/mfg-specific-clusters-commands.zap' + 'resource/mfg-specific-clusters-commands.zap', ), customXml: path.join(__dirname, 'resource/zap-file-with-custom-xml.zap'), fullTh: path.join(__dirname, 'resource/full-th.zap'), @@ -128,19 +128,19 @@ exports.matterTestFile = { allClusters: path.join(__dirname, 'resource/matter-all-clusters.zap'), allClustersFileFormat2: path.join( __dirname, - 'resource/matter-all-clusters-file-format-2.zap' + 'resource/matter-all-clusters-file-format-2.zap', ), multipleDeviceTypesPerEndpoint: path.join( __dirname, - 'resource/multiple-device-types-per-endpoint.zap' + 'resource/multiple-device-types-per-endpoint.zap', ), apiMaturityTest: path.join( __dirname, - 'resource/matter-api-maturity-test.zap' + 'resource/matter-api-maturity-test.zap', ), endpointComposition: path.join( __dirname, - 'resource/matter-endpointComposition.zap' + 'resource/matter-endpointComposition.zap', ), } diff --git a/test/tokens.test.js b/test/tokens.test.js index 6517ae29b3..be34ddab00 100644 --- a/test/tokens.test.js +++ b/test/tokens.test.js @@ -37,7 +37,7 @@ beforeAll(async () => { db = await dbApi.initDatabaseAndLoadSchema( file, env.schemaFile(), - env.zapVersion() + env.zapVersion(), ) await zclLoader.loadZcl(db, env.builtinSilabsZclMetafile()) }, testUtil.timeout.long()) @@ -49,7 +49,7 @@ test( async () => { let context = await genEngine.loadTemplates( db, - testUtil.testTemplate.zigbee + testUtil.testTemplate.zigbee, ) expect(context.crc).not.toBeNull() expect(context.templateData).not.toBeNull() @@ -58,7 +58,7 @@ test( expect(context.packageId).not.toBeNull() templateContext = context }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -68,7 +68,7 @@ test( templateContext.sessionId = importResult.sessionId expect(importResult.sessionId).not.toBeNull() }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -82,7 +82,7 @@ test( { generateOnly: 'zap-tokens.h', disableDeprecationWarnings: true, - } + }, ) expect(genResult).not.toBeNull() @@ -95,22 +95,22 @@ test( expect(header).toContain('#define CREATOR_STACK_VERSION_SINGLETON') expect(header).toContain( - '#define NVM3KEY_STACK_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_STACK_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).not.toContain('#define CREATOR_STACK_VERSION_1') expect(header).not.toContain( - '#define NVM3KEY_STACK_VERSION_1 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_STACK_VERSION_1 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).toContain('#define CREATOR_HW_VERSION_SINGLETON') expect(header).toContain( - '#define NVM3KEY_HW_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_HW_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).not.toContain('#define CREATOR_HW_VERSION_1') expect(header).not.toContain( - '#define NVM3KEY_HW_VERSION_1 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_HW_VERSION_1 (NVM3KEY_DOMAIN_ZIGBEE', ) // Non-singletons @@ -118,65 +118,65 @@ test( expect(header).toContain('#define CREATOR_APPLICATION_VERSION_1') expect(header).toContain( - '#define NVM3KEY_APPLICATION_VERSION_1 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_APPLICATION_VERSION_1 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).toContain('#define CREATOR_APPLICATION_VERSION_7') expect(header).toContain( - '#define NVM3KEY_APPLICATION_VERSION_7 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_APPLICATION_VERSION_7 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).not.toContain( - '#define CREATOR_APPLICATION_VERSION_SINGLETON' + '#define CREATOR_APPLICATION_VERSION_SINGLETON', ) expect(header).not.toContain( - '#define NVM3KEY_APPLICATION_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_APPLICATION_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).toContain('#define CREATOR_PRODUCT_CODE_1') expect(header).toContain( - '#define NVM3KEY_PRODUCT_CODE_1 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_PRODUCT_CODE_1 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).not.toContain('#define CREATOR_PRODUCT_CODE_2') expect(header).not.toContain( - '#define NVM3KEY_PRODUCT_CODE_2 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_PRODUCT_CODE_2 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).not.toContain('#define CREATOR_PRODUCT_CODE_7') expect(header).not.toContain( - '#define NVM3KEY_PRODUCT_CODE_7 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_PRODUCT_CODE_7 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).not.toContain('#define CREATOR_COLOR_CONTROL_COLOR_MODE_1') expect(header).not.toContain( - '#define NVM3KEY_COLOR_CONTROL_COLOR_MODE_1 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_COLOR_CONTROL_COLOR_MODE_1 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).not.toContain('#define CREATOR_COLOR_CONTROL_COLOR_MODE_2') expect(header).not.toContain( - '#define NVM3KEY_COLOR_CONTROL_COLOR_MODE_2 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_COLOR_CONTROL_COLOR_MODE_2 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).toContain('#define CREATOR_COLOR_CONTROL_COLOR_MODE_7') expect(header).toContain( - '#define NVM3KEY_COLOR_CONTROL_COLOR_MODE_7 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_COLOR_CONTROL_COLOR_MODE_7 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).toContain('#define CREATOR_LEVEL_CONTROL_REMAINING_TIME_7') expect(header).toContain( - '#define NVM3KEY_LEVEL_CONTROL_REMAINING_TIME_7 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_LEVEL_CONTROL_REMAINING_TIME_7 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).toContain('#define CREATOR_COLOR_CONTROL_REMAINING_TIME_7') expect(header).toContain( - '#define NVM3KEY_COLOR_CONTROL_REMAINING_TIME_7 (NVM3KEY_DOMAIN_ZIGBEE' + '#define NVM3KEY_COLOR_CONTROL_REMAINING_TIME_7 (NVM3KEY_DOMAIN_ZIGBEE', ) expect(header).not.toContain('#define CREATOR_REMAINING_TIME_') @@ -193,7 +193,7 @@ test( expect(header).toContain('typedef uint8_t tokType_product_code[16];') expect(header).toContain( - 'typedef uint16_t tokType_level_control_remaining_time;' + 'typedef uint16_t tokType_level_control_remaining_time;', ) expect(header).toContain('uint16_t tokType_color_control_remaining_time;') @@ -201,83 +201,83 @@ test( // DEFINETOKENS expect(header).toContain( - 'DEFINE_BASIC_TOKEN(STACK_VERSION_SINGLETON, tokType_stack_version, 12)' + 'DEFINE_BASIC_TOKEN(STACK_VERSION_SINGLETON, tokType_stack_version, 12)', ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(HW_VERSION_SINGLETON, tokType_hw_version, 13)' + 'DEFINE_BASIC_TOKEN(HW_VERSION_SINGLETON, tokType_hw_version, 13)', ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(APPLICATION_VERSION_1, tokType_application_version, 11)' + 'DEFINE_BASIC_TOKEN(APPLICATION_VERSION_1, tokType_application_version, 11)', ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(APPLICATION_VERSION_7, tokType_application_version, 11)' + 'DEFINE_BASIC_TOKEN(APPLICATION_VERSION_7, tokType_application_version, 11)', ) expect(header).toContain( - "DEFINE_BASIC_TOKEN(PRODUCT_CODE_1, tokType_product_code, { 3, 'A', 'B', 'C', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, })" + "DEFINE_BASIC_TOKEN(PRODUCT_CODE_1, tokType_product_code, { 3, 'A', 'B', 'C', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, })", ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(LEVEL_CONTROL_REMAINING_TIME_7, tokType_level_control_remaining_time, 10)' + 'DEFINE_BASIC_TOKEN(LEVEL_CONTROL_REMAINING_TIME_7, tokType_level_control_remaining_time, 10)', ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(COLOR_CONTROL_REMAINING_TIME_7, tokType_color_control_remaining_time, 0xA1B2)' + 'DEFINE_BASIC_TOKEN(COLOR_CONTROL_REMAINING_TIME_7, tokType_color_control_remaining_time, 0xA1B2)', ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(COLOR_CONTROL_COLOR_MODE_7, tokType_color_control_color_mode, 1)' + 'DEFINE_BASIC_TOKEN(COLOR_CONTROL_COLOR_MODE_7, tokType_color_control_color_mode, 1)', ) // GENERATED_TOKEN_LOADER expect(header).toContain( - 'halCommonGetToken((tokType_stack_version *)ptr, TOKEN_STACK_VERSION_SINGLETON);' + 'halCommonGetToken((tokType_stack_version *)ptr, TOKEN_STACK_VERSION_SINGLETON);', ) expect(header).toContain( - 'emberAfWriteServerAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_STACK_VERSION_ATTRIBUTE_ID, (uint8_t*)ptr, ZCL_INT8U_ATTRIBUTE_TYPE);' + 'emberAfWriteServerAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_STACK_VERSION_ATTRIBUTE_ID, (uint8_t*)ptr, ZCL_INT8U_ATTRIBUTE_TYPE);', ) expect(header).toContain( - 'halCommonGetToken((tokType_hw_version *)ptr, TOKEN_HW_VERSION_SINGLETON);' + 'halCommonGetToken((tokType_hw_version *)ptr, TOKEN_HW_VERSION_SINGLETON);', ) expect(header).toContain( - 'emberAfWriteServerAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_HW_VERSION_ATTRIBUTE_ID, (uint8_t*)ptr, ZCL_INT8U_ATTRIBUTE_TYPE);' + 'emberAfWriteServerAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_HW_VERSION_ATTRIBUTE_ID, (uint8_t*)ptr, ZCL_INT8U_ATTRIBUTE_TYPE);', ) expect(header).not.toContain( - 'halCommonGetToken((tokType_stack_version *)ptr, TOKEN_STACK_VERSION_1);' + 'halCommonGetToken((tokType_stack_version *)ptr, TOKEN_STACK_VERSION_1);', ) expect(header).not.toContain( - 'halCommonGetToken((tokType_hw_version *)ptr, TOKEN_HW_VERSION_1);' + 'halCommonGetToken((tokType_hw_version *)ptr, TOKEN_HW_VERSION_1);', ) expect(header).toContain( - 'if(1 == (endpoint) || (EMBER_BROADCAST_ENDPOINT == (endpoint) && epNetwork == curNetwork))' + 'if(1 == (endpoint) || (EMBER_BROADCAST_ENDPOINT == (endpoint) && epNetwork == curNetwork))', ) expect(header).not.toContain( - 'if(2 == (endpoint) || (EMBER_BROADCAST_ENDPOINT == (endpoint) && epNetwork == curNetwork))' + 'if(2 == (endpoint) || (EMBER_BROADCAST_ENDPOINT == (endpoint) && epNetwork == curNetwork))', ) expect(header).toContain( - 'if(7 == (endpoint) || (EMBER_BROADCAST_ENDPOINT == (endpoint) && epNetwork == curNetwork))' + 'if(7 == (endpoint) || (EMBER_BROADCAST_ENDPOINT == (endpoint) && epNetwork == curNetwork))', ) expect(header).toContain( - 'halCommonGetToken((tokType_application_version *)ptr, TOKEN_APPLICATION_VERSION_1);' + 'halCommonGetToken((tokType_application_version *)ptr, TOKEN_APPLICATION_VERSION_1);', ) expect(header).toContain( - 'halCommonGetToken((tokType_application_version *)ptr, TOKEN_APPLICATION_VERSION_7);' + 'halCommonGetToken((tokType_application_version *)ptr, TOKEN_APPLICATION_VERSION_7);', ) expect(header).toContain( - 'emberAfWriteServerAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_APPLICATION_VERSION_ATTRIBUTE_ID, (uint8_t*)ptr, ZCL_INT8U_ATTRIBUTE_TYPE);' + 'emberAfWriteServerAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_APPLICATION_VERSION_ATTRIBUTE_ID, (uint8_t*)ptr, ZCL_INT8U_ATTRIBUTE_TYPE);', ) // GENERATED_TOKEN_SAVER @@ -285,37 +285,37 @@ test( expect(header).toContain('if ( 0x0000 == clusterId )') expect(header).not.toContain('if ( 0x0001 == clusterId )') expect(header).toContain( - 'if ( 0x0002 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) ) {' + 'if ( 0x0002 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) ) {', ) expect(header).toContain( - 'halCommonSetToken(TOKEN_STACK_VERSION_SINGLETON, data); }' + 'halCommonSetToken(TOKEN_STACK_VERSION_SINGLETON, data); }', ) expect(header).toContain( - 'if ( 0x0003 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) )' + 'if ( 0x0003 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) )', ) expect(header).toContain( - 'halCommonSetToken(TOKEN_HW_VERSION_SINGLETON, data); }' + 'halCommonSetToken(TOKEN_HW_VERSION_SINGLETON, data); }', ) expect(header).toContain('if ( 1 == endpoint )') expect(header).not.toContain('if ( 2 == endpoint )') expect(header).toContain('if ( 7 == endpoint )') expect(header).toContain( - 'if ( 0x0001 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) )' + 'if ( 0x0001 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) )', ) expect(header).toContain( - 'halCommonSetToken(TOKEN_APPLICATION_VERSION_1, data);' + 'halCommonSetToken(TOKEN_APPLICATION_VERSION_1, data);', ) expect(header).toContain( - 'halCommonSetToken(TOKEN_APPLICATION_VERSION_7, data);' + 'halCommonSetToken(TOKEN_APPLICATION_VERSION_7, data);', ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -329,7 +329,7 @@ test( { generateOnly: 'zap-tokens-version-2.h', disableDeprecationWarnings: true, - } + }, ) expect(genResult).not.toBeNull() @@ -341,49 +341,49 @@ test( // Singletons expect(header).toContain('#define CREATOR_STACK_VERSION_SINGLETON 0xB000') expect(header).toContain( - '#define NVM3KEY_STACK_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE | 0xB000)' + '#define NVM3KEY_STACK_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE | 0xB000)', ) expect(header).toContain('#define CREATOR_HW_VERSION_SINGLETON 0xB001') expect(header).toContain( - '#define NVM3KEY_HW_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE | 0xB001)' + '#define NVM3KEY_HW_VERSION_SINGLETON (NVM3KEY_DOMAIN_ZIGBEE | 0xB001)', ) // Non-singletons expect(header).toContain('#define CREATOR_APPLICATION_VERSION_1 0xB002') expect(header).toContain( - '#define NVM3KEY_APPLICATION_VERSION_1 (NVM3KEY_DOMAIN_ZIGBEE | 0xB002)' + '#define NVM3KEY_APPLICATION_VERSION_1 (NVM3KEY_DOMAIN_ZIGBEE | 0xB002)', ) expect(header).toContain('#define CREATOR_APPLICATION_VERSION_7 0xB004') expect(header).toContain( - '#define NVM3KEY_APPLICATION_VERSION_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB004)' + '#define NVM3KEY_APPLICATION_VERSION_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB004)', ) expect(header).toContain('#define CREATOR_PRODUCT_CODE_1 0xB003') expect(header).toContain( - '#define NVM3KEY_PRODUCT_CODE_1 (NVM3KEY_DOMAIN_ZIGBEE | 0xB003)' + '#define NVM3KEY_PRODUCT_CODE_1 (NVM3KEY_DOMAIN_ZIGBEE | 0xB003)', ) expect(header).toContain( - '#define CREATOR_COLOR_CONTROL_COLOR_MODE_7 0xB008' + '#define CREATOR_COLOR_CONTROL_COLOR_MODE_7 0xB008', ) expect(header).toContain( - '#define NVM3KEY_COLOR_CONTROL_COLOR_MODE_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB008)' + '#define NVM3KEY_COLOR_CONTROL_COLOR_MODE_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB008)', ) expect(header).toContain( - '#define CREATOR_LEVEL_CONTROL_REMAINING_TIME_7 0xB005' + '#define CREATOR_LEVEL_CONTROL_REMAINING_TIME_7 0xB005', ) expect(header).toContain( - '#define NVM3KEY_LEVEL_CONTROL_REMAINING_TIME_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB005)' + '#define NVM3KEY_LEVEL_CONTROL_REMAINING_TIME_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB005)', ) expect(header).toContain( - '#define CREATOR_COLOR_CONTROL_REMAINING_TIME_7 0xB007' + '#define CREATOR_COLOR_CONTROL_REMAINING_TIME_7 0xB007', ) expect(header).toContain( - '#define NVM3KEY_COLOR_CONTROL_REMAINING_TIME_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB007)' + '#define NVM3KEY_COLOR_CONTROL_REMAINING_TIME_7 (NVM3KEY_DOMAIN_ZIGBEE | 0xB007)', ) // DEFINETYPES @@ -391,37 +391,37 @@ test( expect(header).toContain('typedef uint8_t tokType_hw_version;') expect(header).toContain('typedef uint8_t tokType_product_code[17];') expect(header).toContain( - 'typedef uint16_t tokType_level_control_remaining_time;' + 'typedef uint16_t tokType_level_control_remaining_time;', ) expect(header).toContain( - 'typedef uint16_t tokType_color_control_remaining_time;' + 'typedef uint16_t tokType_color_control_remaining_time;', ) // DEFINETOKENS expect(header).toContain( - 'DEFINE_BASIC_TOKEN(APPLICATION_VERSION_2, tokType_application_version' + 'DEFINE_BASIC_TOKEN(APPLICATION_VERSION_2, tokType_application_version', ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(APPLICATION_VERSION_7, tokType_application_version' + 'DEFINE_BASIC_TOKEN(APPLICATION_VERSION_7, tokType_application_version', ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(PRODUCT_CODE_7, tokType_product_code, { 0x03, 0x41, 0x42, 0x43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })' + 'DEFINE_BASIC_TOKEN(PRODUCT_CODE_7, tokType_product_code, { 0x03, 0x41, 0x42, 0x43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 })', ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(LEVEL_CONTROL_REMAINING_TIME_7, tokType_level_control_remaining_time, 0xA)' + 'DEFINE_BASIC_TOKEN(LEVEL_CONTROL_REMAINING_TIME_7, tokType_level_control_remaining_time, 0xA)', ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(COLOR_CONTROL_REMAINING_TIME_7, tokType_color_control_remaining_time, 0xA1B2)' + 'DEFINE_BASIC_TOKEN(COLOR_CONTROL_REMAINING_TIME_7, tokType_color_control_remaining_time, 0xA1B2)', ) expect(header).toContain( - 'DEFINE_BASIC_TOKEN(COLOR_CONTROL_COLOR_MODE_7, tokType_color_control_color_mode, 0x1)' + 'DEFINE_BASIC_TOKEN(COLOR_CONTROL_COLOR_MODE_7, tokType_color_control_color_mode, 0x1)', ) // GENERATED_TOKEN_LOADER expect(header).toContain( - 'halCommonGetToken((tokType_stack_version *)ptr, TOKEN_STACK_VERSION_SINGLETON);' + 'halCommonGetToken((tokType_stack_version *)ptr, TOKEN_STACK_VERSION_SINGLETON);', ) // Commenting this test because there is something undeterministic here for endoint identifier 1/7. // Could be the test zap file, schema or query. @@ -429,19 +429,19 @@ test( // 'emberAfWriteServerAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_STACK_VERSION_ATTRIBUTE_ID, (uint8_t*)ptr, ZCL_INT8U_ATTRIBUTE_TYPE);' //) expect(header).toContain( - 'if(1 == (endpoint) || (EMBER_BROADCAST_ENDPOINT == (endpoint) && epNetwork == curNetwork))' + 'if(1 == (endpoint) || (EMBER_BROADCAST_ENDPOINT == (endpoint) && epNetwork == curNetwork))', ) expect(header).toContain( - 'if(7 == (endpoint) || (EMBER_BROADCAST_ENDPOINT == (endpoint) && epNetwork == curNetwork))' + 'if(7 == (endpoint) || (EMBER_BROADCAST_ENDPOINT == (endpoint) && epNetwork == curNetwork))', ) expect(header).toContain( - 'halCommonGetToken((tokType_application_version *)ptr, TOKEN_APPLICATION_VERSION_1);' + 'halCommonGetToken((tokType_application_version *)ptr, TOKEN_APPLICATION_VERSION_1);', ) expect(header).toContain( - 'halCommonGetToken((tokType_application_version *)ptr, TOKEN_APPLICATION_VERSION_7);' + 'halCommonGetToken((tokType_application_version *)ptr, TOKEN_APPLICATION_VERSION_7);', ) expect(header).toContain( - 'emberAfWriteServerAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_APPLICATION_VERSION_ATTRIBUTE_ID, (uint8_t*)ptr, ZCL_INT8U_ATTRIBUTE_TYPE);' + 'emberAfWriteServerAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_APPLICATION_VERSION_ATTRIBUTE_ID, (uint8_t*)ptr, ZCL_INT8U_ATTRIBUTE_TYPE);', ) // GENERATED_TOKEN_SAVER @@ -449,30 +449,30 @@ test( expect(header).toContain('if ( 0x0000 == clusterId )') expect(header).not.toContain('if ( 0x0001 == clusterId )') expect(header).toContain( - 'if ( 0x0002 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) )' + 'if ( 0x0002 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) )', ) expect(header).toContain( - 'if ( 0x0003 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) )' + 'if ( 0x0003 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) )', ) expect(header).toContain( - 'halCommonSetToken(TOKEN_HW_VERSION_SINGLETON, data);' + 'halCommonSetToken(TOKEN_HW_VERSION_SINGLETON, data);', ) expect(header).toContain('if ( 1 == endpoint )') expect(header).toContain('if ( 7 == endpoint )') expect(header).toContain( - 'if ( 0x0001 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) )' + 'if ( 0x0001 == metadata->attributeId && 0x0000 == emberAfGetMfgCode(metadata) && !emberAfAttributeIsClient(metadata) )', ) expect(header).toContain( - 'halCommonSetToken(TOKEN_APPLICATION_VERSION_1, data);' + 'halCommonSetToken(TOKEN_APPLICATION_VERSION_1, data);', ) expect(header).toContain( - 'halCommonSetToken(TOKEN_APPLICATION_VERSION_7, data);' + 'halCommonSetToken(TOKEN_APPLICATION_VERSION_7, data);', ) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/util.test.js b/test/util.test.js index b35be49870..ec3bf8a23c 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -31,7 +31,7 @@ test( expect(util.asHex('0x123', 4)).toEqual('0x0123') expect(util.asHex(123, 4)).toEqual('0x007B') }, - timeout.short() + timeout.short(), ) test( @@ -40,10 +40,10 @@ test( expect(util2.patternFormat('{a}{b}', { a: 1, b: 2 })).toEqual('12') expect(util2.patternFormat('{a}{b}', { a: 10, b: 2 })).toEqual('102') expect(util2.patternFormat('{a:hexuppercase}{b}', { a: 10, b: 2 })).toEqual( - 'A2' + 'A2', ) expect(util2.patternFormat('{a:hexlowercase}{b}', { a: 10, b: 2 })).toEqual( - 'a2' + 'a2', ) expect( util2.patternFormat( @@ -51,9 +51,9 @@ test( { a: 'some string', b: 'another string', - } - ) + }, + ), ).toEqual('someString another_string ANOTHER_STRING') }, - timeout.short() + timeout.short(), ) diff --git a/test/validation.test.js b/test/validation.test.js index 568853a119..c0b8d30e45 100644 --- a/test/validation.test.js +++ b/test/validation.test.js @@ -59,10 +59,10 @@ test( 'USER', 'SESSION', env.builtinSilabsZclMetafile(), - env.builtinTemplateMetafile() + env.builtinTemplateMetafile(), ) }, - timeout.medium() + timeout.medium(), ) test( @@ -90,7 +90,7 @@ test( expect(validation.isValidFloat('0x000G')).toBeFalsy() expect(validation.isValidFloat('5.6....')).toBeFalsy() }, - timeout.medium() + timeout.medium(), ) test( @@ -106,10 +106,10 @@ test( // big expect( validation.extractBigIntegerValue('0x7FFFFFFFFFFFFF') == - 36028797018963967n + 36028797018963967n, ).toBeTruthy() }, - timeout.medium() + timeout.medium(), ) test('getIntegerFromAttribute function', () => { @@ -131,55 +131,56 @@ test('Test hex unsigned to signed conversion', () => { // 24 bits expect( - validation.unsignedToSignedInteger(0x800000, 24) == -8388608 + validation.unsignedToSignedInteger(0x800000, 24) == -8388608, ).toBeTruthy() expect( - validation.unsignedToSignedInteger(0x7fffff, 24) == 8388607 + validation.unsignedToSignedInteger(0x7fffff, 24) == 8388607, ).toBeTruthy() // 32 bits expect( - validation.unsignedToSignedInteger(0x80000000n, 32) == -2147483648n + validation.unsignedToSignedInteger(0x80000000n, 32) == -2147483648n, ).toBeTruthy() expect( - validation.unsignedToSignedInteger(0x7fffffffn, 32) == 2147483647n + validation.unsignedToSignedInteger(0x7fffffffn, 32) == 2147483647n, ).toBeTruthy() // 40 bits expect( - validation.unsignedToSignedInteger(0x8000000000n, 40) == -549755813888n + validation.unsignedToSignedInteger(0x8000000000n, 40) == -549755813888n, ).toBeTruthy() expect( - validation.unsignedToSignedInteger(0x7fffffffffn, 40) == 549755813887n + validation.unsignedToSignedInteger(0x7fffffffffn, 40) == 549755813887n, ).toBeTruthy() // 48 bits expect( - validation.unsignedToSignedInteger(0x800000000000n, 48) == -140737488355328n + validation.unsignedToSignedInteger(0x800000000000n, 48) == + -140737488355328n, ).toBeTruthy() expect( - validation.unsignedToSignedInteger(0x7fffffffffffn, 48) == 140737488355327n + validation.unsignedToSignedInteger(0x7fffffffffffn, 48) == 140737488355327n, ).toBeTruthy() // 54 bits expect( validation.unsignedToSignedInteger(0x80000000000000n, 56) == - -36028797018963968n + -36028797018963968n, ).toBeTruthy() expect( validation.unsignedToSignedInteger(0x7fffffffffffffn, 56) == - 36028797018963967n + 36028797018963967n, ).toBeTruthy() // 64 bits expect( validation.unsignedToSignedInteger(0x8000000000000000n, 64) == - -9223372036854775808n + -9223372036854775808n, ).toBeTruthy() expect( validation.unsignedToSignedInteger(0x7fffffffffffffffn, 64) == - 9223372036854775807n + 9223372036854775807n, ).toBeTruthy() }) @@ -200,7 +201,7 @@ test( expect(!validation.checkBoundsFloat(351.0, 25, 50.0)) expect(!validation.checkBoundsFloat(351.0, 355, 5650.0)) }, - timeout.medium() + timeout.medium(), ) test( @@ -219,7 +220,7 @@ test( expect(types.isFloat('FLOAT_DOUBLE')) expect(!types.isFloat('LONG_OCTET_STRING')) }, - timeout.medium() + timeout.medium(), ) test( @@ -230,7 +231,7 @@ test( db, pkgId, 3, - null + null, ) attribute = attribute.filter((e) => { return e.code === 0 @@ -239,14 +240,14 @@ test( const { size, isSigned } = await validation.getIntegerAttributeSize( db, sid, - attribute.type + attribute.type, ) //Test Constraints let minMax = await validation.getBoundsInteger(attribute, size, isSigned) expect(minMax.min == 0).toBeTruthy() expect(minMax.max === 0xffff).toBeTruthy() }, - timeout.medium() + timeout.medium(), ) test( @@ -268,9 +269,9 @@ test( fakeEndpointAttribute, fakeAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeTruthy() // Check for if attribute is out of bounds. @@ -281,9 +282,9 @@ test( fakeEndpointAttribute, fakeAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeFalsy() fakeEndpointAttribute.defaultValue = '5' @@ -293,9 +294,9 @@ test( fakeEndpointAttribute, fakeAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeFalsy() //Check if attribute is actually a number @@ -306,9 +307,9 @@ test( fakeEndpointAttribute, fakeAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeFalsy() fakeAttribute = { @@ -326,9 +327,9 @@ test( fakeEndpointAttribute, fakeAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeTruthy() //Check out of bounds. fakeEndpointAttribute = { @@ -340,9 +341,9 @@ test( fakeEndpointAttribute, fakeAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeFalsy() fakeEndpointAttribute = { defaultValue: '.25', @@ -353,9 +354,9 @@ test( fakeEndpointAttribute, fakeAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeFalsy() //Check if attribute is actually a number @@ -366,9 +367,9 @@ test( fakeEndpointAttribute, fakeAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeFalsy() // Expect no issues with strings. @@ -384,9 +385,9 @@ test( fakeEndpointAttribute, fakeAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeTruthy() // check if handle signed numbers @@ -407,9 +408,9 @@ test( fakeEndpointAttributeValid, fakeSignedAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeTruthy() expect( ( @@ -417,12 +418,12 @@ test( fakeEndpointAttributeInvalid, fakeSignedAttribute, db, - sid + sid, ) - ).defaultValue.length == 0 + ).defaultValue.length == 0, ).toBeFalsy() }, - timeout.medium() + timeout.medium(), ) test( @@ -434,10 +435,10 @@ test( networkId: '0', } expect( - validation.validateSpecificEndpoint(endpoint).endpointId.length == 0 + validation.validateSpecificEndpoint(endpoint).endpointId.length == 0, ).toBeTruthy() expect( - validation.validateSpecificEndpoint(endpoint).networkId.length == 0 + validation.validateSpecificEndpoint(endpoint).networkId.length == 0, ).toBeTruthy() //Validate not a number @@ -446,10 +447,10 @@ test( networkId: 'blah', } expect( - validation.validateSpecificEndpoint(endpoint).endpointId.length == 0 + validation.validateSpecificEndpoint(endpoint).endpointId.length == 0, ).toBeFalsy() expect( - validation.validateSpecificEndpoint(endpoint).networkId.length == 0 + validation.validateSpecificEndpoint(endpoint).networkId.length == 0, ).toBeFalsy() //Validate 0 not being valid Endpoint ID @@ -458,7 +459,7 @@ test( networkId: 'blah', } expect( - validation.validateSpecificEndpoint(endpoint).endpointId.length == 0 + validation.validateSpecificEndpoint(endpoint).endpointId.length == 0, ).toBeFalsy() //Validate out of bounds on endpointId @@ -467,10 +468,10 @@ test( networkId: 'blah', } expect( - validation.validateSpecificEndpoint(endpoint).endpointId.length == 0 + validation.validateSpecificEndpoint(endpoint).endpointId.length == 0, ).toBeFalsy() }, - timeout.medium() + timeout.medium(), ) describe('Validate endpoint for duplicate endpointIds', () => { @@ -487,12 +488,12 @@ describe('Validate endpoint for duplicate endpointIds', () => { 'USER', 'SESSION', env.builtinSilabsZclMetafile(), - env.builtinTemplateMetafile() + env.builtinTemplateMetafile(), ) let rows = await queryDeviceType.selectAllDeviceTypes(db, pkgId) let haOnOffDeviceTypeArray = rows.filter( - (data) => data.label === 'HA-onoff' + (data) => data.label === 'HA-onoff', ) let haOnOffDeviceType = haOnOffDeviceTypeArray[0] let deviceTypeId = haOnOffDeviceType.id @@ -500,7 +501,7 @@ describe('Validate endpoint for duplicate endpointIds', () => { await querySession.selectSessionPartitionInfoFromDeviceType( db, sid, - deviceTypeId + deviceTypeId, ) let rowId = await queryConfig.insertEndpointType( db, @@ -509,7 +510,7 @@ describe('Validate endpoint for duplicate endpointIds', () => { deviceTypeId, haOnOffDeviceType.code, 0, - true + true, ) endpointTypeIdOnOff = rowId let endpointType = await queryEndpointType.selectEndpointType(db, rowId) @@ -519,7 +520,7 @@ describe('Validate endpoint for duplicate endpointIds', () => { 1, endpointType.endpointTypeId, 1, - 23 + 23, ) eptId = await queryEndpoint.insertEndpoint( db, @@ -527,7 +528,7 @@ describe('Validate endpoint for duplicate endpointIds', () => { 1, endpointType.endpointTypeId, 1, - 23 + 23, ) }, timeout.long()) test( @@ -539,6 +540,6 @@ describe('Validate endpoint for duplicate endpointIds', () => { .then((hasNoDuplicates) => { expect(hasNoDuplicates).toBeFalsy() }), - timeout.medium() + timeout.medium(), ) }) diff --git a/test/zcl-loader-consecutive.test.js b/test/zcl-loader-consecutive.test.js index 74ff03802a..1612f15fde 100644 --- a/test/zcl-loader-consecutive.test.js +++ b/test/zcl-loader-consecutive.test.js @@ -48,7 +48,7 @@ test( await dbApi.closeDatabase(db) }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -76,7 +76,7 @@ test( let rows = await queryPackage.getPackagesByType( db, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) expect(rows.length).toEqual(2) let x = await queryZcl.selectAllClusters(db, jsonPackageId) @@ -168,7 +168,7 @@ test( x = await queryZcl.selectAllAttributesBySide( db, 'server', - dotdotPackageId + dotdotPackageId, ) expect(x.length).toBe(615) @@ -184,28 +184,28 @@ test( x = await dbApi.dbAll( db, 'SELECT MANUFACTURER_CODE FROM CLUSTER WHERE MANUFACTURER_CODE NOT NULL', - [] + [], ) expect(x.length).toEqual(5) x = await dbApi.dbAll( db, 'SELECT MANUFACTURER_CODE FROM COMMAND WHERE MANUFACTURER_CODE NOT NULL', - [] + [], ) expect(x.length).toEqual(58) x = await dbApi.dbAll( db, 'SELECT MANUFACTURER_CODE FROM ATTRIBUTE WHERE MANUFACTURER_CODE NOT NULL', - [] + [], ) expect(x.length).toEqual(30) rows = await dbApi.dbMultiSelect( db, 'SELECT CLUSTER_ID FROM CLUSTER WHERE CODE = ?', - [[0], [6]] + [[0], [6]], ) expect(rows.length).toBe(2) expect(rows[0]).not.toBeUndefined() @@ -216,23 +216,23 @@ test( rows = await queryPackage.selectAllOptionsValues( db, jsonPackageId, - dbEnum.sessionOption.defaultResponsePolicy + dbEnum.sessionOption.defaultResponsePolicy, ) expect(rows.length).toBe(3) await dbApi.dbAll( db, 'SELECT DATA_TYPE.NAME, BITMAP.BITMAP_ID, DATA_TYPE.PACKAGE_REF FROM BITMAP INNER JOIN DATA_TYPE ON BITMAP.BITMAP_ID = DATA_TYPE.DATA_TYPE_ID WHERE NAME IN (SELECT DATA_TYPE.NAME FROM BITMAP INNER JOIN DATA_TYPE ON BITMAP.BITMAP_ID = DATA_TYPE.DATA_TYPE_ID GROUP BY DATA_TYPE.NAME HAVING COUNT(*)>1)', - [] + [], ) await dbApi.dbAll( db, 'SELECT DATA_TYPE.NAME, ENUM.ENUM_ID, DATA_TYPE.PACKAGE_REF FROM ENUM INNER JOIN DATA_TYPE ON ENUM.ENUM_ID = DATA_TYPE.DATA_TYPE_ID WHERE NAME IN (SELECT DATA_TYPE.NAME FROM ENUM INNER JOIN DATA_TYPE ON ENUM.ENUM_ID = DATA_TYPE.DATA_TYPE_ID GROUP BY DATA_TYPE.NAME HAVING COUNT(*)>1)', - [] + [], ) } finally { dbApi.closeDatabase(db) } }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/zcl-loader.test.js b/test/zcl-loader.test.js index fda1d9847c..ac5f011b06 100644 --- a/test/zcl-loader.test.js +++ b/test/zcl-loader.test.js @@ -41,7 +41,7 @@ test( let db = await dbApi.initRamDatabase() await dbApi.closeDatabase(db) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -51,7 +51,7 @@ test( await dbApi.loadSchema(db, env.schemaFile(), env.zapVersion()) await dbApi.closeDatabase(db) }, - testUtil.timeout.medium() + testUtil.timeout.medium(), ) test( @@ -70,7 +70,7 @@ test( expect(p.category).toEqual('zigbee') let x = await queryPackage.getPackagesByType( db, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) expect(x.length).toEqual(1) @@ -113,7 +113,7 @@ test( x = await dbApi.dbAll( db, 'SELECT MANUFACTURER_CODE FROM CLUSTER WHERE MANUFACTURER_CODE NOT NULL', - [] + [], ) expect(x.length).toEqual(5) @@ -121,14 +121,14 @@ test( x = await dbApi.dbAll( db, 'SELECT MANUFACTURER_CODE FROM COMMAND WHERE MANUFACTURER_CODE NOT NULL', - [] + [], ) expect(x.length).toEqual(58) x = await dbApi.dbAll( db, 'SELECT MANUFACTURER_CODE FROM ATTRIBUTE WHERE MANUFACTURER_CODE NOT NULL', - [] + [], ) expect(x.length).toEqual(30) @@ -136,7 +136,7 @@ test( let rows = await dbApi.dbMultiSelect( db, 'SELECT CLUSTER_ID FROM CLUSTER WHERE CODE = ?', - [[0], [6]] + [[0], [6]], ) expect(rows.length).toBe(2) @@ -147,7 +147,7 @@ test( rows = await queryPackage.selectAllOptionsValues( db, packageId, - dbEnum.sessionOption.defaultResponsePolicy + dbEnum.sessionOption.defaultResponsePolicy, ) expect(rows.length).toBe(3) @@ -162,12 +162,12 @@ test( x = await dbApi.dbAll( db, 'SELECT DATA_TYPE.NAME AS NAME, BITMAP.BITMAP_ID, DATA_TYPE.PACKAGE_REF FROM BITMAP INNER JOIN DATA_TYPE ON BITMAP.BITMAP_ID = DATA_TYPE.DATA_TYPE_ID WHERE NAME IN (SELECT DATA_TYPE.NAME AS NAME FROM BITMAP INNER JOIN DATA_TYPE ON BITMAP.BITMAP_ID = DATA_TYPE.DATA_TYPE_ID GROUP BY NAME HAVING COUNT(*)>1)', - [] + [], ) x.forEach((c) => { env.logWarning( - `Found Non Unique Bitmap in Silabs XML: ${c.NAME} ${c.TYPE} ${c.PACKAGE_REF}` + `Found Non Unique Bitmap in Silabs XML: ${c.NAME} ${c.TYPE} ${c.PACKAGE_REF}`, ) }) @@ -181,19 +181,19 @@ test( x = await dbApi.dbAll( db, 'SELECT DATA_TYPE.NAME, ENUM.ENUM_ID, DATA_TYPE.PACKAGE_REF FROM ENUM INNER JOIN DATA_TYPE ON ENUM.ENUM_ID = DATA_TYPE.DATA_TYPE_ID WHERE NAME IN (SELECT DATA_TYPE.NAME FROM ENUM INNER JOIN DATA_TYPE ON ENUM.ENUM_ID = DATA_TYPE.DATA_TYPE_ID GROUP BY DATA_TYPE.NAME HAVING COUNT(*)>1)', - [] + [], ) x.forEach((c) => { env.logWarning( - `Found Non Unique Enum in Silabs XML: ${c.NAME} ${c.TYPE} ${c.PACKAGE_REF}` + `Found Non Unique Enum in Silabs XML: ${c.NAME} ${c.TYPE} ${c.PACKAGE_REF}`, ) }) } finally { await dbApi.closeDatabase(db) } }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -205,7 +205,7 @@ test( let ctx = await zclLoader.loadZcl( db, - env.builtinSilabsZclSpecialMetafile() + env.builtinSilabsZclSpecialMetafile(), ) let packageId = ctx.packageId @@ -220,7 +220,7 @@ test( let generalXmlFileOriginalContent = fs.readFileSync(xmlFilePath, 'utf8') let generalXmlFileUpdatedContent = generalXmlFileOriginalContent.replace( originalString, - editString + editString, ) fs.writeFileSync(xmlFilePath, generalXmlFileUpdatedContent, 'utf8') @@ -234,18 +234,18 @@ test( expect(packageId).not.toEqual(newPackageId) let oldPackages = await dbApi.dbAll( db, - `SELECT * FROM PACKAGE WHERE PARENT_PACKAGE_REF = ${packageId}` + `SELECT * FROM PACKAGE WHERE PARENT_PACKAGE_REF = ${packageId}`, ) let newPackages = await dbApi.dbAll( db, - `SELECT * FROM PACKAGE WHERE PARENT_PACKAGE_REF = ${newPackageId}` + `SELECT * FROM PACKAGE WHERE PARENT_PACKAGE_REF = ${newPackageId}`, ) // Making sure all packages are loaded again expect(oldPackages.length).toEqual(newPackages.length) let topLevelZclPackages = await dbApi.dbAll( db, - `SELECT * FROM PACKAGE WHERE TYPE = '${dbEnum.packageType.zclProperties}' ORDER BY PACKAGE_ID` + `SELECT * FROM PACKAGE WHERE TYPE = '${dbEnum.packageType.zclProperties}' ORDER BY PACKAGE_ID`, ) expect(topLevelZclPackages[0].IS_IN_SYNC).toEqual(0) expect(topLevelZclPackages[1].IS_IN_SYNC).toEqual(1) @@ -256,7 +256,7 @@ test( await dbApi.closeDatabase(db) } }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -275,7 +275,7 @@ test( let x = await queryPackage.getPackagesByType( db, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) expect(x.length).toEqual(1) @@ -312,20 +312,20 @@ test( dc.forEach((dcr) => { if (!dcr.clusterRef) { unmatched.push( - `for ${d.caption} failed to match dcr ${dcr.clusterName}` + `for ${d.caption} failed to match dcr ${dcr.clusterName}`, ) } else { queryDeviceType .selectDeviceTypeAttributesByDeviceTypeRef( db, - dcr.deviceTypeRef + dcr.deviceTypeRef, ) .then((dcas) => { if (dcas.length > 0) { dcas.forEach((dca) => { if (!dca.attributeRef) { nullAttribute.push( - `attributeRef for ${dca.attributeName} is NULL` + `attributeRef for ${dca.attributeName} is NULL`, ) } }) @@ -339,12 +339,12 @@ test( x = await dbApi.dbAll( db, 'SELECT DATA_TYPE.NAME, ENUM.ENUM_ID, DATA_TYPE.PACKAGE_REF FROM ENUM INNER JOIN DATA_TYPE ON ENUM.ENUM_ID = DATA_TYPE.DATA_TYPE_ID WHERE NAME IN (SELECT DATA_TYPE.NAME FROM ENUM INNER JOIN DATA_TYPE ON ENUM.ENUM_ID = DATA_TYPE.DATA_TYPE_ID GROUP BY DATA_TYPE.NAME HAVING COUNT(*)>1)', - [] + [], ) x.forEach((c) => { nonUniqueEnum.push( - `Found Non Unique Enum in Dotdot XML: ${c.NAME} ${c.TYPE} ${c.PACKAGE_REF}` + `Found Non Unique Enum in Dotdot XML: ${c.NAME} ${c.TYPE} ${c.PACKAGE_REF}`, ) }) @@ -355,7 +355,7 @@ test( await dbApi.closeDatabase(db) } }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -372,7 +372,7 @@ test( let rows = await queryPackage.getPackagesByType( db, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) expect(rows.length).toEqual(1) @@ -383,34 +383,34 @@ test( expect(p.version).toEqual(1) rows = await queryPackage.getPackagesByType( db, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) expect(rows.length).toEqual(2) let x = await dbApi.dbAll( db, 'SELECT NAME, CODE, PACKAGE_REF FROM CLUSTER WHERE CODE IN (SELECT CODE FROM CLUSTER GROUP BY CODE HAVING COUNT(CODE)=1)', - [] + [], ) expect(x.length).toBeGreaterThan(0) x = await dbApi.dbAll( db, 'SELECT NAME, ATOMIC_IDENTIFIER, PACKAGE_REF FROM ATOMIC WHERE ATOMIC_IDENTIFIER IN (SELECT ATOMIC_IDENTIFIER FROM ATOMIC GROUP BY ATOMIC_IDENTIFIER HAVING COUNT(ATOMIC_IDENTIFIER)=1)', - [] + [], ) expect(x.length).toBeGreaterThan(0) x = await dbApi.dbAll( db, 'SELECT DATA_TYPE.NAME AS NAME, BITMAP.BITMAP_ID, DATA_TYPE.PACKAGE_REF FROM BITMAP INNER JOIN DATA_TYPE ON BITMAP.BITMAP_ID = DATA_TYPE.DATA_TYPE_ID WHERE NAME IN (SELECT DATA_TYPE.NAME AS NAME FROM BITMAP INNER JOIN DATA_TYPE ON BITMAP.BITMAP_ID = DATA_TYPE.DATA_TYPE_ID GROUP BY NAME HAVING COUNT(NAME)=1)', - [] + [], ) expect(x.length).toBeGreaterThan(0) } finally { await dbApi.closeDatabase(db) } }, - testUtil.timeout.long() + testUtil.timeout.long(), ) test( @@ -426,7 +426,7 @@ test( let x = await queryPackage.getPackagesByType( db, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) expect(x.length).toEqual(1) @@ -452,5 +452,5 @@ test( await dbApi.closeDatabase(db) } }, - testUtil.timeout.long() + testUtil.timeout.long(), ) diff --git a/test/zcl-properties-loader.test.js b/test/zcl-properties-loader.test.js index e87c7d01c1..d21c4b6730 100644 --- a/test/zcl-properties-loader.test.js +++ b/test/zcl-properties-loader.test.js @@ -31,7 +31,7 @@ const { timeout } = require('./test-util') const zclTestPropertiesFile = path.join( __dirname, - '../zcl-builtin/silabs/zcl-test.properties' + '../zcl-builtin/silabs/zcl-test.properties', ) beforeAll(() => { @@ -50,7 +50,7 @@ test( expect(p.version).toEqual('ZCL Test Data') let x = await queryPackage.getPackagesByType( db, - dbEnum.packageType.zclProperties + dbEnum.packageType.zclProperties, ) expect(x.length).toEqual(1) @@ -81,25 +81,25 @@ test( x = await dbApi.dbAll( db, 'SELECT MANUFACTURER_CODE FROM CLUSTER WHERE MANUFACTURER_CODE NOT NULL', - [] + [], ) expect(x.length).toEqual(0) x = await dbApi.dbAll( db, 'SELECT MANUFACTURER_CODE FROM COMMAND WHERE MANUFACTURER_CODE NOT NULL', - [] + [], ) expect(x.length).toEqual(0) x = await dbApi.dbAll( db, 'SELECT MANUFACTURER_CODE FROM ATTRIBUTE WHERE MANUFACTURER_CODE NOT NULL', - [] + [], ) expect(x.length).toEqual(0) let rows = await dbApi.dbMultiSelect( db, 'SELECT CLUSTER_ID FROM CLUSTER WHERE CODE = ?', - [[0], [6]] + [[0], [6]], ) expect(rows.length).toBe(2) expect(rows[0]).not.toBeUndefined() @@ -110,7 +110,7 @@ test( rows = await queryPackage.selectAllOptionsValues( db, packageId, - dbEnum.sessionOption.defaultResponsePolicy + dbEnum.sessionOption.defaultResponsePolicy, ) expect(rows.length).toBe(3) @@ -118,5 +118,5 @@ test( await dbApi.closeDatabase(db) } }, - timeout.medium() + timeout.medium(), )