autotel-subscribers 16.0.0 → 16.0.1
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/amplitude.cjs +64 -64
- package/dist/amplitude.cjs.map +1 -1
- package/dist/amplitude.js +64 -64
- package/dist/amplitude.js.map +1 -1
- package/dist/factories.cjs +930 -347
- package/dist/factories.cjs.map +1 -1
- package/dist/factories.js +930 -347
- package/dist/factories.js.map +1 -1
- package/dist/index.cjs +930 -347
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +930 -347
- package/dist/index.js.map +1 -1
- package/dist/mixpanel.cjs +686 -130
- package/dist/mixpanel.cjs.map +1 -1
- package/dist/mixpanel.js +686 -130
- package/dist/mixpanel.js.map +1 -1
- package/dist/posthog.cjs +177 -150
- package/dist/posthog.cjs.map +1 -1
- package/dist/posthog.js +177 -150
- package/dist/posthog.js.map +1 -1
- package/package.json +13 -13
package/dist/mixpanel.js
CHANGED
|
@@ -1304,9 +1304,9 @@ var require_dist2 = __commonJS({
|
|
|
1304
1304
|
}
|
|
1305
1305
|
});
|
|
1306
1306
|
|
|
1307
|
-
// ../../node_modules/.pnpm/mixpanel@0.
|
|
1307
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/package.json
|
|
1308
1308
|
var require_package = __commonJS({
|
|
1309
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
1309
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/package.json"(exports$1, module) {
|
|
1310
1310
|
module.exports = {
|
|
1311
1311
|
name: "mixpanel",
|
|
1312
1312
|
description: "A simple server-side API for mixpanel",
|
|
@@ -1316,7 +1316,7 @@ var require_package = __commonJS({
|
|
|
1316
1316
|
"api",
|
|
1317
1317
|
"stats"
|
|
1318
1318
|
],
|
|
1319
|
-
version: "0.
|
|
1319
|
+
version: "0.20.0",
|
|
1320
1320
|
homepage: "https://github.com/mixpanel/mixpanel-node",
|
|
1321
1321
|
author: "Carl Sverre",
|
|
1322
1322
|
license: "MIT",
|
|
@@ -1332,29 +1332,35 @@ var require_package = __commonJS({
|
|
|
1332
1332
|
node: ">=10.0"
|
|
1333
1333
|
},
|
|
1334
1334
|
scripts: {
|
|
1335
|
-
test: "vitest"
|
|
1335
|
+
test: "vitest",
|
|
1336
|
+
format: "prettier --write .",
|
|
1337
|
+
"check-format": "prettier --check .",
|
|
1338
|
+
lint: "oxlint ."
|
|
1336
1339
|
},
|
|
1337
1340
|
types: "./lib/mixpanel-node.d.ts",
|
|
1338
1341
|
devDependencies: {
|
|
1339
1342
|
"@types/node": "^24.10.1",
|
|
1340
1343
|
"@vitest/coverage-v8": "^4.0.8",
|
|
1341
1344
|
nock: "^14.0.10",
|
|
1345
|
+
oxlint: "^1.16.0",
|
|
1346
|
+
prettier: "^3.6.2",
|
|
1342
1347
|
proxyquire: "^2.1.3",
|
|
1343
1348
|
typescript: "^5.9.3",
|
|
1344
1349
|
vitest: "^4.0.8"
|
|
1345
1350
|
},
|
|
1346
1351
|
dependencies: {
|
|
1347
|
-
"https-proxy-agent": "7.0.6"
|
|
1352
|
+
"https-proxy-agent": "7.0.6",
|
|
1353
|
+
"json-logic-js": "2.0.5"
|
|
1348
1354
|
}
|
|
1349
1355
|
};
|
|
1350
1356
|
}
|
|
1351
1357
|
});
|
|
1352
1358
|
|
|
1353
|
-
// ../../node_modules/.pnpm/mixpanel@0.
|
|
1359
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/utils.js
|
|
1354
1360
|
var require_utils = __commonJS({
|
|
1355
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
1361
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/utils.js"(exports$1) {
|
|
1356
1362
|
exports$1.async_all = function(requests, handler, callback) {
|
|
1357
|
-
|
|
1363
|
+
let total = requests.length, errors = null, results = [], done = function(err, result) {
|
|
1358
1364
|
if (err) {
|
|
1359
1365
|
errors = errors || [];
|
|
1360
1366
|
errors.push(err);
|
|
@@ -1367,14 +1373,16 @@ var require_utils = __commonJS({
|
|
|
1367
1373
|
if (total === 0) {
|
|
1368
1374
|
callback(errors, results);
|
|
1369
1375
|
} else {
|
|
1370
|
-
for (
|
|
1376
|
+
for (let i = 0, l = requests.length; i < l; i++) {
|
|
1371
1377
|
handler(requests[i], done);
|
|
1372
1378
|
}
|
|
1373
1379
|
}
|
|
1374
1380
|
};
|
|
1375
1381
|
exports$1.ensure_timestamp = function(time) {
|
|
1376
1382
|
if (!(time instanceof Date || typeof time === "number")) {
|
|
1377
|
-
throw new Error(
|
|
1383
|
+
throw new Error(
|
|
1384
|
+
"`time` property must be a Date or Unix timestamp and is only required for `import` endpoint"
|
|
1385
|
+
);
|
|
1378
1386
|
}
|
|
1379
1387
|
return time instanceof Date ? time.getTime() : time;
|
|
1380
1388
|
};
|
|
@@ -1391,9 +1399,9 @@ var require_utils = __commonJS({
|
|
|
1391
1399
|
}
|
|
1392
1400
|
});
|
|
1393
1401
|
|
|
1394
|
-
// ../../node_modules/.pnpm/mixpanel@0.
|
|
1402
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/profile_helpers.js
|
|
1395
1403
|
var require_profile_helpers = __commonJS({
|
|
1396
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
1404
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/profile_helpers.js"(exports$1) {
|
|
1397
1405
|
var { ensure_timestamp } = require_utils();
|
|
1398
1406
|
function merge_modifiers(data, modifiers) {
|
|
1399
1407
|
if (modifiers) {
|
|
@@ -1441,7 +1449,7 @@ var require_profile_helpers = __commonJS({
|
|
|
1441
1449
|
}
|
|
1442
1450
|
}
|
|
1443
1451
|
let data = {
|
|
1444
|
-
|
|
1452
|
+
$token: this.token,
|
|
1445
1453
|
...identifiers
|
|
1446
1454
|
};
|
|
1447
1455
|
const set_key = set_once ? "$set_once" : "$set";
|
|
@@ -1456,14 +1464,20 @@ var require_profile_helpers = __commonJS({
|
|
|
1456
1464
|
}
|
|
1457
1465
|
data = merge_modifiers(data, modifiers);
|
|
1458
1466
|
if (this.config.debug) {
|
|
1459
|
-
this.mixpanel.config.logger.debug(
|
|
1467
|
+
this.mixpanel.config.logger.debug(
|
|
1468
|
+
`Sending the following data to Mixpanel (${this.endpoint})`,
|
|
1469
|
+
{ data }
|
|
1470
|
+
);
|
|
1460
1471
|
}
|
|
1461
|
-
this.mixpanel.send_request(
|
|
1472
|
+
this.mixpanel.send_request(
|
|
1473
|
+
{ method: "GET", endpoint: this.endpoint, data },
|
|
1474
|
+
callback
|
|
1475
|
+
);
|
|
1462
1476
|
}
|
|
1463
1477
|
_delete_profile({ identifiers, modifiers, callback }) {
|
|
1464
1478
|
let data = {
|
|
1465
|
-
|
|
1466
|
-
|
|
1479
|
+
$delete: "",
|
|
1480
|
+
$token: this.token,
|
|
1467
1481
|
...identifiers
|
|
1468
1482
|
};
|
|
1469
1483
|
if (typeof modifiers === "function") {
|
|
@@ -1473,13 +1487,18 @@ var require_profile_helpers = __commonJS({
|
|
|
1473
1487
|
if (this.config.debug) {
|
|
1474
1488
|
this.mixpanel.config.logger.debug("Deleting profile", { identifiers });
|
|
1475
1489
|
}
|
|
1476
|
-
this.mixpanel.send_request(
|
|
1490
|
+
this.mixpanel.send_request(
|
|
1491
|
+
{ method: "GET", endpoint: this.endpoint, data },
|
|
1492
|
+
callback
|
|
1493
|
+
);
|
|
1477
1494
|
}
|
|
1478
1495
|
_remove({ identifiers, data, modifiers, callback }) {
|
|
1479
1496
|
let $remove = {};
|
|
1480
1497
|
if (typeof data !== "object" || Array.isArray(data)) {
|
|
1481
1498
|
if (this.config.debug) {
|
|
1482
|
-
this.mixpanel.config.logger.error(
|
|
1499
|
+
this.mixpanel.config.logger.error(
|
|
1500
|
+
"Invalid value passed to #remove - data must be an object with scalar values"
|
|
1501
|
+
);
|
|
1483
1502
|
}
|
|
1484
1503
|
return;
|
|
1485
1504
|
}
|
|
@@ -1500,8 +1519,8 @@ var require_profile_helpers = __commonJS({
|
|
|
1500
1519
|
return;
|
|
1501
1520
|
}
|
|
1502
1521
|
data = {
|
|
1503
|
-
|
|
1504
|
-
|
|
1522
|
+
$remove,
|
|
1523
|
+
$token: this.token,
|
|
1505
1524
|
...identifiers
|
|
1506
1525
|
};
|
|
1507
1526
|
if (typeof modifiers === "function") {
|
|
@@ -1514,19 +1533,24 @@ var require_profile_helpers = __commonJS({
|
|
|
1514
1533
|
{ data }
|
|
1515
1534
|
);
|
|
1516
1535
|
}
|
|
1517
|
-
this.mixpanel.send_request(
|
|
1536
|
+
this.mixpanel.send_request(
|
|
1537
|
+
{ method: "GET", endpoint: this.endpoint, data },
|
|
1538
|
+
callback
|
|
1539
|
+
);
|
|
1518
1540
|
}
|
|
1519
1541
|
_union({ identifiers, data, modifiers, callback }) {
|
|
1520
1542
|
let $union = {};
|
|
1521
1543
|
if (typeof data !== "object" || Array.isArray(data)) {
|
|
1522
1544
|
if (this.config.debug) {
|
|
1523
|
-
this.mixpanel.config.logger.error(
|
|
1545
|
+
this.mixpanel.config.logger.error(
|
|
1546
|
+
"Invalid value passed to #union - data must be an object with scalar or array values"
|
|
1547
|
+
);
|
|
1524
1548
|
}
|
|
1525
1549
|
return;
|
|
1526
1550
|
}
|
|
1527
1551
|
for (const [key, val] of Object.entries(data)) {
|
|
1528
1552
|
if (Array.isArray(val)) {
|
|
1529
|
-
|
|
1553
|
+
const merge_values = val.filter(function(v) {
|
|
1530
1554
|
return typeof v === "string" || typeof v === "number";
|
|
1531
1555
|
});
|
|
1532
1556
|
if (merge_values.length > 0) {
|
|
@@ -1547,8 +1571,8 @@ var require_profile_helpers = __commonJS({
|
|
|
1547
1571
|
return;
|
|
1548
1572
|
}
|
|
1549
1573
|
data = {
|
|
1550
|
-
|
|
1551
|
-
|
|
1574
|
+
$union,
|
|
1575
|
+
$token: this.token,
|
|
1552
1576
|
...identifiers
|
|
1553
1577
|
};
|
|
1554
1578
|
if (typeof modifiers === "function") {
|
|
@@ -1561,7 +1585,10 @@ var require_profile_helpers = __commonJS({
|
|
|
1561
1585
|
{ data }
|
|
1562
1586
|
);
|
|
1563
1587
|
}
|
|
1564
|
-
this.mixpanel.send_request(
|
|
1588
|
+
this.mixpanel.send_request(
|
|
1589
|
+
{ method: "GET", endpoint: this.endpoint, data },
|
|
1590
|
+
callback
|
|
1591
|
+
);
|
|
1565
1592
|
}
|
|
1566
1593
|
_unset({ identifiers, prop, modifiers, callback }) {
|
|
1567
1594
|
let $unset = [];
|
|
@@ -1579,8 +1606,8 @@ var require_profile_helpers = __commonJS({
|
|
|
1579
1606
|
return;
|
|
1580
1607
|
}
|
|
1581
1608
|
let data = {
|
|
1582
|
-
|
|
1583
|
-
|
|
1609
|
+
$unset,
|
|
1610
|
+
$token: this.token,
|
|
1584
1611
|
...identifiers
|
|
1585
1612
|
};
|
|
1586
1613
|
if (typeof modifiers === "function") {
|
|
@@ -1593,15 +1620,18 @@ var require_profile_helpers = __commonJS({
|
|
|
1593
1620
|
{ data }
|
|
1594
1621
|
);
|
|
1595
1622
|
}
|
|
1596
|
-
this.mixpanel.send_request(
|
|
1623
|
+
this.mixpanel.send_request(
|
|
1624
|
+
{ method: "GET", endpoint: this.endpoint, data },
|
|
1625
|
+
callback
|
|
1626
|
+
);
|
|
1597
1627
|
}
|
|
1598
1628
|
};
|
|
1599
1629
|
}
|
|
1600
1630
|
});
|
|
1601
1631
|
|
|
1602
|
-
// ../../node_modules/.pnpm/mixpanel@0.
|
|
1632
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/groups.js
|
|
1603
1633
|
var require_groups = __commonJS({
|
|
1604
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
1634
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/groups.js"(exports$1) {
|
|
1605
1635
|
var { ProfileHelpers } = require_profile_helpers();
|
|
1606
1636
|
var MixpanelGroups = class extends ProfileHelpers() {
|
|
1607
1637
|
constructor(mp_instance) {
|
|
@@ -1610,9 +1640,9 @@ var require_groups = __commonJS({
|
|
|
1610
1640
|
this.endpoint = "/groups";
|
|
1611
1641
|
}
|
|
1612
1642
|
/** groups.set_once(group_key, group_id, prop, to, modifiers, callback)
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1643
|
+
---
|
|
1644
|
+
The same as groups.set, but adds a property value to a group only if it has not been set before.
|
|
1645
|
+
*/
|
|
1616
1646
|
set_once(group_key, group_id, prop, to, modifiers, callback) {
|
|
1617
1647
|
const identifiers = { $group_key: group_key, $group_id: group_id };
|
|
1618
1648
|
this._set(prop, to, modifiers, callback, { identifiers, set_once: true });
|
|
@@ -1701,9 +1731,9 @@ var require_groups = __commonJS({
|
|
|
1701
1731
|
}
|
|
1702
1732
|
});
|
|
1703
1733
|
|
|
1704
|
-
// ../../node_modules/.pnpm/mixpanel@0.
|
|
1734
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/people.js
|
|
1705
1735
|
var require_people = __commonJS({
|
|
1706
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
1736
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/people.js"(exports$1) {
|
|
1707
1737
|
var { merge_modifiers, ProfileHelpers } = require_profile_helpers();
|
|
1708
1738
|
var MixpanelPeople = class extends ProfileHelpers() {
|
|
1709
1739
|
constructor(mp_instance) {
|
|
@@ -1769,7 +1799,7 @@ var require_people = __commonJS({
|
|
|
1769
1799
|
});
|
|
1770
1800
|
*/
|
|
1771
1801
|
increment(distinct_id, prop, by, modifiers, callback) {
|
|
1772
|
-
|
|
1802
|
+
const $add = {};
|
|
1773
1803
|
if (typeof prop === "object") {
|
|
1774
1804
|
if (typeof by === "object") {
|
|
1775
1805
|
callback = modifiers;
|
|
@@ -1805,16 +1835,22 @@ var require_people = __commonJS({
|
|
|
1805
1835
|
$add[prop] = 1;
|
|
1806
1836
|
}
|
|
1807
1837
|
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1838
|
+
let data = {
|
|
1839
|
+
$add,
|
|
1840
|
+
$token: this.mixpanel.token,
|
|
1841
|
+
$distinct_id: distinct_id
|
|
1812
1842
|
};
|
|
1813
1843
|
data = merge_modifiers(data, modifiers);
|
|
1814
1844
|
if (this.mixpanel.config.debug) {
|
|
1815
|
-
this.mixpanel.config.logger.debug(
|
|
1845
|
+
this.mixpanel.config.logger.debug(
|
|
1846
|
+
"Sending the following data to Mixpanel (Engage)",
|
|
1847
|
+
{ data }
|
|
1848
|
+
);
|
|
1816
1849
|
}
|
|
1817
|
-
this.mixpanel.send_request(
|
|
1850
|
+
this.mixpanel.send_request(
|
|
1851
|
+
{ method: "GET", endpoint: "/engage", data },
|
|
1852
|
+
callback
|
|
1853
|
+
);
|
|
1818
1854
|
}
|
|
1819
1855
|
/**
|
|
1820
1856
|
people.append(distinct_id, prop, value, modifiers, callback)
|
|
@@ -1833,7 +1869,7 @@ var require_people = __commonJS({
|
|
|
1833
1869
|
});
|
|
1834
1870
|
*/
|
|
1835
1871
|
append(distinct_id, prop, value, modifiers, callback) {
|
|
1836
|
-
|
|
1872
|
+
const $append = {};
|
|
1837
1873
|
if (typeof prop === "object") {
|
|
1838
1874
|
if (typeof value === "object") {
|
|
1839
1875
|
callback = modifiers;
|
|
@@ -1850,16 +1886,22 @@ var require_people = __commonJS({
|
|
|
1850
1886
|
callback = modifiers;
|
|
1851
1887
|
}
|
|
1852
1888
|
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1889
|
+
let data = {
|
|
1890
|
+
$append,
|
|
1891
|
+
$token: this.mixpanel.token,
|
|
1892
|
+
$distinct_id: distinct_id
|
|
1857
1893
|
};
|
|
1858
1894
|
data = merge_modifiers(data, modifiers);
|
|
1859
1895
|
if (this.mixpanel.config.debug) {
|
|
1860
|
-
this.mixpanel.config.logger.debug(
|
|
1896
|
+
this.mixpanel.config.logger.debug(
|
|
1897
|
+
"Sending the following data to Mixpanel (Engage)",
|
|
1898
|
+
{ data }
|
|
1899
|
+
);
|
|
1861
1900
|
}
|
|
1862
|
-
this.mixpanel.send_request(
|
|
1901
|
+
this.mixpanel.send_request(
|
|
1902
|
+
{ method: "GET", endpoint: "/engage", data },
|
|
1903
|
+
callback
|
|
1904
|
+
);
|
|
1863
1905
|
}
|
|
1864
1906
|
/**
|
|
1865
1907
|
people.track_charge(distinct_id, amount, properties, modifiers, callback)
|
|
@@ -1894,27 +1936,35 @@ var require_people = __commonJS({
|
|
|
1894
1936
|
if (typeof amount !== "number") {
|
|
1895
1937
|
amount = parseFloat(amount);
|
|
1896
1938
|
if (isNaN(amount)) {
|
|
1897
|
-
this.mixpanel.config.logger.error(
|
|
1939
|
+
this.mixpanel.config.logger.error(
|
|
1940
|
+
"Invalid value passed to mixpanel.people.track_charge - must be a number"
|
|
1941
|
+
);
|
|
1898
1942
|
return;
|
|
1899
1943
|
}
|
|
1900
1944
|
}
|
|
1901
1945
|
properties.$amount = amount;
|
|
1902
1946
|
if (properties.hasOwnProperty("$time")) {
|
|
1903
|
-
|
|
1947
|
+
const time = properties.$time;
|
|
1904
1948
|
if (Object.prototype.toString.call(time) === "[object Date]") {
|
|
1905
1949
|
properties.$time = time.toISOString();
|
|
1906
1950
|
}
|
|
1907
1951
|
}
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1952
|
+
let data = {
|
|
1953
|
+
$append: { $transactions: properties },
|
|
1954
|
+
$token: this.mixpanel.token,
|
|
1955
|
+
$distinct_id: distinct_id
|
|
1912
1956
|
};
|
|
1913
1957
|
data = merge_modifiers(data, modifiers);
|
|
1914
1958
|
if (this.mixpanel.config.debug) {
|
|
1915
|
-
this.mixpanel.config.logger.debug(
|
|
1959
|
+
this.mixpanel.config.logger.debug(
|
|
1960
|
+
"Sending the following data to Mixpanel (Engage)",
|
|
1961
|
+
{ data }
|
|
1962
|
+
);
|
|
1916
1963
|
}
|
|
1917
|
-
this.mixpanel.send_request(
|
|
1964
|
+
this.mixpanel.send_request(
|
|
1965
|
+
{ method: "GET", endpoint: "/engage", data },
|
|
1966
|
+
callback
|
|
1967
|
+
);
|
|
1918
1968
|
}
|
|
1919
1969
|
/**
|
|
1920
1970
|
people.clear_charges(distinct_id, modifiers, callback)
|
|
@@ -1926,19 +1976,24 @@ var require_people = __commonJS({
|
|
|
1926
1976
|
mixpanel.people.clear_charges('bob');
|
|
1927
1977
|
*/
|
|
1928
1978
|
clear_charges(distinct_id, modifiers, callback) {
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1979
|
+
let data = {
|
|
1980
|
+
$set: { $transactions: [] },
|
|
1981
|
+
$token: this.mixpanel.token,
|
|
1982
|
+
$distinct_id: distinct_id
|
|
1933
1983
|
};
|
|
1934
1984
|
if (typeof modifiers === "function") {
|
|
1935
1985
|
callback = modifiers;
|
|
1936
1986
|
}
|
|
1937
1987
|
data = merge_modifiers(data, modifiers);
|
|
1938
1988
|
if (this.mixpanel.config.debug) {
|
|
1939
|
-
this.mixpanel.config.logger.debug("Clearing this user's charges", {
|
|
1989
|
+
this.mixpanel.config.logger.debug("Clearing this user's charges", {
|
|
1990
|
+
$distinct_id: distinct_id
|
|
1991
|
+
});
|
|
1940
1992
|
}
|
|
1941
|
-
this.mixpanel.send_request(
|
|
1993
|
+
this.mixpanel.send_request(
|
|
1994
|
+
{ method: "GET", endpoint: "/engage", data },
|
|
1995
|
+
callback
|
|
1996
|
+
);
|
|
1942
1997
|
}
|
|
1943
1998
|
/**
|
|
1944
1999
|
people.delete_user(distinct_id, modifiers, callback)
|
|
@@ -1965,7 +2020,7 @@ var require_people = __commonJS({
|
|
|
1965
2020
|
mixpanel.people.remove('bob', {'browsers': 'chrome', 'os': 'linux'});
|
|
1966
2021
|
*/
|
|
1967
2022
|
remove(distinct_id, data, modifiers, callback) {
|
|
1968
|
-
const identifiers = {
|
|
2023
|
+
const identifiers = { $distinct_id: distinct_id };
|
|
1969
2024
|
this._remove({ identifiers, data, modifiers, callback });
|
|
1970
2025
|
}
|
|
1971
2026
|
/**
|
|
@@ -2003,9 +2058,9 @@ var require_people = __commonJS({
|
|
|
2003
2058
|
}
|
|
2004
2059
|
});
|
|
2005
2060
|
|
|
2006
|
-
// ../../node_modules/.pnpm/mixpanel@0.
|
|
2061
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/flags/utils.js
|
|
2007
2062
|
var require_utils2 = __commonJS({
|
|
2008
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
2063
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/flags/utils.js"(exports$1, module) {
|
|
2009
2064
|
var crypto = __require("crypto");
|
|
2010
2065
|
var EXPOSURE_EVENT = "$experiment_started";
|
|
2011
2066
|
var REQUEST_HEADERS = {
|
|
@@ -2040,22 +2095,55 @@ var require_utils2 = __commonJS({
|
|
|
2040
2095
|
const traceFlags = "01";
|
|
2041
2096
|
return `${version}-${traceId}-${parentId}-${traceFlags}`;
|
|
2042
2097
|
}
|
|
2098
|
+
function lowercaseJson(obj, lowercaseKeys) {
|
|
2099
|
+
if (obj === null || obj === void 0) {
|
|
2100
|
+
return obj;
|
|
2101
|
+
} else if (typeof obj === "string") {
|
|
2102
|
+
return obj.toLowerCase();
|
|
2103
|
+
} else if (typeof obj === "object") {
|
|
2104
|
+
if (Array.isArray(obj)) {
|
|
2105
|
+
return obj.map((item) => lowercaseJson(item, lowercaseKeys));
|
|
2106
|
+
} else {
|
|
2107
|
+
return Object.fromEntries(
|
|
2108
|
+
Object.entries(obj).map(([k, v]) => [
|
|
2109
|
+
lowercaseKeys ? k.toLowerCase() : k,
|
|
2110
|
+
lowercaseJson(v, lowercaseKeys)
|
|
2111
|
+
])
|
|
2112
|
+
);
|
|
2113
|
+
}
|
|
2114
|
+
} else {
|
|
2115
|
+
return obj;
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
function lowercaseAllKeysAndValues(obj) {
|
|
2119
|
+
return lowercaseJson(obj, true);
|
|
2120
|
+
}
|
|
2121
|
+
function lowercaseLeafNodes(obj) {
|
|
2122
|
+
return lowercaseJson(obj, false);
|
|
2123
|
+
}
|
|
2043
2124
|
module.exports = {
|
|
2044
2125
|
EXPOSURE_EVENT,
|
|
2045
2126
|
REQUEST_HEADERS,
|
|
2046
2127
|
normalizedHash,
|
|
2047
2128
|
prepareCommonQueryParams,
|
|
2048
|
-
generateTraceparent
|
|
2129
|
+
generateTraceparent,
|
|
2130
|
+
lowercaseAllKeysAndValues,
|
|
2131
|
+
lowercaseLeafNodes
|
|
2049
2132
|
};
|
|
2050
2133
|
}
|
|
2051
2134
|
});
|
|
2052
2135
|
|
|
2053
|
-
// ../../node_modules/.pnpm/mixpanel@0.
|
|
2136
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/flags/flags.js
|
|
2054
2137
|
var require_flags = __commonJS({
|
|
2055
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
2138
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/flags/flags.js"(exports$1, module) {
|
|
2056
2139
|
var https = __require("https");
|
|
2057
2140
|
var packageInfo = require_package();
|
|
2058
|
-
var {
|
|
2141
|
+
var {
|
|
2142
|
+
prepareCommonQueryParams,
|
|
2143
|
+
generateTraceparent,
|
|
2144
|
+
EXPOSURE_EVENT,
|
|
2145
|
+
REQUEST_HEADERS
|
|
2146
|
+
} = require_utils2();
|
|
2059
2147
|
var FeatureFlagsProvider = class {
|
|
2060
2148
|
/**
|
|
2061
2149
|
* @param {Object} providerConfig - Configuration object with token, api_host, request_timeout_in_seconds
|
|
@@ -2078,7 +2166,10 @@ var require_flags = __commonJS({
|
|
|
2078
2166
|
*/
|
|
2079
2167
|
async callFlagsEndpoint(additionalParams = null) {
|
|
2080
2168
|
return new Promise((resolve, reject) => {
|
|
2081
|
-
const commonParams = prepareCommonQueryParams(
|
|
2169
|
+
const commonParams = prepareCommonQueryParams(
|
|
2170
|
+
this.providerConfig.token,
|
|
2171
|
+
packageInfo.version
|
|
2172
|
+
);
|
|
2082
2173
|
const params = new URLSearchParams(commonParams);
|
|
2083
2174
|
if (additionalParams) {
|
|
2084
2175
|
for (const [key, value] of Object.entries(additionalParams)) {
|
|
@@ -2093,8 +2184,8 @@ var require_flags = __commonJS({
|
|
|
2093
2184
|
method: "GET",
|
|
2094
2185
|
headers: {
|
|
2095
2186
|
...REQUEST_HEADERS,
|
|
2096
|
-
|
|
2097
|
-
|
|
2187
|
+
Authorization: "Basic " + Buffer.from(this.providerConfig.token + ":").toString("base64"),
|
|
2188
|
+
traceparent: generateTraceparent()
|
|
2098
2189
|
},
|
|
2099
2190
|
timeout: this.providerConfig.request_timeout_in_seconds * 1e3
|
|
2100
2191
|
};
|
|
@@ -2105,20 +2196,26 @@ var require_flags = __commonJS({
|
|
|
2105
2196
|
});
|
|
2106
2197
|
res.on("end", () => {
|
|
2107
2198
|
if (res.statusCode !== 200) {
|
|
2108
|
-
this.logger?.error(
|
|
2199
|
+
this.logger?.error(
|
|
2200
|
+
`HTTP ${res.statusCode} error calling flags endpoint: ${data}`
|
|
2201
|
+
);
|
|
2109
2202
|
return reject(new Error(`HTTP ${res.statusCode}: ${data}`));
|
|
2110
2203
|
}
|
|
2111
2204
|
try {
|
|
2112
2205
|
const result = JSON.parse(data);
|
|
2113
2206
|
resolve(result);
|
|
2114
2207
|
} catch (parseErr) {
|
|
2115
|
-
this.logger?.error(
|
|
2208
|
+
this.logger?.error(
|
|
2209
|
+
`Failed to parse JSON response: ${parseErr.message}`
|
|
2210
|
+
);
|
|
2116
2211
|
reject(parseErr);
|
|
2117
2212
|
}
|
|
2118
2213
|
});
|
|
2119
2214
|
});
|
|
2120
2215
|
request.on("error", (err) => {
|
|
2121
|
-
this.logger?.error(
|
|
2216
|
+
this.logger?.error(
|
|
2217
|
+
`Network error calling flags endpoint: ${err.message}`
|
|
2218
|
+
);
|
|
2122
2219
|
reject(err);
|
|
2123
2220
|
});
|
|
2124
2221
|
request.on("timeout", () => {
|
|
@@ -2140,14 +2237,16 @@ var require_flags = __commonJS({
|
|
|
2140
2237
|
*/
|
|
2141
2238
|
trackExposureEvent(flagKey, selectedVariant, context, latencyMs = null) {
|
|
2142
2239
|
if (!context.distinct_id) {
|
|
2143
|
-
this.logger?.error(
|
|
2240
|
+
this.logger?.error(
|
|
2241
|
+
"Cannot track exposure event without a distinct_id in the context"
|
|
2242
|
+
);
|
|
2144
2243
|
return;
|
|
2145
2244
|
}
|
|
2146
2245
|
const properties = {
|
|
2147
|
-
|
|
2246
|
+
distinct_id: context.distinct_id,
|
|
2148
2247
|
"Experiment name": flagKey,
|
|
2149
2248
|
"Variant name": selectedVariant.variant_key,
|
|
2150
|
-
|
|
2249
|
+
$experiment_type: "feature_flag",
|
|
2151
2250
|
"Flag evaluation mode": this.evaluationMode
|
|
2152
2251
|
};
|
|
2153
2252
|
if (latencyMs !== null && latencyMs !== void 0) {
|
|
@@ -2164,7 +2263,9 @@ var require_flags = __commonJS({
|
|
|
2164
2263
|
}
|
|
2165
2264
|
this.tracker(EXPOSURE_EVENT, properties, (err) => {
|
|
2166
2265
|
if (err) {
|
|
2167
|
-
this.logger?.error(
|
|
2266
|
+
this.logger?.error(
|
|
2267
|
+
`[flags]Failed to track exposure event for flag '${flagKey}': ${err.message}`
|
|
2268
|
+
);
|
|
2168
2269
|
}
|
|
2169
2270
|
});
|
|
2170
2271
|
}
|
|
@@ -2173,11 +2274,392 @@ var require_flags = __commonJS({
|
|
|
2173
2274
|
}
|
|
2174
2275
|
});
|
|
2175
2276
|
|
|
2176
|
-
// ../../node_modules/.pnpm/
|
|
2277
|
+
// ../../node_modules/.pnpm/json-logic-js@2.0.5/node_modules/json-logic-js/logic.js
|
|
2278
|
+
var require_logic = __commonJS({
|
|
2279
|
+
"../../node_modules/.pnpm/json-logic-js@2.0.5/node_modules/json-logic-js/logic.js"(exports$1, module) {
|
|
2280
|
+
(function(root, factory) {
|
|
2281
|
+
if (typeof define === "function" && define.amd) {
|
|
2282
|
+
define(factory);
|
|
2283
|
+
} else if (typeof exports$1 === "object") {
|
|
2284
|
+
module.exports = factory();
|
|
2285
|
+
} else {
|
|
2286
|
+
root.jsonLogic = factory();
|
|
2287
|
+
}
|
|
2288
|
+
})(exports$1, function() {
|
|
2289
|
+
if (!Array.isArray) {
|
|
2290
|
+
Array.isArray = function(arg) {
|
|
2291
|
+
return Object.prototype.toString.call(arg) === "[object Array]";
|
|
2292
|
+
};
|
|
2293
|
+
}
|
|
2294
|
+
function arrayUnique(array) {
|
|
2295
|
+
var a = [];
|
|
2296
|
+
for (var i = 0, l = array.length; i < l; i++) {
|
|
2297
|
+
if (a.indexOf(array[i]) === -1) {
|
|
2298
|
+
a.push(array[i]);
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
return a;
|
|
2302
|
+
}
|
|
2303
|
+
var jsonLogic = {};
|
|
2304
|
+
var operations = {
|
|
2305
|
+
"==": function(a, b) {
|
|
2306
|
+
return a == b;
|
|
2307
|
+
},
|
|
2308
|
+
"===": function(a, b) {
|
|
2309
|
+
return a === b;
|
|
2310
|
+
},
|
|
2311
|
+
"!=": function(a, b) {
|
|
2312
|
+
return a != b;
|
|
2313
|
+
},
|
|
2314
|
+
"!==": function(a, b) {
|
|
2315
|
+
return a !== b;
|
|
2316
|
+
},
|
|
2317
|
+
">": function(a, b) {
|
|
2318
|
+
return a > b;
|
|
2319
|
+
},
|
|
2320
|
+
">=": function(a, b) {
|
|
2321
|
+
return a >= b;
|
|
2322
|
+
},
|
|
2323
|
+
"<": function(a, b, c) {
|
|
2324
|
+
return c === void 0 ? a < b : a < b && b < c;
|
|
2325
|
+
},
|
|
2326
|
+
"<=": function(a, b, c) {
|
|
2327
|
+
return c === void 0 ? a <= b : a <= b && b <= c;
|
|
2328
|
+
},
|
|
2329
|
+
"!!": function(a) {
|
|
2330
|
+
return jsonLogic.truthy(a);
|
|
2331
|
+
},
|
|
2332
|
+
"!": function(a) {
|
|
2333
|
+
return !jsonLogic.truthy(a);
|
|
2334
|
+
},
|
|
2335
|
+
"%": function(a, b) {
|
|
2336
|
+
return a % b;
|
|
2337
|
+
},
|
|
2338
|
+
"log": function(a) {
|
|
2339
|
+
console.log(a);
|
|
2340
|
+
return a;
|
|
2341
|
+
},
|
|
2342
|
+
"in": function(a, b) {
|
|
2343
|
+
if (!b || typeof b.indexOf === "undefined") return false;
|
|
2344
|
+
return b.indexOf(a) !== -1;
|
|
2345
|
+
},
|
|
2346
|
+
"cat": function() {
|
|
2347
|
+
return Array.prototype.join.call(arguments, "");
|
|
2348
|
+
},
|
|
2349
|
+
"substr": function(source, start, end) {
|
|
2350
|
+
if (end < 0) {
|
|
2351
|
+
var temp = String(source).substr(start);
|
|
2352
|
+
return temp.substr(0, temp.length + end);
|
|
2353
|
+
}
|
|
2354
|
+
return String(source).substr(start, end);
|
|
2355
|
+
},
|
|
2356
|
+
"+": function() {
|
|
2357
|
+
return Array.prototype.reduce.call(arguments, function(a, b) {
|
|
2358
|
+
return parseFloat(a, 10) + parseFloat(b, 10);
|
|
2359
|
+
}, 0);
|
|
2360
|
+
},
|
|
2361
|
+
"*": function() {
|
|
2362
|
+
return Array.prototype.reduce.call(arguments, function(a, b) {
|
|
2363
|
+
return parseFloat(a, 10) * parseFloat(b, 10);
|
|
2364
|
+
});
|
|
2365
|
+
},
|
|
2366
|
+
"-": function(a, b) {
|
|
2367
|
+
if (b === void 0) {
|
|
2368
|
+
return -a;
|
|
2369
|
+
} else {
|
|
2370
|
+
return a - b;
|
|
2371
|
+
}
|
|
2372
|
+
},
|
|
2373
|
+
"/": function(a, b) {
|
|
2374
|
+
return a / b;
|
|
2375
|
+
},
|
|
2376
|
+
"min": function() {
|
|
2377
|
+
return Math.min.apply(this, arguments);
|
|
2378
|
+
},
|
|
2379
|
+
"max": function() {
|
|
2380
|
+
return Math.max.apply(this, arguments);
|
|
2381
|
+
},
|
|
2382
|
+
"merge": function() {
|
|
2383
|
+
return Array.prototype.reduce.call(arguments, function(a, b) {
|
|
2384
|
+
return a.concat(b);
|
|
2385
|
+
}, []);
|
|
2386
|
+
},
|
|
2387
|
+
"var": function(a, b) {
|
|
2388
|
+
var not_found = b === void 0 ? null : b;
|
|
2389
|
+
var data = this;
|
|
2390
|
+
if (typeof a === "undefined" || a === "" || a === null) {
|
|
2391
|
+
return data;
|
|
2392
|
+
}
|
|
2393
|
+
var sub_props = String(a).split(".");
|
|
2394
|
+
for (var i = 0; i < sub_props.length; i++) {
|
|
2395
|
+
if (data === null || data === void 0) {
|
|
2396
|
+
return not_found;
|
|
2397
|
+
}
|
|
2398
|
+
data = data[sub_props[i]];
|
|
2399
|
+
if (data === void 0) {
|
|
2400
|
+
return not_found;
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
return data;
|
|
2404
|
+
},
|
|
2405
|
+
"missing": function() {
|
|
2406
|
+
var missing = [];
|
|
2407
|
+
var keys = Array.isArray(arguments[0]) ? arguments[0] : arguments;
|
|
2408
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2409
|
+
var key = keys[i];
|
|
2410
|
+
var value = jsonLogic.apply({ "var": key }, this);
|
|
2411
|
+
if (value === null || value === "") {
|
|
2412
|
+
missing.push(key);
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
return missing;
|
|
2416
|
+
},
|
|
2417
|
+
"missing_some": function(need_count, options) {
|
|
2418
|
+
var are_missing = jsonLogic.apply({ "missing": options }, this);
|
|
2419
|
+
if (options.length - are_missing.length >= need_count) {
|
|
2420
|
+
return [];
|
|
2421
|
+
} else {
|
|
2422
|
+
return are_missing;
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
jsonLogic.is_logic = function(logic) {
|
|
2427
|
+
return typeof logic === "object" && // An object
|
|
2428
|
+
logic !== null && // but not null
|
|
2429
|
+
!Array.isArray(logic) && // and not an array
|
|
2430
|
+
Object.keys(logic).length === 1;
|
|
2431
|
+
};
|
|
2432
|
+
jsonLogic.truthy = function(value) {
|
|
2433
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
2434
|
+
return false;
|
|
2435
|
+
}
|
|
2436
|
+
return !!value;
|
|
2437
|
+
};
|
|
2438
|
+
jsonLogic.get_operator = function(logic) {
|
|
2439
|
+
return Object.keys(logic)[0];
|
|
2440
|
+
};
|
|
2441
|
+
jsonLogic.get_values = function(logic) {
|
|
2442
|
+
return logic[jsonLogic.get_operator(logic)];
|
|
2443
|
+
};
|
|
2444
|
+
jsonLogic.apply = function(logic, data) {
|
|
2445
|
+
if (Array.isArray(logic)) {
|
|
2446
|
+
return logic.map(function(l) {
|
|
2447
|
+
return jsonLogic.apply(l, data);
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
if (!jsonLogic.is_logic(logic)) {
|
|
2451
|
+
return logic;
|
|
2452
|
+
}
|
|
2453
|
+
var op = jsonLogic.get_operator(logic);
|
|
2454
|
+
var values = logic[op];
|
|
2455
|
+
var i;
|
|
2456
|
+
var current;
|
|
2457
|
+
var scopedLogic;
|
|
2458
|
+
var scopedData;
|
|
2459
|
+
var initial;
|
|
2460
|
+
if (!Array.isArray(values)) {
|
|
2461
|
+
values = [values];
|
|
2462
|
+
}
|
|
2463
|
+
if (op === "if" || op == "?:") {
|
|
2464
|
+
for (i = 0; i < values.length - 1; i += 2) {
|
|
2465
|
+
if (jsonLogic.truthy(jsonLogic.apply(values[i], data))) {
|
|
2466
|
+
return jsonLogic.apply(values[i + 1], data);
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
if (values.length === i + 1) {
|
|
2470
|
+
return jsonLogic.apply(values[i], data);
|
|
2471
|
+
}
|
|
2472
|
+
return null;
|
|
2473
|
+
} else if (op === "and") {
|
|
2474
|
+
for (i = 0; i < values.length; i += 1) {
|
|
2475
|
+
current = jsonLogic.apply(values[i], data);
|
|
2476
|
+
if (!jsonLogic.truthy(current)) {
|
|
2477
|
+
return current;
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
return current;
|
|
2481
|
+
} else if (op === "or") {
|
|
2482
|
+
for (i = 0; i < values.length; i += 1) {
|
|
2483
|
+
current = jsonLogic.apply(values[i], data);
|
|
2484
|
+
if (jsonLogic.truthy(current)) {
|
|
2485
|
+
return current;
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
return current;
|
|
2489
|
+
} else if (op === "filter") {
|
|
2490
|
+
scopedData = jsonLogic.apply(values[0], data);
|
|
2491
|
+
scopedLogic = values[1];
|
|
2492
|
+
if (!Array.isArray(scopedData)) {
|
|
2493
|
+
return [];
|
|
2494
|
+
}
|
|
2495
|
+
return scopedData.filter(function(datum) {
|
|
2496
|
+
return jsonLogic.truthy(jsonLogic.apply(scopedLogic, datum));
|
|
2497
|
+
});
|
|
2498
|
+
} else if (op === "map") {
|
|
2499
|
+
scopedData = jsonLogic.apply(values[0], data);
|
|
2500
|
+
scopedLogic = values[1];
|
|
2501
|
+
if (!Array.isArray(scopedData)) {
|
|
2502
|
+
return [];
|
|
2503
|
+
}
|
|
2504
|
+
return scopedData.map(function(datum) {
|
|
2505
|
+
return jsonLogic.apply(scopedLogic, datum);
|
|
2506
|
+
});
|
|
2507
|
+
} else if (op === "reduce") {
|
|
2508
|
+
scopedData = jsonLogic.apply(values[0], data);
|
|
2509
|
+
scopedLogic = values[1];
|
|
2510
|
+
initial = typeof values[2] !== "undefined" ? jsonLogic.apply(values[2], data) : null;
|
|
2511
|
+
if (!Array.isArray(scopedData)) {
|
|
2512
|
+
return initial;
|
|
2513
|
+
}
|
|
2514
|
+
return scopedData.reduce(
|
|
2515
|
+
function(accumulator, current2) {
|
|
2516
|
+
return jsonLogic.apply(
|
|
2517
|
+
scopedLogic,
|
|
2518
|
+
{ current: current2, accumulator }
|
|
2519
|
+
);
|
|
2520
|
+
},
|
|
2521
|
+
initial
|
|
2522
|
+
);
|
|
2523
|
+
} else if (op === "all") {
|
|
2524
|
+
scopedData = jsonLogic.apply(values[0], data);
|
|
2525
|
+
scopedLogic = values[1];
|
|
2526
|
+
if (!Array.isArray(scopedData) || !scopedData.length) {
|
|
2527
|
+
return false;
|
|
2528
|
+
}
|
|
2529
|
+
for (i = 0; i < scopedData.length; i += 1) {
|
|
2530
|
+
if (!jsonLogic.truthy(jsonLogic.apply(scopedLogic, scopedData[i]))) {
|
|
2531
|
+
return false;
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
return true;
|
|
2535
|
+
} else if (op === "none") {
|
|
2536
|
+
scopedData = jsonLogic.apply(values[0], data);
|
|
2537
|
+
scopedLogic = values[1];
|
|
2538
|
+
if (!Array.isArray(scopedData) || !scopedData.length) {
|
|
2539
|
+
return true;
|
|
2540
|
+
}
|
|
2541
|
+
for (i = 0; i < scopedData.length; i += 1) {
|
|
2542
|
+
if (jsonLogic.truthy(jsonLogic.apply(scopedLogic, scopedData[i]))) {
|
|
2543
|
+
return false;
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
return true;
|
|
2547
|
+
} else if (op === "some") {
|
|
2548
|
+
scopedData = jsonLogic.apply(values[0], data);
|
|
2549
|
+
scopedLogic = values[1];
|
|
2550
|
+
if (!Array.isArray(scopedData) || !scopedData.length) {
|
|
2551
|
+
return false;
|
|
2552
|
+
}
|
|
2553
|
+
for (i = 0; i < scopedData.length; i += 1) {
|
|
2554
|
+
if (jsonLogic.truthy(jsonLogic.apply(scopedLogic, scopedData[i]))) {
|
|
2555
|
+
return true;
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
return false;
|
|
2559
|
+
}
|
|
2560
|
+
values = values.map(function(val) {
|
|
2561
|
+
return jsonLogic.apply(val, data);
|
|
2562
|
+
});
|
|
2563
|
+
if (operations.hasOwnProperty(op) && typeof operations[op] === "function") {
|
|
2564
|
+
return operations[op].apply(data, values);
|
|
2565
|
+
} else if (op.indexOf(".") > 0) {
|
|
2566
|
+
var sub_ops = String(op).split(".");
|
|
2567
|
+
var operation = operations;
|
|
2568
|
+
for (i = 0; i < sub_ops.length; i++) {
|
|
2569
|
+
if (!operation.hasOwnProperty(sub_ops[i])) {
|
|
2570
|
+
throw new Error("Unrecognized operation " + op + " (failed at " + sub_ops.slice(0, i + 1).join(".") + ")");
|
|
2571
|
+
}
|
|
2572
|
+
operation = operation[sub_ops[i]];
|
|
2573
|
+
}
|
|
2574
|
+
return operation.apply(data, values);
|
|
2575
|
+
}
|
|
2576
|
+
throw new Error("Unrecognized operation " + op);
|
|
2577
|
+
};
|
|
2578
|
+
jsonLogic.uses_data = function(logic) {
|
|
2579
|
+
var collection = [];
|
|
2580
|
+
if (jsonLogic.is_logic(logic)) {
|
|
2581
|
+
var op = jsonLogic.get_operator(logic);
|
|
2582
|
+
var values = logic[op];
|
|
2583
|
+
if (!Array.isArray(values)) {
|
|
2584
|
+
values = [values];
|
|
2585
|
+
}
|
|
2586
|
+
if (op === "var") {
|
|
2587
|
+
collection.push(values[0]);
|
|
2588
|
+
} else {
|
|
2589
|
+
values.forEach(function(val) {
|
|
2590
|
+
collection.push.apply(collection, jsonLogic.uses_data(val));
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
return arrayUnique(collection);
|
|
2595
|
+
};
|
|
2596
|
+
jsonLogic.add_operation = function(name, code) {
|
|
2597
|
+
operations[name] = code;
|
|
2598
|
+
};
|
|
2599
|
+
jsonLogic.rm_operation = function(name) {
|
|
2600
|
+
delete operations[name];
|
|
2601
|
+
};
|
|
2602
|
+
jsonLogic.rule_like = function(rule, pattern) {
|
|
2603
|
+
if (pattern === rule) {
|
|
2604
|
+
return true;
|
|
2605
|
+
}
|
|
2606
|
+
if (pattern === "@") {
|
|
2607
|
+
return true;
|
|
2608
|
+
}
|
|
2609
|
+
if (pattern === "number") {
|
|
2610
|
+
return typeof rule === "number";
|
|
2611
|
+
}
|
|
2612
|
+
if (pattern === "string") {
|
|
2613
|
+
return typeof rule === "string";
|
|
2614
|
+
}
|
|
2615
|
+
if (pattern === "array") {
|
|
2616
|
+
return Array.isArray(rule) && !jsonLogic.is_logic(rule);
|
|
2617
|
+
}
|
|
2618
|
+
if (jsonLogic.is_logic(pattern)) {
|
|
2619
|
+
if (jsonLogic.is_logic(rule)) {
|
|
2620
|
+
var pattern_op = jsonLogic.get_operator(pattern);
|
|
2621
|
+
var rule_op = jsonLogic.get_operator(rule);
|
|
2622
|
+
if (pattern_op === "@" || pattern_op === rule_op) {
|
|
2623
|
+
return jsonLogic.rule_like(
|
|
2624
|
+
jsonLogic.get_values(rule, false),
|
|
2625
|
+
jsonLogic.get_values(pattern, false)
|
|
2626
|
+
);
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
return false;
|
|
2630
|
+
}
|
|
2631
|
+
if (Array.isArray(pattern)) {
|
|
2632
|
+
if (Array.isArray(rule)) {
|
|
2633
|
+
if (pattern.length !== rule.length) {
|
|
2634
|
+
return false;
|
|
2635
|
+
}
|
|
2636
|
+
for (var i = 0; i < pattern.length; i += 1) {
|
|
2637
|
+
if (!jsonLogic.rule_like(rule[i], pattern[i])) {
|
|
2638
|
+
return false;
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
return true;
|
|
2642
|
+
} else {
|
|
2643
|
+
return false;
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
return false;
|
|
2647
|
+
};
|
|
2648
|
+
return jsonLogic;
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2651
|
+
});
|
|
2652
|
+
|
|
2653
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/flags/local_flags.js
|
|
2177
2654
|
var require_local_flags = __commonJS({
|
|
2178
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
2655
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/flags/local_flags.js"(exports$1, module) {
|
|
2179
2656
|
var FeatureFlagsProvider = require_flags();
|
|
2180
|
-
var {
|
|
2657
|
+
var {
|
|
2658
|
+
normalizedHash,
|
|
2659
|
+
lowercaseAllKeysAndValues,
|
|
2660
|
+
lowercaseLeafNodes
|
|
2661
|
+
} = require_utils2();
|
|
2662
|
+
var { apply } = require_logic();
|
|
2181
2663
|
var LocalFeatureFlagsProvider = class extends FeatureFlagsProvider {
|
|
2182
2664
|
/**
|
|
2183
2665
|
* @param {string} token - Mixpanel project token
|
|
@@ -2216,12 +2698,16 @@ var require_local_flags = __commonJS({
|
|
|
2216
2698
|
try {
|
|
2217
2699
|
await this._fetchFlagDefinitions();
|
|
2218
2700
|
} catch (err) {
|
|
2219
|
-
this.logger?.error(
|
|
2701
|
+
this.logger?.error(
|
|
2702
|
+
`Error polling for flag definition: ${err.message}`
|
|
2703
|
+
);
|
|
2220
2704
|
}
|
|
2221
2705
|
}, this.config.polling_interval_in_seconds * 1e3);
|
|
2222
2706
|
}
|
|
2223
2707
|
} catch (err) {
|
|
2224
|
-
this.logger?.error(
|
|
2708
|
+
this.logger?.error(
|
|
2709
|
+
`Initial flag definitions fetch failed: ${err.message}`
|
|
2710
|
+
);
|
|
2225
2711
|
}
|
|
2226
2712
|
}
|
|
2227
2713
|
/**
|
|
@@ -2232,7 +2718,9 @@ var require_local_flags = __commonJS({
|
|
|
2232
2718
|
clearInterval(this.pollingInterval);
|
|
2233
2719
|
this.pollingInterval = null;
|
|
2234
2720
|
} else {
|
|
2235
|
-
this.logger?.warn(
|
|
2721
|
+
this.logger?.warn(
|
|
2722
|
+
"stopPollingForDefinitions called but polling was not active"
|
|
2723
|
+
);
|
|
2236
2724
|
}
|
|
2237
2725
|
}
|
|
2238
2726
|
/**
|
|
@@ -2257,7 +2745,12 @@ var require_local_flags = __commonJS({
|
|
|
2257
2745
|
* @returns {*} The variant value
|
|
2258
2746
|
*/
|
|
2259
2747
|
getVariantValue(flagKey, fallbackValue, context, reportExposure = true) {
|
|
2260
|
-
const result = this.getVariant(
|
|
2748
|
+
const result = this.getVariant(
|
|
2749
|
+
flagKey,
|
|
2750
|
+
{ variant_value: fallbackValue },
|
|
2751
|
+
context,
|
|
2752
|
+
reportExposure
|
|
2753
|
+
);
|
|
2261
2754
|
return result.variant_value;
|
|
2262
2755
|
}
|
|
2263
2756
|
/**
|
|
@@ -2288,7 +2781,12 @@ var require_local_flags = __commonJS({
|
|
|
2288
2781
|
} else {
|
|
2289
2782
|
const rollout = this._getAssignedRollout(flag, contextValue, context);
|
|
2290
2783
|
if (rollout) {
|
|
2291
|
-
selectedVariant = this._getAssignedVariant(
|
|
2784
|
+
selectedVariant = this._getAssignedVariant(
|
|
2785
|
+
flag,
|
|
2786
|
+
contextValue,
|
|
2787
|
+
flagKey,
|
|
2788
|
+
rollout
|
|
2789
|
+
);
|
|
2292
2790
|
}
|
|
2293
2791
|
}
|
|
2294
2792
|
if (selectedVariant) {
|
|
@@ -2383,7 +2881,10 @@ var require_local_flags = __commonJS({
|
|
|
2383
2881
|
}
|
|
2384
2882
|
_getAssignedVariant(flag, contextValue, flagKey, rollout) {
|
|
2385
2883
|
if (rollout.variant_override) {
|
|
2386
|
-
const variant = this._getMatchingVariant(
|
|
2884
|
+
const variant = this._getMatchingVariant(
|
|
2885
|
+
rollout.variant_override.key,
|
|
2886
|
+
flag
|
|
2887
|
+
);
|
|
2387
2888
|
if (variant) {
|
|
2388
2889
|
return { ...variant, is_qa_tester: false };
|
|
2389
2890
|
}
|
|
@@ -2416,15 +2917,41 @@ var require_local_flags = __commonJS({
|
|
|
2416
2917
|
is_qa_tester: false
|
|
2417
2918
|
};
|
|
2418
2919
|
}
|
|
2920
|
+
_extractRuntimeParameters(context) {
|
|
2921
|
+
const customProperties = context.custom_properties;
|
|
2922
|
+
if (!customProperties || typeof customProperties !== "object") {
|
|
2923
|
+
return null;
|
|
2924
|
+
}
|
|
2925
|
+
return lowercaseAllKeysAndValues(customProperties);
|
|
2926
|
+
}
|
|
2927
|
+
_isRuntimeRuleSatisfied(rollout, context) {
|
|
2928
|
+
try {
|
|
2929
|
+
return apply(
|
|
2930
|
+
lowercaseLeafNodes(rollout.runtime_evaluation_rule),
|
|
2931
|
+
this._extractRuntimeParameters(context)
|
|
2932
|
+
);
|
|
2933
|
+
} catch (error) {
|
|
2934
|
+
this.logger?.error(`Error evaluating runtime rule: ${error.message}`);
|
|
2935
|
+
return false;
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2419
2938
|
_isRuntimeEvaluationSatisfied(rollout, context) {
|
|
2420
|
-
if (
|
|
2939
|
+
if (rollout.runtime_evaluation_rule) {
|
|
2940
|
+
return this._isRuntimeRuleSatisfied(rollout, context);
|
|
2941
|
+
} else if (rollout.runtime_evaluation_definition) {
|
|
2942
|
+
return this._isLegacyRuntimeEvaluationSatisfied(rollout, context);
|
|
2943
|
+
} else {
|
|
2421
2944
|
return true;
|
|
2422
2945
|
}
|
|
2423
|
-
|
|
2424
|
-
|
|
2946
|
+
}
|
|
2947
|
+
_isLegacyRuntimeEvaluationSatisfied(rollout, context) {
|
|
2948
|
+
const customProperties = this._extractRuntimeParameters(context);
|
|
2949
|
+
if (!customProperties) {
|
|
2425
2950
|
return false;
|
|
2426
2951
|
}
|
|
2427
|
-
for (const [key, expectedValue] of Object.entries(
|
|
2952
|
+
for (const [key, expectedValue] of Object.entries(
|
|
2953
|
+
rollout.runtime_evaluation_definition
|
|
2954
|
+
)) {
|
|
2428
2955
|
if (!(key in customProperties)) {
|
|
2429
2956
|
return false;
|
|
2430
2957
|
}
|
|
@@ -2440,9 +2967,9 @@ var require_local_flags = __commonJS({
|
|
|
2440
2967
|
}
|
|
2441
2968
|
});
|
|
2442
2969
|
|
|
2443
|
-
// ../../node_modules/.pnpm/mixpanel@0.
|
|
2970
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/flags/remote_flags.js
|
|
2444
2971
|
var require_remote_flags = __commonJS({
|
|
2445
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
2972
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/flags/remote_flags.js"(exports$1, module) {
|
|
2446
2973
|
var FeatureFlagsProvider = require_flags();
|
|
2447
2974
|
var RemoteFeatureFlagsProvider = class extends FeatureFlagsProvider {
|
|
2448
2975
|
/**
|
|
@@ -2476,10 +3003,17 @@ var require_remote_flags = __commonJS({
|
|
|
2476
3003
|
*/
|
|
2477
3004
|
async getVariantValue(flagKey, fallbackValue, context, reportExposure = true) {
|
|
2478
3005
|
try {
|
|
2479
|
-
const selectedVariant = await this.getVariant(
|
|
3006
|
+
const selectedVariant = await this.getVariant(
|
|
3007
|
+
flagKey,
|
|
3008
|
+
{ variant_value: fallbackValue },
|
|
3009
|
+
context,
|
|
3010
|
+
reportExposure
|
|
3011
|
+
);
|
|
2480
3012
|
return selectedVariant.variant_value;
|
|
2481
3013
|
} catch (err) {
|
|
2482
|
-
this.logger?.error(
|
|
3014
|
+
this.logger?.error(
|
|
3015
|
+
`Failed to get variant value for flag '${flagKey}': ${err.message}`
|
|
3016
|
+
);
|
|
2483
3017
|
return fallbackValue;
|
|
2484
3018
|
}
|
|
2485
3019
|
}
|
|
@@ -2508,7 +3042,9 @@ var require_remote_flags = __commonJS({
|
|
|
2508
3042
|
}
|
|
2509
3043
|
return selectedVariant;
|
|
2510
3044
|
} catch (err) {
|
|
2511
|
-
this.logger?.error(
|
|
3045
|
+
this.logger?.error(
|
|
3046
|
+
`Failed to get variant for flag '${flagKey}': ${err.message}`
|
|
3047
|
+
);
|
|
2512
3048
|
return fallbackVariant;
|
|
2513
3049
|
}
|
|
2514
3050
|
}
|
|
@@ -2525,7 +3061,9 @@ var require_remote_flags = __commonJS({
|
|
|
2525
3061
|
const value = await this.getVariantValue(flagKey, false, context);
|
|
2526
3062
|
return value === true;
|
|
2527
3063
|
} catch (err) {
|
|
2528
|
-
this.logger?.error(
|
|
3064
|
+
this.logger?.error(
|
|
3065
|
+
`Failed to check if flag '${flagKey}' is enabled: ${err.message}`
|
|
3066
|
+
);
|
|
2529
3067
|
return false;
|
|
2530
3068
|
}
|
|
2531
3069
|
}
|
|
@@ -2564,9 +3102,9 @@ var require_remote_flags = __commonJS({
|
|
|
2564
3102
|
}
|
|
2565
3103
|
});
|
|
2566
3104
|
|
|
2567
|
-
// ../../node_modules/.pnpm/mixpanel@0.
|
|
3105
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/flags/index.js
|
|
2568
3106
|
var require_flags2 = __commonJS({
|
|
2569
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
3107
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/flags/index.js"(exports$1, module) {
|
|
2570
3108
|
var LocalFeatureFlagsProvider = require_local_flags();
|
|
2571
3109
|
var RemoteFeatureFlagsProvider = require_remote_flags();
|
|
2572
3110
|
module.exports = {
|
|
@@ -2576,9 +3114,9 @@ var require_flags2 = __commonJS({
|
|
|
2576
3114
|
}
|
|
2577
3115
|
});
|
|
2578
3116
|
|
|
2579
|
-
// ../../node_modules/.pnpm/mixpanel@0.
|
|
3117
|
+
// ../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/mixpanel-node.js
|
|
2580
3118
|
var require_mixpanel_node = __commonJS({
|
|
2581
|
-
"../../node_modules/.pnpm/mixpanel@0.
|
|
3119
|
+
"../../node_modules/.pnpm/mixpanel@0.20.0/node_modules/mixpanel/lib/mixpanel-node.js"(exports$1, module) {
|
|
2582
3120
|
var querystring = __require("querystring");
|
|
2583
3121
|
var Buffer2 = __require("buffer").Buffer;
|
|
2584
3122
|
var http = __require("http");
|
|
@@ -2589,7 +3127,10 @@ var require_mixpanel_node = __commonJS({
|
|
|
2589
3127
|
var { async_all, ensure_timestamp, assert_logger } = require_utils();
|
|
2590
3128
|
var { MixpanelGroups } = require_groups();
|
|
2591
3129
|
var { MixpanelPeople } = require_people();
|
|
2592
|
-
var {
|
|
3130
|
+
var {
|
|
3131
|
+
LocalFeatureFlagsProvider,
|
|
3132
|
+
RemoteFeatureFlagsProvider
|
|
3133
|
+
} = require_flags2();
|
|
2593
3134
|
var DEFAULT_CONFIG = {
|
|
2594
3135
|
test: false,
|
|
2595
3136
|
debug: false,
|
|
@@ -2605,7 +3146,9 @@ var require_mixpanel_node = __commonJS({
|
|
|
2605
3146
|
};
|
|
2606
3147
|
var create_client = function(token, config) {
|
|
2607
3148
|
if (!token) {
|
|
2608
|
-
throw new Error(
|
|
3149
|
+
throw new Error(
|
|
3150
|
+
"The Mixpanel Client needs a Mixpanel token: `init(token)`"
|
|
3151
|
+
);
|
|
2609
3152
|
}
|
|
2610
3153
|
const metrics = {
|
|
2611
3154
|
token,
|
|
@@ -2619,9 +3162,11 @@ var require_mixpanel_node = __commonJS({
|
|
|
2619
3162
|
https: new https.Agent({ keepAlive })
|
|
2620
3163
|
};
|
|
2621
3164
|
const proxyPath = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
2622
|
-
const proxyAgent = proxyPath ? new HttpsProxyAgent(
|
|
2623
|
-
|
|
2624
|
-
|
|
3165
|
+
const proxyAgent = proxyPath ? new HttpsProxyAgent(
|
|
3166
|
+
Object.assign(url.parse(proxyPath), {
|
|
3167
|
+
keepAlive
|
|
3168
|
+
})
|
|
3169
|
+
) : null;
|
|
2625
3170
|
metrics.send_request = function(options, callback) {
|
|
2626
3171
|
callback = callback || function() {
|
|
2627
3172
|
};
|
|
@@ -2629,8 +3174,8 @@ var require_mixpanel_node = __commonJS({
|
|
|
2629
3174
|
const endpoint = options.endpoint;
|
|
2630
3175
|
const method = (options.method || "GET").toUpperCase();
|
|
2631
3176
|
let query_params = {
|
|
2632
|
-
|
|
2633
|
-
|
|
3177
|
+
ip: metrics.config.geolocate ? 1 : 0,
|
|
3178
|
+
verbose: metrics.config.verbose ? 1 : 0
|
|
2634
3179
|
};
|
|
2635
3180
|
const key = metrics.config.key;
|
|
2636
3181
|
const secret = metrics.config.secret;
|
|
@@ -2663,7 +3208,9 @@ var require_mixpanel_node = __commonJS({
|
|
|
2663
3208
|
} else if (key) {
|
|
2664
3209
|
query_params.api_key = key;
|
|
2665
3210
|
} else if (endpoint === "/import") {
|
|
2666
|
-
throw new Error(
|
|
3211
|
+
throw new Error(
|
|
3212
|
+
"The Mixpanel Client needs a Mixpanel API Secret when importing old events: `init(token, { secret: ... })`"
|
|
3213
|
+
);
|
|
2667
3214
|
}
|
|
2668
3215
|
request_options.agent = proxyAgent || REQUEST_AGENTS[metrics.config.protocol];
|
|
2669
3216
|
if (metrics.config.test) {
|
|
@@ -2671,20 +3218,22 @@ var require_mixpanel_node = __commonJS({
|
|
|
2671
3218
|
}
|
|
2672
3219
|
request_options.path = metrics.config.path + endpoint + "?" + querystring.stringify(query_params);
|
|
2673
3220
|
request = request_lib.request(request_options, function(res) {
|
|
2674
|
-
|
|
3221
|
+
let data = "";
|
|
2675
3222
|
res.on("data", function(chunk2) {
|
|
2676
3223
|
data += chunk2;
|
|
2677
3224
|
});
|
|
2678
3225
|
res.on("end", function() {
|
|
2679
|
-
|
|
3226
|
+
let e;
|
|
2680
3227
|
if (metrics.config.verbose) {
|
|
2681
3228
|
try {
|
|
2682
|
-
|
|
3229
|
+
const result = JSON.parse(data);
|
|
2683
3230
|
if (result.status != 1) {
|
|
2684
3231
|
e = new Error("Mixpanel Server Error: " + result.error);
|
|
2685
3232
|
}
|
|
2686
3233
|
} catch (ex) {
|
|
2687
|
-
e = new Error(
|
|
3234
|
+
e = new Error(
|
|
3235
|
+
"Could not parse response from Mixpanel " + ex.message
|
|
3236
|
+
);
|
|
2688
3237
|
}
|
|
2689
3238
|
} else {
|
|
2690
3239
|
e = data !== "1" ? new Error("Mixpanel Server Error: " + data) : void 0;
|
|
@@ -2707,39 +3256,46 @@ var require_mixpanel_node = __commonJS({
|
|
|
2707
3256
|
properties.token = metrics.token;
|
|
2708
3257
|
properties.mp_lib = "node";
|
|
2709
3258
|
properties.$lib_version = packageInfo.version;
|
|
2710
|
-
|
|
3259
|
+
const data = {
|
|
2711
3260
|
event,
|
|
2712
3261
|
properties
|
|
2713
3262
|
};
|
|
2714
3263
|
if (metrics.config.debug) {
|
|
2715
|
-
metrics.config.logger.debug("Sending the following event to Mixpanel", {
|
|
3264
|
+
metrics.config.logger.debug("Sending the following event to Mixpanel", {
|
|
3265
|
+
data
|
|
3266
|
+
});
|
|
2716
3267
|
}
|
|
2717
|
-
metrics.send_request(
|
|
3268
|
+
metrics.send_request(
|
|
3269
|
+
{ method: "GET", endpoint, data },
|
|
3270
|
+
callback
|
|
3271
|
+
);
|
|
2718
3272
|
};
|
|
2719
|
-
|
|
2720
|
-
|
|
3273
|
+
const chunk = function(arr, size) {
|
|
3274
|
+
let chunks = [], i = 0, total = arr.length;
|
|
2721
3275
|
while (i < total) {
|
|
2722
3276
|
chunks.push(arr.slice(i, i += size));
|
|
2723
3277
|
}
|
|
2724
3278
|
return chunks;
|
|
2725
3279
|
};
|
|
2726
|
-
|
|
2727
|
-
|
|
3280
|
+
const send_batch_requests = function(options, callback) {
|
|
3281
|
+
const event_list = options.event_list, endpoint = options.endpoint, max_batch_size = options.max_batch_size ? Math.min(MAX_BATCH_SIZE, options.max_batch_size) : MAX_BATCH_SIZE, max_concurrent_requests = options.max_concurrent_requests || options.max_batch_size > MAX_BATCH_SIZE && Math.ceil(options.max_batch_size / MAX_BATCH_SIZE), event_batches = chunk(event_list, max_batch_size), request_batches = max_concurrent_requests ? chunk(event_batches, max_concurrent_requests) : [event_batches], total_event_batches = event_batches.length, total_request_batches = request_batches.length;
|
|
2728
3282
|
function send_event_batch(batch, cb) {
|
|
2729
3283
|
if (batch.length > 0) {
|
|
2730
3284
|
batch = batch.map(function(event) {
|
|
2731
|
-
event.properties;
|
|
2732
3285
|
if (endpoint === "/import" || event.properties.time) {
|
|
2733
3286
|
event.properties.time = ensure_timestamp(event.properties.time);
|
|
2734
3287
|
}
|
|
2735
3288
|
event.properties.token = event.properties.token || metrics.token;
|
|
2736
3289
|
return event;
|
|
2737
3290
|
});
|
|
2738
|
-
metrics.send_request(
|
|
3291
|
+
metrics.send_request(
|
|
3292
|
+
{ method: "POST", endpoint, data: batch },
|
|
3293
|
+
cb
|
|
3294
|
+
);
|
|
2739
3295
|
}
|
|
2740
3296
|
}
|
|
2741
3297
|
function send_next_request_batch(index) {
|
|
2742
|
-
|
|
3298
|
+
const request_batch = request_batches[index], cb = function(errors, results) {
|
|
2743
3299
|
index += 1;
|
|
2744
3300
|
if (index === total_request_batches) {
|
|
2745
3301
|
callback && callback(errors, results);
|
|
@@ -2772,7 +3328,7 @@ var require_mixpanel_node = __commonJS({
|
|
|
2772
3328
|
callback = options;
|
|
2773
3329
|
options = {};
|
|
2774
3330
|
}
|
|
2775
|
-
|
|
3331
|
+
const batch_options = {
|
|
2776
3332
|
event_list,
|
|
2777
3333
|
endpoint: "/track",
|
|
2778
3334
|
max_concurrent_requests: options.max_concurrent_requests,
|
|
@@ -2789,7 +3345,7 @@ var require_mixpanel_node = __commonJS({
|
|
|
2789
3345
|
metrics.send_event_request("/import", event, properties, callback);
|
|
2790
3346
|
};
|
|
2791
3347
|
metrics.import_batch = function(event_list, options, callback) {
|
|
2792
|
-
|
|
3348
|
+
let batch_options;
|
|
2793
3349
|
if (typeof options === "function" || !options) {
|
|
2794
3350
|
callback = options;
|
|
2795
3351
|
options = {};
|
|
@@ -2803,7 +3359,7 @@ var require_mixpanel_node = __commonJS({
|
|
|
2803
3359
|
send_batch_requests(batch_options, callback);
|
|
2804
3360
|
};
|
|
2805
3361
|
metrics.alias = function(distinct_id, alias, callback) {
|
|
2806
|
-
|
|
3362
|
+
const properties = {
|
|
2807
3363
|
distinct_id,
|
|
2808
3364
|
alias
|
|
2809
3365
|
};
|