persistent-request-response 0.1.0 → 0.1.1

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/dist/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // lib/resilient-sse/index.ts
@@ -41,52 +31,23 @@ module.exports = __toCommonJS(index_exports);
41
31
  var import_uuid = require("uuid");
42
32
 
43
33
  // lib/resilient-sse/server/fileLogger.ts
44
- var import_fs = __toESM(require("fs"));
45
- var import_path = __toESM(require("path"));
46
- var LOG_FILE = import_path.default.join(process.cwd(), "sse-debug.log");
47
- var MAX_PREVIEW = 80;
48
- function ts() {
49
- const d = /* @__PURE__ */ new Date();
50
- return d.getHours().toString().padStart(2, "0") + ":" + d.getMinutes().toString().padStart(2, "0") + ":" + d.getSeconds().toString().padStart(2, "0") + "." + d.getMilliseconds().toString().padStart(3, "0");
34
+ function logCreate(_streamId) {
51
35
  }
52
- function short(id) {
53
- return id.slice(0, 8);
36
+ function logEnqueue(_streamId, _eventId, _sseContent) {
54
37
  }
55
- function preview(s) {
56
- const oneline = s.replace(/\n/g, "\u21B5");
57
- return oneline.length > MAX_PREVIEW ? oneline.slice(0, MAX_PREVIEW) + "\u2026" : oneline;
38
+ function logClose(_streamId, _totalChunks, _reason) {
58
39
  }
59
- function write(line) {
60
- if (process.env.NODE_ENV !== "development") return;
61
- import_fs.default.appendFile(LOG_FILE, line + "\n", () => {
62
- });
63
- }
64
- function logCreate(streamId) {
65
- write(`[${ts()}] [CREATE ] sid=${short(streamId)}`);
66
- }
67
- function logEnqueue(streamId, eventId, sseContent) {
68
- write(`[${ts()}] [ENQUEUE ] sid=${short(streamId)} id=${String(eventId).padStart(4)} ${preview(sseContent)}`);
69
- }
70
- function logClose(streamId, totalChunks, reason) {
71
- write(`[${ts()}] [CLOSE ] sid=${short(streamId)} total=${totalChunks} reason=${reason}`);
72
- }
73
- function logResumeStart(streamId, fromEventId) {
74
- write(`[${ts()}] [RESUME ] sid=${short(streamId)} fromId=${fromEventId}`);
40
+ function logResumeStart(_streamId, _fromEventId) {
75
41
  }
76
- function logResumeBuffered(streamId, count) {
77
- write(`[${ts()}] [BUFFERED ] sid=${short(streamId)} replaying=${count} buffered chunks`);
42
+ function logResumeBuffered(_streamId, _count) {
78
43
  }
79
- function logResumePoll(streamId, nextIndex, newCount) {
80
- write(`[${ts()}] [POLL ] sid=${short(streamId)} nextIdx=${nextIndex} newChunks=${newCount}`);
44
+ function logResumePoll(_streamId, _nextIndex, _newCount) {
81
45
  }
82
- function logResumeDone(streamId, totalSent) {
83
- write(`[${ts()}] [RES_DONE ] sid=${short(streamId)} totalSent=${totalSent}`);
46
+ function logResumeDone(_streamId, _totalSent) {
84
47
  }
85
- function logResumeError(streamId, err) {
86
- write(`[${ts()}] [RES_ERR ] sid=${short(streamId)} ${String(err)}`);
48
+ function logResumeError(_streamId, _err) {
87
49
  }
88
50
  function logSeparator() {
89
- write("\u2500".repeat(100));
90
51
  }
91
52
 
92
53
  // lib/resilient-sse/server/createPersistentStream.ts
package/dist/index.mjs CHANGED
@@ -2,52 +2,23 @@
2
2
  import { v4 as uuidv4 } from "uuid";
3
3
 
4
4
  // lib/resilient-sse/server/fileLogger.ts
5
- import fs from "fs";
6
- import path from "path";
7
- var LOG_FILE = path.join(process.cwd(), "sse-debug.log");
8
- var MAX_PREVIEW = 80;
9
- function ts() {
10
- const d = /* @__PURE__ */ new Date();
11
- return d.getHours().toString().padStart(2, "0") + ":" + d.getMinutes().toString().padStart(2, "0") + ":" + d.getSeconds().toString().padStart(2, "0") + "." + d.getMilliseconds().toString().padStart(3, "0");
5
+ function logCreate(_streamId) {
12
6
  }
13
- function short(id) {
14
- return id.slice(0, 8);
7
+ function logEnqueue(_streamId, _eventId, _sseContent) {
15
8
  }
16
- function preview(s) {
17
- const oneline = s.replace(/\n/g, "\u21B5");
18
- return oneline.length > MAX_PREVIEW ? oneline.slice(0, MAX_PREVIEW) + "\u2026" : oneline;
9
+ function logClose(_streamId, _totalChunks, _reason) {
19
10
  }
20
- function write(line) {
21
- if (process.env.NODE_ENV !== "development") return;
22
- fs.appendFile(LOG_FILE, line + "\n", () => {
23
- });
24
- }
25
- function logCreate(streamId) {
26
- write(`[${ts()}] [CREATE ] sid=${short(streamId)}`);
27
- }
28
- function logEnqueue(streamId, eventId, sseContent) {
29
- write(`[${ts()}] [ENQUEUE ] sid=${short(streamId)} id=${String(eventId).padStart(4)} ${preview(sseContent)}`);
30
- }
31
- function logClose(streamId, totalChunks, reason) {
32
- write(`[${ts()}] [CLOSE ] sid=${short(streamId)} total=${totalChunks} reason=${reason}`);
33
- }
34
- function logResumeStart(streamId, fromEventId) {
35
- write(`[${ts()}] [RESUME ] sid=${short(streamId)} fromId=${fromEventId}`);
11
+ function logResumeStart(_streamId, _fromEventId) {
36
12
  }
37
- function logResumeBuffered(streamId, count) {
38
- write(`[${ts()}] [BUFFERED ] sid=${short(streamId)} replaying=${count} buffered chunks`);
13
+ function logResumeBuffered(_streamId, _count) {
39
14
  }
40
- function logResumePoll(streamId, nextIndex, newCount) {
41
- write(`[${ts()}] [POLL ] sid=${short(streamId)} nextIdx=${nextIndex} newChunks=${newCount}`);
15
+ function logResumePoll(_streamId, _nextIndex, _newCount) {
42
16
  }
43
- function logResumeDone(streamId, totalSent) {
44
- write(`[${ts()}] [RES_DONE ] sid=${short(streamId)} totalSent=${totalSent}`);
17
+ function logResumeDone(_streamId, _totalSent) {
45
18
  }
46
- function logResumeError(streamId, err) {
47
- write(`[${ts()}] [RES_ERR ] sid=${short(streamId)} ${String(err)}`);
19
+ function logResumeError(_streamId, _err) {
48
20
  }
49
21
  function logSeparator() {
50
- write("\u2500".repeat(100));
51
22
  }
52
23
 
53
24
  // lib/resilient-sse/server/createPersistentStream.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "persistent-request-response",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Resilient SSE streaming with automatic reconnection and Redis-backed replay",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",