New:Socket for Asana Is Now Available.Learn more
Get Started

@posthog/core

Package Overview
Dependencies
Maintainers
21
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@posthog/core - npm Package Compare versions

Comparing version
1.48.11
to
1.48.12
+26
src/vendor/uuidv7.spec.ts
import { V7Generator } from './uuidv7'
describe('uuidv7 default RNG', () => {
const realRandom = Math.random
afterEach(() => {
Math.random = realRandom
})
it.each([
['exactly 1.0', 1.0],
['greater than 1', 1.5],
['NaN', NaN],
])('does not throw when Math.random() returns %s', (_label, value) => {
Math.random = () => value
const generator = new V7Generator()
const uuid = generator.generate().toString()
expect(uuid).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/)
})
it('still generates well-formed v7 UUIDs with the real Math.random', () => {
const generator = new V7Generator()
const uuid = generator.generate().toString()
expect(uuid).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/)
})
})
+4
-6

@@ -198,8 +198,6 @@ "use strict";

const parsingPolicy = options.semverParsingPolicy ?? 'strict';
if (key in propertyValues) {
const hasProperty = Object.prototype.hasOwnProperty.call(propertyValues, key);
if (hasProperty) {
if ('is_not_set' === operator) return false;
} else {
if ('is_not_set' === operator) return true;
throw new InconclusiveMatchError(`Property ${key} not found in propertyValues`);
}
} else throw new InconclusiveMatchError(`Property ${key} not found in propertyValues`);
const overrideValue = propertyValues[key];

@@ -227,3 +225,3 @@ if (null == overrideValue && !NULL_VALUES_ALLOWED_OPERATORS.includes(operator)) {

case 'is_set':
return key in propertyValues;
return true;
case 'icontains':

@@ -230,0 +228,0 @@ return String(overrideValue).toLowerCase().includes(String(value).toLowerCase());

@@ -162,8 +162,6 @@ import { parsePayload } from "./featureFlagUtils.mjs";

const parsingPolicy = options.semverParsingPolicy ?? 'strict';
if (key in propertyValues) {
const hasProperty = Object.prototype.hasOwnProperty.call(propertyValues, key);
if (hasProperty) {
if ('is_not_set' === operator) return false;
} else {
if ('is_not_set' === operator) return true;
throw new InconclusiveMatchError(`Property ${key} not found in propertyValues`);
}
} else throw new InconclusiveMatchError(`Property ${key} not found in propertyValues`);
const overrideValue = propertyValues[key];

@@ -191,3 +189,3 @@ if (null == overrideValue && !NULL_VALUES_ALLOWED_OPERATORS.includes(operator)) {

case 'is_set':
return key in propertyValues;
return true;
case 'icontains':

@@ -194,0 +192,0 @@ return String(overrideValue).toLowerCase().includes(String(value).toLowerCase());

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"uuidv7.d.ts","sourceRoot":"","sources":["../../src/vendor/uuidv7.ts"],"names":[],"mappings":"AAaA,iDAAiD;AACjD,qBAAa,IAAI;IAEK,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC;IADxD,4DAA4D;IAC5D,OAAO;IAEP;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI;IAQjD;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,IAAI;IAsCP;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IA8ChC;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAYlB;;;OAGG;IACH,KAAK,IAAI,MAAM;IASf,2EAA2E;IAC3E,MAAM,IAAI,MAAM;IAIhB;;;;;;;OAOG;IACH,UAAU,IACN,OAAO,GACP,QAAQ,GACR,SAAS,GACT,cAAc,GACd,KAAK,GACL,KAAK;IAiBT;;;OAGG;IACH,UAAU,IAAI,MAAM,GAAG,SAAS;IAIhC,qCAAqC;IACrC,KAAK,IAAI,IAAI;IAIb,uDAAuD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;;;OAUG;IACH,mBAAmB,CACjB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,MAAM,GACxB,IAAI,GAAG,SAAS;IAqCnB,0DAA0D;IAC1D,OAAO,CAAC,YAAY;IAKpB;;;;OAIG;IACH,UAAU,IAAI,IAAI;CAanB;AA0DD;;;;;GAKG;AACH,eAAO,MAAM,MAAM,QAAO,MAAgC,CAAC;AAE3D,iCAAiC;AACjC,eAAO,MAAM,SAAS,QAAO,IAC4C,CAAC;AAE1E;;;;;GAKG;AACH,eAAO,MAAM,MAAM,QAAO,MAAgC,CAAC;AAE3D,iCAAiC;AACjC,eAAO,MAAM,SAAS,QAAO,IAC8C,CAAC"}

@@ -196,3 +196,3 @@ /*! For license information please see uuidv7.js.LICENSE.txt */

const getDefaultRandom = ()=>({
nextUint32: ()=>0x10000 * Math.trunc(0x10000 * Math.random()) + Math.trunc(0x10000 * Math.random())
nextUint32: ()=>0x10000 * Math.trunc(0x10000 * Math.random()) + Math.trunc(0x10000 * Math.random()) >>> 0
});

@@ -199,0 +199,0 @@ let defaultGenerator;

@@ -163,3 +163,3 @@ /*! For license information please see uuidv7.mjs.LICENSE.txt */

const getDefaultRandom = ()=>({
nextUint32: ()=>0x10000 * Math.trunc(0x10000 * Math.random()) + Math.trunc(0x10000 * Math.random())
nextUint32: ()=>0x10000 * Math.trunc(0x10000 * Math.random()) + Math.trunc(0x10000 * Math.random()) >>> 0
});

@@ -166,0 +166,0 @@ let defaultGenerator;

{
"name": "@posthog/core",
"version": "1.48.11",
"version": "1.48.12",
"bugs": {

@@ -73,3 +73,3 @@ "url": "https://github.com/PostHog/posthog-js/issues"

"dependencies": {
"@posthog/types": "^1.405.3"
"@posthog/types": "^1.407.0"
},

@@ -76,0 +76,0 @@ "devDependencies": {

@@ -188,4 +188,4 @@ import { parsePayload } from './featureFlagUtils'

if (!(key in propertyValues)) {
if (operator === 'is_not_set') return true
const hasProperty = Object.prototype.hasOwnProperty.call(propertyValues, key)
if (!hasProperty) {
throw new InconclusiveMatchError(`Property ${key} not found in propertyValues`)

@@ -223,3 +223,3 @@ } else if (operator === 'is_not_set') {

case 'is_set':
return key in propertyValues
return true
case 'icontains':

@@ -226,0 +226,0 @@ return String(overrideValue).toLowerCase().includes(String(value).toLowerCase())

@@ -432,5 +432,11 @@ // vendor from: https://github.com/LiosK/uuidv7/blob/f30b7a7faff73afbce0b27a46c638310f96912ba/src/index.ts

return {
// Clamp to a valid uint32: a nonconformant Math.random() that returns >= 1 or NaN
// (e.g. Hermes on Android implements Math.random with C++ std::uniform_real_distribution,
// which is documented to occasionally return its upper bound) would otherwise overflow the
// field ranges and make fromFieldsV7 throw `RangeError: invalid field value` on every
// generate call, crashing React Native apps during the internal event-queue flush.
nextUint32: (): number =>
Math.trunc(Math.random() * 0x1_0000) * 0x1_0000 +
Math.trunc(Math.random() * 0x1_0000),
(Math.trunc(Math.random() * 0x1_0000) * 0x1_0000 +
Math.trunc(Math.random() * 0x1_0000)) >>>
0,
};

@@ -437,0 +443,0 @@ };