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 0.6.0 to 0.7.0

Common.d.ts

12

CHANGELOG.md

@@ -10,4 +10,14 @@ # Change Log

[Unreleased]: https://github.com/atomist/slack-messages/compare/0.6.0...HEAD
[Unreleased]: https://github.com/atomist/slack-messages/compare/0.7.0...HEAD
## [0.7.0] - 2017-07-04
[0.7.0]: https://github.com/atomist/slack-messages/compare/0.6.0...0.7.0
### Breaking
- Moved emptyString from SlackMessages to Common
### Added
- Support conversion of GitHub markdown to Slack markdown
## [0.6.0] - 2017-05-16

@@ -14,0 +24,0 @@

2

package.json
{
"name": "@atomist/slack-messages",
"version": "0.6.0",
"version": "0.7.0",
"author": "Atomist, Inc",

@@ -5,0 +5,0 @@ "directories": {

@@ -27,3 +27,3 @@ # @atomist/slack-messages

// A very simple message
const msg = { text: "Simple message" };
const msg: SlackMessage = { text: "Simple message" };
```

@@ -35,3 +35,3 @@

// This assumes user, issue and instruction objects are defined elsewhere.
const msg = {
const msg: SlackMessage = {
text: `${url(user.url, "@" + user.name)} opened issue: ${url(issue.url, issue.title)}`,

@@ -72,2 +72,3 @@ attachments: [

],
"callback_id": "cllbck1",
"actions": [

@@ -85,4 +86,5 @@ {

```
Note that `render` function will automatically assign unique `callback_id` to each attachments that has actions.
But, if you provide your custom `callback_id` it will be preserved as is.
### Additional helper functions:

@@ -89,0 +91,0 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Common_1 = require("./Common");
var SlackMessages_1 = require("./SlackMessages");

@@ -18,3 +19,3 @@ var Handlers_1 = require("@atomist/rug/operations/Handlers");

};
if (!SlackMessages_1.emptyString(correlationId)) {
if (!Common_1.emptyString(correlationId)) {
error.footer = "Correlation ID: " + correlationId;

@@ -21,0 +22,0 @@ }

@@ -1,10 +0,1 @@

/**
* Construct and render slack messages according to Slack message
* formatting: https://api.slack.com/docs/message-formatting. Customize
* messages with rug actions.
*/
export declare function emptyString(str: string): boolean;
/**
* Escapes special Slack characters.
*/
export declare function escape(text: string): string;

@@ -11,0 +2,0 @@ /**

@@ -18,11 +18,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
function emptyString(str) {
return str == null || str === "";
}
exports.emptyString = emptyString;
/**
* Escapes special Slack characters.
*/
var Common_1 = require("./Common");
function escape(text) {
if (!emptyString(text)) {
if (!Common_1.emptyString(text)) {
return text

@@ -43,6 +40,6 @@ .replace(/&/g, "&")

function url(fullUrl, label) {
if (!emptyString(fullUrl) && !emptyString(label)) {
if (!Common_1.emptyString(fullUrl) && !Common_1.emptyString(label)) {
return "<" + fullUrl + "|" + escape(label) + ">";
}
else if (!emptyString(fullUrl)) {
else if (!Common_1.emptyString(fullUrl)) {
return "<" + fullUrl + ">";

@@ -60,6 +57,6 @@ }

function user(userId, userName) {
if (!emptyString(userId) && !emptyString(userName)) {
if (!Common_1.emptyString(userId) && !Common_1.emptyString(userName)) {
return "<@" + userId + "|" + userName + ">";
}
else if (!emptyString(userId)) {
else if (!Common_1.emptyString(userId)) {
return "<@" + userId + ">";

@@ -78,6 +75,6 @@ }

function channel(channelId, channelName) {
if (!emptyString(channelId) && !emptyString(channelName)) {
if (!Common_1.emptyString(channelId) && !Common_1.emptyString(channelName)) {
return "<#" + channelId + "|" + channelName + ">";
}
else if (!emptyString(channelId)) {
else if (!Common_1.emptyString(channelId)) {
return "<#" + channelId + ">";

@@ -130,3 +127,3 @@ }

function bold(text) {
if (!emptyString(text)) {
if (!Common_1.emptyString(text)) {
return "*" + text + "*";

@@ -141,3 +138,3 @@ }

function italic(text) {
if (!emptyString(text)) {
if (!Common_1.emptyString(text)) {
return "_" + text + "_";

@@ -152,3 +149,3 @@ }

function strikethrough(text) {
if (!emptyString(text)) {
if (!Common_1.emptyString(text)) {
return "~" + text + "~";

@@ -163,3 +160,3 @@ }

function codeLine(text) {
if (!emptyString(text)) {
if (!Common_1.emptyString(text)) {
return "`" + text + "`";

@@ -174,3 +171,3 @@ }

function codeBlock(text) {
if (!emptyString(text)) {
if (!Common_1.emptyString(text)) {
return "```" + text + "```";

@@ -185,3 +182,3 @@ }

function listItem(item) {
if (!emptyString(item)) {
if (!Common_1.emptyString(item)) {
return "\u2022 " + item;

@@ -206,3 +203,3 @@ }

function rugButtonFrom(action, command) {
if (emptyString(command.id)) {
if (Common_1.emptyString(command.id)) {
throw new ValidationError("Please provide a valid non-empty command id");

@@ -209,0 +206,0 @@ }

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