From 6e06aac1e9e4dd0b8eeff2ef0ba6869243f832b8 Mon Sep 17 00:00:00 2001
From: Dan Jones <danjon@noc.ac.uk>
Date: Fri, 30 Aug 2024 13:35:24 +0100
Subject: [PATCH 1/6] fix: add hyphen to schema version regex

- Current regex works for dev, master and semvers
- It doesn't work for issue branches
---
 CHANGELOG.md          | 4 ++++
 src/protocol/index.js | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee493a3..042f643 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 ## [Unreleased]
 
+### Changed 
+
+- Add hyphen to regex for schema version to enable issue branches 
+
 ## [v0.1.0] - 2023-03-24
 
 ### Added
diff --git a/src/protocol/index.js b/src/protocol/index.js
index e1f35d3..0dc039b 100644
--- a/src/protocol/index.js
+++ b/src/protocol/index.js
@@ -125,7 +125,7 @@ export class GenericSoarProtocol extends GenericProtocol {
    * @returns {object}
    */
   createValidator(schema) {
-    if (typeof schema === 'string' && schema.match(/^[\w.]+$/)) {
+    if (typeof schema === 'string' && schema.match(/^[\w.-]+$/)) {
       this.loadSchema(schema).then((schema) => {
         this.validator = new Validator(schema);
       });
-- 
GitLab


From 282236649be7b4114c997603a0828883c3e9e918 Mon Sep 17 00:00:00 2001
From: Dan Jones <danjon@noc.ac.uk>
Date: Fri, 30 Aug 2024 13:46:26 +0100
Subject: [PATCH 2/6] lint: run prettier on changelog

---
 CHANGELOG.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 042f643..f37fea3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,9 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 ## [Unreleased]
 
-### Changed 
+### Changed
 
-- Add hyphen to regex for schema version to enable issue branches 
+- Add hyphen to regex for schema version to enable issue branches
 
 ## [v0.1.0] - 2023-03-24
 
-- 
GitLab


From 825abec3d16813a8ebad0bd383886e845e8a88e6 Mon Sep 17 00:00:00 2001
From: Trishna Saeharaseelan <trishna.saeharaseelan@noc.ac.uk>
Date: Thu, 24 Oct 2024 11:11:46 +0100
Subject: [PATCH 3/6] fix: rebuilt dist protocols

---
 dist/protocol.esm.js | 2 +-
 dist/protocol.js     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dist/protocol.esm.js b/dist/protocol.esm.js
index 71a3d82..848a523 100644
--- a/dist/protocol.esm.js
+++ b/dist/protocol.esm.js
@@ -125,7 +125,7 @@ class GenericSoarProtocol extends GenericProtocol {
    * @returns {object}
    */
   createValidator(schema) {
-    if (typeof schema === 'string' && schema.match(/^[\w.]+$/)) {
+    if (typeof schema === 'string' && schema.match(/^[\w.-]+$/)) {
       this.loadSchema(schema).then((schema) => {
         this.validator = new Validator(schema);
       });
diff --git a/dist/protocol.js b/dist/protocol.js
index e2c74bd..b8fd616 100644
--- a/dist/protocol.js
+++ b/dist/protocol.js
@@ -127,7 +127,7 @@ class GenericSoarProtocol extends GenericProtocol {
    * @returns {object}
    */
   createValidator(schema) {
-    if (typeof schema === 'string' && schema.match(/^[\w.]+$/)) {
+    if (typeof schema === 'string' && schema.match(/^[\w.-]+$/)) {
       this.loadSchema(schema).then((schema) => {
         this.validator = new Validator(schema);
       });
-- 
GitLab


From 71be5f45d8d117e3ca2b983f79b4529cd7dc79df Mon Sep 17 00:00:00 2001
From: Dan Jones <danjon@noc.ac.uk>
Date: Fri, 14 Feb 2025 16:14:15 +0000
Subject: [PATCH 4/6] fix: wait for authentication for fast polling rates

---
 CHANGELOG.md         | 4 ++++
 dist/adapter.esm.js  | 9 +++++++++
 dist/adapter.js      | 9 +++++++++
 src/adapter/index.js | 9 +++++++++
 4 files changed, 31 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index f37fea3..3ca620e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 ## [Unreleased]
 
+### Fixed
+
+- Wait for authentication to complete for fast polling rates
+
 ### Changed
 
 - Add hyphen to regex for schema version to enable issue branches
diff --git a/dist/adapter.esm.js b/dist/adapter.esm.js
index 8625521..22e9c0a 100644
--- a/dist/adapter.esm.js
+++ b/dist/adapter.esm.js
@@ -8,6 +8,7 @@ class Adapter {
     this.protocol = protocol;
     this.config = config;
     this.axios = axios;
+    this.authenticating = false;
   }
 
   /**
@@ -44,6 +45,10 @@ class Adapter {
    * @returns {object}
    */
   getAuthorizationHeader() {
+    if (this.authenticating) {
+      // return an pseudo response with an ignored status
+      return Promise.reject({ response: { status: 405 } });
+    }
     if (!this.tokenValid())
       return this.auth().then((response) => {
         return {
@@ -62,6 +67,7 @@ class Adapter {
    * @returns {object}
    */
   auth() {
+    this.authenticating = true;
     let adapterConfig = this.config;
     return this.axios
       .get(`${adapterConfig.api}/token`, {
@@ -72,9 +78,11 @@ class Adapter {
       })
       .then((response) => {
         this.credentials = response.data;
+        this.authenticating = false;
         return response;
       })
       .catch((error) => {
+        this.authenticating = false;
         return Promise.reject(error);
       });
   }
@@ -116,6 +124,7 @@ class Adapter {
               retry = true;
             }
             break;
+          // ignore 405 from auth in progress
           case 503: {
             retry = true;
           }
diff --git a/dist/adapter.js b/dist/adapter.js
index c1f0e28..868a47c 100644
--- a/dist/adapter.js
+++ b/dist/adapter.js
@@ -10,6 +10,7 @@ class Adapter {
     this.protocol = protocol;
     this.config = config;
     this.axios = axios;
+    this.authenticating = false;
   }
 
   /**
@@ -46,6 +47,10 @@ class Adapter {
    * @returns {object}
    */
   getAuthorizationHeader() {
+    if (this.authenticating) {
+      // return an pseudo response with an ignored status
+      return Promise.reject({ response: { status: 405 } });
+    }
     if (!this.tokenValid())
       return this.auth().then((response) => {
         return {
@@ -64,6 +69,7 @@ class Adapter {
    * @returns {object}
    */
   auth() {
+    this.authenticating = true;
     let adapterConfig = this.config;
     return this.axios
       .get(`${adapterConfig.api}/token`, {
@@ -74,9 +80,11 @@ class Adapter {
       })
       .then((response) => {
         this.credentials = response.data;
+        this.authenticating = false;
         return response;
       })
       .catch((error) => {
+        this.authenticating = false;
         return Promise.reject(error);
       });
   }
@@ -118,6 +126,7 @@ class Adapter {
               retry = true;
             }
             break;
+          // ignore 405 from auth in progress
           case 503: {
             retry = true;
           }
diff --git a/src/adapter/index.js b/src/adapter/index.js
index ef71cc3..fba5231 100644
--- a/src/adapter/index.js
+++ b/src/adapter/index.js
@@ -8,6 +8,7 @@ export class Adapter {
     this.protocol = protocol;
     this.config = config;
     this.axios = axios;
+    this.authenticating = false;
   }
 
   /**
@@ -44,6 +45,10 @@ export class Adapter {
    * @returns {object}
    */
   getAuthorizationHeader() {
+    if (this.authenticating) {
+      // return an pseudo response with an ignored status
+      return Promise.reject({ response: { status: 405 } });
+    }
     if (!this.tokenValid())
       return this.auth().then((response) => {
         return {
@@ -62,6 +67,7 @@ export class Adapter {
    * @returns {object}
    */
   auth() {
+    this.authenticating = true;
     let adapterConfig = this.config;
     return this.axios
       .get(`${adapterConfig.api}/token`, {
@@ -72,9 +78,11 @@ export class Adapter {
       })
       .then((response) => {
         this.credentials = response.data;
+        this.authenticating = false;
         return response;
       })
       .catch((error) => {
+        this.authenticating = false;
         return Promise.reject(error);
       });
   }
@@ -116,6 +124,7 @@ export class Adapter {
               retry = true;
             }
             break;
+          // ignore 405 from auth in progress
           case 503: {
             retry = true;
           }
-- 
GitLab


From f98f36fd0f511b846f365e0536d980ca9dc25433 Mon Sep 17 00:00:00 2001
From: Trishna Saeharaseelan <trishna.saeharaseelan@noc.ac.uk>
Date: Tue, 11 Mar 2025 10:14:42 +0000
Subject: [PATCH 5/6] refactor: version bump and update changelog

---
 CHANGELOG.md | 2 ++
 package.json | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ca620e..57755ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 ## [Unreleased]
 
+## [v1.0.0] - 2025-03-11
+
 ### Fixed
 
 - Wait for authentication to complete for fast polling rates
diff --git a/package.json b/package.json
index 1795dd6..6583da0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@noc-comms-backbone/backbone-adapter-javascript",
-  "version": "0.1.0",
+  "version": "1.0.0",
   "private": true,
   "contributors": [
     {
-- 
GitLab


From ddd579ef104eae61c48f03f65a790d9e9cead7a9 Mon Sep 17 00:00:00 2001
From: Trishna Saeharaseelan <trishna.saeharaseelan@noc.ac.uk>
Date: Tue, 11 Mar 2025 10:47:57 +0000
Subject: [PATCH 6/6] refactor: changelog hyperlinks

---
 CHANGELOG.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 57755ce..3f43ee1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,5 +36,6 @@ Create a soar protocol instance
 - implement retreive schema version by tag/branch/commitref
 - override methods to handle soar message structure
 
+[unreleased]: https://git.noc.ac.uk/communications-backbone-system/backbone-adapter-javascript/compare/v1.0.0...dev
+[v1.0.0]: https://git.noc.ac.uk/communications-backbone-system/backbone-adapter-javascript/compare/v0.1.0...v1.0.0
 [v0.1.0]: https://git.noc.ac.uk/communications-backbone-system/backbone-adapter-javascript/compare/a8eef21a...v0.1.0
-[unreleased]: https://git.noc.ac.uk/communications-backbone-system/backbone-adapter-javascript/compare/v0.1.0...dev
-- 
GitLab