diff --git a/README.md b/README.md index d267a2e..46e0a25 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,33 @@ filter($q('age:[0 TO 80]'), data); filter($q('gender:*ale OR age:>55'), data); ``` +#### Private Fields + +In certain scenarios, you may want to exclude specific fields from being matched unless explicitly specified. For example, without additional configuration, a query like `luxury` would match both the `name` and `description` fields: + +```typescript +const data = [ + { id: 2, name: 'Luxury Car Model AC', description: 'Car Model AC stands out with its unique features.', age: 15 }, + { id: 3, name: 'Car Model AD', description: 'Experience the luxury of Car Model AD.', age: 30 }, +]; +``` + +This package provides a method to ignore private fields by prefixing their names with an underscore and enabling the feature over a config. Private fields are excluded from wildcard matches but can still be explicitly queried when needed. + +```typescript +const data = [ + { id: 2, name: 'Luxury Car Model AC', _description: 'Car Model AC stands out with its unique features.', age: 15 }, + { id: 3, name: 'Car Model AD', _description: 'Experience the luxury of Car Model AD.', age: 30 }, +]; + +const $q = (q) => new QueryParser(q); + +filter($q('luxury'), data, {..., featureEnablePrivateField: true}); +filter($q('description:luxury'), data, {..., featureEnablePrivateField: true}); +``` + +In this example, a generic query like `luxury` would only match the `name` field. However, if you need to target the private field, you can do so explicitly, such as with `description:luxury`. + ### Serializer Usage ```typescript @@ -394,6 +421,7 @@ The following Lucene features are not currently supported but may be added in th The following filters are not yet supported: - ~~Iterating over Array Object key without index like (e.g., `field.key_in_array`, working `field.*.key_in_array`)~~ (Supported since v1.1.0) +- The private field feature doesn't work for trailing queries (e.g. `field.private*`) ## Contributing diff --git a/package-lock.json b/package-lock.json index 9b43470..9ac1837 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,22 +18,22 @@ "@semantic-release/npm": "^12.0.1", "@semantic-release/release-notes-generator": "^14.0.1", "@types/eslint__js": "^8.42.3", - "@types/node": "^22.9.3", - "@vitest/coverage-v8": "^2.1.5", - "@vitest/ui": "^2.1.5", + "@types/node": "^22.10.2", + "@vitest/coverage-v8": "^2.1.8", + "@vitest/ui": "^2.1.8", "eslint": "^9.15.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-unicorn": "^56.0.1", "globals": "^15.12.0", "husky": "^9.1.7", - "prettier": "3.4.1", + "prettier": "3.4.2", "semantic-release": "^24.2.0", "ts-pegjs": "^4.2.1", "tsup": "^8.3.5", "typescript": "^5.6.3", "typescript-eslint": "^8.15.0", - "vitest": "^2.1.5" + "vitest": "^2.1.8" } }, "node_modules/@ampproject/remapping": { @@ -1615,7 +1615,8 @@ "version": "1.0.0-next.28", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.28.tgz", "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.24.3", @@ -2169,9 +2170,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "22.10.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.1.tgz", - "integrity": "sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==", + "version": "22.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", + "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2428,9 +2429,9 @@ } }, "node_modules/@vitest/coverage-v8": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.1.6.tgz", - "integrity": "sha512-qItJVYDbG3MUFO68dOZUz+rWlqe9LMzotERXFXKg25s2A/kSVsyS9O0yNGrITfBd943GsnBeQZkBUu7Pc+zVeA==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.1.8.tgz", + "integrity": "sha512-2Y7BPlKH18mAZYAW1tYByudlCYrQyl5RGvnnDYJKW5tCiO5qg3KSAy3XAxcxKz900a0ZXxWtKrMuZLe3lKBpJw==", "dev": true, "license": "MIT", "dependencies": { @@ -2451,8 +2452,8 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "@vitest/browser": "2.1.6", - "vitest": "2.1.6" + "@vitest/browser": "2.1.8", + "vitest": "2.1.8" }, "peerDependenciesMeta": { "@vitest/browser": { @@ -2461,14 +2462,14 @@ } }, "node_modules/@vitest/expect": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.6.tgz", - "integrity": "sha512-9M1UR9CAmrhJOMoSwVnPh2rELPKhYo0m/CSgqw9PyStpxtkwhmdM6XYlXGKeYyERY1N6EIuzkQ7e3Lm1WKCoUg==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.8.tgz", + "integrity": "sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "2.1.6", - "@vitest/utils": "2.1.6", + "@vitest/spy": "2.1.8", + "@vitest/utils": "2.1.8", "chai": "^5.1.2", "tinyrainbow": "^1.2.0" }, @@ -2477,13 +2478,13 @@ } }, "node_modules/@vitest/mocker": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.6.tgz", - "integrity": "sha512-MHZp2Z+Q/A3am5oD4WSH04f9B0T7UvwEb+v5W0kCYMhtXGYbdyl2NUk1wdSMqGthmhpiThPDp/hEoVwu16+u1A==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.8.tgz", + "integrity": "sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "2.1.6", + "@vitest/spy": "2.1.8", "estree-walker": "^3.0.3", "magic-string": "^0.30.12" }, @@ -2492,7 +2493,7 @@ }, "peerDependencies": { "msw": "^2.4.9", - "vite": "^5.0.0 || ^6.0.0" + "vite": "^5.0.0" }, "peerDependenciesMeta": { "msw": { @@ -2504,9 +2505,9 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.6.tgz", - "integrity": "sha512-exZyLcEnHgDMKc54TtHca4McV4sKT+NKAe9ix/yhd/qkYb/TP8HTyXRFDijV19qKqTZM0hPL4753zU/U8L/gAA==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.8.tgz", + "integrity": "sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2517,13 +2518,13 @@ } }, "node_modules/@vitest/runner": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.6.tgz", - "integrity": "sha512-SjkRGSFyrA82m5nz7To4CkRSEVWn/rwQISHoia/DB8c6IHIhaE/UNAo+7UfeaeJRE979XceGl00LNkIz09RFsA==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.8.tgz", + "integrity": "sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "2.1.6", + "@vitest/utils": "2.1.8", "pathe": "^1.1.2" }, "funding": { @@ -2531,13 +2532,13 @@ } }, "node_modules/@vitest/snapshot": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.6.tgz", - "integrity": "sha512-5JTWHw8iS9l3v4/VSuthCndw1lN/hpPB+mlgn1BUhFbobeIUj1J1V/Bj2t2ovGEmkXLTckFjQddsxS5T6LuVWw==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.8.tgz", + "integrity": "sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.1.6", + "@vitest/pretty-format": "2.1.8", "magic-string": "^0.30.12", "pathe": "^1.1.2" }, @@ -2546,9 +2547,9 @@ } }, "node_modules/@vitest/spy": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.6.tgz", - "integrity": "sha512-oTFObV8bd4SDdRka5O+mSh5w9irgx5IetrD5i+OsUUsk/shsBoHifwCzy45SAORzAhtNiprUVaK3hSCCzZh1jQ==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.8.tgz", + "integrity": "sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==", "dev": true, "license": "MIT", "dependencies": { @@ -2559,13 +2560,13 @@ } }, "node_modules/@vitest/ui": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-2.1.6.tgz", - "integrity": "sha512-SrpLAM0/xpOjXBDv3mayFh5TDEYM59fmEmJXgp1AqtpUWHVw4Tonp6Z9dVBhChU/Q+BY57m74nrQZK8vxKDrMQ==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-2.1.8.tgz", + "integrity": "sha512-5zPJ1fs0ixSVSs5+5V2XJjXLmNzjugHRyV11RqxYVR+oMcogZ9qTuSfKW+OcTV0JeFNznI83BNylzH6SSNJ1+w==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "2.1.6", + "@vitest/utils": "2.1.8", "fflate": "^0.8.2", "flatted": "^3.3.1", "pathe": "^1.1.2", @@ -2577,17 +2578,17 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "2.1.6" + "vitest": "2.1.8" } }, "node_modules/@vitest/utils": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.6.tgz", - "integrity": "sha512-ixNkFy3k4vokOUTU2blIUvOgKq/N2PW8vKIjZZYsGJCMX69MRa9J2sKqX5hY/k5O5Gty3YJChepkqZ3KM9LyIQ==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.8.tgz", + "integrity": "sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.1.6", + "@vitest/pretty-format": "2.1.8", "loupe": "^3.1.2", "tinyrainbow": "^1.2.0" }, @@ -4390,7 +4391,8 @@ "version": "0.8.2", "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/figures": { "version": "6.1.0", @@ -6169,6 +6171,7 @@ "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" } @@ -6467,7 +6470,6 @@ }, "node_modules/npm/node_modules/@isaacs/cliui": { "version": "8.0.2", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6484,7 +6486,6 @@ }, "node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex": { "version": "6.0.1", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -6496,13 +6497,11 @@ }, "node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex": { "version": "9.2.2", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -6519,7 +6518,6 @@ }, "node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi": { "version": "7.1.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -6534,13 +6532,11 @@ }, "node_modules/npm/node_modules/@isaacs/string-locale-compare": { "version": "1.1.0", - "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/@npmcli/agent": { "version": "2.2.2", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6556,7 +6552,6 @@ }, "node_modules/npm/node_modules/@npmcli/arborist": { "version": "7.5.3", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6605,7 +6600,6 @@ }, "node_modules/npm/node_modules/@npmcli/config": { "version": "8.3.3", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6624,7 +6618,6 @@ }, "node_modules/npm/node_modules/@npmcli/fs": { "version": "3.1.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6636,7 +6629,6 @@ }, "node_modules/npm/node_modules/@npmcli/git": { "version": "5.0.7", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6655,7 +6647,6 @@ }, "node_modules/npm/node_modules/@npmcli/installed-package-contents": { "version": "2.1.0", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6671,7 +6662,6 @@ }, "node_modules/npm/node_modules/@npmcli/map-workspaces": { "version": "3.0.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6686,7 +6676,6 @@ }, "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { "version": "7.1.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6702,7 +6691,6 @@ }, "node_modules/npm/node_modules/@npmcli/name-from-folder": { "version": "2.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -6711,7 +6699,6 @@ }, "node_modules/npm/node_modules/@npmcli/node-gyp": { "version": "3.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -6720,7 +6707,6 @@ }, "node_modules/npm/node_modules/@npmcli/package-json": { "version": "5.1.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6738,7 +6724,6 @@ }, "node_modules/npm/node_modules/@npmcli/promise-spawn": { "version": "7.0.2", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6750,7 +6735,6 @@ }, "node_modules/npm/node_modules/@npmcli/query": { "version": "3.1.0", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6762,7 +6746,6 @@ }, "node_modules/npm/node_modules/@npmcli/redact": { "version": "2.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -6771,7 +6754,6 @@ }, "node_modules/npm/node_modules/@npmcli/run-script": { "version": "8.1.0", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6788,7 +6770,6 @@ }, "node_modules/npm/node_modules/@pkgjs/parseargs": { "version": "0.11.0", - "dev": true, "inBundle": true, "license": "MIT", "optional": true, @@ -6798,7 +6779,6 @@ }, "node_modules/npm/node_modules/@sigstore/bundle": { "version": "2.3.2", - "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -6810,7 +6790,6 @@ }, "node_modules/npm/node_modules/@sigstore/core": { "version": "1.1.0", - "dev": true, "inBundle": true, "license": "Apache-2.0", "engines": { @@ -6819,7 +6798,6 @@ }, "node_modules/npm/node_modules/@sigstore/protobuf-specs": { "version": "0.3.2", - "dev": true, "inBundle": true, "license": "Apache-2.0", "engines": { @@ -6828,7 +6806,6 @@ }, "node_modules/npm/node_modules/@sigstore/sign": { "version": "2.3.2", - "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -6845,7 +6822,6 @@ }, "node_modules/npm/node_modules/@sigstore/tuf": { "version": "2.3.4", - "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -6858,7 +6834,6 @@ }, "node_modules/npm/node_modules/@sigstore/verify": { "version": "1.2.1", - "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -6872,7 +6847,6 @@ }, "node_modules/npm/node_modules/@tufjs/canonical-json": { "version": "2.0.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -6881,7 +6855,6 @@ }, "node_modules/npm/node_modules/@tufjs/models": { "version": "2.0.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -6894,7 +6867,6 @@ }, "node_modules/npm/node_modules/abbrev": { "version": "2.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -6903,7 +6875,6 @@ }, "node_modules/npm/node_modules/agent-base": { "version": "7.1.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -6915,7 +6886,6 @@ }, "node_modules/npm/node_modules/aggregate-error": { "version": "3.1.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -6928,7 +6898,6 @@ }, "node_modules/npm/node_modules/ansi-regex": { "version": "5.0.1", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -6937,7 +6906,6 @@ }, "node_modules/npm/node_modules/ansi-styles": { "version": "6.2.1", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -6949,25 +6917,21 @@ }, "node_modules/npm/node_modules/aproba": { "version": "2.0.0", - "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/archy": { "version": "1.0.0", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/balanced-match": { "version": "1.0.2", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/bin-links": { "version": "4.0.4", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -6982,7 +6946,6 @@ }, "node_modules/npm/node_modules/binary-extensions": { "version": "2.3.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -6994,7 +6957,6 @@ }, "node_modules/npm/node_modules/brace-expansion": { "version": "2.0.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7003,7 +6965,6 @@ }, "node_modules/npm/node_modules/cacache": { "version": "18.0.3", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7026,7 +6987,6 @@ }, "node_modules/npm/node_modules/chalk": { "version": "5.3.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -7038,7 +6998,6 @@ }, "node_modules/npm/node_modules/chownr": { "version": "2.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -7047,7 +7006,6 @@ }, "node_modules/npm/node_modules/ci-info": { "version": "4.0.0", - "dev": true, "funding": [ { "type": "github", @@ -7062,7 +7020,6 @@ }, "node_modules/npm/node_modules/cidr-regex": { "version": "4.1.1", - "dev": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -7074,7 +7031,6 @@ }, "node_modules/npm/node_modules/clean-stack": { "version": "2.2.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -7083,7 +7039,6 @@ }, "node_modules/npm/node_modules/cli-columns": { "version": "4.0.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7096,7 +7051,6 @@ }, "node_modules/npm/node_modules/cmd-shim": { "version": "6.0.3", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -7105,7 +7059,6 @@ }, "node_modules/npm/node_modules/color-convert": { "version": "2.0.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7117,19 +7070,16 @@ }, "node_modules/npm/node_modules/color-name": { "version": "1.1.4", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/common-ancestor-path": { "version": "1.0.1", - "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/cross-spawn": { "version": "7.0.3", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7143,7 +7093,6 @@ }, "node_modules/npm/node_modules/cross-spawn/node_modules/which": { "version": "2.0.2", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7158,7 +7107,6 @@ }, "node_modules/npm/node_modules/cssesc": { "version": "3.0.0", - "dev": true, "inBundle": true, "license": "MIT", "bin": { @@ -7170,7 +7118,6 @@ }, "node_modules/npm/node_modules/debug": { "version": "4.3.4", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7187,13 +7134,11 @@ }, "node_modules/npm/node_modules/debug/node_modules/ms": { "version": "2.1.2", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/diff": { "version": "5.2.0", - "dev": true, "inBundle": true, "license": "BSD-3-Clause", "engines": { @@ -7202,19 +7147,16 @@ }, "node_modules/npm/node_modules/eastasianwidth": { "version": "0.2.0", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/emoji-regex": { "version": "8.0.0", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/encoding": { "version": "0.1.13", - "dev": true, "inBundle": true, "license": "MIT", "optional": true, @@ -7224,7 +7166,6 @@ }, "node_modules/npm/node_modules/env-paths": { "version": "2.2.1", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -7233,19 +7174,16 @@ }, "node_modules/npm/node_modules/err-code": { "version": "2.0.3", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/exponential-backoff": { "version": "3.1.1", - "dev": true, "inBundle": true, "license": "Apache-2.0" }, "node_modules/npm/node_modules/fastest-levenshtein": { "version": "1.0.16", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -7254,7 +7192,6 @@ }, "node_modules/npm/node_modules/foreground-child": { "version": "3.1.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7270,7 +7207,6 @@ }, "node_modules/npm/node_modules/fs-minipass": { "version": "3.0.3", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7282,7 +7218,6 @@ }, "node_modules/npm/node_modules/function-bind": { "version": "1.1.2", - "dev": true, "inBundle": true, "license": "MIT", "funding": { @@ -7291,7 +7226,6 @@ }, "node_modules/npm/node_modules/glob": { "version": "10.4.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7313,13 +7247,11 @@ }, "node_modules/npm/node_modules/graceful-fs": { "version": "4.2.11", - "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/hasown": { "version": "2.0.2", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7331,7 +7263,6 @@ }, "node_modules/npm/node_modules/hosted-git-info": { "version": "7.0.2", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7343,13 +7274,11 @@ }, "node_modules/npm/node_modules/http-cache-semantics": { "version": "4.1.1", - "dev": true, "inBundle": true, "license": "BSD-2-Clause" }, "node_modules/npm/node_modules/http-proxy-agent": { "version": "7.0.2", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7362,7 +7291,6 @@ }, "node_modules/npm/node_modules/https-proxy-agent": { "version": "7.0.4", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7375,7 +7303,6 @@ }, "node_modules/npm/node_modules/iconv-lite": { "version": "0.6.3", - "dev": true, "inBundle": true, "license": "MIT", "optional": true, @@ -7388,7 +7315,6 @@ }, "node_modules/npm/node_modules/ignore-walk": { "version": "6.0.5", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7400,7 +7326,6 @@ }, "node_modules/npm/node_modules/imurmurhash": { "version": "0.1.4", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -7409,7 +7334,6 @@ }, "node_modules/npm/node_modules/indent-string": { "version": "4.0.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -7418,7 +7342,6 @@ }, "node_modules/npm/node_modules/ini": { "version": "4.1.3", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -7427,7 +7350,6 @@ }, "node_modules/npm/node_modules/init-package-json": { "version": "6.0.3", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7445,7 +7367,6 @@ }, "node_modules/npm/node_modules/ip-address": { "version": "9.0.5", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7458,7 +7379,6 @@ }, "node_modules/npm/node_modules/ip-regex": { "version": "5.0.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -7470,7 +7390,6 @@ }, "node_modules/npm/node_modules/is-cidr": { "version": "5.1.0", - "dev": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -7482,7 +7401,6 @@ }, "node_modules/npm/node_modules/is-core-module": { "version": "2.13.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7494,7 +7412,6 @@ }, "node_modules/npm/node_modules/is-fullwidth-code-point": { "version": "3.0.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -7503,19 +7420,16 @@ }, "node_modules/npm/node_modules/is-lambda": { "version": "1.0.1", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/isexe": { "version": "2.0.0", - "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/jackspeak": { "version": "3.1.2", - "dev": true, "inBundle": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -7533,13 +7447,11 @@ }, "node_modules/npm/node_modules/jsbn": { "version": "1.1.0", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/json-parse-even-better-errors": { "version": "3.0.2", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -7548,7 +7460,6 @@ }, "node_modules/npm/node_modules/json-stringify-nice": { "version": "1.1.4", - "dev": true, "inBundle": true, "license": "ISC", "funding": { @@ -7557,7 +7468,6 @@ }, "node_modules/npm/node_modules/jsonparse": { "version": "1.3.1", - "dev": true, "engines": [ "node >= 0.2.0" ], @@ -7566,19 +7476,16 @@ }, "node_modules/npm/node_modules/just-diff": { "version": "6.0.2", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/just-diff-apply": { "version": "5.5.0", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/libnpmaccess": { "version": "8.0.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7591,7 +7498,6 @@ }, "node_modules/npm/node_modules/libnpmdiff": { "version": "6.1.3", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7610,7 +7516,6 @@ }, "node_modules/npm/node_modules/libnpmexec": { "version": "8.1.2", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7631,7 +7536,6 @@ }, "node_modules/npm/node_modules/libnpmfund": { "version": "5.0.11", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7643,7 +7547,6 @@ }, "node_modules/npm/node_modules/libnpmhook": { "version": "10.0.5", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7656,7 +7559,6 @@ }, "node_modules/npm/node_modules/libnpmorg": { "version": "6.0.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7669,7 +7571,6 @@ }, "node_modules/npm/node_modules/libnpmpack": { "version": "7.0.3", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7684,7 +7585,6 @@ }, "node_modules/npm/node_modules/libnpmpublish": { "version": "9.0.9", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7703,7 +7603,6 @@ }, "node_modules/npm/node_modules/libnpmsearch": { "version": "7.0.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7715,7 +7614,6 @@ }, "node_modules/npm/node_modules/libnpmteam": { "version": "6.0.5", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7728,7 +7626,6 @@ }, "node_modules/npm/node_modules/libnpmversion": { "version": "6.0.3", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7744,7 +7641,6 @@ }, "node_modules/npm/node_modules/lru-cache": { "version": "10.2.2", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -7753,7 +7649,6 @@ }, "node_modules/npm/node_modules/make-fetch-happen": { "version": "13.0.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7776,7 +7671,6 @@ }, "node_modules/npm/node_modules/minimatch": { "version": "9.0.4", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7791,7 +7685,6 @@ }, "node_modules/npm/node_modules/minipass": { "version": "7.1.2", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -7800,7 +7693,6 @@ }, "node_modules/npm/node_modules/minipass-collect": { "version": "2.0.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7812,7 +7704,6 @@ }, "node_modules/npm/node_modules/minipass-fetch": { "version": "3.0.5", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7829,7 +7720,6 @@ }, "node_modules/npm/node_modules/minipass-flush": { "version": "1.0.5", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7841,7 +7731,6 @@ }, "node_modules/npm/node_modules/minipass-flush/node_modules/minipass": { "version": "3.3.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7853,7 +7742,6 @@ }, "node_modules/npm/node_modules/minipass-json-stream": { "version": "1.0.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7863,7 +7751,6 @@ }, "node_modules/npm/node_modules/minipass-json-stream/node_modules/minipass": { "version": "3.3.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7875,7 +7762,6 @@ }, "node_modules/npm/node_modules/minipass-pipeline": { "version": "1.2.4", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7887,7 +7773,6 @@ }, "node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass": { "version": "3.3.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7899,7 +7784,6 @@ }, "node_modules/npm/node_modules/minipass-sized": { "version": "1.0.3", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7911,7 +7795,6 @@ }, "node_modules/npm/node_modules/minipass-sized/node_modules/minipass": { "version": "3.3.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7923,7 +7806,6 @@ }, "node_modules/npm/node_modules/minizlib": { "version": "2.1.2", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -7936,7 +7818,6 @@ }, "node_modules/npm/node_modules/minizlib/node_modules/minipass": { "version": "3.3.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -7948,7 +7829,6 @@ }, "node_modules/npm/node_modules/mkdirp": { "version": "1.0.4", - "dev": true, "inBundle": true, "license": "MIT", "bin": { @@ -7960,13 +7840,11 @@ }, "node_modules/npm/node_modules/ms": { "version": "2.1.3", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/mute-stream": { "version": "1.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -7975,7 +7853,6 @@ }, "node_modules/npm/node_modules/negotiator": { "version": "0.6.3", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -7984,7 +7861,6 @@ }, "node_modules/npm/node_modules/node-gyp": { "version": "10.1.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8008,7 +7884,6 @@ }, "node_modules/npm/node_modules/node-gyp/node_modules/proc-log": { "version": "3.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8017,7 +7892,6 @@ }, "node_modules/npm/node_modules/nopt": { "version": "7.2.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8032,7 +7906,6 @@ }, "node_modules/npm/node_modules/normalize-package-data": { "version": "6.0.1", - "dev": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -8047,7 +7920,6 @@ }, "node_modules/npm/node_modules/npm-audit-report": { "version": "5.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8056,7 +7928,6 @@ }, "node_modules/npm/node_modules/npm-bundled": { "version": "3.0.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8068,7 +7939,6 @@ }, "node_modules/npm/node_modules/npm-install-checks": { "version": "6.3.0", - "dev": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -8080,7 +7950,6 @@ }, "node_modules/npm/node_modules/npm-normalize-package-bin": { "version": "3.0.1", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8089,7 +7958,6 @@ }, "node_modules/npm/node_modules/npm-package-arg": { "version": "11.0.2", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8104,7 +7972,6 @@ }, "node_modules/npm/node_modules/npm-packlist": { "version": "8.0.2", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8116,7 +7983,6 @@ }, "node_modules/npm/node_modules/npm-pick-manifest": { "version": "9.0.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8131,7 +7997,6 @@ }, "node_modules/npm/node_modules/npm-profile": { "version": "10.0.0", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8144,7 +8009,6 @@ }, "node_modules/npm/node_modules/npm-registry-fetch": { "version": "17.0.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8163,7 +8027,6 @@ }, "node_modules/npm/node_modules/npm-user-validate": { "version": "2.0.1", - "dev": true, "inBundle": true, "license": "BSD-2-Clause", "engines": { @@ -8172,7 +8035,6 @@ }, "node_modules/npm/node_modules/p-map": { "version": "4.0.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8187,7 +8049,6 @@ }, "node_modules/npm/node_modules/pacote": { "version": "18.0.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8218,7 +8079,6 @@ }, "node_modules/npm/node_modules/parse-conflict-json": { "version": "3.0.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8232,7 +8092,6 @@ }, "node_modules/npm/node_modules/path-key": { "version": "3.1.1", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -8241,7 +8100,6 @@ }, "node_modules/npm/node_modules/path-scurry": { "version": "1.11.1", - "dev": true, "inBundle": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -8257,7 +8115,6 @@ }, "node_modules/npm/node_modules/postcss-selector-parser": { "version": "6.1.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8270,7 +8127,6 @@ }, "node_modules/npm/node_modules/proc-log": { "version": "4.2.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8279,7 +8135,6 @@ }, "node_modules/npm/node_modules/proggy": { "version": "2.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8288,7 +8143,6 @@ }, "node_modules/npm/node_modules/promise-all-reject-late": { "version": "1.0.1", - "dev": true, "inBundle": true, "license": "ISC", "funding": { @@ -8297,7 +8151,6 @@ }, "node_modules/npm/node_modules/promise-call-limit": { "version": "3.0.1", - "dev": true, "inBundle": true, "license": "ISC", "funding": { @@ -8306,13 +8159,11 @@ }, "node_modules/npm/node_modules/promise-inflight": { "version": "1.0.1", - "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/promise-retry": { "version": "2.0.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8325,7 +8176,6 @@ }, "node_modules/npm/node_modules/promzard": { "version": "1.0.2", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8337,7 +8187,6 @@ }, "node_modules/npm/node_modules/qrcode-terminal": { "version": "0.12.0", - "dev": true, "inBundle": true, "bin": { "qrcode-terminal": "bin/qrcode-terminal.js" @@ -8345,7 +8194,6 @@ }, "node_modules/npm/node_modules/read": { "version": "3.0.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8357,7 +8205,6 @@ }, "node_modules/npm/node_modules/read-cmd-shim": { "version": "4.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8366,7 +8213,6 @@ }, "node_modules/npm/node_modules/read-package-json-fast": { "version": "3.0.2", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8379,7 +8225,6 @@ }, "node_modules/npm/node_modules/retry": { "version": "0.12.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -8388,14 +8233,12 @@ }, "node_modules/npm/node_modules/safer-buffer": { "version": "2.1.2", - "dev": true, "inBundle": true, "license": "MIT", "optional": true }, "node_modules/npm/node_modules/semver": { "version": "7.6.2", - "dev": true, "inBundle": true, "license": "ISC", "bin": { @@ -8407,7 +8250,6 @@ }, "node_modules/npm/node_modules/shebang-command": { "version": "2.0.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8419,7 +8261,6 @@ }, "node_modules/npm/node_modules/shebang-regex": { "version": "3.0.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -8428,7 +8269,6 @@ }, "node_modules/npm/node_modules/signal-exit": { "version": "4.1.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8440,7 +8280,6 @@ }, "node_modules/npm/node_modules/sigstore": { "version": "2.3.1", - "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -8457,7 +8296,6 @@ }, "node_modules/npm/node_modules/smart-buffer": { "version": "4.2.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -8467,7 +8305,6 @@ }, "node_modules/npm/node_modules/socks": { "version": "2.8.3", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8481,7 +8318,6 @@ }, "node_modules/npm/node_modules/socks-proxy-agent": { "version": "8.0.3", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8495,7 +8331,6 @@ }, "node_modules/npm/node_modules/spdx-correct": { "version": "3.2.0", - "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -8505,7 +8340,6 @@ }, "node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse": { "version": "3.0.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8515,13 +8349,11 @@ }, "node_modules/npm/node_modules/spdx-exceptions": { "version": "2.5.0", - "dev": true, "inBundle": true, "license": "CC-BY-3.0" }, "node_modules/npm/node_modules/spdx-expression-parse": { "version": "4.0.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8531,19 +8363,16 @@ }, "node_modules/npm/node_modules/spdx-license-ids": { "version": "3.0.18", - "dev": true, "inBundle": true, "license": "CC0-1.0" }, "node_modules/npm/node_modules/sprintf-js": { "version": "1.1.3", - "dev": true, "inBundle": true, "license": "BSD-3-Clause" }, "node_modules/npm/node_modules/ssri": { "version": "10.0.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8555,7 +8384,6 @@ }, "node_modules/npm/node_modules/string-width": { "version": "4.2.3", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8570,7 +8398,6 @@ "node_modules/npm/node_modules/string-width-cjs": { "name": "string-width", "version": "4.2.3", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8584,7 +8411,6 @@ }, "node_modules/npm/node_modules/strip-ansi": { "version": "6.0.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8597,7 +8423,6 @@ "node_modules/npm/node_modules/strip-ansi-cjs": { "name": "strip-ansi", "version": "6.0.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8609,7 +8434,6 @@ }, "node_modules/npm/node_modules/supports-color": { "version": "9.4.0", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -8621,7 +8445,6 @@ }, "node_modules/npm/node_modules/tar": { "version": "6.2.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8638,7 +8461,6 @@ }, "node_modules/npm/node_modules/tar/node_modules/fs-minipass": { "version": "2.1.0", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8650,7 +8472,6 @@ }, "node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { "version": "3.3.6", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8662,7 +8483,6 @@ }, "node_modules/npm/node_modules/tar/node_modules/minipass": { "version": "5.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8671,19 +8491,16 @@ }, "node_modules/npm/node_modules/text-table": { "version": "0.2.0", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/tiny-relative-date": { "version": "1.3.0", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/treeverse": { "version": "3.0.0", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8692,7 +8509,6 @@ }, "node_modules/npm/node_modules/tuf-js": { "version": "2.2.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8706,7 +8522,6 @@ }, "node_modules/npm/node_modules/unique-filename": { "version": "3.0.0", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8718,7 +8533,6 @@ }, "node_modules/npm/node_modules/unique-slug": { "version": "4.0.0", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8730,13 +8544,11 @@ }, "node_modules/npm/node_modules/util-deprecate": { "version": "1.0.2", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/validate-npm-package-license": { "version": "3.0.4", - "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -8746,7 +8558,6 @@ }, "node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse": { "version": "3.0.1", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8756,7 +8567,6 @@ }, "node_modules/npm/node_modules/validate-npm-package-name": { "version": "5.0.1", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8765,13 +8575,11 @@ }, "node_modules/npm/node_modules/walk-up-path": { "version": "3.0.1", - "dev": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/which": { "version": "4.0.0", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8786,7 +8594,6 @@ }, "node_modules/npm/node_modules/which/node_modules/isexe": { "version": "3.1.1", - "dev": true, "inBundle": true, "license": "ISC", "engines": { @@ -8795,7 +8602,6 @@ }, "node_modules/npm/node_modules/wrap-ansi": { "version": "8.1.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8813,7 +8619,6 @@ "node_modules/npm/node_modules/wrap-ansi-cjs": { "name": "wrap-ansi", "version": "7.0.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8830,7 +8635,6 @@ }, "node_modules/npm/node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { "version": "4.3.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8845,7 +8649,6 @@ }, "node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex": { "version": "6.0.1", - "dev": true, "inBundle": true, "license": "MIT", "engines": { @@ -8857,13 +8660,11 @@ }, "node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex": { "version": "9.2.2", - "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/wrap-ansi/node_modules/string-width": { "version": "5.1.2", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8880,7 +8681,6 @@ }, "node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi": { "version": "7.1.0", - "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8895,7 +8695,6 @@ }, "node_modules/npm/node_modules/write-file-atomic": { "version": "5.0.1", - "dev": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -8908,7 +8707,6 @@ }, "node_modules/npm/node_modules/yallist": { "version": "4.0.0", - "dev": true, "inBundle": true, "license": "ISC" }, @@ -9243,7 +9041,8 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pathval": { "version": "2.0.0", @@ -9487,9 +9286,9 @@ } }, "node_modules/prettier": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.1.tgz", - "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", "dev": true, "license": "MIT", "bin": { @@ -10448,6 +10247,7 @@ "resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.0.tgz", "integrity": "sha512-BPwJGUeDaDCHihkORDchNyyTvWFhcusy1XMmhEVTQTwGeybFbp8YEmB+njbPnth1FibULBSBVwCQni25XlCUDg==", "dev": true, + "license": "MIT", "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", @@ -11170,6 +10970,7 @@ "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -12103,9 +11904,9 @@ } }, "node_modules/vite-node": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.6.tgz", - "integrity": "sha512-DBfJY0n9JUwnyLxPSSUmEePT21j8JZp/sR9n+/gBwQU6DcQOioPdb8/pibWfXForbirSagZCilseYIwaL3f95A==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.8.tgz", + "integrity": "sha512-uPAwSr57kYjAUux+8E2j0q0Fxpn8M9VoyfGiRI8Kfktz9NcYMCenwY5RnZxnF1WTu3TGiYipirIzacLL3VVGFg==", "dev": true, "license": "MIT", "dependencies": { @@ -12113,32 +11914,32 @@ "debug": "^4.3.7", "es-module-lexer": "^1.5.4", "pathe": "^1.1.2", - "vite": "^5.0.0 || ^6.0.0" + "vite": "^5.0.0" }, "bin": { "vite-node": "vite-node.mjs" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/vitest": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.6.tgz", - "integrity": "sha512-isUCkvPL30J4c5O5hgONeFRsDmlw6kzFEdLQHLezmDdKQHy8Ke/B/dgdTMEgU0vm+iZ0TjW8GuK83DiahBoKWQ==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.8.tgz", + "integrity": "sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/expect": "2.1.6", - "@vitest/mocker": "2.1.6", - "@vitest/pretty-format": "^2.1.6", - "@vitest/runner": "2.1.6", - "@vitest/snapshot": "2.1.6", - "@vitest/spy": "2.1.6", - "@vitest/utils": "2.1.6", + "@vitest/expect": "2.1.8", + "@vitest/mocker": "2.1.8", + "@vitest/pretty-format": "^2.1.8", + "@vitest/runner": "2.1.8", + "@vitest/snapshot": "2.1.8", + "@vitest/spy": "2.1.8", + "@vitest/utils": "2.1.8", "chai": "^5.1.2", "debug": "^4.3.7", "expect-type": "^1.1.0", @@ -12149,24 +11950,24 @@ "tinyexec": "^0.3.1", "tinypool": "^1.0.1", "tinyrainbow": "^1.2.0", - "vite": "^5.0.0 || ^6.0.0", - "vite-node": "2.1.6", + "vite": "^5.0.0", + "vite-node": "2.1.8", "why-is-node-running": "^2.3.0" }, "bin": { "vitest": "vitest.mjs" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "@edge-runtime/vm": "*", - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "@vitest/browser": "2.1.6", - "@vitest/ui": "2.1.6", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "2.1.8", + "@vitest/ui": "2.1.8", "happy-dom": "*", "jsdom": "*" }, diff --git a/package.json b/package.json index c327cbe..118236b 100644 --- a/package.json +++ b/package.json @@ -66,21 +66,21 @@ "@semantic-release/npm": "^12.0.1", "@semantic-release/release-notes-generator": "^14.0.1", "@types/eslint__js": "^8.42.3", - "@types/node": "^22.9.3", - "@vitest/coverage-v8": "^2.1.5", - "@vitest/ui": "^2.1.5", + "@types/node": "^22.10.2", + "@vitest/coverage-v8": "^2.1.8", + "@vitest/ui": "^2.1.8", "eslint": "^9.15.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-unicorn": "^56.0.1", "globals": "^15.12.0", "husky": "^9.1.7", - "prettier": "3.4.1", + "prettier": "3.4.2", "semantic-release": "^24.2.0", "ts-pegjs": "^4.2.1", "tsup": "^8.3.5", "typescript": "^5.6.3", "typescript-eslint": "^8.15.0", - "vitest": "^2.1.5" + "vitest": "^2.1.8" } } diff --git a/src/filter/index.ts b/src/filter/index.ts index 430d7c5..5678eb8 100644 --- a/src/filter/index.ts +++ b/src/filter/index.ts @@ -1,17 +1,24 @@ import { ASTEvaluator } from '../handlers/evaluate'; import QueryParser from '../xlucene'; import ReferenceResolver from '../handlers/resolver'; +import { IteratorConfig } from '../types/iterator'; /** * Filters an array of data based on the lucene query. * @param queryInstance The QueryParser instance containing the lucene query. * @param data The array of data to filter. * @param resolver Optional reference resolver to resolve variables and functions in the query. + * @param iteratorConfig Optional iterator config to control the behavior of the object iterator * @returns The filtered array of data. */ -export default function filter(queryInstance: QueryParser, data: T[], resolver?: ReferenceResolver): T[] { +export default function filter( + queryInstance: QueryParser, + data: T[], + resolver?: ReferenceResolver, + iteratorConfig?: IteratorConfig, +): T[] { const ast = queryInstance.toAST(); - const evaluator = new ASTEvaluator(ast, resolver); + const evaluator = new ASTEvaluator(ast, resolver, iteratorConfig); return evaluator.evaluate(data); } diff --git a/src/handlers/evaluate.ts b/src/handlers/evaluate.ts index afb5d96..1969dd2 100644 --- a/src/handlers/evaluate.ts +++ b/src/handlers/evaluate.ts @@ -30,10 +30,11 @@ import { isVariableNode, isWildcard, } from '../types/guards'; -import iterate from '../utils/iterate'; +import iterate, { defaultIteratorConfig } from '../utils/iterate'; import QueryParser from '../xlucene'; import ReferenceResolver from './resolver'; import { testRangeNode, testRegexp, testString, testWildcard } from '../filter/test-value'; +import { IteratorConfig } from '../types/iterator'; /** * Class for evaluating an abstract syntax tree (AST). @@ -44,10 +45,12 @@ export class ASTEvaluator { * Creates an instance of ASTEvaluator. * @param ast The abstract syntax tree (AST) to evaluate. * @param resolver Optional reference resolver to resolve variables and functions. + * @param iteratorConfig Optional iterator config to control the behavior of the object iterator */ constructor( private readonly ast: Node, private readonly resolver?: ReferenceResolver, + private readonly iteratorConfig: IteratorConfig = defaultIteratorConfig, ) {} /** @@ -255,7 +258,7 @@ export class ASTEvaluator { return false; }; - for (const [, value] of iterate(item as never, node.field || '')) { + for (const [, value] of iterate(item as never, node.field || '', this.iteratorConfig)) { if (testValue(value as FlatType)) { return true; } diff --git a/src/tests/filter/filter.test.ts b/src/tests/filter/filter.test.ts index 9f5e7ab..8c9868d 100644 --- a/src/tests/filter/filter.test.ts +++ b/src/tests/filter/filter.test.ts @@ -89,4 +89,37 @@ describe(`filter`, () => { } }); } + + describe(`filter private fields`, () => { + const data = [ + { _id: 12, firstName: 'Bettye', lastName: 'Oakland', age: 13, email: 'boaklandb@mail.me' }, + { _id: 13, firstName: 'Emanuele', lastName: 'Doree', age: 14, email: 'edoreec@mail.org' }, + { + _id: 14, + firstName: 'Rosalind', + lastName: 'Bousler', + age: 15, + email: 'rbouslerd@mail.com', + }, + ]; + const iteratorConfig = { + maxDepth: 3, + featureEnablePrivateField: true, + }; + + it('should ignore private fields for non field queries', () => { + const result = filter(new QueryParser('13'), data, undefined, iteratorConfig); + expect(result).toEqual(data.filter((d) => d.age == 13)); + }); + + it('should ignore private fields for wildcards', () => { + const result = filter(new QueryParser('*:13'), data, undefined, iteratorConfig); + expect(result).toEqual(data.filter((d) => d.age == 13)); + }); + + it('should filter for private fields if specified', () => { + const result = filter(new QueryParser('id:13'), data, undefined, iteratorConfig); + expect(result).toEqual(data.filter((d) => d._id == 13)); + }); + }); }); diff --git a/src/tests/utils/iterate.test.ts b/src/tests/utils/iterate.test.ts index 05ee3bf..c7a7fac 100644 --- a/src/tests/utils/iterate.test.ts +++ b/src/tests/utils/iterate.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import iterate from '../../utils/iterate'; +import iterate, { defaultIteratorConfig } from '../../utils/iterate'; describe('iterate', () => { const testObj = { @@ -313,7 +313,7 @@ describe('iterate', () => { c: 'value1', }, }; - const result = [...iterate(deepObj, 'a.*', 3)]; + const result = [...iterate(deepObj, 'a.*', { ...defaultIteratorConfig, maxDepth: 3 })]; expect(result).toMatchInlineSnapshot(` [ [ @@ -357,7 +357,7 @@ describe('iterate', () => { } }; - const result = [...iterate(new Cls(), '', 3)]; + const result = [...iterate(new Cls(), '', { ...defaultIteratorConfig, maxDepth: 3 })]; expect(result).toMatchInlineSnapshot(` [ [ @@ -371,4 +371,139 @@ describe('iterate', () => { ] `); }); + + describe('iterate private fields feature', () => { + const objWithPrivateFields = { + private: { + _id: 123, + name: 'Max', + }, + someArr: [ + { + _id: 456, + name: 'Alex', + }, + ], + _privateArr: [ + { + _id: 789, + name: 'John', + }, + ], + }; + + it('should not iterate over private fields by default', () => { + const obj = { + _id: 123, + name: 'Max', + person: { + _id: 456, + nested: { + foo: 'bar', + }, + }, + }; + + const result = [...iterate(obj, '', { ...defaultIteratorConfig, featureEnablePrivateField: true })]; + const resultDisabledFeature = [...iterate(obj, '')]; + expect(result).toMatchInlineSnapshot(` + [ + [ + "name", + "Max", + ], + [ + "person.nested.foo", + "bar", + ], + ] + `); + expect(result).not.toBe(resultDisabledFeature); + }); + + it('should iterate over private field if specified', () => { + const obj = { + _id: 123, + _idSimilar: 456, + name: 'Max', + }; + + const result = [...iterate(obj, 'id', { ...defaultIteratorConfig, featureEnablePrivateField: true })]; + const resultDisabledFeature = [...iterate(obj, 'id')]; + expect(result).toMatchInlineSnapshot(` + [ + [ + "_id", + 123, + ], + ] + `); + expect(result).not.toBe(resultDisabledFeature); + }); + + it('should not iterate over private fields by default with wildcard', () => { + const result = [ + ...iterate(objWithPrivateFields, '*', { ...defaultIteratorConfig, featureEnablePrivateField: true }), + ]; + const resultDisabledFeature = [...iterate(objWithPrivateFields, '*')]; + expect(result).toMatchInlineSnapshot(` + [ + [ + "private.name", + "Max", + ], + [ + "someArr.0.name", + "Alex", + ], + ] + `); + expect(result).not.toBe(resultDisabledFeature); + }); + + it('should iterate over private fields with wildcard if specified', () => { + const result = [ + ...iterate(objWithPrivateFields, '*.id', { ...defaultIteratorConfig, featureEnablePrivateField: true }), + ]; + const resultDisabledFeature = [...iterate(objWithPrivateFields, '*.id')]; + expect(result).toMatchInlineSnapshot(` + [ + [ + "private._id", + 123, + ], + [ + "someArr.0._id", + 456, + ], + ] + `); + expect(result).not.toBe(resultDisabledFeature); + }); + + // This won't be supported + it.skip('should handle top-level wildcard for private fields', () => { + /* v8 ignore start */ + const obj = { + private: { + _id: 123, + _insider: true, + }, + }; + const result = [...iterate(obj, 'private.i*')]; + expect(result).toMatchInlineSnapshot(` + [ + [ + "private._id", + 123, + ], + [ + "private._insider", + true, + ], + ] + `); + /* v8 ignore stop */ + }); + }); }); diff --git a/src/types/iterator.ts b/src/types/iterator.ts new file mode 100644 index 0000000..c3086aa --- /dev/null +++ b/src/types/iterator.ts @@ -0,0 +1,10 @@ +export interface IteratorConfig { + /** + * Defaults to Infinity + */ + maxDepth: number; + /** + * Feature flag to control whether private fields should no be iterated for wildcard queries, if not explicitly specified + */ + featureEnablePrivateField: boolean; +} diff --git a/src/utils/iterate.ts b/src/utils/iterate.ts index fd79bb4..d42b468 100644 --- a/src/utils/iterate.ts +++ b/src/utils/iterate.ts @@ -2,6 +2,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ import { testWildcard } from '../filter/test-value'; import { isWildCardString } from '../types/guards'; +import { IteratorConfig } from '../types/iterator'; type AnyObject = { [key: string]: any }; type IterationResult = [string, any]; @@ -18,10 +19,9 @@ const NOT_ITERABLE = [Date]; export default function* iterate( obj: AnyObject | any[], field: string = '', - maxDepth: number = Infinity, + config: IteratorConfig = defaultIteratorConfig, ): Generator { const splittedFields = field.split('.'); // Split the field pattern into individual components - /** * Recursively iterates over the object or array and yields iteration results. * @param obj The object or array to iterate over. @@ -29,7 +29,9 @@ export default function* iterate( * @param depth The current depth of recursion. */ function* _iterate(obj: AnyObject | any[], currentPath: string[], depth: number): Generator { - if (depth > maxDepth) return; // Stop recursion if maximum depth is exceeded + const checkPrivate = config.featureEnablePrivateField; + + if (depth > config.maxDepth) return; // Stop recursion if maximum depth is exceeded const currentField = splittedFields[currentPath.length]; // Get the current field to match const lastField = splittedFields.length > 0 ? splittedFields.at(-1) : ''; // Get the last field in the pattern @@ -39,13 +41,12 @@ export default function* iterate( // Check if the object is iterable and not in the NOT_ITERABLE list if (typeof obj === 'object' && obj !== null && !NOT_ITERABLE.some((cls) => obj instanceof cls)) { // Check if the object is an array with elements having the current field as a key - const arrayWithInnerKey = - Array.isArray(obj) && obj.some((o) => Object.prototype.hasOwnProperty.call(o, currentField)); - + const arrayWithInnerKey = Array.isArray(obj) && obj.some((o) => objectHasField(o, currentField, checkPrivate)); + const objWithCurrentField = objectHasField(obj, currentField, checkPrivate); // If the object has the current field and it's not an array with inner key - if (!isWildcard && Object.prototype.hasOwnProperty.call(obj, currentField) && !arrayWithInnerKey) { - const newPath = [...currentPath, currentField]; // Create new path - yield* _iterate(obj[currentField], newPath, depth + 1); // Recurse into the next level + if (!isWildcard && objWithCurrentField && !arrayWithInnerKey) { + const newPath = [...currentPath, objWithCurrentField]; // Create new path + yield* _iterate(obj[objWithCurrentField], newPath, depth + 1); // Recurse into the next level } else { if (arrayWithInnerKey) { splittedFields.splice(currentPath.length, 0, '*'); // Add wildcard for array elements @@ -53,20 +54,27 @@ export default function* iterate( // Iterate over the properties of the object for (const key in obj) { + // If the key starts with _, it shouldn't work for wildcard, if not explicity specified + if (checkPrivate && isPrivateField(key) && privateFieldName(key) != currentField) continue; if (Object.prototype.hasOwnProperty.call(obj, key)) { + let objKeyWithCurrentField = ''; // Match properties based on the field or wildcard pattern - if (!field || (currentField && testWildcard(key, currentField)) || isTrailingWildcard) { + if ( + !field || + (currentField && testWildcard(checkPrivate ? privateFieldName(key) : key, currentField)) || + isTrailingWildcard + ) { const newPath = [...currentPath, key]; yield* _iterate(obj[key], newPath, depth + 1); } else if ( arrayWithInnerKey && typeof obj[key] === 'object' && obj[key] !== null && - Object.prototype.hasOwnProperty.call(obj[key], currentField) + (objKeyWithCurrentField = objectHasField(obj[key], currentField, checkPrivate)) ) { - const newPath = [...currentPath, key, currentField]; + const newPath = [...currentPath, key, objKeyWithCurrentField]; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - yield* _iterate(obj[key][currentField], newPath, depth + 1); // Recurse into the inner key + yield* _iterate(obj[key][objKeyWithCurrentField], newPath, depth + 1); // Recurse into the inner key } } } @@ -80,3 +88,37 @@ export default function* iterate( // Start the iteration from the top-level object or array yield* _iterate(obj, [], 1); } + +export const defaultIteratorConfig = { maxDepth: Infinity, featureEnablePrivateField: false }; + +/** + * Checks if a field is private based on its naming convention (starts with an underscore). + * @param key - The field name to check. + * @returns True if the field name starts with an underscore, false otherwise. + */ +function isPrivateField(key: string): boolean { + return key.startsWith('_'); +} + +/** + * Removes the leading underscore from a private field name. + * @param key - The private field name. + * @returns The field name without the leading underscore. + */ +function privateFieldName(key: string): string { + return key.startsWith('_') ? key.slice(1) : key; +} + +/** + * Checks if an object or array contains a key (including private versions). + * @param obj - The object or array to check. + * @param key - The key to search for. + * @param featureEnablePrivateField - whether it should also check the private field + * @returns The matching key, or an empty string if not found. + */ +function objectHasField(obj: AnyObject | any[], key: string, featureEnablePrivateField: boolean): string { + const privateKey = `_${key}`; + if (Object.prototype.hasOwnProperty.call(obj, key)) return key; + if (featureEnablePrivateField && Object.prototype.hasOwnProperty.call(obj, privateKey)) return privateKey; + return ''; +} diff --git a/src/xlucene/helpers/index.ts b/src/xlucene/helpers/index.ts index a0ffe0d..ad54982 100644 --- a/src/xlucene/helpers/index.ts +++ b/src/xlucene/helpers/index.ts @@ -26,6 +26,9 @@ import * as i from '../../types/ast'; import * as utils from '../../types/guards'; +/* v8 ignore start */ +// Ignore coverage for grammar specific validation + function validateScopedChars(chars: string[]) { for (const [idx, char] of chars.entries()) { if (char === '.' && chars[idx + 1] === '.') { @@ -68,5 +71,6 @@ function propagateDefaultField(node: i.Node, field: string): void { } } } +/* v8 ignore stop */ export { propagateDefaultField, validateScopedChars };