@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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +18 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/protocol.ts +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/objectql",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Isomorphic ObjectQL Engine for ObjectStack",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@objectstack/core": "3.0.
|
|
17
|
-
"@objectstack/spec": "3.0.
|
|
18
|
-
"@objectstack/types": "3.0.
|
|
16
|
+
"@objectstack/core": "3.0.11",
|
|
17
|
+
"@objectstack/spec": "3.0.11",
|
|
18
|
+
"@objectstack/types": "3.0.11"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"typescript": "^5.0.0",
|
package/src/protocol.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
} from '@objectstack/spec/api';
|
|
11
11
|
import type { MetadataCacheRequest, MetadataCacheResponse, ServiceInfo, ApiRoutes, WellKnownCapabilities } from '@objectstack/spec/api';
|
|
12
12
|
import type { IFeedService } from '@objectstack/spec/contracts';
|
|
13
|
+
import { parseFilterAST, isFilterAST } from '@objectstack/spec/data';
|
|
13
14
|
|
|
14
15
|
// We import SchemaRegistry directly since this class lives in the same package
|
|
15
16
|
import { SchemaRegistry } from './registry.js';
|
|
@@ -303,12 +304,22 @@ export class ObjectStackProtocolImplementation implements ObjectStackProtocol {
|
|
|
303
304
|
delete options.orderBy;
|
|
304
305
|
}
|
|
305
306
|
|
|
307
|
+
// Filter: normalize `filter`/`filters` (plural) → `filter` (singular, canonical)
|
|
308
|
+
// Accept both `filter` and `filters` for backward compatibility.
|
|
309
|
+
if (options.filters !== undefined && options.filter === undefined) {
|
|
310
|
+
options.filter = options.filters;
|
|
311
|
+
}
|
|
312
|
+
delete options.filters;
|
|
313
|
+
|
|
306
314
|
// Filter: JSON string → object
|
|
307
315
|
if (typeof options.filter === 'string') {
|
|
308
316
|
try { options.filter = JSON.parse(options.filter); } catch { /* keep as-is */ }
|
|
309
317
|
}
|
|
310
|
-
|
|
311
|
-
|
|
318
|
+
|
|
319
|
+
// Filter AST array → FilterCondition object
|
|
320
|
+
// Converts ["and", ["field", "=", "val"], ...] to { $and: [{ field: "val" }, ...] }
|
|
321
|
+
if (isFilterAST(options.filter)) {
|
|
322
|
+
options.filter = parseFilterAST(options.filter);
|
|
312
323
|
}
|
|
313
324
|
|
|
314
325
|
// Populate: comma-separated string → array
|