@yourrentals/cloudevent-publisher-hapi 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +34 -6
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,11 +1,39 @@
1
- # cloudevent-publisher-hapi
1
+ # @yourrentals/cloudevent-publisher-hapi
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ This library defines a JS library to publish messages to the message bus.
4
4
 
5
- ## Building
5
+ ## Installation
6
6
 
7
- Run `nx build cloudevent-publisher-hapi` to build the library.
7
+ ```bash
8
+ yarn add @yourrentals/cloudevent-publisher-hapi
9
+ ```
8
10
 
9
- ## Running unit tests
11
+ ## Usage
10
12
 
11
- Run `nx test cloudevent-publisher-hapi` to execute the unit tests via [Jest](https://jestjs.io).
13
+ ```ts
14
+ import { Publisher } from '@yourrentals/cloudevent-publisher-hapi';
15
+
16
+ const publisher = new Publisher({
17
+ source: 'publisher',
18
+ topics: [
19
+ {
20
+ eventType: 'my-event',
21
+ topicArn: 'arn:aws:sns:eu-west-1:123456789012:my-topic',
22
+ },
23
+ ],
24
+ });
25
+
26
+ await publisher.publish('my-event', {
27
+ data: {
28
+ foo: 'bar',
29
+ },
30
+ });
31
+
32
+ await publisher.publishBatch('my-event', [
33
+ {
34
+ data: {
35
+ foo: 'bar',
36
+ },
37
+ },
38
+ ]);
39
+ ```
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@yourrentals/cloudevent-publisher-hapi",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "dependencies": {
5
- "@yourrentals/cloudevent-publisher-core": "0.4.1"
5
+ "@yourrentals/cloudevent-publisher-core": "0.4.3"
6
6
  },
7
7
  "type": "commonjs",
8
8
  "main": "./index.cjs.js",