@betterbugs/rrweb-plugin-sequential-id-replay 2.0.0-alpha.19
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/README.md +202 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/rrweb-plugin-sequential-id-replay.cjs +30 -0
- package/dist/rrweb-plugin-sequential-id-replay.cjs.map +1 -0
- package/dist/rrweb-plugin-sequential-id-replay.js +30 -0
- package/dist/rrweb-plugin-sequential-id-replay.js.map +1 -0
- package/dist/rrweb-plugin-sequential-id-replay.umd.cjs +60 -0
- package/dist/rrweb-plugin-sequential-id-replay.umd.cjs.map +7 -0
- package/dist/rrweb-plugin-sequential-id-replay.umd.min.cjs +32 -0
- package/dist/rrweb-plugin-sequential-id-replay.umd.min.cjs.map +7 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# @rrweb/rrweb-plugin-sequential-id-replay
|
|
2
|
+
|
|
3
|
+
Use this plugin in combination with the [@rrweb/rrweb-plugin-sequential-id-record](../rrweb-plugin-sequential-id-record) plugin to record and replay events with a sequential id.
|
|
4
|
+
See the [guide](../../../guide.md) for more info on rrweb.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @rrweb/rrweb-plugin-sequential-id-replay
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import rrweb from 'rrweb';
|
|
16
|
+
import { getReplaySequentialIdPlugin } from '@rrweb/rrweb-plugin-sequential-id-replay';
|
|
17
|
+
|
|
18
|
+
const replayer = new rrweb.Replayer(events, {
|
|
19
|
+
plugins: [
|
|
20
|
+
getReplaySequentialIdPlugin({
|
|
21
|
+
// make sure this is the same as the record side
|
|
22
|
+
key: '_id', // default value
|
|
23
|
+
warnOnMissingId: true, // default value
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
replayer.play(); // ERROR: [sequential-id-plugin]: expect to get an id with value "42", but got "666"`
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Sponsors
|
|
31
|
+
|
|
32
|
+
[Become a sponsor](https://opencollective.com/rrweb#sponsor) and get your logo on our README on Github with a link to your site.
|
|
33
|
+
|
|
34
|
+
### Gold Sponsors 🥇
|
|
35
|
+
|
|
36
|
+
<div dir="auto">
|
|
37
|
+
|
|
38
|
+
<a href="https://opencollective.com/rrweb/tiers/gold-sponsor/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/gold-sponsor/0/avatar.svg?requireActive=false&avatarHeight=225" alt="sponsor"></a>
|
|
39
|
+
<a href="https://opencollective.com/rrweb/tiers/gold-sponsor/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/gold-sponsor/1/avatar.svg?requireActive=false&avatarHeight=225" alt="sponsor"></a>
|
|
40
|
+
<a href="https://opencollective.com/rrweb/tiers/gold-sponsor/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/gold-sponsor/2/avatar.svg?requireActive=false&avatarHeight=225" alt="sponsor"></a>
|
|
41
|
+
<a href="https://opencollective.com/rrweb/tiers/gold-sponsor/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/gold-sponsor/3/avatar.svg?requireActive=false&avatarHeight=225" alt="sponsor"></a>
|
|
42
|
+
<a href="https://opencollective.com/rrweb/tiers/gold-sponsor/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/gold-sponsor/4/avatar.svg?requireActive=false&avatarHeight=225" alt="sponsor"></a>
|
|
43
|
+
<a href="https://opencollective.com/rrweb/tiers/gold-sponsor/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/gold-sponsor/5/avatar.svg?requireActive=false&avatarHeight=225" alt="sponsor"></a>
|
|
44
|
+
<a href="https://opencollective.com/rrweb/tiers/gold-sponsor/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/gold-sponsor/6/avatar.svg?requireActive=false&avatarHeight=225" alt="sponsor"></a>
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
### Silver Sponsors 🥈
|
|
49
|
+
|
|
50
|
+
<div dir="auto">
|
|
51
|
+
|
|
52
|
+
<a href="https://opencollective.com/rrweb/tiers/silver-sponsor/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/silver-sponsor/0/avatar.svg?requireActive=false&avatarHeight=158" alt="sponsor"></a>
|
|
53
|
+
<a href="https://opencollective.com/rrweb/tiers/silver-sponsor/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/silver-sponsor/1/avatar.svg?requireActive=false&avatarHeight=158" alt="sponsor"></a>
|
|
54
|
+
<a href="https://opencollective.com/rrweb/tiers/silver-sponsor/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/silver-sponsor/2/avatar.svg?requireActive=false&avatarHeight=158" alt="sponsor"></a>
|
|
55
|
+
<a href="https://opencollective.com/rrweb/tiers/silver-sponsor/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/silver-sponsor/3/avatar.svg?requireActive=false&avatarHeight=158" alt="sponsor"></a>
|
|
56
|
+
<a href="https://opencollective.com/rrweb/tiers/silver-sponsor/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/silver-sponsor/4/avatar.svg?requireActive=false&avatarHeight=158" alt="sponsor"></a>
|
|
57
|
+
<a href="https://opencollective.com/rrweb/tiers/silver-sponsor/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/silver-sponsor/5/avatar.svg?requireActive=false&avatarHeight=158" alt="sponsor"></a>
|
|
58
|
+
<a href="https://opencollective.com/rrweb/tiers/silver-sponsor/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/silver-sponsor/6/avatar.svg?requireActive=false&avatarHeight=158" alt="sponsor"></a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
### Bronze Sponsors 🥉
|
|
63
|
+
|
|
64
|
+
<div dir="auto">
|
|
65
|
+
|
|
66
|
+
<a href="https://opencollective.com/rrweb/tiers/sponsors/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/sponsors/0/avatar.svg?requireActive=false&avatarHeight=70" alt="sponsor"></a>
|
|
67
|
+
<a href="https://opencollective.com/rrweb/tiers/sponsors/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/sponsors/1/avatar.svg?requireActive=false&avatarHeight=70" alt="sponsor"></a>
|
|
68
|
+
<a href="https://opencollective.com/rrweb/tiers/sponsors/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/sponsors/2/avatar.svg?requireActive=false&avatarHeight=70" alt="sponsor"></a>
|
|
69
|
+
<a href="https://opencollective.com/rrweb/tiers/sponsors/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/sponsors/3/avatar.svg?requireActive=false&avatarHeight=70" alt="sponsor"></a>
|
|
70
|
+
<a href="https://opencollective.com/rrweb/tiers/sponsors/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/sponsors/4/avatar.svg?requireActive=false&avatarHeight=70" alt="sponsor"></a>
|
|
71
|
+
<a href="https://opencollective.com/rrweb/tiers/sponsors/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/sponsors/5/avatar.svg?requireActive=false&avatarHeight=70" alt="sponsor"></a>
|
|
72
|
+
<a href="https://opencollective.com/rrweb/tiers/sponsors/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/sponsors/6/avatar.svg?requireActive=false&avatarHeight=70" alt="sponsor"></a>
|
|
73
|
+
<a href="https://opencollective.com/rrweb/tiers/sponsors/7/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/sponsors/7/avatar.svg?requireActive=false&avatarHeight=70" alt="sponsor"></a>
|
|
74
|
+
<a href="https://opencollective.com/rrweb/tiers/sponsors/8/website?requireActive=false" target="_blank"><img src="https://opencollective.com/rrweb/tiers/sponsors/8/avatar.svg?requireActive=false&avatarHeight=70" alt="sponsor"></a>
|
|
75
|
+
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
### Backers
|
|
79
|
+
|
|
80
|
+
<a href="https://opencollective.com/rrweb#sponsor" rel="nofollow"><img src="https://opencollective.com/rrweb/tiers/backers.svg?avatarHeight=36"></a>
|
|
81
|
+
|
|
82
|
+
## Core Team Members
|
|
83
|
+
|
|
84
|
+
<table>
|
|
85
|
+
<tr>
|
|
86
|
+
<td align="center">
|
|
87
|
+
<a href="https://github.com/Yuyz0112">
|
|
88
|
+
<img
|
|
89
|
+
src="https://avatars.githubusercontent.com/u/13651389?s=100"
|
|
90
|
+
width="100px;"
|
|
91
|
+
alt=""
|
|
92
|
+
/>
|
|
93
|
+
<br /><sub><b>Yuyz0112</b></sub>
|
|
94
|
+
<br /><br />
|
|
95
|
+
</a>
|
|
96
|
+
</td>
|
|
97
|
+
<td align="center">
|
|
98
|
+
<a href="https://github.com/YunFeng0817">
|
|
99
|
+
<img
|
|
100
|
+
src="https://avatars.githubusercontent.com/u/27533910?s=100"
|
|
101
|
+
width="100px;"
|
|
102
|
+
alt=""
|
|
103
|
+
/>
|
|
104
|
+
<br /><sub><b>Yun Feng</b></sub>
|
|
105
|
+
<br /><br />
|
|
106
|
+
</a>
|
|
107
|
+
</td>
|
|
108
|
+
<td align="center">
|
|
109
|
+
<a href="https://github.com/eoghanmurray">
|
|
110
|
+
<img
|
|
111
|
+
src="https://avatars.githubusercontent.com/u/156780?s=100"
|
|
112
|
+
width="100px;"
|
|
113
|
+
alt=""
|
|
114
|
+
/>
|
|
115
|
+
<br /><sub><b>eoghanmurray</b></sub>
|
|
116
|
+
<br /><br />
|
|
117
|
+
</a>
|
|
118
|
+
</td>
|
|
119
|
+
<td align="center">
|
|
120
|
+
<a href="https://github.com/Juice10">
|
|
121
|
+
<img
|
|
122
|
+
src="https://avatars.githubusercontent.com/u/4106?s=100"
|
|
123
|
+
width="100px;"
|
|
124
|
+
alt=""
|
|
125
|
+
/>
|
|
126
|
+
<br /><sub><b>Juice10</b></sub>
|
|
127
|
+
<br /><sub>open for rrweb consulting</sub>
|
|
128
|
+
</a>
|
|
129
|
+
</td>
|
|
130
|
+
</tr>
|
|
131
|
+
</table>
|
|
132
|
+
|
|
133
|
+
## Who's using rrweb?
|
|
134
|
+
|
|
135
|
+
<table>
|
|
136
|
+
<tr>
|
|
137
|
+
<td align="center">
|
|
138
|
+
<a href="http://www.smartx.com/" target="_blank">
|
|
139
|
+
<img width="195px" src="https://www.rrweb.io/logos/smartx.png">
|
|
140
|
+
</a>
|
|
141
|
+
</td>
|
|
142
|
+
<td align="center">
|
|
143
|
+
<a href="https://posthog.com?utm_source=rrweb&utm_medium=sponsorship&utm_campaign=open-source-sponsorship" target="_blank">
|
|
144
|
+
<img width="195px" src="https://www.rrweb.io/logos/posthog.png">
|
|
145
|
+
</a>
|
|
146
|
+
</td>
|
|
147
|
+
<td align="center">
|
|
148
|
+
<a href="https://statcounter.com/session-replay/" target="_blank">
|
|
149
|
+
<img width="195px" src="https://statcounter.com/images/logo-statcounter-arc-blue.svg">
|
|
150
|
+
</a>
|
|
151
|
+
</td>
|
|
152
|
+
<td align="center">
|
|
153
|
+
<a href="https://recordonce.com/" target="_blank">
|
|
154
|
+
<img width="195px" alt="Smart screen recording for SaaS" src="https://uploads-ssl.webflow.com/5f3d133183156245630d4446/5f3d1940abe8db8612c23521_Record-Once-logo-554x80px.svg">
|
|
155
|
+
</a>
|
|
156
|
+
</td>
|
|
157
|
+
</tr>
|
|
158
|
+
<tr>
|
|
159
|
+
<td align="center">
|
|
160
|
+
<a href="https://cux.io" target="_blank">
|
|
161
|
+
<img style="padding: 8px" alt="The first ever UX automation tool" width="195px" src="https://cux.io/cux-logo.svg">
|
|
162
|
+
</a>
|
|
163
|
+
</td>
|
|
164
|
+
<td align="center">
|
|
165
|
+
<a href="https://remsupp.com" target="_blank">
|
|
166
|
+
<img style="padding: 8px" alt="Remote Access & Co-Browsing" width="195px" src="https://remsupp.com/images/logo.png">
|
|
167
|
+
</a>
|
|
168
|
+
</td>
|
|
169
|
+
<td align="center">
|
|
170
|
+
<a href="https://highlight.io" target="_blank">
|
|
171
|
+
<img style="padding: 8px" alt="The open source, fullstack Monitoring Platform." width="195px" src="https://github.com/highlight/highlight/raw/main/highlight.io/public/images/logo.png">
|
|
172
|
+
</a>
|
|
173
|
+
</td>
|
|
174
|
+
<td align="center">
|
|
175
|
+
<a href="https://analyzee.io" target="_blank">
|
|
176
|
+
<img style="padding: 8px" alt="Comprehensive data analytics platform that empowers businesses to gain valuable insights and make data-driven decisions." width="195px" src="https://cdn.analyzee.io/assets/analyzee-logo.png">
|
|
177
|
+
</a>
|
|
178
|
+
</td>
|
|
179
|
+
</tr>
|
|
180
|
+
<tr>
|
|
181
|
+
<td align="center">
|
|
182
|
+
<a href="https://requestly.io" target="_blank">
|
|
183
|
+
<img style="padding: 8px" alt="Intercept, Modify, Record & Replay HTTP Requests." width="195px" src="https://github.com/requestly/requestly/assets/16779465/652552db-c867-44cb-9bb5-94a2026e04ca">
|
|
184
|
+
</a>
|
|
185
|
+
</td>
|
|
186
|
+
<td align="center">
|
|
187
|
+
<a href="https://gleap.io" target="_blank">
|
|
188
|
+
<img style="padding: 8px" alt="In-app bug reporting & customer feedback platform." width="195px" src="https://assets-global.website-files.com/6506f3f29c68b1724807619d/6506f56010237164c6306591_GleapLogo.svg">
|
|
189
|
+
</a>
|
|
190
|
+
</td>
|
|
191
|
+
<td align="center">
|
|
192
|
+
<a href="https://uxwizz.com" target="_blank">
|
|
193
|
+
<img style="padding: 8px" alt="Self-hosted website analytics with heatmaps and session recordings." width="195px" src="https://github.com/UXWizz/public-files/raw/main/assets/logo.png">
|
|
194
|
+
</a>
|
|
195
|
+
</td>
|
|
196
|
+
<td align="center">
|
|
197
|
+
<a href="https://www.howdygo.com" target="_blank">
|
|
198
|
+
<img style="padding: 8px" alt="Interactive product demos for small marketing teams" width="195px" src="https://assets-global.website-files.com/650afb446f1dd5bd410f00cc/650b2cec6188ff54dd9b01e1_Logo.svg">
|
|
199
|
+
</a>
|
|
200
|
+
</td>
|
|
201
|
+
</tr>
|
|
202
|
+
</table>
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReplayPlugin } from '@betterbugs/rrweb';
|
|
2
|
+
import { SequentialIdOptions } from '@betterbugs/rrweb-plugin-sequential-id-record';
|
|
3
|
+
|
|
4
|
+
export declare const getReplaySequentialIdPlugin: (options?: Partial<Options>) => ReplayPlugin;
|
|
5
|
+
|
|
6
|
+
declare type Options = SequentialIdOptions & {
|
|
7
|
+
warnOnMissingId: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { }
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReplayPlugin } from '@betterbugs/rrweb';
|
|
2
|
+
import { SequentialIdOptions } from '@betterbugs/rrweb-plugin-sequential-id-record';
|
|
3
|
+
|
|
4
|
+
export declare const getReplaySequentialIdPlugin: (options?: Partial<Options>) => ReplayPlugin;
|
|
5
|
+
|
|
6
|
+
declare type Options = SequentialIdOptions & {
|
|
7
|
+
warnOnMissingId: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const defaultOptions = {
|
|
4
|
+
key: "_sid",
|
|
5
|
+
warnOnMissingId: true
|
|
6
|
+
};
|
|
7
|
+
const getReplaySequentialIdPlugin = (options) => {
|
|
8
|
+
const { key, warnOnMissingId } = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
|
|
9
|
+
let currentId = 1;
|
|
10
|
+
return {
|
|
11
|
+
handler(event) {
|
|
12
|
+
if (key in event) {
|
|
13
|
+
const id = event[key];
|
|
14
|
+
if (id !== currentId) {
|
|
15
|
+
console.error(
|
|
16
|
+
`[sequential-id-plugin]: expect to get an id with value "${currentId}", but got "${id}"`
|
|
17
|
+
);
|
|
18
|
+
} else {
|
|
19
|
+
currentId++;
|
|
20
|
+
}
|
|
21
|
+
} else if (warnOnMissingId) {
|
|
22
|
+
console.warn(
|
|
23
|
+
`[sequential-id-plugin]: failed to get id in key: "${key}"`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
exports.getReplaySequentialIdPlugin = getReplaySequentialIdPlugin;
|
|
30
|
+
//# sourceMappingURL=rrweb-plugin-sequential-id-replay.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rrweb-plugin-sequential-id-replay.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { SequentialIdOptions } from '@betterbugs/rrweb-plugin-sequential-id-record';\nimport type { ReplayPlugin } from '@betterbugs/rrweb';\nimport type { eventWithTime } from '@betterbugs/types';\n\ntype Options = SequentialIdOptions & {\n warnOnMissingId: boolean;\n};\n\nconst defaultOptions: Options = {\n key: '_sid',\n warnOnMissingId: true,\n};\n\nexport const getReplaySequentialIdPlugin: (\n options?: Partial<Options>,\n) => ReplayPlugin = (options) => {\n const { key, warnOnMissingId } = options\n ? Object.assign({}, defaultOptions, options)\n : defaultOptions;\n let currentId = 1;\n\n return {\n handler(event: eventWithTime) {\n if (key in event) {\n const id = (event as unknown as Record<string, number>)[key];\n if (id !== currentId) {\n console.error(\n `[sequential-id-plugin]: expect to get an id with value \"${currentId}\", but got \"${id}\"`,\n );\n } else {\n currentId++;\n }\n } else if (warnOnMissingId) {\n console.warn(\n `[sequential-id-plugin]: failed to get id in key: \"${key}\"`,\n );\n }\n },\n };\n};\n"],"names":[],"mappings":";;AAQA,MAAM,iBAA0B;AAAA,EAC9B,KAAK;AAAA,EACL,iBAAiB;AACnB;AAEa,MAAA,8BAEO,CAAC,YAAY;AACzB,QAAA,EAAE,KAAK,gBAAoB,IAAA,UAC7B,OAAO,OAAO,IAAI,gBAAgB,OAAO,IACzC;AACJ,MAAI,YAAY;AAET,SAAA;AAAA,IACL,QAAQ,OAAsB;AAC5B,UAAI,OAAO,OAAO;AACV,cAAA,KAAM,MAA4C,GAAG;AAC3D,YAAI,OAAO,WAAW;AACZ,kBAAA;AAAA,YACN,2DAA2D,SAAS,eAAe,EAAE;AAAA,UAAA;AAAA,QACvF,OACK;AACL;AAAA,QACF;AAAA,iBACS,iBAAiB;AAClB,gBAAA;AAAA,UACN,qDAAqD,GAAG;AAAA,QAAA;AAAA,MAE5D;AAAA,IACF;AAAA,EAAA;AAEJ;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const defaultOptions = {
|
|
2
|
+
key: "_sid",
|
|
3
|
+
warnOnMissingId: true
|
|
4
|
+
};
|
|
5
|
+
const getReplaySequentialIdPlugin = (options) => {
|
|
6
|
+
const { key, warnOnMissingId } = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
|
|
7
|
+
let currentId = 1;
|
|
8
|
+
return {
|
|
9
|
+
handler(event) {
|
|
10
|
+
if (key in event) {
|
|
11
|
+
const id = event[key];
|
|
12
|
+
if (id !== currentId) {
|
|
13
|
+
console.error(
|
|
14
|
+
`[sequential-id-plugin]: expect to get an id with value "${currentId}", but got "${id}"`
|
|
15
|
+
);
|
|
16
|
+
} else {
|
|
17
|
+
currentId++;
|
|
18
|
+
}
|
|
19
|
+
} else if (warnOnMissingId) {
|
|
20
|
+
console.warn(
|
|
21
|
+
`[sequential-id-plugin]: failed to get id in key: "${key}"`
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
getReplaySequentialIdPlugin
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=rrweb-plugin-sequential-id-replay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rrweb-plugin-sequential-id-replay.js","sources":["../src/index.ts"],"sourcesContent":["import type { SequentialIdOptions } from '@betterbugs/rrweb-plugin-sequential-id-record';\nimport type { ReplayPlugin } from '@betterbugs/rrweb';\nimport type { eventWithTime } from '@betterbugs/types';\n\ntype Options = SequentialIdOptions & {\n warnOnMissingId: boolean;\n};\n\nconst defaultOptions: Options = {\n key: '_sid',\n warnOnMissingId: true,\n};\n\nexport const getReplaySequentialIdPlugin: (\n options?: Partial<Options>,\n) => ReplayPlugin = (options) => {\n const { key, warnOnMissingId } = options\n ? Object.assign({}, defaultOptions, options)\n : defaultOptions;\n let currentId = 1;\n\n return {\n handler(event: eventWithTime) {\n if (key in event) {\n const id = (event as unknown as Record<string, number>)[key];\n if (id !== currentId) {\n console.error(\n `[sequential-id-plugin]: expect to get an id with value \"${currentId}\", but got \"${id}\"`,\n );\n } else {\n currentId++;\n }\n } else if (warnOnMissingId) {\n console.warn(\n `[sequential-id-plugin]: failed to get id in key: \"${key}\"`,\n );\n }\n },\n };\n};\n"],"names":[],"mappings":"AAQA,MAAM,iBAA0B;AAAA,EAC9B,KAAK;AAAA,EACL,iBAAiB;AACnB;AAEa,MAAA,8BAEO,CAAC,YAAY;AACzB,QAAA,EAAE,KAAK,gBAAoB,IAAA,UAC7B,OAAO,OAAO,IAAI,gBAAgB,OAAO,IACzC;AACJ,MAAI,YAAY;AAET,SAAA;AAAA,IACL,QAAQ,OAAsB;AAC5B,UAAI,OAAO,OAAO;AACV,cAAA,KAAM,MAA4C,GAAG;AAC3D,YAAI,OAAO,WAAW;AACZ,kBAAA;AAAA,YACN,2DAA2D,SAAS,eAAe,EAAE;AAAA,UAAA;AAAA,QACvF,OACK;AACL;AAAA,QACF;AAAA,iBACS,iBAAiB;AAClB,gBAAA;AAAA,UACN,qDAAqD,GAAG;AAAA,QAAA;AAAA,MAE5D;AAAA,IACF;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
(function (g, f) {
|
|
2
|
+
if ("object" == typeof exports && "object" == typeof module) {
|
|
3
|
+
module.exports = f();
|
|
4
|
+
} else if ("function" == typeof define && define.amd) {
|
|
5
|
+
define("rrwebPluginSequentialIdReplay", [], f);
|
|
6
|
+
} else if ("object" == typeof exports) {
|
|
7
|
+
exports["rrwebPluginSequentialIdReplay"] = f();
|
|
8
|
+
} else {
|
|
9
|
+
g["rrwebPluginSequentialIdReplay"] = f();
|
|
10
|
+
}
|
|
11
|
+
}(this, () => {
|
|
12
|
+
var exports = {};
|
|
13
|
+
var module = { exports };
|
|
14
|
+
"use strict";
|
|
15
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
16
|
+
const defaultOptions = {
|
|
17
|
+
key: "_sid",
|
|
18
|
+
warnOnMissingId: true
|
|
19
|
+
};
|
|
20
|
+
const getReplaySequentialIdPlugin = (options) => {
|
|
21
|
+
const { key, warnOnMissingId } = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
|
|
22
|
+
let currentId = 1;
|
|
23
|
+
return {
|
|
24
|
+
handler(event) {
|
|
25
|
+
if (key in event) {
|
|
26
|
+
const id = event[key];
|
|
27
|
+
if (id !== currentId) {
|
|
28
|
+
console.error(
|
|
29
|
+
`[sequential-id-plugin]: expect to get an id with value "${currentId}", but got "${id}"`
|
|
30
|
+
);
|
|
31
|
+
} else {
|
|
32
|
+
currentId++;
|
|
33
|
+
}
|
|
34
|
+
} else if (warnOnMissingId) {
|
|
35
|
+
console.warn(
|
|
36
|
+
`[sequential-id-plugin]: failed to get id in key: "${key}"`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.getReplaySequentialIdPlugin = getReplaySequentialIdPlugin;
|
|
43
|
+
if (typeof module.exports == "object" && typeof exports == "object") {
|
|
44
|
+
var __cp = (to, from, except, desc) => {
|
|
45
|
+
if ((from && typeof from === "object") || typeof from === "function") {
|
|
46
|
+
for (let key of Object.getOwnPropertyNames(from)) {
|
|
47
|
+
if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except)
|
|
48
|
+
Object.defineProperty(to, key, {
|
|
49
|
+
get: () => from[key],
|
|
50
|
+
enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return to;
|
|
55
|
+
};
|
|
56
|
+
module.exports = __cp(module.exports, exports);
|
|
57
|
+
}
|
|
58
|
+
return module.exports;
|
|
59
|
+
}))
|
|
60
|
+
//# sourceMappingURL=rrweb-plugin-sequential-id-replay.umd.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import type { SequentialIdOptions } from '@betterbugs/rrweb-plugin-sequential-id-record';\nimport type { ReplayPlugin } from '@betterbugs/rrweb';\nimport type { eventWithTime } from '@betterbugs/types';\n\ntype Options = SequentialIdOptions & {\n warnOnMissingId: boolean;\n};\n\nconst defaultOptions: Options = {\n key: '_sid',\n warnOnMissingId: true,\n};\n\nexport const getReplaySequentialIdPlugin: (\n options?: Partial<Options>,\n) => ReplayPlugin = (options) => {\n const { key, warnOnMissingId } = options\n ? Object.assign({}, defaultOptions, options)\n : defaultOptions;\n let currentId = 1;\n\n return {\n handler(event: eventWithTime) {\n if (key in event) {\n const id = (event as unknown as Record<string, number>)[key];\n if (id !== currentId) {\n console.error(\n `[sequential-id-plugin]: expect to get an id with value \"${currentId}\", but got \"${id}\"`,\n );\n } else {\n currentId++;\n }\n } else if (warnOnMissingId) {\n console.warn(\n `[sequential-id-plugin]: failed to get id in key: \"${key}\"`,\n );\n }\n },\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAQA,MAAM,iBAA0B;EAC9B,KAAK;EACL,iBAAiB;AACnB;AAEa,MAAA,8BAEO,CAAC,YAAY;AACzB,QAAA,EAAE,KAAK,gBAAoB,IAAA,UAC7B,OAAO,OAAO,CAAA,GAAI,gBAAgB,OAAO,IACzC;AACJ,MAAI,YAAY;AAET,SAAA;IACL,QAAQ,OAAsB;AAC5B,UAAI,OAAO,OAAO;AACV,cAAA,KAAM,MAA4C,GAAG;AAC3D,YAAI,OAAO,WAAW;AACZ,kBAAA;YACN,2DAA2D,SAAS,eAAe,EAAE;UAAA;QACvF,OACK;AACL;QACF;MAAA,WACS,iBAAiB;AAClB,gBAAA;UACN,qDAAqD,GAAG;QAAA;MAE5D;IACF;EAAA;AAEJ;;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
(function (g, f) {
|
|
2
|
+
if ("object" == typeof exports && "object" == typeof module) {
|
|
3
|
+
module.exports = f();
|
|
4
|
+
} else if ("function" == typeof define && define.amd) {
|
|
5
|
+
define("rrwebPluginSequentialIdReplay", [], f);
|
|
6
|
+
} else if ("object" == typeof exports) {
|
|
7
|
+
exports["rrwebPluginSequentialIdReplay"] = f();
|
|
8
|
+
} else {
|
|
9
|
+
g["rrwebPluginSequentialIdReplay"] = f();
|
|
10
|
+
}
|
|
11
|
+
}(this, () => {
|
|
12
|
+
var exports = {};
|
|
13
|
+
var module = { exports };
|
|
14
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={key:"_sid",warnOnMissingId:!0},u=n=>{const{key:e,warnOnMissingId:a}=n?Object.assign({},s,n):s;let i=1;return{handler(t){if(e in t){const l=t[e];l!==i?console.error(`[sequential-id-plugin]: expect to get an id with value "${i}", but got "${l}"`):i++}else a&&console.warn(`[sequential-id-plugin]: failed to get id in key: "${e}"`)}}};exports.getReplaySequentialIdPlugin=u;
|
|
15
|
+
if (typeof module.exports == "object" && typeof exports == "object") {
|
|
16
|
+
var __cp = (to, from, except, desc) => {
|
|
17
|
+
if ((from && typeof from === "object") || typeof from === "function") {
|
|
18
|
+
for (let key of Object.getOwnPropertyNames(from)) {
|
|
19
|
+
if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except)
|
|
20
|
+
Object.defineProperty(to, key, {
|
|
21
|
+
get: () => from[key],
|
|
22
|
+
enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
module.exports = __cp(module.exports, exports);
|
|
29
|
+
}
|
|
30
|
+
return module.exports;
|
|
31
|
+
}))
|
|
32
|
+
//# sourceMappingURL=rrweb-plugin-sequential-id-replay.umd.min.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import type { SequentialIdOptions } from '@betterbugs/rrweb-plugin-sequential-id-record';\nimport type { ReplayPlugin } from '@betterbugs/rrweb';\nimport type { eventWithTime } from '@betterbugs/types';\n\ntype Options = SequentialIdOptions & {\n warnOnMissingId: boolean;\n};\n\nconst defaultOptions: Options = {\n key: '_sid',\n warnOnMissingId: true,\n};\n\nexport const getReplaySequentialIdPlugin: (\n options?: Partial<Options>,\n) => ReplayPlugin = (options) => {\n const { key, warnOnMissingId } = options\n ? Object.assign({}, defaultOptions, options)\n : defaultOptions;\n let currentId = 1;\n\n return {\n handler(event: eventWithTime) {\n if (key in event) {\n const id = (event as unknown as Record<string, number>)[key];\n if (id !== currentId) {\n console.error(\n `[sequential-id-plugin]: expect to get an id with value \"${currentId}\", but got \"${id}\"`,\n );\n } else {\n currentId++;\n }\n } else if (warnOnMissingId) {\n console.warn(\n `[sequential-id-plugin]: failed to get id in key: \"${key}\"`,\n );\n }\n },\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;gFAQA,MAAMA,EAA0B,CAC9B,IAAK,OACL,gBAAiB,EACnB,EAEaC,EAEQC,GAAY,CACzB,KAAA,CAAE,IAAAC,EAAK,gBAAAC,CAAoB,EAAAF,EAC7B,OAAO,OAAO,CAAA,EAAIF,EAAgBE,CAAO,EACzCF,EACJ,IAAIK,EAAY,EAET,MAAA,CACL,QAAQC,EAAsB,CAC5B,GAAIH,KAAOG,EAAO,CACV,MAAAC,EAAMD,EAA4CH,CAAG,EACvDI,IAAOF,EACD,QAAA,MACN,2DAA2DA,CAAS,eAAeE,CAAE,GAAA,EAGvFF,GACF,MACSD,GACD,QAAA,KACN,qDAAqDD,CAAG,GAAA,CAG9D,CAAA,CAEJ",
|
|
6
|
+
"names": ["defaultOptions", "getReplaySequentialIdPlugin", "options", "key", "warnOnMissingId", "currentId", "event", "id"]
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@betterbugs/rrweb-plugin-sequential-id-replay",
|
|
3
|
+
"version": "2.0.0-alpha.19",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"description": "",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/rrweb-plugin-sequential-id-replay.umd.cjs",
|
|
10
|
+
"module": "./dist/rrweb-plugin-sequential-id-replay.js",
|
|
11
|
+
"unpkg": "./dist/rrweb-plugin-sequential-id-replay.umd.cjs",
|
|
12
|
+
"typings": "dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/rrweb-plugin-sequential-id-replay.js"
|
|
18
|
+
},
|
|
19
|
+
"require": {
|
|
20
|
+
"types": "./dist/index.d.cts",
|
|
21
|
+
"default": "./dist/rrweb-plugin-sequential-id-replay.umd.cjs"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"package.json"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"dev": "vite build --watch",
|
|
31
|
+
"build": "yarn turbo run prepublish",
|
|
32
|
+
"check-types": "tsc -noEmit",
|
|
33
|
+
"prepublish": "tsc -noEmit && vite build"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/BetterBugs-Team/rrweb.git"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"rrweb",
|
|
41
|
+
"betterbugs"
|
|
42
|
+
],
|
|
43
|
+
"author": "BetterBugs-Team",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/BetterBugs-Team/rrweb/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/BetterBugs-Team/rrweb#readme",
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@betterbugs/rrweb-plugin-sequential-id-record": "^2.0.0-alpha.19",
|
|
51
|
+
"@betterbugs/rrweb": "^2.0.0-alpha.19",
|
|
52
|
+
"typescript": "^5.4.5",
|
|
53
|
+
"vite": "^5.3.1",
|
|
54
|
+
"vite-plugin-dts": "^3.9.1"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@betterbugs/rrweb": "^2.0.0-alpha.19"
|
|
58
|
+
}
|
|
59
|
+
}
|