UNPKG

@sentry/remix

Version:
36 lines (32 loc) • 1.28 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const attributes = require('@sentry/conventions/attributes'); const core = require('@sentry/core'); function resolveFormDataCapture(client) { if (!client) { return void 0; } const keys = client.getOptions().captureActionFormDataKeys; if (keys) { return { keys }; } return client.getDataCollectionOptions().httpBodies.includes("incomingRequest") ? { keys: void 0 } : void 0; } function applyFormDataAttributes(span, formData, { keys }) { const collected = {}; formData.forEach((value, key) => { const mapped = keys ? keys[key] : true; if (!mapped) { return; } const attributeName = typeof mapped === "string" ? mapped : key; const reported = typeof value === "string" ? value : value.name || "[non-string value]"; const filtered = core._INTERNAL_filterKeyValueData({ [key]: reported }, true); collected[attributeName] = filtered[key]; }); for (const [key, value] of Object.entries(collected)) { span.setAttribute(`${attributes.REMIX_ACTION_FORM_DATA_KEY_BASE}.${key}`, value); } } exports.applyFormDataAttributes = applyFormDataAttributes; exports.resolveFormDataCapture = resolveFormDataCapture; //# sourceMappingURL=formData.js.map