@smapiot/piral-cloud-node 0.12.2-pre.20220801.2 → 0.12.3-pre.20220802.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 smapiot
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ [![Piral Logo](https://github.com/smapiot/piral/raw/main/docs/assets/logo.png)](https://piral.io)
2
+
3
+ # `@smapiot/piral-cloud-node`
4
+
5
+ Node-usable API Client for the [Piral Feed Service](https://www.piral.cloud).
6
+
7
+ This package is compatible with Node.js v12 or higher.
8
+
9
+ ## Important Links
10
+
11
+ * 📢 **[We are hiring!](https://smapiot.com/jobs)** - work with us on Piral, its ecosystem and our users
12
+ * 🌍 [Website](https://www.piral.cloud/) - learn more about the Piral Feed Service
13
+ * 📖 [Documentation](https://docs.piral.cloud/) - everything to get started and master the Piral Feed Service
14
+ * 👪 [Community Chat](https://gitter.im/piral-io/community) - ask questions and provide answers in our Gitter room
15
+
16
+ ## Installation
17
+
18
+ The package can be installed with your favorite npm client, e.g.:
19
+
20
+ ```sh
21
+ npm i @smapiot/piral-cloud-node
22
+ ```
23
+
24
+ Once installed the package is ready to be used.
25
+
26
+ ## Usage
27
+
28
+ To use the package you need to import the `createServiceClient` function and call it:
29
+
30
+ ```js
31
+ const { createServiceClient } = require('@smapiot/piral-cloud-node');
32
+
33
+ const client = createServiceClient({
34
+ apiKey: '123...',
35
+ });
36
+
37
+ // use the client
38
+ ```
39
+
40
+ If you want to use it with your own Piral Feed Service instance then provide the `host` option:
41
+
42
+ ```js
43
+ const { createServiceClient } = require('@smapiot/piral-cloud-node');
44
+
45
+ const client = createServiceClient({
46
+ apiKey: '123...',
47
+ host: 'http://localhost:9000',
48
+ });
49
+
50
+ // use the client
51
+ ```
52
+
53
+ ## Example
54
+
55
+ If you want to just manipulate a feed you can go ahead and use the `doUpdateFeed` function.
56
+
57
+ ```js
58
+ const { createServiceClient } = require('@smapiot/piral-cloud-node');
59
+
60
+ const client = createServiceClient({
61
+ apiKey: '123...',
62
+ });
63
+
64
+ const feedId = 'my-feed';
65
+
66
+ console.log('Before', await client.doQueryFeed(feedId));
67
+
68
+ await client.doUpdateFeed(feedId, {
69
+ contributors: ['a@b.com', 'c@d.com'],
70
+ });
71
+
72
+ console.log('After', await client.doQueryFeed(feedId));
73
+ ```
74
+
75
+ Everything is fully typed using TypeScript declarations.
76
+
77
+ ## License
78
+
79
+ This SDK is released using the MIT license. For more information see the [license file](./LICENSE).
package/lib/index.js CHANGED
@@ -5994,7 +5994,7 @@ function createServiceClient(options) {
5994
5994
  FormData,
5995
5995
  Headers,
5996
5996
  getAuthorizationHeader() {
5997
- return Promise.resolve(apiKey);
5997
+ return Promise.resolve(`Basic ${apiKey}`);
5998
5998
  }
5999
5999
  };
6000
6000
  return new FeedServiceApiClient(http3, host);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smapiot/piral-cloud-node",
3
- "version": "0.12.2-pre.20220801.2",
3
+ "version": "0.12.3-pre.20220802.3",
4
4
  "description": "Piral Cloud: Node-usable API Client for the Piral Feed Service.",
5
5
  "author": {
6
6
  "name": "smapiot",
@@ -40,7 +40,7 @@
40
40
  "node"
41
41
  ],
42
42
  "devDependencies": {
43
- "@piral/feed-client": "^0.12.2",
43
+ "@piral/feed-client": "^0.12.3",
44
44
  "dets": "^0.12.0",
45
45
  "esbuild": "^0.14.51",
46
46
  "node-fetch": "^3.2.10"