@keploy/capture-sdk 3.1.0-rc.2 → 3.2.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 (43) hide show
  1. package/README.md +259 -122
  2. package/dist/body-jobs.d.ts +108 -10
  3. package/dist/body-redact.d.ts +6 -0
  4. package/dist/body-redact.js +1 -1
  5. package/dist/body-redact.js.map +1 -1
  6. package/dist/body-redact.mjs +1 -1
  7. package/dist/body-redact.mjs.map +1 -1
  8. package/dist/body-worker-none.js +1 -1
  9. package/dist/body-worker-none.js.map +1 -1
  10. package/dist/body-worker-none.mjs +1 -1
  11. package/dist/body-worker-none.mjs.map +1 -1
  12. package/dist/body-worker-start.js +1 -1
  13. package/dist/body-worker-start.js.map +1 -1
  14. package/dist/body-worker-start.mjs +1 -1
  15. package/dist/body-worker-start.mjs.map +1 -1
  16. package/dist/body-worker-unbundled.mjs +1 -1
  17. package/dist/body-worker-unbundled.mjs.map +1 -1
  18. package/dist/body-worker.js +1 -1
  19. package/dist/body-worker.js.map +1 -1
  20. package/dist/index.bundler.mjs +1 -1
  21. package/dist/index.bundler.mjs.map +1 -1
  22. package/dist/index.d.ts +76 -14
  23. package/dist/index.js +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +1 -1
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/module-of.d.ts +17 -0
  28. package/dist/network.d.ts +51 -34
  29. package/dist/page-stream.d.ts +24 -0
  30. package/dist/privacy.d.ts +4 -1
  31. package/dist/recorder.d.ts +3 -3
  32. package/dist/redact.d.ts +25 -2
  33. package/dist/request-term.js +1 -1
  34. package/dist/request-term.js.map +1 -1
  35. package/dist/request-term.mjs +1 -1
  36. package/dist/request-term.mjs.map +1 -1
  37. package/dist/strict-attributes.js +1 -1
  38. package/dist/strict-attributes.js.map +1 -1
  39. package/dist/strict-attributes.mjs +1 -1
  40. package/dist/strict-attributes.mjs.map +1 -1
  41. package/dist/transport.d.ts +10 -10
  42. package/dist/types.d.ts +27 -6
  43. package/package.json +2 -1
@@ -1 +1 @@
1
- var e="3.1.0-rc.2",t=/^(?:id|class|role|slot|part|is|hidden|inert|tabindex|dir|lang|translate|draggable|contenteditable|spellcheck|autofocus|data-testid|xmlns(?::\w+)?|xml:\w+|aria-(?:atomic|autocomplete|busy|colcount|colindex|colspan|controls|describedby|details|disabled|errormessage|expanded|flowto|haspopup|hidden|labelledby|level|live|modal|multiline|multiselectable|orientation|owns|posinset|readonly|relevant|required|rowcount|rowindex|rowspan|setsize)|rr_\w+)$/,o=/^(?:name|type|rel|for|form|list|headers|disabled|readonly|required|multiple|open|autocomplete|inputmode|enterkeyhint|accept|charset|http-equiv|media|sizes|loading|decoding|fetchpriority|crossorigin|referrerpolicy|sandbox|allow|allowfullscreen|target|method|enctype|novalidate|async|defer|nomodule|as|start|reversed|scope|span|colspan|rowspan|cols|rows|size|maxlength|minlength|step|low|high|optimum|width|height|wrap|kind|srclang|default|controls|autoplay|loop|muted|playsinline|preload|shape|coords|usemap|ismap|popover|popovertarget|popovertargetaction|align|valign|border|frameborder|property|itemprop|itemscope|itemtype|itemref)$/,r=/^(?:viewbox|preserveaspectratio|version|d|x|y|z|[xy][12]|c[xy]|r[xy]?|f[xyr]|dx|dy|width|height|points|transform|offset|opacity|display|visibility|overflow|focusable|rotate|refx|refy|orient|pathlength|startoffset|lengthadjust|spreadmethod|in2?|result|stddeviation|operator|mode|k[1-4]|values|radius|scale|type|fill(?:-opacity|-rule)?|stroke(?:-width|-opacity|-linecap|-linejoin|-dasharray|-dashoffset|-miterlimit)?|stop-(?:color|opacity)|font-(?:family|size|weight|style)|text-(?:anchor|decoration|rendering)|textlength|clip-(?:path|rule)|clippathunits|marker(?:-start|-mid|-end|width|height|units)|(?:gradient|pattern|mask|filter|primitive|maskcontent|patterncontent)(?:units|transform)|mask|filter|flood-(?:color|opacity)|lighting-color|vector-effect|(?:dominant|alignment)-baseline|baseline-shift|(?:letter|word)-spacing|writing-mode|paint-order|color(?:-interpolation(?:-filters)?)?|shape-rendering|image-rendering|transform-origin)$/,i=/^(viewport|color-scheme|theme-color|referrer|robots|format-detection)$/i;function a(e,a,n,l){return"content"===e?"meta"===a&&void 0!==l&&("string"==typeof l["http-equiv"]||i.test(String(l.name))):t.test(e)||!0===(n?r:a.includes("-")?null:o)?.test(e)}export{a as kept,e as version};//# sourceMappingURL=strict-attributes.mjs.map
1
+ function e(e,t,n,l){return"content"===e?"meta"===t&&void 0!==l&&("string"==typeof l["http-equiv"]||a.test(String(l.name))):o.test(e)||!0===(n?i:t.includes("-")?null:r)?.test(e)}var t="3.2.0",o=/^(?:id|class|role|slot|part|is|hidden|inert|tabindex|dir|lang|translate|draggable|contenteditable|spellcheck|autofocus|data-testid|xmlns(?::\w+)?|xml:\w+|aria-(?:atomic|autocomplete|busy|colcount|colindex|colspan|controls|describedby|details|disabled|errormessage|expanded|flowto|haspopup|hidden|labelledby|level|live|modal|multiline|multiselectable|orientation|owns|posinset|readonly|relevant|required|rowcount|rowindex|rowspan|setsize)|rr_\w+)$/,r=/^(?:name|type|rel|for|form|list|headers|disabled|readonly|required|multiple|open|autocomplete|inputmode|enterkeyhint|accept|charset|http-equiv|media|sizes|loading|decoding|fetchpriority|crossorigin|referrerpolicy|sandbox|allow|allowfullscreen|target|method|enctype|novalidate|async|defer|nomodule|as|start|reversed|scope|span|colspan|rowspan|cols|rows|size|maxlength|minlength|step|low|high|optimum|width|height|wrap|kind|srclang|default|controls|autoplay|loop|muted|playsinline|preload|shape|coords|usemap|ismap|popover|popovertarget|popovertargetaction|align|valign|border|frameborder|property|itemprop|itemscope|itemtype|itemref)$/,i=/^(?:viewbox|preserveaspectratio|version|d|x|y|z|[xy][12]|c[xy]|r[xy]?|f[xyr]|dx|dy|width|height|points|transform|offset|opacity|display|visibility|overflow|focusable|rotate|refx|refy|orient|pathlength|startoffset|lengthadjust|spreadmethod|in2?|result|stddeviation|operator|mode|k[1-4]|values|radius|scale|type|fill(?:-opacity|-rule)?|stroke(?:-width|-opacity|-linecap|-linejoin|-dasharray|-dashoffset|-miterlimit)?|stop-(?:color|opacity)|font-(?:family|size|weight|style)|text-(?:anchor|decoration|rendering)|textlength|clip-(?:path|rule)|clippathunits|marker(?:-start|-mid|-end|width|height|units)|(?:gradient|pattern|mask|filter|primitive|maskcontent|patterncontent)(?:units|transform)|mask|filter|flood-(?:color|opacity)|lighting-color|vector-effect|(?:dominant|alignment)-baseline|baseline-shift|(?:letter|word)-spacing|writing-mode|paint-order|color(?:-interpolation(?:-filters)?)?|shape-rendering|image-rendering|transform-origin)$/,a=/^(viewport|color-scheme|theme-color|referrer|robots|format-detection)$/i;export{e as kept,t as version};//# sourceMappingURL=strict-attributes.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json","../src/strict-attributes.ts"],"names":["version","STRICT_KEPT","HTML_KEPT","SVG_KEPT","PAGE_METAS","kept","name","tag","svg","attributes","test","String","includes","c","o"],"mappings":"AAEE,IAAAA,EAAW,aC+CPC,EACJ,icAEIC,EACJ,4nBAEIC,EACJ,46BAEIC,EACJ,0EAQK,SAASC,EACdC,EACAC,EACAC,EACAC,GAEA,MAAgB,YAATH,EACK,SAARC,QACiB,IAAfE,IACqC,iBAA7BA,EAAW,eACjBL,EAAWM,KAAKC,OAAOF,EAAWH,QACtCL,EAAYS,KAAKJ,KAEb,KADDE,EAAML,EAAWI,EAAIK,SAAS,KAAO,KAAOV,IAAYQ,KAAKJ,EAEtE,QAAAO,UAAAC","sourcesContent":["{\n \"name\": \"@keploy/capture-sdk\",\n \"version\": \"3.1.0-rc.2\",\n \"description\": \"Lightweight SDK to capture UI flows from real users - DOM recording, network interception, PII masking\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.bundler.mjs\",\n \"unpkg\": \"dist/index.mjs\",\n \"jsdelivr\": \"dist/index.mjs\",\n \"types\": \"dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./request-term\": {\n \"types\": \"./dist/request-term.d.ts\",\n \"import\": \"./dist/request-term.mjs\",\n \"require\": \"./dist/request-term.js\"\n },\n \"./strict-attributes\": {\n \"types\": \"./dist/strict-attributes.d.ts\",\n \"import\": \"./dist/strict-attributes.mjs\",\n \"require\": \"./dist/strict-attributes.js\"\n },\n \"./body-redact\": {\n \"types\": \"./dist/body-redact.d.ts\",\n \"import\": \"./dist/body-redact.mjs\",\n \"require\": \"./dist/body-redact.js\"\n },\n \"./body-worker-start\": {\n \"types\": \"./dist/body-worker-start.d.ts\",\n \"import\": \"./dist/body-worker-start.mjs\",\n \"require\": \"./dist/body-worker-start.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"request-term/package.json\",\n \"strict-attributes/package.json\",\n \"body-redact/package.json\",\n \"body-worker-start/package.json\",\n \"LICENSE\",\n \"README.md\"\n ],\n \"scripts\": {\n \"build\": \"node scripts/build-main.mjs && node scripts/build-worker.mjs && tsc -p tsconfig.build.json\",\n \"dev\": \"node scripts/build-main.mjs --watch\",\n \"test\": \"vitest run\",\n \"clean\": \"rm -rf dist\",\n \"typecheck\": \"tsc --noEmit\",\n \"prepublishOnly\": \"pnpm run clean && turbo run build --filter=@keploy/capture-sdk --force\"\n },\n \"dependencies\": {\n \"rrweb\": \"^2.1.6\"\n },\n \"devDependencies\": {\n \"@keploy/contract\": \"workspace:*\",\n \"@types/node\": \"~24.13.5\",\n \"jsdom\": \"^30.1.0\",\n \"terser\": \"5.51.2\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^7.0.2\",\n \"vitest\": \"^5.0.1\"\n },\n \"peerDependencies\": {},\n \"keywords\": [\n \"keploy\",\n \"ui-testing\",\n \"session-recording\",\n \"e2e\",\n \"capture\"\n ],\n \"browser\": {\n \"./dist/body-worker-unbundled.mjs\": \"./dist/body-worker-none.mjs\"\n },\n \"alias\": {\n \"@keploy/capture-sdk/body-worker-start\": \"./dist/body-worker-start.mjs\"\n },\n \"license\": \"Apache-2.0\",\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","/* ------------------------------------------------------------------ */\n/* @keploy/capture-sdk - strict's attribute allow-list */\n/* ------------------------------------------------------------------ */\n/*\n * THIS FILE IS A CHUNK OF ITS OWN (dist/strict-attributes.{mjs,js}, the\n * package's \"./strict-attributes\" export). The recorder loads it under\n * `privacyMode: \"strict\"` alone, beside rrweb's import and in parallel\n * with it, and starts no recording until both have loaded\n * (recorder.ts loadRecorder), so no snapshot is ever taken without it; a\n * load that fails ends the capture with\n * KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE and records nothing. balanced and\n * off never load it. It imports nothing but the version it exports (a\n * string the build inlines), and the main builds import it\n * only by that name (dist/index.mjs also by its file beside it, for a page\n * with no bundler): __tests__/bundle-size.test.ts fails when\n * one of its names is in dist/index.mjs, dist/index.bundler.mjs or\n * dist/index.js. Why a chunk: the three lists are about 954 B gzipped\n * of distinct names, and with them in the base bundle every build was\n * over its budget (founder's ruling, 2026-11-13: never slow the page).\n *\n * STRICT RECORDS NO PAGE TEXT (README, Privacy): what a text node holds,\n * rrweb masks; what an attribute holds, privacy.ts blanks unless this\n * file keeps it, by an ALLOW-LIST. A list of the attributes that hold\n * text missed every one it did not name -- Livewire's wire:snapshot,\n * Alpine's x-data, an Astro island's props, a custom element's message\n * -- so strict keeps only the names whose value is the page's\n * structure: an id, a class, a token, a number, an id reference, SVG\n * geometry, ARIA state, a test id, rrweb's own. A URL, CSS, a srcset and\n * a srcdoc go through their own rules (privacy.ts OWN_RULE, the URL\n * rule). Every other value is blanked, a field's value rrweb already\n * masked kept as it is, and a meta's `content` kept only where the meta\n * configures the page. Blank, not asterisks: the flow engine reads an\n * empty aria-label as none, so a strict recording never names an\n * element by a label it cannot have.\n *\n * ARIA under strict: kept, the attributes that describe the widget -- its\n * structure (level, posinset, setsize, row/col counts and indexes), its\n * relationships (id references: controls, describedby, labelledby, owns,\n * details, errormessage, flowto), its configuration (autocomplete,\n * haspopup, multiline, multiselectable, orientation, readonly, required,\n * disabled, modal, live, atomic, busy, relevant) and whether it is open or\n * hidden (expanded, hidden). Blanked, every one that reflects what the\n * visitor chose or entered: value now/min/max/text (a two-thumb slider's\n * min and max are the other thumb's chosen value), checked, selected,\n * pressed, current, sort, invalid (a verdict on what they typed) and\n * activedescendant (the id of the option they are on). And on HTML\n * elements `checked` and `selected` for the same reason (privacy.ts drops\n * them).\n */\nconst STRICT_KEPT =\n /^(?:id|class|role|slot|part|is|hidden|inert|tabindex|dir|lang|translate|draggable|contenteditable|spellcheck|autofocus|data-testid|xmlns(?::\\w+)?|xml:\\w+|aria-(?:atomic|autocomplete|busy|colcount|colindex|colspan|controls|describedby|details|disabled|errormessage|expanded|flowto|haspopup|hidden|labelledby|level|live|modal|multiline|multiselectable|orientation|owns|posinset|readonly|relevant|required|rowcount|rowindex|rowspan|setsize)|rr_\\w+)$/;\n/** Kept on an HTML element (not a custom one, whose attributes are its own): a token, a number, an id reference. */\nconst HTML_KEPT =\n /^(?:name|type|rel|for|form|list|headers|disabled|readonly|required|multiple|open|autocomplete|inputmode|enterkeyhint|accept|charset|http-equiv|media|sizes|loading|decoding|fetchpriority|crossorigin|referrerpolicy|sandbox|allow|allowfullscreen|target|method|enctype|novalidate|async|defer|nomodule|as|start|reversed|scope|span|colspan|rowspan|cols|rows|size|maxlength|minlength|step|low|high|optimum|width|height|wrap|kind|srclang|default|controls|autoplay|loop|muted|playsinline|preload|shape|coords|usemap|ismap|popover|popovertarget|popovertargetaction|align|valign|border|frameborder|property|itemprop|itemscope|itemtype|itemref)$/;\n/** Kept on an SVG element only: its geometry and paint, by exact name. */\nconst SVG_KEPT =\n /^(?:viewbox|preserveaspectratio|version|d|x|y|z|[xy][12]|c[xy]|r[xy]?|f[xyr]|dx|dy|width|height|points|transform|offset|opacity|display|visibility|overflow|focusable|rotate|refx|refy|orient|pathlength|startoffset|lengthadjust|spreadmethod|in2?|result|stddeviation|operator|mode|k[1-4]|values|radius|scale|type|fill(?:-opacity|-rule)?|stroke(?:-width|-opacity|-linecap|-linejoin|-dasharray|-dashoffset|-miterlimit)?|stop-(?:color|opacity)|font-(?:family|size|weight|style)|text-(?:anchor|decoration|rendering)|textlength|clip-(?:path|rule)|clippathunits|marker(?:-start|-mid|-end|width|height|units)|(?:gradient|pattern|mask|filter|primitive|maskcontent|patterncontent)(?:units|transform)|mask|filter|flood-(?:color|opacity)|lighting-color|vector-effect|(?:dominant|alignment)-baseline|baseline-shift|(?:letter|word)-spacing|writing-mode|paint-order|color(?:-interpolation(?:-filters)?)?|shape-rendering|image-rendering|transform-origin)$/;\n/** A meta whose `content` configures the page, not one that describes it. */\nconst PAGE_METAS =\n /^(viewport|color-scheme|theme-color|referrer|robots|format-detection)$/i;\n\n/**\n * Whether strict keeps attribute `name`'s value on a `tag` element (an SVG\n * one when `svg`), by name alone; a meta's `content` by the meta's own\n * `attributes`. privacy.ts asks this for every attribute but those with\n * their own rule, and blanks what it answers false for.\n */\nexport function kept(\n name: string,\n tag: string,\n svg: boolean,\n attributes?: Record<string, unknown>,\n): boolean {\n return name === \"content\"\n ? tag === \"meta\" &&\n attributes !== undefined &&\n (typeof attributes[\"http-equiv\"] === \"string\" ||\n PAGE_METAS.test(String(attributes.name)))\n : STRICT_KEPT.test(name) ||\n (svg ? SVG_KEPT : tag.includes(\"-\") ? null : HTML_KEPT)?.test(name) ===\n true;\n}\n\n/** The version this chunk was built as: the SDK refuses one of another (module-of.ts ownChunk). */\nexport { version } from \"../package.json\";\n"]}
1
+ {"version":3,"sources":["../src/strict-attributes.ts","../package.json"],"names":["kept","name","tag","svg","attributes","PAGE_METAS","test","String","STRICT_KEPT","SVG_KEPT","includes","HTML_KEPT","version","c","o"],"mappings":"AAmEO,SAASA,EACdC,EACAC,EACAC,EACAC,GAEA,MAAgB,YAATH,EACK,SAARC,QACiB,IAAfE,IACqC,iBAA7BA,EAAW,eACjBC,EAAWC,KAAKC,OAAOH,EAAWH,QACtCO,EAAYF,KAAKL,KAEb,KADDE,EAAMM,EAAWP,EAAIQ,SAAS,KAAO,KAAOC,IAAYL,KAAKL,EAEtE,CC/EE,IAAAW,EAAW,QD+CPJ,EACJ,icAEIG,EACJ,4nBAEIF,EACJ,46BAEIJ,EACJ,iFAsBFQ,UAAAC","sourcesContent":["/* ------------------------------------------------------------------ */\n/* @keploy/capture-sdk - strict's attribute allow-list */\n/* ------------------------------------------------------------------ */\n/*\n * THIS FILE IS A CHUNK OF ITS OWN (dist/strict-attributes.{mjs,js}, the\n * package's \"./strict-attributes\" export). The recorder loads it under\n * `privacyMode: \"strict\"` alone, beside rrweb's import and in parallel\n * with it, and starts no recording until both have loaded\n * (recorder.ts loadRecorder), so no snapshot is ever taken without it; a\n * load that fails ends the capture with\n * KUI_E_STRICT_ATTRIBUTES_UNAVAILABLE and records nothing. balanced and\n * off never load it. It imports nothing but the version it exports (a\n * string the build inlines), and the main builds import it\n * only by that name (dist/index.mjs also by its file beside it, for a page\n * with no bundler): __tests__/bundle-size.test.ts fails when\n * one of its names is in dist/index.mjs, dist/index.bundler.mjs or\n * dist/index.js. Why a chunk: the three lists are about 954 B gzipped\n * of distinct names, and with them in the base bundle every build was\n * over its budget (founder's ruling, 2026-11-13: never slow the page).\n *\n * STRICT RECORDS NO PAGE TEXT (README, Privacy): what a text node holds,\n * rrweb masks; what an attribute holds, privacy.ts blanks unless this\n * file keeps it, by an ALLOW-LIST. A list of the attributes that hold\n * text missed every one it did not name -- Livewire's wire:snapshot,\n * Alpine's x-data, an Astro island's props, a custom element's message\n * -- so strict keeps only the names whose value is the page's\n * structure: an id, a class, a token, a number, an id reference, SVG\n * geometry, ARIA state, a test id, rrweb's own. A URL, CSS, a srcset and\n * a srcdoc go through their own rules (privacy.ts OWN_RULE, the URL\n * rule). Every other value is blanked, a field's value rrweb already\n * masked kept as it is, and a meta's `content` kept only where the meta\n * configures the page. Blank, not asterisks: the flow engine reads an\n * empty aria-label as none, so a strict recording never names an\n * element by a label it cannot have.\n *\n * ARIA under strict: kept, the attributes that describe the widget -- its\n * structure (level, posinset, setsize, row/col counts and indexes), its\n * relationships (id references: controls, describedby, labelledby, owns,\n * details, errormessage, flowto), its configuration (autocomplete,\n * haspopup, multiline, multiselectable, orientation, readonly, required,\n * disabled, modal, live, atomic, busy, relevant) and whether it is open or\n * hidden (expanded, hidden). Blanked, every one that reflects what the\n * visitor chose or entered: value now/min/max/text (a two-thumb slider's\n * min and max are the other thumb's chosen value), checked, selected,\n * pressed, current, sort, invalid (a verdict on what they typed) and\n * activedescendant (the id of the option they are on). And on HTML\n * elements `checked` and `selected` for the same reason (privacy.ts drops\n * them).\n */\nconst STRICT_KEPT =\n /^(?:id|class|role|slot|part|is|hidden|inert|tabindex|dir|lang|translate|draggable|contenteditable|spellcheck|autofocus|data-testid|xmlns(?::\\w+)?|xml:\\w+|aria-(?:atomic|autocomplete|busy|colcount|colindex|colspan|controls|describedby|details|disabled|errormessage|expanded|flowto|haspopup|hidden|labelledby|level|live|modal|multiline|multiselectable|orientation|owns|posinset|readonly|relevant|required|rowcount|rowindex|rowspan|setsize)|rr_\\w+)$/;\n/** Kept on an HTML element (not a custom one, whose attributes are its own): a token, a number, an id reference. */\nconst HTML_KEPT =\n /^(?:name|type|rel|for|form|list|headers|disabled|readonly|required|multiple|open|autocomplete|inputmode|enterkeyhint|accept|charset|http-equiv|media|sizes|loading|decoding|fetchpriority|crossorigin|referrerpolicy|sandbox|allow|allowfullscreen|target|method|enctype|novalidate|async|defer|nomodule|as|start|reversed|scope|span|colspan|rowspan|cols|rows|size|maxlength|minlength|step|low|high|optimum|width|height|wrap|kind|srclang|default|controls|autoplay|loop|muted|playsinline|preload|shape|coords|usemap|ismap|popover|popovertarget|popovertargetaction|align|valign|border|frameborder|property|itemprop|itemscope|itemtype|itemref)$/;\n/** Kept on an SVG element only: its geometry and paint, by exact name. */\nconst SVG_KEPT =\n /^(?:viewbox|preserveaspectratio|version|d|x|y|z|[xy][12]|c[xy]|r[xy]?|f[xyr]|dx|dy|width|height|points|transform|offset|opacity|display|visibility|overflow|focusable|rotate|refx|refy|orient|pathlength|startoffset|lengthadjust|spreadmethod|in2?|result|stddeviation|operator|mode|k[1-4]|values|radius|scale|type|fill(?:-opacity|-rule)?|stroke(?:-width|-opacity|-linecap|-linejoin|-dasharray|-dashoffset|-miterlimit)?|stop-(?:color|opacity)|font-(?:family|size|weight|style)|text-(?:anchor|decoration|rendering)|textlength|clip-(?:path|rule)|clippathunits|marker(?:-start|-mid|-end|width|height|units)|(?:gradient|pattern|mask|filter|primitive|maskcontent|patterncontent)(?:units|transform)|mask|filter|flood-(?:color|opacity)|lighting-color|vector-effect|(?:dominant|alignment)-baseline|baseline-shift|(?:letter|word)-spacing|writing-mode|paint-order|color(?:-interpolation(?:-filters)?)?|shape-rendering|image-rendering|transform-origin)$/;\n/** A meta whose `content` configures the page, not one that describes it. */\nconst PAGE_METAS =\n /^(viewport|color-scheme|theme-color|referrer|robots|format-detection)$/i;\n\n/**\n * Whether strict keeps attribute `name`'s value on a `tag` element (an SVG\n * one when `svg`), by name alone; a meta's `content` by the meta's own\n * `attributes`. privacy.ts asks this for every attribute but those with\n * their own rule, and blanks what it answers false for.\n */\nexport function kept(\n name: string,\n tag: string,\n svg: boolean,\n attributes?: Record<string, unknown>,\n): boolean {\n return name === \"content\"\n ? tag === \"meta\" &&\n attributes !== undefined &&\n (typeof attributes[\"http-equiv\"] === \"string\" ||\n PAGE_METAS.test(String(attributes.name)))\n : STRICT_KEPT.test(name) ||\n (svg ? SVG_KEPT : tag.includes(\"-\") ? null : HTML_KEPT)?.test(name) ===\n true;\n}\n\n/** The version this chunk was built as: the SDK refuses one of another (module-of.ts ownChunk). */\nexport { version } from \"../package.json\";\n","{\n \"name\": \"@keploy/capture-sdk\",\n \"version\": \"3.2.0\",\n \"description\": \"Lightweight SDK to capture UI flows from real users - DOM recording, network interception, PII masking\",\n \"homepage\": \"https://keploy.io/docs/running-keploy/ui-capture/\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.bundler.mjs\",\n \"unpkg\": \"dist/index.mjs\",\n \"jsdelivr\": \"dist/index.mjs\",\n \"types\": \"dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./request-term\": {\n \"types\": \"./dist/request-term.d.ts\",\n \"import\": \"./dist/request-term.mjs\",\n \"require\": \"./dist/request-term.js\"\n },\n \"./strict-attributes\": {\n \"types\": \"./dist/strict-attributes.d.ts\",\n \"import\": \"./dist/strict-attributes.mjs\",\n \"require\": \"./dist/strict-attributes.js\"\n },\n \"./body-redact\": {\n \"types\": \"./dist/body-redact.d.ts\",\n \"import\": \"./dist/body-redact.mjs\",\n \"require\": \"./dist/body-redact.js\"\n },\n \"./body-worker-start\": {\n \"types\": \"./dist/body-worker-start.d.ts\",\n \"import\": \"./dist/body-worker-start.mjs\",\n \"require\": \"./dist/body-worker-start.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"request-term/package.json\",\n \"strict-attributes/package.json\",\n \"body-redact/package.json\",\n \"body-worker-start/package.json\",\n \"LICENSE\",\n \"README.md\"\n ],\n \"scripts\": {\n \"build\": \"node scripts/build-main.mjs && node scripts/build-worker.mjs && tsc -p tsconfig.build.json\",\n \"dev\": \"node scripts/build-main.mjs --watch\",\n \"test\": \"vitest run\",\n \"clean\": \"rm -rf dist\",\n \"typecheck\": \"tsc --noEmit\",\n \"prepublishOnly\": \"pnpm run clean && turbo run build --filter=@keploy/capture-sdk --force && node ../../tools/check-release-size.mjs\"\n },\n \"dependencies\": {\n \"rrweb\": \"^2.1.6\"\n },\n \"devDependencies\": {\n \"@keploy/contract\": \"workspace:*\",\n \"@types/node\": \"~24.13.5\",\n \"jsdom\": \"^30.1.0\",\n \"terser\": \"5.51.2\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^7.0.2\",\n \"vitest\": \"^5.0.1\"\n },\n \"peerDependencies\": {},\n \"keywords\": [\n \"keploy\",\n \"ui-testing\",\n \"session-recording\",\n \"e2e\",\n \"capture\"\n ],\n \"browser\": {\n \"./dist/body-worker-unbundled.mjs\": \"./dist/body-worker-none.mjs\"\n },\n \"alias\": {\n \"@keploy/capture-sdk/body-worker-start\": \"./dist/body-worker-start.mjs\"\n },\n \"license\": \"Apache-2.0\",\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n"]}
@@ -199,7 +199,7 @@ export declare class Transport {
199
199
  /** Set by a drain request that arrived while a flush was running. */
200
200
  private drainPending;
201
201
  /** Set by hold(): nothing is sent until release(). */
202
- private holding;
202
+ private holdOpen;
203
203
  /**
204
204
  * Full batches enqueue() asked for while a flight was out, which the run
205
205
  * under way owes: one batch each, sent as its flight settles (run()).
@@ -255,9 +255,9 @@ export declare class Transport {
255
255
  * The next flight is the counter's: the queue went past the share, and
256
256
  * no drain was asked. It is capped at the share (formFlight).
257
257
  */
258
- private counted;
258
+ private shareFlight;
259
259
  /** Flights that spent their attempts since one was last accepted; 0 when uploads work. */
260
- private failures;
260
+ private failCount;
261
261
  /** performance.now() before which no flight starts on the timer's or an enqueue's say; see OUTAGE_FIRST_MS. */
262
262
  private notBefore;
263
263
  constructor(config: TransportConfig);
@@ -293,7 +293,7 @@ export declare class Transport {
293
293
  * after start() answers the import with the network still down, and
294
294
  * what comes after waits for the network there as it did.
295
295
  */
296
- release(): void;
296
+ release(drain?: boolean): void;
297
297
  /** Drops what is queued and what waits to be re-sent, unsent. */
298
298
  discard(): void;
299
299
  /**
@@ -315,7 +315,7 @@ export declare class Transport {
315
315
  */
316
316
  place(): number;
317
317
  /** Uploads are failing and the wait before the next flight is not over. */
318
- private get paced();
318
+ private get outagePaced();
319
319
  /**
320
320
  * Holds what is unsent at MAX_QUEUE_BYTES, dropping the oldest first:
321
321
  * waiting flights whole, then queued events. fit() never drops the
@@ -358,7 +358,7 @@ export declare class Transport {
358
358
  /** One console line; each caller says its code once per capture. */
359
359
  private warn;
360
360
  /** The request body for `events`, with everything a batch carries. */
361
- private payload;
361
+ private makeBatch;
362
362
  /**
363
363
  * Send queued events.
364
364
  *
@@ -382,8 +382,8 @@ export declare class Transport {
382
382
  * leaving (found in review #29). One sender runs at a time, so one
383
383
  * wait is pending at most.
384
384
  */
385
- private backoff;
386
- private sendWithRetry;
385
+ private retryWait;
386
+ private postFlight;
387
387
  /**
388
388
  * The last flush, issued while the document is being torn down.
389
389
  *
@@ -431,11 +431,11 @@ export declare class Transport {
431
431
  * leaving. Which is why an event that can never fit is not left to
432
432
  * wait here: enqueue() sends it as soon as it is queued.
433
433
  */
434
- private reclaimInFlight;
434
+ private reclaimFlight;
435
435
  private reviveNext;
436
436
  private formFlight;
437
437
  /**
438
- * The POST body for `events`: JSON.stringify(this.payload(events,
438
+ * The POST body for `events`: JSON.stringify(this.makeBatch(events,
439
439
  * batchId)), the same text, with each event's JSON as enqueue() wrote
440
440
  * it, joined. The envelope is written with no events; its
441
441
  * `"events":[]` is the first, since only the session and batch ids,
package/dist/types.d.ts CHANGED
@@ -215,7 +215,7 @@ export interface CaptureConfig {
215
215
  * A body the SDK does not read at all is recorded as a note naming
216
216
  * what it was, with a size where there is one to give — a stream, a
217
217
  * response it could not read as text and a body it never read carry
218
- * none. There are SEVEN, and this list was
218
+ * none. There are EIGHT, and this list was
219
219
  * four while network.ts wrote a fifth — `[Binary/Document body]`,
220
220
  * for every XHR Blob, buffer and Document alike, with neither the
221
221
  * kind nor the size on it. readme.test.ts now holds both this list
@@ -229,6 +229,9 @@ export interface CaptureConfig {
229
229
  * UTF-8 text; a buffer that is text and fits is recorded as text.
230
230
  * - `[Response body too large: N bytes]` — from a `Content-Length`
231
231
  * over the cap, so the body is never downloaded.
232
+ * - `[Response body not read by the page]` — a response body the
233
+ * page never read, which the SDK then never reads either. No size:
234
+ * nothing of it was read.
232
235
  * - `[ReadableStream]` — a streaming request body, which reading
233
236
  * would consume out from under the page. No size: measuring a
234
237
  * stream means consuming it too.
@@ -270,7 +273,25 @@ export interface CaptureConfig {
270
273
  * `serverMessage` (the server's own sentence) and `remedy.docs`;
271
274
  * `message` is the prose a human read before. It is called after the
272
275
  * capture has ended and the singleton is released, so a handler may
273
- * call KeployCapture.init() again and get a fresh capture. It is
276
+ * call KeployCapture.init() again and get a fresh capture, once it has
277
+ * changed what was refused: the same config is refused the same way.
278
+ * A refusal raised while init() runs is handed over in a timer task of
279
+ * its own, never inside that init() call, and init() resolves once the
280
+ * handler has run, so a handler that re-inits never recurses or freezes
281
+ * the page. A refused init() is told, in order per code, but repeated
282
+ * identical refusals are paced and bounded: a code has at most one
283
+ * hand-over waiting, which tells the refusals of it made meanwhile, at
284
+ * most 16 -- one that comes while 16 wait resolves its init() at once,
285
+ * untold, and nothing of it is kept; one soon after the code's last
286
+ * waits twice as long as the one before, 50 ms up to 30 s, so none is
287
+ * scheduled more than 30 s out; a code quiet for that wait plus a second
288
+ * starts over. A handler that re-inits the same config for every code,
289
+ * even twice a refusal, goes round 11 times in its first minute, then
290
+ * twice a minute, at most 16 handlers a round. Each refusal reads the
291
+ * clock once: a hand-over whose timer the page cleared (or a test's fake
292
+ * timers dropped) is handed over by the next refusal of its code more
293
+ * than 31 s past its due time, and what waits on it stays unresolved
294
+ * until one comes. It is
274
295
  * ALSO how a `sessionIdGenerator` that returns the wrong thing or
275
296
  * throws is reported: the capture never starts, and init() resolves.
276
297
  */
@@ -375,10 +396,10 @@ export interface PrivacyConfig {
375
396
  * that was absent stays null), decided from each body's kind and size,
376
397
  * never by serialising, decoding or relaying it. Two reads remain, for
377
398
  * the requestTerm every mode records: a string body is scanned, and a
378
- * Request object's own body is read only as far as the term needs. The
379
- * browser still copies or encodes a buffer, string, URLSearchParams or
380
- * FormData passed in fetch()'s init once more, into the Request the SDK
381
- * builds from the call, which the SDK never reads. See the README.
399
+ * Request object's own body is read only as far as the term needs,
400
+ * after the page's fetch() call returns. (In every mode, a body passed
401
+ * in fetch()'s init of a plain object is never copied into the Request
402
+ * the SDK takes the call's URL and headers from.) See the README.
382
403
  * @default false
383
404
  *
384
405
  * Forced on under `privacyMode: "strict"`. KeployCapture refuses an
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@keploy/capture-sdk",
3
- "version": "3.1.0-rc.2",
3
+ "version": "3.2.0",
4
4
  "description": "Lightweight SDK to capture UI flows from real users - DOM recording, network interception, PII masking",
5
+ "homepage": "https://keploy.io/docs/running-keploy/ui-capture/",
5
6
  "main": "dist/index.js",
6
7
  "module": "dist/index.bundler.mjs",
7
8
  "unpkg": "dist/index.mjs",