@svadmin/directus 0.11.20 → 0.11.22
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/package.json +2 -2
- package/src/data-provider.ts +8 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/directus",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.22",
|
|
4
4
|
"description": "Directus DataProvider for svadmin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@svadmin/core": "^0.
|
|
23
|
+
"@svadmin/core": "^0.71.0"
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"repository": {
|
package/src/data-provider.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { definedOptions } from '@svadmin/core/options';
|
|
2
2
|
import { withValidatedResponses, type DataTransport } from '@svadmin/core/schema';
|
|
3
|
+
import { assertFiltersExecutable } from '@svadmin/core/provider-filters';
|
|
3
4
|
import type {
|
|
4
5
|
CrudOperator,
|
|
5
6
|
DataProvider,
|
|
@@ -11,22 +12,20 @@ import type {
|
|
|
11
12
|
const DIRECTUS_OPERATOR_MAP: Partial<Record<CrudOperator, string>> = {
|
|
12
13
|
eq: '_eq',
|
|
13
14
|
ne: '_neq',
|
|
14
|
-
eqs: '_eq',
|
|
15
|
-
nes: '_neq',
|
|
16
15
|
lt: '_lt',
|
|
17
16
|
gt: '_gt',
|
|
18
17
|
lte: '_lte',
|
|
19
18
|
gte: '_gte',
|
|
20
|
-
contains: '
|
|
21
|
-
ncontains: '
|
|
19
|
+
contains: '_icontains',
|
|
20
|
+
ncontains: '_nicontains',
|
|
22
21
|
containss: '_contains',
|
|
23
22
|
ncontainss: '_ncontains',
|
|
24
|
-
startswith: '
|
|
25
|
-
nstartswith: '
|
|
23
|
+
startswith: '_istarts_with',
|
|
24
|
+
nstartswith: '_nistarts_with',
|
|
26
25
|
startswiths: '_starts_with',
|
|
27
26
|
nstartswiths: '_nstarts_with',
|
|
28
|
-
endswith: '
|
|
29
|
-
nendswith: '
|
|
27
|
+
endswith: '_iends_with',
|
|
28
|
+
nendswith: '_niends_with',
|
|
30
29
|
endswiths: '_ends_with',
|
|
31
30
|
nendswiths: '_nends_with',
|
|
32
31
|
in: '_in',
|
|
@@ -101,6 +100,7 @@ function buildDirectusRule(filter: Filter): Record<string, unknown> {
|
|
|
101
100
|
|
|
102
101
|
function buildDirectusFilter(filters?: Filter[]): Record<string, unknown> {
|
|
103
102
|
if (!filters?.length) return {};
|
|
103
|
+
assertFiltersExecutable('directus', filters);
|
|
104
104
|
const rules = filters.map(buildDirectusRule);
|
|
105
105
|
const firstRule = rules[0];
|
|
106
106
|
return rules.length === 1 && firstRule ? firstRule : { _and: rules };
|