@prenta/core 8.21.3 → 8.21.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @actuate-media/cms-core
2
2
 
3
+ ## 8.21.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 490e3b9: Close the notification and preview event streams before Vercel's 30-second function limit. On Vercel the streams stayed open for four minutes, so the platform killed each one mid-response and logged "Task timed out after 30 seconds" about every 33 seconds per open admin tab. They now close cleanly after 20 seconds on Vercel and the browser reconnects; other hosts keep the four-minute lifetime. The preview stream also now drops its heartbeat timer and update subscription when it closes itself, which it previously left running.
8
+
3
9
  ## 8.21.3
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,69 @@
1
+ export declare const LICENCE_KEY_PREFIX = "prenta_lic_";
2
+ /**
3
+ * Public keys this release trusts, as base64url-encoded SPKI DER. More than
4
+ * one entry lets a signing key be rotated: keys signed with the old one keep
5
+ * verifying while new keys are signed with the new one.
6
+ *
7
+ * The matching private keys must never be committed, put in CI, or shipped
8
+ * to a site.
9
+ */
10
+ export declare const TRUSTED_LICENCE_PUBLIC_KEYS: readonly string[];
11
+ type LicenceKind = 'site' | 'supporter';
12
+ export interface Licence {
13
+ /** Payload version. Only `1` exists. */
14
+ v: 1;
15
+ /** Licence id, for support and (later) the account page. */
16
+ id: string;
17
+ kind: LicenceKind;
18
+ /** The one production hostname, lowercase, without `www.`. */
19
+ domain: string;
20
+ /** Staging hostnames covered at no charge. */
21
+ stagingDomains: string[];
22
+ /** `YYYY-MM-DD`. */
23
+ issuedAt: string;
24
+ /** `YYYY-MM-DD`, or `null` when updates never lapse (supporter keys). */
25
+ updatesUntil: string | null;
26
+ }
27
+ type LicenceKeyFailure =
28
+ /** Not a licence key at all: wrong prefix, shape, encoding or fields. */
29
+ 'malformed'
30
+ /** Well formed, from a payload version this release does not know. */
31
+ | 'unsupported_version'
32
+ /** Well formed, but not signed by a key this release trusts. */
33
+ | 'bad_signature';
34
+ export type LicenceKeyResult = {
35
+ ok: true;
36
+ licence: Licence;
37
+ } | {
38
+ ok: false;
39
+ reason: LicenceKeyFailure;
40
+ };
41
+ /**
42
+ * Reduce a hostname or URL to the form a licence stores: lowercase, no
43
+ * scheme, port, path or trailing dot, and no leading `www.`. Returns `null`
44
+ * for anything that is not a plain DNS hostname (an IP literal, a wildcard,
45
+ * an empty string).
46
+ */
47
+ export declare function normaliseLicenceHostname(input: string): string | null;
48
+ /**
49
+ * Read a licence key and check its signature.
50
+ *
51
+ * This answers one question: is this a key Prenta issued, and what does it
52
+ * say? Whether it covers the site it is installed on, or the release that is
53
+ * running, is decided elsewhere.
54
+ *
55
+ * `publicKeys` exists for tests and for signing tools that verify their own
56
+ * output; production callers use the default.
57
+ */
58
+ export declare function verifyLicenceKey(key: string, publicKeys?: readonly string[]): LicenceKeyResult;
59
+ /**
60
+ * Issue a licence key. Used by the signing script and by tests; a site never
61
+ * calls it, and it is useless without the private key.
62
+ *
63
+ * `privateKey` is the PKCS#8 DER private key, base64url-encoded. Throws when
64
+ * the licence is not one `verifyLicenceKey` would accept, so a key that could
65
+ * never verify is never handed out.
66
+ */
67
+ export declare function signLicenceKey(licence: Licence, privateKey: string): string;
68
+ export {};
69
+ //# sourceMappingURL=key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key.d.ts","sourceRoot":"","sources":["../../src/licence/key.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,kBAAkB,gBAAgB,CAAA;AAK/C;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EAGxD,CAAA;AAED,KAAK,WAAW,GAAG,MAAM,GAAG,WAAW,CAAA;AAEvC,MAAM,WAAW,OAAO;IACtB,wCAAwC;IACxC,CAAC,EAAE,CAAC,CAAA;IACJ,4DAA4D;IAC5D,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,WAAW,CAAA;IACjB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAA;IACd,8CAA8C;IAC9C,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,yEAAyE;IACzE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,KAAK,iBAAiB;AACpB,yEAAyE;AACvE,WAAW;AACb,sEAAsE;GACpE,qBAAqB;AACvB,gEAAgE;GAC9D,eAAe,CAAA;AAEnB,MAAM,MAAM,gBAAgB,GACxB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAC9B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,CAAA;AAM5C;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyBrE;AAuFD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,UAAU,GAAE,SAAS,MAAM,EAAgC,GAC1D,gBAAgB,CAmBlB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAsB3E"}
@@ -0,0 +1,225 @@
1
+ /**
2
+ * Per-site licence keys: the format, and nothing that acts on it yet.
3
+ *
4
+ * A key is a payload and an Ed25519 signature over it:
5
+ *
6
+ * prenta_lic_<base64url(payload JSON)>.<base64url(signature)>
7
+ *
8
+ * The signature covers the encoded payload exactly as it appears in the key,
9
+ * so verification never depends on how JSON is re-serialised. A site checks
10
+ * its key locally against the public keys shipped in this package; it never
11
+ * contacts Prenta to do so. See docs/adr/0013-per-site-licence-keys.md.
12
+ *
13
+ * No caller uses this module yet. A key verifies only when it was signed by
14
+ * the private half of an entry in `TRUSTED_LICENCE_PUBLIC_KEYS`.
15
+ */
16
+ import { createPrivateKey, createPublicKey, sign, verify } from 'node:crypto';
17
+ export const LICENCE_KEY_PREFIX = 'prenta_lic_';
18
+ /** The most staging hostnames one key may carry. */
19
+ const MAX_STAGING_DOMAINS = 3;
20
+ /**
21
+ * Public keys this release trusts, as base64url-encoded SPKI DER. More than
22
+ * one entry lets a signing key be rotated: keys signed with the old one keep
23
+ * verifying while new keys are signed with the new one.
24
+ *
25
+ * The matching private keys must never be committed, put in CI, or shipped
26
+ * to a site.
27
+ */
28
+ export const TRUSTED_LICENCE_PUBLIC_KEYS = [
29
+ // Production signing key, generated 2026-11-25.
30
+ 'MCowBQYDK2VwAyEAovJkzRLqsE7Lkt7t-YHypTWWETqarQj9AEGqDOTHuw4',
31
+ ];
32
+ const HOSTNAME_LABEL = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
33
+ const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
34
+ const BASE64URL = /^[A-Za-z0-9_-]+$/;
35
+ /**
36
+ * Reduce a hostname or URL to the form a licence stores: lowercase, no
37
+ * scheme, port, path or trailing dot, and no leading `www.`. Returns `null`
38
+ * for anything that is not a plain DNS hostname (an IP literal, a wildcard,
39
+ * an empty string).
40
+ */
41
+ export function normaliseLicenceHostname(input) {
42
+ let host = input.trim().toLowerCase();
43
+ if (!host)
44
+ return null;
45
+ if (host.includes('://')) {
46
+ try {
47
+ host = new URL(host).hostname;
48
+ }
49
+ catch {
50
+ return null;
51
+ }
52
+ }
53
+ else {
54
+ const authority = host.split('/')[0];
55
+ const parts = authority.split(':');
56
+ // At most `host:port`. More colons mean a bare IPv6 literal (`fe80::1`),
57
+ // which must be rejected, not cut down to a first label that looks valid.
58
+ if (parts.length > 2 || (parts.length === 2 && !/^\d+$/.test(parts[1])))
59
+ return null;
60
+ host = parts[0];
61
+ }
62
+ if (host.endsWith('.'))
63
+ host = host.slice(0, -1);
64
+ if (host.startsWith('www.'))
65
+ host = host.slice(4);
66
+ if (!host || host.length > 253)
67
+ return null;
68
+ const labels = host.split('.');
69
+ if (!labels.every((label) => HOSTNAME_LABEL.test(label)))
70
+ return null;
71
+ // All-numeric last label means an IPv4 literal, which is never a licensed site.
72
+ if (/^\d+$/.test(labels[labels.length - 1]))
73
+ return null;
74
+ return host;
75
+ }
76
+ function isIsoDate(value) {
77
+ if (typeof value !== 'string' || !ISO_DATE.test(value))
78
+ return false;
79
+ const parsed = new Date(`${value}T00:00:00Z`);
80
+ return !Number.isNaN(parsed.getTime()) && parsed.toISOString().slice(0, 10) === value;
81
+ }
82
+ /** A stored hostname must already be in normal form, so two spellings of one key cannot exist. */
83
+ function isNormalHostname(value) {
84
+ return typeof value === 'string' && normaliseLicenceHostname(value) === value;
85
+ }
86
+ /**
87
+ * Check a decoded payload field by field. Unknown extra fields are dropped,
88
+ * not rejected, so a later release can add one without breaking this one.
89
+ */
90
+ function validatePayload(raw) {
91
+ if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
92
+ return { ok: false, reason: 'malformed' };
93
+ }
94
+ const p = raw;
95
+ if (typeof p.v !== 'number')
96
+ return { ok: false, reason: 'malformed' };
97
+ if (p.v !== 1)
98
+ return { ok: false, reason: 'unsupported_version' };
99
+ const staging = p.stagingDomains ?? [];
100
+ const valid = typeof p.id === 'string' &&
101
+ p.id.length > 0 &&
102
+ p.id.length <= 64 &&
103
+ (p.kind === 'site' || p.kind === 'supporter') &&
104
+ isNormalHostname(p.domain) &&
105
+ Array.isArray(staging) &&
106
+ staging.length <= MAX_STAGING_DOMAINS &&
107
+ staging.every(isNormalHostname) &&
108
+ new Set(staging).size === staging.length &&
109
+ !staging.includes(p.domain) &&
110
+ isIsoDate(p.issuedAt) &&
111
+ // A supporter key never lapses; a site key always has a date.
112
+ (p.kind === 'supporter' ? p.updatesUntil === null : isIsoDate(p.updatesUntil));
113
+ if (!valid)
114
+ return { ok: false, reason: 'malformed' };
115
+ return {
116
+ ok: true,
117
+ licence: {
118
+ v: 1,
119
+ id: p.id,
120
+ kind: p.kind,
121
+ domain: p.domain,
122
+ stagingDomains: [...staging],
123
+ issuedAt: p.issuedAt,
124
+ updatesUntil: p.updatesUntil,
125
+ },
126
+ };
127
+ }
128
+ function splitKey(key) {
129
+ const trimmed = key.trim();
130
+ if (!trimmed.startsWith(LICENCE_KEY_PREFIX))
131
+ return null;
132
+ const parts = trimmed.slice(LICENCE_KEY_PREFIX.length).split('.');
133
+ if (parts.length !== 2)
134
+ return null;
135
+ const [payload, signature] = parts;
136
+ if (!BASE64URL.test(payload) || !BASE64URL.test(signature))
137
+ return null;
138
+ return { payload, signature };
139
+ }
140
+ function decodePayload(encoded) {
141
+ try {
142
+ return JSON.parse(Buffer.from(encoded, 'base64url').toString('utf8'));
143
+ }
144
+ catch {
145
+ return undefined;
146
+ }
147
+ }
148
+ function toPublicKey(spkiBase64Url) {
149
+ try {
150
+ const key = createPublicKey({
151
+ key: Buffer.from(spkiBase64Url, 'base64url'),
152
+ format: 'der',
153
+ type: 'spki',
154
+ });
155
+ return key.asymmetricKeyType === 'ed25519' ? key : null;
156
+ }
157
+ catch {
158
+ return null;
159
+ }
160
+ }
161
+ /**
162
+ * Read a licence key and check its signature.
163
+ *
164
+ * This answers one question: is this a key Prenta issued, and what does it
165
+ * say? Whether it covers the site it is installed on, or the release that is
166
+ * running, is decided elsewhere.
167
+ *
168
+ * `publicKeys` exists for tests and for signing tools that verify their own
169
+ * output; production callers use the default.
170
+ */
171
+ export function verifyLicenceKey(key, publicKeys = TRUSTED_LICENCE_PUBLIC_KEYS) {
172
+ const parts = splitKey(key);
173
+ if (!parts)
174
+ return { ok: false, reason: 'malformed' };
175
+ const result = validatePayload(decodePayload(parts.payload));
176
+ if (!result.ok)
177
+ return result;
178
+ const signature = Buffer.from(parts.signature, 'base64url');
179
+ const signed = Buffer.from(parts.payload, 'utf8');
180
+ const trusted = publicKeys.some((encoded) => {
181
+ const publicKey = toPublicKey(encoded);
182
+ if (!publicKey)
183
+ return false;
184
+ try {
185
+ return verify(null, signed, publicKey, signature);
186
+ }
187
+ catch {
188
+ return false;
189
+ }
190
+ });
191
+ return trusted ? result : { ok: false, reason: 'bad_signature' };
192
+ }
193
+ /**
194
+ * Issue a licence key. Used by the signing script and by tests; a site never
195
+ * calls it, and it is useless without the private key.
196
+ *
197
+ * `privateKey` is the PKCS#8 DER private key, base64url-encoded. Throws when
198
+ * the licence is not one `verifyLicenceKey` would accept, so a key that could
199
+ * never verify is never handed out.
200
+ */
201
+ export function signLicenceKey(licence, privateKey) {
202
+ const checked = validatePayload(licence);
203
+ if (!checked.ok) {
204
+ throw new Error(`Refusing to sign an invalid licence (${checked.reason}).`);
205
+ }
206
+ let key;
207
+ try {
208
+ key = createPrivateKey({
209
+ key: Buffer.from(privateKey, 'base64url'),
210
+ format: 'der',
211
+ type: 'pkcs8',
212
+ });
213
+ }
214
+ catch {
215
+ // Never echo the input: it is a private key.
216
+ throw new Error('The signing key is not a base64url PKCS#8 private key.');
217
+ }
218
+ if (key.asymmetricKeyType !== 'ed25519') {
219
+ throw new Error('The signing key is not an Ed25519 key.');
220
+ }
221
+ const payload = Buffer.from(JSON.stringify(checked.licence), 'utf8').toString('base64url');
222
+ const signature = sign(null, Buffer.from(payload, 'utf8'), key).toString('base64url');
223
+ return `${LICENCE_KEY_PREFIX}${payload}.${signature}`;
224
+ }
225
+ //# sourceMappingURL=key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"key.js","sourceRoot":"","sources":["../../src/licence/key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAkB,MAAM,aAAa,CAAA;AAE7F,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAA;AAE/C,oDAAoD;AACpD,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAE7B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC5D,gDAAgD;IAChD,6DAA6D;CAC9D,CAAA;AAgCD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atMs?: number;
7
- /** Override for tests so we don't tie up the suite for 4 minutes. */
7
+ /** Stream lifetime in ms. Defaults to `resolveSseMaxLifetimeMs()`. */
8
8
  maxLifetimeMs?: number;
9
9
  }
10
10
  /**
@@ -18,7 +18,7 @@ export interface PreviewStreamOptions {
18
18
  * the client as `event: update` with `payload` as JSON data.
19
19
  * 3. Sends `: heartbeat\n\n` keepalive comments on
20
20
  * `PREVIEW_SSE_HEARTBEAT_MS` intervals.
21
- * 4. Cleanly closes after `PREVIEW_SSE_MAX_LIFETIME_MS` and lets the
21
+ * 4. Cleanly closes after `resolveSseMaxLifetimeMs()` and lets the
22
22
  * browser reconnect, sidestepping platform idle/max-duration caps.
23
23
  *
24
24
  * The returned stream MUST be wrapped in a `Response` with the SSE
@@ -1 +1 @@
1
- {"version":3,"file":"sse-stream.d.ts","sourceRoot":"","sources":["../../src/preview/sse-stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,OAAO,EAAE,cAAc,EAAE,CAAA;AA8BzB,MAAM,WAAW,oBAAoB;IACnC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,YAAY,CAAC,EAC1D,IAAI,GAAE,oBAAyB,GAC9B,cAAc,CAAC,UAAU,CAAC,CAwD5B;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAOtD,CAAA;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,YAAY,CAAC,EAC1D,IAAI,CAAC,EAAE,oBAAoB,GAC1B,QAAQ,CAKV"}
1
+ {"version":3,"file":"sse-stream.d.ts","sourceRoot":"","sources":["../../src/preview/sse-stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,cAAc,EAA2B,MAAM,oBAAoB,CAAA;AAE5E,OAAO,EAAE,cAAc,EAAE,CAAA;AAsBzB,MAAM,WAAW,oBAAoB;IACnC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,YAAY,CAAC,EAC1D,IAAI,GAAE,oBAAyB,GAC9B,cAAc,CAAC,UAAU,CAAC,CAoE5B;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAOtD,CAAA;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,YAAY,CAAC,EAC1D,IAAI,CAAC,EAAE,oBAAoB,GAC1B,QAAQ,CAKV"}
@@ -1,5 +1,5 @@
1
1
  import { subscribePreviewUpdates } from './event-bus.js';
2
- import { encodeSseEvent } from '../realtime/sse.js';
2
+ import { encodeSseEvent, resolveSseMaxLifetimeMs } from '../realtime/sse.js';
3
3
  export { encodeSseEvent };
4
4
  /**
5
5
  * SSE wire format helpers. We keep them small and pure so the route handler
@@ -18,13 +18,6 @@ const encoder = new TextEncoder();
18
18
  * Vercel Serverless 30 s, most reverse-proxies 60 s).
19
19
  */
20
20
  const PREVIEW_SSE_HEARTBEAT_MS = 25_000;
21
- /**
22
- * Maximum stream lifetime in ms. After this, the server closes the stream
23
- * cleanly so EventSource will reconnect — important because some platforms
24
- * (Vercel Fluid Compute, Cloudflare Workers) cap any single response at a
25
- * few minutes regardless of activity.
26
- */
27
- const PREVIEW_SSE_MAX_LIFETIME_MS = 4 * 60 * 1000;
28
21
  /**
29
22
  * Build a `ReadableStream` of Server-Sent Events for the given preview
30
23
  * session. The stream:
@@ -36,7 +29,7 @@ const PREVIEW_SSE_MAX_LIFETIME_MS = 4 * 60 * 1000;
36
29
  * the client as `event: update` with `payload` as JSON data.
37
30
  * 3. Sends `: heartbeat\n\n` keepalive comments on
38
31
  * `PREVIEW_SSE_HEARTBEAT_MS` intervals.
39
- * 4. Cleanly closes after `PREVIEW_SSE_MAX_LIFETIME_MS` and lets the
32
+ * 4. Cleanly closes after `resolveSseMaxLifetimeMs()` and lets the
40
33
  * browser reconnect, sidestepping platform idle/max-duration caps.
41
34
  *
42
35
  * The returned stream MUST be wrapped in a `Response` with the SSE
@@ -44,10 +37,26 @@ const PREVIEW_SSE_MAX_LIFETIME_MS = 4 * 60 * 1000;
44
37
  */
45
38
  export function createPreviewStream(session, opts = {}) {
46
39
  const heartbeatMs = opts.heartbeatMs ?? PREVIEW_SSE_HEARTBEAT_MS;
47
- const maxLifetimeMs = opts.maxLifetimeMs ?? PREVIEW_SSE_MAX_LIFETIME_MS;
40
+ const maxLifetimeMs = resolveSseMaxLifetimeMs(opts.maxLifetimeMs);
48
41
  let heartbeat;
49
42
  let lifetime;
50
43
  let unsubscribe;
44
+ let torn = false;
45
+ // One teardown for both ways the stream ends. `cancel()` only runs
46
+ // when the client disconnects, not when the lifetime timer closes
47
+ // the controller, so without this the heartbeat interval and the bus
48
+ // subscription outlive every server-initiated close.
49
+ const teardown = () => {
50
+ if (torn)
51
+ return;
52
+ torn = true;
53
+ if (heartbeat)
54
+ clearInterval(heartbeat);
55
+ if (lifetime)
56
+ clearTimeout(lifetime);
57
+ if (unsubscribe)
58
+ unsubscribe();
59
+ };
51
60
  return new ReadableStream({
52
61
  start(controller) {
53
62
  const enqueue = (chunk) => {
@@ -72,6 +81,7 @@ export function createPreviewStream(session, opts = {}) {
72
81
  enqueue(`: heartbeat\n\n`);
73
82
  }, heartbeatMs);
74
83
  lifetime = setTimeout(() => {
84
+ teardown();
75
85
  try {
76
86
  controller.close();
77
87
  }
@@ -81,12 +91,7 @@ export function createPreviewStream(session, opts = {}) {
81
91
  }, maxLifetimeMs);
82
92
  },
83
93
  cancel() {
84
- if (heartbeat)
85
- clearInterval(heartbeat);
86
- if (lifetime)
87
- clearTimeout(lifetime);
88
- if (unsubscribe)
89
- unsubscribe();
94
+ teardown();
90
95
  },
91
96
  });
92
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sse-stream.js","sourceRoot":"","sources":["../../src/preview/sse-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,OAAO,EAAE,cAAc,EAAE,CAAA;AAEzB;;;;;;;;;GASG;AAEH,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAEjC;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,MAAM,CAAA;AAEvC;;;;;GAKG;AACH,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AASjD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAA0D,EAC1D,OAA6B,EAAE;IAE/B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,wBAAwB,CAAA;IAChE,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,2BAA2B,CAAA;IAEvE,IAAI,SAAqD,CAAA;IACzD,IAAI,QAAmD,CAAA;IACvD,IAAI,WAAqC,CAAA;IAEzC,OAAO,IAAI,cAAc,CAAa;QACpC,KAAK,CAAC,UAAU;YACd,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE;gBAChC,IAAI,CAAC;oBACH,UAAU,CAAC,OAAO,CAAC,OAAO,CA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YACJ,QAAQ,EAAE,CAAA;QACZ,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA2B;IACzD,cAAc,EAAE,kCAAkC;IAClD,eAAe,EAAE,wBAAwB;IACzC,UAAU,EAAE,YAAY;IACxB,wEAAwE;IACxE,iDAAiD;IACjD,mBAAmB,EAAE,IAAI;CAC1B,CAAA;AAED,MAAM,UAAU,2BAA2B,CACzC,OAA0D,EAC1D,IAA2B;IAE3B,OAAO,IAAI,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;QACtD,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,mBAAmB;KAC7B,CAAC,CAAA;AACJ,CAAC"}
@@ -9,16 +9,16 @@ export { encodeSseEvent };
9
9
  */
10
10
  export declare const NOTIFICATION_SSE_HEARTBEAT_MS = 25000;
11
11
  /**
12
- * Maximum stream lifetime in ms. After this, the server closes the
13
- * stream cleanly so `EventSource` reconnects — important because some
14
- * platforms (Vercel Fluid Compute, Cloudflare Workers) cap any single
15
- * response at a few minutes regardless of activity.
12
+ * Maximum stream lifetime in ms on a long-running server. After this,
13
+ * the server closes the stream cleanly so `EventSource` reconnects.
14
+ * On Vercel the default is shorter, so the stream closes before the
15
+ * function's `maxDuration` cap: see `resolveSseMaxLifetimeMs`.
16
16
  */
17
17
  export declare const NOTIFICATION_SSE_MAX_LIFETIME_MS: number;
18
18
  export interface NotificationStreamOptions {
19
19
  /** Override for tests so we don't have to wait 25 seconds. */
20
20
  heartbeatMs?: number;
21
- /** Override for tests so we don't tie up the suite for 4 minutes. */
21
+ /** Stream lifetime in ms. Defaults to `resolveSseMaxLifetimeMs()`. */
22
22
  maxLifetimeMs?: number;
23
23
  }
24
24
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"notification-stream.d.ts","sourceRoot":"","sources":["../../src/realtime/notification-stream.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,CAAA;AAIzB;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,QAAgB,CAAA;AAE7D,MAAM,WAAW,yBAAyB;IACxC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,yBAA8B,GACnC,cAAc,CAAC,UAAU,CAAC,CAmE5B;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO3D,CAAA;AAED,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,yBAAyB,GAC/B,QAAQ,CAKV"}
1
+ {"version":3,"file":"notification-stream.d.ts","sourceRoot":"","sources":["../../src/realtime/notification-stream.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,cAAc,EAAwD,MAAM,UAAU,CAAA;AAE/F,OAAO,EAAE,cAAc,EAAE,CAAA;AAIzB;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAA;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,QAA8B,CAAA;AAE3E,MAAM,WAAW,yBAAyB;IACxC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,yBAA8B,GACnC,cAAc,CAAC,UAAU,CAAC,CAmE5B;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO3D,CAAA;AAED,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,yBAAyB,GAC/B,QAAQ,CAKV"}
@@ -24,7 +24,7 @@
24
24
  * has fired but the bus subscription hasn't been attached yet.
25
25
  */
26
26
  import { subscribeUserNotifications } from './notification-bus.js';
27
- import { encodeSseEvent } from './sse.js';
27
+ import { encodeSseEvent, resolveSseMaxLifetimeMs, SSE_DEFAULT_MAX_LIFETIME_MS } from './sse.js';
28
28
  export { encodeSseEvent };
29
29
  const encoder = new TextEncoder();
30
30
  /**
@@ -36,12 +36,12 @@ const encoder = new TextEncoder();
36
36
  */
37
37
  export const NOTIFICATION_SSE_HEARTBEAT_MS = 25_000;
38
38
  /**
39
- * Maximum stream lifetime in ms. After this, the server closes the
40
- * stream cleanly so `EventSource` reconnects — important because some
41
- * platforms (Vercel Fluid Compute, Cloudflare Workers) cap any single
42
- * response at a few minutes regardless of activity.
39
+ * Maximum stream lifetime in ms on a long-running server. After this,
40
+ * the server closes the stream cleanly so `EventSource` reconnects.
41
+ * On Vercel the default is shorter, so the stream closes before the
42
+ * function's `maxDuration` cap: see `resolveSseMaxLifetimeMs`.
43
43
  */
44
- export const NOTIFICATION_SSE_MAX_LIFETIME_MS = 4 * 60 * 1000;
44
+ export const NOTIFICATION_SSE_MAX_LIFETIME_MS = SSE_DEFAULT_MAX_LIFETIME_MS;
45
45
  /**
46
46
  * Build a `ReadableStream<Uint8Array>` of notification SSE events for
47
47
  * the given userId. See the file header for the wire format.
@@ -65,7 +65,7 @@ export function createNotificationStream(userId, opts = {}) {
65
65
  throw new Error('createNotificationStream requires a non-empty userId');
66
66
  }
67
67
  const heartbeatMs = opts.heartbeatMs ?? NOTIFICATION_SSE_HEARTBEAT_MS;
68
- const maxLifetimeMs = opts.maxLifetimeMs ?? NOTIFICATION_SSE_MAX_LIFETIME_MS;
68
+ const maxLifetimeMs = resolveSseMaxLifetimeMs(opts.maxLifetimeMs);
69
69
  let heartbeat;
70
70
  let lifetime;
71
71
  let unsubscribe;
@@ -1 +1 @@
1
- {"version":3,"file":"notification-stream.js","sourceRoot":"","sources":["../../src/realtime/notification-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,CAAA;AAEzB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAEjC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AAS7D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAc,EACd,OAAkC,EAAE;IAEpC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IACD,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,6BAA6B,CAAA;IACrE,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI,gCAAgC,CAAA;IAE5E,IAAI,SAAqD,CAAA;IACzD,IAAI,QAAmD,CAAA;IACvD,IAAI,WAAqC,CAAA;IACzC,IAAI,IAAI,GAAG,KAAK,CAAA;IAEhB,kCAAkC;IAClC,4DAA4D;IAC5D,8CAA8C;IAC9C,0DAA0D;IAC1D,gEAAgE;IAChE,+DAA+D;IAC/D,8DAA8D;IAC9D,eAAe;IACf,MAAM,QAAQ,GAAG,GAAG,EAAE;QACpB,IAAI,IAAI;YAAE,OAAM;QAChB,IAAI,GAAG,IAAI,CAAA;QACX,IAAI,SAAS;YAAE,aAAa,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AAE,CAAA;gBACpB,CAAC;gBAAC,MAAM,CAAC;oBACP,oBAAoB;gBACtB,CAAC;YACH,CAAC,EAAE,aAAa,CAAC,CAAA;QACnB,CAAC;QAED,MAAM;YACJ,QAAQ,EAAE,CAAA;QACZ,CAAC;KACF,CAAC,CAAA;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAA2B;IAC9D,cAAc,EAAE,kCAAkC;IAClD,eAAe,EAAE,wBAAwB;IACzC,UAAU,EAAE,YAAY;IACxB,mEAAmE;IACnE,sDAAsD;IACtD,mBAAmB,EAAE,IAAI;CAC1B,CAAA;AAED,MAAM,UAAU,gCAAgC,CAC9C,MAAc,EACd,IAAgC;IAEhC,OAAO,IAAI,QAAQ,CAAC,wBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;QAC1D,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,wBAAwB;KAClC,CAAC,CAAA;AACJ,CAAC"}
@@ -17,4 +17,25 @@
17
17
  * it. Browsers will hold the event in their buffer until they see it.
18
18
  */
19
19
  export declare function encodeSseEvent(data: unknown, event?: string): string;
20
+ /**
21
+ * Stream lifetime on a long-running server: close after four minutes so
22
+ * the browser's `EventSource` reconnects before a proxy or platform cap
23
+ * cuts the response.
24
+ */
25
+ export declare const SSE_DEFAULT_MAX_LIFETIME_MS: number;
26
+ /**
27
+ * Stream lifetime on Vercel. The scaffolded `vercel.json` caps the CMS
28
+ * API function at `maxDuration: 30`, and that budget also covers cold
29
+ * start and the auth check that run before the stream opens. A stream
30
+ * that outlives the cap is killed mid-response and logged as "Task
31
+ * timed out after 30 seconds", once per open admin tab every ~33 s.
32
+ * Twenty seconds leaves room for the work before the stream starts.
33
+ */
34
+ export declare const SSE_SERVERLESS_MAX_LIFETIME_MS = 20000;
35
+ /**
36
+ * Pick how long an SSE stream stays open before the server closes it
37
+ * cleanly. An explicit value wins; otherwise the default depends on
38
+ * whether the process runs on Vercel (which sets `VERCEL`).
39
+ */
40
+ export declare function resolveSseMaxLifetimeMs(explicit?: number, env?: Record<string, string | undefined>): number;
20
41
  //# sourceMappingURL=sse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../src/realtime/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAUpE"}
1
+ {"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../src/realtime/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAUpE;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,QAAgB,CAAA;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,QAAS,CAAA;AAEpD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,CAAC,EAAE,MAAM,EACjB,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,MAAM,CAGR"}
@@ -28,4 +28,29 @@ export function encodeSseEvent(data, event) {
28
28
  lines.push('');
29
29
  return lines.join('\n');
30
30
  }
31
+ /**
32
+ * Stream lifetime on a long-running server: close after four minutes so
33
+ * the browser's `EventSource` reconnects before a proxy or platform cap
34
+ * cuts the response.
35
+ */
36
+ export const SSE_DEFAULT_MAX_LIFETIME_MS = 4 * 60 * 1000;
37
+ /**
38
+ * Stream lifetime on Vercel. The scaffolded `vercel.json` caps the CMS
39
+ * API function at `maxDuration: 30`, and that budget also covers cold
40
+ * start and the auth check that run before the stream opens. A stream
41
+ * that outlives the cap is killed mid-response and logged as "Task
42
+ * timed out after 30 seconds", once per open admin tab every ~33 s.
43
+ * Twenty seconds leaves room for the work before the stream starts.
44
+ */
45
+ export const SSE_SERVERLESS_MAX_LIFETIME_MS = 20_000;
46
+ /**
47
+ * Pick how long an SSE stream stays open before the server closes it
48
+ * cleanly. An explicit value wins; otherwise the default depends on
49
+ * whether the process runs on Vercel (which sets `VERCEL`).
50
+ */
51
+ export function resolveSseMaxLifetimeMs(explicit, env = process.env) {
52
+ if (explicit !== undefined)
53
+ return explicit;
54
+ return env.VERCEL ? SSE_SERVERLESS_MAX_LIFETIME_MS : SSE_DEFAULT_MAX_LIFETIME_MS;
55
+ }
31
56
  //# sourceMappingURL=sse.js.map
@@ -1 +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"}
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;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AAExD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAA;AAEpD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,QAAiB,EACjB,MAA0C,OAAO,CAAC,GAAG;IAErD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAA;IAC3C,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,2BAA2B,CAAA;AAClF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prenta/core",
3
- "version": "8.21.3",
3
+ "version": "8.21.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Actuate Media
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.