@slack/bolt 3.12.0 → 4.0.0-nextGen.2
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 +36 -6
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +132 -45
- package/dist/App.js.map +1 -1
- package/dist/Manifest.d.ts +5 -0
- package/dist/Manifest.d.ts.map +1 -0
- package/dist/Manifest.js +16 -0
- package/dist/Manifest.js.map +1 -0
- package/dist/SlackFunction.d.ts +181 -0
- package/dist/SlackFunction.d.ts.map +1 -0
- package/dist/SlackFunction.js +418 -0
- package/dist/SlackFunction.js.map +1 -0
- package/dist/Subscription.d.ts +61 -0
- package/dist/Subscription.d.ts.map +1 -0
- package/dist/Subscription.js +169 -0
- package/dist/Subscription.js.map +1 -0
- package/dist/cli/get-hooks.d.ts +2 -0
- package/dist/cli/get-hooks.d.ts.map +1 -0
- package/dist/cli/get-hooks.js +18 -0
- package/dist/cli/get-hooks.js.map +1 -0
- package/dist/cli/get-manifest.d.ts +3 -0
- package/dist/cli/get-manifest.d.ts.map +1 -0
- package/dist/cli/get-manifest.js +16 -0
- package/dist/cli/get-manifest.js.map +1 -0
- package/dist/cli/hook-utils/manifest.d.ts +7 -0
- package/dist/cli/hook-utils/manifest.d.ts.map +1 -0
- package/dist/cli/hook-utils/manifest.js +104 -0
- package/dist/cli/hook-utils/manifest.js.map +1 -0
- package/dist/cli/hook-utils/manifest.spec.d.ts +2 -0
- package/dist/cli/hook-utils/manifest.spec.d.ts.map +1 -0
- package/dist/cli/hook-utils/manifest.spec.js +75 -0
- package/dist/cli/hook-utils/manifest.spec.js.map +1 -0
- package/dist/cli/run.d.ts +2 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +37 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/start.d.ts +3 -0
- package/dist/cli/start.d.ts.map +1 -0
- package/dist/cli/start.js +40 -0
- package/dist/cli/start.js.map +1 -0
- package/dist/errors.d.ts +13 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +25 -1
- package/dist/errors.js.map +1 -1
- package/dist/helpers.d.ts +2 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +8 -0
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/middleware/builtin.d.ts.map +1 -1
- package/dist/middleware/builtin.js +0 -1
- 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/BufferedIncomingMessage.d.ts +1 -0
- package/dist/receivers/BufferedIncomingMessage.d.ts.map +1 -1
- package/dist/receivers/ExpressReceiver.d.ts +3 -1
- package/dist/receivers/ExpressReceiver.d.ts.map +1 -1
- package/dist/receivers/ExpressReceiver.js +7 -2
- package/dist/receivers/ExpressReceiver.js.map +1 -1
- package/dist/receivers/HTTPModuleFunctions.d.ts.map +1 -1
- package/dist/receivers/HTTPModuleFunctions.js +2 -1
- package/dist/receivers/HTTPModuleFunctions.js.map +1 -1
- package/dist/receivers/HTTPReceiver.d.ts +2 -0
- package/dist/receivers/HTTPReceiver.d.ts.map +1 -1
- package/dist/receivers/HTTPReceiver.js +4 -4
- package/dist/receivers/HTTPReceiver.js.map +1 -1
- package/dist/receivers/SocketModeFunctions.js +2 -1
- package/dist/receivers/SocketModeFunctions.js.map +1 -1
- package/dist/receivers/SocketModeReceiver.js.map +1 -1
- package/dist/receivers/verify-request.d.ts +2 -2
- package/dist/receivers/verify-request.js +3 -3
- package/dist/types/actions/block-action.d.ts +4 -3
- package/dist/types/actions/block-action.d.ts.map +1 -1
- package/dist/types/actions/dialog-action.d.ts +4 -0
- package/dist/types/actions/dialog-action.d.ts.map +1 -1
- package/dist/types/actions/index.js +5 -1
- package/dist/types/actions/index.js.map +1 -1
- package/dist/types/events/base-events.d.ts +30 -1
- package/dist/types/events/base-events.d.ts.map +1 -1
- package/dist/types/events/base-events.js.map +1 -1
- package/dist/types/events/index.js +5 -1
- package/dist/types/events/index.js.map +1 -1
- package/dist/types/functions/index.d.ts +26 -0
- package/dist/types/functions/index.d.ts.map +1 -0
- package/dist/types/functions/index.js +3 -0
- package/dist/types/functions/index.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +6 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/middleware.d.ts +17 -1
- package/dist/types/middleware.d.ts.map +1 -1
- package/dist/types/middleware.js.map +1 -1
- package/dist/types/shortcuts/index.js +5 -1
- package/dist/types/shortcuts/index.js.map +1 -1
- package/dist/types/subscription/index.d.ts +80 -0
- package/dist/types/subscription/index.d.ts.map +1 -0
- package/dist/types/subscription/index.js +3 -0
- package/dist/types/subscription/index.js.map +1 -0
- package/dist/types/view/index.d.ts +6 -5
- package/dist/types/view/index.d.ts.map +1 -1
- package/package.json +16 -5
- package/src/cli/get-hooks.js +16 -0
- package/src/cli/get-manifest.js +16 -0
- package/src/cli/hook-utils/manifest.js +114 -0
- package/src/cli/start.js +43 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ViewsOpenResponse } from '@slack/web-api';
|
|
2
|
+
import { View } from '@slack/types';
|
|
3
|
+
import { Middleware } from '../middleware';
|
|
4
|
+
import { SayFn, AckFn } from '../utilities';
|
|
5
|
+
export interface NotificationSubscription<T extends string = string> {
|
|
6
|
+
type: T;
|
|
7
|
+
token: string;
|
|
8
|
+
action_ts: string;
|
|
9
|
+
action_id: string;
|
|
10
|
+
user: {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
};
|
|
14
|
+
team: {
|
|
15
|
+
id: string;
|
|
16
|
+
domain: string;
|
|
17
|
+
enterprise_id?: string;
|
|
18
|
+
enterprise_name?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface SubscriptionCreateRequested extends NotificationSubscription<'notification_subscription_create_requested'> {
|
|
22
|
+
channel: {
|
|
23
|
+
id: string;
|
|
24
|
+
};
|
|
25
|
+
notification_subscription_action_trigger_id: string;
|
|
26
|
+
notification_subscription: {
|
|
27
|
+
resource_link: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface SubscriptionConfigureRequested extends NotificationSubscription<'notification_subscription_configure_requested'> {
|
|
31
|
+
notification_subscription_action_trigger_id: string;
|
|
32
|
+
notification_subscription: {
|
|
33
|
+
id: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface SubscriptionDeleted extends NotificationSubscription<'notification_subscription_deleted'> {
|
|
37
|
+
notification_subscription: {
|
|
38
|
+
id: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export declare type SubscriptionInteraction = SubscriptionCreateRequested | SubscriptionConfigureRequested | SubscriptionDeleted;
|
|
42
|
+
/**
|
|
43
|
+
* Utility mixin for middlewares to open a configuration modal view (views.open)
|
|
44
|
+
*/
|
|
45
|
+
export interface UseConfigure {
|
|
46
|
+
configure: {
|
|
47
|
+
(params: View): Promise<ViewsOpenResponse>;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Utility mixin for middlewares which can be used to send a message to the user
|
|
52
|
+
* */
|
|
53
|
+
export interface UseSay {
|
|
54
|
+
say: SayFn;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Values and utilities middlewares receive in order to process incoming notification
|
|
58
|
+
* subscription interactive payloads.
|
|
59
|
+
* */
|
|
60
|
+
export interface SubscriptionMiddlewareArgs<S extends SubscriptionInteraction = SubscriptionInteraction> {
|
|
61
|
+
payload: S;
|
|
62
|
+
body: S;
|
|
63
|
+
ack: AckFn<void>;
|
|
64
|
+
}
|
|
65
|
+
export interface SubscriptionOnCreateMiddlewareArgs extends SubscriptionMiddlewareArgs, UseConfigure, UseSay {
|
|
66
|
+
}
|
|
67
|
+
export interface SubscriptionOnConfigureMiddlewareArgs extends SubscriptionMiddlewareArgs, UseConfigure {
|
|
68
|
+
}
|
|
69
|
+
export declare type SlackSubscriptionMiddlewareArgs = SubscriptionMiddlewareArgs | SubscriptionOnCreateMiddlewareArgs | SubscriptionOnConfigureMiddlewareArgs;
|
|
70
|
+
/**
|
|
71
|
+
* Types for middleware which handle notification subscription interaction
|
|
72
|
+
* payloads defined above
|
|
73
|
+
* */
|
|
74
|
+
export declare type SubscriptionOnCreateMiddleware = Middleware<SubscriptionOnCreateMiddlewareArgs>;
|
|
75
|
+
export declare type SubscriptionOnConfigureMiddleware = Middleware<SubscriptionOnConfigureMiddlewareArgs>;
|
|
76
|
+
export declare type SubscriptionOnDeletedMiddleware = Middleware<SubscriptionMiddlewareArgs>;
|
|
77
|
+
export interface SubConfigureFn {
|
|
78
|
+
(params: View): Promise<ViewsOpenResponse>;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/subscription/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG5C,MAAM,WAAW,wBAAwB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACjE,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,IAAI,EAAE;QACJ,EAAE,EAAE,MA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,EAAE,YAAY;CAAG;AAC1G,oBAAY,+BAA+B,GAC3C,0BAA0B,GAC1B,kCAAkC,GAClC,qCAAqC,CAAC;AAEtC;;;KAGK;AACL,oBAAY,8BAA8B,GAAG,UAAU,CAAC,kCAAkC,CAAC,CAAC;AAC5F,oBAAY,iCAAiC,GAAG,UAAU,CAAC,qCAAqC,CAAC,CAAC;AAClG,oBAAY,+BAA+B,GAAG,UAAU,CAAC,0BAA0B,CAAC,CAAC;AAErF,MAAM,WAAW,cAAc;IAC7B,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/subscription/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Block, KnownBlock, PlainTextElement, View } from '@slack/types';
|
|
2
2
|
import { AckFn, RespondFn } from '../utilities';
|
|
3
|
+
import { FunctionContext } from '../functions';
|
|
3
4
|
/**
|
|
4
5
|
* Known view action types
|
|
5
6
|
*/
|
|
@@ -30,7 +31,7 @@ export interface ViewResponseUrl {
|
|
|
30
31
|
*
|
|
31
32
|
* This describes the entire JSON-encoded body of a view_submission event.
|
|
32
33
|
*/
|
|
33
|
-
export interface ViewSubmitAction {
|
|
34
|
+
export interface ViewSubmitAction extends FunctionContext {
|
|
34
35
|
type: 'view_submission';
|
|
35
36
|
team: {
|
|
36
37
|
id: string;
|
|
@@ -45,8 +46,8 @@ export interface ViewSubmitAction {
|
|
|
45
46
|
};
|
|
46
47
|
view: ViewOutput;
|
|
47
48
|
api_app_id: string;
|
|
48
|
-
token
|
|
49
|
-
trigger_id
|
|
49
|
+
token?: string;
|
|
50
|
+
trigger_id?: string;
|
|
50
51
|
is_enterprise_install?: boolean;
|
|
51
52
|
enterprise?: {
|
|
52
53
|
id: string;
|
|
@@ -59,7 +60,7 @@ export interface ViewSubmitAction {
|
|
|
59
60
|
*
|
|
60
61
|
* This describes the entire JSON-encoded body of a view_closed event.
|
|
61
62
|
*/
|
|
62
|
-
export interface ViewClosedAction {
|
|
63
|
+
export interface ViewClosedAction extends FunctionContext {
|
|
63
64
|
type: 'view_closed';
|
|
64
65
|
team: {
|
|
65
66
|
id: string;
|
|
@@ -173,7 +174,7 @@ export interface ViewErrorsResponseAction {
|
|
|
173
174
|
export declare type ViewResponseAction = ViewUpdateResponseAction | ViewPushResponseAction | ViewClearResponseAction | ViewErrorsResponseAction;
|
|
174
175
|
/**
|
|
175
176
|
* Type function which given a view action `VA` returns a corresponding type for the `ack()` function. The function is
|
|
176
|
-
* used to acknowledge the receipt (and possibly signal failure) of
|
|
177
|
+
* used to acknowledge the receipt (and possibly signal failure) of a view submission or closure from a listener or
|
|
177
178
|
* middleware.
|
|
178
179
|
*/
|
|
179
180
|
declare type ViewAckFn<VA extends SlackViewAction = SlackViewAction> = VA extends ViewSubmitAction ? AckFn<ViewResponseAction> : AckFn<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,oBAAY,eAAe,GACvB,gBAAgB,GAChB,gBAAgB,GAChB,4BAA4B,GAC5B,4B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C5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,QAAQ,CAAC;IAC1B,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,uBAAuB;IACtC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,QAAQ,CAAC;IAC1B,MAAM,EAAE;QACN,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;KAC3B,CAAC;CACH;AAED,oBAAY,kBAAkB,GAC1B,wBAAwB,GACxB,sBAAsB,GACtB,uBAAuB,GACvB,wBAAwB,CAAC;AAE7B;;;;GAIG;AACH,aAAK,SAAS,CAAC,EAAE,SAAS,eAAe,GAAG,eAAe,IAAI,EAAE,SAAS,gBAAgB,GACtF,KAAK,CAAC,kBAAkB,CAAC,GACzB,KAAK,CAAC,IAAI,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slack/bolt",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-nextGen.2",
|
|
4
4
|
"description": "A framework for building Slack apps, fast.",
|
|
5
5
|
"author": "Slack Technologies, LLC",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,29 +29,38 @@
|
|
|
29
29
|
"build": "tsc",
|
|
30
30
|
"build:clean": "shx rm -rf ./dist ./coverage ./.nyc_output",
|
|
31
31
|
"lint": "eslint --fix --ext .ts src",
|
|
32
|
-
"mocha": "TS_NODE_PROJECT=tsconfig.json nyc mocha --config .mocharc.json \"src/**/*.spec.ts\"",
|
|
32
|
+
"mocha": "TS_NODE_PROJECT=tsconfig.json nyc mocha --config .mocharc.json \"src/**/*.spec.ts\" \"src/**/*.spec.js\"",
|
|
33
33
|
"test": "npm run lint && npm run mocha && npm run test:types",
|
|
34
34
|
"test:types": "tsd",
|
|
35
35
|
"coverage": "codecov",
|
|
36
36
|
"watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm run build"
|
|
37
37
|
},
|
|
38
|
+
"bin": {
|
|
39
|
+
"slack-cli-get-hooks": "./src/cli/get-hooks.js",
|
|
40
|
+
"slack-cli-get-manifest": "./src/cli/get-manifest.js",
|
|
41
|
+
"slack-cli-start": "./src/cli/start.js",
|
|
42
|
+
"slack-cli-hook-utils": "./src/cli/hook-utils/manifest.js"
|
|
43
|
+
},
|
|
38
44
|
"repository": "slackapi/bolt",
|
|
39
45
|
"homepage": "https://slack.dev/bolt-js",
|
|
40
46
|
"bugs": {
|
|
41
47
|
"url": "https://github.com/slackapi/bolt-js/issues"
|
|
42
48
|
},
|
|
43
49
|
"dependencies": {
|
|
50
|
+
"@slack/deno-slack-sdk": "^1.0.0",
|
|
44
51
|
"@slack/logger": "^3.0.0",
|
|
45
52
|
"@slack/oauth": "^2.5.1",
|
|
46
53
|
"@slack/socket-mode": "^1.3.0",
|
|
47
54
|
"@slack/types": "^2.7.0",
|
|
48
55
|
"@slack/web-api": "^6.7.1",
|
|
49
56
|
"@types/express": "^4.16.1",
|
|
50
|
-
"@types/node": "
|
|
57
|
+
"@types/node": "18.7.15",
|
|
51
58
|
"@types/promise.allsettled": "^1.0.3",
|
|
52
59
|
"@types/tsscmp": "^1.0.0",
|
|
53
60
|
"axios": "^0.26.1",
|
|
61
|
+
"deepmerge": "^4.2.2",
|
|
54
62
|
"express": "^4.16.4",
|
|
63
|
+
"fs": "0.0.1-security",
|
|
55
64
|
"please-upgrade-node": "^3.2.0",
|
|
56
65
|
"promise.allsettled": "^1.0.2",
|
|
57
66
|
"raw-body": "^2.3.3",
|
|
@@ -74,15 +83,17 @@
|
|
|
74
83
|
"eslint-plugin-node": "^11.1.0",
|
|
75
84
|
"eslint-plugin-react": "^7.29.3",
|
|
76
85
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
86
|
+
"memfs": "^3.4.6",
|
|
77
87
|
"mocha": "^9.1.3",
|
|
88
|
+
"mock-fs": "^5.1.2",
|
|
78
89
|
"nyc": "^15.1.0",
|
|
79
90
|
"rewiremock": "^3.13.4",
|
|
80
91
|
"shx": "^0.3.2",
|
|
81
92
|
"sinon": "^7.3.1",
|
|
82
93
|
"source-map-support": "^0.5.12",
|
|
83
94
|
"ts-node": "^8.1.0",
|
|
84
|
-
"tsd": "^0.
|
|
85
|
-
"typescript": "
|
|
95
|
+
"tsd": "^0.22.0",
|
|
96
|
+
"typescript": "4.7.4"
|
|
86
97
|
},
|
|
87
98
|
"tsd": {
|
|
88
99
|
"directory": "types-tests"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
console.log(JSON.stringify({
|
|
3
|
+
hooks: {
|
|
4
|
+
'get-manifest': 'npx -q --no-install -p @slack/bolt slack-cli-get-manifest',
|
|
5
|
+
start: 'npx -q --no-install -p @slack/bolt slack-cli-start',
|
|
6
|
+
},
|
|
7
|
+
config: {
|
|
8
|
+
watch: {
|
|
9
|
+
'filter-regex': '^manifest\\.(ts|js|json)$',
|
|
10
|
+
paths: [
|
|
11
|
+
'.',
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
'sdk-managed-connection-enabled': true,
|
|
15
|
+
},
|
|
16
|
+
}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { getManifestData } = require('./hook-utils/manifest');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Implements the get-manifest script hook required by the Slack CLI
|
|
6
|
+
* Returns a manifest JSON string to stdout.
|
|
7
|
+
* Looks for a manifest.ts, .js and .json files. If multiple are found
|
|
8
|
+
* Then any manifest.ts (or missing that, manifest.js) defined
|
|
9
|
+
* properties will merge into any manifest.json
|
|
10
|
+
*/
|
|
11
|
+
(function _(cwd) {
|
|
12
|
+
let manifest = getManifestData(cwd);
|
|
13
|
+
|
|
14
|
+
// write manifest to stdout
|
|
15
|
+
console.log(JSON.stringify(manifest));
|
|
16
|
+
}(process.cwd()));
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const merge = require('deepmerge');
|
|
4
|
+
|
|
5
|
+
// helper array merge function
|
|
6
|
+
function unionMerge(array1, array2) {
|
|
7
|
+
return [...new Set(array1.concat(array2))];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// look for manifest.json in the current working directory
|
|
11
|
+
function readManifestJSONFile(searchDir, filename) {
|
|
12
|
+
let jsonFilePath, manifestJSON;
|
|
13
|
+
try {
|
|
14
|
+
jsonFilePath = find(searchDir, filename);
|
|
15
|
+
if (fs.existsSync(jsonFilePath)) {
|
|
16
|
+
manifestJSON = JSON.parse(fs.readFileSync(jsonFilePath, 'utf8'));
|
|
17
|
+
}
|
|
18
|
+
} catch (error) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
return manifestJSON;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// look for a manifest file in the current working directory
|
|
25
|
+
function readImportedManifestFile(searchDir, filename) {
|
|
26
|
+
let importedManifestFilePath, manifestImported;
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
importedManifestFilePath = find(searchDir, filename);
|
|
30
|
+
if (fs.existsSync(importedManifestFilePath)) {
|
|
31
|
+
manifestImported = require(`${importedManifestFilePath}`);
|
|
32
|
+
|
|
33
|
+
// if a default key is provided, assumes default export contains manifest
|
|
34
|
+
if (manifestImported["default"]) {
|
|
35
|
+
manifestImported = manifestImported["default"]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.log(error);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
return manifestImported;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// true if any non empty manifest has been supplied
|
|
46
|
+
function hasManifest(...entries) {
|
|
47
|
+
for (let ent of entries) {
|
|
48
|
+
if (ent && (Object.keys(ent).length > 0)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// recursive search for provided path and return full path when filename is found
|
|
56
|
+
// TODO: Cache searched paths and check that they haven't been explored already
|
|
57
|
+
// This guards against rare edge case of a subdir in the file tree which is
|
|
58
|
+
// symlinked back to root or in such a way that creates a cycle. Can also implement
|
|
59
|
+
// max depth check.
|
|
60
|
+
function find(currentPath, targetFilename) {
|
|
61
|
+
if (currentPath.endsWith(`/${targetFilename}`)) {
|
|
62
|
+
return currentPath;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (fs.existsSync(currentPath) && fs.lstatSync(currentPath).isDirectory()) {
|
|
66
|
+
let foundEntry;
|
|
67
|
+
let dirents = fs.readdirSync(currentPath);
|
|
68
|
+
for (let entry of dirents) {
|
|
69
|
+
if (entry !== 'node_modules') {
|
|
70
|
+
let newPath = path.resolve(currentPath, entry);
|
|
71
|
+
foundEntry = find(newPath, targetFilename);
|
|
72
|
+
if (foundEntry) {
|
|
73
|
+
return foundEntry;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function getManifestData(searchDir) {
|
|
82
|
+
const file = 'manifest';
|
|
83
|
+
let manifest = {};
|
|
84
|
+
|
|
85
|
+
// look for a manifest JSON
|
|
86
|
+
const manifestJSON = readManifestJSONFile(searchDir, `${file}.json`);
|
|
87
|
+
|
|
88
|
+
// look for manifest.js
|
|
89
|
+
// stringify and parses the JSON in order to ensure that objects with .toJSON() functions
|
|
90
|
+
// resolve properly. This is a known behavior for CustomType
|
|
91
|
+
const manifestJS = JSON.parse(JSON.stringify(readImportedManifestFile(searchDir, `${file}.js`)));
|
|
92
|
+
|
|
93
|
+
if (!hasManifest(manifestJS, manifestJSON)) {
|
|
94
|
+
throw new Error('Unable to find a manifest file in this project');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// manage manifest merge
|
|
98
|
+
if (manifestJSON) {
|
|
99
|
+
manifest = merge(manifest, manifestJSON, { arrayMerge: unionMerge});
|
|
100
|
+
}
|
|
101
|
+
if (manifestJS) {
|
|
102
|
+
manifest = merge(manifest, manifestJS, { arrayMerge: unionMerge });
|
|
103
|
+
}
|
|
104
|
+
return manifest;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
module.exports = {
|
|
108
|
+
getManifestData,
|
|
109
|
+
unionMerge,
|
|
110
|
+
readManifestJSONFile,
|
|
111
|
+
readImportedManifestFile,
|
|
112
|
+
hasManifest,
|
|
113
|
+
find,
|
|
114
|
+
}
|
package/src/cli/start.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
}
|