@ahoo-wang/wow-client 10.0.0-beta.1 → 10.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/README.zh-CN.md +1 -1
- package/dist/commands.cjs +1 -1
- package/dist/commands.cjs.map +1 -1
- package/dist/commands.d.cts +1 -8
- package/dist/commands.d.ts +1 -8
- package/dist/commands.es.js +45 -51
- package/dist/commands.es.js.map +1 -1
- package/dist/dsl/aggregation/admit.cjs +1 -1
- package/dist/dsl/aggregation/admit.cjs.map +1 -1
- package/dist/dsl/aggregation/admit.es.js +73 -69
- package/dist/dsl/aggregation/admit.es.js.map +1 -1
- package/dist/dsl/aggregation/aliases.cjs +2 -0
- package/dist/dsl/aggregation/aliases.cjs.map +1 -0
- package/dist/dsl/aggregation/aliases.d.cts +2 -0
- package/dist/dsl/aggregation/aliases.d.ts +2 -0
- package/dist/dsl/aggregation/aliases.es.js +13 -0
- package/dist/dsl/aggregation/aliases.es.js.map +1 -0
- package/dist/dsl/aggregation/builders.cjs +1 -1
- package/dist/dsl/aggregation/builders.cjs.map +1 -1
- package/dist/dsl/aggregation/builders.d.cts +17 -243
- package/dist/dsl/aggregation/builders.d.ts +17 -243
- package/dist/dsl/aggregation/builders.es.js +36 -171
- package/dist/dsl/aggregation/builders.es.js.map +1 -1
- package/dist/dsl/aggregation/derived.cjs +1 -1
- package/dist/dsl/aggregation/derived.cjs.map +1 -1
- package/dist/dsl/aggregation/derived.d.cts +123 -1
- package/dist/dsl/aggregation/derived.d.ts +123 -1
- package/dist/dsl/aggregation/derived.es.js +43 -28
- package/dist/dsl/aggregation/derived.es.js.map +1 -1
- package/dist/dsl/aggregation/groups.cjs +2 -0
- package/dist/dsl/aggregation/groups.cjs.map +1 -0
- package/dist/dsl/aggregation/groups.d.cts +325 -0
- package/dist/dsl/aggregation/groups.d.ts +325 -0
- package/dist/dsl/aggregation/groups.es.js +80 -0
- package/dist/dsl/aggregation/groups.es.js.map +1 -0
- package/dist/dsl/aggregation/having.cjs +1 -1
- package/dist/dsl/aggregation/having.cjs.map +1 -1
- package/dist/dsl/aggregation/having.d.cts +63 -1
- package/dist/dsl/aggregation/having.d.ts +63 -1
- package/dist/dsl/aggregation/having.es.js +33 -30
- package/dist/dsl/aggregation/having.es.js.map +1 -1
- package/dist/dsl/aggregation/index.d.cts +4 -2
- package/dist/dsl/aggregation/index.d.ts +4 -2
- package/dist/dsl/aggregation/metrics.cjs +2 -0
- package/dist/dsl/aggregation/metrics.cjs.map +1 -0
- package/dist/dsl/aggregation/metrics.d.cts +279 -0
- package/dist/dsl/aggregation/metrics.d.ts +279 -0
- package/dist/dsl/aggregation/metrics.es.js +75 -0
- package/dist/dsl/aggregation/metrics.es.js.map +1 -0
- package/dist/dsl/aggregation/types.cjs +1 -1
- package/dist/dsl/aggregation/types.cjs.map +1 -1
- package/dist/dsl/aggregation/types.d.cts +4 -524
- package/dist/dsl/aggregation/types.d.ts +4 -524
- package/dist/dsl/aggregation/types.es.js +5 -25
- package/dist/dsl/aggregation/types.es.js.map +1 -1
- package/dist/dsl/cursorQuery.cjs +1 -1
- package/dist/dsl/cursorQuery.cjs.map +1 -1
- package/dist/dsl/cursorQuery.d.cts +18 -7
- package/dist/dsl/cursorQuery.d.ts +18 -7
- package/dist/dsl/cursorQuery.es.js +13 -12
- package/dist/dsl/cursorQuery.es.js.map +1 -1
- package/dist/dsl/descriptor.cjs +1 -1
- package/dist/dsl/descriptor.cjs.map +1 -1
- package/dist/dsl/descriptor.d.cts +17 -379
- package/dist/dsl/descriptor.d.ts +17 -379
- package/dist/dsl/descriptor.es.js +4 -31
- package/dist/dsl/descriptor.es.js.map +1 -1
- package/dist/dsl/fieldDescriptor.cjs +2 -0
- package/dist/dsl/fieldDescriptor.cjs.map +1 -0
- package/dist/dsl/fieldDescriptor.d.cts +246 -0
- package/dist/dsl/fieldDescriptor.d.ts +246 -0
- package/dist/dsl/fieldDescriptor.es.js +24 -0
- package/dist/dsl/fieldDescriptor.es.js.map +1 -0
- package/dist/dsl/filter/builders.cjs +1 -1
- package/dist/dsl/filter/builders.cjs.map +1 -1
- package/dist/dsl/filter/builders.d.cts +7 -949
- package/dist/dsl/filter/builders.d.ts +7 -949
- package/dist/dsl/filter/builders.es.js +14 -285
- package/dist/dsl/filter/builders.es.js.map +1 -1
- package/dist/dsl/filter/expressionFilter.cjs +2 -0
- package/dist/dsl/filter/expressionFilter.cjs.map +1 -0
- package/dist/dsl/filter/expressionFilter.d.cts +35 -0
- package/dist/dsl/filter/expressionFilter.d.ts +35 -0
- package/dist/dsl/filter/expressionFilter.es.js +18 -0
- package/dist/dsl/filter/expressionFilter.es.js.map +1 -0
- package/dist/dsl/filter/fieldFilters.cjs +2 -0
- package/dist/dsl/filter/fieldFilters.cjs.map +1 -0
- package/dist/dsl/filter/fieldFilters.d.cts +297 -0
- package/dist/dsl/filter/fieldFilters.d.ts +297 -0
- package/dist/dsl/filter/fieldFilters.es.js +110 -0
- package/dist/dsl/filter/fieldFilters.es.js.map +1 -0
- package/dist/dsl/filter/index.d.cts +2 -1
- package/dist/dsl/filter/index.d.ts +2 -1
- package/dist/dsl/filter/logicalFilters.cjs +2 -0
- package/dist/dsl/filter/logicalFilters.cjs.map +1 -0
- package/dist/dsl/filter/logicalFilters.d.cts +109 -0
- package/dist/dsl/filter/logicalFilters.d.ts +109 -0
- package/dist/dsl/filter/logicalFilters.es.js +36 -0
- package/dist/dsl/filter/logicalFilters.es.js.map +1 -0
- package/dist/dsl/filter/metadataFilters.cjs +2 -0
- package/dist/dsl/filter/metadataFilters.cjs.map +1 -0
- package/dist/dsl/filter/metadataFilters.d.cts +132 -0
- package/dist/dsl/filter/metadataFilters.d.ts +132 -0
- package/dist/dsl/filter/metadataFilters.es.js +56 -0
- package/dist/dsl/filter/metadataFilters.es.js.map +1 -0
- package/dist/dsl/filter/operator.cjs +1 -1
- package/dist/dsl/filter/operator.cjs.map +1 -1
- package/dist/dsl/filter/operator.d.cts +11 -9
- package/dist/dsl/filter/operator.d.ts +11 -9
- package/dist/dsl/filter/operator.es.js +1 -1
- package/dist/dsl/filter/operator.es.js.map +1 -1
- package/dist/dsl/filter/searchFilter.cjs +2 -0
- package/dist/dsl/filter/searchFilter.cjs.map +1 -0
- package/dist/dsl/filter/searchFilter.d.cts +39 -0
- package/dist/dsl/filter/searchFilter.d.ts +39 -0
- package/dist/dsl/filter/searchFilter.es.js +19 -0
- package/dist/dsl/filter/searchFilter.es.js.map +1 -0
- package/dist/dsl/filter/timeFilters.cjs +2 -0
- package/dist/dsl/filter/timeFilters.cjs.map +1 -0
- package/dist/dsl/filter/timeFilters.d.cts +290 -0
- package/dist/dsl/filter/timeFilters.d.ts +290 -0
- package/dist/dsl/filter/timeFilters.es.js +89 -0
- package/dist/dsl/filter/timeFilters.es.js.map +1 -0
- package/dist/dsl/filter/types.d.cts +4 -14
- package/dist/dsl/filter/types.d.ts +4 -14
- package/dist/dsl/filter/validate.cjs +1 -1
- package/dist/dsl/filter/validate.cjs.map +1 -1
- package/dist/dsl/filter/validate.d.cts +2 -4
- package/dist/dsl/filter/validate.d.ts +2 -4
- package/dist/dsl/filter/validate.es.js +25 -31
- package/dist/dsl/filter/validate.es.js.map +1 -1
- package/dist/dsl/queryErrorCodes.cjs +1 -1
- package/dist/dsl/queryErrorCodes.cjs.map +1 -1
- package/dist/dsl/queryErrorCodes.d.cts +0 -2
- package/dist/dsl/queryErrorCodes.d.ts +0 -2
- package/dist/dsl/queryErrorCodes.es.js +0 -1
- package/dist/dsl/queryErrorCodes.es.js.map +1 -1
- package/dist/dsl/queryFilter.cjs +2 -0
- package/dist/dsl/queryFilter.cjs.map +1 -0
- package/dist/dsl/queryFilter.d.cts +3 -0
- package/dist/dsl/queryFilter.d.ts +3 -0
- package/dist/dsl/queryFilter.es.js +9 -0
- package/dist/dsl/queryFilter.es.js.map +1 -0
- package/dist/dsl/queryable.cjs +1 -1
- package/dist/dsl/queryable.cjs.map +1 -1
- package/dist/dsl/queryable.es.js +12 -16
- package/dist/dsl/queryable.es.js.map +1 -1
- package/dist/dsl/semanticTypes.cjs +2 -0
- package/dist/dsl/semanticTypes.cjs.map +1 -0
- package/dist/dsl/semanticTypes.d.cts +128 -0
- package/dist/dsl/semanticTypes.d.ts +128 -0
- package/dist/dsl/semanticTypes.es.js +13 -0
- package/dist/dsl/semanticTypes.es.js.map +1 -0
- package/dist/dsl.cjs +1 -1
- package/dist/dsl.d.cts +2 -0
- package/dist/dsl.d.ts +2 -0
- package/dist/dsl.es.js +14 -8
- package/dist/exactJson.cjs +2 -2
- package/dist/exactJson.cjs.map +1 -1
- package/dist/exactJson.d.cts +41 -16
- package/dist/exactJson.d.ts +41 -16
- package/dist/exactJson.es.js +104 -102
- package/dist/exactJson.es.js.map +1 -1
- package/dist/frameworkErrors.cjs.map +1 -1
- package/dist/frameworkErrors.d.cts +4 -4
- package/dist/frameworkErrors.d.ts +4 -4
- package/dist/frameworkErrors.es.js.map +1 -1
- package/dist/http.cjs +1 -1
- package/dist/http.cjs.map +1 -1
- package/dist/http.d.cts +29 -9
- package/dist/http.d.ts +29 -9
- package/dist/http.es.js +24 -19
- package/dist/http.es.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.es.js +12 -12
- package/dist/manifest.cjs +1 -1
- package/dist/manifest.cjs.map +1 -1
- package/dist/manifest.d.cts +24 -0
- package/dist/manifest.d.ts +24 -0
- package/dist/manifest.es.js +34 -6
- package/dist/manifest.es.js.map +1 -1
- package/dist/manifestTypes.d.cts +16 -1
- package/dist/manifestTypes.d.ts +16 -1
- package/dist/queries.cjs +1 -1
- package/dist/queries.cjs.map +1 -1
- package/dist/queries.d.cts +18 -8
- package/dist/queries.d.ts +18 -8
- package/dist/queries.es.js +46 -35
- package/dist/queries.es.js.map +1 -1
- package/dist/routes.cjs +1 -1
- package/dist/routes.cjs.map +1 -1
- package/dist/routes.d.cts +16 -3
- package/dist/routes.d.ts +16 -3
- package/dist/routes.es.js +24 -25
- package/dist/routes.es.js.map +1 -1
- package/dist/state.cjs +1 -1
- package/dist/state.cjs.map +1 -1
- package/dist/state.d.cts +21 -19
- package/dist/state.d.ts +21 -19
- package/dist/state.es.js +27 -22
- package/dist/state.es.js.map +1 -1
- package/dist/streams.cjs +1 -1
- package/dist/streams.cjs.map +1 -1
- package/dist/streams.d.cts +14 -7
- package/dist/streams.d.ts +14 -7
- package/dist/streams.es.js +65 -50
- package/dist/streams.es.js.map +1 -1
- package/dist/testing/wire.cjs +1 -1
- package/dist/testing/wire.cjs.map +1 -1
- package/dist/testing/wire.es.js +1 -1
- package/dist/testing/wire.es.js.map +1 -1
- package/dist/wait.cjs +1 -1
- package/dist/wait.cjs.map +1 -1
- package/dist/wait.d.cts +17 -4
- package/dist/wait.d.ts +17 -4
- package/dist/wait.es.js +36 -34
- package/dist/wait.es.js.map +1 -1
- package/dist/wire.cjs +1 -1
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +75 -31
- package/dist/wire.d.ts +75 -31
- package/dist/wire.es.js +1 -3
- package/dist/wire.es.js.map +1 -1
- package/package.json +5 -5
- package/dist/dsl/filter/datePattern.cjs +0 -2
- package/dist/dsl/filter/datePattern.cjs.map +0 -1
- package/dist/dsl/filter/datePattern.d.cts +0 -8
- package/dist/dsl/filter/datePattern.d.ts +0 -8
- package/dist/dsl/filter/datePattern.es.js +0 -96
- package/dist/dsl/filter/datePattern.es.js.map +0 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { DeletionState } from '../deletionState.js';
|
|
2
|
+
import { DeletionFilter, MatchFilter, MetadataValueFilter, MetadataValuesFilter } from './types.js';
|
|
3
|
+
/** The filters on what Wow knows of every record: all or none, its ids, tenant, owner and space, and its deletion state. */
|
|
4
|
+
export declare const metadataFilters: {
|
|
5
|
+
/**
|
|
6
|
+
* Matches every record in the query scope.
|
|
7
|
+
*
|
|
8
|
+
* @returns `{ op: 'match-all' }`.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* filter.matchAll();
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
matchAll(): MatchFilter;
|
|
15
|
+
/**
|
|
16
|
+
* Matches no record.
|
|
17
|
+
*
|
|
18
|
+
* @returns `{ op: 'match-none' }`.
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* filter.matchNone();
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
matchNone(): MatchFilter;
|
|
25
|
+
/**
|
|
26
|
+
* Matches the record whose record ID equals `value`. Root-only: not allowed
|
|
27
|
+
* inside `elementMatch`.
|
|
28
|
+
*
|
|
29
|
+
* @param value - The record ID.
|
|
30
|
+
* @returns `{ op: 'id', value }`.
|
|
31
|
+
* @throws TypeError If `value` is not a string.
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* filter.id('order-1');
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
id(value: string): MetadataValueFilter;
|
|
38
|
+
/**
|
|
39
|
+
* Matches records whose record ID is one of `values`. Root-only: not
|
|
40
|
+
* allowed inside `elementMatch`.
|
|
41
|
+
*
|
|
42
|
+
* @param values - Non-empty list of record IDs.
|
|
43
|
+
* @returns `{ op: 'ids', values }` with a copy of `values`.
|
|
44
|
+
* @throws TypeError If `values` is empty, contains `null` or `undefined`,
|
|
45
|
+
* or contains a non-string.
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* filter.ids(['order-1', 'order-2']);
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
ids(values: readonly string[]): MetadataValuesFilter;
|
|
52
|
+
/**
|
|
53
|
+
* Matches the record whose aggregate ID equals `value`. Root-only: not allowed
|
|
54
|
+
* inside `elementMatch`.
|
|
55
|
+
*
|
|
56
|
+
* @param value - The aggregate ID.
|
|
57
|
+
* @returns `{ op: 'aggregate-id', value }`.
|
|
58
|
+
* @throws TypeError If `value` is not a string.
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* filter.aggregateId('order-1');
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
aggregateId(value: string): MetadataValueFilter;
|
|
65
|
+
/**
|
|
66
|
+
* Matches records whose aggregate ID is one of `values`. Root-only: not
|
|
67
|
+
* allowed inside `elementMatch`.
|
|
68
|
+
*
|
|
69
|
+
* @param values - Non-empty list of aggregate IDs.
|
|
70
|
+
* @returns `{ op: 'aggregate-ids', values }` with a copy of `values`.
|
|
71
|
+
* @throws TypeError If `values` is empty, contains `null` or `undefined`,
|
|
72
|
+
* or contains a non-string.
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* filter.aggregateIds(['order-1', 'order-2']);
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
aggregateIds(values: readonly string[]): MetadataValuesFilter;
|
|
79
|
+
/**
|
|
80
|
+
* Matches the record whose tenant ID equals `value`. Root-only: not allowed
|
|
81
|
+
* inside `elementMatch`.
|
|
82
|
+
*
|
|
83
|
+
* @param value - The tenant ID.
|
|
84
|
+
* @returns `{ op: 'tenant-id', value }`.
|
|
85
|
+
* @throws TypeError If `value` is not a string.
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* filter.tenantId('tenant-a');
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
tenantId(value: string): MetadataValueFilter;
|
|
92
|
+
/**
|
|
93
|
+
* Matches the record whose owner ID equals `value`. Root-only: not allowed
|
|
94
|
+
* inside `elementMatch`.
|
|
95
|
+
*
|
|
96
|
+
* @param value - The owner ID.
|
|
97
|
+
* @returns `{ op: 'owner-id', value }`.
|
|
98
|
+
* @throws TypeError If `value` is not a string.
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* filter.ownerId('user-1');
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
ownerId(value: string): MetadataValueFilter;
|
|
105
|
+
/**
|
|
106
|
+
* Matches the record whose space ID equals `value`. Root-only: not allowed
|
|
107
|
+
* inside `elementMatch`.
|
|
108
|
+
*
|
|
109
|
+
* @param value - The space ID.
|
|
110
|
+
* @returns `{ op: 'space-id', value }`.
|
|
111
|
+
* @throws TypeError If `value` is not a string.
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* filter.spaceId('space-1');
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
spaceId(value: string): MetadataValueFilter;
|
|
118
|
+
/**
|
|
119
|
+
* Matches snapshots by deletion state. An explicit `DELETION` at the root or
|
|
120
|
+
* in a root `AND` replaces the gateway's default `ACTIVE` scope. Root-only:
|
|
121
|
+
* not allowed inside `elementMatch`.
|
|
122
|
+
*
|
|
123
|
+
* @param state - `ACTIVE`, `DELETED` or `ALL`.
|
|
124
|
+
* @returns `{ op: 'deletion', state }`.
|
|
125
|
+
* @throws TypeError If `state` is not a {@link DeletionState} member.
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* filter.deletion(DeletionState.ALL);
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
deletion(state: DeletionState): DeletionFilter;
|
|
132
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { FilterOperator as e } from "./operator.es.js";
|
|
2
|
+
import { constantName as t } from "../constantName.es.js";
|
|
3
|
+
import { requireNonEmpty as n, requiredString as r } from "./validate.es.js";
|
|
4
|
+
import { DeletionState as i } from "../deletionState.es.js";
|
|
5
|
+
// src/dsl/filter/metadataFilters.ts
|
|
6
|
+
function a(e, n) {
|
|
7
|
+
return {
|
|
8
|
+
op: e,
|
|
9
|
+
value: r(`${t(e)} value`, n)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function o(e, i) {
|
|
13
|
+
return n(`${t(e)} values`, i), i.forEach((n) => r(`${t(e)} value`, n)), {
|
|
14
|
+
op: e,
|
|
15
|
+
values: [...i]
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
var s = {
|
|
19
|
+
matchAll() {
|
|
20
|
+
return { op: e.MATCH_ALL };
|
|
21
|
+
},
|
|
22
|
+
matchNone() {
|
|
23
|
+
return { op: e.MATCH_NONE };
|
|
24
|
+
},
|
|
25
|
+
id(t) {
|
|
26
|
+
return a(e.ID, t);
|
|
27
|
+
},
|
|
28
|
+
ids(t) {
|
|
29
|
+
return o(e.IDS, t);
|
|
30
|
+
},
|
|
31
|
+
aggregateId(t) {
|
|
32
|
+
return a(e.AGGREGATE_ID, t);
|
|
33
|
+
},
|
|
34
|
+
aggregateIds(t) {
|
|
35
|
+
return o(e.AGGREGATE_IDS, t);
|
|
36
|
+
},
|
|
37
|
+
tenantId(t) {
|
|
38
|
+
return a(e.TENANT_ID, t);
|
|
39
|
+
},
|
|
40
|
+
ownerId(t) {
|
|
41
|
+
return a(e.OWNER_ID, t);
|
|
42
|
+
},
|
|
43
|
+
spaceId(t) {
|
|
44
|
+
return a(e.SPACE_ID, t);
|
|
45
|
+
},
|
|
46
|
+
deletion(t) {
|
|
47
|
+
if (t !== i.ACTIVE && t !== i.DELETED && t !== i.ALL) throw TypeError(`Deletion state is invalid: [${String(t)}].`);
|
|
48
|
+
return {
|
|
49
|
+
op: e.DELETION,
|
|
50
|
+
state: t
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export { s as metadataFilters };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=metadataFilters.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadataFilters.es.js","names":["metadataValue","requiredString","constantName","op","value","metadataValues","requireNonEmpty","values","metadataFilters","FilterOperator","state","DeletionState"],"sources":["../../../src/dsl/filter/metadataFilters.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\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 * http://www.apache.org/licenses/LICENSE-2.0\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 { constantName } from '../constantName.js';\nimport { DeletionState } from '../deletionState.js';\nimport { FilterOperator } from './operator.js';\nimport type {\n DeletionFilter,\n MatchFilter,\n MetadataValueFilter,\n MetadataValuesFilter,\n} from './types.js';\nimport { requireNonEmpty, requiredString } from './validate.js';\n\nfunction metadataValue(\n op: MetadataValueFilter['op'],\n value: string,\n): MetadataValueFilter {\n return { op, value: requiredString(`${constantName(op)} value`, value) };\n}\n\nfunction metadataValues(\n op: MetadataValuesFilter['op'],\n values: readonly string[],\n): MetadataValuesFilter {\n requireNonEmpty(`${constantName(op)} values`, values);\n values.forEach(value => requiredString(`${constantName(op)} value`, value));\n return { op, values: [...values] };\n}\n\n/** The filters on what Wow knows of every record: all or none, its ids, tenant, owner and space, and its deletion state. */\nexport const metadataFilters = {\n /**\n * Matches every record in the query scope.\n *\n * @returns `{ op: 'match-all' }`.\n * @example\n * ```typescript\n * filter.matchAll();\n * ```\n */\n matchAll(): MatchFilter {\n return { op: FilterOperator.MATCH_ALL };\n },\n /**\n * Matches no record.\n *\n * @returns `{ op: 'match-none' }`.\n * @example\n * ```typescript\n * filter.matchNone();\n * ```\n */\n matchNone(): MatchFilter {\n return { op: FilterOperator.MATCH_NONE };\n },\n /**\n * Matches the record whose record ID equals `value`. Root-only: not allowed\n * inside `elementMatch`.\n *\n * @param value - The record ID.\n * @returns `{ op: 'id', value }`.\n * @throws TypeError If `value` is not a string.\n * @example\n * ```typescript\n * filter.id('order-1');\n * ```\n */\n id(value: string): MetadataValueFilter {\n return metadataValue(FilterOperator.ID, value);\n },\n /**\n * Matches records whose record ID is one of `values`. Root-only: not\n * allowed inside `elementMatch`.\n *\n * @param values - Non-empty list of record IDs.\n * @returns `{ op: 'ids', values }` with a copy of `values`.\n * @throws TypeError If `values` is empty, contains `null` or `undefined`,\n * or contains a non-string.\n * @example\n * ```typescript\n * filter.ids(['order-1', 'order-2']);\n * ```\n */\n ids(values: readonly string[]): MetadataValuesFilter {\n return metadataValues(FilterOperator.IDS, values);\n },\n /**\n * Matches the record whose aggregate ID equals `value`. Root-only: not allowed\n * inside `elementMatch`.\n *\n * @param value - The aggregate ID.\n * @returns `{ op: 'aggregate-id', value }`.\n * @throws TypeError If `value` is not a string.\n * @example\n * ```typescript\n * filter.aggregateId('order-1');\n * ```\n */\n aggregateId(value: string): MetadataValueFilter {\n return metadataValue(FilterOperator.AGGREGATE_ID, value);\n },\n /**\n * Matches records whose aggregate ID is one of `values`. Root-only: not\n * allowed inside `elementMatch`.\n *\n * @param values - Non-empty list of aggregate IDs.\n * @returns `{ op: 'aggregate-ids', values }` with a copy of `values`.\n * @throws TypeError If `values` is empty, contains `null` or `undefined`,\n * or contains a non-string.\n * @example\n * ```typescript\n * filter.aggregateIds(['order-1', 'order-2']);\n * ```\n */\n aggregateIds(values: readonly string[]): MetadataValuesFilter {\n return metadataValues(FilterOperator.AGGREGATE_IDS, values);\n },\n /**\n * Matches the record whose tenant ID equals `value`. Root-only: not allowed\n * inside `elementMatch`.\n *\n * @param value - The tenant ID.\n * @returns `{ op: 'tenant-id', value }`.\n * @throws TypeError If `value` is not a string.\n * @example\n * ```typescript\n * filter.tenantId('tenant-a');\n * ```\n */\n tenantId(value: string): MetadataValueFilter {\n return metadataValue(FilterOperator.TENANT_ID, value);\n },\n /**\n * Matches the record whose owner ID equals `value`. Root-only: not allowed\n * inside `elementMatch`.\n *\n * @param value - The owner ID.\n * @returns `{ op: 'owner-id', value }`.\n * @throws TypeError If `value` is not a string.\n * @example\n * ```typescript\n * filter.ownerId('user-1');\n * ```\n */\n ownerId(value: string): MetadataValueFilter {\n return metadataValue(FilterOperator.OWNER_ID, value);\n },\n /**\n * Matches the record whose space ID equals `value`. Root-only: not allowed\n * inside `elementMatch`.\n *\n * @param value - The space ID.\n * @returns `{ op: 'space-id', value }`.\n * @throws TypeError If `value` is not a string.\n * @example\n * ```typescript\n * filter.spaceId('space-1');\n * ```\n */\n spaceId(value: string): MetadataValueFilter {\n return metadataValue(FilterOperator.SPACE_ID, value);\n },\n /**\n * Matches snapshots by deletion state. An explicit `DELETION` at the root or\n * in a root `AND` replaces the gateway's default `ACTIVE` scope. Root-only:\n * not allowed inside `elementMatch`.\n *\n * @param state - `ACTIVE`, `DELETED` or `ALL`.\n * @returns `{ op: 'deletion', state }`.\n * @throws TypeError If `state` is not a {@link DeletionState} member.\n * @example\n * ```typescript\n * filter.deletion(DeletionState.ALL);\n * ```\n */\n deletion(state: DeletionState): DeletionFilter {\n if (\n state !== DeletionState.ACTIVE &&\n state !== DeletionState.DELETED &&\n state !== DeletionState.ALL\n ) {\n throw new TypeError(`Deletion state is invalid: [${String(state)}].`);\n }\n return { op: FilterOperator.DELETION, state };\n },\n};\n"],"mappings":";;;;;AAwBA,SAASA,EACP,GACA,GACqB;CACrB,OAAO;EAAE;EAAI,OAAOC,EAAe,GAAGC,EAAaC,CAAE,EAAE,SAASC,CAAK;CAAE;AACzE;AAEA,SAASC,EACP,GACA,GACsB;CAGtB,OAFAC,EAAgB,GAAGJ,EAAaC,CAAE,EAAE,UAAUI,CAAM,GACpDA,EAAO,SAAQ,MAASN,EAAe,GAAGC,EAAaC,CAAE,EAAE,SAASC,CAAK,CAAC,GACnE;EAAE;EAAI,QAAQ,CAAC,GAAGG,CAAM;CAAE;AACnC;AAGA,IAAaC,IAAkB;CAU7B,WAAwB;EACtB,OAAO,EAAE,IAAIC,EAAe,UAAU;CACxC;CAUA,YAAyB;EACvB,OAAO,EAAE,IAAIA,EAAe,WAAW;CACzC;CAaA,GAAG,GAAoC;EACrC,OAAOT,EAAcS,EAAe,IAAIL,CAAK;CAC/C;CAcA,IAAI,GAAiD;EACnD,OAAOC,EAAeI,EAAe,KAAKF,CAAM;CAClD;CAaA,YAAY,GAAoC;EAC9C,OAAOP,EAAcS,EAAe,cAAcL,CAAK;CACzD;CAcA,aAAa,GAAiD;EAC5D,OAAOC,EAAeI,EAAe,eAAeF,CAAM;CAC5D;CAaA,SAAS,GAAoC;EAC3C,OAAOP,EAAcS,EAAe,WAAWL,CAAK;CACtD;CAaA,QAAQ,GAAoC;EAC1C,OAAOJ,EAAcS,EAAe,UAAUL,CAAK;CACrD;CAaA,QAAQ,GAAoC;EAC1C,OAAOJ,EAAcS,EAAe,UAAUL,CAAK;CACrD;CAcA,SAAS,GAAsC;EAC7C,IACEM,MAAUC,EAAc,UACxBD,MAAUC,EAAc,WACxBD,MAAUC,EAAc,KAExB,MAAU,UAAU,+BAA+B,OAAOD,CAAK,EAAE,GAAG;EAEtE,OAAO;GAAE,IAAID,EAAe;GAAU;EAAM;CAC9C;AACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=function(e){return e.MATCH_ALL=`match-all`,e.MATCH_NONE=`match-none`,e.ID=`id`,e.IDS=`ids`,e.AGGREGATE_ID=`aggregate-id`,e.AGGREGATE_IDS=`aggregate-ids`,e.TENANT_ID=`tenant-id`,e.OWNER_ID=`owner-id`,e.SPACE_ID=`space-id`,e.AND=`and`,e.OR=`or`,e.NOR=`nor`,e.EQ=`eq`,e.NE=`ne`,e.GT=`gt`,e.GTE=`gte`,e.LT=`lt`,e.LTE=`lte`,e.CONTAINS=`contains`,e.STARTS_WITH=`starts-with`,e.ENDS_WITH=`ends-with`,e.IN=`in`,e.NOT_IN=`not-in`,e.BETWEEN=`between`,e.CONTAINS_ALL=`contains-all`,e.IS_EMPTY=`is-empty`,e.IS_EMPTY_STRING=`is-empty-string`,e.IS_NOT_EMPTY_STRING=`is-not-empty-string`,e.IS_NULL=`is-null`,e.IS_NOT_NULL=`is-not-null`,e.EXISTS=`exists`,e.NOT_EXISTS=`not-exists`,e.DELETION=`deletion`,e.ELEMENT_MATCH=`element-match`,e.SEARCH=`search`,e.TODAY=`today`,e.BEFORE_TODAY=`before-today`,e.TOMORROW=`tomorrow`,e.THIS_WEEK=`this-week`,e.NEXT_WEEK=`next-week`,e.LAST_WEEK=`last-week`,e.THIS_MONTH=`this-month`,e.LAST_MONTH=`last-month`,e.YESTERDAY=`yesterday`,e.NEXT_MONTH=`next-month`,e.LAST_YEAR=`last-year`,e.THIS_YEAR=`this-year`,e.NEXT_YEAR=`next-year`,e.RECENT_DAYS=`recent-days`,e.EARLIER_DAYS=`earlier-days`,e.BEFORE_NOW=`before-now`,e.AFTER_NOW=`after-now`,e.EXPRESSION=`expression`,e}({}),t=function(e){return e.CASE_SENSITIVE=`case-sensitive`,e.CASE_INSENSITIVE=`case-insensitive`,e}({}),n=function(e){return e.TERMS=`terms`,e.PHRASE=`phrase`,e}({}),r=function(e){return e.NANOSECONDS=`
|
|
1
|
+
var e=function(e){return e.MATCH_ALL=`match-all`,e.MATCH_NONE=`match-none`,e.ID=`id`,e.IDS=`ids`,e.AGGREGATE_ID=`aggregate-id`,e.AGGREGATE_IDS=`aggregate-ids`,e.TENANT_ID=`tenant-id`,e.OWNER_ID=`owner-id`,e.SPACE_ID=`space-id`,e.AND=`and`,e.OR=`or`,e.NOR=`nor`,e.EQ=`eq`,e.NE=`ne`,e.GT=`gt`,e.GTE=`gte`,e.LT=`lt`,e.LTE=`lte`,e.CONTAINS=`contains`,e.STARTS_WITH=`starts-with`,e.ENDS_WITH=`ends-with`,e.IN=`in`,e.NOT_IN=`not-in`,e.BETWEEN=`between`,e.CONTAINS_ALL=`contains-all`,e.IS_EMPTY=`is-empty`,e.IS_EMPTY_STRING=`is-empty-string`,e.IS_NOT_EMPTY_STRING=`is-not-empty-string`,e.IS_NULL=`is-null`,e.IS_NOT_NULL=`is-not-null`,e.EXISTS=`exists`,e.NOT_EXISTS=`not-exists`,e.DELETION=`deletion`,e.ELEMENT_MATCH=`element-match`,e.SEARCH=`search`,e.TODAY=`today`,e.BEFORE_TODAY=`before-today`,e.TOMORROW=`tomorrow`,e.THIS_WEEK=`this-week`,e.NEXT_WEEK=`next-week`,e.LAST_WEEK=`last-week`,e.THIS_MONTH=`this-month`,e.LAST_MONTH=`last-month`,e.YESTERDAY=`yesterday`,e.NEXT_MONTH=`next-month`,e.LAST_YEAR=`last-year`,e.THIS_YEAR=`this-year`,e.NEXT_YEAR=`next-year`,e.RECENT_DAYS=`recent-days`,e.EARLIER_DAYS=`earlier-days`,e.BEFORE_NOW=`before-now`,e.AFTER_NOW=`after-now`,e.EXPRESSION=`expression`,e}({}),t=function(e){return e.CASE_SENSITIVE=`case-sensitive`,e.CASE_INSENSITIVE=`case-insensitive`,e}({}),n=function(e){return e.TERMS=`terms`,e.PHRASE=`phrase`,e}({}),r=function(e){return e.NANOSECONDS=`nanoseconds`,e.MICROSECONDS=`microseconds`,e.MILLISECONDS=`milliseconds`,e.SECONDS=`seconds`,e.MINUTES=`minutes`,e.HOURS=`hours`,e.DAYS=`days`,e}({});exports.FilterOperator=e,exports.SearchMode=n,exports.StringComparison=t,exports.TimeUnit=r;
|
|
2
2
|
//# sourceMappingURL=operator.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.cjs","names":["FilterOperator","\"MATCH_ALL\"","\"MATCH_NONE\"","\"ID\"","\"IDS\"","\"AGGREGATE_ID\"","\"AGGREGATE_IDS\"","\"TENANT_ID\"","\"OWNER_ID\"","\"SPACE_ID\"","\"AND\"","\"OR\"","\"NOR\"","\"EQ\"","\"NE\"","\"GT\"","\"GTE\"","\"LT\"","\"LTE\"","\"CONTAINS\"","\"STARTS_WITH\"","\"ENDS_WITH\"","\"IN\"","\"NOT_IN\"","\"BETWEEN\"","\"CONTAINS_ALL\"","\"IS_EMPTY\"","\"IS_EMPTY_STRING\"","\"IS_NOT_EMPTY_STRING\"","\"IS_NULL\"","\"IS_NOT_NULL\"","\"EXISTS\"","\"NOT_EXISTS\"","\"DELETION\"","\"ELEMENT_MATCH\"","\"SEARCH\"","\"TODAY\"","\"BEFORE_TODAY\"","\"TOMORROW\"","\"THIS_WEEK\"","\"NEXT_WEEK\"","\"LAST_WEEK\"","\"THIS_MONTH\"","\"LAST_MONTH\"","\"YESTERDAY\"","\"NEXT_MONTH\"","\"LAST_YEAR\"","\"THIS_YEAR\"","\"NEXT_YEAR\"","\"RECENT_DAYS\"","\"EARLIER_DAYS\"","\"BEFORE_NOW\"","\"AFTER_NOW\"","\"EXPRESSION\"","StringComparison","\"CASE_SENSITIVE\"","\"CASE_INSENSITIVE\"","SearchMode","\"TERMS\"","\"PHRASE\"","TimeUnit","\"NANOSECONDS\"","\"MICROSECONDS\"","\"MILLISECONDS\"","\"SECONDS\"","\"MINUTES\"","\"HOURS\"","\"DAYS\""],"sources":["../../../src/dsl/filter/operator.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\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 * http://www.apache.org/licenses/LICENSE-2.0\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\n/**\n * Discriminator sent as the `op` property of every filter expression. The\n * values match the server-side `FilterOperator` enum.\n */\nexport enum FilterOperator {\n MATCH_ALL = 'match-all',\n MATCH_NONE = 'match-none',\n ID = 'id',\n IDS = 'ids',\n AGGREGATE_ID = 'aggregate-id',\n AGGREGATE_IDS = 'aggregate-ids',\n TENANT_ID = 'tenant-id',\n OWNER_ID = 'owner-id',\n SPACE_ID = 'space-id',\n AND = 'and',\n OR = 'or',\n NOR = 'nor',\n EQ = 'eq',\n NE = 'ne',\n GT = 'gt',\n GTE = 'gte',\n LT = 'lt',\n LTE = 'lte',\n CONTAINS = 'contains',\n STARTS_WITH = 'starts-with',\n ENDS_WITH = 'ends-with',\n IN = 'in',\n NOT_IN = 'not-in',\n BETWEEN = 'between',\n CONTAINS_ALL = 'contains-all',\n IS_EMPTY = 'is-empty',\n IS_EMPTY_STRING = 'is-empty-string',\n IS_NOT_EMPTY_STRING = 'is-not-empty-string',\n IS_NULL = 'is-null',\n IS_NOT_NULL = 'is-not-null',\n EXISTS = 'exists',\n NOT_EXISTS = 'not-exists',\n DELETION = 'deletion',\n ELEMENT_MATCH = 'element-match',\n SEARCH = 'search',\n TODAY = 'today',\n BEFORE_TODAY = 'before-today',\n TOMORROW = 'tomorrow',\n THIS_WEEK = 'this-week',\n NEXT_WEEK = 'next-week',\n LAST_WEEK = 'last-week',\n THIS_MONTH = 'this-month',\n LAST_MONTH = 'last-month',\n YESTERDAY = 'yesterday',\n NEXT_MONTH = 'next-month',\n LAST_YEAR = 'last-year',\n THIS_YEAR = 'this-year',\n NEXT_YEAR = 'next-year',\n RECENT_DAYS = 'recent-days',\n EARLIER_DAYS = 'earlier-days',\n /**\n * The field is strictly before the server's `now + offset`. Needs a Wow\n * server of 9.2.0 or later.\n */\n BEFORE_NOW = 'before-now',\n /**\n * The field is strictly after the server's `now + offset`. Needs a Wow\n * server of 9.2.0 or later.\n */\n AFTER_NOW = 'after-now',\n /**\n * A computed expression, such as the hours between two time fields,\n * compared with a number. Evaluated per record, so expensive; a record\n * whose expression has no value never matches. Needs a Wow server of\n * 9.2.0 or later.\n */\n EXPRESSION = 'expression',\n}\n\n/**\n * Case handling for `CONTAINS`, `STARTS_WITH` and `ENDS_WITH`.\n */\nexport enum StringComparison {\n /**\n * Characters must match exactly. The default.\n */\n CASE_SENSITIVE = 'case-sensitive',\n /**\n * Ignores case. Backends may execute this more expensively.\n */\n CASE_INSENSITIVE = 'case-insensitive',\n}\n\n/**\n * Matching mode of a full-text `SEARCH` filter.\n */\nexport enum SearchMode {\n /**\n * Analyzed terms match independently; they need not appear together. The\n * default.\n */\n TERMS = 'terms',\n /**\n * Analyzed terms must appear in order and at adjacent positions.\n */\n PHRASE = 'phrase',\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"operator.cjs","names":["FilterOperator","\"MATCH_ALL\"","\"MATCH_NONE\"","\"ID\"","\"IDS\"","\"AGGREGATE_ID\"","\"AGGREGATE_IDS\"","\"TENANT_ID\"","\"OWNER_ID\"","\"SPACE_ID\"","\"AND\"","\"OR\"","\"NOR\"","\"EQ\"","\"NE\"","\"GT\"","\"GTE\"","\"LT\"","\"LTE\"","\"CONTAINS\"","\"STARTS_WITH\"","\"ENDS_WITH\"","\"IN\"","\"NOT_IN\"","\"BETWEEN\"","\"CONTAINS_ALL\"","\"IS_EMPTY\"","\"IS_EMPTY_STRING\"","\"IS_NOT_EMPTY_STRING\"","\"IS_NULL\"","\"IS_NOT_NULL\"","\"EXISTS\"","\"NOT_EXISTS\"","\"DELETION\"","\"ELEMENT_MATCH\"","\"SEARCH\"","\"TODAY\"","\"BEFORE_TODAY\"","\"TOMORROW\"","\"THIS_WEEK\"","\"NEXT_WEEK\"","\"LAST_WEEK\"","\"THIS_MONTH\"","\"LAST_MONTH\"","\"YESTERDAY\"","\"NEXT_MONTH\"","\"LAST_YEAR\"","\"THIS_YEAR\"","\"NEXT_YEAR\"","\"RECENT_DAYS\"","\"EARLIER_DAYS\"","\"BEFORE_NOW\"","\"AFTER_NOW\"","\"EXPRESSION\"","StringComparison","\"CASE_SENSITIVE\"","\"CASE_INSENSITIVE\"","SearchMode","\"TERMS\"","\"PHRASE\"","TimeUnit","\"NANOSECONDS\"","\"MICROSECONDS\"","\"MILLISECONDS\"","\"SECONDS\"","\"MINUTES\"","\"HOURS\"","\"DAYS\""],"sources":["../../../src/dsl/filter/operator.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\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 * http://www.apache.org/licenses/LICENSE-2.0\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\n/**\n * Discriminator sent as the `op` property of every filter expression. The\n * values match the server-side `FilterOperator` enum.\n */\nexport enum FilterOperator {\n MATCH_ALL = 'match-all',\n MATCH_NONE = 'match-none',\n ID = 'id',\n IDS = 'ids',\n AGGREGATE_ID = 'aggregate-id',\n AGGREGATE_IDS = 'aggregate-ids',\n TENANT_ID = 'tenant-id',\n OWNER_ID = 'owner-id',\n SPACE_ID = 'space-id',\n AND = 'and',\n OR = 'or',\n NOR = 'nor',\n EQ = 'eq',\n NE = 'ne',\n GT = 'gt',\n GTE = 'gte',\n LT = 'lt',\n LTE = 'lte',\n CONTAINS = 'contains',\n STARTS_WITH = 'starts-with',\n ENDS_WITH = 'ends-with',\n IN = 'in',\n NOT_IN = 'not-in',\n BETWEEN = 'between',\n CONTAINS_ALL = 'contains-all',\n IS_EMPTY = 'is-empty',\n IS_EMPTY_STRING = 'is-empty-string',\n IS_NOT_EMPTY_STRING = 'is-not-empty-string',\n IS_NULL = 'is-null',\n IS_NOT_NULL = 'is-not-null',\n EXISTS = 'exists',\n NOT_EXISTS = 'not-exists',\n DELETION = 'deletion',\n ELEMENT_MATCH = 'element-match',\n SEARCH = 'search',\n TODAY = 'today',\n BEFORE_TODAY = 'before-today',\n TOMORROW = 'tomorrow',\n THIS_WEEK = 'this-week',\n NEXT_WEEK = 'next-week',\n LAST_WEEK = 'last-week',\n THIS_MONTH = 'this-month',\n LAST_MONTH = 'last-month',\n YESTERDAY = 'yesterday',\n NEXT_MONTH = 'next-month',\n LAST_YEAR = 'last-year',\n THIS_YEAR = 'this-year',\n NEXT_YEAR = 'next-year',\n RECENT_DAYS = 'recent-days',\n EARLIER_DAYS = 'earlier-days',\n /**\n * The field is strictly before the server's `now + offset`. Needs a Wow\n * server of 9.2.0 or later.\n */\n BEFORE_NOW = 'before-now',\n /**\n * The field is strictly after the server's `now + offset`. Needs a Wow\n * server of 9.2.0 or later.\n */\n AFTER_NOW = 'after-now',\n /**\n * A computed expression, such as the hours between two time fields,\n * compared with a number. Evaluated per record, so expensive; a record\n * whose expression has no value never matches. Needs a Wow server of\n * 9.2.0 or later.\n */\n EXPRESSION = 'expression',\n}\n\n/**\n * Case handling for `CONTAINS`, `STARTS_WITH` and `ENDS_WITH`.\n */\nexport enum StringComparison {\n /**\n * Characters must match exactly. The default.\n */\n CASE_SENSITIVE = 'case-sensitive',\n /**\n * Ignores case. Backends may execute this more expensively.\n */\n CASE_INSENSITIVE = 'case-insensitive',\n}\n\n/**\n * Matching mode of a full-text `SEARCH` filter.\n */\nexport enum SearchMode {\n /**\n * Analyzed terms match independently; they need not appear together. The\n * default.\n */\n TERMS = 'terms',\n /**\n * Analyzed terms must appear in order and at adjacent positions.\n */\n PHRASE = 'phrase',\n}\n\n/**\n * The unit a number counts in, as the capability descriptor names it: a\n * `temporal-epoch` field's epoch (`TemporalEpoch`) or a `duration`\n * field's length (`DurationSemantic`). The words are the JVM's\n * `TimeUnit` names in lower case.\n */\nexport enum TimeUnit {\n NANOSECONDS = 'nanoseconds',\n MICROSECONDS = 'microseconds',\n MILLISECONDS = 'milliseconds',\n SECONDS = 'seconds',\n MINUTES = 'minutes',\n HOURS = 'hours',\n DAYS = 'days',\n}\n"],"mappings":"AAiBA,IAAYA,EAAL,SAAA,EAAA,C,MACL,GAAAC,UAAA,YACA,EAAAC,WAAA,aACA,EAAAC,GAAA,KACA,EAAAC,IAAA,MACA,EAAAC,aAAA,eACA,EAAAC,cAAA,gBACA,EAAAC,UAAA,YACA,EAAAC,SAAA,WACA,EAAAC,SAAA,WACA,EAAAC,IAAA,MACA,EAAAC,GAAA,KACA,EAAAC,IAAA,MACA,EAAAC,GAAA,KACA,EAAAC,GAAA,KACA,EAAAC,GAAA,KACA,EAAAC,IAAA,MACA,EAAAC,GAAA,KACA,EAAAC,IAAA,MACA,EAAAC,SAAA,WACA,EAAAC,YAAA,cACA,EAAAC,UAAA,YACA,EAAAC,GAAA,KACA,EAAAC,OAAA,SACA,EAAAC,QAAA,UACA,EAAAC,aAAA,eACA,EAAAC,SAAA,WACA,EAAAC,gBAAA,kBACA,EAAAC,oBAAA,sBACA,EAAAC,QAAA,UACA,EAAAC,YAAA,cACA,EAAAC,OAAA,SACA,EAAAC,WAAA,aACA,EAAAC,SAAA,WACA,EAAAC,cAAA,gBACA,EAAAC,OAAA,SACA,EAAAC,MAAA,QACA,EAAAC,aAAA,eACA,EAAAC,SAAA,WACA,EAAAC,UAAA,YACA,EAAAC,UAAA,YACA,EAAAC,UAAA,YACA,EAAAC,WAAA,aACA,EAAAC,WAAA,aACA,EAAAC,UAAA,YACA,EAAAC,WAAA,aACA,EAAAC,UAAA,YACA,EAAAC,UAAA,YACA,EAAAC,UAAA,YACA,EAAAC,YAAA,cACA,EAAAC,aAAA,eAKA,EAAAC,WAAA,aAKA,EAAAC,UAAA,YAOA,EAAAC,WAAA,a,CACF,EAAA,CAAA,CAAA,EAKYC,EAAL,SAAA,EAAA,C,MAIL,GAAAC,eAAA,iBAIA,EAAAC,iBAAA,mB,CACF,EAAA,CAAA,CAAA,EAKYC,EAAL,SAAA,EAAA,C,MAKL,GAAAC,MAAA,QAIA,EAAAC,OAAA,S,CACF,EAAA,CAAA,CAAA,EAQYC,EAAL,SAAA,EAAA,C,MACL,GAAAC,YAAA,cACA,EAAAC,aAAA,eACA,EAAAC,aAAA,eACA,EAAAC,QAAA,UACA,EAAAC,QAAA,UACA,EAAAC,MAAA,QACA,EAAAC,KAAA,O,CACF,EAAA,CAAA,CAAA,E"}
|
|
@@ -99,15 +99,17 @@ export declare enum SearchMode {
|
|
|
99
99
|
PHRASE = "phrase"
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
102
|
+
* The unit a number counts in, as the capability descriptor names it: a
|
|
103
|
+
* `temporal-epoch` field's epoch (`TemporalEpoch`) or a `duration`
|
|
104
|
+
* field's length (`DurationSemantic`). The words are the JVM's
|
|
105
|
+
* `TimeUnit` names in lower case.
|
|
104
106
|
*/
|
|
105
107
|
export declare enum TimeUnit {
|
|
106
|
-
NANOSECONDS = "
|
|
107
|
-
MICROSECONDS = "
|
|
108
|
-
MILLISECONDS = "
|
|
109
|
-
SECONDS = "
|
|
110
|
-
MINUTES = "
|
|
111
|
-
HOURS = "
|
|
112
|
-
DAYS = "
|
|
108
|
+
NANOSECONDS = "nanoseconds",
|
|
109
|
+
MICROSECONDS = "microseconds",
|
|
110
|
+
MILLISECONDS = "milliseconds",
|
|
111
|
+
SECONDS = "seconds",
|
|
112
|
+
MINUTES = "minutes",
|
|
113
|
+
HOURS = "hours",
|
|
114
|
+
DAYS = "days"
|
|
113
115
|
}
|
|
@@ -99,15 +99,17 @@ export declare enum SearchMode {
|
|
|
99
99
|
PHRASE = "phrase"
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
102
|
+
* The unit a number counts in, as the capability descriptor names it: a
|
|
103
|
+
* `temporal-epoch` field's epoch (`TemporalEpoch`) or a `duration`
|
|
104
|
+
* field's length (`DurationSemantic`). The words are the JVM's
|
|
105
|
+
* `TimeUnit` names in lower case.
|
|
104
106
|
*/
|
|
105
107
|
export declare enum TimeUnit {
|
|
106
|
-
NANOSECONDS = "
|
|
107
|
-
MICROSECONDS = "
|
|
108
|
-
MILLISECONDS = "
|
|
109
|
-
SECONDS = "
|
|
110
|
-
MINUTES = "
|
|
111
|
-
HOURS = "
|
|
112
|
-
DAYS = "
|
|
108
|
+
NANOSECONDS = "nanoseconds",
|
|
109
|
+
MICROSECONDS = "microseconds",
|
|
110
|
+
MILLISECONDS = "milliseconds",
|
|
111
|
+
SECONDS = "seconds",
|
|
112
|
+
MINUTES = "minutes",
|
|
113
|
+
HOURS = "hours",
|
|
114
|
+
DAYS = "days"
|
|
113
115
|
}
|
|
@@ -6,7 +6,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
6
6
|
}({}), n = /* @__PURE__ */ function(e) {
|
|
7
7
|
return e.TERMS = "terms", e.PHRASE = "phrase", e;
|
|
8
8
|
}({}), r = /* @__PURE__ */ function(e) {
|
|
9
|
-
return e.NANOSECONDS = "
|
|
9
|
+
return e.NANOSECONDS = "nanoseconds", e.MICROSECONDS = "microseconds", e.MILLISECONDS = "milliseconds", e.SECONDS = "seconds", e.MINUTES = "minutes", e.HOURS = "hours", e.DAYS = "days", e;
|
|
10
10
|
}({});
|
|
11
11
|
export { e as FilterOperator, n as SearchMode, t as StringComparison, r as TimeUnit };
|
|
12
12
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.es.js","names":["FilterOperator","\"MATCH_ALL\"","\"MATCH_NONE\"","\"ID\"","\"IDS\"","\"AGGREGATE_ID\"","\"AGGREGATE_IDS\"","\"TENANT_ID\"","\"OWNER_ID\"","\"SPACE_ID\"","\"AND\"","\"OR\"","\"NOR\"","\"EQ\"","\"NE\"","\"GT\"","\"GTE\"","\"LT\"","\"LTE\"","\"CONTAINS\"","\"STARTS_WITH\"","\"ENDS_WITH\"","\"IN\"","\"NOT_IN\"","\"BETWEEN\"","\"CONTAINS_ALL\"","\"IS_EMPTY\"","\"IS_EMPTY_STRING\"","\"IS_NOT_EMPTY_STRING\"","\"IS_NULL\"","\"IS_NOT_NULL\"","\"EXISTS\"","\"NOT_EXISTS\"","\"DELETION\"","\"ELEMENT_MATCH\"","\"SEARCH\"","\"TODAY\"","\"BEFORE_TODAY\"","\"TOMORROW\"","\"THIS_WEEK\"","\"NEXT_WEEK\"","\"LAST_WEEK\"","\"THIS_MONTH\"","\"LAST_MONTH\"","\"YESTERDAY\"","\"NEXT_MONTH\"","\"LAST_YEAR\"","\"THIS_YEAR\"","\"NEXT_YEAR\"","\"RECENT_DAYS\"","\"EARLIER_DAYS\"","\"BEFORE_NOW\"","\"AFTER_NOW\"","\"EXPRESSION\"","StringComparison","\"CASE_SENSITIVE\"","\"CASE_INSENSITIVE\"","SearchMode","\"TERMS\"","\"PHRASE\"","TimeUnit","\"NANOSECONDS\"","\"MICROSECONDS\"","\"MILLISECONDS\"","\"SECONDS\"","\"MINUTES\"","\"HOURS\"","\"DAYS\""],"sources":["../../../src/dsl/filter/operator.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\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 * http://www.apache.org/licenses/LICENSE-2.0\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\n/**\n * Discriminator sent as the `op` property of every filter expression. The\n * values match the server-side `FilterOperator` enum.\n */\nexport enum FilterOperator {\n MATCH_ALL = 'match-all',\n MATCH_NONE = 'match-none',\n ID = 'id',\n IDS = 'ids',\n AGGREGATE_ID = 'aggregate-id',\n AGGREGATE_IDS = 'aggregate-ids',\n TENANT_ID = 'tenant-id',\n OWNER_ID = 'owner-id',\n SPACE_ID = 'space-id',\n AND = 'and',\n OR = 'or',\n NOR = 'nor',\n EQ = 'eq',\n NE = 'ne',\n GT = 'gt',\n GTE = 'gte',\n LT = 'lt',\n LTE = 'lte',\n CONTAINS = 'contains',\n STARTS_WITH = 'starts-with',\n ENDS_WITH = 'ends-with',\n IN = 'in',\n NOT_IN = 'not-in',\n BETWEEN = 'between',\n CONTAINS_ALL = 'contains-all',\n IS_EMPTY = 'is-empty',\n IS_EMPTY_STRING = 'is-empty-string',\n IS_NOT_EMPTY_STRING = 'is-not-empty-string',\n IS_NULL = 'is-null',\n IS_NOT_NULL = 'is-not-null',\n EXISTS = 'exists',\n NOT_EXISTS = 'not-exists',\n DELETION = 'deletion',\n ELEMENT_MATCH = 'element-match',\n SEARCH = 'search',\n TODAY = 'today',\n BEFORE_TODAY = 'before-today',\n TOMORROW = 'tomorrow',\n THIS_WEEK = 'this-week',\n NEXT_WEEK = 'next-week',\n LAST_WEEK = 'last-week',\n THIS_MONTH = 'this-month',\n LAST_MONTH = 'last-month',\n YESTERDAY = 'yesterday',\n NEXT_MONTH = 'next-month',\n LAST_YEAR = 'last-year',\n THIS_YEAR = 'this-year',\n NEXT_YEAR = 'next-year',\n RECENT_DAYS = 'recent-days',\n EARLIER_DAYS = 'earlier-days',\n /**\n * The field is strictly before the server's `now + offset`. Needs a Wow\n * server of 9.2.0 or later.\n */\n BEFORE_NOW = 'before-now',\n /**\n * The field is strictly after the server's `now + offset`. Needs a Wow\n * server of 9.2.0 or later.\n */\n AFTER_NOW = 'after-now',\n /**\n * A computed expression, such as the hours between two time fields,\n * compared with a number. Evaluated per record, so expensive; a record\n * whose expression has no value never matches. Needs a Wow server of\n * 9.2.0 or later.\n */\n EXPRESSION = 'expression',\n}\n\n/**\n * Case handling for `CONTAINS`, `STARTS_WITH` and `ENDS_WITH`.\n */\nexport enum StringComparison {\n /**\n * Characters must match exactly. The default.\n */\n CASE_SENSITIVE = 'case-sensitive',\n /**\n * Ignores case. Backends may execute this more expensively.\n */\n CASE_INSENSITIVE = 'case-insensitive',\n}\n\n/**\n * Matching mode of a full-text `SEARCH` filter.\n */\nexport enum SearchMode {\n /**\n * Analyzed terms match independently; they need not appear together. The\n * default.\n */\n TERMS = 'terms',\n /**\n * Analyzed terms must appear in order and at adjacent positions.\n */\n PHRASE = 'phrase',\n}\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"operator.es.js","names":["FilterOperator","\"MATCH_ALL\"","\"MATCH_NONE\"","\"ID\"","\"IDS\"","\"AGGREGATE_ID\"","\"AGGREGATE_IDS\"","\"TENANT_ID\"","\"OWNER_ID\"","\"SPACE_ID\"","\"AND\"","\"OR\"","\"NOR\"","\"EQ\"","\"NE\"","\"GT\"","\"GTE\"","\"LT\"","\"LTE\"","\"CONTAINS\"","\"STARTS_WITH\"","\"ENDS_WITH\"","\"IN\"","\"NOT_IN\"","\"BETWEEN\"","\"CONTAINS_ALL\"","\"IS_EMPTY\"","\"IS_EMPTY_STRING\"","\"IS_NOT_EMPTY_STRING\"","\"IS_NULL\"","\"IS_NOT_NULL\"","\"EXISTS\"","\"NOT_EXISTS\"","\"DELETION\"","\"ELEMENT_MATCH\"","\"SEARCH\"","\"TODAY\"","\"BEFORE_TODAY\"","\"TOMORROW\"","\"THIS_WEEK\"","\"NEXT_WEEK\"","\"LAST_WEEK\"","\"THIS_MONTH\"","\"LAST_MONTH\"","\"YESTERDAY\"","\"NEXT_MONTH\"","\"LAST_YEAR\"","\"THIS_YEAR\"","\"NEXT_YEAR\"","\"RECENT_DAYS\"","\"EARLIER_DAYS\"","\"BEFORE_NOW\"","\"AFTER_NOW\"","\"EXPRESSION\"","StringComparison","\"CASE_SENSITIVE\"","\"CASE_INSENSITIVE\"","SearchMode","\"TERMS\"","\"PHRASE\"","TimeUnit","\"NANOSECONDS\"","\"MICROSECONDS\"","\"MILLISECONDS\"","\"SECONDS\"","\"MINUTES\"","\"HOURS\"","\"DAYS\""],"sources":["../../../src/dsl/filter/operator.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\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 * http://www.apache.org/licenses/LICENSE-2.0\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\n/**\n * Discriminator sent as the `op` property of every filter expression. The\n * values match the server-side `FilterOperator` enum.\n */\nexport enum FilterOperator {\n MATCH_ALL = 'match-all',\n MATCH_NONE = 'match-none',\n ID = 'id',\n IDS = 'ids',\n AGGREGATE_ID = 'aggregate-id',\n AGGREGATE_IDS = 'aggregate-ids',\n TENANT_ID = 'tenant-id',\n OWNER_ID = 'owner-id',\n SPACE_ID = 'space-id',\n AND = 'and',\n OR = 'or',\n NOR = 'nor',\n EQ = 'eq',\n NE = 'ne',\n GT = 'gt',\n GTE = 'gte',\n LT = 'lt',\n LTE = 'lte',\n CONTAINS = 'contains',\n STARTS_WITH = 'starts-with',\n ENDS_WITH = 'ends-with',\n IN = 'in',\n NOT_IN = 'not-in',\n BETWEEN = 'between',\n CONTAINS_ALL = 'contains-all',\n IS_EMPTY = 'is-empty',\n IS_EMPTY_STRING = 'is-empty-string',\n IS_NOT_EMPTY_STRING = 'is-not-empty-string',\n IS_NULL = 'is-null',\n IS_NOT_NULL = 'is-not-null',\n EXISTS = 'exists',\n NOT_EXISTS = 'not-exists',\n DELETION = 'deletion',\n ELEMENT_MATCH = 'element-match',\n SEARCH = 'search',\n TODAY = 'today',\n BEFORE_TODAY = 'before-today',\n TOMORROW = 'tomorrow',\n THIS_WEEK = 'this-week',\n NEXT_WEEK = 'next-week',\n LAST_WEEK = 'last-week',\n THIS_MONTH = 'this-month',\n LAST_MONTH = 'last-month',\n YESTERDAY = 'yesterday',\n NEXT_MONTH = 'next-month',\n LAST_YEAR = 'last-year',\n THIS_YEAR = 'this-year',\n NEXT_YEAR = 'next-year',\n RECENT_DAYS = 'recent-days',\n EARLIER_DAYS = 'earlier-days',\n /**\n * The field is strictly before the server's `now + offset`. Needs a Wow\n * server of 9.2.0 or later.\n */\n BEFORE_NOW = 'before-now',\n /**\n * The field is strictly after the server's `now + offset`. Needs a Wow\n * server of 9.2.0 or later.\n */\n AFTER_NOW = 'after-now',\n /**\n * A computed expression, such as the hours between two time fields,\n * compared with a number. Evaluated per record, so expensive; a record\n * whose expression has no value never matches. Needs a Wow server of\n * 9.2.0 or later.\n */\n EXPRESSION = 'expression',\n}\n\n/**\n * Case handling for `CONTAINS`, `STARTS_WITH` and `ENDS_WITH`.\n */\nexport enum StringComparison {\n /**\n * Characters must match exactly. The default.\n */\n CASE_SENSITIVE = 'case-sensitive',\n /**\n * Ignores case. Backends may execute this more expensively.\n */\n CASE_INSENSITIVE = 'case-insensitive',\n}\n\n/**\n * Matching mode of a full-text `SEARCH` filter.\n */\nexport enum SearchMode {\n /**\n * Analyzed terms match independently; they need not appear together. The\n * default.\n */\n TERMS = 'terms',\n /**\n * Analyzed terms must appear in order and at adjacent positions.\n */\n PHRASE = 'phrase',\n}\n\n/**\n * The unit a number counts in, as the capability descriptor names it: a\n * `temporal-epoch` field's epoch (`TemporalEpoch`) or a `duration`\n * field's length (`DurationSemantic`). The words are the JVM's\n * `TimeUnit` names in lower case.\n */\nexport enum TimeUnit {\n NANOSECONDS = 'nanoseconds',\n MICROSECONDS = 'microseconds',\n MILLISECONDS = 'milliseconds',\n SECONDS = 'seconds',\n MINUTES = 'minutes',\n HOURS = 'hours',\n DAYS = 'days',\n}\n"],"mappings":";AAiBA,IAAYA,IAAL,yBAAA,GAAA;C,OACL,EAAAC,YAAA,aACA,EAAAC,aAAA,cACA,EAAAC,KAAA,MACA,EAAAC,MAAA,OACA,EAAAC,eAAA,gBACA,EAAAC,gBAAA,iBACA,EAAAC,YAAA,aACA,EAAAC,WAAA,YACA,EAAAC,WAAA,YACA,EAAAC,MAAA,OACA,EAAAC,KAAA,MACA,EAAAC,MAAA,OACA,EAAAC,KAAA,MACA,EAAAC,KAAA,MACA,EAAAC,KAAA,MACA,EAAAC,MAAA,OACA,EAAAC,KAAA,MACA,EAAAC,MAAA,OACA,EAAAC,WAAA,YACA,EAAAC,cAAA,eACA,EAAAC,YAAA,aACA,EAAAC,KAAA,MACA,EAAAC,SAAA,UACA,EAAAC,UAAA,WACA,EAAAC,eAAA,gBACA,EAAAC,WAAA,YACA,EAAAC,kBAAA,mBACA,EAAAC,sBAAA,uBACA,EAAAC,UAAA,WACA,EAAAC,cAAA,eACA,EAAAC,SAAA,UACA,EAAAC,aAAA,cACA,EAAAC,WAAA,YACA,EAAAC,gBAAA,iBACA,EAAAC,SAAA,UACA,EAAAC,QAAA,SACA,EAAAC,eAAA,gBACA,EAAAC,WAAA,YACA,EAAAC,YAAA,aACA,EAAAC,YAAA,aACA,EAAAC,YAAA,aACA,EAAAC,aAAA,cACA,EAAAC,aAAA,cACA,EAAAC,YAAA,aACA,EAAAC,aAAA,cACA,EAAAC,YAAA,aACA,EAAAC,YAAA,aACA,EAAAC,YAAA,aACA,EAAAC,cAAA,eACA,EAAAC,eAAA,gBAKA,EAAAC,aAAA,cAKA,EAAAC,YAAA,aAOA,EAAAC,aAAA,c;AACF,EAAA,CAAA,CAAA,GAKYC,IAAL,yBAAA,GAAA;C,OAIL,EAAAC,iBAAA,kBAIA,EAAAC,mBAAA,oB;AACF,EAAA,CAAA,CAAA,GAKYC,IAAL,yBAAA,GAAA;C,OAKL,EAAAC,QAAA,SAIA,EAAAC,SAAA,U;AACF,EAAA,CAAA,CAAA,GAQYC,IAAL,yBAAA,GAAA;C,OACL,EAAAC,cAAA,eACA,EAAAC,eAAA,gBACA,EAAAC,eAAA,gBACA,EAAAC,UAAA,WACA,EAAAC,UAAA,WACA,EAAAC,QAAA,SACA,EAAAC,OAAA,Q;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./operator.cjs"),t=require("../field.cjs");function n(n,r){if(typeof n!=`string`||!n.trim())throw TypeError(`SEARCH query cannot be blank.`);if(r!==void 0&&(typeof r!=`object`||!r||Array.isArray(r)))throw TypeError(`SEARCH options must be a non-null object.`);let{fields:i=[],mode:a=e.SearchMode.TERMS}=r??{};if(!Object.values(e.SearchMode).includes(a))throw TypeError(`SEARCH mode is invalid: [${String(a)}].`);return{op:e.FilterOperator.SEARCH,query:n,mode:a,fields:i.map(t.queryField)}}var r={search:n};exports.searchFilters=r;
|
|
2
|
+
//# sourceMappingURL=searchFilter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchFilter.cjs","names":["SearchMode","FilterOperator","queryField","require_operator","require_field","search","query","options","mode","fields","searchFilters"],"sources":["../../../src/dsl/filter/searchFilter.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\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 * http://www.apache.org/licenses/LICENSE-2.0\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 { queryField } from '../field.js';\nimport { FilterOperator, SearchMode } from './operator.js';\nimport type {\n SearchFilter,\n SearchFilterOptions,\n ElementSearchFilter,\n QueryField,\n} from './types.js';\n\n/**\n * The overloads of {@link searchFilters.search | `filter.search`}: naming at least one field, as an\n * array literal, types the result as an {@link ElementSearchFilter}, which\n * `ELEMENT_MATCH` takes; otherwise it is a {@link SearchFilter}, root-only\n * when its `fields` are empty.\n */\nexport interface SearchBuilder {\n <FIELDS extends string>(\n query: string,\n options: SearchFilterOptions<FIELDS> & {\n fields: readonly [QueryField<FIELDS>, ...QueryField<FIELDS>[]];\n },\n ): ElementSearchFilter<FIELDS>;\n <FIELDS extends string>(\n query: string,\n options?: SearchFilterOptions<FIELDS>,\n ): SearchFilter<FIELDS>;\n}\n\nfunction search<FIELDS extends string>(\n query: string,\n options?: SearchFilterOptions<FIELDS>,\n): SearchFilter<FIELDS> {\n if (typeof query !== 'string' || !query.trim()) {\n throw new TypeError('SEARCH query cannot be blank.');\n }\n if (\n options !== undefined &&\n (options === null || typeof options !== 'object' || Array.isArray(options))\n ) {\n throw new TypeError('SEARCH options must be a non-null object.');\n }\n const { fields = [], mode = SearchMode.TERMS } = options ?? {};\n if (!Object.values(SearchMode).includes(mode)) {\n throw new TypeError(`SEARCH mode is invalid: [${String(mode)}].`);\n }\n return {\n op: FilterOperator.SEARCH,\n query,\n mode,\n fields: fields.map(queryField),\n };\n}\n\n/** The full-text search filter. */\nexport const searchFilters = {\n /**\n * Matches records by full-text search. Tokenization and matching depend on\n * the backend's analyzer. Inside `elementMatch` it must name its fields,\n * relative to the element; with fields given as a non-empty array literal\n * it returns an {@link ElementSearchFilter}, which `elementMatch` takes.\n *\n * @param query - Search text.\n * @param options - Optional `fields` (defaults to `[]`, the backend's default\n * search fields) and `mode` (defaults to `SearchMode.TERMS`).\n * @returns `{ op: 'search', query, mode, fields }`.\n * @throws TypeError If `query` is not a string or is blank, `options` is\n * given but is `null`, an array or not an object, `mode` is not a\n * {@link SearchMode} member, or any of `fields` is not a valid query field\n * path.\n * @example\n * ```typescript\n * filter.search('event sourcing', {\n * fields: ['state.description'],\n * mode: SearchMode.PHRASE,\n * });\n * ```\n */\n search: search as SearchBuilder,\n};\n"],"mappings":"A,4DAyCA,SAASK,EACP,EACA,EACsB,CACtB,GAAI,OAAOC,GAAU,UAAY,CAACA,EAAM,KAAK,EAC3C,MAAU,UAAU,+BAA+B,EAErD,GACEC,IAAY,IAAA,KACS,OAAOA,GAAY,WAAvCA,GAAmD,MAAM,QAAQA,CAAO,GAEzE,MAAU,UAAU,2CAA2C,EAEjE,GAAM,CAAE,SAAS,CAAC,EAAG,OAAOP,EAAAA,WAAW,OAAUO,GAAW,CAAC,EAC7D,GAAI,CAAC,OAAO,OAAOP,EAAAA,UAAU,CAAC,CAAC,SAASQ,CAAI,EAC1C,MAAU,UAAU,4BAA4B,OAAOA,CAAI,EAAE,GAAG,EAElE,MAAO,CACL,GAAIP,EAAAA,eAAe,OACnB,QACA,OACA,OAAQQ,EAAO,IAAIP,EAAAA,UAAU,CAC/B,CACF,CAGA,IAAaQ,EAAgB,CAuBnB,QACV,E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SearchFilter, SearchFilterOptions, ElementSearchFilter, QueryField } from './types.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* The overloads of {@link searchFilters.search | `filter.search`}: naming at least one field, as an
|
|
4
|
+
* array literal, types the result as an {@link ElementSearchFilter}, which
|
|
5
|
+
* `ELEMENT_MATCH` takes; otherwise it is a {@link SearchFilter}, root-only
|
|
6
|
+
* when its `fields` are empty.
|
|
7
|
+
*/
|
|
8
|
+
export interface SearchBuilder {
|
|
9
|
+
<FIELDS extends string>(query: string, options: SearchFilterOptions<FIELDS> & {
|
|
10
|
+
fields: readonly [QueryField<FIELDS>, ...QueryField<FIELDS>[]];
|
|
11
|
+
}): ElementSearchFilter<FIELDS>;
|
|
12
|
+
<FIELDS extends string>(query: string, options?: SearchFilterOptions<FIELDS>): SearchFilter<FIELDS>;
|
|
13
|
+
}
|
|
14
|
+
/** The full-text search filter. */
|
|
15
|
+
export declare const searchFilters: {
|
|
16
|
+
/**
|
|
17
|
+
* Matches records by full-text search. Tokenization and matching depend on
|
|
18
|
+
* the backend's analyzer. Inside `elementMatch` it must name its fields,
|
|
19
|
+
* relative to the element; with fields given as a non-empty array literal
|
|
20
|
+
* it returns an {@link ElementSearchFilter}, which `elementMatch` takes.
|
|
21
|
+
*
|
|
22
|
+
* @param query - Search text.
|
|
23
|
+
* @param options - Optional `fields` (defaults to `[]`, the backend's default
|
|
24
|
+
* search fields) and `mode` (defaults to `SearchMode.TERMS`).
|
|
25
|
+
* @returns `{ op: 'search', query, mode, fields }`.
|
|
26
|
+
* @throws TypeError If `query` is not a string or is blank, `options` is
|
|
27
|
+
* given but is `null`, an array or not an object, `mode` is not a
|
|
28
|
+
* {@link SearchMode} member, or any of `fields` is not a valid query field
|
|
29
|
+
* path.
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* filter.search('event sourcing', {
|
|
33
|
+
* fields: ['state.description'],
|
|
34
|
+
* mode: SearchMode.PHRASE,
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
search: SearchBuilder;
|
|
39
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SearchFilter, SearchFilterOptions, ElementSearchFilter, QueryField } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The overloads of {@link searchFilters.search | `filter.search`}: naming at least one field, as an
|
|
4
|
+
* array literal, types the result as an {@link ElementSearchFilter}, which
|
|
5
|
+
* `ELEMENT_MATCH` takes; otherwise it is a {@link SearchFilter}, root-only
|
|
6
|
+
* when its `fields` are empty.
|
|
7
|
+
*/
|
|
8
|
+
export interface SearchBuilder {
|
|
9
|
+
<FIELDS extends string>(query: string, options: SearchFilterOptions<FIELDS> & {
|
|
10
|
+
fields: readonly [QueryField<FIELDS>, ...QueryField<FIELDS>[]];
|
|
11
|
+
}): ElementSearchFilter<FIELDS>;
|
|
12
|
+
<FIELDS extends string>(query: string, options?: SearchFilterOptions<FIELDS>): SearchFilter<FIELDS>;
|
|
13
|
+
}
|
|
14
|
+
/** The full-text search filter. */
|
|
15
|
+
export declare const searchFilters: {
|
|
16
|
+
/**
|
|
17
|
+
* Matches records by full-text search. Tokenization and matching depend on
|
|
18
|
+
* the backend's analyzer. Inside `elementMatch` it must name its fields,
|
|
19
|
+
* relative to the element; with fields given as a non-empty array literal
|
|
20
|
+
* it returns an {@link ElementSearchFilter}, which `elementMatch` takes.
|
|
21
|
+
*
|
|
22
|
+
* @param query - Search text.
|
|
23
|
+
* @param options - Optional `fields` (defaults to `[]`, the backend's default
|
|
24
|
+
* search fields) and `mode` (defaults to `SearchMode.TERMS`).
|
|
25
|
+
* @returns `{ op: 'search', query, mode, fields }`.
|
|
26
|
+
* @throws TypeError If `query` is not a string or is blank, `options` is
|
|
27
|
+
* given but is `null`, an array or not an object, `mode` is not a
|
|
28
|
+
* {@link SearchMode} member, or any of `fields` is not a valid query field
|
|
29
|
+
* path.
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* filter.search('event sourcing', {
|
|
33
|
+
* fields: ['state.description'],
|
|
34
|
+
* mode: SearchMode.PHRASE,
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
search: SearchBuilder;
|
|
39
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FilterOperator as e, SearchMode as t } from "./operator.es.js";
|
|
2
|
+
import { queryField as n } from "../field.es.js";
|
|
3
|
+
// src/dsl/filter/searchFilter.ts
|
|
4
|
+
function r(r, i) {
|
|
5
|
+
if (typeof r != "string" || !r.trim()) throw TypeError("SEARCH query cannot be blank.");
|
|
6
|
+
if (i !== void 0 && (typeof i != "object" || !i || Array.isArray(i))) throw TypeError("SEARCH options must be a non-null object.");
|
|
7
|
+
let { fields: a = [], mode: o = t.TERMS } = i ?? {};
|
|
8
|
+
if (!Object.values(t).includes(o)) throw TypeError(`SEARCH mode is invalid: [${String(o)}].`);
|
|
9
|
+
return {
|
|
10
|
+
op: e.SEARCH,
|
|
11
|
+
query: r,
|
|
12
|
+
mode: o,
|
|
13
|
+
fields: a.map(n)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
var i = { search: r };
|
|
17
|
+
export { i as searchFilters };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=searchFilter.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchFilter.es.js","names":["search","query","options","SearchMode","mode","FilterOperator","fields","queryField","searchFilters"],"sources":["../../../src/dsl/filter/searchFilter.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\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 * http://www.apache.org/licenses/LICENSE-2.0\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 { queryField } from '../field.js';\nimport { FilterOperator, SearchMode } from './operator.js';\nimport type {\n SearchFilter,\n SearchFilterOptions,\n ElementSearchFilter,\n QueryField,\n} from './types.js';\n\n/**\n * The overloads of {@link searchFilters.search | `filter.search`}: naming at least one field, as an\n * array literal, types the result as an {@link ElementSearchFilter}, which\n * `ELEMENT_MATCH` takes; otherwise it is a {@link SearchFilter}, root-only\n * when its `fields` are empty.\n */\nexport interface SearchBuilder {\n <FIELDS extends string>(\n query: string,\n options: SearchFilterOptions<FIELDS> & {\n fields: readonly [QueryField<FIELDS>, ...QueryField<FIELDS>[]];\n },\n ): ElementSearchFilter<FIELDS>;\n <FIELDS extends string>(\n query: string,\n options?: SearchFilterOptions<FIELDS>,\n ): SearchFilter<FIELDS>;\n}\n\nfunction search<FIELDS extends string>(\n query: string,\n options?: SearchFilterOptions<FIELDS>,\n): SearchFilter<FIELDS> {\n if (typeof query !== 'string' || !query.trim()) {\n throw new TypeError('SEARCH query cannot be blank.');\n }\n if (\n options !== undefined &&\n (options === null || typeof options !== 'object' || Array.isArray(options))\n ) {\n throw new TypeError('SEARCH options must be a non-null object.');\n }\n const { fields = [], mode = SearchMode.TERMS } = options ?? {};\n if (!Object.values(SearchMode).includes(mode)) {\n throw new TypeError(`SEARCH mode is invalid: [${String(mode)}].`);\n }\n return {\n op: FilterOperator.SEARCH,\n query,\n mode,\n fields: fields.map(queryField),\n };\n}\n\n/** The full-text search filter. */\nexport const searchFilters = {\n /**\n * Matches records by full-text search. Tokenization and matching depend on\n * the backend's analyzer. Inside `elementMatch` it must name its fields,\n * relative to the element; with fields given as a non-empty array literal\n * it returns an {@link ElementSearchFilter}, which `elementMatch` takes.\n *\n * @param query - Search text.\n * @param options - Optional `fields` (defaults to `[]`, the backend's default\n * search fields) and `mode` (defaults to `SearchMode.TERMS`).\n * @returns `{ op: 'search', query, mode, fields }`.\n * @throws TypeError If `query` is not a string or is blank, `options` is\n * given but is `null`, an array or not an object, `mode` is not a\n * {@link SearchMode} member, or any of `fields` is not a valid query field\n * path.\n * @example\n * ```typescript\n * filter.search('event sourcing', {\n * fields: ['state.description'],\n * mode: SearchMode.PHRASE,\n * });\n * ```\n */\n search: search as SearchBuilder,\n};\n"],"mappings":";;;AAyCA,SAASA,EACP,GACA,GACsB;CACtB,IAAI,OAAOC,KAAU,YAAY,CAACA,EAAM,KAAK,GAC3C,MAAU,UAAU,+BAA+B;CAErD,IACEC,MAAY,KAAA,MACS,OAAOA,KAAY,aAAvCA,KAAmD,MAAM,QAAQA,CAAO,IAEzE,MAAU,UAAU,2CAA2C;CAEjE,IAAM,EAAE,YAAS,CAAC,GAAG,UAAOC,EAAW,UAAUD,KAAW,CAAC;CAC7D,IAAI,CAAC,OAAO,OAAOC,CAAU,CAAC,CAAC,SAASC,CAAI,GAC1C,MAAU,UAAU,4BAA4B,OAAOA,CAAI,EAAE,GAAG;CAElE,OAAO;EACL,IAAIC,EAAe;EACnB;EACA;EACA,QAAQC,EAAO,IAAIC,CAAU;CAC/B;AACF;AAGA,IAAaC,IAAgB,EAuBnB,UACV"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./operator.cjs"),t=require("../field.cjs"),n=require("./validate.cjs");function r(e,r,i){return{...n.validateRelativeTimeOptions(i),op:e,field:t.queryField(r)}}function i(e,r,i,a){return n.validateDays(e,i),{...n.validateRelativeTimeOptions(a),op:e,field:t.queryField(r),days:i}}function a(e,r,i,a){return n.requireDuration(e,i),{...n.validateRelativeTimeOptions(a),op:e,field:t.queryField(r),offset:i}}var o={today(t,n={}){return r(e.FilterOperator.TODAY,t,n)},beforeToday(r,i,a={}){let o=n.requireLocalTime(i);return{...n.validateRelativeTimeOptions(a),op:e.FilterOperator.BEFORE_TODAY,field:t.queryField(r),time:o}},tomorrow(t,n={}){return r(e.FilterOperator.TOMORROW,t,n)},thisWeek(t,n={}){return r(e.FilterOperator.THIS_WEEK,t,n)},nextWeek(t,n={}){return r(e.FilterOperator.NEXT_WEEK,t,n)},lastWeek(t,n={}){return r(e.FilterOperator.LAST_WEEK,t,n)},thisMonth(t,n={}){return r(e.FilterOperator.THIS_MONTH,t,n)},lastMonth(t,n={}){return r(e.FilterOperator.LAST_MONTH,t,n)},yesterday(t,n={}){return r(e.FilterOperator.YESTERDAY,t,n)},nextMonth(t,n={}){return r(e.FilterOperator.NEXT_MONTH,t,n)},lastYear(t,n={}){return r(e.FilterOperator.LAST_YEAR,t,n)},thisYear(t,n={}){return r(e.FilterOperator.THIS_YEAR,t,n)},nextYear(t,n={}){return r(e.FilterOperator.NEXT_YEAR,t,n)},recentDays(t,n,r={}){return i(e.FilterOperator.RECENT_DAYS,t,n,r)},earlierDays(t,n,r={}){return i(e.FilterOperator.EARLIER_DAYS,t,n,r)},beforeNow(t,n=`PT0S`,r={}){return a(e.FilterOperator.BEFORE_NOW,t,n,r)},afterNow(t,n=`PT0S`,r={}){return a(e.FilterOperator.AFTER_NOW,t,n,r)}};exports.timeFilters=o;
|
|
2
|
+
//# sourceMappingURL=timeFilters.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeFilters.cjs","names":["validateRelativeTimeOptions","queryField","FilterOperator","requireLocalTime","require_operator","require_field","require_validate","calendar","options","field","dayWindow","op","days","nowRelative","offset","timeFilters","localTime","time"],"sources":["../../../src/dsl/filter/timeFilters.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\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 * http://www.apache.org/licenses/LICENSE-2.0\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 { queryField } from '../field.js';\nimport { FilterOperator } from './operator.js';\nimport type {\n BeforeTodayFilter,\n CalendarFilter,\n DaysFilter,\n NowFilter,\n RelativeTimeFilterOptions,\n} from './types.js';\nimport {\n requireLocalTime,\n requireDuration,\n validateDays,\n validateRelativeTimeOptions,\n} from './validate.js';\n\nfunction calendar<FIELDS extends string>(\n op: CalendarFilter['op'],\n field: FIELDS,\n options: RelativeTimeFilterOptions,\n): CalendarFilter<FIELDS> {\n return {\n ...validateRelativeTimeOptions(options),\n op,\n field: queryField(field),\n };\n}\n\nfunction dayWindow<FIELDS extends string>(\n op: DaysFilter['op'],\n field: FIELDS,\n days: number,\n options: RelativeTimeFilterOptions,\n): DaysFilter<FIELDS> {\n validateDays(op, days);\n return {\n ...validateRelativeTimeOptions(options),\n op,\n field: queryField(field),\n days,\n };\n}\n\nfunction nowRelative<FIELDS extends string>(\n op: NowFilter['op'],\n field: FIELDS,\n offset: string,\n options: RelativeTimeFilterOptions,\n): NowFilter<FIELDS> {\n requireDuration(op, offset);\n return {\n ...validateRelativeTimeOptions(options),\n op,\n field: queryField(field),\n offset,\n };\n}\n\n/** The filters on a time field: calendar periods, days relative to today, and instants relative to the server's now. */\nexport const timeFilters = {\n /**\n * Matches times within today, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'today', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.today('state.createTime', { timeZone: 'Asia/Shanghai' });\n * ```\n */\n today<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.TODAY, field, options);\n },\n /**\n * Matches times earlier than today at the local time `time`\n * (`field < today at time`) in the configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param time - 24-hour local time: `HH:mm`, `HH:mm:ss` or `HH:mm:ss.S` with\n * 1 to 9 fraction digits.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'before-today', field, time }`, plus `timeZone` when set.\n * @throws TypeError If `time` is not a string in one of the formats above,\n * `field` is not a valid query field path, or `timeZone` is blank or an\n * invalid UTC offset.\n * @example\n * ```typescript\n * filter.beforeToday('state.createTime', '12:00');\n * ```\n */\n beforeToday<FIELDS extends string>(\n field: FIELDS,\n time: string,\n options: RelativeTimeFilterOptions = {},\n ): BeforeTodayFilter<FIELDS> {\n const localTime = requireLocalTime(time);\n return {\n ...validateRelativeTimeOptions(options),\n op: FilterOperator.BEFORE_TODAY,\n field: queryField(field),\n time: localTime,\n };\n },\n /**\n * Matches times within tomorrow, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'tomorrow', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.tomorrow('state.createTime');\n * ```\n */\n tomorrow<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.TOMORROW, field, options);\n },\n /**\n * Matches times within the current Monday-start week, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'this-week', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.thisWeek('state.createTime');\n * ```\n */\n thisWeek<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.THIS_WEEK, field, options);\n },\n /**\n * Matches times within the next Monday-start week, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'next-week', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.nextWeek('state.createTime');\n * ```\n */\n nextWeek<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.NEXT_WEEK, field, options);\n },\n /**\n * Matches times within the previous Monday-start week, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'last-week', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.lastWeek('state.createTime');\n * ```\n */\n lastWeek<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.LAST_WEEK, field, options);\n },\n /**\n * Matches times within the current calendar month, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'this-month', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.thisMonth('state.createTime');\n * ```\n */\n thisMonth<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.THIS_MONTH, field, options);\n },\n /**\n * Matches times within the previous calendar month, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'last-month', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.lastMonth('state.createTime');\n * ```\n */\n lastMonth<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.LAST_MONTH, field, options);\n },\n /**\n * Matches times within yesterday, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'yesterday', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.yesterday('state.createTime');\n * ```\n */\n yesterday<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.YESTERDAY, field, options);\n },\n /**\n * Matches times within the next calendar month, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'next-month', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.nextMonth('state.createTime');\n * ```\n */\n nextMonth<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.NEXT_MONTH, field, options);\n },\n /**\n * Matches times within the previous calendar year, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'last-year', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.lastYear('state.createTime');\n * ```\n */\n lastYear<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.LAST_YEAR, field, options);\n },\n /**\n * Matches times within the current calendar year, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'this-year', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.thisYear('state.createTime', { timeZone: 'Asia/Shanghai' });\n * ```\n */\n thisYear<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.THIS_YEAR, field, options);\n },\n /**\n * Matches times within the next calendar year, as the half-open range `[start, end)` in the\n * configured time zone.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'next-year', field }`, plus `timeZone` when set.\n * @throws TypeError If `field` is not a valid query field path, or `timeZone` is\n * blank or an invalid UTC offset.\n * @example\n * ```typescript\n * filter.nextYear('state.createTime');\n * ```\n */\n nextYear<FIELDS extends string>(\n field: FIELDS,\n options: RelativeTimeFilterOptions = {},\n ): CalendarFilter<FIELDS> {\n return calendar(FilterOperator.NEXT_YEAR, field, options);\n },\n /**\n * Matches times from the start of the day `days - 1` days ago until the end\n * of today. `recentDays(field, 7)` covers today and the six previous days.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param days - Number of calendar days, including today; an integer from\n * 1 to 2147483647.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'recent-days', field, days }`, plus `timeZone` when set.\n * @throws TypeError If `days` is not an integer from 1 to 2147483647,\n * `field` is not a valid query field path, or `timeZone` is blank or an\n * invalid UTC offset.\n * @example\n * ```typescript\n * filter.recentDays('state.createTime', 7);\n * ```\n */\n recentDays<FIELDS extends string>(\n field: FIELDS,\n days: number,\n options: RelativeTimeFilterOptions = {},\n ): DaysFilter<FIELDS> {\n return dayWindow(FilterOperator.RECENT_DAYS, field, days, options);\n },\n /**\n * Matches times before the start of the day `days - 1` days ago, that is,\n * before the window that `recentDays` covers with the same `days`.\n *\n * @param field - Query field path, e.g. `state.status`.\n * @param days - Number of calendar days, including today; an integer from\n * 1 to 2147483647.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'earlier-days', field, days }`, plus `timeZone` when set.\n * @throws TypeError If `days` is not an integer from 1 to 2147483647,\n * `field` is not a valid query field path, or `timeZone` is blank or an\n * invalid UTC offset.\n * @example\n * ```typescript\n * filter.earlierDays('state.createTime', 7);\n * ```\n */\n earlierDays<FIELDS extends string>(\n field: FIELDS,\n days: number,\n options: RelativeTimeFilterOptions = {},\n ): DaysFilter<FIELDS> {\n return dayWindow(FilterOperator.EARLIER_DAYS, field, days, options);\n },\n /**\n * Matches times strictly before the server's `now + offset`\n * (`field < now + offset`). The server reads its clock once per query,\n * so a saved query never depends on the client's clock, and the moment is\n * encoded the way the query schema says the field stores time: an epoch in\n * its unit, or text in its pattern, in the zone `timeZone` names.\n *\n * Needs a Wow server of 9.2.0 or later; an earlier one refuses `BEFORE_NOW`.\n *\n * @param field - Query field path, e.g. `state.timeoutAt`.\n * @param offset - ISO-8601 duration added to now, as\n * `java.time.Duration.parse` reads it: days, hours, minutes and seconds,\n * each optionally signed, e.g. `PT0S`, `-PT30M` or `P1DT2H`. A negative\n * offset looks back. Defaults to `PT0S`, now itself.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'before-now', field, offset }`, plus `timeZone` when set.\n * @throws TypeError If `offset` is not an ISO-8601 duration in that\n * grammar, `field` is not a valid query field path, or `timeZone` is blank\n * or an invalid UTC offset.\n * @example\n * ```typescript\n * // Timed out: the deadline has passed.\n * filter.beforeNow('state.timeoutAt');\n * ```\n */\n beforeNow<FIELDS extends string>(\n field: FIELDS,\n offset = 'PT0S',\n options: RelativeTimeFilterOptions = {},\n ): NowFilter<FIELDS> {\n return nowRelative(FilterOperator.BEFORE_NOW, field, offset, options);\n },\n /**\n * Matches times strictly after the server's `now + offset`\n * (`field > now + offset`). The server reads its clock once per query,\n * so a saved query never depends on the client's clock, and the moment is\n * encoded the way the query schema says the field stores time: an epoch in\n * its unit, or text in its pattern, in the zone `timeZone` names.\n *\n * Needs a Wow server of 9.2.0 or later; an earlier one refuses `AFTER_NOW`.\n *\n * @param field - Query field path, e.g. `state.timeoutAt`.\n * @param offset - ISO-8601 duration added to now, as\n * `java.time.Duration.parse` reads it: days, hours, minutes and seconds,\n * each optionally signed, e.g. `PT0S`, `-PT30M` or `P1DT2H`. A negative\n * offset looks back. Defaults to `PT0S`, now itself.\n * @param options - Optional `timeZone`; see {@link RelativeTimeFilterOptions}.\n * @returns `{ op: 'after-now', field, offset }`, plus `timeZone` when set.\n * @throws TypeError If `offset` is not an ISO-8601 duration in that\n * grammar, `field` is not a valid query field path, or `timeZone` is blank\n * or an invalid UTC offset.\n * @example\n * ```typescript\n * // Created in the last 30 minutes.\n * filter.afterNow('state.createTime', '-PT30M');\n * ```\n */\n afterNow<FIELDS extends string>(\n field: FIELDS,\n offset = 'PT0S',\n options: RelativeTimeFilterOptions = {},\n ): NowFilter<FIELDS> {\n return nowRelative(FilterOperator.AFTER_NOW, field, offset, options);\n },\n};\n"],"mappings":"A,wFA6BA,SAASO,EACP,EACA,EACA,EACwB,CACxB,MAAO,CACL,GAAGP,EAAAA,4BAA4BQ,CAAO,EACtC,KACA,MAAOP,EAAAA,WAAWQ,CAAK,CACzB,CACF,CAEA,SAASC,EACP,EACA,EACA,EACA,EACoB,CAEpB,OADAJ,EAAA,aAAaK,EAAIC,CAAI,EACd,CACL,GAAGZ,EAAAA,4BAA4BQ,CAAO,EACtC,KACA,MAAOP,EAAAA,WAAWQ,CAAK,EACvB,MACF,CACF,CAEA,SAASI,EACP,EACA,EACA,EACA,EACmB,CAEnB,OADAP,EAAA,gBAAgBK,EAAIG,CAAM,EACnB,CACL,GAAGd,EAAAA,4BAA4BQ,CAAO,EACtC,KACA,MAAOP,EAAAA,WAAWQ,CAAK,EACvB,QACF,CACF,CAGA,IAAaM,EAAc,CAezB,MACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOR,EAASL,EAAAA,eAAe,MAAOO,EAAOD,CAAO,CACtD,EAkBA,YACE,EACA,EACA,EAAqC,CAAC,EACX,CAC3B,IAAMQ,EAAYb,EAAAA,iBAAiBc,CAAI,EACvC,MAAO,CACL,GAAGjB,EAAAA,4BAA4BQ,CAAO,EACtC,GAAIN,EAAAA,eAAe,aACnB,MAAOD,EAAAA,WAAWQ,CAAK,EACvB,KAAMO,CACR,CACF,EAeA,SACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOT,EAASL,EAAAA,eAAe,SAAUO,EAAOD,CAAO,CACzD,EAeA,SACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOD,EAASL,EAAAA,eAAe,UAAWO,EAAOD,CAAO,CAC1D,EAeA,SACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOD,EAASL,EAAAA,eAAe,UAAWO,EAAOD,CAAO,CAC1D,EAeA,SACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOD,EAASL,EAAAA,eAAe,UAAWO,EAAOD,CAAO,CAC1D,EAeA,UACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOD,EAASL,EAAAA,eAAe,WAAYO,EAAOD,CAAO,CAC3D,EAeA,UACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOD,EAASL,EAAAA,eAAe,WAAYO,EAAOD,CAAO,CAC3D,EAeA,UACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOD,EAASL,EAAAA,eAAe,UAAWO,EAAOD,CAAO,CAC1D,EAeA,UACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOD,EAASL,EAAAA,eAAe,WAAYO,EAAOD,CAAO,CAC3D,EAeA,SACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOD,EAASL,EAAAA,eAAe,UAAWO,EAAOD,CAAO,CAC1D,EAeA,SACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOD,EAASL,EAAAA,eAAe,UAAWO,EAAOD,CAAO,CAC1D,EAeA,SACE,EACA,EAAqC,CAAC,EACd,CACxB,OAAOD,EAASL,EAAAA,eAAe,UAAWO,EAAOD,CAAO,CAC1D,EAkBA,WACE,EACA,EACA,EAAqC,CAAC,EAClB,CACpB,OAAOE,EAAUR,EAAAA,eAAe,YAAaO,EAAOG,EAAMJ,CAAO,CACnE,EAkBA,YACE,EACA,EACA,EAAqC,CAAC,EAClB,CACpB,OAAOE,EAAUR,EAAAA,eAAe,aAAcO,EAAOG,EAAMJ,CAAO,CACpE,EA0BA,UACE,EACA,EAAS,OACT,EAAqC,CAAC,EACnB,CACnB,OAAOK,EAAYX,EAAAA,eAAe,WAAYO,EAAOK,EAAQN,CAAO,CACtE,EA0BA,SACE,EACA,EAAS,OACT,EAAqC,CAAC,EACnB,CACnB,OAAOK,EAAYX,EAAAA,eAAe,UAAWO,EAAOK,EAAQN,CAAO,CACrE,CACF,E"}
|