@react-querybuilder/core 8.14.4 → 8.16.0
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/README.md +114 -53
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +288 -22
- package/dist/cjs/react-querybuilder_core.cjs.development.js +796 -77
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +288 -22
- package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
- package/dist/{convertQuery-CeJSNn37.mjs → convertQuery-BeJJH9BI.mjs} +2 -2
- package/dist/convertQuery-BeJJH9BI.mjs.map +1 -0
- package/dist/{convertQuery-J8LpTG-7.js → convertQuery-Lx2HQa0m.js} +2 -2
- package/dist/convertQuery-Lx2HQa0m.js.map +1 -0
- package/dist/formatQuery.d.mts +89 -2
- package/dist/formatQuery.d.ts +89 -2
- package/dist/formatQuery.js +775 -66
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +768 -67
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-BwQqExpO.d.mts → import-BHlzBLM_.d.mts} +2 -2
- package/dist/{import-CrJf23Nf.d.ts → import-C6imciDf.d.ts} +2 -2
- package/dist/{index-CYT4Saz-.d.mts → index-Cjapnb-H.d.ts} +161 -10
- package/dist/{index-DBlQeLax.d.ts → index-D-Iej37L.d.mts} +161 -10
- package/dist/{objectUtils-ButT0Mng.js → objectUtils-Bzug_QfX.js} +2 -2
- package/dist/objectUtils-Bzug_QfX.js.map +1 -0
- package/dist/{objectUtils-C0WB-8ex.mjs → objectUtils-D96eEEzL.mjs} +2 -2
- package/dist/objectUtils-D96eEEzL.mjs.map +1 -0
- package/dist/parseCEL.d.mts +2 -2
- package/dist/parseCEL.d.ts +2 -2
- package/dist/parseCEL.js +35 -35
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +35 -35
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseCypher.d.mts +49 -0
- package/dist/parseCypher.d.ts +49 -0
- package/dist/parseCypher.js +578 -0
- package/dist/parseCypher.js.map +1 -0
- package/dist/parseCypher.mjs +575 -0
- package/dist/parseCypher.mjs.map +1 -0
- package/dist/parseGremlin.d.mts +35 -0
- package/dist/parseGremlin.d.ts +35 -0
- package/dist/parseGremlin.js +192 -0
- package/dist/parseGremlin.js.map +1 -0
- package/dist/parseGremlin.mjs +191 -0
- package/dist/parseGremlin.mjs.map +1 -0
- package/dist/parseJSONata.d.mts +2 -2
- package/dist/parseJSONata.d.ts +2 -2
- package/dist/parseJSONata.js +11 -11
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +11 -11
- package/dist/parseJSONata.mjs.map +1 -1
- package/dist/parseJsonLogic.d.mts +2 -2
- package/dist/parseJsonLogic.d.ts +2 -2
- package/dist/parseJsonLogic.js +6 -6
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +6 -6
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +2 -2
- package/dist/parseMongoDB.d.ts +2 -2
- package/dist/parseMongoDB.js +6 -6
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +6 -6
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/parseSPARQL.d.mts +34 -0
- package/dist/parseSPARQL.d.ts +34 -0
- package/dist/parseSPARQL.js +253 -0
- package/dist/parseSPARQL.js.map +1 -0
- package/dist/parseSPARQL.mjs +251 -0
- package/dist/parseSPARQL.mjs.map +1 -0
- package/dist/parseSQL.d.mts +2 -2
- package/dist/parseSQL.d.ts +2 -2
- package/dist/parseSQL.js +16 -16
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +16 -16
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +2 -2
- package/dist/parseSpEL.d.ts +2 -2
- package/dist/parseSpEL.js +10 -10
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +10 -10
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-DO3qXriW.js → prepareQueryObjects-BoG5Rt8z.js} +6 -6
- package/dist/prepareQueryObjects-BoG5Rt8z.js.map +1 -0
- package/dist/{prepareQueryObjects-BfMlS4ql.mjs → prepareQueryObjects-uA10ZpZX.mjs} +6 -6
- package/dist/prepareQueryObjects-uA10ZpZX.mjs.map +1 -0
- package/dist/query-builder.css +1 -1
- package/dist/query-builder.css.map +1 -1
- package/dist/react-querybuilder_core.d.mts +288 -22
- package/dist/react-querybuilder_core.legacy-esm.d.ts +288 -22
- package/dist/react-querybuilder_core.legacy-esm.js +833 -108
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +788 -78
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +288 -22
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/styles/_main.scss +4 -0
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.d.ts +1 -1
- package/dist/transformQuery.js +1 -1
- package/dist/transformQuery.mjs +1 -1
- package/dist/{utils-BlMGIhvx.mjs → utils-ChLG90DP.mjs} +3 -3
- package/dist/utils-ChLG90DP.mjs.map +1 -0
- package/dist/{utils-CZRhzje-.js → utils-Qwkq2Q0F.js} +3 -3
- package/dist/utils-Qwkq2Q0F.js.map +1 -0
- package/formatQuery/package.json +1 -1
- package/package.json +53 -14
- package/parseCEL/package.json +1 -1
- package/parseCypher/package.json +4 -0
- package/parseGremlin/package.json +4 -0
- package/parseJSONata/package.json +1 -1
- package/parseJsonLogic/package.json +1 -1
- package/parseMongoDB/package.json +1 -1
- package/parseSPARQL/package.json +4 -0
- package/parseSQL/package.json +1 -1
- package/parseSpEL/package.json +1 -1
- package/transformQuery/package.json +1 -1
- package/dist/convertQuery-CeJSNn37.mjs.map +0 -1
- package/dist/convertQuery-J8LpTG-7.js.map +0 -1
- package/dist/objectUtils-ButT0Mng.js.map +0 -1
- package/dist/objectUtils-C0WB-8ex.mjs.map +0 -1
- package/dist/prepareQueryObjects-BfMlS4ql.mjs.map +0 -1
- package/dist/prepareQueryObjects-DO3qXriW.js.map +0 -1
- package/dist/utils-BlMGIhvx.mjs.map +0 -1
- package/dist/utils-CZRhzje-.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as ValueSources, k as OptionList, y as FullField } from "./index-D-Iej37L.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/types/import.d.ts
|
|
4
4
|
/**
|
|
@@ -24,4 +24,4 @@ interface ParserCommonOptions {
|
|
|
24
24
|
}
|
|
25
25
|
//#endregion
|
|
26
26
|
export { ParserCommonOptions as t };
|
|
27
|
-
//# sourceMappingURL=import-
|
|
27
|
+
//# sourceMappingURL=import-BHlzBLM_.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as ValueSources, k as OptionList, y as FullField } from "./index-Cjapnb-H.js";
|
|
2
2
|
|
|
3
3
|
//#region src/types/import.d.ts
|
|
4
4
|
/**
|
|
@@ -24,4 +24,4 @@ interface ParserCommonOptions {
|
|
|
24
24
|
}
|
|
25
25
|
//#endregion
|
|
26
26
|
export { ParserCommonOptions as t };
|
|
27
|
-
//# sourceMappingURL=import-
|
|
27
|
+
//# sourceMappingURL=import-C6imciDf.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { RulesLogic } from "json-logic-js";
|
|
|
2
2
|
|
|
3
3
|
//#region ../../node_modules/type-fest/source/union-to-intersection.d.ts
|
|
4
4
|
/**
|
|
5
|
-
Convert a union type to an intersection type
|
|
5
|
+
Convert a union type to an intersection type.
|
|
6
6
|
|
|
7
7
|
Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
|
|
8
8
|
|
|
@@ -899,7 +899,7 @@ type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Requ
|
|
|
899
899
|
//#endregion
|
|
900
900
|
//#region ../../node_modules/type-fest/source/set-required.d.ts
|
|
901
901
|
/**
|
|
902
|
-
Create a type that makes the given keys required
|
|
902
|
+
Create a type that makes the given keys required, while keeping the remaining keys as is.
|
|
903
903
|
|
|
904
904
|
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.
|
|
905
905
|
|
|
@@ -925,8 +925,8 @@ type ArrayExample = SetRequired<[number?, number?, number?], 0 | 1>;
|
|
|
925
925
|
*/
|
|
926
926
|
type SetRequired<BaseType, Keys extends keyof BaseType> = (BaseType extends ((...arguments_: never) => any) ? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType> : unknown) & _SetRequired<BaseType, Keys>;
|
|
927
927
|
type _SetRequired<BaseType, Keys extends keyof BaseType> = BaseType extends UnknownArray ? SetArrayRequired<BaseType, Keys> extends infer ResultantArray ? If<IsArrayReadonly<BaseType>, Readonly<ResultantArray>, ResultantArray> : never : Simplify< // Pick just the keys that are optional from the base type.
|
|
928
|
-
Except<BaseType, Keys>
|
|
929
|
-
Required<HomomorphicPick<BaseType, Keys>>>;
|
|
928
|
+
Except<BaseType, Keys> // Pick the keys that should be required from the base type and make them required.
|
|
929
|
+
& Required<HomomorphicPick<BaseType, Keys>>>;
|
|
930
930
|
/**
|
|
931
931
|
Remove the optional modifier from the specified keys in an array.
|
|
932
932
|
*/
|
|
@@ -1072,7 +1072,7 @@ interface CommonRuleAndGroupProperties {
|
|
|
1072
1072
|
* The main rule type. The `field`, `operator`, and `value` properties
|
|
1073
1073
|
* can be narrowed with generics.
|
|
1074
1074
|
*/
|
|
1075
|
-
interface RuleType<F extends string = string, O extends string = string, V = any, C extends string = string
|
|
1075
|
+
interface RuleType<F extends string = string, O extends string = string, V = any, C extends string = string, M = Record<string, any>> extends CommonRuleAndGroupProperties {
|
|
1076
1076
|
field: F;
|
|
1077
1077
|
operator: O;
|
|
1078
1078
|
value: V;
|
|
@@ -1082,6 +1082,13 @@ interface RuleType<F extends string = string, O extends string = string, V = any
|
|
|
1082
1082
|
* Only used when adding a rule to a query that uses independent combinators.
|
|
1083
1083
|
*/
|
|
1084
1084
|
combinatorPreceding?: C;
|
|
1085
|
+
/**
|
|
1086
|
+
* Opaque metadata for use by extension packages. The core library
|
|
1087
|
+
* preserves this property but does not read or interpret it.
|
|
1088
|
+
* Extensions like `@react-querybuilder/graph` use `meta` to store
|
|
1089
|
+
* domain-specific context (e.g., graph pattern information).
|
|
1090
|
+
*/
|
|
1091
|
+
meta?: M;
|
|
1085
1092
|
}
|
|
1086
1093
|
/**
|
|
1087
1094
|
* The main rule group type. This type is used for query definitions as well as
|
|
@@ -1216,7 +1223,7 @@ type ValueEditorType = "text" | "select" | "checkbox" | "radio" | "textarea" | "
|
|
|
1216
1223
|
*/
|
|
1217
1224
|
type ValueSources = ["value"] | ["value", "field"] | ["field", "value"] | ["field"];
|
|
1218
1225
|
type ValueSourceFlexibleOptions = ToFlexibleOptionArrays<ValueSources>;
|
|
1219
|
-
type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption
|
|
1226
|
+
type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption } : never;
|
|
1220
1227
|
type WithOptionalClassName<T> = T & {
|
|
1221
1228
|
className?: Classname;
|
|
1222
1229
|
};
|
|
@@ -1304,13 +1311,13 @@ type ParseNumbersPropConfig = boolean | `${ParseNumberMethodName}${ParseNumbersM
|
|
|
1304
1311
|
*
|
|
1305
1312
|
* @group Export
|
|
1306
1313
|
*/
|
|
1307
|
-
type ExportFormat = "json" | "sql" | "json_without_ids" | "parameterized" | "parameterized_named" | "mongodb" | "mongodb_query" | "cel" | "jsonlogic" | "spel" | "elasticsearch" | "jsonata" | "natural_language" | "ldap" | "drizzle" | "prisma" | "sequelize";
|
|
1314
|
+
type ExportFormat = "json" | "sql" | "json_without_ids" | "parameterized" | "parameterized_named" | "mongodb" | "mongodb_query" | "cel" | "jsonlogic" | "spel" | "elasticsearch" | "jsonata" | "natural_language" | "ldap" | "drizzle" | "prisma" | "sequelize" | "cypher" | "gql" | "sparql" | "gremlin" | "diagnostics";
|
|
1308
1315
|
/**
|
|
1309
1316
|
* Export formats for {@link formatQuery} that produce objects instead of strings.
|
|
1310
1317
|
*
|
|
1311
1318
|
* @group Export
|
|
1312
1319
|
*/
|
|
1313
|
-
type ExportObjectFormats = "parameterized" | "parameterized_named" | "jsonlogic" | "elasticsearch" | "jsonata" | "mongodb_query";
|
|
1320
|
+
type ExportObjectFormats = "parameterized" | "parameterized_named" | "jsonlogic" | "elasticsearch" | "jsonata" | "mongodb_query" | "diagnostics";
|
|
1314
1321
|
/**
|
|
1315
1322
|
* Available presets for the "sql" export format.
|
|
1316
1323
|
*
|
|
@@ -1685,6 +1692,150 @@ interface ParameterizedNamedSQL {
|
|
|
1685
1692
|
params: Record<string, any>;
|
|
1686
1693
|
}
|
|
1687
1694
|
/**
|
|
1695
|
+
* A {@link RuleType} annotated with diagnostics results, as produced
|
|
1696
|
+
* by {@link formatQuery} for the `"diagnostics"` format.
|
|
1697
|
+
*
|
|
1698
|
+
* The generics mirror those of {@link RuleType}.
|
|
1699
|
+
*
|
|
1700
|
+
* @group Export
|
|
1701
|
+
*/
|
|
1702
|
+
type RuleDiagnosticsResult<F extends string = string, O extends string = string, V = any, C extends string = string> = RuleType<F, O, V, C> & {
|
|
1703
|
+
/** Whether the rule passed all validation checks. */valid: boolean;
|
|
1704
|
+
/**
|
|
1705
|
+
* Reasons why the rule is invalid. Only present when
|
|
1706
|
+
* the rule is invalid and specific reasons were provided
|
|
1707
|
+
* by the validator.
|
|
1708
|
+
*/
|
|
1709
|
+
reasons?: any[]; /** The path to this rule within the query tree. */
|
|
1710
|
+
path: number[]; /** The nesting depth of this rule (`path.length`). */
|
|
1711
|
+
level: number;
|
|
1712
|
+
};
|
|
1713
|
+
/**
|
|
1714
|
+
* The type of the `rules` array in a {@link RuleGroupDiagnosticsResult}.
|
|
1715
|
+
*
|
|
1716
|
+
* @group Export
|
|
1717
|
+
*/
|
|
1718
|
+
type RuleGroupDiagnosticsArray<RG extends RuleGroupDiagnosticsResult = RuleGroupDiagnosticsResult, R extends RuleDiagnosticsResult = RuleDiagnosticsResult> = RuleGroupArray<RG, R>;
|
|
1719
|
+
/**
|
|
1720
|
+
* A {@link RuleGroupType} annotated with diagnostics results, as produced
|
|
1721
|
+
* by {@link formatQuery} for the `"diagnostics"` format.
|
|
1722
|
+
*
|
|
1723
|
+
* The generics mirror those of {@link RuleGroupType}.
|
|
1724
|
+
*
|
|
1725
|
+
* @group Export
|
|
1726
|
+
*/
|
|
1727
|
+
interface RuleGroupDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> extends Omit<RuleGroupType<R, C>, "rules"> {
|
|
1728
|
+
/** Whether the group and all of its descendants are valid. */
|
|
1729
|
+
valid: boolean;
|
|
1730
|
+
/**
|
|
1731
|
+
* Reasons why the group itself is invalid. Only present when
|
|
1732
|
+
* the group is invalid and specific reasons were provided
|
|
1733
|
+
* by the validator.
|
|
1734
|
+
*/
|
|
1735
|
+
reasons?: any[];
|
|
1736
|
+
/** The path to this group within the query tree. */
|
|
1737
|
+
path: number[];
|
|
1738
|
+
/** The nesting depth of this group (`path.length`). */
|
|
1739
|
+
level: number;
|
|
1740
|
+
rules: RuleGroupDiagnosticsArray<RuleGroupDiagnosticsResult<R, C>, R>;
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* The type of the `rules` array in a {@link RuleGroupICDiagnosticsResult}.
|
|
1744
|
+
*
|
|
1745
|
+
* Mirrors {@link RuleGroupICArray} but with diagnostics-annotated node types.
|
|
1746
|
+
*
|
|
1747
|
+
* @group Export
|
|
1748
|
+
*/
|
|
1749
|
+
type RuleGroupICDiagnosticsArray<RG extends RuleGroupICDiagnosticsResult = RuleGroupICDiagnosticsResult, R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> = RuleGroupICArray<RG, R, C>;
|
|
1750
|
+
/**
|
|
1751
|
+
* A {@link RuleGroupTypeIC} annotated with diagnostics results, as produced
|
|
1752
|
+
* by {@link formatQuery} for the `"diagnostics"` format (independent combinators).
|
|
1753
|
+
*
|
|
1754
|
+
* The generics mirror those of {@link RuleGroupTypeIC}.
|
|
1755
|
+
*
|
|
1756
|
+
* @group Export
|
|
1757
|
+
*/
|
|
1758
|
+
interface RuleGroupICDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> extends Omit<RuleGroupTypeIC<R, C>, "rules"> {
|
|
1759
|
+
/** Whether the group and all of its descendants are valid. */
|
|
1760
|
+
valid: boolean;
|
|
1761
|
+
/**
|
|
1762
|
+
* Reasons why the group itself is invalid. Only present when
|
|
1763
|
+
* the group is invalid and specific reasons were provided
|
|
1764
|
+
* by the validator.
|
|
1765
|
+
*/
|
|
1766
|
+
reasons?: any[];
|
|
1767
|
+
/** The path to this group within the query tree. */
|
|
1768
|
+
path: number[];
|
|
1769
|
+
/** The nesting depth of this group (`path.length`). */
|
|
1770
|
+
level: number;
|
|
1771
|
+
rules: RuleGroupICDiagnosticsArray<RuleGroupICDiagnosticsResult<R, C>, R, C>;
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* A single diagnostic entry produced by the `"diagnostics"` format.
|
|
1775
|
+
*
|
|
1776
|
+
* @group Export
|
|
1777
|
+
*/
|
|
1778
|
+
interface DiagnosticEntry {
|
|
1779
|
+
/** The `id` of the rule or group this diagnostic pertains to. */
|
|
1780
|
+
id: string;
|
|
1781
|
+
/** The path to the rule or group within the query tree. */
|
|
1782
|
+
path: number[];
|
|
1783
|
+
/** A machine-readable code identifying the type of diagnostic. */
|
|
1784
|
+
code: string;
|
|
1785
|
+
/** A human-readable description of the diagnostic. */
|
|
1786
|
+
message: string;
|
|
1787
|
+
/**
|
|
1788
|
+
* Which check produced this diagnostic.
|
|
1789
|
+
*
|
|
1790
|
+
* - `"placeholder"` — a placeholder field, operator, or value
|
|
1791
|
+
* - `"muted"` — a muted rule or group
|
|
1792
|
+
* - `"query-validator"` — the query-level validator
|
|
1793
|
+
* - `"field-validator"` — a field-level validator
|
|
1794
|
+
* - `"type-check"` — value/type mismatch based on field `inputType`
|
|
1795
|
+
* - `"field-check"` — field existence check against the `fields` config
|
|
1796
|
+
*/
|
|
1797
|
+
source: "placeholder" | "muted" | "query-validator" | "field-validator" | "type-check" | "field-check";
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Aggregate statistics for the `"diagnostics"` format.
|
|
1801
|
+
*
|
|
1802
|
+
* @group Export
|
|
1803
|
+
*/
|
|
1804
|
+
interface DiagnosticsStats {
|
|
1805
|
+
totalRules: number;
|
|
1806
|
+
totalGroups: number;
|
|
1807
|
+
validRules: number;
|
|
1808
|
+
invalidRules: number;
|
|
1809
|
+
validGroups: number;
|
|
1810
|
+
invalidGroups: number;
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Per-field summary entry for the `"diagnostics"` format.
|
|
1814
|
+
*
|
|
1815
|
+
* @group Export
|
|
1816
|
+
*/
|
|
1817
|
+
interface DiagnosticsFieldSummaryEntry {
|
|
1818
|
+
/** Number of rules referencing this field. */
|
|
1819
|
+
ruleCount: number;
|
|
1820
|
+
/** Number of invalid rules referencing this field. */
|
|
1821
|
+
invalidCount: number;
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Top-level result of {@link formatQuery} for the `"diagnostics"` format.
|
|
1825
|
+
*
|
|
1826
|
+
* @group Export
|
|
1827
|
+
*/
|
|
1828
|
+
interface DiagnosticsResult {
|
|
1829
|
+
/** The annotated query tree with `valid`, `path`, and `level` on every node. */
|
|
1830
|
+
query: RuleGroupDiagnosticsResult | RuleGroupICDiagnosticsResult;
|
|
1831
|
+
/** A flat array of all diagnostic entries across the tree. */
|
|
1832
|
+
diagnostics: DiagnosticEntry[];
|
|
1833
|
+
/** Aggregate statistics about the query. */
|
|
1834
|
+
stats: DiagnosticsStats;
|
|
1835
|
+
/** Per-field summary of rule counts and invalid counts. */
|
|
1836
|
+
fieldSummary: Record<string, DiagnosticsFieldSummaryEntry>;
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1688
1839
|
* @group Export
|
|
1689
1840
|
*/
|
|
1690
1841
|
interface RQBJsonLogicStartsWith {
|
|
@@ -1744,5 +1895,5 @@ type NLTranslationKey = "and" | "or" | "true" | "false" | `groupPrefix${ZeroOrMo
|
|
|
1744
1895
|
*/
|
|
1745
1896
|
type NLTranslations = Partial<Record<NLTranslationKey, string>>;
|
|
1746
1897
|
//#endregion
|
|
1747
|
-
export {
|
|
1748
|
-
//# sourceMappingURL=index-
|
|
1898
|
+
export { SetRequired as A, RuleGroupTypeIC as C, RuleGroupType as D, DefaultRuleGroupType as E, RuleType as O, RuleGroupTypeAny as S, DefaultOperatorName as T, ValueProcessorLegacy as _, ExportOperatorMap as a, ValueSources as b, NLTranslationKey as c, ParameterizedSQL as d, RQBJsonLogic as f, ValueProcessorByRule as g, SQLPreset as h, ExportObjectFormats as i, Except as j, OptionList as k, NLTranslations as l, RuleProcessor as m, DiagnosticsResult as n, FormatQueryOptions as o, RuleGroupProcessor as p, ExportFormat as r, GroupVariantCondition as s, ConstituentWordOrder as t, ParameterizedNamedSQL as u, ValueProcessorOptions as v, DefaultCombinatorName as w, DefaultRuleGroupTypeIC as x, FullField as y };
|
|
1899
|
+
//# sourceMappingURL=index-Cjapnb-H.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { RulesLogic } from "json-logic-js";
|
|
|
2
2
|
|
|
3
3
|
//#region ../../node_modules/type-fest/source/union-to-intersection.d.ts
|
|
4
4
|
/**
|
|
5
|
-
Convert a union type to an intersection type
|
|
5
|
+
Convert a union type to an intersection type.
|
|
6
6
|
|
|
7
7
|
Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
|
|
8
8
|
|
|
@@ -899,7 +899,7 @@ type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Requ
|
|
|
899
899
|
//#endregion
|
|
900
900
|
//#region ../../node_modules/type-fest/source/set-required.d.ts
|
|
901
901
|
/**
|
|
902
|
-
Create a type that makes the given keys required
|
|
902
|
+
Create a type that makes the given keys required, while keeping the remaining keys as is.
|
|
903
903
|
|
|
904
904
|
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.
|
|
905
905
|
|
|
@@ -925,8 +925,8 @@ type ArrayExample = SetRequired<[number?, number?, number?], 0 | 1>;
|
|
|
925
925
|
*/
|
|
926
926
|
type SetRequired<BaseType, Keys extends keyof BaseType> = (BaseType extends ((...arguments_: never) => any) ? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType> : unknown) & _SetRequired<BaseType, Keys>;
|
|
927
927
|
type _SetRequired<BaseType, Keys extends keyof BaseType> = BaseType extends UnknownArray ? SetArrayRequired<BaseType, Keys> extends infer ResultantArray ? If<IsArrayReadonly<BaseType>, Readonly<ResultantArray>, ResultantArray> : never : Simplify< // Pick just the keys that are optional from the base type.
|
|
928
|
-
Except<BaseType, Keys>
|
|
929
|
-
Required<HomomorphicPick<BaseType, Keys>>>;
|
|
928
|
+
Except<BaseType, Keys> // Pick the keys that should be required from the base type and make them required.
|
|
929
|
+
& Required<HomomorphicPick<BaseType, Keys>>>;
|
|
930
930
|
/**
|
|
931
931
|
Remove the optional modifier from the specified keys in an array.
|
|
932
932
|
*/
|
|
@@ -1072,7 +1072,7 @@ interface CommonRuleAndGroupProperties {
|
|
|
1072
1072
|
* The main rule type. The `field`, `operator`, and `value` properties
|
|
1073
1073
|
* can be narrowed with generics.
|
|
1074
1074
|
*/
|
|
1075
|
-
interface RuleType<F extends string = string, O extends string = string, V = any, C extends string = string
|
|
1075
|
+
interface RuleType<F extends string = string, O extends string = string, V = any, C extends string = string, M = Record<string, any>> extends CommonRuleAndGroupProperties {
|
|
1076
1076
|
field: F;
|
|
1077
1077
|
operator: O;
|
|
1078
1078
|
value: V;
|
|
@@ -1082,6 +1082,13 @@ interface RuleType<F extends string = string, O extends string = string, V = any
|
|
|
1082
1082
|
* Only used when adding a rule to a query that uses independent combinators.
|
|
1083
1083
|
*/
|
|
1084
1084
|
combinatorPreceding?: C;
|
|
1085
|
+
/**
|
|
1086
|
+
* Opaque metadata for use by extension packages. The core library
|
|
1087
|
+
* preserves this property but does not read or interpret it.
|
|
1088
|
+
* Extensions like `@react-querybuilder/graph` use `meta` to store
|
|
1089
|
+
* domain-specific context (e.g., graph pattern information).
|
|
1090
|
+
*/
|
|
1091
|
+
meta?: M;
|
|
1085
1092
|
}
|
|
1086
1093
|
/**
|
|
1087
1094
|
* The main rule group type. This type is used for query definitions as well as
|
|
@@ -1216,7 +1223,7 @@ type ValueEditorType = "text" | "select" | "checkbox" | "radio" | "textarea" | "
|
|
|
1216
1223
|
*/
|
|
1217
1224
|
type ValueSources = ["value"] | ["value", "field"] | ["field", "value"] | ["field"];
|
|
1218
1225
|
type ValueSourceFlexibleOptions = ToFlexibleOptionArrays<ValueSources>;
|
|
1219
|
-
type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption
|
|
1226
|
+
type ToFlexibleOptionArrays<Sources extends readonly string[]> = Sources extends unknown ? { [K in keyof Sources]: FlexibleOption } : never;
|
|
1220
1227
|
type WithOptionalClassName<T> = T & {
|
|
1221
1228
|
className?: Classname;
|
|
1222
1229
|
};
|
|
@@ -1304,13 +1311,13 @@ type ParseNumbersPropConfig = boolean | `${ParseNumberMethodName}${ParseNumbersM
|
|
|
1304
1311
|
*
|
|
1305
1312
|
* @group Export
|
|
1306
1313
|
*/
|
|
1307
|
-
type ExportFormat = "json" | "sql" | "json_without_ids" | "parameterized" | "parameterized_named" | "mongodb" | "mongodb_query" | "cel" | "jsonlogic" | "spel" | "elasticsearch" | "jsonata" | "natural_language" | "ldap" | "drizzle" | "prisma" | "sequelize";
|
|
1314
|
+
type ExportFormat = "json" | "sql" | "json_without_ids" | "parameterized" | "parameterized_named" | "mongodb" | "mongodb_query" | "cel" | "jsonlogic" | "spel" | "elasticsearch" | "jsonata" | "natural_language" | "ldap" | "drizzle" | "prisma" | "sequelize" | "cypher" | "gql" | "sparql" | "gremlin" | "diagnostics";
|
|
1308
1315
|
/**
|
|
1309
1316
|
* Export formats for {@link formatQuery} that produce objects instead of strings.
|
|
1310
1317
|
*
|
|
1311
1318
|
* @group Export
|
|
1312
1319
|
*/
|
|
1313
|
-
type ExportObjectFormats = "parameterized" | "parameterized_named" | "jsonlogic" | "elasticsearch" | "jsonata" | "mongodb_query";
|
|
1320
|
+
type ExportObjectFormats = "parameterized" | "parameterized_named" | "jsonlogic" | "elasticsearch" | "jsonata" | "mongodb_query" | "diagnostics";
|
|
1314
1321
|
/**
|
|
1315
1322
|
* Available presets for the "sql" export format.
|
|
1316
1323
|
*
|
|
@@ -1685,6 +1692,150 @@ interface ParameterizedNamedSQL {
|
|
|
1685
1692
|
params: Record<string, any>;
|
|
1686
1693
|
}
|
|
1687
1694
|
/**
|
|
1695
|
+
* A {@link RuleType} annotated with diagnostics results, as produced
|
|
1696
|
+
* by {@link formatQuery} for the `"diagnostics"` format.
|
|
1697
|
+
*
|
|
1698
|
+
* The generics mirror those of {@link RuleType}.
|
|
1699
|
+
*
|
|
1700
|
+
* @group Export
|
|
1701
|
+
*/
|
|
1702
|
+
type RuleDiagnosticsResult<F extends string = string, O extends string = string, V = any, C extends string = string> = RuleType<F, O, V, C> & {
|
|
1703
|
+
/** Whether the rule passed all validation checks. */valid: boolean;
|
|
1704
|
+
/**
|
|
1705
|
+
* Reasons why the rule is invalid. Only present when
|
|
1706
|
+
* the rule is invalid and specific reasons were provided
|
|
1707
|
+
* by the validator.
|
|
1708
|
+
*/
|
|
1709
|
+
reasons?: any[]; /** The path to this rule within the query tree. */
|
|
1710
|
+
path: number[]; /** The nesting depth of this rule (`path.length`). */
|
|
1711
|
+
level: number;
|
|
1712
|
+
};
|
|
1713
|
+
/**
|
|
1714
|
+
* The type of the `rules` array in a {@link RuleGroupDiagnosticsResult}.
|
|
1715
|
+
*
|
|
1716
|
+
* @group Export
|
|
1717
|
+
*/
|
|
1718
|
+
type RuleGroupDiagnosticsArray<RG extends RuleGroupDiagnosticsResult = RuleGroupDiagnosticsResult, R extends RuleDiagnosticsResult = RuleDiagnosticsResult> = RuleGroupArray<RG, R>;
|
|
1719
|
+
/**
|
|
1720
|
+
* A {@link RuleGroupType} annotated with diagnostics results, as produced
|
|
1721
|
+
* by {@link formatQuery} for the `"diagnostics"` format.
|
|
1722
|
+
*
|
|
1723
|
+
* The generics mirror those of {@link RuleGroupType}.
|
|
1724
|
+
*
|
|
1725
|
+
* @group Export
|
|
1726
|
+
*/
|
|
1727
|
+
interface RuleGroupDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> extends Omit<RuleGroupType<R, C>, "rules"> {
|
|
1728
|
+
/** Whether the group and all of its descendants are valid. */
|
|
1729
|
+
valid: boolean;
|
|
1730
|
+
/**
|
|
1731
|
+
* Reasons why the group itself is invalid. Only present when
|
|
1732
|
+
* the group is invalid and specific reasons were provided
|
|
1733
|
+
* by the validator.
|
|
1734
|
+
*/
|
|
1735
|
+
reasons?: any[];
|
|
1736
|
+
/** The path to this group within the query tree. */
|
|
1737
|
+
path: number[];
|
|
1738
|
+
/** The nesting depth of this group (`path.length`). */
|
|
1739
|
+
level: number;
|
|
1740
|
+
rules: RuleGroupDiagnosticsArray<RuleGroupDiagnosticsResult<R, C>, R>;
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* The type of the `rules` array in a {@link RuleGroupICDiagnosticsResult}.
|
|
1744
|
+
*
|
|
1745
|
+
* Mirrors {@link RuleGroupICArray} but with diagnostics-annotated node types.
|
|
1746
|
+
*
|
|
1747
|
+
* @group Export
|
|
1748
|
+
*/
|
|
1749
|
+
type RuleGroupICDiagnosticsArray<RG extends RuleGroupICDiagnosticsResult = RuleGroupICDiagnosticsResult, R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> = RuleGroupICArray<RG, R, C>;
|
|
1750
|
+
/**
|
|
1751
|
+
* A {@link RuleGroupTypeIC} annotated with diagnostics results, as produced
|
|
1752
|
+
* by {@link formatQuery} for the `"diagnostics"` format (independent combinators).
|
|
1753
|
+
*
|
|
1754
|
+
* The generics mirror those of {@link RuleGroupTypeIC}.
|
|
1755
|
+
*
|
|
1756
|
+
* @group Export
|
|
1757
|
+
*/
|
|
1758
|
+
interface RuleGroupICDiagnosticsResult<R extends RuleDiagnosticsResult = RuleDiagnosticsResult, C extends string = string> extends Omit<RuleGroupTypeIC<R, C>, "rules"> {
|
|
1759
|
+
/** Whether the group and all of its descendants are valid. */
|
|
1760
|
+
valid: boolean;
|
|
1761
|
+
/**
|
|
1762
|
+
* Reasons why the group itself is invalid. Only present when
|
|
1763
|
+
* the group is invalid and specific reasons were provided
|
|
1764
|
+
* by the validator.
|
|
1765
|
+
*/
|
|
1766
|
+
reasons?: any[];
|
|
1767
|
+
/** The path to this group within the query tree. */
|
|
1768
|
+
path: number[];
|
|
1769
|
+
/** The nesting depth of this group (`path.length`). */
|
|
1770
|
+
level: number;
|
|
1771
|
+
rules: RuleGroupICDiagnosticsArray<RuleGroupICDiagnosticsResult<R, C>, R, C>;
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* A single diagnostic entry produced by the `"diagnostics"` format.
|
|
1775
|
+
*
|
|
1776
|
+
* @group Export
|
|
1777
|
+
*/
|
|
1778
|
+
interface DiagnosticEntry {
|
|
1779
|
+
/** The `id` of the rule or group this diagnostic pertains to. */
|
|
1780
|
+
id: string;
|
|
1781
|
+
/** The path to the rule or group within the query tree. */
|
|
1782
|
+
path: number[];
|
|
1783
|
+
/** A machine-readable code identifying the type of diagnostic. */
|
|
1784
|
+
code: string;
|
|
1785
|
+
/** A human-readable description of the diagnostic. */
|
|
1786
|
+
message: string;
|
|
1787
|
+
/**
|
|
1788
|
+
* Which check produced this diagnostic.
|
|
1789
|
+
*
|
|
1790
|
+
* - `"placeholder"` — a placeholder field, operator, or value
|
|
1791
|
+
* - `"muted"` — a muted rule or group
|
|
1792
|
+
* - `"query-validator"` — the query-level validator
|
|
1793
|
+
* - `"field-validator"` — a field-level validator
|
|
1794
|
+
* - `"type-check"` — value/type mismatch based on field `inputType`
|
|
1795
|
+
* - `"field-check"` — field existence check against the `fields` config
|
|
1796
|
+
*/
|
|
1797
|
+
source: "placeholder" | "muted" | "query-validator" | "field-validator" | "type-check" | "field-check";
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Aggregate statistics for the `"diagnostics"` format.
|
|
1801
|
+
*
|
|
1802
|
+
* @group Export
|
|
1803
|
+
*/
|
|
1804
|
+
interface DiagnosticsStats {
|
|
1805
|
+
totalRules: number;
|
|
1806
|
+
totalGroups: number;
|
|
1807
|
+
validRules: number;
|
|
1808
|
+
invalidRules: number;
|
|
1809
|
+
validGroups: number;
|
|
1810
|
+
invalidGroups: number;
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Per-field summary entry for the `"diagnostics"` format.
|
|
1814
|
+
*
|
|
1815
|
+
* @group Export
|
|
1816
|
+
*/
|
|
1817
|
+
interface DiagnosticsFieldSummaryEntry {
|
|
1818
|
+
/** Number of rules referencing this field. */
|
|
1819
|
+
ruleCount: number;
|
|
1820
|
+
/** Number of invalid rules referencing this field. */
|
|
1821
|
+
invalidCount: number;
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Top-level result of {@link formatQuery} for the `"diagnostics"` format.
|
|
1825
|
+
*
|
|
1826
|
+
* @group Export
|
|
1827
|
+
*/
|
|
1828
|
+
interface DiagnosticsResult {
|
|
1829
|
+
/** The annotated query tree with `valid`, `path`, and `level` on every node. */
|
|
1830
|
+
query: RuleGroupDiagnosticsResult | RuleGroupICDiagnosticsResult;
|
|
1831
|
+
/** A flat array of all diagnostic entries across the tree. */
|
|
1832
|
+
diagnostics: DiagnosticEntry[];
|
|
1833
|
+
/** Aggregate statistics about the query. */
|
|
1834
|
+
stats: DiagnosticsStats;
|
|
1835
|
+
/** Per-field summary of rule counts and invalid counts. */
|
|
1836
|
+
fieldSummary: Record<string, DiagnosticsFieldSummaryEntry>;
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1688
1839
|
* @group Export
|
|
1689
1840
|
*/
|
|
1690
1841
|
interface RQBJsonLogicStartsWith {
|
|
@@ -1744,5 +1895,5 @@ type NLTranslationKey = "and" | "or" | "true" | "false" | `groupPrefix${ZeroOrMo
|
|
|
1744
1895
|
*/
|
|
1745
1896
|
type NLTranslations = Partial<Record<NLTranslationKey, string>>;
|
|
1746
1897
|
//#endregion
|
|
1747
|
-
export {
|
|
1748
|
-
//# sourceMappingURL=index-
|
|
1898
|
+
export { SetRequired as A, RuleGroupTypeIC as C, RuleGroupType as D, DefaultRuleGroupType as E, RuleType as O, RuleGroupTypeAny as S, DefaultOperatorName as T, ValueProcessorLegacy as _, ExportOperatorMap as a, ValueSources as b, NLTranslationKey as c, ParameterizedSQL as d, RQBJsonLogic as f, ValueProcessorByRule as g, SQLPreset as h, ExportObjectFormats as i, Except as j, OptionList as k, NLTranslations as l, RuleProcessor as m, DiagnosticsResult as n, FormatQueryOptions as o, RuleGroupProcessor as p, ExportFormat as r, GroupVariantCondition as s, ConstituentWordOrder as t, ParameterizedNamedSQL as u, ValueProcessorOptions as v, DefaultCombinatorName as w, DefaultRuleGroupTypeIC as x, FullField as y };
|
|
1899
|
+
//# sourceMappingURL=index-D-Iej37L.d.mts.map
|
|
@@ -4,7 +4,7 @@ let numeric_quantity = require("numeric-quantity");
|
|
|
4
4
|
/**
|
|
5
5
|
* Converts a value to lowercase if it's a string, otherwise returns the value as is.
|
|
6
6
|
*/
|
|
7
|
-
//
|
|
7
|
+
// v8 ignore next
|
|
8
8
|
const lc = (v) => typeof v === "string" ? v.toLowerCase() : v;
|
|
9
9
|
/**
|
|
10
10
|
* Regex matching numeric strings. Passes for positive/negative integers, decimals,
|
|
@@ -102,4 +102,4 @@ Object.defineProperty(exports, "objectKeys", {
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
//# sourceMappingURL=objectUtils-
|
|
105
|
+
//# sourceMappingURL=objectUtils-Bzug_QfX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectUtils-Bzug_QfX.js","names":["numericQuantityRegex"],"sources":["../src/utils/misc.ts","../src/utils/isRuleGroup.ts","../src/utils/objectUtils.ts"],"sourcesContent":["import { numericRegex as numericQuantityRegex } from 'numeric-quantity';\n\n/**\n * Converts a value to lowercase if it's a string, otherwise returns the value as is.\n */\n// v8 ignore next\nexport const lc = <T>(v: T): T => (typeof v === 'string' ? (v.toLowerCase() as T) : v);\n\n/**\n * Regex matching numeric strings. Passes for positive/negative integers, decimals,\n * and E notation, with optional surrounding whitespace.\n */\nexport const numericRegex: RegExp = new RegExp(\n numericQuantityRegex.source.replace(/^\\^/, String.raw`^\\s*`).replace(/\\$$/, String.raw`\\s*$`)\n);\n\n/**\n * Determines if a variable is a plain old JavaScript object, aka POJO.\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const isPojo = (obj: any): obj is Record<string, any> =>\n obj === null || typeof obj !== 'object' ? false : Object.getPrototypeOf(obj) === Object.prototype;\n\n/**\n * Simple helper to determine whether a value is null, undefined, or an empty string.\n */\nexport const nullOrUndefinedOrEmpty = (value: unknown): value is null | undefined | '' =>\n value === null || value === undefined || value === '';\n","import type { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from '../types';\nimport { isPojo } from './misc';\n\n/**\n * Determines if an object is a {@link RuleType} (only checks for a `field` property).\n */\nexport const isRuleType = (s: unknown): s is RuleType =>\n isPojo(s) && 'field' in s && typeof s.field === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupType} or {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroup = (rg: unknown): rg is RuleGroupTypeAny =>\n isPojo(rg) && Array.isArray(rg.rules);\n\n/**\n * Determines if an object is a {@link RuleGroupType}.\n */\nexport const isRuleGroupType = (rg: unknown): rg is RuleGroupType =>\n isRuleGroup(rg) && typeof rg.combinator === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroupTypeIC = (rg: unknown): rg is RuleGroupTypeIC =>\n isRuleGroup(rg) && rg.combinator === undefined;\n","// All code in this file is adapted from:\n// npm: https://www.npmjs.com/package/ts-extras\n// src: https://github.com/sindresorhus/ts-extras\n\n/**\n * Original looked like this (not sure why template string is used):\n * ```\n * type ObjectKeys<T extends object> = `${Exclude<keyof T, symbol>}`;\n * ```\n */\ntype ObjectKeys<T extends object> = Exclude<keyof T, symbol>;\n\n/**\n * A strongly-typed version of `Object.keys()`.\n *\n * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)\n */\nexport const objectKeys = Object.keys as <Type extends object>(\n value: Type\n) => Array<ObjectKeys<Type>>;\n\n/**\n * A strongly-typed version of `Object.entries()`.\n *\n * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)\n */\nexport const objectEntries = Object.entries as <Type extends Record<PropertyKey, unknown>>(\n value: Type\n) => Array<[ObjectKeys<Type>, Type[ObjectKeys<Type>]]>;\n\n/**\n * Returns `true` if the key could cause prototype pollution when used\n * as a property name in bracket-notation assignment.\n */\nexport const isUnsafeKey = (key: unknown): boolean =>\n key === '__proto__' || key === 'constructor' || key === 'prototype';\n"],"mappings":";;;;;;;AAMA,MAAa,MAAS,MAAa,OAAO,MAAM,WAAY,EAAE,aAAa,GAAS;;;;;AAMpF,MAAa,eAAuB,IAAI,OACtCA,iBAAAA,aAAqB,OAAO,QAAQ,OAAO,OAAO,GAAG,OAAO,CAAC,QAAQ,OAAO,OAAO,GAAG,OAAO,CAC9F;;;;AAMD,MAAa,UAAU,QACrB,QAAQ,QAAQ,OAAO,QAAQ,WAAW,QAAQ,OAAO,eAAe,IAAI,KAAK,OAAO;;;;AAK1F,MAAa,0BAA0B,UACrC,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU;;;;;;ACfrD,MAAa,eAAe,OAC1B,OAAO,GAAG,IAAI,MAAM,QAAQ,GAAG,MAAM;;;;AAKvC,MAAa,mBAAmB,OAC9B,YAAY,GAAG,IAAI,OAAO,GAAG,eAAe;;;;AAK9C,MAAa,qBAAqB,OAChC,YAAY,GAAG,IAAI,GAAG,eAAe,KAAA;;;;;;;;ACRvC,MAAa,aAAa,OAAO;;;;;AAiBjC,MAAa,eAAe,QAC1B,QAAQ,eAAe,QAAQ,iBAAiB,QAAQ"}
|
|
@@ -3,7 +3,7 @@ import { numericRegex } from "numeric-quantity";
|
|
|
3
3
|
/**
|
|
4
4
|
* Converts a value to lowercase if it's a string, otherwise returns the value as is.
|
|
5
5
|
*/
|
|
6
|
-
//
|
|
6
|
+
// v8 ignore next
|
|
7
7
|
const lc = (v) => typeof v === "string" ? v.toLowerCase() : v;
|
|
8
8
|
/**
|
|
9
9
|
* Regex matching numeric strings. Passes for positive/negative integers, decimals,
|
|
@@ -48,4 +48,4 @@ const isUnsafeKey = (key) => key === "__proto__" || key === "constructor" || key
|
|
|
48
48
|
//#endregion
|
|
49
49
|
export { isRuleGroupTypeIC as a, nullOrUndefinedOrEmpty as c, isRuleGroupType as i, numericRegex$1 as l, objectKeys as n, isPojo as o, isRuleGroup as r, lc as s, isUnsafeKey as t };
|
|
50
50
|
|
|
51
|
-
//# sourceMappingURL=objectUtils-
|
|
51
|
+
//# sourceMappingURL=objectUtils-D96eEEzL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectUtils-D96eEEzL.mjs","names":["numericRegex","numericQuantityRegex"],"sources":["../src/utils/misc.ts","../src/utils/isRuleGroup.ts","../src/utils/objectUtils.ts"],"sourcesContent":["import { numericRegex as numericQuantityRegex } from 'numeric-quantity';\n\n/**\n * Converts a value to lowercase if it's a string, otherwise returns the value as is.\n */\n// v8 ignore next\nexport const lc = <T>(v: T): T => (typeof v === 'string' ? (v.toLowerCase() as T) : v);\n\n/**\n * Regex matching numeric strings. Passes for positive/negative integers, decimals,\n * and E notation, with optional surrounding whitespace.\n */\nexport const numericRegex: RegExp = new RegExp(\n numericQuantityRegex.source.replace(/^\\^/, String.raw`^\\s*`).replace(/\\$$/, String.raw`\\s*$`)\n);\n\n/**\n * Determines if a variable is a plain old JavaScript object, aka POJO.\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const isPojo = (obj: any): obj is Record<string, any> =>\n obj === null || typeof obj !== 'object' ? false : Object.getPrototypeOf(obj) === Object.prototype;\n\n/**\n * Simple helper to determine whether a value is null, undefined, or an empty string.\n */\nexport const nullOrUndefinedOrEmpty = (value: unknown): value is null | undefined | '' =>\n value === null || value === undefined || value === '';\n","import type { RuleGroupType, RuleGroupTypeAny, RuleGroupTypeIC, RuleType } from '../types';\nimport { isPojo } from './misc';\n\n/**\n * Determines if an object is a {@link RuleType} (only checks for a `field` property).\n */\nexport const isRuleType = (s: unknown): s is RuleType =>\n isPojo(s) && 'field' in s && typeof s.field === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupType} or {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroup = (rg: unknown): rg is RuleGroupTypeAny =>\n isPojo(rg) && Array.isArray(rg.rules);\n\n/**\n * Determines if an object is a {@link RuleGroupType}.\n */\nexport const isRuleGroupType = (rg: unknown): rg is RuleGroupType =>\n isRuleGroup(rg) && typeof rg.combinator === 'string';\n\n/**\n * Determines if an object is a {@link RuleGroupTypeIC}.\n */\nexport const isRuleGroupTypeIC = (rg: unknown): rg is RuleGroupTypeIC =>\n isRuleGroup(rg) && rg.combinator === undefined;\n","// All code in this file is adapted from:\n// npm: https://www.npmjs.com/package/ts-extras\n// src: https://github.com/sindresorhus/ts-extras\n\n/**\n * Original looked like this (not sure why template string is used):\n * ```\n * type ObjectKeys<T extends object> = `${Exclude<keyof T, symbol>}`;\n * ```\n */\ntype ObjectKeys<T extends object> = Exclude<keyof T, symbol>;\n\n/**\n * A strongly-typed version of `Object.keys()`.\n *\n * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-keys.ts)\n */\nexport const objectKeys = Object.keys as <Type extends object>(\n value: Type\n) => Array<ObjectKeys<Type>>;\n\n/**\n * A strongly-typed version of `Object.entries()`.\n *\n * [Original source](https://github.com/sindresorhus/ts-extras/blob/44f57392c5f027268330771996c4fdf9260b22d6/source/object-entries.ts)\n */\nexport const objectEntries = Object.entries as <Type extends Record<PropertyKey, unknown>>(\n value: Type\n) => Array<[ObjectKeys<Type>, Type[ObjectKeys<Type>]]>;\n\n/**\n * Returns `true` if the key could cause prototype pollution when used\n * as a property name in bracket-notation assignment.\n */\nexport const isUnsafeKey = (key: unknown): boolean =>\n key === '__proto__' || key === 'constructor' || key === 'prototype';\n"],"mappings":";;;;;;AAMA,MAAa,MAAS,MAAa,OAAO,MAAM,WAAY,EAAE,aAAa,GAAS;;;;;AAMpF,MAAaA,iBAAuB,IAAI,OACtCC,aAAqB,OAAO,QAAQ,OAAO,OAAO,GAAG,OAAO,CAAC,QAAQ,OAAO,OAAO,GAAG,OAAO,CAC9F;;;;AAMD,MAAa,UAAU,QACrB,QAAQ,QAAQ,OAAO,QAAQ,WAAW,QAAQ,OAAO,eAAe,IAAI,KAAK,OAAO;;;;AAK1F,MAAa,0BAA0B,UACrC,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU;;;;;;ACfrD,MAAa,eAAe,OAC1B,OAAO,GAAG,IAAI,MAAM,QAAQ,GAAG,MAAM;;;;AAKvC,MAAa,mBAAmB,OAC9B,YAAY,GAAG,IAAI,OAAO,GAAG,eAAe;;;;AAK9C,MAAa,qBAAqB,OAChC,YAAY,GAAG,IAAI,GAAG,eAAe,KAAA;;;;;;;;ACRvC,MAAa,aAAa,OAAO;;;;;AAiBjC,MAAa,eAAe,QAC1B,QAAQ,eAAe,QAAQ,iBAAiB,QAAQ"}
|
package/dist/parseCEL.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as ParserCommonOptions } from "./import-
|
|
1
|
+
import { C as RuleGroupTypeIC, D as RuleGroupType, E as DefaultRuleGroupType, O as RuleType, T as DefaultOperatorName, j as Except, w as DefaultCombinatorName, x as DefaultRuleGroupTypeIC } from "./index-D-Iej37L.mjs";
|
|
2
|
+
import { t as ParserCommonOptions } from "./import-BHlzBLM_.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/parseCEL/types.d.ts
|
|
5
5
|
type CELExpressionType = "Addition" | "BooleanLiteral" | "BytesLiteral" | "ConditionalAnd" | "ConditionalExpr" | "ConditionalOr" | "Division" | "DynamicPropertyAccessor" | "ExpressionGroup" | "ExpressionList" | "FieldInit" | "FieldInits" | "FieldsObject" | "FloatLiteral" | "FunctionCall" | "Identifier" | "IntegerLiteral" | "List" | "Map" | "MapInit" | "MapInits" | "Member" | "Modulo" | "Multiplication" | "Negation" | "Negative" | "NullLiteral" | "Property" | "Relation" | "StringLiteral" | "Subtraction" | "Unary" | "UnsignedIntegerLiteral" | "LikeExpression" | "SubqueryExpression";
|
package/dist/parseCEL.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as ParserCommonOptions } from "./import-
|
|
1
|
+
import { C as RuleGroupTypeIC, D as RuleGroupType, E as DefaultRuleGroupType, O as RuleType, T as DefaultOperatorName, j as Except, w as DefaultCombinatorName, x as DefaultRuleGroupTypeIC } from "./index-Cjapnb-H.js";
|
|
2
|
+
import { t as ParserCommonOptions } from "./import-C6imciDf.js";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/parseCEL/types.d.ts
|
|
5
5
|
type CELExpressionType = "Addition" | "BooleanLiteral" | "BytesLiteral" | "ConditionalAnd" | "ConditionalExpr" | "ConditionalOr" | "Division" | "DynamicPropertyAccessor" | "ExpressionGroup" | "ExpressionList" | "FieldInit" | "FieldInits" | "FieldsObject" | "FloatLiteral" | "FunctionCall" | "Identifier" | "IntegerLiteral" | "List" | "Map" | "MapInit" | "MapInits" | "Member" | "Modulo" | "Multiplication" | "Negation" | "Negative" | "NullLiteral" | "Property" | "Relation" | "StringLiteral" | "Subtraction" | "Unary" | "UnsignedIntegerLiteral" | "LikeExpression" | "SubqueryExpression";
|