@cubenest/rrweb-core 0.1.0-alpha.1 → 0.1.0-alpha.3
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.
- package/LICENSE +202 -0
- package/NOTICE +12 -0
- package/README.md +1 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/plugins/network/defaults.d.ts +36 -0
- package/dist/plugins/network/defaults.d.ts.map +1 -0
- package/dist/plugins/network/defaults.js +80 -0
- package/dist/plugins/network/defaults.js.map +1 -0
- package/dist/plugins/network/index.d.ts +3 -0
- package/dist/plugins/network/index.d.ts.map +1 -0
- package/dist/plugins/network/index.js +9 -0
- package/dist/plugins/network/index.js.map +1 -0
- package/dist/plugins/network/patch.d.ts +15 -0
- package/dist/plugins/network/patch.d.ts.map +1 -0
- package/dist/plugins/network/patch.js +64 -0
- package/dist/plugins/network/patch.js.map +1 -0
- package/dist/plugins/network/record.d.ts +38 -0
- package/dist/plugins/network/record.d.ts.map +1 -0
- package/dist/plugins/network/record.js +911 -0
- package/dist/plugins/network/record.js.map +1 -0
- package/dist/plugins/network/types.d.ts +208 -0
- package/dist/plugins/network/types.d.ts.map +1 -0
- package/dist/plugins/network/types.js +16 -0
- package/dist/plugins/network/types.js.map +1 -0
- package/package.json +14 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
CHANGED
|
@@ -11,5 +11,17 @@ This product includes software developed by:
|
|
|
11
11
|
Used to provide getRecordConsolePlugin because the PostHog fork at
|
|
12
12
|
0.0.34 doesn't bundle it (it shipped separately since upstream 2.x).
|
|
13
13
|
|
|
14
|
+
This package contains code adapted from the PostHog network recording
|
|
15
|
+
plugin (posthog-js), Copyright (c) 2025 PostHog Inc., licensed under
|
|
16
|
+
the Apache-2.0 License. Original source:
|
|
17
|
+
https://github.com/PostHog/posthog-js/blob/main/packages/browser/src/extensions/replay/external/network-plugin.ts
|
|
18
|
+
The adaptation strips PostHog-internal utility dependencies and rewires
|
|
19
|
+
the body/header masking surface to use @cubenest/rrweb-core's own
|
|
20
|
+
redactBody and redactNetworkHeaders helpers. PostHog's network plugin
|
|
21
|
+
itself descends from rrweb-io/rrweb PR #1689 (stalled at upstream);
|
|
22
|
+
the patch.ts utility traces back through PostHog → rrweb → Sentry
|
|
23
|
+
(@sentry/utils/object.ts). The full chain of vendoring is preserved
|
|
24
|
+
in src/plugins/network/record.ts and src/plugins/network/patch.ts.
|
|
25
|
+
|
|
14
26
|
This product is licensed under the Apache License, Version 2.0.
|
|
15
27
|
See the LICENSE file for details.
|
package/README.md
CHANGED
|
@@ -4,8 +4,6 @@ Shared rrweb-based capture substrate. Used by [`tracelane`](https://github.com/C
|
|
|
4
4
|
|
|
5
5
|
## What's in here
|
|
6
6
|
|
|
7
|
-
See [ADR-0002](https://github.com/Cubenest/rrweb-stack/blob/main/prds/adrs/0002-rrweb-posthog-fork-substrate.md) for the full inventory.
|
|
8
|
-
|
|
9
7
|
- Vendored PostHog rrweb fork (`@posthog/rrweb@0.0.34`)
|
|
10
8
|
- PII masking primitives (selectors + regex bank + body/header redaction)
|
|
11
9
|
- Large-DOM throttling defaults (mutation guard, data-URL guard, single-event size cap)
|
|
@@ -19,7 +17,7 @@ See [ADR-0002](https://github.com/Cubenest/rrweb-stack/blob/main/prds/adrs/0002-
|
|
|
19
17
|
|
|
20
18
|
## Versioning
|
|
21
19
|
|
|
22
|
-
Independent semver. Breaking changes are coordinated across `tracelane` and `peek` releases
|
|
20
|
+
Independent semver. Breaking changes are coordinated across `tracelane` and `peek` releases.
|
|
23
21
|
|
|
24
22
|
## License
|
|
25
23
|
|
package/dist/index.d.ts
CHANGED
|
@@ -14,4 +14,6 @@ export { compress, decompress } from './compression/index.js';
|
|
|
14
14
|
export { createSessionStore } from './persistence/index.js';
|
|
15
15
|
export type { SessionChunk, SessionStore, SessionStoreOptions } from './persistence/index.js';
|
|
16
16
|
export { COMPATIBILITY_MATRIX, type CompatEntry } from './compat/index.js';
|
|
17
|
+
export { getRecordNetworkPlugin, NETWORK_PLUGIN_NAME, } from './plugins/network/index.js';
|
|
18
|
+
export type { CapturedNetworkRequest, InitiatorType as NetworkInitiatorType, MaskRequestFn as NetworkMaskRequestFn, NetworkData, NetworkHeaders, NetworkRecordOptions, RecordBodyOption as NetworkRecordBodyOption, RecordHeadersOption as NetworkRecordHeadersOption, } from './plugins/network/index.js';
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,QAAQ,EACR,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,GACT,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,aAAa,EACb,WAAW,EACX,aAAa,EAGb,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,SAAS,EACT,oBAAoB,EACpB,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC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AAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG9F,OAAO,EAAE,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAM3E,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,sBAAsB,EACtB,aAAa,IAAI,oBAAoB,EACrC,aAAa,IAAI,oBAAoB,EACrC,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,gBAAgB,IAAI,uBAAuB,EAC3C,mBAAmB,IAAI,0BAA0B,GAClD,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,9 @@ export { compress, decompress } from './compression/index.js';
|
|
|
15
15
|
export { createSessionStore } from './persistence/index.js';
|
|
16
16
|
// Compatibility matrix
|
|
17
17
|
export { COMPATIBILITY_MATRIX } from './compat/index.js';
|
|
18
|
+
// Framework-agnostic rrweb network capture plugin (PR #1689 vendored).
|
|
19
|
+
// Emits EventType.Plugin events with name 'rrweb/network@1' from any
|
|
20
|
+
// recorder running anywhere (extension MAIN-world, WDIO Service,
|
|
21
|
+
// future Playwright/Cypress integration).
|
|
22
|
+
export { getRecordNetworkPlugin, NETWORK_PLUGIN_NAME, } from './plugins/network/index.js';
|
|
18
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,QAAQ,EACR,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,GACT,MAAM,YAAY,CAAC;AAqBpB,UAAU;AACV,OAAO,EACL,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,gBAAgB,GACjB,MA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3B,MAAM,oBAAoB,CAAC;AAE5B,kDAAkD;AAClD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE9D,+BAA+B;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,uBAAuB;AACvB,OAAO,EAAE,oBAAoB,EAAoB,MAAM,mBAAmB,CAAC;AAE3E,uEAAuE;AACvE,qEAAqE;AACrE,iEAAiE;AACjE,0CAA0C;AAC1C,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { InitiatorType, MaskRequestFn } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The narrow shape of `defaultNetworkOptions`. Every key is required,
|
|
4
|
+
* every value is concrete — no `| undefined` in the union. `record.ts`
|
|
5
|
+
* merges this with the caller's `NetworkRecordOptions` to produce its
|
|
6
|
+
* own `NormalizedNetworkOptions` view.
|
|
7
|
+
*/
|
|
8
|
+
export interface DefaultedNetworkOptions {
|
|
9
|
+
recordInitialRequests: boolean;
|
|
10
|
+
recordHeaders: boolean | {
|
|
11
|
+
request: boolean;
|
|
12
|
+
response: boolean;
|
|
13
|
+
};
|
|
14
|
+
recordBody: boolean | string[] | {
|
|
15
|
+
request: boolean | string[];
|
|
16
|
+
response: boolean | string[];
|
|
17
|
+
};
|
|
18
|
+
capturePerformance: boolean;
|
|
19
|
+
performanceEntryTypeToObserve: string[];
|
|
20
|
+
initiatorTypes: InitiatorType[];
|
|
21
|
+
payloadSizeLimitBytes: number;
|
|
22
|
+
bodyByteLimit: number;
|
|
23
|
+
maxRequestsPerBatch: number;
|
|
24
|
+
payloadHostDenyList: string[];
|
|
25
|
+
maskRequestFn: MaskRequestFn;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Fully-defaulted plugin options. Internal — `record.ts` merges this
|
|
29
|
+
* with the caller's options at observer-install time.
|
|
30
|
+
*
|
|
31
|
+
* Frozen via `Object.freeze` (and `as const` on the literal) so
|
|
32
|
+
* downstream code can't mutate the defaults at runtime — see the
|
|
33
|
+
* top-of-file comment for the privacy implication.
|
|
34
|
+
*/
|
|
35
|
+
export declare const defaultNetworkOptions: DefaultedNetworkOptions;
|
|
36
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/plugins/network/defaults.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAA0B,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvF;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,aAAa,EAAE,OAAO,GAAG;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IACjE,UAAU,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG;QAAE,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;IAC/F,kBAAkB,EAAE,OAAO,CAAC;IAC5B,6BAA6B,EAAE,MAAM,EAAE,CAAC;IACxC,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,EAAE,uBA2ClC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Default options for `getRecordNetworkPlugin`.
|
|
2
|
+
//
|
|
3
|
+
// Adapted from PostHog's `replay/config.ts` `defaultNetworkOptions`. The
|
|
4
|
+
// trimmed differences vs PostHog's version:
|
|
5
|
+
// - `capturePerformance` and `recordInitialRequests` default to `true`
|
|
6
|
+
// here — PostHog's defaults to `false` because their config layer
|
|
7
|
+
// gates them on a remote feature flag. Our substrate is opt-out at
|
|
8
|
+
// the plugin level: consumers who want only the timing surface get
|
|
9
|
+
// it by default, and consumers who want bodies/headers opt in
|
|
10
|
+
// explicitly.
|
|
11
|
+
// - `maskRequestFn` default is identity — the real default mask
|
|
12
|
+
// (redactNetworkHeaders + redactBody + URL redaction) is composed
|
|
13
|
+
// inside `record.ts` so it has access to the substrate's masking
|
|
14
|
+
// helpers without an import cycle here.
|
|
15
|
+
// - `payloadHostDenyList` is empty by default. PostHog's defaults
|
|
16
|
+
// include analytics-vendor hostnames (Sentry, Google Analytics,
|
|
17
|
+
// Clarity, …) to avoid feedback loops, but we have no equivalent
|
|
18
|
+
// "always-on PostHog endpoint" — consumers (tracelane, peek)
|
|
19
|
+
// bring their own list per integration.
|
|
20
|
+
//
|
|
21
|
+
// The exported object is frozen with `Object.freeze` so consumer
|
|
22
|
+
// mutation can't change module-global state. This is important
|
|
23
|
+
// because `record.ts` uses a referential-equality check
|
|
24
|
+
// (`hasConsumerMask = consumerMask !== defaultNetworkOptions.maskRequestFn`)
|
|
25
|
+
// to detect when no consumer mask was provided — if a consumer
|
|
26
|
+
// overwrites `defaultNetworkOptions.maskRequestFn`, the sentinel
|
|
27
|
+
// silently flips and the privacy-default mask stops running.
|
|
28
|
+
/**
|
|
29
|
+
* Fully-defaulted plugin options. Internal — `record.ts` merges this
|
|
30
|
+
* with the caller's options at observer-install time.
|
|
31
|
+
*
|
|
32
|
+
* Frozen via `Object.freeze` (and `as const` on the literal) so
|
|
33
|
+
* downstream code can't mutate the defaults at runtime — see the
|
|
34
|
+
* top-of-file comment for the privacy implication.
|
|
35
|
+
*/
|
|
36
|
+
export const defaultNetworkOptions = Object.freeze({
|
|
37
|
+
initiatorTypes: [
|
|
38
|
+
'audio',
|
|
39
|
+
'beacon',
|
|
40
|
+
'body',
|
|
41
|
+
'css',
|
|
42
|
+
'early-hint',
|
|
43
|
+
'embed',
|
|
44
|
+
'fetch',
|
|
45
|
+
'frame',
|
|
46
|
+
'iframe',
|
|
47
|
+
'icon',
|
|
48
|
+
'image',
|
|
49
|
+
'img',
|
|
50
|
+
'input',
|
|
51
|
+
'link',
|
|
52
|
+
'navigation',
|
|
53
|
+
'object',
|
|
54
|
+
'ping',
|
|
55
|
+
'script',
|
|
56
|
+
'track',
|
|
57
|
+
'video',
|
|
58
|
+
'xmlhttprequest',
|
|
59
|
+
],
|
|
60
|
+
// Identity — the real default mask is composed in `record.ts` because
|
|
61
|
+
// it pulls in the substrate's masking helpers. The identity here is
|
|
62
|
+
// also what `record.ts` uses as a sentinel to detect "no consumer
|
|
63
|
+
// mask provided" (referential equality check).
|
|
64
|
+
maskRequestFn: (data) => data,
|
|
65
|
+
recordHeaders: false,
|
|
66
|
+
recordBody: false,
|
|
67
|
+
recordInitialRequests: true,
|
|
68
|
+
capturePerformance: true,
|
|
69
|
+
performanceEntryTypeToObserve: Object.freeze([
|
|
70
|
+
'first-input',
|
|
71
|
+
'navigation',
|
|
72
|
+
'paint',
|
|
73
|
+
'resource',
|
|
74
|
+
]),
|
|
75
|
+
payloadSizeLimitBytes: 1_000_000,
|
|
76
|
+
bodyByteLimit: 5_000,
|
|
77
|
+
maxRequestsPerBatch: 1_000,
|
|
78
|
+
payloadHostDenyList: Object.freeze([]),
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/plugins/network/defaults.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,yEAAyE;AACzE,4CAA4C;AAC5C,yEAAyE;AACzE,sEAAsE;AACtE,uEAAuE;AACvE,uEAAuE;AACvE,kEAAkE;AAClE,kBAAkB;AAClB,kEAAkE;AAClE,sEAAsE;AACtE,qEAAqE;AACrE,4CAA4C;AAC5C,oEAAoE;AACpE,oEAAoE;AACpE,qEAAqE;AACrE,iEAAiE;AACjE,4CAA4C;AAC5C,EAAE;AACF,iEAAiE;AACjE,+DAA+D;AAC/D,wDAAwD;AACxD,6EAA6E;AAC7E,+DAA+D;AAC/D,iEAAiE;AACjE,6DAA6D;AAwB7D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC1E,cAAc,EAAE;QACd,OAAO;QACP,QAAQ;QACR,MAAM;QACN,KAAK;QACL,YAAY;QACZ,OAAO;QACP,OAAO;QACP,OAAO;QACP,QAAQ;QACR,MAAM;QACN,OAAO;QACP,KAAK;QACL,OAAO;QACP,MAAM;QACN,YAAY;QACZ,QAAQ;QACR,MAAM;QACN,QAAQ;QACR,OAAO;QACP,OAAO;QACP,gBAAgB;KACE;IACpB,sEAAsE;IACtE,oEAAoE;IACpE,kEAAkE;IAClE,+CAA+C;IAC/C,aAAa,EAAE,CAAC,IAA4B,EAA0B,EAAE,CAAC,IAAI;IAC7E,aAAa,EAAE,KAAK;IACpB,UAAU,EAAE,KAAK;IACjB,qBAAqB,EAAE,IAAI;IAC3B,kBAAkB,EAAE,IAAI;IACxB,6BAA6B,EAAE,MAAM,CAAC,MAAM,CAAC;QAC3C,aAAa;QACb,YAAY;QACZ,OAAO;QACP,UAAU;KACX,CAAwB;IACzB,qBAAqB,EAAE,SAAS;IAChC,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,KAAK;IAC1B,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAwB;CAC9D,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { getRecordNetworkPlugin } from './record.js';
|
|
2
|
+
export { NETWORK_PLUGIN_NAME, type CapturedNetworkRequest, type InitiatorType, type MaskRequestFn, type NetworkData, type NetworkHeaders, type NetworkRecordOptions, type RecordBodyOption, type RecordHeadersOption, } from './types.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/network/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACL,mBAAmB,EACnB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Public barrel for the framework-agnostic network capture plugin.
|
|
2
|
+
//
|
|
3
|
+
// The plugin emits `EventType.Plugin` events with
|
|
4
|
+
// `data.plugin === 'rrweb/network@1'` — the same name as the stalled
|
|
5
|
+
// upstream rrweb PR #1689, so when (if) upstream lands we can swap the
|
|
6
|
+
// implementation without changing the event payload contract.
|
|
7
|
+
export { getRecordNetworkPlugin } from './record.js';
|
|
8
|
+
export { NETWORK_PLUGIN_NAME, } from './types.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/network/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,EAAE;AACF,kDAAkD;AAClD,qEAAqE;AACrE,uEAAuE;AACvE,8DAA8D;AAE9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACL,mBAAmB,GASpB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace `source[name]` with `replacement(original)` and return a
|
|
3
|
+
* disposer that restores the original.
|
|
4
|
+
*
|
|
5
|
+
* Returns a no-op disposer if:
|
|
6
|
+
* - `name` is not in `source` (caller may be running in an env without
|
|
7
|
+
* fetch/XHR, e.g. a Node target);
|
|
8
|
+
* - the replacement throws on definition (some browsers throw on
|
|
9
|
+
* `defineProperties` over re-defined globals — Sentry hit this on
|
|
10
|
+
* XMLHttpRequest in older Safari);
|
|
11
|
+
*/
|
|
12
|
+
export declare function patch(source: {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}, name: string, replacement: (original: unknown) => unknown): () => void;
|
|
15
|
+
//# sourceMappingURL=patch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../src/plugins/network/patch.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CACnB,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAClC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,GAC1C,MAAM,IAAI,CAsCZ"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Monkey-patch utility for replacing global functions (fetch, XHR.open, …)
|
|
2
|
+
// with our wrappers and restoring them on teardown.
|
|
3
|
+
//
|
|
4
|
+
// Adapted from PostHog's rrweb-plugins/patch.ts (Apache-2.0), which was
|
|
5
|
+
// itself copied from rrweb-io/rrweb's utils.ts, which was copied from
|
|
6
|
+
// Sentry's @sentry/utils/object.ts. The chain of vendoring is documented
|
|
7
|
+
// in NOTICE.
|
|
8
|
+
//
|
|
9
|
+
// Trimmed differences vs PostHog's version:
|
|
10
|
+
// - Drops the `@posthog/core` `isFunction` import; inlines the typeof
|
|
11
|
+
// check (3 LOC).
|
|
12
|
+
// - Renames the non-enumerable marker to `__cubenest_wrapped__` so we
|
|
13
|
+
// don't claim a property name PostHog also uses (defensive — avoids
|
|
14
|
+
// accidental double-wrap detection if both libraries ever sit in the
|
|
15
|
+
// same global).
|
|
16
|
+
const isFunction = (v) => typeof v === 'function';
|
|
17
|
+
/**
|
|
18
|
+
* Replace `source[name]` with `replacement(original)` and return a
|
|
19
|
+
* disposer that restores the original.
|
|
20
|
+
*
|
|
21
|
+
* Returns a no-op disposer if:
|
|
22
|
+
* - `name` is not in `source` (caller may be running in an env without
|
|
23
|
+
* fetch/XHR, e.g. a Node target);
|
|
24
|
+
* - the replacement throws on definition (some browsers throw on
|
|
25
|
+
* `defineProperties` over re-defined globals — Sentry hit this on
|
|
26
|
+
* XMLHttpRequest in older Safari);
|
|
27
|
+
*/
|
|
28
|
+
export function patch(source, name, replacement) {
|
|
29
|
+
try {
|
|
30
|
+
if (!(name in source)) {
|
|
31
|
+
return () => {
|
|
32
|
+
/* no-op */
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const original = source[name];
|
|
36
|
+
const wrapped = replacement(original);
|
|
37
|
+
// Attach a non-enumerable marker so external code can detect that the
|
|
38
|
+
// function has been wrapped (matches Sentry's pattern). We need a
|
|
39
|
+
// function with a prototype slot for `defineProperties` to work.
|
|
40
|
+
if (isFunction(wrapped)) {
|
|
41
|
+
// biome-ignore lint/suspicious/noExplicitAny: prototype slot assignment
|
|
42
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
43
|
+
Object.defineProperties(wrapped, {
|
|
44
|
+
__cubenest_wrapped__: {
|
|
45
|
+
enumerable: false,
|
|
46
|
+
value: true,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
source[name] = wrapped;
|
|
51
|
+
return () => {
|
|
52
|
+
source[name] = original;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Some browsers throw if a global has already been redefined
|
|
57
|
+
// (multi-wrap scenario). Returning a no-op disposer matches PostHog
|
|
58
|
+
// and Sentry — silently degrade rather than break the host page.
|
|
59
|
+
return () => {
|
|
60
|
+
/* no-op */
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch.js","sourceRoot":"","sources":["../../../src/plugins/network/patch.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,oDAAoD;AACpD,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,yEAAyE;AACzE,aAAa;AACb,EAAE;AACF,4CAA4C;AAC5C,wEAAwE;AACxE,qBAAqB;AACrB,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,oBAAoB;AAEpB,MAAM,UAAU,GAAG,CAAC,CAAU,EAAwC,EAAE,CAAC,OAAO,CAAC,KAAK,UAAU,CAAC;AAEjG;;;;;;;;;;GAUG;AACH,MAAM,UAAU,KAAK,CACnB,MAAkC,EAClC,IAAY,EACZ,WAA2C;IAE3C,IAAI,CAAC;QACH,IAAI,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE,CAAC;YACtB,OAAO,GAAG,EAAE;gBACV,WAAW;YACb,CAAC,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEtC,sEAAsE;QACtE,kEAAkE;QAClE,iEAAiE;QACjE,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACxB,wEAAwE;YACvE,OAAe,CAAC,SAAS,GAAI,OAAe,CAAC,SAAS,IAAI,EAAE,CAAC;YAC9D,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE;gBAC/B,oBAAoB,EAAE;oBACpB,UAAU,EAAE,KAAK;oBACjB,KAAK,EAAE,IAAI;iBACZ;aACF,CAAC,CAAC;QACL,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;QAEvB,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;QAC7D,oEAAoE;QACpE,iEAAiE;QACjE,OAAO,GAAG,EAAE;YACV,WAAW;QACb,CAAC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { RecordPlugin } from '@posthog/rrweb-types';
|
|
2
|
+
import { type NetworkHeaders, type NetworkRecordOptions } from './types.js';
|
|
3
|
+
export declare function shouldRecordBody({ type, recordBody, headers, url, }: {
|
|
4
|
+
type: 'request' | 'response';
|
|
5
|
+
headers: NetworkHeaders;
|
|
6
|
+
url: string | URL | RequestInfo;
|
|
7
|
+
recordBody: NetworkRecordOptions['recordBody'];
|
|
8
|
+
}): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Test-only — override the retry config. Returns the previous values so
|
|
11
|
+
* tests can restore. Not exported from the public barrel.
|
|
12
|
+
*/
|
|
13
|
+
export declare function _setPerfEntryRetryConfigForTests(maxAttempts: number, backoffMs: number): {
|
|
14
|
+
previousMax: number;
|
|
15
|
+
previousBackoff: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Reset internal state. Test-only — exposed so tests can re-initialize
|
|
19
|
+
* the singleton observer between cases.
|
|
20
|
+
*/
|
|
21
|
+
export declare function _resetNetworkObserverForTests(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Build the rrweb network capture plugin. Pass to `record({ plugins: [
|
|
24
|
+
* getRecordNetworkPlugin() ] })`.
|
|
25
|
+
*
|
|
26
|
+
* Emits `EventType.Plugin` events with `data.plugin === 'rrweb/network@1'`
|
|
27
|
+
* and `data.payload: NetworkData`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* record({
|
|
31
|
+
* emit(event) { … },
|
|
32
|
+
* plugins: [
|
|
33
|
+
* getRecordNetworkPlugin({ recordBody: true, recordHeaders: true }),
|
|
34
|
+
* ],
|
|
35
|
+
* });
|
|
36
|
+
*/
|
|
37
|
+
export declare function getRecordNetworkPlugin(options?: NetworkRecordOptions): RecordPlugin<NetworkRecordOptions>;
|
|
38
|
+
//# sourceMappingURL=record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../src/plugins/network/record.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAW,YAAY,EAAmB,MAAM,sBAAsB,CAAC;AAKnF,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AA8IpB,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,UAAU,EACV,OAAO,EACP,GAAG,GACJ,EAAE;IACD,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;IAC7B,OAAO,EAAE,cAAc,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,WAAW,CAAC;IAChC,UAAU,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;CAChD,GAAG,OAAO,CA2BV;AAqID;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAMlD;AA6uBD;;;GAGG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,YAAY,CAAC,oBAAoB,CAAC,CAWpC"}
|