@appsurify-testmap/rrweb-plugin-sequential-id-record 2.1.0-alpha.1 → 2.1.0-alpha.2

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/dist/index.d.cts CHANGED
@@ -2,10 +2,13 @@ import { RecordPlugin } from '@appsurify-testmap/rrweb-types';
2
2
 
3
3
  export declare const getRecordSequentialIdPlugin: (options?: Partial<SequentialIdOptions>) => RecordPlugin;
4
4
 
5
+ export declare let globalSequentialId: number;
6
+
5
7
  export declare const PLUGIN_NAME = "rrweb/sequential-id@1";
6
8
 
7
9
  export declare type SequentialIdOptions = {
8
10
  key: string;
11
+ getId?: () => number;
9
12
  };
10
13
 
11
14
  export { }
package/dist/index.d.ts CHANGED
@@ -2,10 +2,13 @@ import { RecordPlugin } from '@appsurify-testmap/rrweb-types';
2
2
 
3
3
  export declare const getRecordSequentialIdPlugin: (options?: Partial<SequentialIdOptions>) => RecordPlugin;
4
4
 
5
+ export declare let globalSequentialId: number;
6
+
5
7
  export declare const PLUGIN_NAME = "rrweb/sequential-id@1";
6
8
 
7
9
  export declare type SequentialIdOptions = {
8
10
  key: string;
11
+ getId?: () => number;
9
12
  };
10
13
 
11
14
  export { }
@@ -3,15 +3,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const defaultOptions = {
4
4
  key: "_sid"
5
5
  };
6
+ let globalSequentialId = 0;
6
7
  const PLUGIN_NAME = "rrweb/sequential-id@1";
7
8
  const getRecordSequentialIdPlugin = (options) => {
8
- const _options = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
9
- let id = 0;
9
+ const _options = Object.assign({}, defaultOptions, options);
10
+ let localId = 0;
10
11
  return {
11
12
  name: PLUGIN_NAME,
12
13
  eventProcessor(event) {
14
+ const id = _options.getId ? _options.getId() : ++localId;
13
15
  Object.assign(event, {
14
- [_options.key]: ++id
16
+ [_options.key]: id
15
17
  });
16
18
  return event;
17
19
  },
@@ -20,4 +22,5 @@ const getRecordSequentialIdPlugin = (options) => {
20
22
  };
21
23
  exports.PLUGIN_NAME = PLUGIN_NAME;
22
24
  exports.getRecordSequentialIdPlugin = getRecordSequentialIdPlugin;
25
+ exports.globalSequentialId = globalSequentialId;
23
26
  //# sourceMappingURL=rrweb-plugin-sequential-id-record.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rrweb-plugin-sequential-id-record.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { RecordPlugin } from '@appsurify-testmap/rrweb-types';\n\nexport type SequentialIdOptions = {\n key: string;\n};\n\nconst defaultOptions: SequentialIdOptions = {\n key: '_sid',\n};\n\nexport const PLUGIN_NAME = 'rrweb/sequential-id@1';\n\nexport const getRecordSequentialIdPlugin: (\n options?: Partial<SequentialIdOptions>,\n) => RecordPlugin = (options) => {\n const _options = options\n ? Object.assign({}, defaultOptions, options)\n : defaultOptions;\n let id = 0;\n\n return {\n name: PLUGIN_NAME,\n eventProcessor(event) {\n Object.assign(event, {\n [_options.key]: ++id,\n });\n return event;\n },\n options: _options,\n };\n};\n"],"names":[],"mappings":";;AAMA,MAAM,iBAAsC;AAAA,EAC1C,KAAK;AACP;AAEO,MAAM,cAAc;AAEd,MAAA,8BAEO,CAAC,YAAY;AACzB,QAAA,WAAW,UACb,OAAO,OAAO,CAAA,GAAI,gBAAgB,OAAO,IACzC;AACJ,MAAI,KAAK;AAEF,SAAA;AAAA,IACL,MAAM;AAAA,IACN,eAAe,OAAO;AACpB,aAAO,OAAO,OAAO;AAAA,QACnB,CAAC,SAAS,GAAG,GAAG,EAAE;AAAA,MAAA,CACnB;AACM,aAAA;AAAA,IACT;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;;;"}
1
+ {"version":3,"file":"rrweb-plugin-sequential-id-record.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { RecordPlugin } from '@appsurify-testmap/rrweb-types';\n\nexport type SequentialIdOptions = {\n key: string;\n getId?: () => number; // ❗️необязательный колбэк для получения ID\n};\n\nconst defaultOptions: SequentialIdOptions = {\n key: '_sid',\n};\n\nexport let globalSequentialId = 0;\n\nexport const PLUGIN_NAME = 'rrweb/sequential-id@1';\n\nexport const getRecordSequentialIdPlugin: (\n options?: Partial<SequentialIdOptions>,\n) => RecordPlugin = (options) => {\n const _options = Object.assign({}, defaultOptions, options);\n let localId = 0;\n\n return {\n name: PLUGIN_NAME,\n eventProcessor(event) {\n const id = _options.getId ? _options.getId() : ++localId;\n Object.assign(event, {\n [_options.key]: id,\n });\n return event;\n },\n options: _options,\n };\n};\n"],"names":[],"mappings":";;AAOA,MAAM,iBAAsC;AAAA,EAC1C,KAAK;AACP;AAEO,IAAI,qBAAqB;AAEzB,MAAM,cAAc;AAEd,MAAA,8BAEO,CAAC,YAAY;AAC/B,QAAM,WAAW,OAAO,OAAO,CAAA,GAAI,gBAAgB,OAAO;AAC1D,MAAI,UAAU;AAEP,SAAA;AAAA,IACL,MAAM;AAAA,IACN,eAAe,OAAO;AACpB,YAAM,KAAK,SAAS,QAAQ,SAAS,MAAA,IAAU,EAAE;AACjD,aAAO,OAAO,OAAO;AAAA,QACnB,CAAC,SAAS,GAAG,GAAG;AAAA,MAAA,CACjB;AACM,aAAA;AAAA,IACT;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;;;;"}
@@ -1,15 +1,17 @@
1
1
  const defaultOptions = {
2
2
  key: "_sid"
3
3
  };
4
+ let globalSequentialId = 0;
4
5
  const PLUGIN_NAME = "rrweb/sequential-id@1";
5
6
  const getRecordSequentialIdPlugin = (options) => {
6
- const _options = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
7
- let id = 0;
7
+ const _options = Object.assign({}, defaultOptions, options);
8
+ let localId = 0;
8
9
  return {
9
10
  name: PLUGIN_NAME,
10
11
  eventProcessor(event) {
12
+ const id = _options.getId ? _options.getId() : ++localId;
11
13
  Object.assign(event, {
12
- [_options.key]: ++id
14
+ [_options.key]: id
13
15
  });
14
16
  return event;
15
17
  },
@@ -18,6 +20,7 @@ const getRecordSequentialIdPlugin = (options) => {
18
20
  };
19
21
  export {
20
22
  PLUGIN_NAME,
21
- getRecordSequentialIdPlugin
23
+ getRecordSequentialIdPlugin,
24
+ globalSequentialId
22
25
  };
23
26
  //# sourceMappingURL=rrweb-plugin-sequential-id-record.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rrweb-plugin-sequential-id-record.js","sources":["../src/index.ts"],"sourcesContent":["import type { RecordPlugin } from '@appsurify-testmap/rrweb-types';\n\nexport type SequentialIdOptions = {\n key: string;\n};\n\nconst defaultOptions: SequentialIdOptions = {\n key: '_sid',\n};\n\nexport const PLUGIN_NAME = 'rrweb/sequential-id@1';\n\nexport const getRecordSequentialIdPlugin: (\n options?: Partial<SequentialIdOptions>,\n) => RecordPlugin = (options) => {\n const _options = options\n ? Object.assign({}, defaultOptions, options)\n : defaultOptions;\n let id = 0;\n\n return {\n name: PLUGIN_NAME,\n eventProcessor(event) {\n Object.assign(event, {\n [_options.key]: ++id,\n });\n return event;\n },\n options: _options,\n };\n};\n"],"names":[],"mappings":"AAMA,MAAM,iBAAsC;AAAA,EAC1C,KAAK;AACP;AAEO,MAAM,cAAc;AAEd,MAAA,8BAEO,CAAC,YAAY;AACzB,QAAA,WAAW,UACb,OAAO,OAAO,CAAA,GAAI,gBAAgB,OAAO,IACzC;AACJ,MAAI,KAAK;AAEF,SAAA;AAAA,IACL,MAAM;AAAA,IACN,eAAe,OAAO;AACpB,aAAO,OAAO,OAAO;AAAA,QACnB,CAAC,SAAS,GAAG,GAAG,EAAE;AAAA,MAAA,CACnB;AACM,aAAA;AAAA,IACT;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;"}
1
+ {"version":3,"file":"rrweb-plugin-sequential-id-record.js","sources":["../src/index.ts"],"sourcesContent":["import type { RecordPlugin } from '@appsurify-testmap/rrweb-types';\n\nexport type SequentialIdOptions = {\n key: string;\n getId?: () => number; // ❗️необязательный колбэк для получения ID\n};\n\nconst defaultOptions: SequentialIdOptions = {\n key: '_sid',\n};\n\nexport let globalSequentialId = 0;\n\nexport const PLUGIN_NAME = 'rrweb/sequential-id@1';\n\nexport const getRecordSequentialIdPlugin: (\n options?: Partial<SequentialIdOptions>,\n) => RecordPlugin = (options) => {\n const _options = Object.assign({}, defaultOptions, options);\n let localId = 0;\n\n return {\n name: PLUGIN_NAME,\n eventProcessor(event) {\n const id = _options.getId ? _options.getId() : ++localId;\n Object.assign(event, {\n [_options.key]: id,\n });\n return event;\n },\n options: _options,\n };\n};\n"],"names":[],"mappings":"AAOA,MAAM,iBAAsC;AAAA,EAC1C,KAAK;AACP;AAEO,IAAI,qBAAqB;AAEzB,MAAM,cAAc;AAEd,MAAA,8BAEO,CAAC,YAAY;AAC/B,QAAM,WAAW,OAAO,OAAO,CAAA,GAAI,gBAAgB,OAAO;AAC1D,MAAI,UAAU;AAEP,SAAA;AAAA,IACL,MAAM;AAAA,IACN,eAAe,OAAO;AACpB,YAAM,KAAK,SAAS,QAAQ,SAAS,MAAA,IAAU,EAAE;AACjD,aAAO,OAAO,OAAO;AAAA,QACnB,CAAC,SAAS,GAAG,GAAG;AAAA,MAAA,CACjB;AACM,aAAA;AAAA,IACT;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;"}
@@ -16,15 +16,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
16
16
  const defaultOptions = {
17
17
  key: "_sid"
18
18
  };
19
+ let globalSequentialId = 0;
19
20
  const PLUGIN_NAME = "rrweb/sequential-id@1";
20
21
  const getRecordSequentialIdPlugin = (options) => {
21
- const _options = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
22
- let id = 0;
22
+ const _options = Object.assign({}, defaultOptions, options);
23
+ let localId = 0;
23
24
  return {
24
25
  name: PLUGIN_NAME,
25
26
  eventProcessor(event) {
27
+ const id = _options.getId ? _options.getId() : ++localId;
26
28
  Object.assign(event, {
27
- [_options.key]: ++id
29
+ [_options.key]: id
28
30
  });
29
31
  return event;
30
32
  },
@@ -33,6 +35,7 @@ const getRecordSequentialIdPlugin = (options) => {
33
35
  };
34
36
  exports.PLUGIN_NAME = PLUGIN_NAME;
35
37
  exports.getRecordSequentialIdPlugin = getRecordSequentialIdPlugin;
38
+ exports.globalSequentialId = globalSequentialId;
36
39
  if (typeof module.exports == "object" && typeof exports == "object") {
37
40
  var __cp = (to, from, except, desc) => {
38
41
  if ((from && typeof from === "object") || typeof from === "function") {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import type { RecordPlugin } from '@appsurify-testmap/rrweb-types';\n\nexport type SequentialIdOptions = {\n key: string;\n};\n\nconst defaultOptions: SequentialIdOptions = {\n key: '_sid',\n};\n\nexport const PLUGIN_NAME = 'rrweb/sequential-id@1';\n\nexport const getRecordSequentialIdPlugin: (\n options?: Partial<SequentialIdOptions>,\n) => RecordPlugin = (options) => {\n const _options = options\n ? Object.assign({}, defaultOptions, options)\n : defaultOptions;\n let id = 0;\n\n return {\n name: PLUGIN_NAME,\n eventProcessor(event) {\n Object.assign(event, {\n [_options.key]: ++id,\n });\n return event;\n },\n options: _options,\n };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;AAMA,MAAM,iBAAsC;EAC1C,KAAK;AACP;AAEO,MAAM,cAAc;AAEd,MAAA,8BAEO,CAAC,YAAY;AACzB,QAAA,WAAW,UACb,OAAO,OAAO,CAAA,GAAI,gBAAgB,OAAO,IACzC;AACJ,MAAI,KAAK;AAEF,SAAA;IACL,MAAM;IACN,eAAe,OAAO;AACpB,aAAO,OAAO,OAAO;QACnB,CAAC,SAAS,GAAG,GAAG,EAAE;MAAA,CACnB;AACM,aAAA;IACT;IACA,SAAS;EAAA;AAEb;;;",
4
+ "sourcesContent": ["import type { RecordPlugin } from '@appsurify-testmap/rrweb-types';\n\nexport type SequentialIdOptions = {\n key: string;\n getId?: () => number; // ❗️необязательный колбэк для получения ID\n};\n\nconst defaultOptions: SequentialIdOptions = {\n key: '_sid',\n};\n\nexport let globalSequentialId = 0;\n\nexport const PLUGIN_NAME = 'rrweb/sequential-id@1';\n\nexport const getRecordSequentialIdPlugin: (\n options?: Partial<SequentialIdOptions>,\n) => RecordPlugin = (options) => {\n const _options = Object.assign({}, defaultOptions, options);\n let localId = 0;\n\n return {\n name: PLUGIN_NAME,\n eventProcessor(event) {\n const id = _options.getId ? _options.getId() : ++localId;\n Object.assign(event, {\n [_options.key]: id,\n });\n return event;\n },\n options: _options,\n };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;AAOA,MAAM,iBAAsC;EAC1C,KAAK;AACP;AAEO,IAAI,qBAAqB;AAEzB,MAAM,cAAc;AAEd,MAAA,8BAEO,CAAC,YAAY;AAC/B,QAAM,WAAW,OAAO,OAAO,CAAA,GAAI,gBAAgB,OAAO;AAC1D,MAAI,UAAU;AAEP,SAAA;IACL,MAAM;IACN,eAAe,OAAO;AACpB,YAAM,KAAK,SAAS,QAAQ,SAAS,MAAA,IAAU,EAAE;AACjD,aAAO,OAAO,OAAO;QACnB,CAAC,SAAS,GAAG,GAAG;MAAA,CACjB;AACM,aAAA;IACT;IACA,SAAS;EAAA;AAEb;;;;",
6
6
  "names": []
7
7
  }
@@ -11,7 +11,7 @@
11
11
  }(this, () => {
12
12
  var exports = {};
13
13
  var module = { exports };
14
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={key:"_sid"},i="rrweb/sequential-id@1",r=e=>{const t=e?Object.assign({},s,e):s;let o=0;return{name:i,eventProcessor(n){return Object.assign(n,{[t.key]:++o}),n},options:t}};exports.PLUGIN_NAME=i;exports.getRecordSequentialIdPlugin=r;
14
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={key:"_sid"};let d=0;const n="rrweb/sequential-id@1",a=o=>{const e=Object.assign({},s,o);let l=0;return{name:n,eventProcessor(t){const i=e.getId?e.getId():++l;return Object.assign(t,{[e.key]:i}),t},options:e}};exports.PLUGIN_NAME=n;exports.getRecordSequentialIdPlugin=a;exports.globalSequentialId=d;
15
15
  if (typeof module.exports == "object" && typeof exports == "object") {
16
16
  var __cp = (to, from, except, desc) => {
17
17
  if ((from && typeof from === "object") || typeof from === "function") {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import type { RecordPlugin } from '@appsurify-testmap/rrweb-types';\n\nexport type SequentialIdOptions = {\n key: string;\n};\n\nconst defaultOptions: SequentialIdOptions = {\n key: '_sid',\n};\n\nexport const PLUGIN_NAME = 'rrweb/sequential-id@1';\n\nexport const getRecordSequentialIdPlugin: (\n options?: Partial<SequentialIdOptions>,\n) => RecordPlugin = (options) => {\n const _options = options\n ? Object.assign({}, defaultOptions, options)\n : defaultOptions;\n let id = 0;\n\n return {\n name: PLUGIN_NAME,\n eventProcessor(event) {\n Object.assign(event, {\n [_options.key]: ++id,\n });\n return event;\n },\n options: _options,\n };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;gFAMA,MAAMA,EAAsC,CAC1C,IAAK,MACP,EAEaC,EAAc,wBAEdC,EAEQC,GAAY,CACzB,MAAAC,EAAWD,EACb,OAAO,OAAO,CAAA,EAAIH,EAAgBG,CAAO,EACzCH,EACJ,IAAIK,EAAK,EAEF,MAAA,CACL,KAAMJ,EACN,eAAeK,EAAO,CACpB,cAAO,OAAOA,EAAO,CACnB,CAACF,EAAS,GAAG,EAAG,EAAEC,CAAA,CACnB,EACMC,CACT,EACA,QAASF,CAAA,CAEb",
6
- "names": ["defaultOptions", "PLUGIN_NAME", "getRecordSequentialIdPlugin", "options", "_options", "id", "event"]
4
+ "sourcesContent": ["import type { RecordPlugin } from '@appsurify-testmap/rrweb-types';\n\nexport type SequentialIdOptions = {\n key: string;\n getId?: () => number; // ❗️необязательный колбэк для получения ID\n};\n\nconst defaultOptions: SequentialIdOptions = {\n key: '_sid',\n};\n\nexport let globalSequentialId = 0;\n\nexport const PLUGIN_NAME = 'rrweb/sequential-id@1';\n\nexport const getRecordSequentialIdPlugin: (\n options?: Partial<SequentialIdOptions>,\n) => RecordPlugin = (options) => {\n const _options = Object.assign({}, defaultOptions, options);\n let localId = 0;\n\n return {\n name: PLUGIN_NAME,\n eventProcessor(event) {\n const id = _options.getId ? _options.getId() : ++localId;\n Object.assign(event, {\n [_options.key]: id,\n });\n return event;\n },\n options: _options,\n };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;gFAOA,MAAMA,EAAsC,CAC1C,IAAK,MACP,EAEO,IAAIC,EAAqB,EAEzB,MAAMC,EAAc,wBAEdC,EAEQC,GAAY,CAC/B,MAAMC,EAAW,OAAO,OAAO,CAAA,EAAIL,EAAgBI,CAAO,EAC1D,IAAIE,EAAU,EAEP,MAAA,CACL,KAAMJ,EACN,eAAeK,EAAO,CACpB,MAAMC,EAAKH,EAAS,MAAQA,EAAS,MAAA,EAAU,EAAEC,EACjD,cAAO,OAAOC,EAAO,CACnB,CAACF,EAAS,GAAG,EAAGG,CAAA,CACjB,EACMD,CACT,EACA,QAASF,CAAA,CAEb",
6
+ "names": ["defaultOptions", "globalSequentialId", "PLUGIN_NAME", "getRecordSequentialIdPlugin", "options", "_options", "localId", "event", "id"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsurify-testmap/rrweb-plugin-sequential-id-record",
3
- "version": "2.1.0-alpha.1",
3
+ "version": "2.1.0-alpha.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/rrweb-plugin-sequential-id-record.umd.cjs",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "homepage": "https://github.com/rrweb-io/rrweb#readme",
45
45
  "devDependencies": {
46
- "@appsurify-testmap/rrweb": "^2.1.0-alpha.1",
46
+ "@appsurify-testmap/rrweb": "^2.1.0-alpha.2",
47
47
  "typescript": "^5.4.5",
48
48
  "vite": "^5.3.1",
49
49
  "vite-plugin-dts": "^3.9.1"