@slack/bolt 4.0.0-nextGen.8 → 4.0.0-rc.1

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.
Files changed (151) hide show
  1. package/dist/App.d.ts +17 -37
  2. package/dist/App.d.ts.map +1 -1
  3. package/dist/App.js +53 -152
  4. package/dist/App.js.map +1 -1
  5. package/dist/WorkflowFunction.d.ts +63 -0
  6. package/dist/WorkflowFunction.d.ts.map +1 -0
  7. package/dist/WorkflowFunction.js +130 -0
  8. package/dist/WorkflowFunction.js.map +1 -0
  9. package/dist/errors.d.ts +1 -13
  10. package/dist/errors.d.ts.map +1 -1
  11. package/dist/errors.js +1 -25
  12. package/dist/errors.js.map +1 -1
  13. package/dist/helpers.d.ts +15 -2
  14. package/dist/helpers.d.ts.map +1 -1
  15. package/dist/helpers.js +40 -9
  16. package/dist/helpers.js.map +1 -1
  17. package/dist/index.d.ts +0 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +0 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/middleware/builtin.d.ts +2 -2
  22. package/dist/middleware/builtin.d.ts.map +1 -1
  23. package/dist/middleware/builtin.js +1 -0
  24. package/dist/middleware/builtin.js.map +1 -1
  25. package/dist/middleware/process.d.ts.map +1 -1
  26. package/dist/middleware/process.js.map +1 -1
  27. package/dist/receivers/AwsLambdaReceiver.d.ts.map +1 -1
  28. package/dist/receivers/AwsLambdaReceiver.js +1 -1
  29. package/dist/receivers/AwsLambdaReceiver.js.map +1 -1
  30. package/dist/receivers/ExpressReceiver.d.ts.map +1 -1
  31. package/dist/receivers/ExpressReceiver.js +2 -2
  32. package/dist/receivers/ExpressReceiver.js.map +1 -1
  33. package/dist/receivers/HTTPModuleFunctions.d.ts +1 -1
  34. package/dist/receivers/HTTPModuleFunctions.d.ts.map +1 -1
  35. package/dist/receivers/HTTPModuleFunctions.js +13 -1
  36. package/dist/receivers/HTTPModuleFunctions.js.map +1 -1
  37. package/dist/receivers/HTTPReceiver.d.ts.map +1 -1
  38. package/dist/receivers/HTTPReceiver.js +11 -5
  39. package/dist/receivers/HTTPReceiver.js.map +1 -1
  40. package/dist/receivers/HTTPResponseAck.d.ts +1 -1
  41. package/dist/receivers/HTTPResponseAck.d.ts.map +1 -1
  42. package/dist/receivers/ParamsIncomingMessage.d.ts +14 -0
  43. package/dist/receivers/ParamsIncomingMessage.d.ts.map +1 -0
  44. package/dist/{types/functions/index.js → receivers/ParamsIncomingMessage.js} +1 -1
  45. package/dist/receivers/ParamsIncomingMessage.js.map +1 -0
  46. package/dist/receivers/SocketModeReceiver.d.ts +3 -2
  47. package/dist/receivers/SocketModeReceiver.d.ts.map +1 -1
  48. package/dist/receivers/SocketModeReceiver.js +13 -5
  49. package/dist/receivers/SocketModeReceiver.js.map +1 -1
  50. package/dist/receivers/custom-routes.d.ts +4 -3
  51. package/dist/receivers/custom-routes.d.ts.map +1 -1
  52. package/dist/receivers/custom-routes.js.map +1 -1
  53. package/dist/receivers/http-utils.d.ts.map +1 -1
  54. package/dist/receivers/http-utils.js.map +1 -1
  55. package/dist/receivers/verify-request.d.ts +1 -1
  56. package/dist/receivers/verify-request.d.ts.map +1 -1
  57. package/dist/receivers/verify-request.js +1 -1
  58. package/dist/receivers/verify-request.js.map +1 -1
  59. package/dist/types/actions/block-action.d.ts +27 -8
  60. package/dist/types/actions/block-action.d.ts.map +1 -1
  61. package/dist/types/actions/dialog-action.d.ts +0 -4
  62. package/dist/types/actions/dialog-action.d.ts.map +1 -1
  63. package/dist/types/events/base-events.d.ts +85 -33
  64. package/dist/types/events/base-events.d.ts.map +1 -1
  65. package/dist/types/events/base-events.js.map +1 -1
  66. package/dist/types/index.d.ts +0 -1
  67. package/dist/types/index.d.ts.map +1 -1
  68. package/dist/types/index.js +0 -1
  69. package/dist/types/index.js.map +1 -1
  70. package/dist/types/middleware.d.ts +5 -17
  71. package/dist/types/middleware.d.ts.map +1 -1
  72. package/dist/types/middleware.js.map +1 -1
  73. package/dist/types/options/index.d.ts +8 -6
  74. package/dist/types/options/index.d.ts.map +1 -1
  75. package/dist/types/shortcuts/index.d.ts +1 -1
  76. package/dist/types/shortcuts/index.d.ts.map +1 -1
  77. package/dist/types/utilities.d.ts +9 -8
  78. package/dist/types/utilities.d.ts.map +1 -1
  79. package/dist/types/view/index.d.ts +134 -6
  80. package/dist/types/view/index.d.ts.map +1 -1
  81. package/package.json +14 -29
  82. package/dist/Manifest.d.ts +0 -5
  83. package/dist/Manifest.d.ts.map +0 -1
  84. package/dist/Manifest.js +0 -16
  85. package/dist/Manifest.js.map +0 -1
  86. package/dist/SlackFunction.d.ts +0 -182
  87. package/dist/SlackFunction.d.ts.map +0 -1
  88. package/dist/SlackFunction.js +0 -420
  89. package/dist/SlackFunction.js.map +0 -1
  90. package/dist/Subscription.d.ts +0 -61
  91. package/dist/Subscription.d.ts.map +0 -1
  92. package/dist/Subscription.js +0 -169
  93. package/dist/Subscription.js.map +0 -1
  94. package/dist/cli/check-update.d.ts +0 -3
  95. package/dist/cli/check-update.d.ts.map +0 -1
  96. package/dist/cli/check-update.js +0 -13
  97. package/dist/cli/check-update.js.map +0 -1
  98. package/dist/cli/get-hooks.d.ts +0 -2
  99. package/dist/cli/get-hooks.d.ts.map +0 -1
  100. package/dist/cli/get-hooks.js +0 -19
  101. package/dist/cli/get-hooks.js.map +0 -1
  102. package/dist/cli/get-manifest.d.ts +0 -3
  103. package/dist/cli/get-manifest.d.ts.map +0 -1
  104. package/dist/cli/get-manifest.js +0 -16
  105. package/dist/cli/get-manifest.js.map +0 -1
  106. package/dist/cli/hook-utils/get-check-update-data.d.ts +0 -49
  107. package/dist/cli/hook-utils/get-check-update-data.d.ts.map +0 -1
  108. package/dist/cli/hook-utils/get-check-update-data.js +0 -252
  109. package/dist/cli/hook-utils/get-check-update-data.js.map +0 -1
  110. package/dist/cli/hook-utils/get-check-update-data.spec.d.ts +0 -2
  111. package/dist/cli/hook-utils/get-check-update-data.spec.d.ts.map +0 -1
  112. package/dist/cli/hook-utils/get-check-update-data.spec.js +0 -266
  113. package/dist/cli/hook-utils/get-check-update-data.spec.js.map +0 -1
  114. package/dist/cli/hook-utils/get-manifest-data.d.ts +0 -7
  115. package/dist/cli/hook-utils/get-manifest-data.d.ts.map +0 -1
  116. package/dist/cli/hook-utils/get-manifest-data.js +0 -30
  117. package/dist/cli/hook-utils/get-manifest-data.js.map +0 -1
  118. package/dist/cli/hook-utils/get-manifest-data.spec.d.ts +0 -2
  119. package/dist/cli/hook-utils/get-manifest-data.spec.d.ts.map +0 -1
  120. package/dist/cli/hook-utils/get-manifest-data.spec.js +0 -113
  121. package/dist/cli/hook-utils/get-manifest-data.spec.js.map +0 -1
  122. package/dist/cli/hook-utils/manifest.d.ts +0 -30
  123. package/dist/cli/hook-utils/manifest.d.ts.map +0 -1
  124. package/dist/cli/hook-utils/manifest.js +0 -103
  125. package/dist/cli/hook-utils/manifest.js.map +0 -1
  126. package/dist/cli/hook-utils/manifest.spec.d.ts +0 -2
  127. package/dist/cli/hook-utils/manifest.spec.d.ts.map +0 -1
  128. package/dist/cli/hook-utils/manifest.spec.js +0 -79
  129. package/dist/cli/hook-utils/manifest.spec.js.map +0 -1
  130. package/dist/cli/run.d.ts +0 -2
  131. package/dist/cli/run.d.ts.map +0 -1
  132. package/dist/cli/run.js +0 -37
  133. package/dist/cli/run.js.map +0 -1
  134. package/dist/cli/start.d.ts +0 -3
  135. package/dist/cli/start.d.ts.map +0 -1
  136. package/dist/cli/start.js +0 -40
  137. package/dist/cli/start.js.map +0 -1
  138. package/dist/types/functions/index.d.ts +0 -26
  139. package/dist/types/functions/index.d.ts.map +0 -1
  140. package/dist/types/functions/index.js.map +0 -1
  141. package/dist/types/subscription/index.d.ts +0 -80
  142. package/dist/types/subscription/index.d.ts.map +0 -1
  143. package/dist/types/subscription/index.js +0 -3
  144. package/dist/types/subscription/index.js.map +0 -1
  145. package/src/cli/check-update.js +0 -13
  146. package/src/cli/get-hooks.js +0 -17
  147. package/src/cli/get-manifest.js +0 -16
  148. package/src/cli/hook-utils/get-check-update-data.js +0 -292
  149. package/src/cli/hook-utils/get-manifest-data.js +0 -39
  150. package/src/cli/hook-utils/manifest.js +0 -108
  151. package/src/cli/start.js +0 -43
@@ -1,39 +0,0 @@
1
- const {
2
- readManifestJSONFile,
3
- readImportedManifestFile,
4
- hasManifest,
5
- unionMerge,
6
- } = require('./manifest.js');
7
- const merge = require('deepmerge');
8
-
9
-
10
- /**
11
- * Returns any manifest data, if it exists.
12
- * Otherwise throws an error
13
- * @param searchDir path to begin searching at
14
- */
15
- function getManifestData(searchDir) {
16
- const file = 'manifest';
17
- let manifest = {};
18
-
19
- // look for a manifest JSON
20
- const manifestJSON = readManifestJSONFile(searchDir, `${file}.json`);
21
- // look for manifest.js
22
- let manifestJS = readImportedManifestFile(searchDir, `${file}.js`);
23
-
24
- if (!hasManifest(manifestJS, manifestJSON)) {
25
- const msg = 'Unable to find a manifest file in this project';
26
- throw new Error(msg);
27
- }
28
-
29
- // manage manifest merge
30
- if (manifestJSON) {
31
- manifest = merge(manifest, manifestJSON, { arrayMerge: unionMerge });
32
- }
33
- if (manifestJS) {
34
- manifest = merge(manifest, manifestJS, { arrayMerge: unionMerge });
35
- }
36
- return manifest;
37
- }
38
-
39
- module.exports = { getManifestData };
@@ -1,108 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- /**
5
- * Union merge of arrays
6
- */
7
- function unionMerge(array1, array2) {
8
- return [...new Set(array1.concat(array2))];
9
- }
10
-
11
- /**
12
- * Returns a manifest.json if it exists, null otherwise
13
- * @param searchDir typically current working directory
14
- * @param filename file to search for
15
- */
16
- function readManifestJSONFile(searchDir, filename) {
17
- let jsonFilePath, manifestJSON;
18
- try {
19
- jsonFilePath = find(searchDir, filename);
20
- if (fs.existsSync(jsonFilePath)) {
21
- manifestJSON = JSON.parse(fs.readFileSync(jsonFilePath, 'utf8'));
22
- }
23
- } catch (error) {
24
- return null;
25
- }
26
- return manifestJSON;
27
- }
28
-
29
- /**
30
- * Returns a manifest object if it exists, null otherwise
31
- * @param searchDir typically current working directory
32
- * @param filename file to search for
33
- */
34
- function readImportedManifestFile(searchDir, filename) {
35
- let importedManifestFilePath, manifestImported;
36
-
37
- try {
38
- importedManifestFilePath = find(searchDir, filename);
39
- if (fs.existsSync(importedManifestFilePath)) {
40
- manifestImported = require(`${importedManifestFilePath}`);
41
-
42
- // if a default key is provided, assumes default export contains manifest
43
- if (manifestImported["default"]) {
44
- manifestImported = manifestImported["default"]
45
- }
46
- // stringify and parses the JSON in order to ensure that objects with .toJSON() functions
47
- // resolve properly. This is a known behavior for CustomType
48
- manifestImported = JSON.parse(JSON.stringify(manifestImported));
49
- }
50
- } catch (error) {
51
- console.log(error);
52
- return null;
53
- }
54
- return manifestImported;
55
- }
56
-
57
- /**
58
- * @param entries
59
- * @returns true if any non-empty manifest has been supplied
60
- * */
61
- function hasManifest(...entries) {
62
- for (let ent of entries) {
63
- if (ent && (Object.keys(ent).length > 0)) {
64
- return true;
65
- }
66
- }
67
- return false;
68
- }
69
-
70
- /**
71
- * Search for provided file path.
72
- * Returns full path when filename is found or null if no file found.
73
- * @param currentPath string of current path
74
- * @param targetFilename filename to match
75
- * @returns full file path string relative to starting path or null
76
- * */
77
- function find(currentPath, targetFilename) {
78
- // TODO Cache searched paths and check that they haven't been explored already
79
- // This guards against rare edge case of a subdir in the file tree which is
80
- // symlinked back to root or in such a way that creates a cycle. Can also implement
81
- // max depth check.
82
- if (currentPath.endsWith(`/${targetFilename}`)) {
83
- return currentPath;
84
- }
85
-
86
- if (fs.existsSync(currentPath) && fs.lstatSync(currentPath).isDirectory()) {
87
- let foundEntry;
88
- let dirents = fs.readdirSync(currentPath);
89
- for (let entry of dirents) {
90
- if (entry !== 'node_modules') {
91
- let newPath = path.resolve(currentPath, entry);
92
- foundEntry = find(newPath, targetFilename);
93
- if (foundEntry) {
94
- return foundEntry;
95
- }
96
- }
97
- }
98
- return null;
99
- }
100
- }
101
-
102
- module.exports = {
103
- unionMerge,
104
- readManifestJSONFile,
105
- readImportedManifestFile,
106
- hasManifest,
107
- find,
108
- }
package/src/cli/start.js DELETED
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env node
2
- const { spawn } = require('child_process');
3
- const path = require('path');
4
- const fs = require('fs');
5
- const { main: pkgJSONMain } = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
6
-
7
- // Run script hook verifies that requirements for running an App in
8
- // in developerMode (via Socket Mode) are met
9
- (function _(cwd, customPath) {
10
- // TODO - Format so that its less miss-able in output
11
- console.log('Preparing local run in developer mode (Socket Mode)');
12
- // Check required local run tokens
13
- validate();
14
-
15
- // tries the provided path, then package.json main, then defaults to index.js in the current
16
- // working directory
17
- const pkgJSONDefault = 'index.js';
18
- const fullPath = path.resolve(cwd, customPath ? customPath : pkgJSONMain ? pkgJSONMain : pkgJSONDefault);
19
- console.log(fullPath);
20
-
21
- // Kick off a subprocess to run the app in development mode
22
- const app = spawn('node', [`${fullPath}`]);
23
- app.stdout.setEncoding('utf-8');
24
- app.stdout.on('data', (data) => {
25
- process.stdout.write(data);
26
- });
27
- app.stderr.on('data', (data) => {
28
- process.stderr.write(data);
29
- });
30
-
31
- app.on('close', (code) => {
32
- console.log(`bolt-app local run exited with code ${code}`);
33
- });
34
- }(process.cwd(), process.env.SLACK_CLI_CUSTOM_FILE_PATH));
35
-
36
- function validate() {
37
- if (!process.env.SLACK_CLI_XOXB) {
38
- throw new Error('Missing local run bot token. Please see slack-cli maintainers to troubleshoot.');
39
- }
40
- if (!process.env.SLACK_CLI_XAPP) {
41
- throw new Error('Missing local run app token. Please see slack-cli maintainers to troubleshoot');
42
- }
43
- }