@shware/analytics 16.2.2 → 16.2.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/dist/schema/index.cjs +9 -7
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts.map +1 -1
- package/dist/schema/index.d.mts.map +1 -1
- package/dist/schema/index.mjs +9 -7
- package/dist/schema/index.mjs.map +1 -1
- package/dist/server/event-time.cjs +14 -0
- package/dist/server/event-time.cjs.map +1 -0
- package/dist/server/event-time.d.cts +8 -0
- package/dist/server/event-time.d.cts.map +1 -0
- package/dist/server/event-time.d.mts +8 -0
- package/dist/server/event-time.d.mts.map +1 -0
- package/dist/server/event-time.mjs +13 -0
- package/dist/server/event-time.mjs.map +1 -0
- package/dist/server/meta-capi.cjs +4 -3
- package/dist/server/meta-capi.cjs.map +1 -1
- package/dist/server/meta-capi.d.cts.map +1 -1
- package/dist/server/meta-capi.d.mts.map +1 -1
- package/dist/server/meta-capi.mjs +4 -3
- package/dist/server/meta-capi.mjs.map +1 -1
- package/dist/server/microsoft-conversions-api.cjs +2 -1
- package/dist/server/microsoft-conversions-api.cjs.map +1 -1
- package/dist/server/microsoft-conversions-api.d.cts.map +1 -1
- package/dist/server/microsoft-conversions-api.d.mts.map +1 -1
- package/dist/server/microsoft-conversions-api.mjs +2 -1
- package/dist/server/microsoft-conversions-api.mjs.map +1 -1
- package/dist/server/reddit-conversions-api.cjs +2 -1
- package/dist/server/reddit-conversions-api.cjs.map +1 -1
- package/dist/server/reddit-conversions-api.d.cts.map +1 -1
- package/dist/server/reddit-conversions-api.d.mts.map +1 -1
- package/dist/server/reddit-conversions-api.mjs +2 -1
- package/dist/server/reddit-conversions-api.mjs.map +1 -1
- package/dist/visitor/id.cjs +5 -2
- package/dist/visitor/id.cjs.map +1 -1
- package/dist/visitor/id.d.cts +4 -1
- package/dist/visitor/id.d.cts.map +1 -1
- package/dist/visitor/id.d.mts +4 -1
- package/dist/visitor/id.d.mts.map +1 -1
- package/dist/visitor/id.mjs +6 -3
- package/dist/visitor/id.mjs.map +1 -1
- package/package.json +1 -1
package/dist/visitor/id.d.cts
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so
|
|
3
3
|
* it exists the moment the page loads. The first events, and the beacon of a visit left within a
|
|
4
4
|
* second, go out without waiting for a round trip; the server creates the visitor from its first
|
|
5
|
-
* events.
|
|
5
|
+
* events. A uuidv7 a server issued to an older client is kept as it is: the visitor continues.
|
|
6
|
+
* Anything else stored there is replaced, because the server rejects every batch carrying it:
|
|
7
|
+
* clients before 11.0 kept the int64 id older servers issued, and healed it by recreating the
|
|
8
|
+
* visitor when the server refused it; without that round trip the id would never change.
|
|
6
9
|
*
|
|
7
10
|
* Needs a server that creates visitors from events (see the README, "Visitors"); one that still
|
|
8
11
|
* only creates them on `POST /visitors` rejects the events of a new visitor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.d.cts","names":[],"sources":["../../src/visitor/id.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"id.d.cts","names":[],"sources":["../../src/visitor/id.ts"],"mappings":";;;;;;;;;;;;wBAgBgB;;wBASA"}
|
package/dist/visitor/id.d.mts
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so
|
|
3
3
|
* it exists the moment the page loads. The first events, and the beacon of a visit left within a
|
|
4
4
|
* second, go out without waiting for a round trip; the server creates the visitor from its first
|
|
5
|
-
* events.
|
|
5
|
+
* events. A uuidv7 a server issued to an older client is kept as it is: the visitor continues.
|
|
6
|
+
* Anything else stored there is replaced, because the server rejects every batch carrying it:
|
|
7
|
+
* clients before 11.0 kept the int64 id older servers issued, and healed it by recreating the
|
|
8
|
+
* visitor when the server refused it; without that round trip the id would never change.
|
|
6
9
|
*
|
|
7
10
|
* Needs a server that creates visitors from events (see the README, "Visitors"); one that still
|
|
8
11
|
* only creates them on `POST /visitors` rejects the events of a new visitor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.d.mts","names":[],"sources":["../../src/visitor/id.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"id.d.mts","names":[],"sources":["../../src/visitor/id.ts"],"mappings":";;;;;;;;;;;;wBAgBgB;;wBASA"}
|
package/dist/visitor/id.mjs
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { config } from "../setup/index.mjs";
|
|
2
2
|
import { keys } from "../constants/storage.mjs";
|
|
3
|
-
import { v7 } from "uuid";
|
|
3
|
+
import { v7, validate, version } from "uuid";
|
|
4
4
|
// src/visitor/id.ts
|
|
5
5
|
/**
|
|
6
6
|
* This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so
|
|
7
7
|
* it exists the moment the page loads. The first events, and the beacon of a visit left within a
|
|
8
8
|
* second, go out without waiting for a round trip; the server creates the visitor from its first
|
|
9
|
-
* events.
|
|
9
|
+
* events. A uuidv7 a server issued to an older client is kept as it is: the visitor continues.
|
|
10
|
+
* Anything else stored there is replaced, because the server rejects every batch carrying it:
|
|
11
|
+
* clients before 11.0 kept the int64 id older servers issued, and healed it by recreating the
|
|
12
|
+
* visitor when the server refused it; without that round trip the id would never change.
|
|
10
13
|
*
|
|
11
14
|
* Needs a server that creates visitors from events (see the README, "Visitors"); one that still
|
|
12
15
|
* only creates them on `POST /visitors` rejects the events of a new visitor.
|
|
13
16
|
*/
|
|
14
17
|
function visitorId() {
|
|
15
18
|
const stored = config.storage.getItem(keys.visitor_id);
|
|
16
|
-
if (stored && stored
|
|
19
|
+
if (stored && validate(stored) && version(stored) === 7) return stored;
|
|
17
20
|
return newVisitorId();
|
|
18
21
|
}
|
|
19
22
|
/** Starts a new visitor on this device — `reset()` — and returns its id. */
|
package/dist/visitor/id.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.mjs","names":["uuidv7"],"sources":["../../src/visitor/id.ts"],"sourcesContent":["import { v7 as uuidv7 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { config } from '../setup/index';\n\n/**\n * This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so\n * it exists the moment the page loads. The first events, and the beacon of a visit left within a\n * second, go out without waiting for a round trip; the server creates the visitor from its first\n * events.
|
|
1
|
+
{"version":3,"file":"id.mjs","names":["uuidv7"],"sources":["../../src/visitor/id.ts"],"sourcesContent":["import { v7 as uuidv7, validate, version } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { config } from '../setup/index';\n\n/**\n * This visitor's id: generated here on the first visit (uuidv7) and kept in `config.storage`, so\n * it exists the moment the page loads. The first events, and the beacon of a visit left within a\n * second, go out without waiting for a round trip; the server creates the visitor from its first\n * events. A uuidv7 a server issued to an older client is kept as it is: the visitor continues.\n * Anything else stored there is replaced, because the server rejects every batch carrying it:\n * clients before 11.0 kept the int64 id older servers issued, and healed it by recreating the\n * visitor when the server refused it; without that round trip the id would never change.\n *\n * Needs a server that creates visitors from events (see the README, \"Visitors\"); one that still\n * only creates them on `POST /visitors` rejects the events of a new visitor.\n */\nexport function visitorId(): string {\n const stored = config.storage.getItem(keys.visitor_id);\n // Also covers the string 'undefined' an old client stored for an unset id. Replacing it below\n // writes the new id back, which clears the bad value from storage for good.\n if (stored && validate(stored) && version(stored) === 7) return stored;\n return newVisitorId();\n}\n\n/** Starts a new visitor on this device — `reset()` — and returns its id. */\nexport function newVisitorId(): string {\n const id = uuidv7();\n config.storage.setItem(keys.visitor_id, id);\n return id;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAgB,YAAoB;CAClC,MAAM,SAAS,OAAO,QAAQ,QAAQ,KAAK,UAAU;CAGrD,IAAI,UAAU,SAAS,MAAM,KAAK,QAAQ,MAAM,MAAM,GAAG,OAAO;CAChE,OAAO,aAAa;AACtB;;AAGA,SAAgB,eAAuB;CACrC,MAAM,KAAKA,GAAO;CAClB,OAAO,QAAQ,QAAQ,KAAK,YAAY,EAAE;CAC1C,OAAO;AACT"}
|