@actuate-media/cms-core 0.23.0 → 0.25.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.
Files changed (44) hide show
  1. package/dist/__tests__/api/notifications-routes.test.js +45 -0
  2. package/dist/__tests__/api/notifications-routes.test.js.map +1 -1
  3. package/dist/__tests__/api/users-search.test.d.ts +2 -0
  4. package/dist/__tests__/api/users-search.test.d.ts.map +1 -0
  5. package/dist/__tests__/api/users-search.test.js +182 -0
  6. package/dist/__tests__/api/users-search.test.js.map +1 -0
  7. package/dist/__tests__/realtime/notification-bus.test.d.ts +2 -0
  8. package/dist/__tests__/realtime/notification-bus.test.d.ts.map +1 -0
  9. package/dist/__tests__/realtime/notification-bus.test.js +79 -0
  10. package/dist/__tests__/realtime/notification-bus.test.js.map +1 -0
  11. package/dist/__tests__/realtime/notification-stream.test.d.ts +2 -0
  12. package/dist/__tests__/realtime/notification-stream.test.d.ts.map +1 -0
  13. package/dist/__tests__/realtime/notification-stream.test.js +157 -0
  14. package/dist/__tests__/realtime/notification-stream.test.js.map +1 -0
  15. package/dist/__tests__/realtime/notifications.test.js +14 -1
  16. package/dist/__tests__/realtime/notifications.test.js.map +1 -1
  17. package/dist/api/handlers.d.ts.map +1 -1
  18. package/dist/api/handlers.js +97 -3
  19. package/dist/api/handlers.js.map +1 -1
  20. package/dist/preview/sse-stream.d.ts +2 -5
  21. package/dist/preview/sse-stream.d.ts.map +1 -1
  22. package/dist/preview/sse-stream.js +7 -16
  23. package/dist/preview/sse-stream.js.map +1 -1
  24. package/dist/realtime/index.d.ts +3 -0
  25. package/dist/realtime/index.d.ts.map +1 -1
  26. package/dist/realtime/index.js +9 -0
  27. package/dist/realtime/index.js.map +1 -1
  28. package/dist/realtime/notification-bus.d.ts +60 -0
  29. package/dist/realtime/notification-bus.d.ts.map +1 -0
  30. package/dist/realtime/notification-bus.js +77 -0
  31. package/dist/realtime/notification-bus.js.map +1 -0
  32. package/dist/realtime/notification-stream.d.ts +50 -0
  33. package/dist/realtime/notification-stream.d.ts.map +1 -0
  34. package/dist/realtime/notification-stream.js +148 -0
  35. package/dist/realtime/notification-stream.js.map +1 -0
  36. package/dist/realtime/notifications.d.ts +0 -8
  37. package/dist/realtime/notifications.d.ts.map +1 -1
  38. package/dist/realtime/notifications.js +28 -4
  39. package/dist/realtime/notifications.js.map +1 -1
  40. package/dist/realtime/sse.d.ts +20 -0
  41. package/dist/realtime/sse.d.ts.map +1 -0
  42. package/dist/realtime/sse.js +31 -0
  43. package/dist/realtime/sse.js.map +1 -0
  44. package/package.json +1 -1
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Minimal SSE wire-format helpers shared by every Server-Sent Events
3
+ * stream in `cms-core` (preview updates and per-user notifications,
4
+ * today). Kept dependency-free so any future stream can `import` it
5
+ * without dragging in module state from sibling channels.
6
+ *
7
+ * A single source of truth here means a bug in the encoder is fixed
8
+ * once, not in N parallel copies.
9
+ */
10
+ /**
11
+ * Encode a single SSE message. `event` is optional; when omitted the
12
+ * default `message` event name is used (per the SSE spec). Multi-line
13
+ * payloads are split across multiple `data:` lines so the receiving
14
+ * `EventSource` reassembles them.
15
+ *
16
+ * The trailing blank line is the SSE event delimiter — DO NOT drop
17
+ * it. Browsers will hold the event in their buffer until they see it.
18
+ */
19
+ export function encodeSseEvent(data, event) {
20
+ const lines = [];
21
+ if (event)
22
+ lines.push(`event: ${event}`);
23
+ const serialized = typeof data === 'string' ? data : JSON.stringify(data);
24
+ for (const line of serialized.split('\n')) {
25
+ lines.push(`data: ${line}`);
26
+ }
27
+ lines.push('');
28
+ lines.push('');
29
+ return lines.join('\n');
30
+ }
31
+ //# sourceMappingURL=sse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse.js","sourceRoot":"","sources":["../../src/realtime/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,IAAa,EAAE,KAAc;IAC1D,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC,CAAA;IACxC,MAAM,UAAU,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACzE,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAA;IAC7B,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actuate-media/cms-core",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/actuate-media/actuatecms.git",