@jitsu/js 1.9.17 → 1.9.18-canary.1269.20250403142744
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/jitsu.cjs.js +2 -1
- package/dist/jitsu.d.ts +1 -12
- package/dist/jitsu.es.js +2 -1
- package/dist/web/p.js.txt +2 -1
- package/package.json +9 -3
- package/.turbo/turbo-build.log +0 -67
- package/.turbo/turbo-clean.log +0 -5
- package/.turbo/turbo-test.log +0 -4665
- package/__tests__/node/method-queue.test.ts +0 -66
- package/__tests__/node/nodejs.test.ts +0 -306
- package/__tests__/playwright/cases/anonymous-id-bug.html +0 -26
- package/__tests__/playwright/cases/basic.html +0 -32
- package/__tests__/playwright/cases/callbacks.html +0 -21
- package/__tests__/playwright/cases/cookie-names.html +0 -22
- package/__tests__/playwright/cases/disable-user-ids.html +0 -23
- package/__tests__/playwright/cases/dont-send.html +0 -22
- package/__tests__/playwright/cases/ip-policy.html +0 -22
- package/__tests__/playwright/cases/reset.html +0 -32
- package/__tests__/playwright/cases/segment-reference.html +0 -64
- package/__tests__/playwright/cases/url-bug.html +0 -20
- package/__tests__/playwright/integration.test.ts +0 -640
- package/__tests__/simple-syrup.ts +0 -136
- package/jest.config.js +0 -13
- package/playwrite.config.ts +0 -91
- package/rollup.config.js +0 -32
- package/src/analytics-plugin.ts +0 -993
- package/src/browser.ts +0 -163
- package/src/destination-plugins/ga4.ts +0 -138
- package/src/destination-plugins/gtm.ts +0 -142
- package/src/destination-plugins/index.ts +0 -61
- package/src/destination-plugins/logrocket.ts +0 -85
- package/src/destination-plugins/tag.ts +0 -85
- package/src/index.ts +0 -255
- package/src/method-queue.ts +0 -70
- package/src/script-loader.ts +0 -76
- package/src/tlds.ts +0 -27
- package/src/version.ts +0 -6
- package/tsconfig.json +0 -23
- package/tsconfig.test.json +0 -15
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import type { Application, RequestHandler } from "express";
|
|
2
|
-
import http from "http";
|
|
3
|
-
import https from "https";
|
|
4
|
-
|
|
5
|
-
const express = require("express");
|
|
6
|
-
|
|
7
|
-
const forge = require("node-forge");
|
|
8
|
-
|
|
9
|
-
export type SimpleSyrupOpts = {
|
|
10
|
-
port?: number;
|
|
11
|
-
https?: boolean;
|
|
12
|
-
handlers?: Record<string, RequestHandler>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type SimpleSyrup = {
|
|
16
|
-
app: Application;
|
|
17
|
-
server: http.Server;
|
|
18
|
-
port: number;
|
|
19
|
-
baseUrl: string;
|
|
20
|
-
close: () => Promise<void>;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
function getNextAvailablePort(port: number) {
|
|
24
|
-
return new Promise<number>(resolve => {
|
|
25
|
-
const server = http.createServer();
|
|
26
|
-
server.on("error", () => {
|
|
27
|
-
resolve(getNextAvailablePort(port + 1));
|
|
28
|
-
});
|
|
29
|
-
server.on("listening", () => {
|
|
30
|
-
server.close(() => {
|
|
31
|
-
resolve(port);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
server.listen(port);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function generateX509Certificate(altNames: { type: number; value: string }[]) {
|
|
39
|
-
const issuer = [
|
|
40
|
-
{ name: "commonName", value: "localhost" },
|
|
41
|
-
{ name: "organizationName", value: "ACME Corp" },
|
|
42
|
-
{ name: "organizationalUnitName", value: "XYZ Department" },
|
|
43
|
-
];
|
|
44
|
-
const certificateExtensions = [
|
|
45
|
-
{ name: "basicConstraints", cA: true },
|
|
46
|
-
{
|
|
47
|
-
name: "keyUsage",
|
|
48
|
-
keyCertSign: true,
|
|
49
|
-
digitalSignature: true,
|
|
50
|
-
nonRepudiation: true,
|
|
51
|
-
keyEncipherment: true,
|
|
52
|
-
dataEncipherment: true,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: "extKeyUsage",
|
|
56
|
-
serverAuth: true,
|
|
57
|
-
clientAuth: true,
|
|
58
|
-
codeSigning: true,
|
|
59
|
-
emailProtection: true,
|
|
60
|
-
timeStamping: true,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "nsCertType",
|
|
64
|
-
client: true,
|
|
65
|
-
server: true,
|
|
66
|
-
email: true,
|
|
67
|
-
objsign: true,
|
|
68
|
-
sslCA: true,
|
|
69
|
-
emailCA: true,
|
|
70
|
-
objCA: true,
|
|
71
|
-
},
|
|
72
|
-
{ name: "subjectAltName", altNames },
|
|
73
|
-
{ name: "subjectKeyIdentifier" },
|
|
74
|
-
];
|
|
75
|
-
const keys = forge.pki.rsa.generateKeyPair(2048);
|
|
76
|
-
const cert = forge.pki.createCertificate();
|
|
77
|
-
cert.validity.notBefore = new Date();
|
|
78
|
-
cert.validity.notAfter = new Date();
|
|
79
|
-
cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 1);
|
|
80
|
-
cert.publicKey = keys.publicKey;
|
|
81
|
-
cert.setSubject(issuer);
|
|
82
|
-
cert.setIssuer(issuer);
|
|
83
|
-
cert.setExtensions(certificateExtensions);
|
|
84
|
-
cert.sign(keys.privateKey);
|
|
85
|
-
return {
|
|
86
|
-
key: forge.pki.privateKeyToPem(keys.privateKey),
|
|
87
|
-
cert: forge.pki.certificateToPem(cert),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function shutdownFunction(server): Promise<void> {
|
|
92
|
-
return new Promise<void>(resolve => {
|
|
93
|
-
let resolved = false;
|
|
94
|
-
const resolveIfNeeded = () => {
|
|
95
|
-
if (!resolved) {
|
|
96
|
-
resolved = true;
|
|
97
|
-
resolve();
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
setTimeout(resolveIfNeeded, 5000);
|
|
101
|
-
server.close(resolveIfNeeded);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export function createServer(opts: SimpleSyrupOpts = {}): Promise<SimpleSyrup> {
|
|
106
|
-
return new Promise<SimpleSyrup>(async (resolve, reject) => {
|
|
107
|
-
const app: Application = express();
|
|
108
|
-
app.use(express.json());
|
|
109
|
-
const server = opts?.https ? https.createServer(generateX509Certificate([]), app) : http.createServer(app);
|
|
110
|
-
const port = opts?.port ? await getNextAvailablePort(opts.port) : 0;
|
|
111
|
-
server.listen(port, () => {
|
|
112
|
-
const address = server.address();
|
|
113
|
-
if (!address) {
|
|
114
|
-
reject(new Error(`Unable to get server address`));
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
if (typeof address === "string") {
|
|
118
|
-
reject(new Error(`Address is not an of network. This is not supported: ${address} `));
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const port = address.port;
|
|
122
|
-
if (opts?.handlers) {
|
|
123
|
-
for (const [path, handler] of Object.entries(opts?.handlers)) {
|
|
124
|
-
app.all(path, handler);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
resolve({
|
|
128
|
-
app: app,
|
|
129
|
-
port,
|
|
130
|
-
close: () => shutdownFunction(server),
|
|
131
|
-
baseUrl: `${opts.https ? "https" : "http"}://localhost:${port}`,
|
|
132
|
-
server: server,
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
}
|
package/jest.config.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** @type {import("ts-jest").JestConfigWithTsJest} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
//preset: "ts-jest",
|
|
4
|
-
preset: "ts-jest",
|
|
5
|
-
testEnvironment: "node",
|
|
6
|
-
runner: "jest-runner",
|
|
7
|
-
rootDir: "./__tests__/node/",
|
|
8
|
-
globals: {
|
|
9
|
-
'ts-jest': {
|
|
10
|
-
tsConfig: 'tsconfig.test.json'
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
};
|
package/playwrite.config.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { devices, PlaywrightTestConfig } from "@playwright/test";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Read environment variables from file.
|
|
5
|
-
* https://github.com/motdotla/dotenv
|
|
6
|
-
*/
|
|
7
|
-
// require('dotenv').config();
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* See https://playwright.dev/docs/test-configuration.
|
|
11
|
-
*/
|
|
12
|
-
const config: PlaywrightTestConfig = {
|
|
13
|
-
/* Maximum time one test can run for. */
|
|
14
|
-
timeout: 30 * 1000,
|
|
15
|
-
expect: {
|
|
16
|
-
/**
|
|
17
|
-
* Maximum time expect() should wait for the condition to be met.
|
|
18
|
-
* For example in `await expect(locator).toHaveText();`
|
|
19
|
-
*/
|
|
20
|
-
timeout: 5000,
|
|
21
|
-
},
|
|
22
|
-
/* Run tests in files in parallel */
|
|
23
|
-
fullyParallel: true,
|
|
24
|
-
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
25
|
-
forbidOnly: !!process.env.CI,
|
|
26
|
-
/* Retry on CI only */
|
|
27
|
-
retries: process.env.CI ? 2 : 0,
|
|
28
|
-
/* Opt out of parallel tests on CI. */
|
|
29
|
-
workers: process.env.CI ? 1 : undefined,
|
|
30
|
-
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
31
|
-
reporter: "html",
|
|
32
|
-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
33
|
-
use: {
|
|
34
|
-
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
|
|
35
|
-
actionTimeout: 0,
|
|
36
|
-
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
37
|
-
// baseURL: 'http://localhost:3000',
|
|
38
|
-
|
|
39
|
-
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
40
|
-
trace: "on-first-retry",
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
/* Configure projects for major browsers */
|
|
44
|
-
projects: [
|
|
45
|
-
{
|
|
46
|
-
name: "chromium",
|
|
47
|
-
use: {
|
|
48
|
-
...devices["Desktop Chrome"],
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
/* Test against mobile viewports. */
|
|
53
|
-
// {
|
|
54
|
-
// name: 'Mobile Chrome',
|
|
55
|
-
// use: {
|
|
56
|
-
// ...devices['Pixel 5'],
|
|
57
|
-
// },
|
|
58
|
-
// },
|
|
59
|
-
// {
|
|
60
|
-
// name: 'Mobile Safari',
|
|
61
|
-
// use: {
|
|
62
|
-
// ...devices['iPhone 12'],
|
|
63
|
-
// },
|
|
64
|
-
// },
|
|
65
|
-
|
|
66
|
-
/* Test against branded browsers. */
|
|
67
|
-
// {
|
|
68
|
-
// name: 'Microsoft Edge',
|
|
69
|
-
// use: {
|
|
70
|
-
// channel: 'msedge',
|
|
71
|
-
// },
|
|
72
|
-
// },
|
|
73
|
-
// {
|
|
74
|
-
// name: 'Google Chrome',
|
|
75
|
-
// use: {
|
|
76
|
-
// channel: 'chrome',
|
|
77
|
-
// },
|
|
78
|
-
// },
|
|
79
|
-
],
|
|
80
|
-
|
|
81
|
-
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
|
|
82
|
-
outputDir: "__tests__/results",
|
|
83
|
-
|
|
84
|
-
/* Run your local dev server before starting the tests */
|
|
85
|
-
// webServer: {
|
|
86
|
-
// command: 'npm run start',
|
|
87
|
-
// port: 3000,
|
|
88
|
-
// },
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default config;
|
package/rollup.config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const multi = require("@rollup/plugin-multi-entry");
|
|
2
|
-
const resolve = require("@rollup/plugin-node-resolve");
|
|
3
|
-
const commonjs = require("@rollup/plugin-commonjs");
|
|
4
|
-
const rollupJson = require("@rollup/plugin-json");
|
|
5
|
-
const terser = require("@rollup/plugin-terser");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
module.exports = [
|
|
9
|
-
{
|
|
10
|
-
plugins: [
|
|
11
|
-
multi(),
|
|
12
|
-
resolve({ preferBuiltins: false }),
|
|
13
|
-
commonjs(),
|
|
14
|
-
rollupJson(),
|
|
15
|
-
(process.JITSU_JS_DEBUG_BUILD = "1" ? undefined : terser()),
|
|
16
|
-
],
|
|
17
|
-
input: "./compiled/src/browser.js",
|
|
18
|
-
output: {
|
|
19
|
-
file: `dist/web/p.js.txt`,
|
|
20
|
-
format: "iife",
|
|
21
|
-
sourcemap: false,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
plugins: [multi(), resolve({ preferBuiltins: false }), commonjs(), rollupJson()],
|
|
26
|
-
input: ["./compiled/src/index.js", "./compiled/src/jitsu.js", "./compiled/src/analytics-plugin.js"],
|
|
27
|
-
output: [
|
|
28
|
-
{ file: "dist/jitsu.es.js", format: "es" },
|
|
29
|
-
{ file: "dist/jitsu.cjs.js", format: "cjs" },
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
];
|