mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
1 line
10 KiB
JSON
1 line
10 KiB
JSON
{"ast":null,"code":"import { dropUndefinedKeys } from './object.js';\n\n/**\n * Creates an envelope.\n * Make sure to always explicitly provide the generic to this function\n * so that the envelope types resolve correctly.\n */\nfunction createEnvelope(headers, items = []) {\n return [headers, items];\n}\n\n/**\n * Add an item to an envelope.\n * Make sure to always explicitly provide the generic to this function\n * so that the envelope types resolve correctly.\n */\nfunction addItemToEnvelope(envelope, newItem) {\n const [headers, items] = envelope;\n return [headers, [...items, newItem]];\n}\n\n/**\n * Convenience function to loop through the items and item types of an envelope.\n * (This function was mostly created because working with envelope types is painful at the moment)\n */\nfunction forEachEnvelopeItem(envelope, callback) {\n var envelopeItems = envelope[1];\n envelopeItems.forEach(envelopeItem => {\n var envelopeItemType = envelopeItem[0].type;\n callback(envelopeItem, envelopeItemType);\n });\n}\nfunction encodeUTF8(input, textEncoder) {\n var utf8 = textEncoder || new TextEncoder();\n return utf8.encode(input);\n}\n\n/**\n * Serializes an envelope.\n */\nfunction serializeEnvelope(envelope, textEncoder) {\n const [envHeaders, items] = envelope;\n\n // Initially we construct our envelope as a string and only convert to binary chunks if we encounter binary data\n let parts = JSON.stringify(envHeaders);\n function append(next) {\n if (typeof parts === 'string') {\n parts = typeof next === 'string' ? parts + next : [encodeUTF8(parts, textEncoder), next];\n } else {\n parts.push(typeof next === 'string' ? encodeUTF8(next, textEncoder) : next);\n }\n }\n for (var item of items) {\n const [itemHeaders, payload] = item;\n append(`\\n${JSON.stringify(itemHeaders)}\\n`);\n append(typeof payload === 'string' || payload instanceof Uint8Array ? payload : JSON.stringify(payload));\n }\n return typeof parts === 'string' ? parts : concatBuffers(parts);\n}\nfunction concatBuffers(buffers) {\n var totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0);\n var merged = new Uint8Array(totalLength);\n let offset = 0;\n for (var buffer of buffers) {\n merged.set(buffer, offset);\n offset += buffer.length;\n }\n return merged;\n}\n\n/**\n * Creates attachment envelope items\n */\nfunction createAttachmentEnvelopeItem(attachment, textEncoder) {\n var buffer = typeof attachment.data === 'string' ? encodeUTF8(attachment.data, textEncoder) : attachment.data;\n return [dropUndefinedKeys({\n type: 'attachment',\n length: buffer.length,\n filename: attachment.filename,\n content_type: attachment.contentType,\n attachment_type: attachment.attachmentType\n }), buffer];\n}\nvar ITEM_TYPE_TO_DATA_CATEGORY_MAP = {\n session: 'session',\n sessions: 'session',\n attachment: 'attachment',\n transaction: 'transaction',\n event: 'error',\n client_report: 'internal',\n user_report: 'default'\n};\n\n/**\n * Maps the type of an envelope item to a data category.\n */\nfunction envelopeItemTypeToDataCategory(type) {\n return ITEM_TYPE_TO_DATA_CATEGORY_MAP[type];\n}\nexport { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, envelopeItemTypeToDataCategory, forEachEnvelopeItem, serializeEnvelope };","map":{"version":3,"names":["dropUndefinedKeys","createEnvelope","headers","items","addItemToEnvelope","envelope","newItem","forEachEnvelopeItem","callback","envelopeItems","forEach","envelopeItem","envelopeItemType","type","encodeUTF8","input","textEncoder","utf8","TextEncoder","encode","serializeEnvelope","envHeaders","parts","JSON","stringify","append","next","push","item","itemHeaders","payload","Uint8Array","concatBuffers","buffers","totalLength","reduce","acc","buf","length","merged","offset","buffer","set","createAttachmentEnvelopeItem","attachment","data","filename","content_type","contentType","attachment_type","attachmentType","ITEM_TYPE_TO_DATA_CATEGORY_MAP","session","sessions","transaction","event","client_report","user_report","envelopeItemTypeToDataCategory"],"sources":["C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@sentry/utils/esm/envelope.js"],"sourcesContent":["import { dropUndefinedKeys } from './object.js';\n\n/**\n * Creates an envelope.\n * Make sure to always explicitly provide the generic to this function\n * so that the envelope types resolve correctly.\n */\nfunction createEnvelope(headers, items = []) {\n return [headers, items] ;\n}\n\n/**\n * Add an item to an envelope.\n * Make sure to always explicitly provide the generic to this function\n * so that the envelope types resolve correctly.\n */\nfunction addItemToEnvelope(envelope, newItem) {\n const [headers, items] = envelope;\n return [headers, [...items, newItem]] ;\n}\n\n/**\n * Convenience function to loop through the items and item types of an envelope.\n * (This function was mostly created because working with envelope types is painful at the moment)\n */\nfunction forEachEnvelopeItem(\n envelope,\n callback,\n) {\n var envelopeItems = envelope[1];\n envelopeItems.forEach((envelopeItem) => {\n var envelopeItemType = envelopeItem[0].type;\n callback(envelopeItem, envelopeItemType);\n });\n}\n\nfunction encodeUTF8(input, textEncoder) {\n var utf8 = textEncoder || new TextEncoder();\n return utf8.encode(input);\n}\n\n/**\n * Serializes an envelope.\n */\nfunction serializeEnvelope(envelope, textEncoder) {\n const [envHeaders, items] = envelope;\n\n // Initially we construct our envelope as a string and only convert to binary chunks if we encounter binary data\n let parts = JSON.stringify(envHeaders);\n\n function append(next) {\n if (typeof parts === 'string') {\n parts = typeof next === 'string' ? parts + next : [encodeUTF8(parts, textEncoder), next];\n } else {\n parts.push(typeof next === 'string' ? encodeUTF8(next, textEncoder) : next);\n }\n }\n\n for (var item of items) {\n const [itemHeaders, payload] = item ;\n append(`\\n${JSON.stringify(itemHeaders)}\\n`);\n append(typeof payload === 'string' || payload instanceof Uint8Array ? payload : JSON.stringify(payload));\n }\n\n return typeof parts === 'string' ? parts : concatBuffers(parts);\n}\n\nfunction concatBuffers(buffers) {\n var totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0);\n\n var merged = new Uint8Array(totalLength);\n let offset = 0;\n for (var buffer of buffers) {\n merged.set(buffer, offset);\n offset += buffer.length;\n }\n\n return merged;\n}\n\n/**\n * Creates attachment envelope items\n */\nfunction createAttachmentEnvelopeItem(\n attachment,\n textEncoder,\n) {\n var buffer = typeof attachment.data === 'string' ? encodeUTF8(attachment.data, textEncoder) : attachment.data;\n\n return [\n dropUndefinedKeys({\n type: 'attachment',\n length: buffer.length,\n filename: attachment.filename,\n content_type: attachment.contentType,\n attachment_type: attachment.attachmentType,\n }),\n buffer,\n ];\n}\n\nvar ITEM_TYPE_TO_DATA_CATEGORY_MAP = {\n session: 'session',\n sessions: 'session',\n attachment: 'attachment',\n transaction: 'transaction',\n event: 'error',\n client_report: 'internal',\n user_report: 'default',\n};\n\n/**\n * Maps the type of an envelope item to a data category.\n */\nfunction envelopeItemTypeToDataCategory(type) {\n return ITEM_TYPE_TO_DATA_CATEGORY_MAP[type];\n}\n\nexport { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, envelopeItemTypeToDataCategory, forEachEnvelopeItem, serializeEnvelope };\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,aAAa;;AAE/C;AACA;AACA;AACA;AACA;AACA,SAASC,cAAcA,CAACC,OAAO,EAAEC,KAAK,GAAG,EAAE,EAAE;EAC3C,OAAO,CAACD,OAAO,EAAEC,KAAK,CAAC;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAACC,QAAQ,EAAEC,OAAO,EAAE;EAC5C,MAAM,CAACJ,OAAO,EAAEC,KAAK,CAAC,GAAGE,QAAQ;EACjC,OAAO,CAACH,OAAO,EAAE,CAAC,GAAGC,KAAK,EAAEG,OAAO,CAAC,CAAC;AACvC;;AAEA;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAC1BF,QAAQ,EACRG,QAAQ,EACR;EACA,IAAIC,aAAa,GAAGJ,QAAQ,CAAC,CAAC,CAAC;EAC/BI,aAAa,CAACC,OAAO,CAAEC,YAAY,IAAK;IACtC,IAAIC,gBAAgB,GAAGD,YAAY,CAAC,CAAC,CAAC,CAACE,IAAI;IAC3CL,QAAQ,CAACG,YAAY,EAAEC,gBAAgB,CAAC;EAC1C,CAAC,CAAC;AACJ;AAEA,SAASE,UAAUA,CAACC,KAAK,EAAEC,WAAW,EAAE;EACtC,IAAIC,IAAI,GAAGD,WAAW,IAAI,IAAIE,WAAW,CAAC,CAAC;EAC3C,OAAOD,IAAI,CAACE,MAAM,CAACJ,KAAK,CAAC;AAC3B;;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