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

@guardian/anghammarad

Package Overview
Dependencies
Maintainers
45
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@guardian/anghammarad - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

2

dist/src/interfaces.d.ts

@@ -11,2 +11,3 @@ import { SNS } from "aws-sdk";

AwsAccount?: string;
GithubTeamSlug?: string;
}

@@ -29,2 +30,3 @@ export declare enum RequestedChannel {

client?: SNS;
threadKey?: string;
}

11

dist/src/main.js

@@ -29,9 +29,6 @@ "use strict";

messageJson(params) {
return JSON.stringify({
message: params.message,
sender: params.sourceSystem,
channel: params.channel,
target: params.target,
actions: params.actions,
});
const { message, sourceSystem, channel, target, actions, threadKey } = params;
return JSON.stringify(Object.assign({ message, sender: sourceSystem, channel,
target,
actions }, (threadKey && { threadKey })));
}

@@ -38,0 +35,0 @@ notify(params) {

{
"name": "@guardian/anghammarad",
"version": "1.0.2",
"version": "1.1.0",
"description": "Notification service for the Guardian's dev teams",

@@ -5,0 +5,0 @@ "main": "dist/src/main.js",

@@ -24,6 +24,3 @@ # Anghammarad Node Client

```js
import {
Anghammarad,
RequestedChannel,
} from "@guardian/anghammarad";
import { Anghammarad, RequestedChannel } from '@guardian/anghammarad';

@@ -33,10 +30,10 @@ const client = new Anghammarad();

client.notify({
subject: "Hello",
message: "Hi there, something has happened which we'd like to tell you about",
actions: [{url: "https://example.com"}],
target: {Stack: "my-stack", Stage: "CODE", App: "my-app"},
channel: RequestedChannel.Email,
sourceSystem: "my-monitoring-tool",
topicArn: "arn:aws:123"
})
subject: 'Hello',
message: "Hi there, something has happened which we'd like to tell you about",
actions: [{ url: 'https://example.com' }],
target: { Stack: 'my-stack', Stage: 'CODE', App: 'my-app' },
channel: RequestedChannel.Email,
sourceSystem: 'my-monitoring-tool',
topicArn: 'arn:aws:123',
});
```

@@ -47,7 +44,4 @@

```js
import {
Anghammarad,
RequestedChannel,
} from "@guardian/anghammarad";
import { credentialsProvider, snsClient } from "./aws";
import { Anghammarad, RequestedChannel } from '@guardian/anghammarad';
import { credentialsProvider, snsClient } from './aws';

@@ -57,11 +51,11 @@ const client = new Anghammarad();

client.notify({
subject: "Hello",
message: "Hi there, something has happened which we'd like to tell you about",
actions: [{url: "https://example.com"}],
target: {Stack: "my-stack", Stage: "CODE", App: "my-app"},
channel: RequestedChannel.Email,
sourceSystem: "my-monitoring-tool",
topicArn: "arn:aws:123",
client: snsClient(credentialsProvider())
})
subject: 'Hello',
message: "Hi there, something has happened which we'd like to tell you about",
actions: [{ url: 'https://example.com' }],
target: { Stack: 'my-stack', Stage: 'CODE', App: 'my-app' },
channel: RequestedChannel.Email,
sourceSystem: 'my-monitoring-tool',
topicArn: 'arn:aws:123',
client: snsClient(credentialsProvider()),
});
```

@@ -80,3 +74,3 @@

| topicArn | The ARN of the topic to which the message should be send | Y | "arn:aws:..." |
| client | An optional SNS client to send the message with. | N | https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html |
| client | An optional SNS client to send the message with. | N | https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html |

@@ -115,7 +109,4 @@ ### Channels

// Custom client for Anghammarad client
import {
Anghammarad,
RequestedChannel,
} from "@guardian/anghammarad";
import { credentialsProvider, snsClient } from "./aws";
import { Anghammarad, RequestedChannel } from '@guardian/anghammarad';
import { credentialsProvider, snsClient } from './aws';

@@ -125,10 +116,10 @@ const client = new Anghammarad(snsClient(credentialsProvider()));

client.notify({
subject: "Hello",
message: "Hi there, something has happened which we'd like to tell you about",
actions: [{url: "https://example.com"}],
target: {Stack: "my-stack", Stage: "CODE", App: "my-app"},
channel: RequestedChannel.Email,
sourceSystem: "my-monitoring-tool",
topicArn: "arn:aws:123"
})
subject: 'Hello',
message: "Hi there, something has happened which we'd like to tell you about",
actions: [{ url: 'https://example.com' }],
target: { Stack: 'my-stack', Stage: 'CODE', App: 'my-app' },
channel: RequestedChannel.Email,
sourceSystem: 'my-monitoring-tool',
topicArn: 'arn:aws:123',
});
```

@@ -138,2 +129,2 @@

The client is published to npm as `@guardian/anghammarad`. You must have an `npm` account with 2fa enabled and be part of the `guardian` organisation. You can then run `yarn publish` to publish the library, enterring your OTP when prompted.
The client is published to npm as `@guardian/anghammarad`. You must have an `npm` account with 2fa enabled and be part of the `guardian` organisation. You can then run `npm version <patch|minor|major>` followed by `npm publish` to publish the library, enterring your OTP when prompted (issues have been encountered running `yarn publish` in the past so npm is recommended).

@@ -13,2 +13,3 @@ import { SNS } from "aws-sdk";

AwsAccount?: string;
GithubTeamSlug?: string;
}

@@ -33,2 +34,3 @@

client?: SNS;
threadKey?: string;
}

@@ -13,8 +13,18 @@ import { NotifyParams } from "./interfaces";

messageJson(params: NotifyParams): string {
const {
message,
sourceSystem,
channel,
target,
actions,
threadKey
} = params
return JSON.stringify({
message: params.message,
sender: params.sourceSystem,
channel: params.channel,
target: params.target,
actions: params.actions,
message,
sender: sourceSystem,
channel,
target,
actions,
...(threadKey && { threadKey }), // only add "threadKey" when it is defined
});

@@ -21,0 +31,0 @@ }

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