@osdk/client 2.7.0-beta.12 → 2.7.0-beta.14
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/CHANGELOG.md +26 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +14 -9
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +74 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/browser/observable/internal/evaluateFilter.js +1 -1
- package/build/browser/observable/internal/evaluateFilter.js.map +1 -1
- package/build/browser/observable/internal/evaluateFilter.test.js +105 -0
- package/build/browser/observable/internal/evaluateFilter.test.js.map +1 -0
- package/build/browser/observable/internal/list/ListQuery.test.js +86 -1
- package/build/browser/observable/internal/list/ListQuery.test.js.map +1 -1
- package/build/browser/observable/internal/list/ObjectListQuery.js +4 -4
- package/build/browser/observable/internal/list/ObjectListQuery.js.map +1 -1
- package/build/browser/observable/internal/object/ObjectQuery.js +12 -1
- package/build/browser/observable/internal/object/ObjectQuery.js.map +1 -1
- package/build/browser/observable/internal/objectMatchesWhereClause.test.js +11 -1
- package/build/browser/observable/internal/objectMatchesWhereClause.test.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -2
- package/build/cjs/{chunk-4HXJEKQT.cjs → chunk-VVKEXIIO.cjs} +16 -9
- package/build/cjs/chunk-VVKEXIIO.cjs.map +1 -0
- package/build/cjs/{chunk-62RUUOW2.cjs → chunk-VX7CVNQZ.cjs} +65 -65
- package/build/cjs/{chunk-62RUUOW2.cjs.map → chunk-VX7CVNQZ.cjs.map} +1 -1
- package/build/cjs/index.cjs +8 -8
- package/build/cjs/public/internal.cjs +8 -8
- package/build/cjs/public/unstable-do-not-use.cjs +65 -55
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +14 -9
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +74 -0
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/esm/observable/internal/evaluateFilter.js +1 -1
- package/build/esm/observable/internal/evaluateFilter.js.map +1 -1
- package/build/esm/observable/internal/evaluateFilter.test.js +105 -0
- package/build/esm/observable/internal/evaluateFilter.test.js.map +1 -0
- package/build/esm/observable/internal/list/ListQuery.test.js +86 -1
- package/build/esm/observable/internal/list/ListQuery.test.js.map +1 -1
- package/build/esm/observable/internal/list/ObjectListQuery.js +4 -4
- package/build/esm/observable/internal/list/ObjectListQuery.js.map +1 -1
- package/build/esm/observable/internal/object/ObjectQuery.js +12 -1
- package/build/esm/observable/internal/object/ObjectQuery.js.map +1 -1
- package/build/esm/observable/internal/objectMatchesWhereClause.test.js +11 -1
- package/build/esm/observable/internal/objectMatchesWhereClause.test.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -2
- package/build/types/observable/internal/evaluateFilter.test.d.ts +1 -0
- package/build/types/observable/internal/evaluateFilter.test.d.ts.map +1 -0
- package/build/types/observable/internal/list/ObjectListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/object/ObjectQuery.d.ts.map +1 -1
- package/package.json +9 -9
- package/build/cjs/chunk-4HXJEKQT.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @osdk/client
|
|
2
2
|
|
|
3
|
+
## 2.7.0-beta.14
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 24730c7: fix rdp pivot behavior
|
|
8
|
+
- ecd18e2: fix pivotTo with where usage
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- @osdk/api@2.7.0-beta.14
|
|
13
|
+
- @osdk/client.unstable@2.7.0-beta.14
|
|
14
|
+
- @osdk/generator-converters@2.7.0-beta.14
|
|
15
|
+
|
|
16
|
+
## 2.7.0-beta.13
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- fb83808: Allow arrays to use all subtype filters
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [fb83808]
|
|
25
|
+
- @osdk/api@2.7.0-beta.13
|
|
26
|
+
- @osdk/client.unstable@2.7.0-beta.13
|
|
27
|
+
- @osdk/generator-converters@2.7.0-beta.13
|
|
28
|
+
|
|
3
29
|
## 2.7.0-beta.12
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -106,16 +106,21 @@ function handleWherePair([fieldName, filter], objectOrInterface, structFieldSele
|
|
|
106
106
|
}
|
|
107
107
|
const firstKey = keysOfFilter[0];
|
|
108
108
|
!(filter[firstKey] != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
109
|
-
|
|
110
|
-
// Struct array
|
|
111
109
|
if (firstKey === "$contains" && filter[firstKey] instanceof Object) {
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
const containsValue = filter[firstKey];
|
|
111
|
+
const containsKeys = Object.keys(containsValue);
|
|
112
|
+
const isFilterObject = containsKeys.some(key => key.startsWith("$"));
|
|
113
|
+
if (isFilterObject) {
|
|
114
|
+
return handleWherePair([fieldName, containsValue], objectOrInterface, structFieldSelector, rdpNames);
|
|
115
|
+
} else {
|
|
116
|
+
const structFilter = Object.entries(containsValue);
|
|
117
|
+
!(structFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot filter on more than one struct field in the same clause, need to use an and clause") : invariant(false) : void 0;
|
|
118
|
+
const structFieldApiName = structFilter[0][0];
|
|
119
|
+
return handleWherePair(structFilter[0], objectOrInterface, {
|
|
120
|
+
propertyApiName: fieldName,
|
|
121
|
+
structFieldApiName
|
|
122
|
+
});
|
|
123
|
+
}
|
|
119
124
|
}
|
|
120
125
|
if (firstKey === "$ne") {
|
|
121
126
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modernToLegacyWhereClause.js","names":["invariant","fullyQualifyPropName","makeGeoFilterIntersects","makeGeoFilterWithin","isAndClause","whereClause","$and","undefined","isOrClause","$or","isNotClause","$not","modernToLegacyWhereClause","objectOrInterface","rdpNames","parts","Object","entries","map","key","value","length","modernToLegacyWhereClauseInner","type","v","process","env","NODE_ENV","clause","handleWherePair","fieldName","filter","structFieldSelector","isRdp","has","propertyIdentifier","apiName","propertyApiName","field","keysOfFilter","keys","hasDollarSign","some","startsWith","structFilter","structFieldApiName","firstKey","substring","fuzzy"],"sources":["modernToLegacyWhereClause.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n AndWhereClause,\n NotWhereClause,\n ObjectOrInterfaceDefinition,\n OrWhereClause,\n PossibleWhereClauseFilters,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\n\nimport type {\n PropertyIdentifier,\n SearchJsonQueryV2,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { fullyQualifyPropName } from \"./fullyQualifyPropName.js\";\nimport { makeGeoFilterIntersects } from \"./makeGeoFilterIntersects.js\";\nimport { makeGeoFilterWithin } from \"./makeGeoFilterWithin.js\";\n\ntype DropDollarSign<T extends `$${string}`> = T extends `$${infer U}` ? U\n : never;\n\nfunction isAndClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is AndWhereClause<T, RDPs> {\n return \"$and\" in whereClause && whereClause.$and !== undefined;\n}\n\nfunction isOrClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is OrWhereClause<T, RDPs> {\n return \"$or\" in whereClause && whereClause.$or !== undefined;\n}\n\nfunction isNotClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is NotWhereClause<T, RDPs> {\n return \"$not\" in whereClause && whereClause.$not !== undefined;\n}\n\n/** @internal */\nexport function modernToLegacyWhereClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n objectOrInterface: T,\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n const parts = Object.entries(whereClause).map(([key, value]) => ({\n [key]: value,\n })) as WhereClause<T, RDPs>[];\n if (parts.length === 1) {\n return modernToLegacyWhereClauseInner(\n whereClause,\n objectOrInterface,\n rdpNames,\n );\n }\n return {\n type: \"and\",\n value: parts.map<SearchJsonQueryV2>(\n v => modernToLegacyWhereClauseInner(v, objectOrInterface, rdpNames),\n ),\n };\n}\n\n/** @internal */\nexport function modernToLegacyWhereClauseInner<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n objectOrInterface: T,\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n const parts = Object.entries(whereClause);\n\n invariant(parts.length === 1, \"Invalid where clause provided.\");\n\n if (isAndClause(whereClause)) {\n return {\n type: \"and\",\n value: (whereClause.$and as WhereClause<T, RDPs>[]).map(\n (clause) =>\n modernToLegacyWhereClause(clause, objectOrInterface, rdpNames),\n ),\n };\n } else if (isOrClause(whereClause)) {\n return {\n type: \"or\",\n value: (whereClause.$or as WhereClause<T, RDPs>[]).map(\n (clause) =>\n modernToLegacyWhereClause(clause, objectOrInterface, rdpNames),\n ),\n };\n } else if (isNotClause(whereClause)) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(\n whereClause.$not as WhereClause<T, RDPs>,\n objectOrInterface,\n rdpNames,\n ),\n };\n }\n\n return handleWherePair(parts[0], objectOrInterface, undefined, rdpNames);\n}\n\nfunction handleWherePair(\n [fieldName, filter]: [string, any],\n objectOrInterface: ObjectOrInterfaceDefinition,\n structFieldSelector?: { propertyApiName: string; structFieldApiName: string },\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n invariant(\n filter != null,\n \"Defined key values are only allowed when they are not undefined.\",\n );\n\n const isRdp = !structFieldSelector && rdpNames?.has(fieldName);\n\n const propertyIdentifier: PropertyIdentifier | undefined = isRdp\n ? {\n type: \"property\",\n apiName: fieldName,\n }\n : structFieldSelector != null\n ? {\n type: \"structField\",\n ...structFieldSelector,\n propertyApiName: fullyQualifyPropName(\n structFieldSelector.propertyApiName,\n objectOrInterface,\n ),\n }\n : undefined;\n\n const field = !isRdp && structFieldSelector == null\n ? fullyQualifyPropName(fieldName, objectOrInterface)\n : undefined;\n\n invariant(\n field == null\n || propertyIdentifier == null && (field != null || isRdp != null),\n \"Encountered error constructing where clause: field and propertyIdentifier cannot both be defined\",\n );\n\n if (\n typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\"\n ) {\n return {\n type: \"eq\",\n ...(propertyIdentifier != null\n && { propertyIdentifier }),\n field,\n value: filter,\n };\n }\n\n const keysOfFilter = Object.keys(filter);\n\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(\n !hasDollarSign\n || keysOfFilter.length === 1,\n \"A WhereClause Filter with multiple clauses/fields is not allowed. Instead, use an 'or'/'and' clause to combine multiple filters.\",\n );\n\n // Struct\n if (!hasDollarSign) {\n const structFilter = Object.entries(filter);\n invariant(\n structFilter.length === 1,\n \"Cannot filter on more than one struct field in the same clause, need to use an and clause\",\n );\n const structFieldApiName = keysOfFilter[0];\n return handleWherePair(Object.entries(filter)[0], objectOrInterface, {\n propertyApiName: fieldName,\n structFieldApiName,\n }, rdpNames);\n }\n\n const firstKey = keysOfFilter[0] as PossibleWhereClauseFilters;\n invariant(filter[firstKey] != null);\n\n // Struct array\n if (firstKey === \"$contains\" && filter[firstKey] instanceof Object) {\n const structFilter: [string, any][] = Object.entries(filter[firstKey]);\n invariant(\n structFilter.length === 1,\n \"Cannot filter on more than one struct field in the same clause, need to use an and clause\",\n );\n const structFieldApiName = structFilter[0][0];\n\n return handleWherePair(structFilter[0], objectOrInterface, {\n propertyApiName: fieldName,\n structFieldApiName,\n });\n }\n\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey],\n },\n };\n }\n\n if (firstKey === \"$within\") {\n return makeGeoFilterWithin(filter[firstKey], propertyIdentifier, field);\n }\n if (firstKey === \"$intersects\") {\n return makeGeoFilterIntersects(filter[firstKey], propertyIdentifier, field);\n }\n\n if (firstKey === \"$containsAllTerms\" || firstKey === \"$containsAnyTerm\") {\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: typeof filter[firstKey] === \"string\"\n ? filter[firstKey]\n : filter[firstKey][\"term\"],\n fuzzy: typeof filter[firstKey] === \"string\"\n ? false\n : filter[firstKey][\"fuzzySearch\"] ?? false,\n };\n }\n\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey] as any,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA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terWithin","isAndClause","whereClause","$and","undefined","isOrClause","$or","isNotClause","$not","modernToLegacyWhereClause","objectOrInterface","rdpNames","parts","Object","entries","map","key","value","length","modernToLegacyWhereClauseInner","type","v","process","env","NODE_ENV","clause","handleWherePair","fieldName","filter","structFieldSelector","isRdp","has","propertyIdentifier","apiName","propertyApiName","field","keysOfFilter","keys","hasDollarSign","some","startsWith","structFilter","structFieldApiName","firstKey","containsValue","containsKeys","isFilterObject","substring","fuzzy"],"sources":["modernToLegacyWhereClause.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n AndWhereClause,\n NotWhereClause,\n ObjectOrInterfaceDefinition,\n OrWhereClause,\n PossibleWhereClauseFilters,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\n\nimport type {\n PropertyIdentifier,\n SearchJsonQueryV2,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { fullyQualifyPropName } from \"./fullyQualifyPropName.js\";\nimport { makeGeoFilterIntersects } from \"./makeGeoFilterIntersects.js\";\nimport { makeGeoFilterWithin } from \"./makeGeoFilterWithin.js\";\n\ntype DropDollarSign<T extends `$${string}`> = T extends `$${infer U}` ? U\n : never;\n\nfunction isAndClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is AndWhereClause<T, RDPs> {\n return \"$and\" in whereClause && whereClause.$and !== undefined;\n}\n\nfunction isOrClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is OrWhereClause<T, RDPs> {\n return \"$or\" in whereClause && whereClause.$or !== undefined;\n}\n\nfunction isNotClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n): whereClause is NotWhereClause<T, RDPs> {\n return \"$not\" in whereClause && whereClause.$not !== undefined;\n}\n\n/** @internal */\nexport function modernToLegacyWhereClause<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n objectOrInterface: T,\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n const parts = Object.entries(whereClause).map(([key, value]) => ({\n [key]: value,\n })) as WhereClause<T, RDPs>[];\n if (parts.length === 1) {\n return modernToLegacyWhereClauseInner(\n whereClause,\n objectOrInterface,\n rdpNames,\n );\n }\n return {\n type: \"and\",\n value: parts.map<SearchJsonQueryV2>(\n v => modernToLegacyWhereClauseInner(v, objectOrInterface, rdpNames),\n ),\n };\n}\n\n/** @internal */\nexport function modernToLegacyWhereClauseInner<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n whereClause: WhereClause<T, RDPs>,\n objectOrInterface: T,\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n const parts = Object.entries(whereClause);\n\n invariant(parts.length === 1, \"Invalid where clause provided.\");\n\n if (isAndClause(whereClause)) {\n return {\n type: \"and\",\n value: (whereClause.$and as WhereClause<T, RDPs>[]).map(\n (clause) =>\n modernToLegacyWhereClause(clause, objectOrInterface, rdpNames),\n ),\n };\n } else if (isOrClause(whereClause)) {\n return {\n type: \"or\",\n value: (whereClause.$or as WhereClause<T, RDPs>[]).map(\n (clause) =>\n modernToLegacyWhereClause(clause, objectOrInterface, rdpNames),\n ),\n };\n } else if (isNotClause(whereClause)) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(\n whereClause.$not as WhereClause<T, RDPs>,\n objectOrInterface,\n rdpNames,\n ),\n };\n }\n\n return handleWherePair(parts[0], objectOrInterface, undefined, rdpNames);\n}\n\nfunction handleWherePair(\n [fieldName, filter]: [string, any],\n objectOrInterface: ObjectOrInterfaceDefinition,\n structFieldSelector?: { propertyApiName: string; structFieldApiName: string },\n rdpNames?: Set<string>,\n): SearchJsonQueryV2 {\n invariant(\n filter != null,\n \"Defined key values are only allowed when they are not undefined.\",\n );\n\n const isRdp = !structFieldSelector && rdpNames?.has(fieldName);\n\n const propertyIdentifier: PropertyIdentifier | undefined = isRdp\n ? {\n type: \"property\",\n apiName: fieldName,\n }\n : structFieldSelector != null\n ? {\n type: \"structField\",\n ...structFieldSelector,\n propertyApiName: fullyQualifyPropName(\n structFieldSelector.propertyApiName,\n objectOrInterface,\n ),\n }\n : undefined;\n\n const field = !isRdp && structFieldSelector == null\n ? fullyQualifyPropName(fieldName, objectOrInterface)\n : undefined;\n\n invariant(\n field == null\n || propertyIdentifier == null && (field != null || isRdp != null),\n \"Encountered error constructing where clause: field and propertyIdentifier cannot both be defined\",\n );\n\n if (\n typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\"\n ) {\n return {\n type: \"eq\",\n ...(propertyIdentifier != null\n && { propertyIdentifier }),\n field,\n value: filter,\n };\n }\n\n const keysOfFilter = Object.keys(filter);\n\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(\n !hasDollarSign\n || keysOfFilter.length === 1,\n \"A WhereClause Filter with multiple clauses/fields is not allowed. Instead, use an 'or'/'and' clause to combine multiple filters.\",\n );\n\n // Struct\n if (!hasDollarSign) {\n const structFilter = Object.entries(filter);\n invariant(\n structFilter.length === 1,\n \"Cannot filter on more than one struct field in the same clause, need to use an and clause\",\n );\n const structFieldApiName = keysOfFilter[0];\n return handleWherePair(Object.entries(filter)[0], objectOrInterface, {\n propertyApiName: fieldName,\n structFieldApiName,\n }, rdpNames);\n }\n\n const firstKey = keysOfFilter[0] as PossibleWhereClauseFilters;\n invariant(filter[firstKey] != null);\n\n if (firstKey === \"$contains\" && filter[firstKey] instanceof Object) {\n const containsValue = filter[firstKey];\n const containsKeys = Object.keys(containsValue);\n\n const isFilterObject = containsKeys.some(key => key.startsWith(\"$\"));\n\n if (isFilterObject) {\n return handleWherePair(\n [fieldName, containsValue],\n objectOrInterface,\n structFieldSelector,\n rdpNames,\n );\n } else {\n const structFilter: [string, any][] = Object.entries(containsValue);\n invariant(\n structFilter.length === 1,\n \"Cannot filter on more than one struct field in the same clause, need to use an and clause\",\n );\n const structFieldApiName = structFilter[0][0];\n\n return handleWherePair(structFilter[0], objectOrInterface, {\n propertyApiName: fieldName,\n structFieldApiName,\n });\n }\n }\n\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey],\n },\n };\n }\n\n if (firstKey === \"$within\") {\n return makeGeoFilterWithin(filter[firstKey], propertyIdentifier, field);\n }\n if (firstKey === \"$intersects\") {\n return makeGeoFilterIntersects(filter[firstKey], propertyIdentifier, field);\n }\n\n if (firstKey === \"$containsAllTerms\" || firstKey === \"$containsAnyTerm\") {\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: typeof filter[firstKey] === \"string\"\n ? filter[firstKey]\n : filter[firstKey][\"term\"],\n fuzzy: typeof filter[firstKey] === \"string\"\n ? false\n : filter[firstKey][\"fuzzySearch\"] ?? false,\n };\n }\n\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey] as any,\n };\n}\n"],"mappings":"AAAA;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AAM,CAACe,QAAQ,CAAC,CAAC,aAAa,CAAC,IAAI;IACzC,CAAC;EACH;EAEA,OAAO;IACLvB,IAAI,EAAEuB,QAAQ,CAACI,SAAS,CAAC,CAAC,CAAoC;IAC9D,IAAIf,kBAAkB,IAAI,IAAI,IAAI;MAAEA;IAAmB,CAAC,CAAC;IACzDG,KAAK;IACLlB,KAAK,EAAEW,MAAM,CAACe,QAAQ;EACxB,CAAC;AACH","ignoreList":[]}
|
|
@@ -969,6 +969,80 @@ describe(modernToLegacyWhereClause, () => {
|
|
|
969
969
|
}
|
|
970
970
|
`);
|
|
971
971
|
});
|
|
972
|
+
it("converts primitive arrays with nested filters correctly", () => {
|
|
973
|
+
expect(modernToLegacyWhereClause({
|
|
974
|
+
integerArray: {
|
|
975
|
+
$contains: {
|
|
976
|
+
$lt: 5
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
980
|
+
{
|
|
981
|
+
"field": "integerArray",
|
|
982
|
+
"type": "lt",
|
|
983
|
+
"value": 5,
|
|
984
|
+
}
|
|
985
|
+
`);
|
|
986
|
+
expect(modernToLegacyWhereClause({
|
|
987
|
+
stringArray: {
|
|
988
|
+
$contains: {
|
|
989
|
+
$startsWith: "test"
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
993
|
+
{
|
|
994
|
+
"field": "stringArray",
|
|
995
|
+
"type": "startsWith",
|
|
996
|
+
"value": "test",
|
|
997
|
+
}
|
|
998
|
+
`);
|
|
999
|
+
expect(modernToLegacyWhereClause({
|
|
1000
|
+
booleanArray: {
|
|
1001
|
+
$contains: {
|
|
1002
|
+
$eq: true
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
1006
|
+
{
|
|
1007
|
+
"field": "booleanArray",
|
|
1008
|
+
"type": "eq",
|
|
1009
|
+
"value": true,
|
|
1010
|
+
}
|
|
1011
|
+
`);
|
|
1012
|
+
});
|
|
1013
|
+
it("converts primitive arrays with multiple nested filter conditions", () => {
|
|
1014
|
+
expect(modernToLegacyWhereClause({
|
|
1015
|
+
$and: [{
|
|
1016
|
+
integerArray: {
|
|
1017
|
+
$contains: {
|
|
1018
|
+
$gte: 1
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}, {
|
|
1022
|
+
integerArray: {
|
|
1023
|
+
$contains: {
|
|
1024
|
+
$lt: 10
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
}]
|
|
1028
|
+
}, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`
|
|
1029
|
+
{
|
|
1030
|
+
"type": "and",
|
|
1031
|
+
"value": [
|
|
1032
|
+
{
|
|
1033
|
+
"field": "integerArray",
|
|
1034
|
+
"type": "gte",
|
|
1035
|
+
"value": 1,
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
"field": "integerArray",
|
|
1039
|
+
"type": "lt",
|
|
1040
|
+
"value": 10,
|
|
1041
|
+
},
|
|
1042
|
+
],
|
|
1043
|
+
}
|
|
1044
|
+
`);
|
|
1045
|
+
});
|
|
972
1046
|
});
|
|
973
1047
|
describe("multiple checks", () => {
|
|
974
1048
|
it("properly handles multiple simple where checks", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modernToLegacyWhereClause.test.js","names":["BgaoNflPlayer","objectTypeWithAllPropertyTypes","expectType","describe","expect","it","modernToLegacyWhereClause","T","type","apiName","__DefinitionMetadata","properties","displayName","links","rid","description","undefined","r","$and","prop","$eq","prop2","innerProp1","toMatchInlineSnapshot","foo","geoPoint","$within","$bbox","$distance","$of","coordinates","$polygon","geoShape","$intersects","integer","$ne","string","$containsAllTerms","term","fuzzySearch","$containsAnyTerm","address","state","city","$or","gamesPlayed","$gt","addressArray","$contains","zipCode","$gte","location","decimal","result","$not","$in","boolean","mockObjectType","department","status","primaryKeyApiName","titleProperty","primaryKeyType","icon","visibility","pluralDisplayName","interfaceMap","inverseInterfaceMap","rdpNames","Set","reportCount","managerName"],"sources":["modernToLegacyWhereClause.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectOrInterfaceDefinition, WhereClause } from \"@osdk/api\";\nimport {\n BgaoNflPlayer,\n objectTypeWithAllPropertyTypes,\n} from \"@osdk/client.test.ontology\";\nimport type { Point } from \"geojson\";\nimport { expectType } from \"ts-expect\";\nimport { describe, expect, it } from \"vitest\";\nimport { modernToLegacyWhereClause } from \"./modernToLegacyWhereClause.js\";\n\ntype ObjAllProps = objectTypeWithAllPropertyTypes;\ntype structObj = BgaoNflPlayer;\ndescribe(modernToLegacyWhereClause, () => {\n describe(\"api namespaces\", () => {\n describe(\"interfaces\", () => {\n it(\"properly converts shortname to fqApiName\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"prop\": { type: \"integer\" },\n \"prop2\": {\n type: { \"innerProp1\": \"string\", \"innerProp2\": \"float\" },\n },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n description: undefined,\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n $and: [\n { prop: { $eq: 5 } },\n { prop2: { innerProp1: { $eq: \"myProp\" } } },\n ],\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"a.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"a.prop2\",\n \"structFieldApiName\": \"innerProp1\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"myProp\",\n },\n ],\n }\n `);\n });\n\n it(\"properly does not convert when interface has no apiNamespace\", () => {\n const T = {\n type: \"interface\",\n apiName: \"Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n \"c.prop2\": {\n type: { \"innerProp1\": \"string\", \"innerProp2\": \"float\" },\n },\n },\n apiName: \"Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n description: undefined,\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n \"b.prop\": 5,\n foo: 6,\n \"c.prop2\": { innerProp1: { $eq: \"myProp\" } },\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"foo\",\n \"type\": \"eq\",\n \"value\": 6,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"c.prop2\",\n \"structFieldApiName\": \"innerProp1\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"myProp\",\n },\n ],\n }\n `);\n });\n\n it(\"gracefully handles redundant apiNamespace in property\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n \"c.prop2\": {\n type: { \"innerProp1\": \"string\", \"innerProp2\": \"float\" },\n },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n description: undefined,\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n \"b.prop\": 5,\n \"a.foo\": 6,\n \"c.prop2\": { innerProp1: { $eq: \"myProp\" } },\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"a.foo\",\n \"type\": \"eq\",\n \"value\": 6,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"c.prop2\",\n \"structFieldApiName\": \"innerProp1\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"myProp\",\n },\n ],\n }\n `);\n });\n\n it(\"properly does not convert different apiNamespaces\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n description: undefined,\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n expect(modernToLegacyWhereClause({\n \"b.prop\": 5,\n }, T)).toMatchInlineSnapshot(`\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n }\n `);\n });\n });\n\n describe(\"objects\", () => {\n it(\"does not convert object short property names to fq\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n description: undefined,\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n const r = modernToLegacyWhereClause({\n prop: 5,\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"field\": \"a.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n }\n `);\n });\n });\n });\n\n describe(\"single checks\", () => {\n describe(\"$within\", () => {\n it(\"properly generates bbox shortcut\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: [-5, 5, -10, 10],\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates bbox long form\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: {\n $bbox: [-5, 5, -10, 10],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates within radius\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $distance: [5, \"km\"], $of: [-5, 5] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinDistanceOf\",\n \"value\": {\n \"center\": {\n \"coordinates\": [\n -5,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"distance\": {\n \"unit\": \"KILOMETERS\",\n \"value\": 5,\n },\n },\n }\n `);\n });\n\n it(\"properly generates within radius of geopoint\", async () => {\n // suppose you loaded an object with a geopoint field\n // and you want to find all objects within 5 km of that point\n const pointAsGeoJsonPoint: Point = {\n type: \"Point\",\n coordinates: [-5, 5],\n };\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $distance: [5, \"km\"], $of: pointAsGeoJsonPoint },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinDistanceOf\",\n \"value\": {\n \"center\": {\n \"coordinates\": [\n -5,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"distance\": {\n \"unit\": \"KILOMETERS\",\n \"value\": 5,\n },\n },\n }\n `);\n });\n\n it(\"properly generates within polygon\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n\n it(\"properly generates within polygon geojson\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n it(\"check types\", async () => {\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: [-5, 5, -10, 10],\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $distance: [2, \"centimeter\"], $of: [2, 2] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $bbox: [-5, 5, -10, 10] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n $bbox: [-5, 5, -10, 10],\n // @ts-expect-error\n $distance: [2, \"centimeter\"],\n // @ts-expect-error\n $of: [2, 2],\n },\n },\n });\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n $polygon: [[[0, 1], [3, 2], [0, 1]]],\n // @ts-expect-error\n $bbox: [2, 2, 2, 2],\n },\n },\n });\n });\n describe(\"$intersects\", () => {\n it(\"properly generates bbox shortcut\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: [-5, 5, -10, 10],\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n it(\"properly generates bbox long form\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: {\n $bbox: [-5, 5, -10, 10],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates intersects polygon\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n\n it(\"properly generates within polygon geojson\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n });\n\n it(\"inverts ne short hand properly\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n integer: { $ne: 5 },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"type\": \"not\",\n \"value\": {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n }\n `);\n });\n it(\"converts $containsAllTerms correctly if using new type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\", fuzzySearch: true } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": true,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\", fuzzySearch: false } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\" } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n });\n\n it(\"converts $containsAllTerms correctly if using old type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: \"test\" },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n });\n it(\"converts $containsAnyTerm correctly if using new type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\", fuzzySearch: true } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": true,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\", fuzzySearch: false } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\" } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n });\n\n it(\"converts $containsAnyTerm correctly if using old type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: \"test\" },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n });\n it(\"converts struct where clauses correctly\", () => {\n expect(modernToLegacyWhereClause<structObj>({\n address: { state: { $eq: \"NJ\" } },\n }, BgaoNflPlayer)).toMatchInlineSnapshot(`\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"state\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"NJ\",\n }\n `);\n\n expect(modernToLegacyWhereClause<structObj>({\n $and: [\n { address: { state: { $eq: \"NJ\" } } },\n { address: { city: { $containsAnyTerm: \"N\" } } },\n ],\n }, BgaoNflPlayer)).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"state\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"NJ\",\n },\n {\n \"field\": undefined,\n \"fuzzy\": false,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"city\",\n \"type\": \"structField\",\n },\n \"type\": \"containsAnyTerm\",\n \"value\": \"N\",\n },\n ],\n }\n `);\n\n expect(modernToLegacyWhereClause<structObj>({\n $or: [\n { address: { state: { $eq: \"NJ\" } } },\n { address: { city: { $containsAnyTerm: \"N\" } } },\n { gamesPlayed: { $gt: 5 } },\n ],\n }, BgaoNflPlayer)).toMatchInlineSnapshot(`\n {\n \"type\": \"or\",\n \"value\": [\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"state\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"NJ\",\n },\n {\n \"field\": undefined,\n \"fuzzy\": false,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"city\",\n \"type\": \"structField\",\n },\n \"type\": \"containsAnyTerm\",\n \"value\": \"N\",\n },\n {\n \"field\": \"gamesPlayed\",\n \"type\": \"gt\",\n \"value\": 5,\n },\n ],\n }\n `);\n });\n it(\"converts struct arrays correctly\", () => {\n expect(\n modernToLegacyWhereClause<structObj>({\n $and: [{\n addressArray: { $contains: { zipCode: { $gte: 10001 } } },\n }, {\n addressArray: {\n $contains: {\n location: {\n $within: [1, 2, 3, 4],\n },\n },\n },\n }],\n }, BgaoNflPlayer),\n )\n .toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"addressArray\",\n \"structFieldApiName\": \"zipCode\",\n \"type\": \"structField\",\n },\n \"type\": \"gte\",\n \"value\": 10001,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"addressArray\",\n \"structFieldApiName\": \"location\",\n \"type\": \"structField\",\n },\n \"type\": \"withinBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n 3,\n 2,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n 1,\n 4,\n ],\n \"type\": \"Point\",\n },\n },\n },\n ],\n }\n `);\n });\n });\n\n describe(\"multiple checks\", () => {\n it(\"properly handles multiple simple where checks\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n decimal: 5,\n integer: 10,\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n\n it(\"properly handles $and\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n $and: [{\n decimal: 5,\n }, {\n integer: 10,\n }],\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n\n it(\"properly handles $or\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n $or: [{\n decimal: 5,\n }, {\n integer: 10,\n }],\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"or\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n });\n });\n\n describe(\"mixed $ operators and regular properties\", () => {\n it(\"should handle $not operator with regular properties at top level\", () => {\n const whereClause: WhereClause<ObjAllProps> = {\n integer: { $eq: 5 },\n $not: { string: { $in: [\"a\", \"b\", \"c\"] } },\n };\n\n const result = modernToLegacyWhereClause(\n whereClause,\n objectTypeWithAllPropertyTypes,\n );\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"type\": \"not\",\n \"value\": {\n \"field\": \"string\",\n \"type\": \"in\",\n \"value\": [\n \"a\",\n \"b\",\n \"c\",\n ],\n },\n },\n ],\n }\n `);\n });\n\n it(\"should handle multiple regular properties with $not at top level\", () => {\n const whereClause: WhereClause<ObjAllProps> = {\n integer: 5,\n boolean: true,\n $not: { string: { $eq: \"excluded\" } },\n };\n\n const result = modernToLegacyWhereClause(\n whereClause,\n objectTypeWithAllPropertyTypes,\n );\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"boolean\",\n \"type\": \"eq\",\n \"value\": true,\n },\n {\n \"type\": \"not\",\n \"value\": {\n \"field\": \"string\",\n \"type\": \"eq\",\n \"value\": \"excluded\",\n },\n },\n ],\n }\n `);\n });\n });\n\n describe(\"RDP properties\", () => {\n type TestRDPs = {\n reportCount: \"integer\";\n managerName: \"string\";\n };\n\n const mockObjectType = {\n type: \"object\" as const,\n apiName: \"TestObject\",\n __DefinitionMetadata: {\n type: \"object\" as const,\n apiName: \"TestObject\",\n displayName: \"Test Object\",\n description: undefined,\n properties: {\n department: { type: \"string\" as const },\n status: { type: \"string\" as const },\n },\n rid: \"test-rid\",\n primaryKeyApiName: \"id\",\n titleProperty: \"department\",\n links: {},\n primaryKeyType: \"string\" as const,\n icon: undefined,\n visibility: undefined,\n pluralDisplayName: \"Test Objects\",\n status: undefined,\n interfaceMap: {},\n inverseInterfaceMap: {},\n },\n };\n\n it(\"should handle RDP properties at top level\", () => {\n const whereClause: WhereClause<typeof mockObjectType, TestRDPs> = {\n department: \"Engineering\",\n reportCount: { $gte: 5 },\n managerName: \"John\",\n };\n\n const rdpNames = new Set([\"reportCount\", \"managerName\"]);\n\n const result = modernToLegacyWhereClause(\n whereClause,\n mockObjectType,\n rdpNames,\n );\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"department\",\n \"type\": \"eq\",\n \"value\": \"Engineering\",\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"apiName\": \"reportCount\",\n \"type\": \"property\",\n },\n \"type\": \"gte\",\n \"value\": 5,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"apiName\": \"managerName\",\n \"type\": \"property\",\n },\n \"type\": \"eq\",\n \"value\": \"John\",\n },\n ],\n }\n `);\n });\n\n it(\"should handle RDP properties in $and clauses\", () => {\n const whereClause: WhereClause<typeof mockObjectType, TestRDPs> = {\n $and: [\n { department: \"Engineering\" },\n { reportCount: { $gte: 5 } },\n ],\n };\n\n const rdpNames = new Set([\"reportCount\"]);\n\n const result = modernToLegacyWhereClause(\n whereClause,\n mockObjectType,\n rdpNames,\n );\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"department\",\n \"type\": \"eq\",\n \"value\": \"Engineering\",\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"apiName\": \"reportCount\",\n \"type\": \"property\",\n },\n \"type\": \"gte\",\n \"value\": 5,\n },\n ],\n }\n `);\n });\n\n it(\"should handle complex nested structures with RDP\", () => {\n const whereClause: WhereClause<typeof mockObjectType, TestRDPs> = {\n department: \"Engineering\",\n $and: [\n {\n $or: [\n { status: \"active\" },\n { reportCount: { $gte: 10 } },\n ],\n },\n {\n managerName: { $ne: \"Admin\" },\n },\n ],\n };\n\n const rdpNames = new Set([\"reportCount\", \"managerName\"]);\n\n const result = modernToLegacyWhereClause(\n whereClause,\n mockObjectType,\n rdpNames,\n );\n\n // The actual structure flattens the nested $and differently\n expect(result).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"department\",\n \"type\": \"eq\",\n \"value\": \"Engineering\",\n },\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"type\": \"or\",\n \"value\": [\n {\n \"field\": \"status\",\n \"type\": \"eq\",\n \"value\": \"active\",\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"apiName\": \"reportCount\",\n \"type\": \"property\",\n },\n \"type\": \"gte\",\n \"value\": 10,\n },\n ],\n },\n {\n \"type\": \"not\",\n \"value\": {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"apiName\": \"managerName\",\n \"type\": \"property\",\n },\n \"type\": \"eq\",\n \"value\": \"Admin\",\n },\n },\n ],\n },\n ],\n }\n `);\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;QAEAnB,MAAM,CAACE,yBAAyB,CAAY;UAC1CsC,GAAG,EAAE,CACH;YAAEH,OAAO,EAAE;cAAEC,KAAK,EAAE;gBAAEtB,GAAG,EAAE;cAAK;YAAE;UAAE,CAAC,EACrC;YAAEqB,OAAO,EAAE;cAAEE,IAAI,EAAE;gBAAEH,gBAAgB,EAAE;cAAI;YAAE;UAAE,CAAC,EAChD;YAAEK,WAAW,EAAE;cAAEC,GAAG,EAAE;YAAE;UAAE,CAAC;QAE/B,CAAC,EAAE9C,aAAa,CAAC,CAAC,CAACuB,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;MACA,CAAC,CAAC;MACFlB,EAAE,CAAC,kCAAkC,EAAE,MAAM;QAC3CD,MAAM,CACJE,yBAAyB,CAAY;UACnCY,IAAI,EAAE,CAAC;YACL6B,YAAY,EAAE;cAAEC,SAAS,EAAE;gBAAEC,OAAO,EAAE;kBAAEC,IAAI,EAAE;gBAAM;cAAE;YAAE;UAC1D,CAAC,EAAE;YACDH,YAAY,EAAE;cACZC,SAAS,EAAE;gBACTG,QAAQ,EAAE;kBACRzB,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;gBACtB;cACF;YACF;UACF,CAAC;QACH,CAAC,EAAE1B,aAAa,CAClB,CAAC,CACEuB,qBAAqB,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IACJ,CAAC,CAAC;IAEFlB,EAAE,CAAC,kDAAkD,EAAE,MAAM;MAgB3D,MAAM+D,QAAQ,GAAG,IAAIC,GAAG,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;MAExD,MAAMhB,MAAM,GAAG/C,yBAAyB,CAjB0B;QAChEoD,UAAU,EAAE,aAAa;QACzBxC,IAAI,EAAE,CACJ;UACE0B,GAAG,EAAE,CACH;YAAEe,MAAM,EAAE;UAAS,CAAC,EACpB;YAAEW,WAAW,EAAE;cAAEpB,IAAI,EAAE;YAAG;UAAE,CAAC;QAEjC,CAAC,EACD;UACEqB,WAAW,EAAE;YAAEpC,GAAG,EAAE;UAAQ;QAC9B,CAAC;MAEL,CAAC,EAMCsB,cAAc,EACdW,QACF,CAAC;;MAED;MACAhE,MAAM,CAACiD,MAAM,CAAC,CAAC9B,qBAAqB,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"modernToLegacyWhereClause.test.js","names":["BgaoNflPlayer","objectTypeWithAllPropertyTypes","expectType","describe","expect","it","modernToLegacyWhereClause","T","type","apiName","__DefinitionMetadata","properties","displayName","links","rid","description","undefined","r","$and","prop","$eq","prop2","innerProp1","toMatchInlineSnapshot","foo","geoPoint","$within","$bbox","$distance","$of","coordinates","$polygon","geoShape","$intersects","integer","$ne","string","$containsAllTerms","term","fuzzySearch","$containsAnyTerm","address","state","city","$or","gamesPlayed","$gt","addressArray","$contains","zipCode","$gte","location","integerArray","$lt","stringArray","$startsWith","booleanArray","decimal","result","$not","$in","boolean","mockObjectType","department","status","primaryKeyApiName","titleProperty","primaryKeyType","icon","visibility","pluralDisplayName","interfaceMap","inverseInterfaceMap","rdpNames","Set","reportCount","managerName"],"sources":["modernToLegacyWhereClause.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectOrInterfaceDefinition, WhereClause } from \"@osdk/api\";\nimport {\n BgaoNflPlayer,\n objectTypeWithAllPropertyTypes,\n} from \"@osdk/client.test.ontology\";\nimport type { Point } from \"geojson\";\nimport { expectType } from \"ts-expect\";\nimport { describe, expect, it } from \"vitest\";\nimport { modernToLegacyWhereClause } from \"./modernToLegacyWhereClause.js\";\n\ntype ObjAllProps = objectTypeWithAllPropertyTypes;\ntype structObj = BgaoNflPlayer;\ndescribe(modernToLegacyWhereClause, () => {\n describe(\"api namespaces\", () => {\n describe(\"interfaces\", () => {\n it(\"properly converts shortname to fqApiName\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"prop\": { type: \"integer\" },\n \"prop2\": {\n type: { \"innerProp1\": \"string\", \"innerProp2\": \"float\" },\n },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n description: undefined,\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n $and: [\n { prop: { $eq: 5 } },\n { prop2: { innerProp1: { $eq: \"myProp\" } } },\n ],\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"a.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"a.prop2\",\n \"structFieldApiName\": \"innerProp1\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"myProp\",\n },\n ],\n }\n `);\n });\n\n it(\"properly does not convert when interface has no apiNamespace\", () => {\n const T = {\n type: \"interface\",\n apiName: \"Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n \"c.prop2\": {\n type: { \"innerProp1\": \"string\", \"innerProp2\": \"float\" },\n },\n },\n apiName: \"Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n description: undefined,\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n \"b.prop\": 5,\n foo: 6,\n \"c.prop2\": { innerProp1: { $eq: \"myProp\" } },\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"foo\",\n \"type\": \"eq\",\n \"value\": 6,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"c.prop2\",\n \"structFieldApiName\": \"innerProp1\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"myProp\",\n },\n ],\n }\n `);\n });\n\n it(\"gracefully handles redundant apiNamespace in property\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n \"c.prop2\": {\n type: { \"innerProp1\": \"string\", \"innerProp2\": \"float\" },\n },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n description: undefined,\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n const r = modernToLegacyWhereClause({\n \"b.prop\": 5,\n \"a.foo\": 6,\n \"c.prop2\": { innerProp1: { $eq: \"myProp\" } },\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"a.foo\",\n \"type\": \"eq\",\n \"value\": 6,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"c.prop2\",\n \"structFieldApiName\": \"innerProp1\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"myProp\",\n },\n ],\n }\n `);\n });\n\n it(\"properly does not convert different apiNamespaces\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"b.prop\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n description: undefined,\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n\n expect(modernToLegacyWhereClause({\n \"b.prop\": 5,\n }, T)).toMatchInlineSnapshot(`\n {\n \"field\": \"b.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n }\n `);\n });\n });\n\n describe(\"objects\", () => {\n it(\"does not convert object short property names to fq\", () => {\n const T = {\n type: \"interface\",\n apiName: \"a.Foo\",\n __DefinitionMetadata: {\n type: \"interface\",\n properties: {\n \"a.foo\": { type: \"integer\" },\n \"prop\": { type: \"integer\" },\n },\n apiName: \"a.Foo\",\n displayName: \"\",\n links: {},\n rid: \"\",\n description: undefined,\n },\n } as const satisfies ObjectOrInterfaceDefinition;\n const r = modernToLegacyWhereClause({\n prop: 5,\n }, T);\n\n expect(r).toMatchInlineSnapshot(`\n {\n \"field\": \"a.prop\",\n \"type\": \"eq\",\n \"value\": 5,\n }\n `);\n });\n });\n });\n\n describe(\"single checks\", () => {\n describe(\"$within\", () => {\n it(\"properly generates bbox shortcut\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: [-5, 5, -10, 10],\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates bbox long form\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: {\n $bbox: [-5, 5, -10, 10],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates within radius\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $distance: [5, \"km\"], $of: [-5, 5] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinDistanceOf\",\n \"value\": {\n \"center\": {\n \"coordinates\": [\n -5,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"distance\": {\n \"unit\": \"KILOMETERS\",\n \"value\": 5,\n },\n },\n }\n `);\n });\n\n it(\"properly generates within radius of geopoint\", async () => {\n // suppose you loaded an object with a geopoint field\n // and you want to find all objects within 5 km of that point\n const pointAsGeoJsonPoint: Point = {\n type: \"Point\",\n coordinates: [-5, 5],\n };\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $distance: [5, \"km\"], $of: pointAsGeoJsonPoint },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinDistanceOf\",\n \"value\": {\n \"center\": {\n \"coordinates\": [\n -5,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"distance\": {\n \"unit\": \"KILOMETERS\",\n \"value\": 5,\n },\n },\n }\n `);\n });\n\n it(\"properly generates within polygon\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n\n it(\"properly generates within polygon geojson\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoPoint: {\n $within: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoPoint\",\n \"type\": \"withinPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n it(\"check types\", async () => {\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: [-5, 5, -10, 10],\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $distance: [2, \"centimeter\"], $of: [2, 2] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: { $bbox: [-5, 5, -10, 10] },\n },\n });\n\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n $bbox: [-5, 5, -10, 10],\n // @ts-expect-error\n $distance: [2, \"centimeter\"],\n // @ts-expect-error\n $of: [2, 2],\n },\n },\n });\n expectType<WhereClause<ObjAllProps>>({\n geoPoint: {\n $within: {\n $polygon: [[[0, 1], [3, 2], [0, 1]]],\n // @ts-expect-error\n $bbox: [2, 2, 2, 2],\n },\n },\n });\n });\n describe(\"$intersects\", () => {\n it(\"properly generates bbox shortcut\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: [-5, 5, -10, 10],\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n it(\"properly generates bbox long form\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: {\n $bbox: [-5, 5, -10, 10],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n -10,\n 5,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n -5,\n 10,\n ],\n \"type\": \"Point\",\n },\n },\n }\n `);\n });\n\n it(\"properly generates intersects polygon\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: { $polygon: [[[0, 1], [3, 2], [0, 1]]] },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n\n it(\"properly generates within polygon geojson\", async () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n geoShape: {\n $intersects: {\n type: \"Polygon\",\n coordinates: [[[0, 1], [3, 2], [0, 1]]],\n },\n },\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"field\": \"geoShape\",\n \"type\": \"intersectsPolygon\",\n \"value\": {\n \"coordinates\": [\n [\n [\n 0,\n 1,\n ],\n [\n 3,\n 2,\n ],\n [\n 0,\n 1,\n ],\n ],\n ],\n \"type\": \"Polygon\",\n },\n }\n `);\n });\n });\n\n it(\"inverts ne short hand properly\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n integer: { $ne: 5 },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"type\": \"not\",\n \"value\": {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n }\n `);\n });\n it(\"converts $containsAllTerms correctly if using new type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\", fuzzySearch: true } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": true,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\", fuzzySearch: false } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: { term: \"test\" } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n });\n\n it(\"converts $containsAllTerms correctly if using old type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAllTerms: \"test\" },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAllTerms\",\n \"value\": \"test\",\n }\n `);\n });\n it(\"converts $containsAnyTerm correctly if using new type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\", fuzzySearch: true } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": true,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\", fuzzySearch: false } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: { term: \"test\" } },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n });\n\n it(\"converts $containsAnyTerm correctly if using old type\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>({\n string: { $containsAnyTerm: \"test\" },\n }, objectTypeWithAllPropertyTypes)).toMatchInlineSnapshot(`\n {\n \"field\": \"string\",\n \"fuzzy\": false,\n \"type\": \"containsAnyTerm\",\n \"value\": \"test\",\n }\n `);\n });\n it(\"converts struct where clauses correctly\", () => {\n expect(modernToLegacyWhereClause<structObj>({\n address: { state: { $eq: \"NJ\" } },\n }, BgaoNflPlayer)).toMatchInlineSnapshot(`\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"state\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"NJ\",\n }\n `);\n\n expect(modernToLegacyWhereClause<structObj>({\n $and: [\n { address: { state: { $eq: \"NJ\" } } },\n { address: { city: { $containsAnyTerm: \"N\" } } },\n ],\n }, BgaoNflPlayer)).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"state\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"NJ\",\n },\n {\n \"field\": undefined,\n \"fuzzy\": false,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"city\",\n \"type\": \"structField\",\n },\n \"type\": \"containsAnyTerm\",\n \"value\": \"N\",\n },\n ],\n }\n `);\n\n expect(modernToLegacyWhereClause<structObj>({\n $or: [\n { address: { state: { $eq: \"NJ\" } } },\n { address: { city: { $containsAnyTerm: \"N\" } } },\n { gamesPlayed: { $gt: 5 } },\n ],\n }, BgaoNflPlayer)).toMatchInlineSnapshot(`\n {\n \"type\": \"or\",\n \"value\": [\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"state\",\n \"type\": \"structField\",\n },\n \"type\": \"eq\",\n \"value\": \"NJ\",\n },\n {\n \"field\": undefined,\n \"fuzzy\": false,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"address\",\n \"structFieldApiName\": \"city\",\n \"type\": \"structField\",\n },\n \"type\": \"containsAnyTerm\",\n \"value\": \"N\",\n },\n {\n \"field\": \"gamesPlayed\",\n \"type\": \"gt\",\n \"value\": 5,\n },\n ],\n }\n `);\n });\n it(\"converts struct arrays correctly\", () => {\n expect(\n modernToLegacyWhereClause<structObj>({\n $and: [{\n addressArray: { $contains: { zipCode: { $gte: 10001 } } },\n }, {\n addressArray: {\n $contains: {\n location: {\n $within: [1, 2, 3, 4],\n },\n },\n },\n }],\n }, BgaoNflPlayer),\n )\n .toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"addressArray\",\n \"structFieldApiName\": \"zipCode\",\n \"type\": \"structField\",\n },\n \"type\": \"gte\",\n \"value\": 10001,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"propertyApiName\": \"addressArray\",\n \"structFieldApiName\": \"location\",\n \"type\": \"structField\",\n },\n \"type\": \"withinBoundingBox\",\n \"value\": {\n \"bottomRight\": {\n \"coordinates\": [\n 3,\n 2,\n ],\n \"type\": \"Point\",\n },\n \"topLeft\": {\n \"coordinates\": [\n 1,\n 4,\n ],\n \"type\": \"Point\",\n },\n },\n },\n ],\n }\n `);\n });\n\n it(\"converts primitive arrays with nested filters correctly\", () => {\n expect(\n modernToLegacyWhereClause<ObjAllProps>({\n integerArray: { $contains: { $lt: 5 } },\n }, objectTypeWithAllPropertyTypes),\n ).toMatchInlineSnapshot(`\n {\n \"field\": \"integerArray\",\n \"type\": \"lt\",\n \"value\": 5,\n }\n `);\n\n expect(\n modernToLegacyWhereClause<ObjAllProps>({\n stringArray: { $contains: { $startsWith: \"test\" } },\n }, objectTypeWithAllPropertyTypes),\n ).toMatchInlineSnapshot(`\n {\n \"field\": \"stringArray\",\n \"type\": \"startsWith\",\n \"value\": \"test\",\n }\n `);\n\n expect(\n modernToLegacyWhereClause<ObjAllProps>({\n booleanArray: { $contains: { $eq: true } },\n }, objectTypeWithAllPropertyTypes),\n ).toMatchInlineSnapshot(`\n {\n \"field\": \"booleanArray\",\n \"type\": \"eq\",\n \"value\": true,\n }\n `);\n });\n\n it(\"converts primitive arrays with multiple nested filter conditions\", () => {\n expect(\n modernToLegacyWhereClause<ObjAllProps>({\n $and: [\n { integerArray: { $contains: { $gte: 1 } } },\n { integerArray: { $contains: { $lt: 10 } } },\n ],\n }, objectTypeWithAllPropertyTypes),\n ).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"integerArray\",\n \"type\": \"gte\",\n \"value\": 1,\n },\n {\n \"field\": \"integerArray\",\n \"type\": \"lt\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n });\n\n describe(\"multiple checks\", () => {\n it(\"properly handles multiple simple where checks\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n decimal: 5,\n integer: 10,\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n\n it(\"properly handles $and\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n $and: [{\n decimal: 5,\n }, {\n integer: 10,\n }],\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n\n it(\"properly handles $or\", () => {\n expect(modernToLegacyWhereClause<ObjAllProps>(\n {\n $or: [{\n decimal: 5,\n }, {\n integer: 10,\n }],\n },\n objectTypeWithAllPropertyTypes,\n )).toMatchInlineSnapshot(`\n {\n \"type\": \"or\",\n \"value\": [\n {\n \"field\": \"decimal\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 10,\n },\n ],\n }\n `);\n });\n });\n });\n\n describe(\"mixed $ operators and regular properties\", () => {\n it(\"should handle $not operator with regular properties at top level\", () => {\n const whereClause: WhereClause<ObjAllProps> = {\n integer: { $eq: 5 },\n $not: { string: { $in: [\"a\", \"b\", \"c\"] } },\n };\n\n const result = modernToLegacyWhereClause(\n whereClause,\n objectTypeWithAllPropertyTypes,\n );\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"type\": \"not\",\n \"value\": {\n \"field\": \"string\",\n \"type\": \"in\",\n \"value\": [\n \"a\",\n \"b\",\n \"c\",\n ],\n },\n },\n ],\n }\n `);\n });\n\n it(\"should handle multiple regular properties with $not at top level\", () => {\n const whereClause: WhereClause<ObjAllProps> = {\n integer: 5,\n boolean: true,\n $not: { string: { $eq: \"excluded\" } },\n };\n\n const result = modernToLegacyWhereClause(\n whereClause,\n objectTypeWithAllPropertyTypes,\n );\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"integer\",\n \"type\": \"eq\",\n \"value\": 5,\n },\n {\n \"field\": \"boolean\",\n \"type\": \"eq\",\n \"value\": true,\n },\n {\n \"type\": \"not\",\n \"value\": {\n \"field\": \"string\",\n \"type\": \"eq\",\n \"value\": \"excluded\",\n },\n },\n ],\n }\n `);\n });\n });\n\n describe(\"RDP properties\", () => {\n type TestRDPs = {\n reportCount: \"integer\";\n managerName: \"string\";\n };\n\n const mockObjectType = {\n type: \"object\" as const,\n apiName: \"TestObject\",\n __DefinitionMetadata: {\n type: \"object\" as const,\n apiName: \"TestObject\",\n displayName: \"Test Object\",\n description: undefined,\n properties: {\n department: { type: \"string\" as const },\n status: { type: \"string\" as const },\n },\n rid: \"test-rid\",\n primaryKeyApiName: \"id\",\n titleProperty: \"department\",\n links: {},\n primaryKeyType: \"string\" as const,\n icon: undefined,\n visibility: undefined,\n pluralDisplayName: \"Test Objects\",\n status: undefined,\n interfaceMap: {},\n inverseInterfaceMap: {},\n },\n };\n\n it(\"should handle RDP properties at top level\", () => {\n const whereClause: WhereClause<typeof mockObjectType, TestRDPs> = {\n department: \"Engineering\",\n reportCount: { $gte: 5 },\n managerName: \"John\",\n };\n\n const rdpNames = new Set([\"reportCount\", \"managerName\"]);\n\n const result = modernToLegacyWhereClause(\n whereClause,\n mockObjectType,\n rdpNames,\n );\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"department\",\n \"type\": \"eq\",\n \"value\": \"Engineering\",\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"apiName\": \"reportCount\",\n \"type\": \"property\",\n },\n \"type\": \"gte\",\n \"value\": 5,\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"apiName\": \"managerName\",\n \"type\": \"property\",\n },\n \"type\": \"eq\",\n \"value\": \"John\",\n },\n ],\n }\n `);\n });\n\n it(\"should handle RDP properties in $and clauses\", () => {\n const whereClause: WhereClause<typeof mockObjectType, TestRDPs> = {\n $and: [\n { department: \"Engineering\" },\n { reportCount: { $gte: 5 } },\n ],\n };\n\n const rdpNames = new Set([\"reportCount\"]);\n\n const result = modernToLegacyWhereClause(\n whereClause,\n mockObjectType,\n rdpNames,\n );\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"department\",\n \"type\": \"eq\",\n \"value\": \"Engineering\",\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"apiName\": \"reportCount\",\n \"type\": \"property\",\n },\n \"type\": \"gte\",\n \"value\": 5,\n },\n ],\n }\n `);\n });\n\n it(\"should handle complex nested structures with RDP\", () => {\n const whereClause: WhereClause<typeof mockObjectType, TestRDPs> = {\n department: \"Engineering\",\n $and: [\n {\n $or: [\n { status: \"active\" },\n { reportCount: { $gte: 10 } },\n ],\n },\n {\n managerName: { $ne: \"Admin\" },\n },\n ],\n };\n\n const rdpNames = new Set([\"reportCount\", \"managerName\"]);\n\n const result = modernToLegacyWhereClause(\n whereClause,\n mockObjectType,\n rdpNames,\n );\n\n // The actual structure flattens the nested $and differently\n expect(result).toMatchInlineSnapshot(`\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"field\": \"department\",\n \"type\": \"eq\",\n \"value\": \"Engineering\",\n },\n {\n \"type\": \"and\",\n \"value\": [\n {\n \"type\": \"or\",\n \"value\": [\n {\n \"field\": \"status\",\n \"type\": \"eq\",\n \"value\": \"active\",\n },\n {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"apiName\": \"reportCount\",\n \"type\": \"property\",\n },\n \"type\": \"gte\",\n \"value\": 10,\n },\n ],\n },\n {\n \"type\": \"not\",\n \"value\": {\n \"field\": undefined,\n \"propertyIdentifier\": {\n \"apiName\": \"managerName\",\n \"type\": \"property\",\n },\n \"type\": \"eq\",\n \"value\": \"Admin\",\n },\n },\n ],\n },\n ],\n }\n `);\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SACEA,aAAa,EACbC,8BAA8B,QACzB,4BAA4B;AAEnC,SAASC,UAAU,QAAQ,WAAW;AACtC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,yBAAyB,QAAQ,gCAAgC;AAI1EH,QAAQ,CAACG,yBAAyB,EAAE,MAAM;EACxCH,QAAQ,CAAC,g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zB7C,IAAI,EAAE,CACJ;UACE0B,GAAG,EAAE,CACH;YAAEoB,MAAM,EAAE;UAAS,CAAC,EACpB;YAAEW,WAAW,EAAE;cAAEzB,IAAI,EAAE;YAAG;UAAE,CAAC;QAEjC,CAAC,EACD;UACE0B,WAAW,EAAE;YAAEzC,GAAG,EAAE;UAAQ;QAC9B,CAAC;MAEL,CAAC,EAMC2B,cAAc,EACdW,QACF,CAAC;;MAED;MACArE,MAAM,CAACsD,MAAM,CAAC,CAACnC,qBAAqB,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -35,7 +35,7 @@ export function evaluateFilter(f, realValue, expected, strict) {
|
|
|
35
35
|
case "$ne":
|
|
36
36
|
return realValue !== expected;
|
|
37
37
|
case "$in":
|
|
38
|
-
return expected
|
|
38
|
+
return Array.isArray(expected) && expected.includes(realValue);
|
|
39
39
|
case "$isNull":
|
|
40
40
|
return realValue == null;
|
|
41
41
|
case "$startsWith":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluateFilter.js","names":["invariant","evaluateFilter","f","realValue","expected","strict","
|
|
1
|
+
{"version":3,"file":"evaluateFilter.js","names":["invariant","evaluateFilter","f","realValue","expected","strict","Array","isArray","includes","startsWith","process","env","NODE_ENV"],"sources":["evaluateFilter.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PossibleWhereClauseFilters } from \"@osdk/api\";\nimport invariant from \"tiny-invariant\";\n\n/**\n * Evaluates a where clause filter against a value.\n * This is a runtime evaluation function that handles different property types.\n */\nexport function evaluateFilter(\n f: PossibleWhereClauseFilters,\n realValue: any,\n expected: any,\n strict: boolean,\n): boolean {\n switch (f) {\n case \"$eq\":\n return realValue === expected;\n case \"$gt\":\n return realValue > expected;\n case \"$lt\":\n return realValue < expected;\n case \"$gte\":\n return realValue >= expected;\n case \"$lte\":\n return realValue <= expected;\n case \"$ne\":\n return realValue !== expected;\n case \"$in\":\n return Array.isArray(expected) && expected.includes(realValue);\n case \"$isNull\":\n return realValue == null;\n case \"$startsWith\":\n return realValue.startsWith(expected);\n case \"$contains\":\n case \"$containsAllTerms\":\n case \"$containsAllTermsInOrder\":\n case \"$containsAnyTerm\":\n case \"$intersects\":\n case \"$within\":\n // for these we will strictly say no and loosely say yes\n // so that they don't change things now but may if reloaded\n return !strict;\n\n default:\n // same thing here as the above cases but we will catch the\n // exhaustive check in dev\n if (process.env.NODE_ENV !== \"production\") {\n const exhaustive: never = f;\n invariant(false, `Unknown where filter ${f}`);\n }\n return !strict;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;;AAEtC;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAC5BC,CAA6B,EAC7BC,SAAc,EACdC,QAAa,EACbC,MAAe,EACN;EACT,QAAQH,CAAC;IACP,KAAK,KAAK;MACR,OAAOC,SAAS,KAAKC,QAAQ;IAC/B,KAAK,KAAK;MACR,OAAOD,SAAS,GAAGC,QAAQ;IAC7B,KAAK,KAAK;MACR,OAAOD,SAAS,GAAGC,QAAQ;IAC7B,KAAK,MAAM;MACT,OAAOD,SAAS,IAAIC,QAAQ;IAC9B,KAAK,MAAM;MACT,OAAOD,SAAS,IAAIC,QAAQ;IAC9B,KAAK,KAAK;MACR,OAAOD,SAAS,KAAKC,QAAQ;IAC/B,KAAK,KAAK;MACR,OAAOE,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,IAAIA,QAAQ,CAACI,QAAQ,CAACL,SAAS,CAAC;IAChE,KAAK,SAAS;MACZ,OAAOA,SAAS,IAAI,IAAI;IAC1B,KAAK,aAAa;MAChB,OAAOA,SAAS,CAACM,UAAU,CAACL,QAAQ,CAAC;IACvC,KAAK,WAAW;IAChB,KAAK,mBAAmB;IACxB,KAAK,0BAA0B;IAC/B,KAAK,kBAAkB;IACvB,KAAK,aAAa;IAClB,KAAK,SAAS;MACZ;MACA;MACA,OAAO,CAACC,MAAM;IAEhB;MACE;MACA;MACA,IAAIK,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;QAEzCF,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAZ,SAAS,QAAQ,wBAAwBE,CAAC,EAAE,IAA5CF,SAAS;MACX;MACA,OAAO,CAACK,MAAM;EAClB;AACF","ignoreList":[]}
|