@dasasian/firebase-structured-logger 0.8.0 → 1.0.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/README.md +234 -35
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/logger.d.ts +22 -2
- package/dist/client/logger.d.ts.map +1 -1
- package/dist/client/logger.js +135 -21
- package/dist/client/logger.js.map +1 -1
- package/dist/client/rateLimiter.d.ts +106 -11
- package/dist/client/rateLimiter.d.ts.map +1 -1
- package/dist/client/rateLimiter.js +334 -21
- package/dist/client/rateLimiter.js.map +1 -1
- package/dist/functions/httpHandler.d.ts +1 -1
- package/dist/functions/httpHandler.js +1 -1
- package/dist/functions/index.d.ts +1 -1
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/logHandler.d.ts +10 -5
- package/dist/functions/logHandler.d.ts.map +1 -1
- package/dist/functions/logHandler.js +17 -5
- package/dist/functions/logHandler.js.map +1 -1
- package/dist/functions/logger.d.ts.map +1 -1
- package/dist/functions/logger.js +232 -10
- package/dist/functions/logger.js.map +1 -1
- package/dist/functions/sourceMapCache.js +1 -1
- package/dist/functions/sourceMapCache.js.map +1 -1
- package/dist/shared/deprecate.d.ts +4 -0
- package/dist/shared/deprecate.d.ts.map +1 -0
- package/dist/shared/deprecate.js +30 -0
- package/dist/shared/deprecate.js.map +1 -0
- package/dist/shared/nodeModules.d.ts +39 -0
- package/dist/shared/nodeModules.d.ts.map +1 -0
- package/dist/shared/nodeModules.js +120 -0
- package/dist/shared/nodeModules.js.map +1 -0
- package/dist/shared/types.d.ts +7 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/versionRange.d.ts +17 -0
- package/dist/shared/versionRange.d.ts.map +1 -0
- package/dist/shared/versionRange.js +48 -0
- package/dist/shared/versionRange.js.map +1 -0
- package/dist/tools/doctor.d.ts +54 -0
- package/dist/tools/doctor.d.ts.map +1 -0
- package/dist/tools/doctor.js +381 -0
- package/dist/tools/doctor.js.map +1 -0
- package/dist/tools/index.js +34 -5
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/uploadSourceMaps.d.ts +7 -0
- package/dist/tools/uploadSourceMaps.d.ts.map +1 -1
- package/dist/tools/uploadSourceMaps.js.map +1 -1
- package/package.json +11 -11
- package/skills/query-logs/SKILL.md +49 -0
package/dist/client/logger.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Logger = void 0;
|
|
4
4
|
exports.sendFeedback = sendFeedback;
|
|
5
|
+
exports.sendTestLog = sendTestLog;
|
|
5
6
|
exports.triggerTestLog = triggerTestLog;
|
|
6
7
|
exports.initLogger = initLogger;
|
|
7
8
|
exports.getClientLogger = getClientLogger;
|
|
8
9
|
const severity_1 = require("../shared/severity");
|
|
9
10
|
const error_1 = require("../shared/error");
|
|
11
|
+
const deprecate_1 = require("../shared/deprecate");
|
|
10
12
|
const breadcrumbs_1 = require("./breadcrumbs");
|
|
11
13
|
const rateLimiter_1 = require("./rateLimiter");
|
|
12
14
|
/**
|
|
@@ -75,7 +77,9 @@ class Logger {
|
|
|
75
77
|
userLabels = {};
|
|
76
78
|
constructor(config) {
|
|
77
79
|
this.config = config;
|
|
78
|
-
|
|
80
|
+
if (config.minLogLevel !== undefined)
|
|
81
|
+
(0, deprecate_1.warnDeprecated)('minLogLevel', 'minSeverity');
|
|
82
|
+
this.minLevel = severity_1.SEVERITY_ORDER[config.minSeverity ?? config.minLogLevel ?? defaultMinLevel()];
|
|
79
83
|
if (config.rateLimitOptions) {
|
|
80
84
|
(0, rateLimiter_1.configureRateLimiter)(config.rateLimitOptions);
|
|
81
85
|
}
|
|
@@ -136,33 +140,51 @@ class Logger {
|
|
|
136
140
|
// same pipe — it is rare by nature and there is nothing to throttle. The
|
|
137
141
|
// exemption keys on the record being feedback, not on its severity, so a
|
|
138
142
|
// NOTICE emitted for anything else still behaves normally.
|
|
139
|
-
bypassVolumeControls = false
|
|
143
|
+
bypassVolumeControls = false,
|
|
144
|
+
// A repeat summary spends no budget and is never itself a duplicate — but
|
|
145
|
+
// it still respects the severity floor, unlike feedback above.
|
|
146
|
+
skipBudget = false, timestamp) {
|
|
140
147
|
if (!bypassVolumeControls && severity_1.SEVERITY_ORDER[severity] > this.minLevel)
|
|
141
|
-
return;
|
|
148
|
+
return false;
|
|
149
|
+
const allLabels = {
|
|
150
|
+
appId: this.config.appId,
|
|
151
|
+
releaseId: this.config.releaseId,
|
|
152
|
+
screen: (0, breadcrumbs_1.getCurrentScreen)(),
|
|
153
|
+
userId: this.userId,
|
|
154
|
+
platform: PLATFORM,
|
|
155
|
+
browser: BROWSER,
|
|
156
|
+
...this.userLabels,
|
|
157
|
+
...labels,
|
|
158
|
+
};
|
|
142
159
|
// One gate for every severity. Passing a signature opts this log into
|
|
143
160
|
// duplicate suppression; the check and the budget spend are one operation,
|
|
144
161
|
// so a log can neither be counted twice nor checked without being counted.
|
|
145
|
-
|
|
162
|
+
// Once a signature passes `duplicateLimit`, further occurrences are
|
|
163
|
+
// "counted", not refused outright — the rate limiter keeps a running
|
|
164
|
+
// count toward the next repeat summary.
|
|
165
|
+
const decision = bypassVolumeControls || skipBudget
|
|
166
|
+
? { allowed: true }
|
|
167
|
+
: (0, rateLimiter_1.allow)({ severity, signature, labels: allLabels });
|
|
146
168
|
if (!decision.allowed) {
|
|
147
169
|
if (decision.reason === 'duplicate') {
|
|
148
|
-
console.warn(`[fsl] Duplicate
|
|
170
|
+
console.warn(`[fsl] Duplicate counted for the next summary: ${(0, rateLimiter_1.describeSignature)(decision.signature ?? '')}`);
|
|
171
|
+
}
|
|
172
|
+
else if (decision.reason === 'reserve') {
|
|
173
|
+
console.warn('[fsl] Log limit: only errors can use the reserved logs now');
|
|
149
174
|
}
|
|
150
175
|
else {
|
|
151
|
-
console.warn('[fsl]
|
|
176
|
+
console.warn('[fsl] Log limit reached — recharging, next log in about a minute');
|
|
152
177
|
}
|
|
153
|
-
return;
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
// Ties this full copy to the summary its repeats will eventually become.
|
|
181
|
+
// The client has no server logId to put in the summary's `repeatOf` — see
|
|
182
|
+
// README, "Repeats are counted, not dropped" — so this client-side id is
|
|
183
|
+
// the join key instead, carried by every full copy of the signature.
|
|
184
|
+
if ('repeatKey' in decision && decision.repeatKey) {
|
|
185
|
+
allLabels.repeatKey = decision.repeatKey;
|
|
154
186
|
}
|
|
155
187
|
try {
|
|
156
|
-
const allLabels = {
|
|
157
|
-
appId: this.config.appId,
|
|
158
|
-
releaseId: this.config.releaseId,
|
|
159
|
-
screen: (0, breadcrumbs_1.getCurrentScreen)(),
|
|
160
|
-
userId: this.userId,
|
|
161
|
-
platform: PLATFORM,
|
|
162
|
-
browser: BROWSER,
|
|
163
|
-
...this.userLabels,
|
|
164
|
-
...labels,
|
|
165
|
-
};
|
|
166
188
|
// Each attachment is converted in its own try. A Blob or File can fail to
|
|
167
189
|
// read — a user picks a file from <input type="file">, moves or deletes it,
|
|
168
190
|
// then submits, and the browser raises NotReadableError. Previously one
|
|
@@ -200,13 +222,65 @@ class Logger {
|
|
|
200
222
|
error,
|
|
201
223
|
},
|
|
202
224
|
...(base64Attachments ? { attachments: base64Attachments } : {}),
|
|
225
|
+
...(timestamp ? { timestamp } : {}),
|
|
203
226
|
};
|
|
204
227
|
await this.config.logFunction(payload);
|
|
228
|
+
return true;
|
|
205
229
|
}
|
|
206
230
|
catch (err) {
|
|
207
231
|
console.error('[fsl] Failed to send log:', err instanceof Error ? err.message : err);
|
|
232
|
+
return false;
|
|
208
233
|
}
|
|
209
234
|
}
|
|
235
|
+
// Guards against sending the same queued summary twice when a flush is
|
|
236
|
+
// triggered again (interval, visibilitychange) before a previous attempt's
|
|
237
|
+
// `logFunction` call has resolved — `peekPendingSummaries` does not remove
|
|
238
|
+
// anything, so without this a slow or slow-to-fail send could be picked up
|
|
239
|
+
// more than once.
|
|
240
|
+
summariesInFlight = new Set();
|
|
241
|
+
/** Send whatever repeat summaries are due, from this visit or an earlier one. */
|
|
242
|
+
sendPendingSummaries() {
|
|
243
|
+
for (const summary of (0, rateLimiter_1.peekPendingSummaries)()) {
|
|
244
|
+
if (this.summariesInFlight.has(summary.id))
|
|
245
|
+
continue;
|
|
246
|
+
this.summariesInFlight.add(summary.id);
|
|
247
|
+
void this.sendRepeatSummary(summary).finally(() => this.summariesInFlight.delete(summary.id));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* A repeat summary: a WARNING with no stack, timestamped at `lastSeen` (see
|
|
252
|
+
* README, "Repeats are counted, not dropped"). It still respects the
|
|
253
|
+
* severity floor — only the budget and the duplicate gate are skipped, via
|
|
254
|
+
* `send`'s `skipBudget`.
|
|
255
|
+
*
|
|
256
|
+
* It is queued in `localStorage` precisely so a failed send does not lose
|
|
257
|
+
* it — offline, or the tab tearing down right after the `visibilitychange`
|
|
258
|
+
* that triggered this. So it is only acknowledged (removed from the queue)
|
|
259
|
+
* once `send` reports the entry actually reached `logFunction`; otherwise
|
|
260
|
+
* the next flush, or the next visit, finds it still there and retries it.
|
|
261
|
+
*/
|
|
262
|
+
async sendRepeatSummary(summary) {
|
|
263
|
+
const labels = {
|
|
264
|
+
appId: this.config.appId,
|
|
265
|
+
releaseId: summary.releaseId ?? this.config.releaseId,
|
|
266
|
+
userId: summary.userId,
|
|
267
|
+
screen: summary.screen,
|
|
268
|
+
errorType: summary.errorType,
|
|
269
|
+
repeatOf: summary.repeatOf,
|
|
270
|
+
repeatCount: String(summary.repeatCount),
|
|
271
|
+
firstSeen: summary.firstSeen,
|
|
272
|
+
lastSeen: summary.lastSeen,
|
|
273
|
+
...(summary.sentLate ? { sentLate: 'true' } : {}),
|
|
274
|
+
};
|
|
275
|
+
const sent = await this.send(`Repeated ${summary.repeatCount} more times: ${summary.message}`, 'WARNING', labels,
|
|
276
|
+
// A body besides the message. With only `message` left once the timestamp
|
|
277
|
+
// is promoted, Cloud Logging files the entry as textPayload, and a search on
|
|
278
|
+
// jsonPayload.message — /query-logs, or anyone's saved query — misses every
|
|
279
|
+
// summary. The smoke run found it.
|
|
280
|
+
{ repeat: { count: summary.repeatCount, firstSeen: summary.firstSeen, lastSeen: summary.lastSeen } }, undefined, undefined, undefined, false, true, summary.lastSeen);
|
|
281
|
+
if (sent)
|
|
282
|
+
(0, rateLimiter_1.acknowledgeSummary)(summary.id);
|
|
283
|
+
}
|
|
210
284
|
}
|
|
211
285
|
exports.Logger = Logger;
|
|
212
286
|
/**
|
|
@@ -219,7 +293,7 @@ function sendFeedback(text, extras) {
|
|
|
219
293
|
getClientLogger().sendFeedback(text, extras);
|
|
220
294
|
}
|
|
221
295
|
/**
|
|
222
|
-
*
|
|
296
|
+
* Send a test log entry to verify the logging pipeline is working end-to-end.
|
|
223
297
|
* Logs at all severities with errorType: 'fsl-verify'. Safe to call in dev only.
|
|
224
298
|
*
|
|
225
299
|
* After clicking, check:
|
|
@@ -227,8 +301,8 @@ function sendFeedback(text, extras) {
|
|
|
227
301
|
* 2. Stack trace is symbolicated (points to source file, not minified bundle)
|
|
228
302
|
* 3. MCP query: source: local, where: [{ field: "labels.errorType", operator: "==", value: "fsl-verify" }]
|
|
229
303
|
*/
|
|
230
|
-
function
|
|
231
|
-
console.info('[fsl]
|
|
304
|
+
function sendTestLog() {
|
|
305
|
+
console.info('[fsl] sendTestLog called');
|
|
232
306
|
const logger = getClientLogger();
|
|
233
307
|
const testError = new Error('[fsl-verify] Test error — logging pipeline check');
|
|
234
308
|
console.info('[fsl] sending error log...');
|
|
@@ -237,12 +311,24 @@ function triggerTestLog() {
|
|
|
237
311
|
logger.warning('[fsl-verify] Test warning', { errorType: 'fsl-verify' });
|
|
238
312
|
console.info('[fsl] sending info log...');
|
|
239
313
|
logger.info('[fsl-verify] Test info', { errorType: 'fsl-verify' });
|
|
240
|
-
console.info('[fsl]
|
|
314
|
+
console.info('[fsl] sendTestLog scheduled — sends are fire-and-forget; check dev.jsonl in ~1-2s');
|
|
315
|
+
}
|
|
316
|
+
/** @deprecated Use `sendTestLog()`. */
|
|
317
|
+
function triggerTestLog() {
|
|
318
|
+
(0, deprecate_1.warnDeprecated)('triggerTestLog', 'sendTestLog');
|
|
319
|
+
sendTestLog();
|
|
241
320
|
}
|
|
242
321
|
// Module-level singleton
|
|
243
322
|
let instance = null;
|
|
244
323
|
function initLogger(config) {
|
|
245
324
|
instance = new Logger(config);
|
|
325
|
+
// A previous visit's queued summaries (README, "the next visit sends
|
|
326
|
+
// them") would otherwise wait for the first `visibilitychange: hidden` or
|
|
327
|
+
// the first 60s interval tick — a short delay so init itself can finish
|
|
328
|
+
// first, not a wait for either of those.
|
|
329
|
+
if (typeof setTimeout !== 'undefined') {
|
|
330
|
+
setTimeout(() => instance?.sendPendingSummaries(), 0);
|
|
331
|
+
}
|
|
246
332
|
return instance;
|
|
247
333
|
}
|
|
248
334
|
function getClientLogger() {
|
|
@@ -250,4 +336,32 @@ function getClientLogger() {
|
|
|
250
336
|
throw new Error('[fsl] initLogger() not called');
|
|
251
337
|
return instance;
|
|
252
338
|
}
|
|
339
|
+
/**
|
|
340
|
+
* Repeat summaries are sent hourly and when the tab is hidden (README,
|
|
341
|
+
* "Repeats are counted, not dropped"). Neither is triggered by an ordinary
|
|
342
|
+
* log call — `send` does not check for due summaries itself, since doing so
|
|
343
|
+
* with frozen-for-testing time reliably makes an interval-based check look
|
|
344
|
+
* due immediately (see tests/rateLimiter.ts). So there are exactly three
|
|
345
|
+
* triggers for a flush: `initLogger` (a previous visit's queue, once, above),
|
|
346
|
+
* this `visibilitychange` listener (the tab going hidden), and the interval
|
|
347
|
+
* below (an app that never hides its tab and rarely reloads).
|
|
348
|
+
*
|
|
349
|
+
* Neither exists in the esbuild bundle test's sandbox (no `window`/`document`
|
|
350
|
+
* there — see tests/browserBundle.ts), so both are guarded.
|
|
351
|
+
*/
|
|
352
|
+
if (typeof document !== 'undefined') {
|
|
353
|
+
document.addEventListener('visibilitychange', () => {
|
|
354
|
+
if (document.visibilityState !== 'hidden')
|
|
355
|
+
return;
|
|
356
|
+
(0, rateLimiter_1.flushDueSummaries)(true);
|
|
357
|
+
instance?.sendPendingSummaries();
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
if (typeof window !== 'undefined') {
|
|
361
|
+
const interval = setInterval(() => {
|
|
362
|
+
(0, rateLimiter_1.flushDueSummaries)();
|
|
363
|
+
instance?.sendPendingSummaries();
|
|
364
|
+
}, 60_000);
|
|
365
|
+
interval.unref?.();
|
|
366
|
+
}
|
|
253
367
|
//# sourceMappingURL=logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/client/logger.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/client/logger.ts"],"names":[],"mappings":";;;AA+ZA,oCAIC;AAWD,kCAWC;AAGD,wCAGC;AAKD,gCAcC;AAED,0CAKC;AAxdD,iDAAmE;AACnE,2CAAyD;AACzD,mDAAoD;AACpD,+CAOsB;AACtB,+CAUsB;AA2BtB;;;;;;;;GAQG;AACH,SAAS,eAAe;IACtB,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;YAAE,OAAO,SAAS,CAAA;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,wCAAwC;IAC1C,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,oCAAoC;AACpC,MAAM,SAAS,GAAuB;IACpC,CAAC,kBAAkB,EAAE,KAAK,CAAC;IAC3B,CAAC,SAAS,EAAE,SAAS,CAAC;IACtB,CAAC,KAAK,EAAE,OAAO,CAAC;IAChB,CAAC,KAAK,EAAE,SAAS,CAAC;IAClB,CAAC,OAAO,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,MAAM,QAAQ,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E;IACxE,yCAAyC;IACzC,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE,CAAC;QACtC,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,oBAAoB,EAAE,EAAE,CAAC,CAAC,CAAA;IACvD,CAAC;IAED,OAAO,QAA6B,CAAA;AACtC,CAAC;AAED,SAAgB,eAAe;IAG7B,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAC/D,OAAO,QAA6B,CAAA;AACtC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;IACpC,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,GAAG,EAAE;QACjD,IAAI,QAAQ,CAAC,eAAe,KAAK,QAAQ;YAAE,OAAM;QACjD,IAAA,+BAAiB,EAAC,IAAI,CAAC,CAAA;QACvB,QAAQ,EAAE,oBAAoB,EAAE,CAAA;IAClC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAChC,IAAA,+BAAiB,GAAE,CAAA;QACnB,QAAQ,EAAE,oBAAoB,EAAE,CAAA;IAClC,CAAC,EAAE,MAAM,CAAC,CACT;IAAC,QAA8C,CAAC,KAAK,EAAE,EAAE,CAAA;AAC5D,CAAC"}
|
|
@@ -1,7 +1,70 @@
|
|
|
1
|
+
import type { LogSeverity } from '../shared/types';
|
|
1
2
|
export interface RateLimitConfig {
|
|
2
|
-
|
|
3
|
+
/** The budget: how many logs can go out at once. Default 50. */
|
|
4
|
+
burstLimit?: number;
|
|
5
|
+
/** After a burst, how many seconds before one more log recharges. Default 60. */
|
|
6
|
+
rechargeSecondsPerLog?: number;
|
|
7
|
+
/** Of `burstLimit`, how many only ERROR and above may spend. A value over half of
|
|
8
|
+
* `burstLimit` is capped at half, with one warning. Default 10. */
|
|
9
|
+
reservedForErrors?: number;
|
|
10
|
+
/** Full copies of one error before it is only counted. Default 3. */
|
|
3
11
|
duplicateLimit?: number;
|
|
4
12
|
storageKey?: string;
|
|
13
|
+
/** How often a running count of repeats is sent as a summary. Default 60. */
|
|
14
|
+
summaryIntervalMinutes?: number;
|
|
15
|
+
/** How long an unsent summary is kept before it is deleted, not sent. Default 7. */
|
|
16
|
+
summaryMaxAgeDays?: number;
|
|
17
|
+
/** Most pending summaries kept at once; oldest are dropped first. Default 50. */
|
|
18
|
+
maxPendingSummaries?: number;
|
|
19
|
+
/** @deprecated Use `burstLimit`. */
|
|
20
|
+
sessionLimit?: number;
|
|
21
|
+
/** @deprecated Use `rechargeSecondsPerLog` (`60 / refillPerMinute`). */
|
|
22
|
+
refillPerMinute?: number;
|
|
23
|
+
/** @deprecated Use `reservedForErrors` (`Math.round(errorReserve * burstLimit)`), a count rather than a share. */
|
|
24
|
+
errorReserve?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A repeat count waiting to be sent as a WARNING summary. Queued in
|
|
28
|
+
* `localStorage` so it survives the tab closing — `sessionStorage` does not.
|
|
29
|
+
*
|
|
30
|
+
* `bootId` is what `sentLate` is built from: it is the module's own load-time
|
|
31
|
+
* id, not anything persisted. A summary queued during an earlier page load
|
|
32
|
+
* carries a different `bootId` than the one currently running, so popping it
|
|
33
|
+
* here reveals it as "from a previous visit" without needing a server
|
|
34
|
+
* round-trip or a wall-clock guess.
|
|
35
|
+
*
|
|
36
|
+
* `message`/`errorType`/`screen`/`releaseId`/`userId` are short fields
|
|
37
|
+
* rebuilt once from the signature's key when the summary is created (see
|
|
38
|
+
* `parseSignatureKey`) — not a full label copy. Everything else about the
|
|
39
|
+
* error (browser, platform, stack, breadcrumbs…) is already in Cloud Logging
|
|
40
|
+
* on the full copies `repeatOf` points back to.
|
|
41
|
+
*/
|
|
42
|
+
export interface PendingSummary {
|
|
43
|
+
id: string;
|
|
44
|
+
message: string;
|
|
45
|
+
errorType?: string;
|
|
46
|
+
screen?: string;
|
|
47
|
+
releaseId?: string;
|
|
48
|
+
userId?: string;
|
|
49
|
+
repeatOf: string;
|
|
50
|
+
repeatCount: number;
|
|
51
|
+
firstSeen: string;
|
|
52
|
+
lastSeen: string;
|
|
53
|
+
createdAt: number;
|
|
54
|
+
bootId: string;
|
|
55
|
+
}
|
|
56
|
+
export interface SentSummary {
|
|
57
|
+
id: string;
|
|
58
|
+
message: string;
|
|
59
|
+
errorType?: string;
|
|
60
|
+
screen?: string;
|
|
61
|
+
releaseId?: string;
|
|
62
|
+
userId?: string;
|
|
63
|
+
repeatOf: string;
|
|
64
|
+
repeatCount: number;
|
|
65
|
+
firstSeen: string;
|
|
66
|
+
lastSeen: string;
|
|
67
|
+
sentLate: boolean;
|
|
5
68
|
}
|
|
6
69
|
export declare function configureRateLimiter(options: RateLimitConfig): void;
|
|
7
70
|
/**
|
|
@@ -15,25 +78,57 @@ export declare function configureRateLimiter(options: RateLimitConfig): void;
|
|
|
15
78
|
* without the staleness of a span someone has to remember to clear.
|
|
16
79
|
*/
|
|
17
80
|
export declare function signatureFor(error: Error | string, screen?: string): string;
|
|
81
|
+
/** A signature as a person reads it, for the console: `TypeError: cannot read 'id' | checkout`. */
|
|
82
|
+
export declare function describeSignature(signature: string): string;
|
|
18
83
|
export type RateLimitDecision = {
|
|
19
84
|
allowed: true;
|
|
85
|
+
repeatKey?: string;
|
|
20
86
|
} | {
|
|
21
87
|
allowed: false;
|
|
22
|
-
reason: 'session-limit' | 'duplicate';
|
|
88
|
+
reason: 'session-limit' | 'reserve' | 'duplicate';
|
|
23
89
|
signature?: string;
|
|
24
90
|
};
|
|
91
|
+
export interface AllowOptions {
|
|
92
|
+
signature?: string;
|
|
93
|
+
severity: LogSeverity;
|
|
94
|
+
labels?: Record<string, string | undefined>;
|
|
95
|
+
}
|
|
96
|
+
export declare function allow(options: AllowOptions): RateLimitDecision;
|
|
25
97
|
/**
|
|
26
|
-
*
|
|
98
|
+
* Move any signature's accumulated repeats into the pending-summary queue —
|
|
99
|
+
* every one whose window (`summaryIntervalMinutes`) has elapsed, or every one
|
|
100
|
+
* with anything to send when `force` is true (the tab going hidden).
|
|
27
101
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
102
|
+
* Only the counting resets; `count` (full copies already sent) is untouched,
|
|
103
|
+
* so a signature stays in "counting" mode across summary windows rather than
|
|
104
|
+
* sending three more full copies before the next summary.
|
|
105
|
+
*/
|
|
106
|
+
export declare function flushDueSummaries(force?: boolean): void;
|
|
107
|
+
/**
|
|
108
|
+
* Look at every pending summary not past `summaryMaxAgeDays`, WITHOUT
|
|
109
|
+
* removing it from the queue. A summary may only leave the queue once its
|
|
110
|
+
* send has actually succeeded — see `acknowledgeSummary` — so a failed send
|
|
111
|
+
* (offline, or the tab tearing down right after the `visibilitychange` that
|
|
112
|
+
* triggered this) leaves it queued for the next flush or the next visit to
|
|
113
|
+
* retry, instead of losing it. `sentLate` is true for anything queued by an
|
|
114
|
+
* earlier page load (a different `bootId`): the case the README's "next
|
|
115
|
+
* visit sends them" describes.
|
|
33
116
|
*
|
|
34
|
-
*
|
|
35
|
-
|
|
117
|
+
* Expired entries ARE removed here — there is no send to wait on for those.
|
|
118
|
+
*/
|
|
119
|
+
export declare function peekPendingSummaries(): SentSummary[];
|
|
120
|
+
/**
|
|
121
|
+
* Remove one summary from the queue by id, once its send has resolved. A
|
|
122
|
+
* retry that calls this again for an id already gone is a no-op — it never
|
|
123
|
+
* re-adds anything, so it cannot create a second entry.
|
|
124
|
+
*/
|
|
125
|
+
export declare function acknowledgeSummary(id: string): void;
|
|
126
|
+
/**
|
|
127
|
+
* Test-only reset. There is no `beforeunload` wiring any more — the budget
|
|
128
|
+
* lives in `sessionStorage` on purpose, so a reload keeps it — but tests still
|
|
129
|
+
* need a way to start a clean session, and to simulate a genuinely new visit
|
|
130
|
+
* (a new tab gets a new `bootId` for free, since the module reloads with it;
|
|
131
|
+
* a test in the same process cannot, so this rotates it explicitly).
|
|
36
132
|
*/
|
|
37
|
-
export declare function allow(signature?: string): RateLimitDecision;
|
|
38
133
|
export declare function resetRateLimiter(): void;
|
|
39
134
|
//# sourceMappingURL=rateLimiter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rateLimiter.d.ts","sourceRoot":"","sources":["../../src/client/rateLimiter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rateLimiter.d.ts","sourceRoot":"","sources":["../../src/client/rateLimiter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AA4BlD,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iFAAiF;IACjF,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;wEACoE;IACpE,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6EAA6E;IAC7E,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iFAAiF;IACjF,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,kHAAkH;IAClH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AA+BD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC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