Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atomist/slack-messages

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atomist/slack-messages - npm Package Compare versions

Comparing version 1.1.2-master.20200430150635 to 1.2.0-master.20200806083357

.eslintrc.json

8

CHANGELOG.md

@@ -8,4 +8,10 @@ # Changelog

## [Unreleased](https://github.com/atomist/slack-messages/compare/1.1.1...HEAD)
## [Unreleased](https://github.com/atomist/slack-messages/compare/1.1.2...HEAD)
### Added
- Add types for Slack Block messages. [c0d12d1](https://github.com/atomist/slack-messages/commit/c0d12d19b3b7c7bf5382b6a6fa8594d7ace18951)
## [1.1.2](https://github.com/atomist/slack-messages/compare/1.1.1...1.1.2) - 2020-04-30
## [1.1.1](https://github.com/atomist/slack-messages/compare/1.1.0...1.1.1) - 2019-06-18

@@ -12,0 +18,0 @@

2

index.d.ts
export * from "./lib/SlackMessages";
export { githubToSlack, } from "./lib/Markdown";
export { githubToSlack } from "./lib/Markdown";
//# sourceMappingURL=index.d.ts.map

@@ -17,9 +17,16 @@ "use strict";

*/
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./lib/SlackMessages"));
__exportStar(require("./lib/SlackMessages"), exports);
var Markdown_1 = require("./lib/Markdown");
exports.githubToSlack = Markdown_1.githubToSlack;
Object.defineProperty(exports, "githubToSlack", { enumerable: true, get: function () { return Markdown_1.githubToSlack; } });
//# sourceMappingURL=index.js.map

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.githubToSlack = exports.convertFormat = exports.convertLinks = exports.convertImageLinks = exports.convertInlineImages = exports.convertNamedLinks = void 0;
const splitProcessor_1 = require("./splitProcessor");

@@ -31,4 +32,4 @@ /**

function trailingSpace(match, url, space, offset, full) {
const pad = (offset + match.length === full.length) ? "" : " ";
return (space) ? url + space : url + pad;
const pad = offset + match.length === full.length ? "" : " ";
return space ? url + space : url + pad;
}

@@ -42,6 +43,7 @@ /**

function convertNamedLinks(text) {
const namedLinksRegExp = /^\[(.+?)\]:\s*(https?:\/\/\S+).*\n/mg;
const namedLinksRegExp = /^\[(.+?)\]:\s*(https?:\/\/\S+).*\n/gm;
let matches;
const links = {};
while (matches = namedLinksRegExp.exec(text)) { // eslint-disable-line no-cond-assign
while ((matches = namedLinksRegExp.exec(text))) {
// eslint-disable-line no-cond-assign
const name = matches[1];

@@ -56,3 +58,3 @@ const url = matches[2];

linked = linked.replace(nameRegExp, (m, ln) => {
const linkName = (ln) ? ln : n;
const linkName = ln ? ln : n;
return `[${linkName}](${u})`;

@@ -103,3 +105,4 @@ });

function convertFormat(text) {
return text.replace(/^(\s*)[-*](\s+)/mg, "$1•$2")
return text
.replace(/^(\s*)[-*](\s+)/gm, "$1•$2")
.replace(/(\*|_)\1(\S|\S.*?\S)\1\1(?!\1)/g, "<bdmkd>$2<bdmkd>")

@@ -106,0 +109,0 @@ .replace(/(\*|_)(?!\1)(\S|\S.*?\S)\1(?!\1)/g, "<itmkd>$2<itmkd>")

@@ -66,2 +66,3 @@ /**

attachments?: Attachment[];
blocks?: Block[];
unfurl_links?: boolean;

@@ -133,2 +134,144 @@ unfurl_media?: boolean;

export declare type ActionType = "button" | "select";
export interface Block {
type: "actions" | "context" | "divider" | "file" | "header" | "image" | "section";
block_id?: string;
}
export interface ActionsBlock extends Block {
type: "actions";
elements: Array<ButtonElement | CheckboxesElement | PlainTextElement | RadioButtonsElement | StaticOptionElement | UserOptionElement | ConversationOptionElement | ChannelOptionElement | DatePickerElement | OverflowElement>;
}
export interface ContextBlock extends Block {
type: "context";
elements: Array<TextObject | ImageElement>;
}
export interface DividerBlock {
type: "divider";
}
export interface FileBlock {
type: "file";
external_id: string;
source: string;
}
export interface HeaderBlock {
type: "header";
text: PlainTextObject;
}
export interface ImageBlock {
type: "image";
image_url: string;
alt_text: string;
title?: PlainTextObject;
}
export interface SectionBlock {
type: "section";
text: TextObject;
fields?: TextObject[];
accessory?: Element;
}
export interface Element {
type: "button" | "checkboxes" | "datepicker" | "image" | "multi_static_select" | "multi_users_select" | "multi_conversations_select" | "multi_channels_select" | "overflow" | "plain_text_input" | "radio_buttons" | "static_select" | "users_select" | "conversations_select" | "channels_select";
}
export interface TextObject {
type: "plain_text" | "mrkdwn";
text: string;
emoji?: boolean;
verbatim?: boolean;
}
export interface ConfirmObject {
title: string;
text: string;
confirm: string;
deny: string;
style: "primary" | "danger";
}
export interface PlainTextObject extends TextObject {
type: "plain_text";
}
export interface ButtonElement extends Element {
type: "button";
text: PlainTextObject;
url?: string;
value?: string;
style?: "primary" | "danger";
confirm?: ConfirmObject;
}
export interface CheckboxesElement extends Element {
type: "checkboxes";
options: OptionObject[];
initial_option?: OptionObject;
confirm?: ConfirmObject;
}
export interface DatePickerElement extends Element {
type: "datepicker";
placeholder: PlainTextObject;
initial_date?: string;
confirm?: ConfirmObject;
}
export interface ImageElement extends Element {
type: "image";
image_url: string;
alt_text: string;
}
export interface OverflowElement extends Element {
type: "overflow";
options: OptionObject[];
confirm?: ConfirmObject;
}
export interface PlainTextElement extends Element {
type: "plain_text_input";
placeholder?: PlainTextObject;
initial_value?: string;
multiline?: boolean;
min_length?: number;
max_length?: number;
}
export interface RadioButtonsElement extends Element {
type: "radio_buttons";
options: OptionObject[];
initial_option?: OptionObject;
confirm?: ConfirmObject;
}
export interface OptionObject {
text: PlainTextObject;
value: string;
description?: string;
url?: string;
}
export interface StaticOptionElement extends Element {
type: "static_select";
placeholder: PlainTextObject;
options?: OptionObject[];
option_groups?: Array<{
label: PlainTextObject;
options: OptionObject[];
}>;
initial_option?: OptionObject;
confirm?: ConfirmObject;
}
export interface UserOptionElement extends Element {
type: "users_select";
placeholder: PlainTextObject;
initial_user?: string;
confirm?: ConfirmObject;
}
export interface ConversationOptionElement extends Element {
type: "conversations_select";
placeholder: PlainTextObject;
initial_conversation?: string;
default_to_current_conversation?: boolean;
confirm?: ConfirmObject;
response_url_enabled?: boolean;
filter?: {
include?: string[];
exclude_external_shared_channels?: boolean;
exclude_bot_users?: boolean;
};
}
export interface ChannelOptionElement extends Element {
type: "channels_select";
placeholder: PlainTextObject;
initial_channel?: string;
confirm?: ConfirmObject;
response_url_enabled?: boolean;
}
//# sourceMappingURL=SlackMessages.d.ts.map

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.listItem = exports.codeBlock = exports.codeLine = exports.strikethrough = exports.italic = exports.bold = exports.emoji = exports.render = exports.atEveryone = exports.atHere = exports.atChannel = exports.channel = exports.user = exports.url = exports.escape = exports.MessageMimeTypes = void 0;
const splitProcessor_1 = require("./splitProcessor");

@@ -39,3 +40,6 @@ /**

if (text) {
const entify = (i) => i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
const entify = (i) => i
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
const htmlEntities = /(&(?:\w+|#\d+);)/;

@@ -123,3 +127,3 @@ return splitProcessor_1.splitProcessor(text, entify, htmlEntities);

if (att.actions && att.actions.length > 0 && !att.callback_id) {
att.callback_id = `cllbck${idx++}`; // eslint-disable-line @typescript-eslint/camelcase
att.callback_id = `cllbck${idx++}`;
}

@@ -133,3 +137,3 @@ });

function emoji(name) {
return (name) ? `:${name}:` : "";
return name ? `:${name}:` : "";
}

@@ -139,3 +143,3 @@ exports.emoji = emoji;

function bold(text) {
return (text) ? `*${text}*` : "";
return text ? `*${text}*` : "";
}

@@ -145,3 +149,3 @@ exports.bold = bold;

function italic(text) {
return (text) ? `_${text}_` : "";
return text ? `_${text}_` : "";
}

@@ -151,3 +155,3 @@ exports.italic = italic;

function strikethrough(text) {
return (text) ? `~${text}~` : "";
return text ? `~${text}~` : "";
}

@@ -157,3 +161,3 @@ exports.strikethrough = strikethrough;

function codeLine(text) {
return (text) ? "`" + text + "`" : "";
return text ? "`" + text + "`" : "";
}

@@ -163,3 +167,3 @@ exports.codeLine = codeLine;

function codeBlock(text) {
return (text) ? "```" + text + "```" : "";
return text ? "```" + text + "```" : "";
}

@@ -169,5 +173,5 @@ exports.codeBlock = codeBlock;

function listItem(item) {
return (item) ? `• ${item}` : "";
return item ? `• ${item}` : "";
}
exports.listItem = listItem;
//# sourceMappingURL=SlackMessages.js.map

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.splitProcessor = void 0;
/**

@@ -20,0 +21,0 @@ * Perform transformations on input string, skipping sections that match

{
"name": "@atomist/slack-messages",
"version": "1.1.2-master.20200430150635",
"version": "1.2.0-master.20200806083357",
"description": "Atomist utilities for creating formatted Slack messages",

@@ -29,16 +29,19 @@ "author": {

"devDependencies": {
"@types/mocha": "^7.0.2",
"@types/mocha": "^8.0.1",
"@types/power-assert": "^1.5.3",
"@typescript-eslint/eslint-plugin": "^2.30.0",
"@typescript-eslint/parser": "^2.30.0",
"eslint": "^6.8.0",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"eslint": "^7.6.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"espower-typescript": "^9.0.2",
"mocha": "^7.1.2",
"mocha": "^8.1.1",
"npm-run-all": "^4.1.5",
"power-assert": "^1.6.1",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
"supervisor": "^0.12.0",
"ts-node": "^8.9.1",
"typedoc": "^0.17.6",
"typescript": "^3.8.3"
"ts-node": "^8.10.2",
"typedoc": "^0.17.8",
"typescript": "^3.9.7"
},

@@ -45,0 +48,0 @@ "directories": {

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc