@atomist/slack-messages
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -10,4 +10,15 @@ # Change Log | ||
[Unreleased]: https://github.com/atomist/slack-messages/compare/0.7.0...HEAD | ||
[Unreleased]: https://github.com/atomist/slack-messages/compare/0.8.0...HEAD | ||
### Added | ||
- New function `rugMenuFrom` in SlackMessages for building Slack combo | ||
boxes | ||
## [0.8.0] - 2017-08-14 | ||
[0.8.0]: https://github.com/atomist/slack-messages/compare/0.7.0...0.8.0 | ||
Standard messages release | ||
### Fixed | ||
@@ -33,5 +44,7 @@ | ||
### Breaking | ||
- Moved emptyString from SlackMessages to Common | ||
### Added | ||
- Support conversion of GitHub markdown to Slack markdown | ||
@@ -44,2 +57,3 @@ | ||
### Fixed | ||
- Enforce message validation to ensure rendered buttons can be clicked: | ||
@@ -53,2 +67,3 @@ [#10](https://github.com/atomist/slack-messages/issues/10) | ||
### Fixed | ||
- Replace special characters globally: [#9](https://github.com/atomist/slack-messages/issues/9) | ||
@@ -61,5 +76,7 @@ | ||
### Added | ||
- Added explicit `atChannel` that renders as `@channel` in Slack | ||
### Fixed | ||
- Fixes [#8](https://github.com/atomist/slack-messages/issues/8) (TypeError: key.charAt is not a function) | ||
@@ -69,2 +86,3 @@ - Slack helper function will render empty string when given undefined values | ||
### Changed | ||
- **BREAKING** Renamed `atUser` to `user` | ||
@@ -78,2 +96,3 @@ - **BREAKING** Renamed `atChannel` with channel id, channel name to `channel` | ||
### Fixed | ||
- **BREAKING** Flatten module structure. You will need to update your | ||
@@ -91,2 +110,3 @@ import statements: | ||
### Fixed | ||
- **BREAKING** `ButtonSpec` should be an interface | ||
@@ -99,2 +119,3 @@ | ||
### Changed | ||
- **BREAKING** `Action` fields `name` and `type` are now required in order | ||
@@ -108,5 +129,7 @@ to match Slack required fields | ||
### Added | ||
- Add `renderError` and `renderSuccess` generic success and error rug messages | ||
### Fixed | ||
- `SlackMessage` `text` field should be optional | ||
@@ -113,0 +136,0 @@ - `Attachment` `text` field should be optional |
{ | ||
"name": "@atomist/slack-messages", | ||
"description": "utilities for creating Slack messages", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"author": "Atomist", | ||
@@ -21,3 +21,3 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@atomist/rug": "^1.0.0-m.5", | ||
"@atomist/rug": "^1.0.0-m.6", | ||
"deprecated-decorator": "^0.1.6", | ||
@@ -24,0 +24,0 @@ "lodash": "^4.17.4" |
@@ -90,2 +90,7 @@ /** | ||
} | ||
export interface SelectOption { | ||
text: string; | ||
value: string; | ||
} | ||
export declare type DataSource = "static" | "users" | "channels" | "conversations" | "external"; | ||
/** | ||
@@ -102,2 +107,4 @@ * Represents Slack action. | ||
confirm?: ActionConfirmation; | ||
options?: SelectOption[]; | ||
data_source?: DataSource; | ||
} | ||
@@ -111,3 +118,3 @@ /** Represents Slack action confirmation. */ | ||
} | ||
export declare type ActionType = "button"; | ||
export declare type ActionType = "button" | "select"; | ||
export interface ButtonSpec { | ||
@@ -121,2 +128,6 @@ text: string; | ||
} | ||
export interface SelectableIdentifiableInstruction extends IdentifiableInstruction { | ||
id: string; | ||
parameterName: string; | ||
} | ||
export declare class ValidationError extends Error { | ||
@@ -128,1 +139,7 @@ message: string; | ||
export declare function rugButtonFrom(action: ButtonSpec, command: IdentifiableInstruction): Action; | ||
export interface SelectSpec { | ||
text: string; | ||
options: SelectOption[] | DataSource; | ||
} | ||
/** Construct Slack menu that will execute provided rug instruction. */ | ||
export declare function rugMenuFrom(action: SelectSpec, command: SelectableIdentifiableInstruction): Action; |
@@ -198,2 +198,29 @@ "use strict"; | ||
exports.rugButtonFrom = rugButtonFrom; | ||
/** Construct Slack menu that will execute provided rug instruction. */ | ||
function rugMenuFrom(action, command) { | ||
if (!command.id) { | ||
throw new ValidationError("SelectableIdentifiableInstruction must have id set"); | ||
} | ||
if (!command.parameterName) { | ||
throw new ValidationError("SelectableIdentifiableInstruction must have parameterName set"); | ||
} | ||
var select = { | ||
text: action.text, | ||
type: "select", | ||
name: "rug::" + command.id, | ||
}; | ||
if (typeof action.options === "string") { | ||
select.data_source = action.options; | ||
} | ||
else { | ||
select.options = action.options; | ||
} | ||
for (var attr in action) { | ||
if (action.hasOwnProperty(attr) && attr !== "options") { | ||
select[attr] = action[attr]; | ||
} | ||
} | ||
return select; | ||
} | ||
exports.rugMenuFrom = rugMenuFrom; | ||
//# sourceMappingURL=SlackMessages.js.map |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
70008
806
0
Updated@atomist/rug@^1.0.0-m.6