@posthog/plugin-unduplicates
Advanced tools
Sorry, the diff of this file is not supported yet
+0
-5
| import { createHash, randomUUID } from 'crypto'; | ||
| // From UUID Namespace RFC (https://datatracker.ietf.org/doc/html/rfc4122) | ||
| const NAMESPACE_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8'; | ||
@@ -13,4 +12,2 @@ const stringifyEvent = (event) => { | ||
| function stringifyUUID(arr) { | ||
| // Forked from https://github.com/uuidjs/uuid (MIT) | ||
| // Copyright (c) 2010-2020 Robert Kieffer and other contributors | ||
| return (byteToHex[arr[0]] + | ||
@@ -44,3 +41,2 @@ byteToHex[arr[1]] + | ||
| } | ||
| // Create a hash of the relevant properties of the event | ||
| const stringifiedProps = config.dedupMode === 'All Properties' ? `_${JSON.stringify(event.properties)}` : ''; | ||
@@ -51,3 +47,2 @@ const hash = createHash('sha1'); | ||
| .digest(); | ||
| // Convert to UUID v5 spec | ||
| eventKeyBuffer[6] = (eventKeyBuffer[6] & 0x0f) | 0x50; | ||
@@ -54,0 +49,0 @@ eventKeyBuffer[8] = (eventKeyBuffer[8] & 0x3f) | 0x80; |
+1
-1
| { | ||
| "name": "@posthog/plugin-unduplicates", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "description": "Prevent duplicates in your data by rejecting duplicate events at ingestion.", | ||
@@ -5,0 +5,0 @@ "main": "index.ts", |
44582
502.7%6
20%66
-7.04%