@objectstack/objectql 3.0.9 → 3.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -491,6 +491,7 @@ SchemaRegistry.namespaceRegistry = /* @__PURE__ */ new Map();
491
491
  SchemaRegistry.metadata = /* @__PURE__ */ new Map();
492
492
 
493
493
  // src/protocol.ts
494
+ import { parseFilterAST, isFilterAST } from "@objectstack/spec/data";
494
495
  function simpleHash(str) {
495
496
  let hash = 0;
496
497
  for (let i = 0; i < str.length; i++) {
@@ -717,18 +718,18 @@ var ObjectStackProtocolImplementation = class {
717
718
  options.sort = parsed;
718
719
  delete options.orderBy;
719
720
  }
721
+ if (options.filters !== void 0 && options.filter === void 0) {
722
+ options.filter = options.filters;
723
+ }
724
+ delete options.filters;
720
725
  if (typeof options.filter === "string") {
721
726
  try {
722
727
  options.filter = JSON.parse(options.filter);
723
728
  } catch {
724
729
  }
725
730
  }
726
- if (typeof options.filters === "string") {
727
- try {
728
- options.filter = JSON.parse(options.filters);
729
- delete options.filters;
730
- } catch {
731
- }
731
+ if (isFilterAST(options.filter)) {
732
+ options.filter = parseFilterAST(options.filter);
732
733
  }
733
734
  if (typeof options.populate === "string") {
734
735
  options.populate = options.populate.split(",").map((s) => s.trim()).filter(Boolean);