@slingr/slingr-services 0.0.5 → 0.0.7
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/Deployment-Notes.md +28 -0
- package/README.md +16 -12
- package/index.js +9 -2
- package/package.json +1 -1
- package/services/files/files.js +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Deployment Notes
|
|
2
|
+
To deploy, you need to be logged on npm.
|
|
3
|
+
```shell
|
|
4
|
+
npm login
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
After logged, you need to push a new versión
|
|
8
|
+
If the sdk has bugfixes:
|
|
9
|
+
```shell
|
|
10
|
+
npm version patch
|
|
11
|
+
```
|
|
12
|
+
Or if it has great behavior changes:
|
|
13
|
+
```shell
|
|
14
|
+
npm version minor
|
|
15
|
+
```
|
|
16
|
+
And if there is a complete change in it
|
|
17
|
+
```shell
|
|
18
|
+
npm version major
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
To deploy and publish on npm:
|
|
22
|
+
```shell
|
|
23
|
+
npm publish --access public
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
You can verify that the version is public here
|
|
27
|
+
|
|
28
|
+
[NPM SDK Node](https://www.npmjs.com/package/@slingr/slingr-services)
|
package/README.md
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<table class="table" style="margin-top: 10px">
|
|
2
|
+
<thead>
|
|
3
|
+
<tr>
|
|
4
|
+
<th>Title</th>
|
|
5
|
+
<th>Last Updated</th>
|
|
6
|
+
<th>Summary</th>
|
|
7
|
+
</tr>
|
|
8
|
+
</thead>
|
|
9
|
+
<tbody>
|
|
10
|
+
<tr>
|
|
11
|
+
<td>Services Nodejs SDK</td>
|
|
12
|
+
<td>April 16, 2024</td>
|
|
13
|
+
<td>Node.js SDK to create Slingr Services.</td>
|
|
14
|
+
</tr>
|
|
15
|
+
</tbody>
|
|
16
|
+
</table>
|
|
11
17
|
|
|
12
18
|
This document will guide through the creation of a service using the Nodejs SDK and will provide details about the
|
|
13
19
|
framework.
|
|
@@ -369,5 +375,3 @@ There are dozens of services already developed for the SLINGR platform. You can
|
|
|
369
375
|
more features in the services' framework:
|
|
370
376
|
|
|
371
377
|
[https://github.com/slingr-stack](https://github.com/slingr-stack)
|
|
372
|
-
|
|
373
|
-
{% include links.html %}
|
package/index.js
CHANGED
|
@@ -130,7 +130,7 @@ const loadPlatformWebServices = () => {
|
|
|
130
130
|
if (settings.token === req?.headers?.token) {
|
|
131
131
|
validToken = true
|
|
132
132
|
}
|
|
133
|
-
if (!validToken && localDeployment) {
|
|
133
|
+
if (!validToken && settings.localDeployment) {
|
|
134
134
|
// if the service is running in local environment, pass token validation
|
|
135
135
|
if (!firstLocalDeploymentWarning) {
|
|
136
136
|
firstLocalDeploymentWarning = true;
|
|
@@ -282,7 +282,14 @@ const loadPlatformWebServices = () => {
|
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
} else {
|
|
285
|
-
|
|
285
|
+
// The platform was retrying this request multiple times since it didn't get a response in this case
|
|
286
|
+
// so lets send it a 500
|
|
287
|
+
appLogger.error(`Cannot find function [${functionName}] on service [${settings.svcName}]`);
|
|
288
|
+
res.status(500).send({
|
|
289
|
+
date: + new Date(),
|
|
290
|
+
data: convertException(`Cannot find function [${functionName}] on service [${settings.svcName}]`)
|
|
291
|
+
});
|
|
292
|
+
next(new Error('Cannot find function [' + functionName + '] on service [' + settings.svcName + ']'));
|
|
286
293
|
}
|
|
287
294
|
|
|
288
295
|
}
|
package/package.json
CHANGED
package/services/files/files.js
CHANGED
|
@@ -6,7 +6,7 @@ const stream = require('node:stream');
|
|
|
6
6
|
const pStream = stream.promises;
|
|
7
7
|
const FormData = require('form-data');
|
|
8
8
|
|
|
9
|
-
const FILES_API_PATH = '/
|
|
9
|
+
const FILES_API_PATH = '/services/files'
|
|
10
10
|
const TMP_FILES_PATH = './tmp/'
|
|
11
11
|
|
|
12
12
|
const clearTmpFile = async (filePath) => {
|