@dasasian/firebase-structured-logger 0.5.0 → 0.7.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 (63) hide show
  1. package/README.md +652 -91
  2. package/dist/client/breadcrumbs.d.ts +14 -2
  3. package/dist/client/breadcrumbs.d.ts.map +1 -1
  4. package/dist/client/breadcrumbs.js +39 -21
  5. package/dist/client/breadcrumbs.js.map +1 -1
  6. package/dist/client/index.d.ts +3 -3
  7. package/dist/client/index.d.ts.map +1 -1
  8. package/dist/client/index.js +2 -2
  9. package/dist/client/index.js.map +1 -1
  10. package/dist/client/logger.d.ts +29 -0
  11. package/dist/client/logger.d.ts.map +1 -1
  12. package/dist/client/logger.js +39 -5
  13. package/dist/client/logger.js.map +1 -1
  14. package/dist/client/rateLimiter.d.ts +8 -3
  15. package/dist/client/rateLimiter.d.ts.map +1 -1
  16. package/dist/client/rateLimiter.js +9 -4
  17. package/dist/client/rateLimiter.js.map +1 -1
  18. package/dist/functions/httpHandler.d.ts +89 -0
  19. package/dist/functions/httpHandler.d.ts.map +1 -0
  20. package/dist/functions/httpHandler.js +112 -0
  21. package/dist/functions/httpHandler.js.map +1 -0
  22. package/dist/functions/index.d.ts +6 -3
  23. package/dist/functions/index.d.ts.map +1 -1
  24. package/dist/functions/index.js +6 -2
  25. package/dist/functions/index.js.map +1 -1
  26. package/dist/functions/logHandler.d.ts +53 -2
  27. package/dist/functions/logHandler.d.ts.map +1 -1
  28. package/dist/functions/logHandler.js +38 -7
  29. package/dist/functions/logHandler.js.map +1 -1
  30. package/dist/functions/logger.d.ts.map +1 -1
  31. package/dist/functions/logger.js +95 -7
  32. package/dist/functions/logger.js.map +1 -1
  33. package/dist/functions/requestLogger.d.ts +2 -20
  34. package/dist/functions/requestLogger.d.ts.map +1 -1
  35. package/dist/functions/requestLogger.js +2 -39
  36. package/dist/functions/requestLogger.js.map +1 -1
  37. package/dist/functions/sourceMapCache.d.ts +27 -1
  38. package/dist/functions/sourceMapCache.d.ts.map +1 -1
  39. package/dist/functions/sourceMapCache.js +84 -9
  40. package/dist/functions/sourceMapCache.js.map +1 -1
  41. package/dist/functions/traceContext.d.ts +40 -0
  42. package/dist/functions/traceContext.d.ts.map +1 -0
  43. package/dist/functions/traceContext.js +93 -0
  44. package/dist/functions/traceContext.js.map +1 -0
  45. package/dist/shared/paths.d.ts +59 -0
  46. package/dist/shared/paths.d.ts.map +1 -0
  47. package/dist/shared/paths.js +126 -0
  48. package/dist/shared/paths.js.map +1 -0
  49. package/dist/shared/severity.d.ts +21 -0
  50. package/dist/shared/severity.d.ts.map +1 -1
  51. package/dist/shared/severity.js +31 -3
  52. package/dist/shared/severity.js.map +1 -1
  53. package/dist/shared/types.d.ts +1 -2
  54. package/dist/shared/types.d.ts.map +1 -1
  55. package/dist/tools/index.js +13 -4
  56. package/dist/tools/index.js.map +1 -1
  57. package/dist/tools/uploadSourceMaps.d.ts +24 -1
  58. package/dist/tools/uploadSourceMaps.d.ts.map +1 -1
  59. package/dist/tools/uploadSourceMaps.js +31 -4
  60. package/dist/tools/uploadSourceMaps.js.map +1 -1
  61. package/package.json +4 -4
  62. package/skills/logs/SKILL.md +32 -9
  63. package/skills/query-logs/SKILL.md +14 -1
@@ -35,12 +35,17 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.__cacheForTests = void 0;
37
37
  exports.configureSourceMapBucket = configureSourceMapBucket;
38
+ exports.configureAttachments = configureAttachments;
39
+ exports.getAttachmentBucket = getAttachmentBucket;
40
+ exports.getAttachmentPrefix = getAttachmentPrefix;
41
+ exports.resetAttachmentConfig = resetAttachmentConfig;
38
42
  exports.getBucket = getBucket;
39
43
  exports.getSourceMap = getSourceMap;
44
+ exports.resetSourceMapWarnings = resetSourceMapWarnings;
40
45
  exports.clearSourceMapCache = clearSourceMapCache;
41
46
  const fs = __importStar(require("fs"));
42
- const path = __importStar(require("path"));
43
47
  const storage_1 = require("firebase-admin/storage");
48
+ const paths_js_1 = require("../shared/paths.js");
44
49
  /**
45
50
  * Storage-map cache, bounded by approximate bytes with LRU eviction.
46
51
  *
@@ -117,6 +122,41 @@ let defaultBucket;
117
122
  function configureSourceMapBucket(bucketName) {
118
123
  defaultBucket = bucketName;
119
124
  }
125
+ /**
126
+ * Where attachments are written.
127
+ *
128
+ * Global on purpose, and global in the API so the shape does not lie. The
129
+ * upload happens in `writeLog`, which is reached from every log call — including
130
+ * `logError()` inside a handler that never went through `createClientLogHandler`
131
+ * — so there is no per-instance config for it to read. Accepting this as a field
132
+ * on the handler would let a second handler silently retarget the first's
133
+ * attachments, which is the module-scoped-state trap in CLAUDE.md.
134
+ *
135
+ * Unset fields keep today's behaviour: the bucket falls back to
136
+ * `configureSourceMapBucket`'s value and then to the project default, and the
137
+ * prefix to `logAttachments/`. Never calling this changes nothing.
138
+ */
139
+ function configureAttachments(options) {
140
+ if (options.bucket !== undefined)
141
+ attachmentBucket = options.bucket;
142
+ if (options.prefix !== undefined)
143
+ attachmentPrefix = options.prefix;
144
+ }
145
+ let attachmentBucket;
146
+ let attachmentPrefix;
147
+ /** Bucket for attachments: explicit, then the source-map bucket, then the project default. */
148
+ function getAttachmentBucket() {
149
+ return getBucket(attachmentBucket ?? defaultBucket);
150
+ }
151
+ /** Prefix for attachments, defaulting to the documented one. */
152
+ function getAttachmentPrefix() {
153
+ return attachmentPrefix;
154
+ }
155
+ /** Reset attachment config. Tests only — production configures once at module load. */
156
+ function resetAttachmentConfig() {
157
+ attachmentBucket = undefined;
158
+ attachmentPrefix = undefined;
159
+ }
120
160
  /**
121
161
  * Resolve the configured Storage bucket, falling back to the project default.
122
162
  *
@@ -145,7 +185,7 @@ function readEmbeddedRelease() {
145
185
  if (embeddedRelease !== undefined)
146
186
  return embeddedRelease;
147
187
  try {
148
- const markerPath = path.join(process.cwd(), 'sourcemaps', 'current', '.release');
188
+ const markerPath = (0, paths_js_1.embeddedMarkerPath)(process.cwd());
149
189
  embeddedRelease = fs.existsSync(markerPath)
150
190
  ? fs.readFileSync(markerPath, 'utf-8').trim() || null
151
191
  : null;
@@ -157,8 +197,9 @@ function readEmbeddedRelease() {
157
197
  }
158
198
  function readEmbeddedSourceMap(fileName) {
159
199
  try {
160
- // Looks for sourcemaps/current/{fileName}.map relative to the Cloud Function working directory
161
- const mapPath = path.join(process.cwd(), 'sourcemaps', 'current', `${fileName}.map`);
200
+ // Resolved against the process working directory the deployed backend's,
201
+ // whether that is Cloud Functions or anything else that ships the directory.
202
+ const mapPath = (0, paths_js_1.embeddedMapPath)(process.cwd(), fileName);
162
203
  if (!fs.existsSync(mapPath))
163
204
  return null;
164
205
  return JSON.parse(fs.readFileSync(mapPath, 'utf-8'));
@@ -170,15 +211,17 @@ function readEmbeddedSourceMap(fileName) {
170
211
  /**
171
212
  * Load source map from Firebase Storage (for older releases).
172
213
  */
173
- async function loadStorageSourceMap(releaseId, fileName, bucketName) {
214
+ async function loadStorageSourceMap(releaseId, fileName, bucketName, prefix) {
174
215
  // The bucket is part of the key: the same release/file in two buckets is two
175
216
  // different maps, and caching them under one key would serve the wrong one.
176
- const cacheKey = `${bucketName ?? defaultBucket ?? ''}/${releaseId}/${fileName}`;
217
+ // The prefix is part of the key for the same reason the bucket is: the same
218
+ // release and file under two prefixes are two different objects.
219
+ const cacheKey = `${bucketName ?? defaultBucket ?? ''}/${prefix ?? ''}/${releaseId}/${fileName}`;
177
220
  const hit = cacheGet(cacheKey);
178
221
  if (hit)
179
222
  return hit.map;
180
223
  try {
181
- const file = getBucket(bucketName).file(`sourcemaps/${releaseId}/${fileName}.map`);
224
+ const file = getBucket(bucketName).file((0, paths_js_1.storageMapPath)(releaseId, fileName, prefix));
182
225
  const [exists] = await file.exists();
183
226
  if (!exists) {
184
227
  cacheSet(cacheKey, null, 0);
@@ -218,22 +261,54 @@ async function loadStorageSourceMap(releaseId, fileName, bucketName) {
218
261
  * That is strictly better than preferring embedded in every case, and it leaves
219
262
  * the unversioned setup working exactly as before.
220
263
  */
221
- async function getSourceMap(releaseId, fileName, bucketName) {
264
+ async function getSourceMap(releaseId, fileName, bucketName, prefix) {
222
265
  const embedded = loadEmbeddedSourceMap(fileName);
223
266
  const marker = readEmbeddedRelease();
224
267
  // No marker means we cannot tell whether this stack belongs to the embedded
225
268
  // release. Older deploys have none, so keep the previous behaviour.
226
269
  if (embedded && (marker === null || marker === releaseId))
227
270
  return embedded;
228
- const stored = await loadStorageSourceMap(releaseId, fileName, bucketName);
271
+ const stored = await loadStorageSourceMap(releaseId, fileName, bucketName, prefix);
229
272
  if (stored)
230
273
  return stored;
231
274
  if (embedded) {
232
275
  warnReleaseFallback(releaseId, marker);
233
276
  return embedded;
234
277
  }
278
+ warnNothingResolved(releaseId, fileName, bucketName, prefix);
235
279
  return null;
236
280
  }
281
+ // Warn once per (release, prefix). This sits on the per-error path.
282
+ const warnedMisses = new Set();
283
+ /**
284
+ * Say so when a stack could not be symbolicated from anywhere.
285
+ *
286
+ * Silence here is the expensive failure. A wrong bucket, a wrong prefix, a
287
+ * release whose maps were never uploaded and an `fsl` step missing from the
288
+ * deploy script all produce the same thing — a minified stack, and no signal
289
+ * which of the four it was. With the prefix configurable (#35) there is one more
290
+ * way to land here, and the two ends are checked against each other by nothing.
291
+ *
292
+ * So name the exact places that were looked in. A prefix mismatch is obvious the
293
+ * moment you see the object name that was tried.
294
+ */
295
+ function warnNothingResolved(releaseId, fileName, bucketName, prefix) {
296
+ const key = `${releaseId}|${prefix ?? ''}`;
297
+ if (warnedMisses.has(key))
298
+ return;
299
+ warnedMisses.add(key);
300
+ const bucket = bucketName ?? defaultBucket ?? '<project default>';
301
+ console.warn(`[fsl] No source map for '${fileName}' at release '${releaseId}' — this stack stays minified.`);
302
+ console.warn(`[fsl] embedded: ${(0, paths_js_1.embeddedMapPath)(process.cwd(), fileName)} (not found)`);
303
+ console.warn(`[fsl] storage: gs://${bucket}/${(0, paths_js_1.storageMapPath)(releaseId, fileName, prefix)} (not found)`);
304
+ console.warn('[fsl] Check that the deploy runs `fsl upload-sourcemaps`, and that its --prefix');
305
+ console.warn('[fsl] and --bucket match createClientLogHandler({ sourceMaps }). Nothing verifies that for you.');
306
+ }
307
+ /** Reset the warn-once sets. Tests only. */
308
+ function resetSourceMapWarnings() {
309
+ warnedMisses.clear();
310
+ warnedFallbacks.clear();
311
+ }
237
312
  // Warn once per (release, marker) pair — this sits on the per-error path.
238
313
  const warnedFallbacks = new Set();
239
314
  function warnReleaseFallback(releaseId, marker) {
@@ -1 +1 @@
1
- {"version":3,"file":"sourceMapCache.js","sourceRoot":"","sources":["../../src/functions/sourceMapCache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,4DAEC;AASD,8BAEC;AAkGD,oCAoBC;AAiBD,kDAMC;AApPD,uCAAwB;AACxB,2CAA4B;AAC5B,oDAAmD;AAInD;;;;;;;;;;;;;GAaG;AACH,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAOxC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAA;AAC3C,IAAI,UAAU,GAAG,CAAC,CAAA;AAElB,0DAA0D;AAC1D,SAAS,QAAQ,CAAC,GAAW;IAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC5B,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAA;IAC5B,uEAAuE;IACvE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACjB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACrB,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW,EAAE,GAA4B,EAAE,KAAa;IACxE,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC/B,IAAI,QAAQ;QAAE,UAAU,IAAI,QAAQ,CAAC,KAAK,CAAA;I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mF,CACpF,CAAA;IACD,OAAO,CAAC,IAAI,CACV,mGAAmG,CACpG,CAAA;AACH,CAAC;AAED,4CAA4C;AAC5C,SAAgB,sBAAsB;IACpC,YAAY,CAAC,KAAK,EAAE,CAAA;IACpB,eAAe,CAAC,KAAK,EAAE,CAAA;AACzB,CAAC;AAED,0EAA0E;AAC1E,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAA;AACzC,SAAS,mBAAmB,CAAC,SAAiB,EAAE,MAAqB;IACnE,MAAM,GAAG,GAAG,GAAG,SAAS,IAAI,MAAM,EAAE,CAAA;IACpC,IAAI,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAM;IACpC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACxB,OAAO,CAAC,IAAI,CACV,gCAAgC,SAAS,kCAAkC;QACzE,IAAI,MAAM,kCAAkC,SAAS,wBAAwB;QAC7E,8EAA8E;QAC9E,8EAA8E;QAC9E,yEAAyE,CAC5E,CAAA;AACH,CAAC;AAED,SAAgB,mBAAmB;IACjC,KAAK,CAAC,KAAK,EAAE,CAAA;IACb,UAAU,GAAG,CAAC,CAAA;IACd,aAAa,CAAC,KAAK,EAAE,CAAA;IACrB,eAAe,GAAG,SAAS,CAAA;IAC3B,eAAe,CAAC,KAAK,EAAE,CAAA;AACzB,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Request trace ids, for backends that are not Cloud Functions (#34).
3
+ *
4
+ * `firebase-functions/logger`'s `write()` attaches
5
+ * `logging.googleapis.com/trace` from an AsyncLocalStorage that
6
+ * firebase-functions populates inside its own request wrapper. Outside one —
7
+ * Cloud Run, or anything behind `createHttpLogHandler` — that store is empty, so
8
+ * no trace id is attached and Cloud Logging cannot group a request's entries.
9
+ *
10
+ * That is silent: the logs arrive, they simply do not correlate, and nothing
11
+ * says why. So the adapter reads the headers itself and stores the id here.
12
+ *
13
+ * Inside Cloud Functions this is dormant — the store is never populated, and
14
+ * firebase-functions' own value takes precedence anyway, since it overwrites the
15
+ * field after we set it.
16
+ */
17
+ /**
18
+ * Pull a trace id out of request headers, preferring Cloud Trace's own format.
19
+ *
20
+ * Returns undefined rather than a partial id when nothing matches. A malformed
21
+ * header is not worth guessing at: an invalid trace resource name is rejected by
22
+ * Cloud Logging, which would cost the whole entry rather than just its
23
+ * correlation.
24
+ */
25
+ export declare function traceIdFromHeaders(headers: Record<string, string | string[] | undefined>): string | undefined;
26
+ /** Run `fn` with `traceId` attached to every log written inside it. */
27
+ export declare function runWithTrace<T>(traceId: string | undefined, fn: () => T): T;
28
+ /** The current request's trace id, if one was parsed. */
29
+ export declare function currentTraceId(): string | undefined;
30
+ /**
31
+ * The project a trace resource name belongs to.
32
+ *
33
+ * Cloud Functions sets `GCLOUD_PROJECT`; Cloud Run sets `GOOGLE_CLOUD_PROJECT`.
34
+ * With neither there is no valid resource name to build, so the field is left
35
+ * off rather than written wrong.
36
+ */
37
+ export declare function traceProject(): string | undefined;
38
+ /** The full `logging.googleapis.com/trace` value, or undefined if unavailable. */
39
+ export declare function traceResourceName(): string | undefined;
40
+ //# sourceMappingURL=traceContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traceContext.d.ts","sourceRoot":"","sources":["../../src/functions/traceContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA0BH;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GACrD,MAAM,GAAG,SAAS,CAepB;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAE3E;AAED,yDAAyD;AACzD,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD;AAED,kFAAkF;AAClF,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAKtD"}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ /**
3
+ * Request trace ids, for backends that are not Cloud Functions (#34).
4
+ *
5
+ * `firebase-functions/logger`'s `write()` attaches
6
+ * `logging.googleapis.com/trace` from an AsyncLocalStorage that
7
+ * firebase-functions populates inside its own request wrapper. Outside one —
8
+ * Cloud Run, or anything behind `createHttpLogHandler` — that store is empty, so
9
+ * no trace id is attached and Cloud Logging cannot group a request's entries.
10
+ *
11
+ * That is silent: the logs arrive, they simply do not correlate, and nothing
12
+ * says why. So the adapter reads the headers itself and stores the id here.
13
+ *
14
+ * Inside Cloud Functions this is dormant — the store is never populated, and
15
+ * firebase-functions' own value takes precedence anyway, since it overwrites the
16
+ * field after we set it.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.traceIdFromHeaders = traceIdFromHeaders;
20
+ exports.runWithTrace = runWithTrace;
21
+ exports.currentTraceId = currentTraceId;
22
+ exports.traceProject = traceProject;
23
+ exports.traceResourceName = traceResourceName;
24
+ const async_hooks_1 = require("async_hooks");
25
+ const traceStore = new async_hooks_1.AsyncLocalStorage();
26
+ /**
27
+ * Cloud Trace's own header: `TRACE_ID/SPAN_ID;o=TRACE_TRUE`.
28
+ * Google's load balancers and Cloud Run set this.
29
+ */
30
+ const CLOUD_TRACE_HEADER = 'x-cloud-trace-context';
31
+ /**
32
+ * W3C Trace Context: `00-<32 hex trace>-<16 hex span>-<flags>`.
33
+ * What OpenTelemetry and most third-party tracers send.
34
+ */
35
+ const TRACEPARENT_HEADER = 'traceparent';
36
+ const CLOUD_TRACE = /^([0-9a-fA-F]{32})(?:\/(\d+))?(?:;o=[01])?$/;
37
+ const TRACEPARENT = /^[0-9a-fA-F]{2}-([0-9a-fA-F]{32})-[0-9a-fA-F]{16}-[0-9a-fA-F]{2}$/;
38
+ function firstValue(value) {
39
+ if (Array.isArray(value))
40
+ return value[0];
41
+ return value;
42
+ }
43
+ /**
44
+ * Pull a trace id out of request headers, preferring Cloud Trace's own format.
45
+ *
46
+ * Returns undefined rather than a partial id when nothing matches. A malformed
47
+ * header is not worth guessing at: an invalid trace resource name is rejected by
48
+ * Cloud Logging, which would cost the whole entry rather than just its
49
+ * correlation.
50
+ */
51
+ function traceIdFromHeaders(headers) {
52
+ // Header names are case-insensitive, and nothing guarantees the host framework
53
+ // lower-cased them — Node's http does, a hand-rolled object may not.
54
+ const lower = {};
55
+ for (const [k, v] of Object.entries(headers))
56
+ lower[k.toLowerCase()] = v;
57
+ const cloud = firstValue(lower[CLOUD_TRACE_HEADER]);
58
+ const cloudMatch = cloud && CLOUD_TRACE.exec(cloud.trim());
59
+ if (cloudMatch)
60
+ return cloudMatch[1];
61
+ const parent = firstValue(lower[TRACEPARENT_HEADER]);
62
+ const parentMatch = parent && TRACEPARENT.exec(parent.trim());
63
+ if (parentMatch)
64
+ return parentMatch[1];
65
+ return undefined;
66
+ }
67
+ /** Run `fn` with `traceId` attached to every log written inside it. */
68
+ function runWithTrace(traceId, fn) {
69
+ return traceId ? traceStore.run(traceId, fn) : fn();
70
+ }
71
+ /** The current request's trace id, if one was parsed. */
72
+ function currentTraceId() {
73
+ return traceStore.getStore();
74
+ }
75
+ /**
76
+ * The project a trace resource name belongs to.
77
+ *
78
+ * Cloud Functions sets `GCLOUD_PROJECT`; Cloud Run sets `GOOGLE_CLOUD_PROJECT`.
79
+ * With neither there is no valid resource name to build, so the field is left
80
+ * off rather than written wrong.
81
+ */
82
+ function traceProject() {
83
+ return process.env.GCLOUD_PROJECT || process.env.GOOGLE_CLOUD_PROJECT || undefined;
84
+ }
85
+ /** The full `logging.googleapis.com/trace` value, or undefined if unavailable. */
86
+ function traceResourceName() {
87
+ const traceId = currentTraceId();
88
+ const project = traceProject();
89
+ if (!traceId || !project)
90
+ return undefined;
91
+ return `projects/${project}/traces/${traceId}`;
92
+ }
93
+ //# sourceMappingURL=traceContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traceContext.js","sourceRoot":"","sources":["../../src/functions/traceContext.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAkCH,gDAiBC;AAGD,oCAEC;AAGD,wCAEC;AASD,oCAEC;AAGD,8CAKC;AA9ED,6CAA+C;AAE/C,MAAM,UAAU,GAAG,IAAI,+BAAiB,EAAU,CAAA;AAElD;;;GAGG;AACH,MAAM,kBAAkB,GAAG,uBAAuB,CAAA;AAElD;;;GAGG;AACH,MAAM,kBAAkB,GAAG,aAAa,CAAA;AAExC,MAAM,WAAW,GAAG,6CAA6C,CAAA;AACjE,MAAM,WAAW,GAAG,mEAAmE,CAAA;AAEvF,SAAS,UAAU,CAAC,KAAoC;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAA;IACzC,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAChC,OAAsD;IAEtD,+EAA+E;IAC/E,qEAAqE;IACrE,MAAM,KAAK,GAAkD,EAAE,CAAA;IAC/D,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,KAAK,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAA;IAExE,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAA;IACnD,MAAM,UAAU,GAAG,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IAC1D,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC,CAAC,CAAC,CAAA;IAEpC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAA;IACpD,MAAM,WAAW,GAAG,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IAC7D,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC,CAAC,CAAC,CAAA;IAEtC,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,uEAAuE;AACvE,SAAgB,YAAY,CAAI,OAA2B,EAAE,EAAW;IACtE,OAAO,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;AACrD,CAAC;AAED,yDAAyD;AACzD,SAAgB,cAAc;IAC5B,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAA;AAC9B,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY;IAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,SAAS,CAAA;AACpF,CAAC;AAED,kFAAkF;AAClF,SAAgB,iBAAiB;IAC/B,MAAM,OAAO,GAAG,cAAc,EAAE,CAAA;IAChC,MAAM,OAAO,GAAG,YAAY,EAAE,CAAA;IAC9B,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAA;IAC1C,OAAO,YAAY,OAAO,WAAW,OAAO,EAAE,CAAA;AAChD,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Every storage location this package reads or writes, defined once.
3
+ *
4
+ * These are contracts, not conveniences: each source-map path has a writer in
5
+ * `/tools` and a reader in `/functions`, and they used to be independent string
6
+ * literals in different entry points with nothing enforcing that they matched.
7
+ * When they disagree, symbolication does not fail — it falls through and returns
8
+ * the minified frames, which looks like "my maps never uploaded".
9
+ *
10
+ * #36 is what that costs: `.release` was written in three places, none of them
11
+ * the writer, so the release check never ran and every stack resolved against
12
+ * whatever happened to be embedded.
13
+ *
14
+ * `/functions` cannot import from `/tools` without a cross-entry-point
15
+ * dependency, which is why this lives in `shared/` beside `error.ts` and
16
+ * `severity.ts` rather than being exported from either side.
17
+ *
18
+ * Cloud Storage object names always use `/`; local paths are built with
19
+ * `path.join` by the caller. The two are kept apart on purpose — a Windows
20
+ * separator in a GCS object name is a different object.
21
+ */
22
+ /** Cloud Storage prefix holding one directory per release. */
23
+ export declare const SOURCEMAP_PREFIX = "sourcemaps";
24
+ /** Cloud Storage prefix holding one directory per log entry. */
25
+ export declare const ATTACHMENT_PREFIX = "logAttachments";
26
+ /**
27
+ * Directory inside the deployed backend holding the current release's maps,
28
+ * relative to the process working directory. Checked before Cloud Storage so
29
+ * the common case costs no network call.
30
+ */
31
+ export declare const EMBEDDED_DIR: string;
32
+ /**
33
+ * Names the release the embedded maps belong to.
34
+ *
35
+ * Without it the runtime cannot tell "this stack is from the deployed release"
36
+ * from "this stack is from an older one" — the embedded directory is keyed only
37
+ * by filename, so an old stack naming a bundle that still exists would be
38
+ * resolved with the current map, giving confidently wrong line numbers.
39
+ */
40
+ export declare const RELEASE_MARKER = ".release";
41
+ /**
42
+ * Cloud Storage object name for one release's map of one bundle.
43
+ *
44
+ * `bundleFileName` is the bundle as it appears in a stack trace — `app-4f2a.js`,
45
+ * without the `.map`. The suffix belongs to the contract, not to either caller,
46
+ * which is what kept the writer and reader agreeing by accident before.
47
+ */
48
+ export declare function storageMapPath(releaseId: string, bundleFileName: string, prefix?: string): string;
49
+ /** Cloud Storage object name for one attachment of one log entry. */
50
+ export declare function attachmentPath(logId: string, name: string, prefix?: string): string;
51
+ /** Local directory holding the embedded maps, under `baseDir`. */
52
+ export declare function embeddedDir(baseDir: string): string;
53
+ /** Local path of one embedded map, under `baseDir`. */
54
+ export declare function embeddedMapPath(baseDir: string, bundleFileName: string): string;
55
+ /** Local path of the release marker, under `baseDir`. */
56
+ export declare function embeddedMarkerPath(baseDir: string): string;
57
+ /** Strip the `.map` suffix from a map filename to get the bundle name. */
58
+ export declare function bundleNameOf(mapFileName: string): string;
59
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/shared/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,8DAA8D;AAC9D,eAAO,MAAM,gBAAgB,eAAe,CAAA;AAE5C,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,mBAAmB,CAAA;AAEjD;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAAyC,CAAA;AAElE;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,aAAa,CAAA;AAExC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,MAAM,GAAE,MAAyB,GAChC,MAAM,CAER;AAED,qEAAqE;AACrE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,MAA0B,GACjC,MAAM,CAER;AAeD,kEAAkE;AAClE,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,uDAAuD;AACvD,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAE/E;AAED,yDAAyD;AACzD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ /**
3
+ * Every storage location this package reads or writes, defined once.
4
+ *
5
+ * These are contracts, not conveniences: each source-map path has a writer in
6
+ * `/tools` and a reader in `/functions`, and they used to be independent string
7
+ * literals in different entry points with nothing enforcing that they matched.
8
+ * When they disagree, symbolication does not fail — it falls through and returns
9
+ * the minified frames, which looks like "my maps never uploaded".
10
+ *
11
+ * #36 is what that costs: `.release` was written in three places, none of them
12
+ * the writer, so the release check never ran and every stack resolved against
13
+ * whatever happened to be embedded.
14
+ *
15
+ * `/functions` cannot import from `/tools` without a cross-entry-point
16
+ * dependency, which is why this lives in `shared/` beside `error.ts` and
17
+ * `severity.ts` rather than being exported from either side.
18
+ *
19
+ * Cloud Storage object names always use `/`; local paths are built with
20
+ * `path.join` by the caller. The two are kept apart on purpose — a Windows
21
+ * separator in a GCS object name is a different object.
22
+ */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || (function () {
40
+ var ownKeys = function(o) {
41
+ ownKeys = Object.getOwnPropertyNames || function (o) {
42
+ var ar = [];
43
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
+ return ar;
45
+ };
46
+ return ownKeys(o);
47
+ };
48
+ return function (mod) {
49
+ if (mod && mod.__esModule) return mod;
50
+ var result = {};
51
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
+ __setModuleDefault(result, mod);
53
+ return result;
54
+ };
55
+ })();
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.RELEASE_MARKER = exports.EMBEDDED_DIR = exports.ATTACHMENT_PREFIX = exports.SOURCEMAP_PREFIX = void 0;
58
+ exports.storageMapPath = storageMapPath;
59
+ exports.attachmentPath = attachmentPath;
60
+ exports.embeddedDir = embeddedDir;
61
+ exports.embeddedMapPath = embeddedMapPath;
62
+ exports.embeddedMarkerPath = embeddedMarkerPath;
63
+ exports.bundleNameOf = bundleNameOf;
64
+ const path = __importStar(require("path"));
65
+ /** Cloud Storage prefix holding one directory per release. */
66
+ exports.SOURCEMAP_PREFIX = 'sourcemaps';
67
+ /** Cloud Storage prefix holding one directory per log entry. */
68
+ exports.ATTACHMENT_PREFIX = 'logAttachments';
69
+ /**
70
+ * Directory inside the deployed backend holding the current release's maps,
71
+ * relative to the process working directory. Checked before Cloud Storage so
72
+ * the common case costs no network call.
73
+ */
74
+ exports.EMBEDDED_DIR = path.join(exports.SOURCEMAP_PREFIX, 'current');
75
+ /**
76
+ * Names the release the embedded maps belong to.
77
+ *
78
+ * Without it the runtime cannot tell "this stack is from the deployed release"
79
+ * from "this stack is from an older one" — the embedded directory is keyed only
80
+ * by filename, so an old stack naming a bundle that still exists would be
81
+ * resolved with the current map, giving confidently wrong line numbers.
82
+ */
83
+ exports.RELEASE_MARKER = '.release';
84
+ /**
85
+ * Cloud Storage object name for one release's map of one bundle.
86
+ *
87
+ * `bundleFileName` is the bundle as it appears in a stack trace — `app-4f2a.js`,
88
+ * without the `.map`. The suffix belongs to the contract, not to either caller,
89
+ * which is what kept the writer and reader agreeing by accident before.
90
+ */
91
+ function storageMapPath(releaseId, bundleFileName, prefix = exports.SOURCEMAP_PREFIX) {
92
+ return `${trimPrefix(prefix)}/${releaseId}/${bundleFileName}.map`;
93
+ }
94
+ /** Cloud Storage object name for one attachment of one log entry. */
95
+ function attachmentPath(logId, name, prefix = exports.ATTACHMENT_PREFIX) {
96
+ return `${trimPrefix(prefix)}/${logId}/${name}`;
97
+ }
98
+ /**
99
+ * Normalise a caller-supplied prefix.
100
+ *
101
+ * A prefix is a directory, and people write directories with a trailing slash.
102
+ * Passing `'fsl/'` unnormalised yields `fsl//abc/app.js.map`, which is a
103
+ * *different* Storage object from `fsl/abc/app.js.map` — GCS keys are opaque
104
+ * strings, so the double slash is not collapsed and the reader would miss.
105
+ * Leading slashes are dropped for the same reason.
106
+ */
107
+ function trimPrefix(prefix) {
108
+ return prefix.replace(/^\/+/, '').replace(/\/+$/, '');
109
+ }
110
+ /** Local directory holding the embedded maps, under `baseDir`. */
111
+ function embeddedDir(baseDir) {
112
+ return path.join(baseDir, exports.EMBEDDED_DIR);
113
+ }
114
+ /** Local path of one embedded map, under `baseDir`. */
115
+ function embeddedMapPath(baseDir, bundleFileName) {
116
+ return path.join(embeddedDir(baseDir), `${bundleFileName}.map`);
117
+ }
118
+ /** Local path of the release marker, under `baseDir`. */
119
+ function embeddedMarkerPath(baseDir) {
120
+ return path.join(embeddedDir(baseDir), exports.RELEASE_MARKER);
121
+ }
122
+ /** Strip the `.map` suffix from a map filename to get the bundle name. */
123
+ function bundleNameOf(mapFileName) {
124
+ return mapFileName.replace(/\.map$/, '');
125
+ }
126
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/shared/paths.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCH,wCAMC;AAGD,wCAMC;AAgBD,kCAEC;AAGD,0CAEC;AAGD,gDAEC;AAGD,oCAEC;AAhFD,2CAA4B;AAE5B,8DAA8D;AACjD,QAAA,gBAAgB,GAAG,YAAY,CAAA;AAE5C,gEAAgE;AACnD,QAAA,iBAAiB,GAAG,gBAAgB,CAAA;AAEjD;;;;GAIG;AACU,QAAA,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,wBAAgB,EAAE,SAAS,CAAC,CAAA;AAElE;;;;;;;GAOG;AACU,QAAA,cAAc,GAAG,UAAU,CAAA;AAExC;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,SAAiB,EACjB,cAAsB,EACtB,SAAiB,wBAAgB;IAEjC,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,SAAS,IAAI,cAAc,MAAM,CAAA;AACnE,CAAC;AAED,qEAAqE;AACrE,SAAgB,cAAc,CAC5B,KAAa,EACb,IAAY,EACZ,SAAiB,yBAAiB;IAElC,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAA;AACjD,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,UAAU,CAAC,MAAc;IAChC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACvD,CAAC;AAED,kEAAkE;AAClE,SAAgB,WAAW,CAAC,OAAe;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,oBAAY,CAAC,CAAA;AACzC,CAAC;AAED,uDAAuD;AACvD,SAAgB,eAAe,CAAC,OAAe,EAAE,cAAsB;IACrE,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,cAAc,MAAM,CAAC,CAAA;AACjE,CAAC;AAED,yDAAyD;AACzD,SAAgB,kBAAkB,CAAC,OAAe;IAChD,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,sBAAc,CAAC,CAAA;AACxD,CAAC;AAED,0EAA0E;AAC1E,SAAgB,YAAY,CAAC,WAAmB;IAC9C,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AAC1C,CAAC"}
@@ -1,9 +1,30 @@
1
1
  import type { LogSeverity } from './types';
2
2
  /**
3
3
  * Single source of truth for severity ranking. Lower number = more severe.
4
+ *
5
+ * NOTICE ranks between WARNING and INFO, matching Cloud Logging's own ordering
6
+ * (INFO 200, NOTICE 300, WARNING 400). Its official meaning — "normal but
7
+ * significant events" — is where user feedback belongs: more important than
8
+ * routine status, not a warning about system health.
4
9
  * Both the client and functions loggers filter against this, so a change here
5
10
  * keeps min-level behaviour consistent on both sides of the wire.
6
11
  */
7
12
  export declare const SEVERITY_ORDER: Record<LogSeverity, number>;
8
13
  export declare const SEVERITIES: LogSeverity[];
14
+ /** Is this a severity the loggers know how to dispatch? */
15
+ export declare function isLogSeverity(value: unknown): value is LogSeverity;
16
+ /**
17
+ * Label marking an entry as user feedback rather than a system event.
18
+ *
19
+ * The severity floors are volume and cost controls for events the system emits.
20
+ * Feedback is a person sending a message that happens to travel the same pipe,
21
+ * so it is exempt from them — on BOTH sides, since the client and the functions
22
+ * logger each have their own floor and either one would drop it silently.
23
+ *
24
+ * The exemption keys on this marker, not on the NOTICE severity. A NOTICE
25
+ * emitted for anything else still respects the floor, otherwise we would have
26
+ * built a severity level that silently defeats filtering.
27
+ */
28
+ export declare const FEEDBACK_LABEL = "feedback";
29
+ export declare function isFeedback(labels: Record<string, unknown> | undefined): boolean;
9
30
  //# sourceMappingURL=severity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"severity.d.ts","sourceRoot":"","sources":["../../src/shared/severity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAKtD,CAAA;AAED,eAAO,MAAM,UAAU,EAAkC,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"severity.d.ts","sourceRoot":"","sources":["../../src/shared/severity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAMtD,CAAA;AAED,eAAO,MAAM,UAAU,EAAkC,WAAW,EAAE,CAAA;AAEtE,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,aAAa,CAAA;AAExC,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,OAAO,CAE/E"}
@@ -1,16 +1,44 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SEVERITIES = exports.SEVERITY_ORDER = void 0;
3
+ exports.FEEDBACK_LABEL = exports.SEVERITIES = exports.SEVERITY_ORDER = void 0;
4
+ exports.isLogSeverity = isLogSeverity;
5
+ exports.isFeedback = isFeedback;
4
6
  /**
5
7
  * Single source of truth for severity ranking. Lower number = more severe.
8
+ *
9
+ * NOTICE ranks between WARNING and INFO, matching Cloud Logging's own ordering
10
+ * (INFO 200, NOTICE 300, WARNING 400). Its official meaning — "normal but
11
+ * significant events" — is where user feedback belongs: more important than
12
+ * routine status, not a warning about system health.
6
13
  * Both the client and functions loggers filter against this, so a change here
7
14
  * keeps min-level behaviour consistent on both sides of the wire.
8
15
  */
9
16
  exports.SEVERITY_ORDER = {
10
17
  ERROR: 0,
11
18
  WARNING: 1,
12
- INFO: 2,
13
- DEBUG: 3,
19
+ NOTICE: 2,
20
+ INFO: 3,
21
+ DEBUG: 4,
14
22
  };
15
23
  exports.SEVERITIES = Object.keys(exports.SEVERITY_ORDER);
24
+ /** Is this a severity the loggers know how to dispatch? */
25
+ function isLogSeverity(value) {
26
+ return typeof value === 'string' && Object.prototype.hasOwnProperty.call(exports.SEVERITY_ORDER, value);
27
+ }
28
+ /**
29
+ * Label marking an entry as user feedback rather than a system event.
30
+ *
31
+ * The severity floors are volume and cost controls for events the system emits.
32
+ * Feedback is a person sending a message that happens to travel the same pipe,
33
+ * so it is exempt from them — on BOTH sides, since the client and the functions
34
+ * logger each have their own floor and either one would drop it silently.
35
+ *
36
+ * The exemption keys on this marker, not on the NOTICE severity. A NOTICE
37
+ * emitted for anything else still respects the floor, otherwise we would have
38
+ * built a severity level that silently defeats filtering.
39
+ */
40
+ exports.FEEDBACK_LABEL = 'feedback';
41
+ function isFeedback(labels) {
42
+ return labels?.[exports.FEEDBACK_LABEL] === 'true';
43
+ }
16
44
  //# sourceMappingURL=severity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"severity.js","sourceRoot":"","sources":["../../src/shared/severity.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,cAAc,GAAgC;IACzD,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACT,CAAA;AAEY,QAAA,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,sBAAc,CAAkB,CAAA"}
1
+ {"version":3,"file":"severity.js","sourceRoot":"","sources":["../../src/shared/severity.ts"],"names":[],"mappings":";;;AAuBA,sCAEC;AAgBD,gCAEC;AAzCD;;;;;;;;;GASG;AACU,QAAA,cAAc,GAAgC;IACzD,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACT,CAAA;AAEY,QAAA,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,sBAAc,CAAkB,CAAA;AAEtE,2DAA2D;AAC3D,SAAgB,aAAa,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,sBAAc,EAAE,KAAK,CAAC,CAAA;AACjG,CAAC;AAED;;;;;;;;;;;GAWG;AACU,QAAA,cAAc,GAAG,UAAU,CAAA;AAExC,SAAgB,UAAU,CAAC,MAA2C;IACpE,OAAO,MAAM,EAAE,CAAC,sBAAc,CAAC,KAAK,MAAM,CAAA;AAC5C,CAAC"}
@@ -1,4 +1,4 @@
1
- export type LogSeverity = 'ERROR' | 'WARNING' | 'INFO' | 'DEBUG';
1
+ export type LogSeverity = 'ERROR' | 'WARNING' | 'NOTICE' | 'INFO' | 'DEBUG';
2
2
  export interface BaseLabels {
3
3
  appId: string;
4
4
  userId?: string;
@@ -8,7 +8,6 @@ export interface BaseLabels {
8
8
  releaseId?: string;
9
9
  errorType?: string;
10
10
  errorCategory?: string;
11
- activity?: string;
12
11
  }
13
12
  export interface ErrorPayload {
14
13
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAA;AAEhE,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,WAAW,CAAA;IACrB,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACvD,WAAW,CAAC,EAAE;QACZ,WAAW,CAAC,EAAE,eAAe,EAAE,CAAA;QAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QACjC,KAAK,CAAC,EAAE,Y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