@genesislcap/foundation-utils 15.90.4 → 15.92.0-HT-305.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,6 +61,7 @@ export interface ErrorMonitoringIntegration {
61
61
  *
62
62
  * @remarks
63
63
  * The names match Sentry's `init` options. Any other keys from `initOptions` are passed through.
64
+ * The limits described below apply while `stripSensitiveData` is on, as it is by default.
64
65
  * @public
65
66
  */
66
67
  export interface ErrorMonitoringInitOptions {
@@ -86,6 +87,10 @@ export interface ErrorMonitoringInitOptions {
86
87
  }
87
88
  /**
88
89
  * Extra options for the client's `init`, merged into what {@link setupErrorMonitoring} passes.
90
+ *
91
+ * @remarks
92
+ * The defaults described below apply unless `stripSensitiveData` is `false`, which keeps every
93
+ * default integration, breadcrumb and URL, and leaves data collection to the SDK's defaults.
89
94
  * @public
90
95
  */
91
96
  export interface ErrorMonitoringExtraInitOptions {
@@ -111,7 +116,8 @@ export interface ErrorMonitoringExtraInitOptions {
111
116
  }
112
117
  /**
113
118
  * An error-monitoring SDK, or an adapter for one. The method names and shapes match the Sentry
114
- * browser SDKs, so `import * as Sentry from '@sentry/react'` can be passed as is.
119
+ * browser SDKs, so an object of the SDK's own functions works as is. Pass those functions, not the
120
+ * SDK's namespace: a namespace passed as a value keeps every export in the bundle.
115
121
  * @public
116
122
  */
117
123
  export interface ErrorMonitoringClient {
@@ -151,6 +157,23 @@ export interface ErrorMonitoringOptions {
151
157
  init?: (options: ErrorMonitoringInitOptions) => unknown;
152
158
  /** Records non-error foundation logs as breadcrumbs. Defaults to `true`. */
153
159
  breadcrumbs?: boolean;
160
+ /**
161
+ * Keeps logged data and page data out of what is sent. Defaults to `true`; set it to `false` only
162
+ * in development environments, knowing that it sends their credentials too.
163
+ *
164
+ * @remarks
165
+ * Set to `false`, logs carry their logged data (`extra.arguments` on events, `data.arguments` on
166
+ * breadcrumbs), logged errors keep their own fields, and the SDK runs with its own default
167
+ * integrations and data collection, under the app's `initOptions`. Console, click and input
168
+ * breadcrumbs, URL query strings and fragments are all kept. Foundation logger console
169
+ * breadcrumbs are still dropped, since the reporter's breadcrumbs carry the same logs.
170
+ *
171
+ * Logged arguments can hold passwords and session tokens, and debug logs are recorded by default,
172
+ * so turning this off sends the credentials of developers' and shared test accounts to the
173
+ * monitoring service. Only the service's own server-side scrubbing, such as Sentry's for keys like
174
+ * `password` and `token`, then keeps them out of stored events.
175
+ */
176
+ stripSensitiveData?: boolean;
154
177
  }
155
178
  /**
156
179
  * Creates a global log reporter that sends foundation logger output to a monitoring client.
@@ -165,6 +188,9 @@ export interface ErrorMonitoringOptions {
165
188
  * and `Error` cause. Other logs become breadcrumbs unless `breadcrumbs` is `false`. A failing client
166
189
  * never breaks logging.
167
190
  *
191
+ * With `stripSensitiveData: false`, the other logged arguments are sent too, as `extra.arguments` on
192
+ * events and `data.arguments` on breadcrumbs, and logged errors are sent as they are.
193
+ *
168
194
  * This covers only what the reporter sends. SDKs that record console calls, such as the Sentry
169
195
  * browser SDKs by default, also record foundation logger output as console breadcrumbs with the
170
196
  * logged arguments as data. When wiring a client by hand, drop those in the SDK's
@@ -173,10 +199,11 @@ export interface ErrorMonitoringOptions {
173
199
  * {@link setupErrorMonitoring} does both for you; use this directly to wire a client by hand.
174
200
  *
175
201
  * @param client - The monitoring client.
176
- * @param options - Set `breadcrumbs: false` to skip breadcrumbs.
202
+ * @param options - Set `breadcrumbs: false` to skip breadcrumbs, and `stripSensitiveData: false` to
203
+ * send logged data.
177
204
  * @public
178
205
  */
179
- export declare const createErrorMonitoringReporter: (client: ErrorMonitoringClient, { breadcrumbs }?: Pick<ErrorMonitoringOptions, "breadcrumbs">) => ConsolaReporter;
206
+ export declare const createErrorMonitoringReporter: (client: ErrorMonitoringClient, { breadcrumbs, stripSensitiveData, }?: Pick<ErrorMonitoringOptions, "breadcrumbs" | "stripSensitiveData">) => ConsolaReporter;
180
207
  /**
181
208
  * True for a console breadcrumb written by a foundation logger.
182
209
  *
@@ -211,6 +238,9 @@ export declare const isFoundationLoggerConsoleBreadcrumb: (breadcrumb: ErrorMoni
211
238
  * every foundation logger, including those Genesis packages create at import time, are reported,
212
239
  * and other logs become breadcrumbs. Only log messages and exceptions are sent, never logged data.
213
240
  *
241
+ * `stripSensitiveData: false` lifts all of these limits, for development environments: logged data
242
+ * is sent, and the SDK collects what its own defaults collect.
243
+ *
214
244
  * Logs written while an asynchronous `init` runs (the last 100) are reported once it finishes. If
215
245
  * `init` throws or rejects, for example when a lazily loaded SDK fails to download, it warns on the
216
246
  * console and resolves `false` rather than rejecting.
@@ -226,17 +256,20 @@ export declare const isFoundationLoggerConsoleBreadcrumb: (breadcrumb: ErrorMoni
226
256
  *
227
257
  * @example
228
258
  * ```ts
229
- * import * as Sentry from '@sentry/react';
259
+ * import { addBreadcrumb, captureException, captureMessage, init } from '@sentry/react';
230
260
  * import { setupErrorMonitoring } from '@genesislcap/foundation-utils';
231
261
  *
232
- * setupErrorMonitoring(Sentry, {
233
- * dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',
234
- * environment: () =>
235
- * document.querySelector<HTMLMetaElement>('meta[name="error-monitoring-environment"]')?.content,
236
- * });
262
+ * setupErrorMonitoring(
263
+ * { addBreadcrumb, captureException, captureMessage, init },
264
+ * {
265
+ * dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',
266
+ * environment: () =>
267
+ * document.querySelector<HTMLMetaElement>('meta[name="error-monitoring-environment"]')?.content,
268
+ * },
269
+ * );
237
270
  * ```
238
271
  *
239
- * @param client - The monitoring SDK (for example the Sentry namespace) or an adapter for one.
272
+ * @param client - The monitoring SDK's functions (for example Sentry's) or an adapter for one.
240
273
  * @param options - The DSN, the environment, and extra init options.
241
274
  * @returns Whether this call enabled monitoring.
242
275
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"error-monitoring.d.ts","sourceRoot":"","sources":["../../../src/error-monitoring/error-monitoring.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe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;;;;;;;;;;;GAyDG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,OAAO,CAAC,CA4FlB"}
@@ -57,6 +57,17 @@ const spanOp = ({ op, attributes, data }) => {
57
57
  const value = (_a = op !== null && op !== void 0 ? op : attributes === null || attributes === void 0 ? void 0 : attributes['sentry.op']) !== null && _a !== void 0 ? _a : data === null || data === void 0 ? void 0 : data['sentry.op'];
58
58
  return typeof value === 'string' ? value : undefined;
59
59
  };
60
+ const withoutSpanUrlQueries = (span) => {
61
+ var _a;
62
+ const isResource = (_a = spanOp(span)) === null || _a === void 0 ? void 0 : _a.startsWith('resource.');
63
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, span), (span.attributes && { attributes: withoutSpanUrlParts(span.attributes) })), (span.data && { data: withoutSpanUrlParts(span.data) })), (isResource && span.name && { name: withoutQuery(span.name) })), (isResource && span.description && { description: withoutQuery(span.description) }));
64
+ };
65
+ const withoutPageUrlQuery = (event) => {
66
+ var _a;
67
+ const url = (_a = event.request) === null || _a === void 0 ? void 0 : _a.url;
68
+ return typeof url === 'string'
69
+ ? Object.assign(Object.assign({}, event), { request: Object.assign(Object.assign({}, event.request), { url: withoutQuery(url) }) }) : event;
70
+ };
60
71
  const LOCAL_HOSTNAMES = new Set(['localhost', '0.0.0.0', 'host.docker.internal']);
61
72
  const LOCAL_HOSTNAME_SUFFIXES = ['.localhost', '.local'];
62
73
  const IPV4 = /^\d{1,3}(\.\d{1,3}){3}$/;
@@ -132,6 +143,8 @@ const withoutOwnFields = (error, depth = 0) => {
132
143
  }
133
144
  return copy;
134
145
  };
146
+ /** The logged arguments other than the message string and the reported error. */
147
+ const loggedData = (args, reported) => args.filter((arg, index) => (!reported || arg !== reported) && !(index === 0 && typeof arg === 'string'));
135
148
  /**
136
149
  * Creates a global log reporter that sends foundation logger output to a monitoring client.
137
150
  *
@@ -145,6 +158,9 @@ const withoutOwnFields = (error, depth = 0) => {
145
158
  * and `Error` cause. Other logs become breadcrumbs unless `breadcrumbs` is `false`. A failing client
146
159
  * never breaks logging.
147
160
  *
161
+ * With `stripSensitiveData: false`, the other logged arguments are sent too, as `extra.arguments` on
162
+ * events and `data.arguments` on breadcrumbs, and logged errors are sent as they are.
163
+ *
148
164
  * This covers only what the reporter sends. SDKs that record console calls, such as the Sentry
149
165
  * browser SDKs by default, also record foundation logger output as console breadcrumbs with the
150
166
  * logged arguments as data. When wiring a client by hand, drop those in the SDK's
@@ -153,28 +169,28 @@ const withoutOwnFields = (error, depth = 0) => {
153
169
  * {@link setupErrorMonitoring} does both for you; use this directly to wire a client by hand.
154
170
  *
155
171
  * @param client - The monitoring client.
156
- * @param options - Set `breadcrumbs: false` to skip breadcrumbs.
172
+ * @param options - Set `breadcrumbs: false` to skip breadcrumbs, and `stripSensitiveData: false` to
173
+ * send logged data.
157
174
  * @public
158
175
  */
159
- export const createErrorMonitoringReporter = (client, { breadcrumbs = true } = {}) => ({
176
+ export const createErrorMonitoringReporter = (client, { breadcrumbs = true, stripSensitiveData = true, } = {}) => ({
160
177
  log: ({ type, tag, args }) => {
161
178
  var _a, _b;
162
179
  try {
163
180
  const message = logMessage(args);
164
181
  if (!REPORTED_LOG_TYPES.has(type)) {
165
182
  if (breadcrumbs) {
166
- (_a = client.addBreadcrumb) === null || _a === void 0 ? void 0 : _a.call(client, {
167
- category: tag || 'logger',
168
- level: (_b = BREADCRUMB_LEVELS[type]) !== null && _b !== void 0 ? _b : 'info',
169
- message,
170
- });
183
+ const data = stripSensitiveData ? [] : loggedData(args);
184
+ (_a = client.addBreadcrumb) === null || _a === void 0 ? void 0 : _a.call(client, Object.assign({ category: tag || 'logger', level: (_b = BREADCRUMB_LEVELS[type]) !== null && _b !== void 0 ? _b : 'info', message }, (data.length > 0 && { data: { arguments: data } })));
171
185
  }
172
186
  return;
173
187
  }
174
- const context = Object.assign({ level: type === 'fatal' ? 'fatal' : 'error', tags: { logger: tag || 'unknown' } }, (message ? { extra: { message } } : {}));
175
188
  const error = args.find((arg) => arg instanceof Error);
189
+ const data = stripSensitiveData ? [] : loggedData(args, error);
190
+ const extra = Object.assign(Object.assign({}, (message ? { message } : {})), (data.length > 0 && { arguments: data }));
191
+ const context = Object.assign({ level: type === 'fatal' ? 'fatal' : 'error', tags: { logger: tag || 'unknown' } }, (Object.keys(extra).length > 0 && { extra }));
176
192
  if (error) {
177
- client.captureException(withoutOwnFields(error), context);
193
+ client.captureException(stripSensitiveData ? withoutOwnFields(error) : error, context);
178
194
  return;
179
195
  }
180
196
  client.captureMessage(`${tag || 'unknown'}: ${message !== null && message !== void 0 ? message : '[no message]'}`, context);
@@ -205,6 +221,24 @@ export const isFoundationLoggerConsoleBreadcrumb = (breadcrumb) => {
205
221
  typeof style === 'string' &&
206
222
  CONSOLA_BADGE_STYLE.test(style));
207
223
  };
224
+ const DEFAULT_LIMITS = {
225
+ dataCollection: DEFAULT_DATA_COLLECTION,
226
+ keepsDefaultIntegration: ({ name }) => KEPT_DEFAULT_INTEGRATIONS.has(name),
227
+ dropsBreadcrumb: ({ category }) => DROPPED_BREADCRUMB_CATEGORIES.has(category !== null && category !== void 0 ? category : ''),
228
+ breadcrumb: withoutUrlQueries,
229
+ event: withoutPageUrlQuery,
230
+ span: withoutSpanUrlQueries,
231
+ };
232
+ const unchanged = (value) => value;
233
+ const NO_LIMITS = {
234
+ dataCollection: {},
235
+ keepsDefaultIntegration: () => true,
236
+ // The reporter's breadcrumbs record the same logs, with their data.
237
+ dropsBreadcrumb: isFoundationLoggerConsoleBreadcrumb,
238
+ breadcrumb: unchanged,
239
+ event: unchanged,
240
+ span: unchanged,
241
+ };
208
242
  let removeActiveReporter;
209
243
  let latestSetup = 0;
210
244
  const bufferLogs = () => {
@@ -241,6 +275,9 @@ const bufferLogs = () => {
241
275
  * every foundation logger, including those Genesis packages create at import time, are reported,
242
276
  * and other logs become breadcrumbs. Only log messages and exceptions are sent, never logged data.
243
277
  *
278
+ * `stripSensitiveData: false` lifts all of these limits, for development environments: logged data
279
+ * is sent, and the SDK collects what its own defaults collect.
280
+ *
244
281
  * Logs written while an asynchronous `init` runs (the last 100) are reported once it finishes. If
245
282
  * `init` throws or rejects, for example when a lazily loaded SDK fails to download, it warns on the
246
283
  * console and resolves `false` rather than rejecting.
@@ -256,17 +293,20 @@ const bufferLogs = () => {
256
293
  *
257
294
  * @example
258
295
  * ```ts
259
- * import * as Sentry from '@sentry/react';
296
+ * import { addBreadcrumb, captureException, captureMessage, init } from '@sentry/react';
260
297
  * import { setupErrorMonitoring } from '@genesislcap/foundation-utils';
261
298
  *
262
- * setupErrorMonitoring(Sentry, {
263
- * dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',
264
- * environment: () =>
265
- * document.querySelector<HTMLMetaElement>('meta[name="error-monitoring-environment"]')?.content,
266
- * });
299
+ * setupErrorMonitoring(
300
+ * { addBreadcrumb, captureException, captureMessage, init },
301
+ * {
302
+ * dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',
303
+ * environment: () =>
304
+ * document.querySelector<HTMLMetaElement>('meta[name="error-monitoring-environment"]')?.content,
305
+ * },
306
+ * );
267
307
  * ```
268
308
  *
269
- * @param client - The monitoring SDK (for example the Sentry namespace) or an adapter for one.
309
+ * @param client - The monitoring SDK's functions (for example Sentry's) or an adapter for one.
270
310
  * @param options - The DSN, the environment, and extra init options.
271
311
  * @returns Whether this call enabled monitoring.
272
312
  * @public
@@ -274,7 +314,8 @@ const bufferLogs = () => {
274
314
  export function setupErrorMonitoring(client, options) {
275
315
  return __awaiter(this, void 0, void 0, function* () {
276
316
  var _a;
277
- const { initOptions = {}, init, breadcrumbs = true } = options;
317
+ const { initOptions = {}, init, breadcrumbs = true, stripSensitiveData = true } = options;
318
+ const limits = stripSensitiveData ? DEFAULT_LIMITS : NO_LIMITS;
278
319
  latestSetup += 1;
279
320
  const setup = latestSetup;
280
321
  const isSuperseded = () => setup !== latestSetup;
@@ -289,24 +330,18 @@ export function setupErrorMonitoring(client, options) {
289
330
  try {
290
331
  const appBeforeBreadcrumb = initOptions.beforeBreadcrumb;
291
332
  const beforeBreadcrumb = (breadcrumb, hint) => {
292
- var _a;
293
- if (DROPPED_BREADCRUMB_CATEGORIES.has((_a = breadcrumb.category) !== null && _a !== void 0 ? _a : '')) {
333
+ if (limits.dropsBreadcrumb(breadcrumb)) {
294
334
  return null;
295
335
  }
296
- const kept = withoutUrlQueries(breadcrumb);
336
+ const kept = limits.breadcrumb(breadcrumb);
297
337
  return appBeforeBreadcrumb ? appBeforeBreadcrumb(kept, hint) : kept;
298
338
  };
299
- const withPageUrlStripped = (hook) => (event, hint) => {
300
- var _a;
301
- const url = (_a = event.request) === null || _a === void 0 ? void 0 : _a.url;
302
- const kept = typeof url === 'string'
303
- ? Object.assign(Object.assign({}, event), { request: Object.assign(Object.assign({}, event.request), { url: withoutQuery(url) }) }) : event;
339
+ const withPageUrlLimits = (hook) => (event, hint) => {
340
+ const kept = limits.event(event);
304
341
  return (initOptions[hook] ? initOptions[hook](kept, hint) : kept);
305
342
  };
306
343
  const beforeSendSpan = (span) => {
307
- var _a;
308
- const isResource = (_a = spanOp(span)) === null || _a === void 0 ? void 0 : _a.startsWith('resource.');
309
- const kept = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, span), (span.attributes && { attributes: withoutSpanUrlParts(span.attributes) })), (span.data && { data: withoutSpanUrlParts(span.data) })), (isResource && span.name && { name: withoutQuery(span.name) })), (isResource && span.description && { description: withoutQuery(span.description) }));
344
+ const kept = limits.span(span);
310
345
  return (initOptions.beforeSendSpan ? initOptions.beforeSendSpan(kept) : kept);
311
346
  };
312
347
  const isStaticLifecycle = initOptions.traceLifecycle === 'static';
@@ -316,7 +351,7 @@ export function setupErrorMonitoring(client, options) {
316
351
  }
317
352
  const appIntegrations = initOptions.integrations;
318
353
  const integrations = (defaults) => {
319
- const kept = defaults.filter(({ name }) => KEPT_DEFAULT_INTEGRATIONS.has(name));
354
+ const kept = defaults.filter(limits.keepsDefaultIntegration);
320
355
  if (typeof appIntegrations === 'function') {
321
356
  return appIntegrations(kept);
322
357
  }
@@ -325,9 +360,9 @@ export function setupErrorMonitoring(client, options) {
325
360
  return [...kept.filter(({ name }) => !addedNames.has(name)), ...added];
326
361
  };
327
362
  const resolvedInitOptions = Object.assign(Object.assign(Object.assign(Object.assign({}, initOptions), { dsn,
328
- environment, dataCollection: Object.assign(Object.assign({}, DEFAULT_DATA_COLLECTION), initOptions.dataCollection), integrations,
329
- beforeBreadcrumb, beforeSend: withPageUrlStripped('beforeSend') }), (isStaticLifecycle && {
330
- beforeSendTransaction: withPageUrlStripped('beforeSendTransaction'),
363
+ environment, dataCollection: Object.assign(Object.assign({}, limits.dataCollection), initOptions.dataCollection), integrations,
364
+ beforeBreadcrumb, beforeSend: withPageUrlLimits('beforeSend') }), (isStaticLifecycle && {
365
+ beforeSendTransaction: withPageUrlLimits('beforeSendTransaction'),
331
366
  })), { beforeSendSpan });
332
367
  try {
333
368
  yield (init ? init(resolvedInitOptions) : (_a = client.init) === null || _a === void 0 ? void 0 : _a.call(client, resolvedInitOptions));
@@ -339,7 +374,7 @@ export function setupErrorMonitoring(client, options) {
339
374
  if (isSuperseded()) {
340
375
  return false;
341
376
  }
342
- const reporter = createErrorMonitoringReporter(client, { breadcrumbs });
377
+ const reporter = createErrorMonitoringReporter(client, { breadcrumbs, stripSensitiveData });
343
378
  for (const log of buffer.logs) {
344
379
  reporter.log(...log);
345
380
  }
@@ -673,7 +673,7 @@
673
673
  {
674
674
  "kind": "Function",
675
675
  "canonicalReference": "@genesislcap/foundation-utils!createErrorMonitoringReporter:function(1)",
676
- "docComment": "/**\n * Creates a global log reporter that sends foundation logger output to a monitoring client.\n *\n * @remarks\n *\n * No logged data is sent: a report carries only the logger name, the level, the log's message (its first argument, when that is a string) and, for errors, the exception. Objects and any further arguments are left out, so credentials, personal or business data passed to a logger never reach the monitoring service. `error` and `fatal` logs become events: an exception when an `Error` was logged, with the message as `extra.message`, otherwise a message event. A logged `Error` with its own fields or a cause is sent as a copy that keeps only its name, message, stack and `Error` cause. Other logs become breadcrumbs unless `breadcrumbs` is `false`. A failing client never breaks logging.\n *\n * This covers only what the reporter sends. SDKs that record console calls, such as the Sentry browser SDKs by default, also record foundation logger output as console breadcrumbs with the logged arguments as data. When wiring a client by hand, drop those in the SDK's `beforeBreadcrumb` with {@link isFoundationLoggerConsoleBreadcrumb}.\n *\n * {@link setupErrorMonitoring} does both for you; use this directly to wire a client by hand.\n *\n * @param client - The monitoring client.\n *\n * @param options - Set `breadcrumbs: false` to skip breadcrumbs.\n *\n * @public\n */\n",
676
+ "docComment": "/**\n * Creates a global log reporter that sends foundation logger output to a monitoring client.\n *\n * @remarks\n *\n * No logged data is sent: a report carries only the logger name, the level, the log's message (its first argument, when that is a string) and, for errors, the exception. Objects and any further arguments are left out, so credentials, personal or business data passed to a logger never reach the monitoring service. `error` and `fatal` logs become events: an exception when an `Error` was logged, with the message as `extra.message`, otherwise a message event. A logged `Error` with its own fields or a cause is sent as a copy that keeps only its name, message, stack and `Error` cause. Other logs become breadcrumbs unless `breadcrumbs` is `false`. A failing client never breaks logging.\n *\n * With `stripSensitiveData: false`, the other logged arguments are sent too, as `extra.arguments` on events and `data.arguments` on breadcrumbs, and logged errors are sent as they are.\n *\n * This covers only what the reporter sends. SDKs that record console calls, such as the Sentry browser SDKs by default, also record foundation logger output as console breadcrumbs with the logged arguments as data. When wiring a client by hand, drop those in the SDK's `beforeBreadcrumb` with {@link isFoundationLoggerConsoleBreadcrumb}.\n *\n * {@link setupErrorMonitoring} does both for you; use this directly to wire a client by hand.\n *\n * @param client - The monitoring client.\n *\n * @param options - Set `breadcrumbs: false` to skip breadcrumbs, and `stripSensitiveData: false` to send logged data.\n *\n * @public\n */\n",
677
677
  "excerptTokens": [
678
678
  {
679
679
  "kind": "Content",
@@ -686,7 +686,7 @@
686
686
  },
687
687
  {
688
688
  "kind": "Content",
689
- "text": ", { breadcrumbs }?: "
689
+ "text": ", { breadcrumbs, stripSensitiveData, }?: "
690
690
  },
691
691
  {
692
692
  "kind": "Reference",
@@ -704,7 +704,7 @@
704
704
  },
705
705
  {
706
706
  "kind": "Content",
707
- "text": ", \"breadcrumbs\">"
707
+ "text": ", \"breadcrumbs\" | \"stripSensitiveData\">"
708
708
  },
709
709
  {
710
710
  "kind": "Content",
@@ -733,7 +733,7 @@
733
733
  "isOptional": false
734
734
  },
735
735
  {
736
- "parameterName": "{ breadcrumbs }",
736
+ "parameterName": "{ breadcrumbs, stripSensitiveData, }",
737
737
  "parameterTypeTokenRange": {
738
738
  "startIndex": 3,
739
739
  "endIndex": 7
@@ -5298,7 +5298,7 @@
5298
5298
  {
5299
5299
  "kind": "Interface",
5300
5300
  "canonicalReference": "@genesislcap/foundation-utils!ErrorMonitoringClient:interface",
5301
- "docComment": "/**\n * An error-monitoring SDK, or an adapter for one. The method names and shapes match the Sentry browser SDKs, so `import * as Sentry from '@sentry/react'` can be passed as is.\n *\n * @public\n */\n",
5301
+ "docComment": "/**\n * An error-monitoring SDK, or an adapter for one. The method names and shapes match the Sentry browser SDKs, so an object of the SDK's own functions works as is. Pass those functions, not the SDK's namespace: a namespace passed as a value keeps every export in the bundle.\n *\n * @public\n */\n",
5302
5302
  "excerptTokens": [
5303
5303
  {
5304
5304
  "kind": "Content",
@@ -5735,7 +5735,7 @@
5735
5735
  {
5736
5736
  "kind": "Interface",
5737
5737
  "canonicalReference": "@genesislcap/foundation-utils!ErrorMonitoringExtraInitOptions:interface",
5738
- "docComment": "/**\n * Extra options for the client's `init`, merged into what {@link setupErrorMonitoring} passes.\n *\n * @public\n */\n",
5738
+ "docComment": "/**\n * Extra options for the client's `init`, merged into what {@link setupErrorMonitoring} passes.\n *\n * @remarks\n *\n * The defaults described below apply unless `stripSensitiveData` is `false`, which keeps every default integration, breadcrumb and URL, and leaves data collection to the SDK's defaults.\n *\n * @public\n */\n",
5739
5739
  "excerptTokens": [
5740
5740
  {
5741
5741
  "kind": "Content",
@@ -6150,7 +6150,7 @@
6150
6150
  {
6151
6151
  "kind": "Interface",
6152
6152
  "canonicalReference": "@genesislcap/foundation-utils!ErrorMonitoringInitOptions:interface",
6153
- "docComment": "/**\n * Options {@link setupErrorMonitoring} passes to the client's `init`.\n *\n * @remarks\n *\n * The names match Sentry's `init` options. Any other keys from `initOptions` are passed through.\n *\n * @public\n */\n",
6153
+ "docComment": "/**\n * Options {@link setupErrorMonitoring} passes to the client's `init`.\n *\n * @remarks\n *\n * The names match Sentry's `init` options. Any other keys from `initOptions` are passed through. The limits described below apply while `stripSensitiveData` is on, as it is by default.\n *\n * @public\n */\n",
6154
6154
  "excerptTokens": [
6155
6155
  {
6156
6156
  "kind": "Content",
@@ -6737,6 +6737,33 @@
6737
6737
  "startIndex": 1,
6738
6738
  "endIndex": 2
6739
6739
  }
6740
+ },
6741
+ {
6742
+ "kind": "PropertySignature",
6743
+ "canonicalReference": "@genesislcap/foundation-utils!ErrorMonitoringOptions#stripSensitiveData:member",
6744
+ "docComment": "/**\n * Keeps logged data and page data out of what is sent. Defaults to `true`; set it to `false` only in development environments, knowing that it sends their credentials too.\n *\n * @remarks\n *\n * Set to `false`, logs carry their logged data (`extra.arguments` on events, `data.arguments` on breadcrumbs), logged errors keep their own fields, and the SDK runs with its own default integrations and data collection, under the app's `initOptions`. Console, click and input breadcrumbs, URL query strings and fragments are all kept. Foundation logger console breadcrumbs are still dropped, since the reporter's breadcrumbs carry the same logs.\n *\n * Logged arguments can hold passwords and session tokens, and debug logs are recorded by default, so turning this off sends the credentials of developers' and shared test accounts to the monitoring service. Only the service's own server-side scrubbing, such as Sentry's for keys like `password` and `token`, then keeps them out of stored events.\n */\n",
6745
+ "excerptTokens": [
6746
+ {
6747
+ "kind": "Content",
6748
+ "text": "stripSensitiveData?: "
6749
+ },
6750
+ {
6751
+ "kind": "Content",
6752
+ "text": "boolean"
6753
+ },
6754
+ {
6755
+ "kind": "Content",
6756
+ "text": ";"
6757
+ }
6758
+ ],
6759
+ "isReadonly": false,
6760
+ "isOptional": true,
6761
+ "releaseTag": "Public",
6762
+ "name": "stripSensitiveData",
6763
+ "propertyTypeTokenRange": {
6764
+ "startIndex": 1,
6765
+ "endIndex": 2
6766
+ }
6740
6767
  }
6741
6768
  ],
6742
6769
  "extendsTokenRanges": []
@@ -20006,7 +20033,7 @@
20006
20033
  {
20007
20034
  "kind": "Function",
20008
20035
  "canonicalReference": "@genesislcap/foundation-utils!setupErrorMonitoring:function(1)",
20009
- "docComment": "/**\n * Sets up error monitoring for a Genesis app in one call.\n *\n * @remarks\n *\n * Without a DSN, or when no environment applies (by default on local hosts such as `localhost` or a private IP address), it does nothing and resolves `false`. The environment defaults to the page's hostname, so one image promoted across environments reports each under its own name. To use names such as `uat`, read one the deployment sets rather than listing hostnames, which would show everyone who loads the bundle where the other environments are. Otherwise it:\n *\n * - initialises the client (`client.init`, or `options.init`) with the DSN, the environment, any `initOptions`, and defaults that keep page data out of what the SDK collects by itself: Sentry 11's `dataCollection` off for user info, cookies, headers but `User-Agent`, bodies and URL queries; only the default integrations that send nothing from the page (so not `Console`); no console, click or input breadcrumbs; and no query strings or fragments in breadcrumb URLs, the page URL, or span URLs and resource span names when tracing is on. The app's `beforeBreadcrumb`, `beforeSend`, `beforeSendTransaction` and `beforeSendSpan` run after these, and its `integrations` are added; - registers a global log reporter ({@link createErrorMonitoringReporter}), so errors logged by every foundation logger, including those Genesis packages create at import time, are reported, and other logs become breadcrumbs. Only log messages and exceptions are sent, never logged data.\n *\n * Logs written while an asynchronous `init` runs (the last 100) are reported once it finishes. If `init` throws or rejects, for example when a lazily loaded SDK fails to download, it warns on the console and resolves `false` rather than rejecting.\n *\n * Errors caught by the foundation-react-utils `AppErrorBoundary` and `TileErrorBoundary` are logged with their reference ID and component stack in the message, so they are reported too without an `onError`. Pair them with `onCaughtError` on the React root.\n *\n * Calling it again replaces the previous reporter, or removes it if the new call has no DSN or environment. When calls overlap, only the last one takes effect, and the earlier ones resolve `false`.\n *\n * @param client - The monitoring SDK (for example the Sentry namespace) or an adapter for one.\n *\n * @param options - The DSN, the environment, and extra init options.\n *\n * @returns Whether this call enabled monitoring.\n *\n * @example\n * ```ts\n * import * as Sentry from '@sentry/react';\n * import { setupErrorMonitoring } from '@genesislcap/foundation-utils';\n *\n * setupErrorMonitoring(Sentry, {\n * dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',\n * environment: () =>\n * document.querySelector<HTMLMetaElement>('meta[name=\"error-monitoring-environment\"]')?.content,\n * });\n * ```\n *\n * @public\n */\n",
20036
+ "docComment": "/**\n * Sets up error monitoring for a Genesis app in one call.\n *\n * @remarks\n *\n * Without a DSN, or when no environment applies (by default on local hosts such as `localhost` or a private IP address), it does nothing and resolves `false`. The environment defaults to the page's hostname, so one image promoted across environments reports each under its own name. To use names such as `uat`, read one the deployment sets rather than listing hostnames, which would show everyone who loads the bundle where the other environments are. Otherwise it:\n *\n * - initialises the client (`client.init`, or `options.init`) with the DSN, the environment, any `initOptions`, and defaults that keep page data out of what the SDK collects by itself: Sentry 11's `dataCollection` off for user info, cookies, headers but `User-Agent`, bodies and URL queries; only the default integrations that send nothing from the page (so not `Console`); no console, click or input breadcrumbs; and no query strings or fragments in breadcrumb URLs, the page URL, or span URLs and resource span names when tracing is on. The app's `beforeBreadcrumb`, `beforeSend`, `beforeSendTransaction` and `beforeSendSpan` run after these, and its `integrations` are added; - registers a global log reporter ({@link createErrorMonitoringReporter}), so errors logged by every foundation logger, including those Genesis packages create at import time, are reported, and other logs become breadcrumbs. Only log messages and exceptions are sent, never logged data.\n *\n * `stripSensitiveData: false` lifts all of these limits, for development environments: logged data is sent, and the SDK collects what its own defaults collect.\n *\n * Logs written while an asynchronous `init` runs (the last 100) are reported once it finishes. If `init` throws or rejects, for example when a lazily loaded SDK fails to download, it warns on the console and resolves `false` rather than rejecting.\n *\n * Errors caught by the foundation-react-utils `AppErrorBoundary` and `TileErrorBoundary` are logged with their reference ID and component stack in the message, so they are reported too without an `onError`. Pair them with `onCaughtError` on the React root.\n *\n * Calling it again replaces the previous reporter, or removes it if the new call has no DSN or environment. When calls overlap, only the last one takes effect, and the earlier ones resolve `false`.\n *\n * @param client - The monitoring SDK's functions (for example Sentry's) or an adapter for one.\n *\n * @param options - The DSN, the environment, and extra init options.\n *\n * @returns Whether this call enabled monitoring.\n *\n * @example\n * ```ts\n * import { addBreadcrumb, captureException, captureMessage, init } from '@sentry/react';\n * import { setupErrorMonitoring } from '@genesislcap/foundation-utils';\n *\n * setupErrorMonitoring(\n * { addBreadcrumb, captureException, captureMessage, init },\n * {\n * dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',\n * environment: () =>\n * document.querySelector<HTMLMetaElement>('meta[name=\"error-monitoring-environment\"]')?.content,\n * },\n * );\n * ```\n *\n * @public\n */\n",
20010
20037
  "excerptTokens": [
20011
20038
  {
20012
20039
  "kind": "Content",
@@ -167,6 +167,9 @@ export declare const createErrorMap: <TErrorDetailMap extends ErrorDetailMap>(lo
167
167
  * and `Error` cause. Other logs become breadcrumbs unless `breadcrumbs` is `false`. A failing client
168
168
  * never breaks logging.
169
169
  *
170
+ * With `stripSensitiveData: false`, the other logged arguments are sent too, as `extra.arguments` on
171
+ * events and `data.arguments` on breadcrumbs, and logged errors are sent as they are.
172
+ *
170
173
  * This covers only what the reporter sends. SDKs that record console calls, such as the Sentry
171
174
  * browser SDKs by default, also record foundation logger output as console breadcrumbs with the
172
175
  * logged arguments as data. When wiring a client by hand, drop those in the SDK's
@@ -175,10 +178,11 @@ export declare const createErrorMap: <TErrorDetailMap extends ErrorDetailMap>(lo
175
178
  * {@link setupErrorMonitoring} does both for you; use this directly to wire a client by hand.
176
179
  *
177
180
  * @param client - The monitoring client.
178
- * @param options - Set `breadcrumbs: false` to skip breadcrumbs.
181
+ * @param options - Set `breadcrumbs: false` to skip breadcrumbs, and `stripSensitiveData: false` to
182
+ * send logged data.
179
183
  * @public
180
184
  */
181
- export declare const createErrorMonitoringReporter: (client: ErrorMonitoringClient, { breadcrumbs }?: Pick<ErrorMonitoringOptions, "breadcrumbs">) => ConsolaReporter;
185
+ export declare const createErrorMonitoringReporter: (client: ErrorMonitoringClient, { breadcrumbs, stripSensitiveData, }?: Pick<ErrorMonitoringOptions, "breadcrumbs" | "stripSensitiveData">) => ConsolaReporter;
182
186
 
183
187
  /**
184
188
  * Creates a logger with the given name and options.
@@ -607,7 +611,8 @@ export declare type ErrorMonitoringBreadcrumbHint = Record<string, unknown>;
607
611
 
608
612
  /**
609
613
  * An error-monitoring SDK, or an adapter for one. The method names and shapes match the Sentry
610
- * browser SDKs, so `import * as Sentry from '@sentry/react'` can be passed as is.
614
+ * browser SDKs, so an object of the SDK's own functions works as is. Pass those functions, not the
615
+ * SDK's namespace: a namespace passed as a value keeps every export in the bundle.
611
616
  * @public
612
617
  */
613
618
  export declare interface ErrorMonitoringClient {
@@ -648,6 +653,10 @@ export declare interface ErrorMonitoringEvent {
648
653
 
649
654
  /**
650
655
  * Extra options for the client's `init`, merged into what {@link setupErrorMonitoring} passes.
656
+ *
657
+ * @remarks
658
+ * The defaults described below apply unless `stripSensitiveData` is `false`, which keeps every
659
+ * default integration, breadcrumb and URL, and leaves data collection to the SDK's defaults.
651
660
  * @public
652
661
  */
653
662
  export declare interface ErrorMonitoringExtraInitOptions {
@@ -677,6 +686,7 @@ export declare interface ErrorMonitoringExtraInitOptions {
677
686
  *
678
687
  * @remarks
679
688
  * The names match Sentry's `init` options. Any other keys from `initOptions` are passed through.
689
+ * The limits described below apply while `stripSensitiveData` is on, as it is by default.
680
690
  * @public
681
691
  */
682
692
  export declare interface ErrorMonitoringInitOptions {
@@ -738,6 +748,23 @@ export declare interface ErrorMonitoringOptions {
738
748
  init?: (options: ErrorMonitoringInitOptions) => unknown;
739
749
  /** Records non-error foundation logs as breadcrumbs. Defaults to `true`. */
740
750
  breadcrumbs?: boolean;
751
+ /**
752
+ * Keeps logged data and page data out of what is sent. Defaults to `true`; set it to `false` only
753
+ * in development environments, knowing that it sends their credentials too.
754
+ *
755
+ * @remarks
756
+ * Set to `false`, logs carry their logged data (`extra.arguments` on events, `data.arguments` on
757
+ * breadcrumbs), logged errors keep their own fields, and the SDK runs with its own default
758
+ * integrations and data collection, under the app's `initOptions`. Console, click and input
759
+ * breadcrumbs, URL query strings and fragments are all kept. Foundation logger console
760
+ * breadcrumbs are still dropped, since the reporter's breadcrumbs carry the same logs.
761
+ *
762
+ * Logged arguments can hold passwords and session tokens, and debug logs are recorded by default,
763
+ * so turning this off sends the credentials of developers' and shared test accounts to the
764
+ * monitoring service. Only the service's own server-side scrubbing, such as Sentry's for keys like
765
+ * `password` and `token`, then keeps them out of stored events.
766
+ */
767
+ stripSensitiveData?: boolean;
741
768
  }
742
769
 
743
770
  /**
@@ -2581,6 +2608,9 @@ export declare type SetActivatedFeaturesOptions = {
2581
2608
  * every foundation logger, including those Genesis packages create at import time, are reported,
2582
2609
  * and other logs become breadcrumbs. Only log messages and exceptions are sent, never logged data.
2583
2610
  *
2611
+ * `stripSensitiveData: false` lifts all of these limits, for development environments: logged data
2612
+ * is sent, and the SDK collects what its own defaults collect.
2613
+ *
2584
2614
  * Logs written while an asynchronous `init` runs (the last 100) are reported once it finishes. If
2585
2615
  * `init` throws or rejects, for example when a lazily loaded SDK fails to download, it warns on the
2586
2616
  * console and resolves `false` rather than rejecting.
@@ -2596,17 +2626,20 @@ export declare type SetActivatedFeaturesOptions = {
2596
2626
  *
2597
2627
  * @example
2598
2628
  * ```ts
2599
- * import * as Sentry from '@sentry/react';
2629
+ * import { addBreadcrumb, captureException, captureMessage, init } from '@sentry/react';
2600
2630
  * import { setupErrorMonitoring } from '@genesislcap/foundation-utils';
2601
2631
  *
2602
- * setupErrorMonitoring(Sentry, {
2603
- * dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',
2604
- * environment: () =>
2605
- * document.querySelector<HTMLMetaElement>('meta[name="error-monitoring-environment"]')?.content,
2606
- * });
2632
+ * setupErrorMonitoring(
2633
+ * { addBreadcrumb, captureException, captureMessage, init },
2634
+ * {
2635
+ * dsn: 'https://<key>@<org>.ingest.sentry.io/<project>',
2636
+ * environment: () =>
2637
+ * document.querySelector<HTMLMetaElement>('meta[name="error-monitoring-environment"]')?.content,
2638
+ * },
2639
+ * );
2607
2640
  * ```
2608
2641
  *
2609
- * @param client - The monitoring SDK (for example the Sentry namespace) or an adapter for one.
2642
+ * @param client - The monitoring SDK's functions (for example Sentry's) or an adapter for one.
2610
2643
  * @param options - The DSN, the environment, and extra init options.
2611
2644
  * @returns Whether this call enabled monitoring.
2612
2645
  * @public
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-utils",
3
3
  "description": "Genesis Foundation Utils",
4
- "version": "15.90.4",
4
+ "version": "15.92.0-HT-305.1",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -29,17 +29,17 @@
29
29
  }
30
30
  },
31
31
  "devDependencies": {
32
- "@genesislcap/foundation-testing": "15.90.4",
33
- "@genesislcap/genx": "15.90.4",
34
- "@genesislcap/ts-builder": "15.90.4",
35
- "@genesislcap/uvu-playwright-builder": "15.90.4",
36
- "@genesislcap/vite-builder": "15.90.4",
37
- "@genesislcap/webpack-builder": "15.90.4",
32
+ "@genesislcap/foundation-testing": "15.92.0-HT-305.1",
33
+ "@genesislcap/genx": "15.92.0-HT-305.1",
34
+ "@genesislcap/ts-builder": "15.92.0-HT-305.1",
35
+ "@genesislcap/uvu-playwright-builder": "15.92.0-HT-305.1",
36
+ "@genesislcap/vite-builder": "15.92.0-HT-305.1",
37
+ "@genesislcap/webpack-builder": "15.92.0-HT-305.1",
38
38
  "@types/json-schema": "^7.0.11"
39
39
  },
40
40
  "dependencies": {
41
- "@genesislcap/expression-builder": "15.90.4",
42
- "@genesislcap/foundation-logger": "15.90.4",
41
+ "@genesislcap/expression-builder": "15.92.0-HT-305.1",
42
+ "@genesislcap/foundation-logger": "15.92.0-HT-305.1",
43
43
  "@microsoft/fast-components": "2.30.6",
44
44
  "@microsoft/fast-element": "1.14.0",
45
45
  "@microsoft/fast-foundation": "2.50.0",