@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.
- package/dist/App.d.ts +17 -37
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +53 -152
- package/dist/App.js.map +1 -1
- package/dist/WorkflowFunction.d.ts +63 -0
- package/dist/WorkflowFunction.d.ts.map +1 -0
- package/dist/WorkflowFunction.js +130 -0
- package/dist/WorkflowFunction.js.map +1 -0
- package/dist/errors.d.ts +1 -13
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -25
- package/dist/errors.js.map +1 -1
- package/dist/helpers.d.ts +15 -2
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +40 -9
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/middleware/builtin.d.ts +2 -2
- package/dist/middleware/builtin.d.ts.map +1 -1
- package/dist/middleware/builtin.js +1 -0
- package/dist/middleware/builtin.js.map +1 -1
- package/dist/middleware/process.d.ts.map +1 -1
- package/dist/middleware/process.js.map +1 -1
- package/dist/receivers/AwsLambdaReceiver.d.ts.map +1 -1
- package/dist/receivers/AwsLambdaReceiver.js +1 -1
- package/dist/receivers/AwsLambdaReceiver.js.map +1 -1
- package/dist/receivers/ExpressReceiver.d.ts.map +1 -1
- package/dist/receivers/ExpressReceiver.js +2 -2
- package/dist/receivers/ExpressReceiver.js.map +1 -1
- package/dist/receivers/HTTPModuleFunctions.d.ts +1 -1
- package/dist/receivers/HTTPModuleFunctions.d.ts.map +1 -1
- package/dist/receivers/HTTPModuleFunctions.js +13 -1
- package/dist/receivers/HTTPModuleFunctions.js.map +1 -1
- package/dist/receivers/HTTPReceiver.d.ts.map +1 -1
- package/dist/receivers/HTTPReceiver.js +11 -5
- package/dist/receivers/HTTPReceiver.js.map +1 -1
- package/dist/receivers/HTTPResponseAck.d.ts +1 -1
- package/dist/receivers/HTTPResponseAck.d.ts.map +1 -1
- package/dist/receivers/ParamsIncomingMessage.d.ts +14 -0
- package/dist/receivers/ParamsIncomingMessage.d.ts.map +1 -0
- package/dist/{types/functions/index.js → receivers/ParamsIncomingMessage.js} +1 -1
- package/dist/receivers/ParamsIncomingMessage.js.map +1 -0
- package/dist/receivers/SocketModeReceiver.d.ts +3 -2
- package/dist/receivers/SocketModeReceiver.d.ts.map +1 -1
- package/dist/receivers/SocketModeReceiver.js +13 -5
- package/dist/receivers/SocketModeReceiver.js.map +1 -1
- package/dist/receivers/custom-routes.d.ts +4 -3
- package/dist/receivers/custom-routes.d.ts.map +1 -1
- package/dist/receivers/custom-routes.js.map +1 -1
- package/dist/receivers/http-utils.d.ts.map +1 -1
- package/dist/receivers/http-utils.js.map +1 -1
- package/dist/receivers/verify-request.d.ts +1 -1
- package/dist/receivers/verify-request.d.ts.map +1 -1
- package/dist/receivers/verify-request.js +1 -1
- package/dist/receivers/verify-request.js.map +1 -1
- package/dist/types/actions/block-action.d.ts +27 -8
- package/dist/types/actions/block-action.d.ts.map +1 -1
- package/dist/types/actions/dialog-action.d.ts +0 -4
- package/dist/types/actions/dialog-action.d.ts.map +1 -1
- package/dist/types/events/base-events.d.ts +85 -33
- package/dist/types/events/base-events.d.ts.map +1 -1
- package/dist/types/events/base-events.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/middleware.d.ts +5 -17
- package/dist/types/middleware.d.ts.map +1 -1
- package/dist/types/middleware.js.map +1 -1
- package/dist/types/options/index.d.ts +8 -6
- package/dist/types/options/index.d.ts.map +1 -1
- package/dist/types/shortcuts/index.d.ts +1 -1
- package/dist/types/shortcuts/index.d.ts.map +1 -1
- package/dist/types/utilities.d.ts +9 -8
- package/dist/types/utilities.d.ts.map +1 -1
- package/dist/types/view/index.d.ts +134 -6
- package/dist/types/view/index.d.ts.map +1 -1
- package/package.json +14 -29
- package/dist/Manifest.d.ts +0 -5
- package/dist/Manifest.d.ts.map +0 -1
- package/dist/Manifest.js +0 -16
- package/dist/Manifest.js.map +0 -1
- package/dist/SlackFunction.d.ts +0 -182
- package/dist/SlackFunction.d.ts.map +0 -1
- package/dist/SlackFunction.js +0 -420
- package/dist/SlackFunction.js.map +0 -1
- package/dist/Subscription.d.ts +0 -61
- package/dist/Subscription.d.ts.map +0 -1
- package/dist/Subscription.js +0 -169
- package/dist/Subscription.js.map +0 -1
- package/dist/cli/check-update.d.ts +0 -3
- package/dist/cli/check-update.d.ts.map +0 -1
- package/dist/cli/check-update.js +0 -13
- package/dist/cli/check-update.js.map +0 -1
- package/dist/cli/get-hooks.d.ts +0 -2
- package/dist/cli/get-hooks.d.ts.map +0 -1
- package/dist/cli/get-hooks.js +0 -19
- package/dist/cli/get-hooks.js.map +0 -1
- package/dist/cli/get-manifest.d.ts +0 -3
- package/dist/cli/get-manifest.d.ts.map +0 -1
- package/dist/cli/get-manifest.js +0 -16
- package/dist/cli/get-manifest.js.map +0 -1
- package/dist/cli/hook-utils/get-check-update-data.d.ts +0 -49
- package/dist/cli/hook-utils/get-check-update-data.d.ts.map +0 -1
- package/dist/cli/hook-utils/get-check-update-data.js +0 -252
- package/dist/cli/hook-utils/get-check-update-data.js.map +0 -1
- package/dist/cli/hook-utils/get-check-update-data.spec.d.ts +0 -2
- package/dist/cli/hook-utils/get-check-update-data.spec.d.ts.map +0 -1
- package/dist/cli/hook-utils/get-check-update-data.spec.js +0 -266
- package/dist/cli/hook-utils/get-check-update-data.spec.js.map +0 -1
- package/dist/cli/hook-utils/get-manifest-data.d.ts +0 -7
- package/dist/cli/hook-utils/get-manifest-data.d.ts.map +0 -1
- package/dist/cli/hook-utils/get-manifest-data.js +0 -30
- package/dist/cli/hook-utils/get-manifest-data.js.map +0 -1
- package/dist/cli/hook-utils/get-manifest-data.spec.d.ts +0 -2
- package/dist/cli/hook-utils/get-manifest-data.spec.d.ts.map +0 -1
- package/dist/cli/hook-utils/get-manifest-data.spec.js +0 -113
- package/dist/cli/hook-utils/get-manifest-data.spec.js.map +0 -1
- package/dist/cli/hook-utils/manifest.d.ts +0 -30
- package/dist/cli/hook-utils/manifest.d.ts.map +0 -1
- package/dist/cli/hook-utils/manifest.js +0 -103
- package/dist/cli/hook-utils/manifest.js.map +0 -1
- package/dist/cli/hook-utils/manifest.spec.d.ts +0 -2
- package/dist/cli/hook-utils/manifest.spec.d.ts.map +0 -1
- package/dist/cli/hook-utils/manifest.spec.js +0 -79
- package/dist/cli/hook-utils/manifest.spec.js.map +0 -1
- package/dist/cli/run.d.ts +0 -2
- package/dist/cli/run.d.ts.map +0 -1
- package/dist/cli/run.js +0 -37
- package/dist/cli/run.js.map +0 -1
- package/dist/cli/start.d.ts +0 -3
- package/dist/cli/start.d.ts.map +0 -1
- package/dist/cli/start.js +0 -40
- package/dist/cli/start.js.map +0 -1
- package/dist/types/functions/index.d.ts +0 -26
- package/dist/types/functions/index.d.ts.map +0 -1
- package/dist/types/functions/index.js.map +0 -1
- package/dist/types/subscription/index.d.ts +0 -80
- package/dist/types/subscription/index.d.ts.map +0 -1
- package/dist/types/subscription/index.js +0 -3
- package/dist/types/subscription/index.js.map +0 -1
- package/src/cli/check-update.js +0 -13
- package/src/cli/get-hooks.js +0 -17
- package/src/cli/get-manifest.js +0 -16
- package/src/cli/hook-utils/get-check-update-data.js +0 -292
- package/src/cli/hook-utils/get-manifest-data.js +0 -39
- package/src/cli/hook-utils/manifest.js +0 -108
- 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
|
-
}
|