configurapi-handler-ws 1.1.1 → 1.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "configurapi-handler-ws",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "main": "src/index",
5
5
  "files": [
6
6
  "src/*",
@@ -23,5 +23,8 @@
23
23
  "description": "",
24
24
  "devDependencies": {
25
25
  "@types/node": "^25.2.3"
26
+ },
27
+ "dependencies": {
28
+ "uuid": "^13.0.0"
26
29
  }
27
30
  }
@@ -1,3 +1,3 @@
1
1
  import { PostbackResponse } from "./postbackResponse";
2
2
 
3
- export function pushFunction(postBackFunction: Function, response: PostbackResponse): Promise<void>;
3
+ export function postbackFunction(postBackFunction: Function, response: PostbackResponse): Promise<void>;
@@ -1,4 +1,4 @@
1
- const { randomUUID } = require("node:crypto");
1
+ const { v4: uuidv4 } = require('uuid');
2
2
  const StreamResponse = require("./streamResponse");
3
3
 
4
4
  // tiny sleep for retry/backoff
@@ -50,7 +50,7 @@ module.exports = async function postbackFunction(postBackFunction, response)
50
50
  };
51
51
 
52
52
  const stream = response.body;
53
- const streamId = baseHeaders?.['message-id'] || randomUUID();
53
+ const streamId = baseHeaders?.['message-id'] || uuidv4();
54
54
 
55
55
  // Guard: need a readable stream
56
56
  if(!stream || typeof stream.on !== 'function')
@@ -1,6 +1,4 @@
1
- const Response = require('configurapi').Response;
2
-
3
- module.exports = class PostbackResponse extends Response
1
+ module.exports = class PostbackResponse
4
2
  {
5
3
  body;
6
4
  headers;
@@ -9,7 +7,5 @@ module.exports = class PostbackResponse extends Response
9
7
  {
10
8
  this.body = body;
11
9
  this.headers = headers;
12
-
13
- super(body, 200, headers);
14
10
  }
15
11
  };
@@ -1,9 +1,13 @@
1
- const Response = require('configurapi').Response;
2
-
3
- module.exports = class StreamResponse extends Response
1
+ module.exports = class StreamResponse
4
2
  {
5
- constructor(stream, statusCode = 200, headers = {})
3
+ statusCode = 200;
4
+ body;
5
+ headers;
6
+
7
+ constructor(stream, statusCode, headers = {})
6
8
  {
7
- super(stream, statusCode, headers);
9
+ this.body = stream;
10
+ this.statusCode = statusCode;
11
+ this.headers = headers;
8
12
  }
9
13
  };