This commit is contained in:
Andras Schmelczer 2025-03-15 15:06:06 +00:00
commit 15a09dff95
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
6 changed files with 59 additions and 75 deletions

View file

@ -22,7 +22,6 @@
"../backend/sync_lib/pkg": { "../backend/sync_lib/pkg": {
"name": "sync_lib", "name": "sync_lib",
"version": "0.0.30", "version": "0.0.30",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@ampproject/remapping": { "node_modules/@ampproject/remapping": {
@ -39,7 +38,6 @@
}, },
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
"version": "7.26.2", "version": "7.26.2",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/helper-validator-identifier": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9",
@ -179,7 +177,6 @@
}, },
"node_modules/@babel/helper-validator-identifier": { "node_modules/@babel/helper-validator-identifier": {
"version": "7.25.9", "version": "7.25.9",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
@ -1235,7 +1232,6 @@
}, },
"node_modules/@redocly/ajv": { "node_modules/@redocly/ajv": {
"version": "8.11.2", "version": "8.11.2",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fast-deep-equal": "^3.1.1", "fast-deep-equal": "^3.1.1",
@ -1250,17 +1246,14 @@
}, },
"node_modules/@redocly/ajv/node_modules/json-schema-traverse": { "node_modules/@redocly/ajv/node_modules/json-schema-traverse": {
"version": "1.0.0", "version": "1.0.0",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@redocly/config": { "node_modules/@redocly/config": {
"version": "0.20.3", "version": "0.20.3",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@redocly/openapi-core": { "node_modules/@redocly/openapi-core": {
"version": "1.29.0", "version": "1.29.0",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@redocly/ajv": "^8.11.2", "@redocly/ajv": "^8.11.2",
@ -1280,7 +1273,6 @@
}, },
"node_modules/@redocly/openapi-core/node_modules/brace-expansion": { "node_modules/@redocly/openapi-core/node_modules/brace-expansion": {
"version": "2.0.1", "version": "2.0.1",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"balanced-match": "^1.0.0" "balanced-match": "^1.0.0"
@ -1288,7 +1280,6 @@
}, },
"node_modules/@redocly/openapi-core/node_modules/minimatch": { "node_modules/@redocly/openapi-core/node_modules/minimatch": {
"version": "5.1.6", "version": "5.1.6",
"dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"brace-expansion": "^2.0.1" "brace-expansion": "^2.0.1"
@ -1909,7 +1900,6 @@
}, },
"node_modules/agent-base": { "node_modules/agent-base": {
"version": "7.1.3", "version": "7.1.3",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">= 14" "node": ">= 14"
@ -1976,7 +1966,6 @@
}, },
"node_modules/ansi-colors": { "node_modules/ansi-colors": {
"version": "4.1.3", "version": "4.1.3",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=6" "node": ">=6"
@ -2039,7 +2028,6 @@
}, },
"node_modules/argparse": { "node_modules/argparse": {
"version": "2.0.1", "version": "2.0.1",
"dev": true,
"license": "Python-2.0" "license": "Python-2.0"
}, },
"node_modules/async": { "node_modules/async": {
@ -2161,7 +2149,6 @@
}, },
"node_modules/balanced-match": { "node_modules/balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/big.js": { "node_modules/big.js": {
@ -2249,7 +2236,6 @@
}, },
"node_modules/byte-base64": { "node_modules/byte-base64": {
"version": "1.1.0", "version": "1.1.0",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/call-bind-apply-helpers": { "node_modules/call-bind-apply-helpers": {
@ -2335,7 +2321,6 @@
}, },
"node_modules/change-case": { "node_modules/change-case": {
"version": "5.4.4", "version": "5.4.4",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/char-regex": { "node_modules/char-regex": {
@ -2445,7 +2430,6 @@
}, },
"node_modules/colorette": { "node_modules/colorette": {
"version": "1.4.0", "version": "1.4.0",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/commander": { "node_modules/commander": {
@ -2597,7 +2581,6 @@
}, },
"node_modules/debug": { "node_modules/debug": {
"version": "4.4.0", "version": "4.4.0",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"ms": "^2.1.3" "ms": "^2.1.3"
@ -2991,7 +2974,6 @@
}, },
"node_modules/eventemitter3": { "node_modules/eventemitter3": {
"version": "5.0.1", "version": "5.0.1",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/events": { "node_modules/events": {
@ -3048,7 +3030,6 @@
}, },
"node_modules/fast-deep-equal": { "node_modules/fast-deep-equal": {
"version": "3.1.3", "version": "3.1.3",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/fast-glob": { "node_modules/fast-glob": {
@ -3128,7 +3109,6 @@
}, },
"node_modules/fetch-retry": { "node_modules/fetch-retry": {
"version": "6.0.0", "version": "6.0.0",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/file-entry-cache": { "node_modules/file-entry-cache": {
@ -3449,7 +3429,6 @@
}, },
"node_modules/https-proxy-agent": { "node_modules/https-proxy-agent": {
"version": "7.0.6", "version": "7.0.6",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"agent-base": "^7.1.2", "agent-base": "^7.1.2",
@ -3536,7 +3515,6 @@
}, },
"node_modules/index-to-position": { "node_modules/index-to-position": {
"version": "0.1.2", "version": "0.1.2",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=18" "node": ">=18"
@ -4271,7 +4249,6 @@
}, },
"node_modules/js-levenshtein": { "node_modules/js-levenshtein": {
"version": "1.1.6", "version": "1.1.6",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@ -4279,12 +4256,10 @@
}, },
"node_modules/js-tokens": { "node_modules/js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/js-yaml": { "node_modules/js-yaml": {
"version": "4.1.0", "version": "4.1.0",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"argparse": "^2.0.1" "argparse": "^2.0.1"
@ -4631,7 +4606,6 @@
}, },
"node_modules/ms": { "node_modules/ms": {
"version": "2.1.3", "version": "2.1.3",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/nanoid": { "node_modules/nanoid": {
@ -4759,7 +4733,6 @@
}, },
"node_modules/openapi-fetch": { "node_modules/openapi-fetch": {
"version": "0.13.4", "version": "0.13.4",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"openapi-typescript-helpers": "^0.0.15" "openapi-typescript-helpers": "^0.0.15"
@ -4767,7 +4740,6 @@
}, },
"node_modules/openapi-typescript": { "node_modules/openapi-typescript": {
"version": "7.6.1", "version": "7.6.1",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@redocly/openapi-core": "^1.28.0", "@redocly/openapi-core": "^1.28.0",
@ -4786,12 +4758,10 @@
}, },
"node_modules/openapi-typescript-helpers": { "node_modules/openapi-typescript-helpers": {
"version": "0.0.15", "version": "0.0.15",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/openapi-typescript/node_modules/parse-json": { "node_modules/openapi-typescript/node_modules/parse-json": {
"version": "8.1.0", "version": "8.1.0",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/code-frame": "^7.22.13", "@babel/code-frame": "^7.22.13",
@ -4807,7 +4777,6 @@
}, },
"node_modules/openapi-typescript/node_modules/supports-color": { "node_modules/openapi-typescript/node_modules/supports-color": {
"version": "9.4.0", "version": "9.4.0",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=12" "node": ">=12"
@ -4818,7 +4787,6 @@
}, },
"node_modules/openapi-typescript/node_modules/type-fest": { "node_modules/openapi-typescript/node_modules/type-fest": {
"version": "4.35.0", "version": "4.35.0",
"dev": true,
"license": "(MIT OR CC0-1.0)", "license": "(MIT OR CC0-1.0)",
"engines": { "engines": {
"node": ">=16" "node": ">=16"
@ -4873,7 +4841,6 @@
}, },
"node_modules/p-queue": { "node_modules/p-queue": {
"version": "8.1.0", "version": "8.1.0",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"eventemitter3": "^5.0.1", "eventemitter3": "^5.0.1",
@ -4888,7 +4855,6 @@
}, },
"node_modules/p-timeout": { "node_modules/p-timeout": {
"version": "6.1.4", "version": "6.1.4",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=14.16" "node": ">=14.16"
@ -4966,7 +4932,6 @@
}, },
"node_modules/picocolors": { "node_modules/picocolors": {
"version": "1.1.1", "version": "1.1.1",
"dev": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/picomatch": { "node_modules/picomatch": {
@ -5049,7 +5014,6 @@
}, },
"node_modules/pluralize": { "node_modules/pluralize": {
"version": "8.0.0", "version": "8.0.0",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=4" "node": ">=4"
@ -5328,7 +5292,6 @@
}, },
"node_modules/require-from-string": { "node_modules/require-from-string": {
"version": "2.0.2", "version": "2.0.2",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@ -6197,7 +6160,6 @@
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.7.3", "version": "5.7.3",
"dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
@ -6280,7 +6242,6 @@
}, },
"node_modules/uri-js-replace": { "node_modules/uri-js-replace": {
"version": "1.0.1", "version": "1.0.1",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/url": { "node_modules/url": {
@ -6311,7 +6272,6 @@
}, },
"node_modules/uuid": { "node_modules/uuid": {
"version": "11.1.0", "version": "11.1.0",
"dev": true,
"funding": [ "funding": [
"https://github.com/sponsors/broofa", "https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan" "https://github.com/sponsors/ctavan"
@ -6480,6 +6440,8 @@
}, },
"node_modules/webpack-merge": { "node_modules/webpack-merge": {
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-6.0.1.tgz",
"integrity": "sha512-hXXvrjtx2PLYx4qruKl+kyRSLc52V+cCvMxRjmKwoA+CBbbF5GfIBtR6kCvl0fYGqTUPKB+1ktVmTHqMOzgCBg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -6643,7 +6605,6 @@
}, },
"node_modules/yaml-ast-parser": { "node_modules/yaml-ast-parser": {
"version": "0.0.43", "version": "0.0.43",
"dev": true,
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
"node_modules/yargs": { "node_modules/yargs": {
@ -6665,7 +6626,6 @@
}, },
"node_modules/yargs-parser": { "node_modules/yargs-parser": {
"version": "21.1.1", "version": "21.1.1",
"dev": true,
"license": "ISC", "license": "ISC",
"engines": { "engines": {
"node": ">=12" "node": ">=12"
@ -6723,23 +6683,26 @@
}, },
"sync-client": { "sync-client": {
"version": "0.0.0", "version": "0.0.0",
"devDependencies": { "dependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.13.5",
"byte-base64": "^1.1.0", "byte-base64": "^1.1.0",
"fetch-retry": "^6.0.0", "fetch-retry": "^6.0.0",
"jest": "^29.7.0",
"openapi-fetch": "0.13.4", "openapi-fetch": "0.13.4",
"openapi-typescript": "7.6.1", "openapi-typescript": "7.6.1",
"p-queue": "^8.1.0", "p-queue": "^8.1.0",
"sync_lib": "file:../../backend/sync_lib/pkg", "sync_lib": "file:../../backend/sync_lib/pkg",
"uuid": "^11.1.0"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.13.5",
"jest": "^29.7.0",
"ts-jest": "^29.2.6", "ts-jest": "^29.2.6",
"ts-loader": "^9.5.2", "ts-loader": "^9.5.2",
"tslib": "2.8.1", "tslib": "2.8.1",
"typescript": "5.7.3", "typescript": "5.7.3",
"uuid": "^11.1.0",
"webpack": "^5.98.0", "webpack": "^5.98.0",
"webpack-cli": "^6.0.1" "webpack-cli": "^6.0.1",
"webpack-merge": "^6.0.1"
} }
}, },
"test-client": { "test-client": {

View file

@ -1,31 +1,36 @@
{ {
"name": "sync-client", "name": "sync-client",
"version": "0.0.0", "version": "0.0.0",
"private": true, "main": "dist/sync-client.node.js",
"main": "dist/index.js", "browser": "dist/sync-client.web.js",
"types": "dist/types/index.d.ts", "types": "dist/types/index.d.ts",
"module": "src/index.js", "files": [
"dist/**/*"
],
"scripts": { "scripts": {
"dev": "webpack watch --mode development", "dev": "webpack watch --mode development",
"build": "webpack --mode production", "build": "webpack --mode production",
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest" "test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest"
}, },
"devDependencies": { "dependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.13.5",
"byte-base64": "^1.1.0", "byte-base64": "^1.1.0",
"fetch-retry": "^6.0.0", "fetch-retry": "^6.0.0",
"jest": "^29.7.0",
"openapi-fetch": "0.13.4", "openapi-fetch": "0.13.4",
"openapi-typescript": "7.6.1", "openapi-typescript": "7.6.1",
"p-queue": "^8.1.0", "p-queue": "^8.1.0",
"sync_lib": "file:../../backend/sync_lib/pkg", "uuid": "^11.1.0"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.13.5",
"jest": "^29.7.0",
"ts-jest": "^29.2.6", "ts-jest": "^29.2.6",
"ts-loader": "^9.5.2", "ts-loader": "^9.5.2",
"tslib": "2.8.1", "tslib": "2.8.1",
"typescript": "5.7.3", "typescript": "5.7.3",
"uuid": "^11.1.0",
"webpack": "^5.98.0", "webpack": "^5.98.0",
"webpack-cli": "^6.0.1" "webpack-cli": "^6.0.1",
"webpack-merge": "^6.0.1",
"sync_lib": "file:../../backend/sync_lib/pkg"
} }
} }

View file

@ -1,6 +1,7 @@
const path = require("path"); const path = require("path");
const { merge } = require("webpack-merge");
module.exports = (_env, _argv) => ({ const common = {
entry: "./src/index.ts", entry: "./src/index.ts",
module: { module: {
rules: [ rules: [
@ -27,15 +28,29 @@ module.exports = (_env, _argv) => ({
}, },
performance: { performance: {
hints: false // it's a library, no need to warn about its size hints: false // it's a library, no need to warn about its size
},
output: {
clean: true,
filename: "index.js",
globalObject: "this",
library: {
name: "SyncClient",
type: "umd"
},
path: path.resolve(__dirname, "dist")
} }
}); };
module.exports = [
merge(common, {
target: "web",
output: {
path: path.resolve(__dirname, "dist"),
filename: "sync-client.web.js",
library: {
name: "SyncClient",
type: "umd",
export: "default"
},
globalObject: "this"
}
}),
merge(common, {
target: "node",
output: {
path: path.resolve(__dirname, "dist"),
filename: "sync-client.node.js",
libraryTarget: "commonjs2"
}
})
];

View file

@ -14,9 +14,11 @@ process_count=$1
npm run build npm run build
mkdir -p logs
pids=() pids=()
for i in $(seq 1 $process_count); do for i in $(seq 1 $process_count); do
node dist/cli.js 2>&1 > "log_${i}.log" & node dist/cli.js 2>&1 > "logs/log_${i}.log" &
pids+=($!) pids+=($!)
done done

View file

@ -93,7 +93,7 @@ async function runTests(): Promise<void> {
const agentCounts = [2, 8]; const agentCounts = [2, 8];
const jitterScaleInSeconds = [0.5, 0, 2]; const jitterScaleInSeconds = [0.5, 0, 2];
const concurrencies = [16, 1]; const concurrencies = [16, 1];
const iterations = [50, 200]; const iterations = [200];
const doDeletes = [true, false]; const doDeletes = [true, false];
for (const agentCount of agentCounts) { for (const agentCount of agentCounts) {
@ -101,7 +101,7 @@ async function runTests(): Promise<void> {
for (const jitter of jitterScaleInSeconds) { for (const jitter of jitterScaleInSeconds) {
for (const iteration of iterations) { for (const iteration of iterations) {
for (const deleteFiles of doDeletes) { for (const deleteFiles of doDeletes) {
for (let i = 0; i < 20; i++) { for (let i = 0; i < 3; i++) {
await runTest({ await runTest({
agentCount, agentCount,
concurrency, concurrency,

View file

@ -12,8 +12,7 @@ module.exports = {
rules: [ rules: [
{ {
test: /\.ts$/, test: /\.ts$/,
use: "ts-loader", use: "ts-loader"
exclude: /node_modules/
} }
] ]
}, },