messaging-api-slack
Advanced tools
Comparing version 1.0.6 to 1.1.0
@@ -17,12 +17,16 @@ "use strict"; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SlackTypes = exports.SlackWebhookClient = exports.SlackOAuthClient = void 0; | ||
var SlackOAuthClient_1 = require("./SlackOAuthClient"); | ||
Object.defineProperty(exports, "SlackOAuthClient", { enumerable: true, get: function () { return SlackOAuthClient_1.default; } }); | ||
Object.defineProperty(exports, "SlackOAuthClient", { enumerable: true, get: function () { return __importDefault(SlackOAuthClient_1).default; } }); | ||
var SlackWebhookClient_1 = require("./SlackWebhookClient"); | ||
Object.defineProperty(exports, "SlackWebhookClient", { enumerable: true, get: function () { return SlackWebhookClient_1.default; } }); | ||
Object.defineProperty(exports, "SlackWebhookClient", { enumerable: true, get: function () { return __importDefault(SlackWebhookClient_1).default; } }); | ||
exports.SlackTypes = __importStar(require("./SlackTypes")); | ||
//# sourceMappingURL=index.js.map |
@@ -26,3 +26,3 @@ "use strict"; | ||
// eslint-disable-next-line no-param-reassign | ||
payload[field] = JSON.stringify(messaging_api_common_1.snakecaseKeysDeep(payload[field])); | ||
payload[field] = JSON.stringify((0, messaging_api_common_1.snakecaseKeysDeep)(payload[field])); | ||
} | ||
@@ -34,3 +34,3 @@ }); | ||
constructor(config) { | ||
ts_invariant_1.default(typeof config !== 'string', `SlackOAuthClient: do not allow constructing client with ${config} string. Use object instead.`); | ||
(0, ts_invariant_1.default)(typeof config !== 'string', `SlackOAuthClient: do not allow constructing client with ${config} string. Use object instead.`); | ||
this.accessToken = config.accessToken; | ||
@@ -46,3 +46,3 @@ this.onRequest = config.onRequest; | ||
}); | ||
this.axios.interceptors.request.use(messaging_api_common_1.createRequestInterceptor({ onRequest: this.onRequest })); | ||
this.axios.interceptors.request.use((0, messaging_api_common_1.createRequestInterceptor)({ onRequest: this.onRequest })); | ||
this.chat = { | ||
@@ -73,3 +73,3 @@ postMessage: this._postMessage.bind(this), | ||
static connect(config) { | ||
warning_1.default(false, '`SlackOAuthClient.connect(...)` is deprecated. Use `new SlackOAuthClient(...)` instead.'); | ||
(0, warning_1.default)(false, '`SlackOAuthClient.connect(...)` is deprecated. Use `new SlackOAuthClient(...)` instead.'); | ||
return new SlackOAuthClient(config); | ||
@@ -81,4 +81,4 @@ } | ||
const body = Object.assign(Object.assign({}, inputBody), { token: this.accessToken }); | ||
const response = yield this.axios.post(method, querystring_1.default.stringify(messaging_api_common_1.snakecaseKeysDeep(body))); | ||
const data = messaging_api_common_1.camelcaseKeysDeep(response.data); | ||
const response = yield this.axios.post(method, querystring_1.default.stringify((0, messaging_api_common_1.snakecaseKeysDeep)(body))); | ||
const data = (0, messaging_api_common_1.camelcaseKeysDeep)(response.data); | ||
if (!data.ok) { | ||
@@ -262,3 +262,5 @@ const { config, request } = response; | ||
? Object.assign({ cursor: continuationCursor }, options) : options; | ||
const { channels, next, } = yield this.getConversationList(nextOptions); | ||
const { channels, next, | ||
// eslint-disable-next-line no-await-in-loop | ||
} = yield this.getConversationList(nextOptions); | ||
allChannels = allChannels.concat(channels); | ||
@@ -271,3 +273,3 @@ continuationCursor = next; | ||
postMessage(channel, inputMessage, options = {}) { | ||
warning_1.default(false, '`postMessage` is deprecated. Use `chat.postMessage` instead.'); | ||
(0, warning_1.default)(false, '`postMessage` is deprecated. Use `chat.postMessage` instead.'); | ||
const message = typeof inputMessage === 'string' ? { text: inputMessage } : inputMessage; | ||
@@ -306,3 +308,3 @@ return this._postMessage(Object.assign(Object.assign({ channel }, message), options)); | ||
postEphemeral(channel, user, inputMessage, options = {}) { | ||
warning_1.default(false, '`postEphemeral` is deprecated. Use `chat.postEphemeral` instead.'); | ||
(0, warning_1.default)(false, '`postEphemeral` is deprecated. Use `chat.postEphemeral` instead.'); | ||
const message = typeof inputMessage === 'string' ? { text: inputMessage } : inputMessage; | ||
@@ -309,0 +311,0 @@ return this._postEphemeral(Object.assign(Object.assign({ channel, |
@@ -12,3 +12,3 @@ "use strict"; | ||
constructor(config) { | ||
ts_invariant_1.default(typeof config !== 'string', `SlackWebhookClient: do not allow constructing client with ${config} string. Use object instead.`); | ||
(0, ts_invariant_1.default)(typeof config !== 'string', `SlackWebhookClient: do not allow constructing client with ${config} string. Use object instead.`); | ||
this.onRequest = config.onRequest; | ||
@@ -21,3 +21,3 @@ // incoming webhooks | ||
}); | ||
this.axios.interceptors.request.use(messaging_api_common_1.createRequestInterceptor({ onRequest: this.onRequest })); | ||
this.axios.interceptors.request.use((0, messaging_api_common_1.createRequestInterceptor)({ onRequest: this.onRequest })); | ||
} | ||
@@ -28,3 +28,3 @@ /** | ||
static connect(config) { | ||
warning_1.default(false, '`SlackWebhookClient.connect(...)` is deprecated. Use `new SlackWebhookClient(...)` instead.'); | ||
(0, warning_1.default)(false, '`SlackWebhookClient.connect(...)` is deprecated. Use `new SlackWebhookClient(...)` instead.'); | ||
return new SlackWebhookClient(config); | ||
@@ -46,3 +46,3 @@ } | ||
sendRawBody(body) { | ||
return this.axios.post('', messaging_api_common_1.snakecaseKeysDeep(body)).then((res) => res.data); | ||
return this.axios.post('', (0, messaging_api_common_1.snakecaseKeysDeep)(body)).then((res) => res.data); | ||
} | ||
@@ -49,0 +49,0 @@ /** |
@@ -9,3 +9,3 @@ { | ||
}, | ||
"version": "1.0.6", | ||
"version": "1.1.0", | ||
"main": "dist/index.js", | ||
@@ -32,3 +32,3 @@ "types": "dist/index.d.ts", | ||
}, | ||
"gitHead": "785284584a31f3c3a9daa63497ba7b0d6b7a2eb4" | ||
"gitHead": "7df9e3bba37712e0892f14895576c42c949d3003" | ||
} |
@@ -689,5 +689,5 @@ import querystring from 'querystring'; | ||
const data = (camelcaseKeysDeep( | ||
const data = camelcaseKeysDeep( | ||
response.data | ||
) as any) as SlackTypes.OAuthAPIResponse; | ||
) as any as SlackTypes.OAuthAPIResponse; | ||
@@ -705,3 +705,3 @@ if (!data.ok) { | ||
return data; | ||
} catch (err) { | ||
} catch (err: any) { | ||
throw new AxiosError(err.message, err); | ||
@@ -875,5 +875,3 @@ } | ||
*/ | ||
getConversationList( | ||
options?: SlackTypes.ConversationListOptions | ||
): Promise<{ | ||
getConversationList(options?: SlackTypes.ConversationListOptions): Promise<{ | ||
channels: SlackTypes.Channel[]; | ||
@@ -1224,5 +1222,3 @@ next?: string; | ||
*/ | ||
getUserList( | ||
options?: SlackTypes.UserListOptions | ||
): Promise<{ | ||
getUserList(options?: SlackTypes.UserListOptions): Promise<{ | ||
members: SlackTypes.User[]; | ||
@@ -1229,0 +1225,0 @@ next?: string; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
6826
249665