@itentialopensource/adapter-slack 2.6.1 → 3.0.0

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/CHANGELOG.md CHANGED
@@ -1,4 +1,20 @@
1
1
 
2
+ ## 3.0.0 [02-15-2023]
3
+
4
+ * Major/adapt 2297
5
+
6
+ See merge request itentialopensource/adapters/notification-messaging/adapter-slack!14
7
+
8
+ ---
9
+
10
+ ## 2.6.2 [08-03-2022]
11
+
12
+ * Add parameters for postFilesupload
13
+
14
+ See merge request itentialopensource/adapters/notification-messaging/adapter-slack!13
15
+
16
+ ---
17
+
2
18
  ## 2.6.1 [07-25-2022]
3
19
 
4
20
  * Fix schema for threadTs
package/adapter.js CHANGED
@@ -15,13 +15,13 @@ const path = require('path');
15
15
  const AdapterBaseCl = require(path.join(__dirname, 'adapterBase.js'));
16
16
 
17
17
  /**
18
- * This is the adapter/interface into Slacktest
18
+ * This is the adapter/interface into Slack
19
19
  */
20
20
 
21
21
  /* GENERAL ADAPTER FUNCTIONS */
22
- class Slacktest extends AdapterBaseCl {
22
+ class Slack extends AdapterBaseCl {
23
23
  /**
24
- * Slacktest Adapter
24
+ * Slack Adapter
25
25
  * @constructor
26
26
  */
27
27
  /* Working on changing the way we do Emit methods due to size and time constrainsts
@@ -5283,10 +5283,11 @@ class Slacktest extends AdapterBaseCl {
5283
5283
  * @param {string} content - File contents via a POST variable. If omitting this parameter, you must provide a `file`.
5284
5284
  * @param {string} token - Authentication token. Requires scope: `files:write:user`
5285
5285
  * @param {string} file - File contents via `multipart\/form-data`. If omitting this parameter, you must submit `content`.
5286
+ * @param {number} threadTs - Unique identifier of a thread's parent message
5286
5287
  * @param {getCallback} callback - a callback function to return the result
5287
5288
  */
5288
5289
  /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
5289
- postFilesupload(channels, title, initialComment, filetype, filename, content, token, file, callback) {
5290
+ postFilesupload(channels, title, initialComment, filetype, filename, content, token, file, threadTs, callback) {
5290
5291
  const meth = 'adapter-postFilesupload';
5291
5292
  const origin = `${this.id}-${meth}`;
5292
5293
  log.trace(origin);
@@ -5303,7 +5304,7 @@ class Slacktest extends AdapterBaseCl {
5303
5304
  const queryParamsAvailable = {};
5304
5305
  const queryParams = {};
5305
5306
  const pathVars = [];
5306
- const bodyVars = {};
5307
+ const bodyVars = { channels, title, initialComment, filetype, filename, content, file, threadTs };
5307
5308
 
5308
5309
  // loop in template. long callback arg name to avoid identifier conflicts
5309
5310
  Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
@@ -10722,4 +10723,4 @@ class Slacktest extends AdapterBaseCl {
10722
10723
  }
10723
10724
  }
10724
10725
 
10725
- module.exports = Slacktest;
10726
+ module.exports = Slack;
@@ -29,7 +29,7 @@
29
29
  "external_name": "ph_request_type"
30
30
  },
31
31
  "threadTs": {
32
- "type": "string",
32
+ "type": ["string", "number"],
33
33
  "description": "Unique identifier of a thread's parent message",
34
34
  "parse": false,
35
35
  "encode": false,
@@ -21,7 +21,7 @@
21
21
  "external_name": "ph_request_type"
22
22
  },
23
23
  "threadTs": {
24
- "type": "string",
24
+ "type": ["string", "number"],
25
25
  "description": "Unique identifier of a thread's parent message",
26
26
  "parse": false,
27
27
  "encode": false,
@@ -2,7 +2,7 @@
2
2
  "$id": "schema.json",
3
3
  "type": "object",
4
4
  "schema": "http://json-schema.org/draft-07/schema#",
5
- "translate": false,
5
+ "translate": true,
6
6
  "dynamicfields": true,
7
7
  "properties": {
8
8
  "ph_request_type": {
@@ -18,6 +18,17 @@
18
18
  "postFilesupload"
19
19
  ],
20
20
  "external_name": "ph_request_type"
21
+ },
22
+ "threadTs": {
23
+ "type": ["string", "number"],
24
+ "description": "Unique identifier of a thread's parent message",
25
+ "parse": false,
26
+ "encode": false,
27
+ "encrypt": {
28
+ "type": "AES",
29
+ "key": ""
30
+ },
31
+ "external_name": "thread_ts"
21
32
  }
22
33
  },
23
34
  "definitions": {}
@@ -30,7 +30,7 @@
30
30
  "external_name": "ph_request_type"
31
31
  },
32
32
  "threadTs": {
33
- "type": "string",
33
+ "type": ["string", "number"],
34
34
  "description": "Unique identifier of a thread's parent message",
35
35
  "parse": false,
36
36
  "encode": false,
@@ -20,7 +20,7 @@
20
20
  "external_name": "ph_request_type"
21
21
  },
22
22
  "threadTs": {
23
- "type": "string",
23
+ "type": ["string", "number"],
24
24
  "description": "Unique identifier of a thread's parent message",
25
25
  "parse": false,
26
26
  "encode": false,
@@ -20,7 +20,7 @@
20
20
  "external_name": "ph_request_type"
21
21
  },
22
22
  "threadTs": {
23
- "type": "string",
23
+ "type": ["string", "number"],
24
24
  "description": "Unique identifier of a thread's parent message",
25
25
  "parse": false,
26
26
  "encode": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-slack",
3
- "version": "2.6.1",
3
+ "version": "3.0.0",
4
4
  "description": "This adapter integrates with system Slack",
5
5
  "main": "adapter.js",
6
6
  "systemName": "Slack",
@@ -55,7 +55,7 @@
55
55
  "author": "Itential",
56
56
  "homepage": "https://gitlab.com/itentialopensource/adapters/notification-messaging/adapter-slack#readme",
57
57
  "dependencies": {
58
- "@itentialopensource/adapter-utils": "^4.45.6",
58
+ "@itentialopensource/adapter-utils": "^4.48.7",
59
59
  "ajv": "^6.12.0",
60
60
  "axios": "^0.21.0",
61
61
  "commander": "^2.20.0",
package/pronghorn.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "@itentialopensource/adapter-slack",
3
3
  "type": "Adapter",
4
- "export": "Slacktest",
4
+ "export": "Slack",
5
5
  "title": "Slack",
6
6
  "src": "adapter.js",
7
7
  "roles": [
@@ -4332,6 +4332,16 @@
4332
4332
  "title": "file",
4333
4333
  "type": "string"
4334
4334
  }
4335
+ },
4336
+ {
4337
+ "name": "threadTs",
4338
+ "type": "number",
4339
+ "info": "Unique identifier of a thread's parent message",
4340
+ "required": false,
4341
+ "schema": {
4342
+ "title": "threadTs",
4343
+ "type": "number"
4344
+ }
4335
4345
  }
4336
4346
  ],
4337
4347
  "output": {
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "2.5.5",
3
- "configLines": 10347,
2
+ "version": "2.6.1",
3
+ "configLines": 10357,
4
4
  "scriptLines": 1707,
5
- "codeLines": 12509,
5
+ "codeLines": 12510,
6
6
  "testLines": 9108,
7
7
  "testCases": 394,
8
- "totalCodeLines": 23324,
8
+ "totalCodeLines": 23325,
9
9
  "wfTasks": 155
10
10
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "slack",
3
- "type": "Slacktest",
3
+ "type": "Slack",
4
4
  "properties": {
5
5
  "host": "slack.com",
6
6
  "port": 443,
@@ -58,7 +58,7 @@ global.pronghornProps = {
58
58
  adapterProps: {
59
59
  adapters: [{
60
60
  id: 'Test-slack',
61
- type: 'Slacktest',
61
+ type: 'Slack',
62
62
  properties: samProps
63
63
  }]
64
64
  }
@@ -234,12 +234,12 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
234
234
  }
235
235
 
236
236
  // require the adapter that we are going to be using
237
- const Slacktest = require('../../adapter');
237
+ const Slack = require('../../adapter');
238
238
 
239
239
  // begin the testing - these should be pretty well defined between the describe and the it!
240
240
  describe('[integration] Slack Adapter Test', () => {
241
- describe('Slacktest Class Tests', () => {
242
- const a = new Slacktest(
241
+ describe('Slack Class Tests', () => {
242
+ const a = new Slack(
243
243
  pronghornProps.adapterProps.adapters[0].id,
244
244
  pronghornProps.adapterProps.adapters[0].properties
245
245
  );
@@ -2848,7 +2848,7 @@ describe('[integration] Slack Adapter Test', () => {
2848
2848
  describe('#postFilesupload - errors', () => {
2849
2849
  it('should work if integrated or standalone with mockdata', (done) => {
2850
2850
  try {
2851
- a.postFilesupload('fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', (data, error) => {
2851
+ a.postFilesupload('fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', 0, (data, error) => {
2852
2852
  try {
2853
2853
  if (stub) {
2854
2854
  assert.equal(undefined, error);
@@ -54,7 +54,7 @@ global.pronghornProps = {
54
54
  adapterProps: {
55
55
  adapters: [{
56
56
  id: 'Test-slack',
57
- type: 'Slacktest',
57
+ type: 'Slack',
58
58
  properties: samProps
59
59
  }]
60
60
  }
@@ -116,7 +116,7 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
116
116
  }
117
117
 
118
118
  // require the adapter that we are going to be using
119
- const Slacktest = require('../../adapter');
119
+ const Slack = require('../../adapter');
120
120
 
121
121
  // delete the .DS_Store directory in entities -- otherwise this will cause errors
122
122
  const dirPath = path.join(__dirname, '../../entities/.DS_Store');
@@ -131,8 +131,8 @@ if (fs.existsSync(dirPath)) {
131
131
 
132
132
  // begin the testing - these should be pretty well defined between the describe and the it!
133
133
  describe('[unit] Slack Adapter Test', () => {
134
- describe('Slacktest Class Tests', () => {
135
- const a = new Slacktest(
134
+ describe('Slack Class Tests', () => {
135
+ const a = new Slack(
136
136
  pronghornProps.adapterProps.adapters[0].id,
137
137
  pronghornProps.adapterProps.adapters[0].properties
138
138
  );
@@ -363,7 +363,7 @@ describe('[unit] Slack Adapter Test', () => {
363
363
  const pronghornDotJson = require('../../pronghorn.json');
364
364
  assert.notEqual(-1, pronghornDotJson.id.indexOf('slack'));
365
365
  assert.equal('Adapter', pronghornDotJson.type);
366
- assert.equal('Slacktest', pronghornDotJson.export);
366
+ assert.equal('Slack', pronghornDotJson.export);
367
367
  assert.equal('Slack', pronghornDotJson.title);
368
368
  assert.equal('adapter.js', pronghornDotJson.src);
369
369
  done();
@@ -729,7 +729,7 @@ describe('[unit] Slack Adapter Test', () => {
729
729
  try {
730
730
  const sampleDotJson = require('../../sampleProperties.json');
731
731
  assert.notEqual(-1, sampleDotJson.id.indexOf('slack'));
732
- assert.equal('Slacktest', sampleDotJson.type);
732
+ assert.equal('Slack', sampleDotJson.type);
733
733
  assert.notEqual(undefined, sampleDotJson.properties);
734
734
  assert.notEqual(null, sampleDotJson.properties);
735
735
  assert.notEqual('', sampleDotJson.properties);