ac-support-connector 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/CODEOWNERS +9 -0
- package/.github/workflows/node.js.yml +1 -1
- package/CHANGELOG.md +23 -0
- package/Makefile +2 -2
- package/eslint.config.js +31 -27
- package/index.js +7 -7
- package/package.json +9 -7
- package/test/test.js +16 -16
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Code Owners
|
|
2
|
+
#
|
|
3
|
+
# This file defines who is responsible for code in this repository.
|
|
4
|
+
# Reviews from code owners are automatically requested for pull requests.
|
|
5
|
+
#
|
|
6
|
+
# More info: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
|
|
7
|
+
|
|
8
|
+
# Default owner for everything in the repo
|
|
9
|
+
* @AdmiralCloud/ac-maintainer-backend
|
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
|
|
2
|
+
## [1.0.11](https://github.com/admiralcloud/ac-support-connector/compare/v1.0.10..v1.0.11) (2026-02-24 19:50:42)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fix
|
|
6
|
+
|
|
7
|
+
* **Misc:** Package updates | MP | [b6607b26ec283654cf2dcffa02c8719d1cc284b6](https://github.com/admiralcloud/ac-support-connector/commit/b6607b26ec283654cf2dcffa02c8719d1cc284b6)
|
|
8
|
+
Package updates incl ESLint 9 -> 10 and lint fixes
|
|
9
|
+
Related issues:
|
|
10
|
+
### Chores
|
|
11
|
+
|
|
12
|
+
* **Misc:** Remove Node 18 from tests | MP | [d08361704454ba261573ef9156584e6732450537](https://github.com/admiralcloud/ac-support-connector/commit/d08361704454ba261573ef9156584e6732450537)
|
|
13
|
+
Remove Node 18 from tests
|
|
14
|
+
Related issues:
|
|
15
|
+
|
|
16
|
+
## [1.0.10](https://github.com/admiralcloud/ac-support-connector/compare/v1.0.9..v1.0.10) (2026-02-03 08:35:38)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fix
|
|
20
|
+
|
|
21
|
+
* **Connector:** Package updates | MP | [a5c71a2b5941e2c82e2c078ce5d594dd0b8c12f7](https://github.com/admiralcloud/ac-support-connector/commit/a5c71a2b5941e2c82e2c078ce5d594dd0b8c12f7)
|
|
22
|
+
Package updates
|
|
23
|
+
Related issues:
|
|
24
|
+
|
|
2
25
|
## [1.0.9](https://github.com/admiralcloud/ac-support-connector/compare/v1.0.8..v1.0.9) (2026-01-27 13:26:39)
|
|
3
26
|
|
|
4
27
|
|
package/Makefile
CHANGED
|
@@ -2,10 +2,10 @@ MOCHA_OPTS= --slow 0 -A
|
|
|
2
2
|
REPORTER = spec
|
|
3
3
|
|
|
4
4
|
lint-fix:
|
|
5
|
-
./node_modules/.bin/eslint --fix
|
|
5
|
+
./node_modules/.bin/eslint --fix
|
|
6
6
|
|
|
7
7
|
lint-check:
|
|
8
|
-
./node_modules/.bin/eslint
|
|
8
|
+
./node_modules/.bin/eslint
|
|
9
9
|
|
|
10
10
|
commit:
|
|
11
11
|
@node ./node_modules/ac-semantic-release/lib/commit.js
|
package/eslint.config.js
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
|
-
const globals = require('globals')
|
|
1
|
+
const globals = require('globals')
|
|
2
2
|
|
|
3
|
-
module.exports =
|
|
4
|
-
|
|
5
|
-
'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
files: ['index.js', 'test/test.js'],
|
|
6
|
+
languageOptions: {
|
|
7
|
+
ecmaVersion: 2022,
|
|
8
|
+
sourceType: 'module',
|
|
9
|
+
globals: {
|
|
10
|
+
...globals.commonjs,
|
|
11
|
+
...globals.es2015,
|
|
12
|
+
...globals.node,
|
|
13
|
+
expect: 'readonly',
|
|
14
|
+
describe: 'readonly',
|
|
15
|
+
it: 'readonly'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
'no-const-assign': 'error',
|
|
20
|
+
'space-before-function-paren': 'off',
|
|
21
|
+
'no-extra-semi': 'off',
|
|
22
|
+
'object-curly-spacing': ['error', 'always'],
|
|
23
|
+
'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
|
|
24
|
+
'block-spacing': 'error',
|
|
25
|
+
'no-useless-escape': 'off',
|
|
26
|
+
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
27
|
+
'no-unused-vars': 'error',
|
|
28
|
+
'eqeqeq': 'error',
|
|
29
|
+
'no-var': 'error',
|
|
30
|
+
'curly': 'error',
|
|
31
|
+
'prefer-const': ['error', { ignoreReadBeforeAssign: true }]
|
|
17
32
|
}
|
|
18
|
-
},
|
|
19
|
-
rules: {
|
|
20
|
-
'no-const-assign': 'error', // Ensure this rule is enabled
|
|
21
|
-
'space-before-function-paren': 'off',
|
|
22
|
-
'no-extra-semi': 'off',
|
|
23
|
-
'object-curly-spacing': ['error', 'always'],
|
|
24
|
-
'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
|
|
25
|
-
'no-useless-escape': 'off',
|
|
26
|
-
'standard/no-callback-literal': 'off',
|
|
27
|
-
'new-cap': 'off',
|
|
28
|
-
'no-console': ['warn', { allow: ['warn', 'error'] }]
|
|
29
33
|
}
|
|
30
|
-
|
|
34
|
+
]
|
package/index.js
CHANGED
|
@@ -33,7 +33,7 @@ module.exports = {
|
|
|
33
33
|
fifo: true
|
|
34
34
|
}]
|
|
35
35
|
}
|
|
36
|
-
if (profile) sqsParams.profile = profile // Optional AWS profile, see below
|
|
36
|
+
if (profile) { sqsParams.profile = profile } // Optional AWS profile, see below
|
|
37
37
|
if (bucket) {
|
|
38
38
|
sqsParams.useS3 = {
|
|
39
39
|
enabled: true,
|
|
@@ -71,11 +71,11 @@ module.exports = {
|
|
|
71
71
|
createMessage: async function({ subject, text, message = [], attachments = [], block, platforms, reporter, messageGroupId }) {
|
|
72
72
|
// check block time in Redis, fallback to memory
|
|
73
73
|
if (block) {
|
|
74
|
-
if (block < 1) block = 1 // make sure to use reasonable value!
|
|
74
|
+
if (block < 1) { block = 1 } // make sure to use reasonable value!
|
|
75
75
|
const key = `${process.env.NODE_ENV}:supportConnector:${this.serviceName}:${Buffer.from(subject).toString('base64')}`
|
|
76
76
|
if (this.redisInstance) {
|
|
77
77
|
// OK if set for the first time, null if existing
|
|
78
|
-
|
|
78
|
+
const response = await this.redisInstance.set(key, 1, 'ex', block, 'nx')
|
|
79
79
|
if (response !== 'OK') {
|
|
80
80
|
return// { statusCode: 423, message: 'keyBlocked' }
|
|
81
81
|
}
|
|
@@ -91,11 +91,11 @@ module.exports = {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// message is an array of objects, if it is empty and just text is set, add it to the array
|
|
94
|
-
if (message.length === 0) message.push({ type: 'text', content: text })
|
|
94
|
+
if (message.length === 0) { message.push({ type: 'text', content: text }) }
|
|
95
95
|
|
|
96
96
|
// service is also part of message array
|
|
97
97
|
message.push({ type: 'service', content: this.serviceName })
|
|
98
|
-
if (this.instanceId) message.push({ type: 'instanceId', content: this.instanceId })
|
|
98
|
+
if (this.instanceId) { message.push({ type: 'instanceId', content: this.instanceId }) }
|
|
99
99
|
|
|
100
100
|
const messagePayload = {
|
|
101
101
|
platforms,
|
|
@@ -103,7 +103,7 @@ module.exports = {
|
|
|
103
103
|
reporter,
|
|
104
104
|
message,
|
|
105
105
|
}
|
|
106
|
-
if (attachments.length > 0) messagePayload.attachments = attachments
|
|
106
|
+
if (attachments.length > 0) { messagePayload.attachments = attachments }
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
if (process.env.NODE_ENV === 'test') {
|
|
@@ -111,7 +111,7 @@ module.exports = {
|
|
|
111
111
|
}
|
|
112
112
|
try {
|
|
113
113
|
const response = await this.acsqs.sendSQSMessage({ name: this.sqsQueue, message: JSON.stringify(messagePayload), messageGroupId: (messageGroupId || this.serviceName) })
|
|
114
|
-
if (this.debugMode) console.warn(response)
|
|
114
|
+
if (this.debugMode) { console.warn(response) }
|
|
115
115
|
return response
|
|
116
116
|
}
|
|
117
117
|
catch(e) {
|
package/package.json
CHANGED
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
"author": "Mark Poepping (https://www.admiralcloud.com)",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "admiralcloud/ac-support-connector",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.11",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@aws-sdk/client-sts": "^3.
|
|
9
|
-
"ac-sqs": "^
|
|
8
|
+
"@aws-sdk/client-sts": "^3.996.0",
|
|
9
|
+
"ac-sqs": "^4.0.4",
|
|
10
10
|
"node-cache": "^5.1.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"ac-semantic-release": "^0.4.10",
|
|
14
14
|
"chai": "^4.5.0",
|
|
15
|
-
"eslint": "^
|
|
16
|
-
"expect": "^
|
|
17
|
-
"
|
|
15
|
+
"eslint": "^10.0.2",
|
|
16
|
+
"expect": "^30.2.0",
|
|
17
|
+
"globals": "^17.3.0",
|
|
18
|
+
"ioredis": "^5.9.3",
|
|
18
19
|
"mocha": "^11.7.5"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
@@ -24,7 +25,8 @@
|
|
|
24
25
|
"node": ">=20.0.0"
|
|
25
26
|
},
|
|
26
27
|
"resolutions": {
|
|
27
|
-
"mocha/diff": "^8.0.3"
|
|
28
|
+
"mocha/diff": "^8.0.3",
|
|
29
|
+
"minimatch": "^10.2.1"
|
|
28
30
|
},
|
|
29
31
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
30
32
|
}
|
package/test/test.js
CHANGED
|
@@ -14,11 +14,11 @@ function timeout(ms) {
|
|
|
14
14
|
|
|
15
15
|
describe('Basic tests', () => {
|
|
16
16
|
it('Test properties', async() => {
|
|
17
|
-
|
|
17
|
+
const params = {
|
|
18
18
|
subject: 'Failed',
|
|
19
19
|
text: 'This failed'
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
const response = await supCon.createMessage(params)
|
|
22
22
|
expect(response).to.have.property('subject', params.subject)
|
|
23
23
|
expect(response).to.have.property('message').that.is.an('array').with.lengthOf.at.least(1);
|
|
24
24
|
expect(response.message[0]).to.have.property('type', 'text')
|
|
@@ -26,7 +26,7 @@ describe('Basic tests', () => {
|
|
|
26
26
|
})
|
|
27
27
|
|
|
28
28
|
it('Check truncated payload > 256KB - should not throw an error', async() => {
|
|
29
|
-
|
|
29
|
+
const params = {
|
|
30
30
|
subject: 'Failed',
|
|
31
31
|
message: [{
|
|
32
32
|
type: 'text',
|
|
@@ -34,7 +34,7 @@ describe('Basic tests', () => {
|
|
|
34
34
|
}]
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
const response = await supCon.createMessage(params)
|
|
38
38
|
expect(response).to.have.property('subject', params.subject)
|
|
39
39
|
expect(response).to.have.property('message').that.is.an('array').with.lengthOf.at.least(1);
|
|
40
40
|
expect(response.message[0]).to.have.property('type', 'text')
|
|
@@ -52,24 +52,24 @@ describe('Block with Redis', () => {
|
|
|
52
52
|
})
|
|
53
53
|
|
|
54
54
|
it('Send message - should work', async() => {
|
|
55
|
-
|
|
55
|
+
const params = {
|
|
56
56
|
subject: 'Failed',
|
|
57
57
|
text: 'This failed',
|
|
58
58
|
level: 'warn',
|
|
59
59
|
block: 5
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
const response = await supCon.createMessage(params)
|
|
62
62
|
expect(response).to.have.property('subject', params.subject)
|
|
63
63
|
})
|
|
64
64
|
|
|
65
65
|
it('Send message - should be blocked', async() => {
|
|
66
|
-
|
|
66
|
+
const params = {
|
|
67
67
|
subject: 'Failed',
|
|
68
68
|
text: 'This failed',
|
|
69
69
|
level: 'warn',
|
|
70
70
|
block: 5
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
const response = await supCon.createMessage(params)
|
|
73
73
|
expect(response).to.be.undefined
|
|
74
74
|
})
|
|
75
75
|
|
|
@@ -78,13 +78,13 @@ describe('Block with Redis', () => {
|
|
|
78
78
|
}).timeout(10000)
|
|
79
79
|
|
|
80
80
|
it('Send message - should work again', async() => {
|
|
81
|
-
|
|
81
|
+
const params = {
|
|
82
82
|
subject: 'Failed',
|
|
83
83
|
text: 'This failed',
|
|
84
84
|
level: 'warn',
|
|
85
85
|
block: 5
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
const response = await supCon.createMessage(params)
|
|
88
88
|
expect(response).to.have.property('subject', params.subject)
|
|
89
89
|
})
|
|
90
90
|
})
|
|
@@ -99,24 +99,24 @@ describe('Block with Memory', () => {
|
|
|
99
99
|
})
|
|
100
100
|
|
|
101
101
|
it('Send message - should work', async() => {
|
|
102
|
-
|
|
102
|
+
const params = {
|
|
103
103
|
subject: 'Failed',
|
|
104
104
|
text: 'This failed',
|
|
105
105
|
level: 'warn',
|
|
106
106
|
block: 5
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
const response = await supCon.createMessage(params)
|
|
109
109
|
expect(response).to.have.property('subject', params.subject)
|
|
110
110
|
})
|
|
111
111
|
|
|
112
112
|
it('Send message - should be blocked', async() => {
|
|
113
|
-
|
|
113
|
+
const params = {
|
|
114
114
|
subject: 'Failed',
|
|
115
115
|
text: 'This failed',
|
|
116
116
|
level: 'warn',
|
|
117
117
|
block: 5
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
const response = await supCon.createMessage(params)
|
|
120
120
|
expect(response).to.be.undefined
|
|
121
121
|
})
|
|
122
122
|
|
|
@@ -126,13 +126,13 @@ describe('Block with Memory', () => {
|
|
|
126
126
|
}).timeout(10000)
|
|
127
127
|
|
|
128
128
|
it('Send message - should work again', async() => {
|
|
129
|
-
|
|
129
|
+
const params = {
|
|
130
130
|
subject: 'Failed',
|
|
131
131
|
text: 'This failed',
|
|
132
132
|
level: 'warn',
|
|
133
133
|
block: 5
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
const response = await supCon.createMessage(params)
|
|
136
136
|
expect(response).to.have.property('subject', params.subject)
|
|
137
137
|
})
|
|
138
138
|
|