@mgamadeus/ddd-web 0.0.1 → 0.2.2
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/.claude/skills/ddd-web-specialist/SKILL.md +110 -0
- package/.claude/skills/ddd-web-specialist/references/consumer.md +277 -0
- package/.claude/skills/ddd-web-specialist/references/maintaining.md +107 -0
- package/CHANGELOG.md +103 -0
- package/README.md +68 -2
- package/dist/api/index.d.ts +270 -0
- package/dist/api/index.js +292 -0
- package/dist/api/index.js.map +1 -0
- package/dist/auth/index.d.ts +109 -0
- package/dist/auth/index.js +146 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/chunk-OL742YG5.js +1514 -0
- package/dist/chunk-OL742YG5.js.map +1 -0
- package/dist/chunk-QLCE3QTP.js +123 -0
- package/dist/chunk-QLCE3QTP.js.map +1 -0
- package/dist/codegen/cli.js +77 -0
- package/dist/codegen/cli.js.map +1 -0
- package/dist/codegen/index.d.ts +342 -0
- package/dist/codegen/index.js +25 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/contract/index.d.ts +109 -0
- package/dist/contract/index.js +126 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/errors-B4KabvNa.d.ts +22 -0
- package/dist/extensions-DToc6G5E.d.ts +208 -0
- package/dist/query/index.d.ts +372 -0
- package/dist/query/index.js +860 -0
- package/dist/query/index.js.map +1 -0
- package/dist/types-BhDMN3ZS.d.ts +35 -0
- package/package.json +58 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** One entry of `ExceptionDetails.elements` in a DDD error response. */
|
|
2
|
+
interface DddExceptionDetail {
|
|
3
|
+
message?: string | null;
|
|
4
|
+
details?: unknown[] | null;
|
|
5
|
+
objectType?: string | null;
|
|
6
|
+
}
|
|
7
|
+
/** `DDD.Infrastructure.Exceptions.ExceptionDetails`. */
|
|
8
|
+
interface DddExceptionDetails {
|
|
9
|
+
elements?: DddExceptionDetail[];
|
|
10
|
+
objectType?: string | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Body of every DDD error response (`DDD.Infrastructure.Exceptions.*Exception`, e.g. BadRequestException).
|
|
14
|
+
* `validationErrors` is present on 400 responses caused by DTO/entity validation.
|
|
15
|
+
*/
|
|
16
|
+
interface DddErrorBody {
|
|
17
|
+
error?: string | null;
|
|
18
|
+
validationErrors?: unknown;
|
|
19
|
+
exceptionDetails?: DddExceptionDetails | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type { DddExceptionDetail as D, DddErrorBody as a, DddExceptionDetails as b };
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter operators of the DDD `filters` grammar.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `FiltersOptions::OPERATORS` in DDD Core: two-letter, case-insensitive operators. Comparison operators take a
|
|
5
|
+
* single scalar, list operators take a list (`bw` exactly two items), fulltext operators take a non-empty search string.
|
|
6
|
+
*/
|
|
7
|
+
type ComparisonOperator = 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le';
|
|
8
|
+
/** Operators whose value is a list: `in`, `ni` (not in), `bw` (between, exactly two items). */
|
|
9
|
+
type ListOperator = 'in' | 'ni' | 'bw';
|
|
10
|
+
/** Fulltext operators (MATCH AGAINST): `ft` natural language mode, `fb` boolean mode. */
|
|
11
|
+
type FulltextOperator = 'ft' | 'fb';
|
|
12
|
+
/** Every operator the backend parser accepts. */
|
|
13
|
+
type FilterOperator = ComparisonOperator | ListOperator | FulltextOperator;
|
|
14
|
+
/** Join operators connecting two filter terms. */
|
|
15
|
+
type FilterJoinOperator = 'and' | 'or';
|
|
16
|
+
/** Mirrors `FiltersOptions::OPERATORS`. */
|
|
17
|
+
declare const FILTER_OPERATORS: readonly FilterOperator[];
|
|
18
|
+
/** Mirrors `FiltersOptions::ALLOWED_OPERATORS_ON_ARRAY_VALUE`. */
|
|
19
|
+
declare const LIST_OPERATORS: readonly ListOperator[];
|
|
20
|
+
/** Mirrors `FiltersOptions::FULLTEXT_OPERATORS`. */
|
|
21
|
+
declare const FULLTEXT_OPERATORS: readonly FulltextOperator[];
|
|
22
|
+
/** Mirrors `FiltersOptions::ALLOWED_OPERATORS_ON_NULL_VALUE`: a null value is only allowed with `eq` / `ne`. */
|
|
23
|
+
declare const NULL_OPERATORS: readonly ComparisonOperator[];
|
|
24
|
+
/** Whether `value` is one of the operators the backend parser accepts (case-sensitive, lowercase). */
|
|
25
|
+
declare function isFilterOperator(value: unknown): value is FilterOperator;
|
|
26
|
+
/** Whether the operator takes a list value (`in`, `ni`, `bw`). */
|
|
27
|
+
declare function isListOperator(operator: FilterOperator): operator is ListOperator;
|
|
28
|
+
/** Whether the operator is a fulltext operator (`ft`, `fb`). */
|
|
29
|
+
declare function isFulltextOperator(operator: FilterOperator): operator is FulltextOperator;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* QueryOptions request parameters as the backend reads them.
|
|
33
|
+
*
|
|
34
|
+
* The names are matched verbatim against the request DTO properties (`DtoQueryOptionsTrait`): `filters`, `orderBy`,
|
|
35
|
+
* `expand`, `select`, `top`, `skip` — no `$` prefix. `top` defaults to 50 on the backend (`QueryOptions::$top`).
|
|
36
|
+
*/
|
|
37
|
+
interface QueryOptionsParams {
|
|
38
|
+
/** Filter expression, e.g. `name eq 'Dune' and year ge '1965'`. */
|
|
39
|
+
filters?: string;
|
|
40
|
+
/** Comma-separated sort list, e.g. `title asc,id desc`. */
|
|
41
|
+
orderBy?: string;
|
|
42
|
+
/** Comma-separated expand list with optional `(…)` clauses, e.g. `author(select=id,name;top=5)`. */
|
|
43
|
+
expand?: string;
|
|
44
|
+
/** Comma-separated property list, e.g. `id,title`. */
|
|
45
|
+
select?: string;
|
|
46
|
+
/** Page size (backend default 50, capped by `maxTop` where declared). */
|
|
47
|
+
top?: number;
|
|
48
|
+
/** Offset. */
|
|
49
|
+
skip?: number;
|
|
50
|
+
}
|
|
51
|
+
/** Sort direction accepted by `orderBy` (case-insensitive on the backend, `OrderByOption::__construct`). */
|
|
52
|
+
type OrderDirection = 'asc' | 'desc';
|
|
53
|
+
/** Default page size of the backend when `top` is absent (`QueryOptions::$top = 50`). */
|
|
54
|
+
declare const DEFAULT_TOP = 50;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Types of the `x-ddd-*` OpenAPI extensions emitted by DDD Core, plus the defaults that apply when an extension is
|
|
58
|
+
* absent. All extensions are additive: a document without them is valid and is read with the defaults below.
|
|
59
|
+
*/
|
|
60
|
+
/** `info.x-ddd-contract`: contract number and the emitting `mgamadeus/ddd` version. */
|
|
61
|
+
interface DddContractInfo {
|
|
62
|
+
/** Contract number; bumped on every change of an `x-ddd-*` key, an implicit part or a default. */
|
|
63
|
+
contract: number;
|
|
64
|
+
/** Version of the `mgamadeus/ddd` package that emitted the document, e.g. `3.14.0`. */
|
|
65
|
+
ddd: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Column kind of a filter (`FiltersDefinition::COLUMN_KIND_*`): what a filter value is validated and bound as.
|
|
69
|
+
* `translatable` is a plain `#[Translatable]` (JSON of all languages), `translatable-searchable` one with
|
|
70
|
+
* `fullTextIndex: true` (comparisons run on its virtual search column).
|
|
71
|
+
*/
|
|
72
|
+
type DddColumnKind = 'int' | 'float' | 'bool' | 'string' | 'datetime' | 'json' | 'translatable' | 'translatable-searchable';
|
|
73
|
+
/**
|
|
74
|
+
* Temporal kind of a filter (`FiltersDefinition::TEMPORAL_KIND_*`): `MOMENT` = an instant (date-time),
|
|
75
|
+
* `DAY` = a calendar day (date, never zone-converted).
|
|
76
|
+
*/
|
|
77
|
+
type DddTemporalKind = 'MOMENT' | 'DAY';
|
|
78
|
+
/**
|
|
79
|
+
* A value rule for one operator of a filter. Known rules:
|
|
80
|
+
* - `wildcard-required`: the value must contain `*` (plain Translatable `eq` / `ne`, a LIKE on the JSON text);
|
|
81
|
+
* - `null-only`: only a null comparison is allowed (JSON columns).
|
|
82
|
+
* Further rules may be added by the contract; unknown rules must be ignored by clients.
|
|
83
|
+
*/
|
|
84
|
+
type DddFilterValueRule = 'wildcard-required' | 'null-only' | (string & {});
|
|
85
|
+
/** One filter definition inside `x-ddd-query.filters`. */
|
|
86
|
+
interface DddFilterDefinition {
|
|
87
|
+
/** Filter property name as used in `filters`, may be dotted (e.g. `author.name`). */
|
|
88
|
+
name: string;
|
|
89
|
+
/** Path of the filtered value in the response schema (e.g. `changeHistory.createdTime`); `null` if none. */
|
|
90
|
+
path?: string | null;
|
|
91
|
+
/** Column kind; absent or `null` = no value validation on the backend. */
|
|
92
|
+
columnKind?: DddColumnKind | null;
|
|
93
|
+
/** Temporal kind; absent or `null` = not temporal. */
|
|
94
|
+
temporalKind?: DddTemporalKind | null;
|
|
95
|
+
/** Whether `ft` / `fb` work on this filter (single-column FULLTEXT index). */
|
|
96
|
+
supportsFulltext?: boolean;
|
|
97
|
+
/** Allowed values (`FiltersDefinition::$options`); every value, also each list item, must be one of them. */
|
|
98
|
+
options?: Array<string | number> | null;
|
|
99
|
+
/** Operators allowed for this filter; absent = every operator the column kind accepts. */
|
|
100
|
+
operators?: FilterOperator[];
|
|
101
|
+
/** Value rules per operator. */
|
|
102
|
+
valueRules?: Partial<Record<FilterOperator, DddFilterValueRule>>;
|
|
103
|
+
/** Name of the expand that must be present in `expand` for this filter to be accepted; absent = none. */
|
|
104
|
+
requiresExpand?: string | null;
|
|
105
|
+
}
|
|
106
|
+
/** One expand definition inside `x-ddd-query.expand`. */
|
|
107
|
+
interface DddExpandDefinition {
|
|
108
|
+
/** Property name to expand (no dots; nesting goes through `expand`). */
|
|
109
|
+
name: string;
|
|
110
|
+
/** `true` for a computed field (no relation, no clauses), e.g. a rendered SVG. */
|
|
111
|
+
computed?: boolean;
|
|
112
|
+
/** Default `top` inside the expand clause. */
|
|
113
|
+
top?: number;
|
|
114
|
+
/** Upper bound for `top` inside the expand clause. */
|
|
115
|
+
maxTop?: number | null;
|
|
116
|
+
/** Default `skip` inside the expand clause. */
|
|
117
|
+
skip?: number;
|
|
118
|
+
/** Filters available inside the expand clause (`filters=` in `(…)`). */
|
|
119
|
+
filters?: DddFilterDefinition[];
|
|
120
|
+
/** Sortable properties inside the expand clause. */
|
|
121
|
+
orderBy?: string[];
|
|
122
|
+
/** Nested expands (`expand=` in `(…)`). */
|
|
123
|
+
expand?: DddExpandDefinition[];
|
|
124
|
+
}
|
|
125
|
+
/** `x-ddd-query` on an operation whose request DTO applies QueryOptions. */
|
|
126
|
+
interface DddQueryDefinition {
|
|
127
|
+
filters?: DddFilterDefinition[];
|
|
128
|
+
/** Sortable property names. */
|
|
129
|
+
orderBy?: string[];
|
|
130
|
+
expand?: DddExpandDefinition[];
|
|
131
|
+
/** `true` = `select` accepted (any property), a list = the selectable properties, `false`/absent = not exposed. */
|
|
132
|
+
select?: boolean | string[];
|
|
133
|
+
/** Default page size (backend default 50). */
|
|
134
|
+
top?: number;
|
|
135
|
+
/** Upper bound for `top` (`#[QueryOptions(maxTop: …)]`); a larger `top` answers 400. */
|
|
136
|
+
maxTop?: number | null;
|
|
137
|
+
}
|
|
138
|
+
/** `x-ddd-entity.action`. DDD `#[Update]` is an upsert. */
|
|
139
|
+
type DddEntityAction = 'list' | 'get' | 'upsert' | 'delete' | 'action';
|
|
140
|
+
/** `x-ddd-entity` on an operation. Absent = unknown entity, clients invalidate conservatively. */
|
|
141
|
+
interface DddEntityInfo {
|
|
142
|
+
/** Entity schema name, e.g. `App.Domain.Library.Entities.Books.Book`. */
|
|
143
|
+
schema: string;
|
|
144
|
+
action: DddEntityAction;
|
|
145
|
+
/** Identity source, `path:<parameter>` or `body:<dotted.path>` (e.g. `body:book.id`). */
|
|
146
|
+
identity?: string;
|
|
147
|
+
/** `true` when derived by DDD Core, `false` when set explicitly via `#[OperationEntity]`. */
|
|
148
|
+
derived: boolean;
|
|
149
|
+
}
|
|
150
|
+
/** Field-level `x-ddd-translatable` (from `#[Translatable]`). */
|
|
151
|
+
interface DddTranslatableInfo {
|
|
152
|
+
fullTextIndex?: boolean;
|
|
153
|
+
fullTextMode?: string;
|
|
154
|
+
}
|
|
155
|
+
/** Extensions on the document `info` object. */
|
|
156
|
+
interface DddInfoExtensions {
|
|
157
|
+
'x-ddd-contract'?: DddContractInfo;
|
|
158
|
+
}
|
|
159
|
+
/** Extensions on an operation object. */
|
|
160
|
+
interface DddOperationExtensions {
|
|
161
|
+
'x-ddd-query'?: DddQueryDefinition;
|
|
162
|
+
/** Absent = default by HTTP method (see {@link hasSideEffects}). */
|
|
163
|
+
'x-ddd-side-effects'?: boolean;
|
|
164
|
+
'x-ddd-entity'?: DddEntityInfo;
|
|
165
|
+
/** Cache TTL in seconds from `#[RequestCache]`. */
|
|
166
|
+
'x-ddd-cache-ttl'?: number;
|
|
167
|
+
}
|
|
168
|
+
/** Extensions on a schema property. */
|
|
169
|
+
interface DddPropertyExtensions {
|
|
170
|
+
'x-ddd-translatable'?: DddTranslatableInfo;
|
|
171
|
+
/** `#[HideProperty]`: never in responses, accepted in requests (write-only). Absent = visible. */
|
|
172
|
+
'x-ddd-hidden'?: boolean;
|
|
173
|
+
/** The stored value is kept when the property is omitted on an update of an existing entity. */
|
|
174
|
+
'x-ddd-preserve-on-omission'?: boolean;
|
|
175
|
+
}
|
|
176
|
+
/** Extensions on an entity schema. */
|
|
177
|
+
interface DddSchemaExtensions {
|
|
178
|
+
/** Roles required to write the entity (`RolesRequiredForUpdate`). */
|
|
179
|
+
'x-ddd-roles-required-for-update'?: string[];
|
|
180
|
+
}
|
|
181
|
+
/** HTTP methods of OpenAPI operations (lowercase or uppercase accepted by the helpers). */
|
|
182
|
+
type HttpMethod = 'get' | 'head' | 'post' | 'put' | 'patch' | 'delete' | 'options' | 'trace';
|
|
183
|
+
/**
|
|
184
|
+
* Whether an operation has side effects (contract defaults, Appendix A.6): `x-ddd-side-effects` wins when present,
|
|
185
|
+
* otherwise `false` for GET/HEAD/OPTIONS/TRACE and `true` for POST/PUT/PATCH/DELETE.
|
|
186
|
+
*/
|
|
187
|
+
declare function hasSideEffects(method: string, operation?: Pick<DddOperationExtensions, 'x-ddd-side-effects'> | null): boolean;
|
|
188
|
+
/** Whether a property is write-only (`x-ddd-hidden: true`). Absent = visible. */
|
|
189
|
+
declare function isHiddenProperty(property?: DddPropertyExtensions | null): boolean;
|
|
190
|
+
/** Whether a property keeps its stored value when omitted on an update (`x-ddd-preserve-on-omission: true`). */
|
|
191
|
+
declare function isPreservedOnOmission(property?: DddPropertyExtensions | null): boolean;
|
|
192
|
+
/** Whether a property is `#[Translatable]` (`x-ddd-translatable` present). */
|
|
193
|
+
declare function isTranslatableProperty(property?: DddPropertyExtensions | null): boolean;
|
|
194
|
+
/** Parsed `x-ddd-entity.identity`. */
|
|
195
|
+
interface DddEntityIdentity {
|
|
196
|
+
source: 'path' | 'body';
|
|
197
|
+
/** Path parameter name (`source: 'path'`) or dotted body path (`source: 'body'`). */
|
|
198
|
+
name: string;
|
|
199
|
+
}
|
|
200
|
+
/** Parses `x-ddd-entity.identity` (`path:bookId`, `body:book.id`); `null` for an absent or malformed value. */
|
|
201
|
+
declare function parseEntityIdentity(identity: string | null | undefined): DddEntityIdentity | null;
|
|
202
|
+
/** Reads `info.x-ddd-contract` from an OpenAPI document; `null` when the document carries no contract version. */
|
|
203
|
+
declare function getContractInfo(document: {
|
|
204
|
+
info?: DddInfoExtensions | null;
|
|
205
|
+
} | null | undefined): DddContractInfo | null;
|
|
206
|
+
|
|
207
|
+
export { isPreservedOnOmission as A, isTranslatableProperty as B, DEFAULT_TOP as D, parseEntityIdentity as E, FILTER_OPERATORS as F, LIST_OPERATORS as L, NULL_OPERATORS as N, FULLTEXT_OPERATORS as p, getContractInfo as u, hasSideEffects as v, isFilterOperator as w, isFulltextOperator as x, isHiddenProperty as y, isListOperator as z };
|
|
208
|
+
export type { ComparisonOperator as C, HttpMethod as H, OrderDirection as O, QueryOptionsParams as Q, DddColumnKind as a, DddContractInfo as b, DddEntityAction as c, DddEntityIdentity as d, DddEntityInfo as e, DddExpandDefinition as f, DddFilterDefinition as g, DddFilterValueRule as h, DddInfoExtensions as i, DddOperationExtensions as j, DddPropertyExtensions as k, DddQueryDefinition as l, DddSchemaExtensions as m, DddTemporalKind as n, DddTranslatableInfo as o, FilterJoinOperator as q, FilterOperator as r, FulltextOperator as s, ListOperator as t };
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { q as FilterJoinOperator, s as FulltextOperator, r as FilterOperator, t as ListOperator, O as OrderDirection, Q as QueryOptionsParams } from '../extensions-DToc6G5E.js';
|
|
2
|
+
import { DddColumnKind, DddFilterDefinition, DddQueryDefinition } from '../contract/index.js';
|
|
3
|
+
export { C as ComparisonOperator, D as DEFAULT_TOP, w as isFilterOperator, x as isFulltextOperator, z as isListOperator } from '../extensions-DToc6G5E.js';
|
|
4
|
+
|
|
5
|
+
/** Thrown by the builders for input the backend would answer with 400 (or parse differently than intended). */
|
|
6
|
+
declare class QueryOptionsError extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** A scalar filter value. A `Date` is written as a DDD date-time (`Y-m-d H:i:s`, UTC). */
|
|
11
|
+
type FilterScalar = string | number | boolean | Date | null;
|
|
12
|
+
/** A filter value: a scalar, or a list for `in` / `ni` / `bw`. */
|
|
13
|
+
type FilterValue = FilterScalar | readonly FilterScalar[];
|
|
14
|
+
/**
|
|
15
|
+
* Escapes text for use inside a single-quoted filter literal.
|
|
16
|
+
*
|
|
17
|
+
* Mirrors `FiltersOptionsParser::parseLiteral()`: inside `'…'` exactly two escapes exist, `\'` (a quote) and `\\`
|
|
18
|
+
* (one backslash); the literal ends at the first unescaped quote. Same rule as `FiltersOptions::toCanonicalLiteral()`.
|
|
19
|
+
* (Doubling quotes, `''`, is NOT understood by the backend: it ends the literal.)
|
|
20
|
+
*/
|
|
21
|
+
declare function escapeFilterString(value: string): string;
|
|
22
|
+
/** Alias of {@link escapeFilterString}, kept for code ported from OData-style helpers. */
|
|
23
|
+
declare const escapeOData: typeof escapeFilterString;
|
|
24
|
+
/**
|
|
25
|
+
* The string form of a scalar as the backend validates it (`FiltersOptions::getFilterValueAsString()`):
|
|
26
|
+
* a bool is `1` / `0`, a `Date` a UTC DDD date-time, a number its decimal form. Throws for a non-finite number or one
|
|
27
|
+
* that only has an exponent form (the column-kind check accepts `-?\d+(\.\d+)?` only).
|
|
28
|
+
*/
|
|
29
|
+
declare function filterScalarToString(value: Exclude<FilterScalar, null>): string;
|
|
30
|
+
/**
|
|
31
|
+
* Writes one scalar literal: `null` for null, every other scalar single-quoted and escaped.
|
|
32
|
+
*
|
|
33
|
+
* The backend rule is "every scalar MUST be wrapped in single quotes" (`FiltersOptions::getSyntaxDocumentation()`):
|
|
34
|
+
* the parser only reads unsigned unquoted numbers (`-5` fails), so numbers are quoted too; the column-kind check
|
|
35
|
+
* judges a quoted literal by content (`id eq '12'` is an int).
|
|
36
|
+
*/
|
|
37
|
+
declare function formatFilterScalar(value: FilterScalar): string;
|
|
38
|
+
/**
|
|
39
|
+
* Writes one list item as a JSON value: a double-quoted JSON string (every scalar is written as its string form, as
|
|
40
|
+
* in {@link formatFilterScalar}) or `null`. `FiltersOptionsParser::parseArrayLiteral()` keeps the escapes of a
|
|
41
|
+
* double-quoted item and JSON-decodes the list, so every character — also newlines and other control characters,
|
|
42
|
+
* which a single-quoted item cannot carry — arrives unchanged.
|
|
43
|
+
*/
|
|
44
|
+
declare function formatFilterListItem(value: FilterScalar): string;
|
|
45
|
+
/**
|
|
46
|
+
* Writes a filter literal: a scalar via {@link formatFilterScalar}, a list as `["a","b"]` (bracket list of JSON
|
|
47
|
+
* items, see {@link formatFilterListItem}).
|
|
48
|
+
*/
|
|
49
|
+
declare function formatFilterLiteral(value: FilterValue): string;
|
|
50
|
+
/**
|
|
51
|
+
* Throws unless `property` is a valid filter / orderBy / select property path. Mirrors
|
|
52
|
+
* `FiltersOptionsParser::parseIdentifier()`: letters, digits, `_` and `.` (dot-notation through expands).
|
|
53
|
+
*/
|
|
54
|
+
declare function assertPropertyPath(property: string, context?: string): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns the join operators (`and` / `or`) that occur at the top level of a filter expression — outside quoted
|
|
58
|
+
* literals, bracket lists and parentheses. Tokenisation mirrors `FiltersOptionsParser`: single-quoted literals with
|
|
59
|
+
* `\'` / `\\` escapes, double-quoted items inside lists, case-insensitive keywords that follow a term (whitespace
|
|
60
|
+
* optional) and are followed by whitespace, a parenthesis or the end of input.
|
|
61
|
+
*/
|
|
62
|
+
declare function topLevelJoinOperators(expression: string): Set<FilterJoinOperator>;
|
|
63
|
+
/** Wraps a clause in parentheses. */
|
|
64
|
+
declare function groupFilter(clause: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Joins clauses with `joinOperator`, parenthesising every clause that contains a top-level join operator other than
|
|
67
|
+
* `joinOperator`. Needed because `FiltersOptionsParser::parseExpression()` has NO precedence: it reads strictly
|
|
68
|
+
* left to right, so `x and a or b` means `(x and a) or b`.
|
|
69
|
+
*/
|
|
70
|
+
declare function joinFilters(joinOperator: FilterJoinOperator, clauses: readonly string[]): string | undefined;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Throws when the value shape does not fit the operator. Mirrors `FilterOptionsConstraintValidator::validate()`:
|
|
74
|
+
* null only with `eq` / `ne`; a list only with `in` / `ni` / `bw`; `in` / `ni` / `bw` need a list; `bw` exactly two
|
|
75
|
+
* items; `ft` / `fb` a non-empty string. Additionally refuses an empty `in` / `ni` list (an empty SQL IN list).
|
|
76
|
+
*/
|
|
77
|
+
declare function assertValueFitsOperator(operator: FilterOperator, value: FilterValue): void;
|
|
78
|
+
/**
|
|
79
|
+
* Builds one comparison `<property> <operator> <literal>`, e.g. `title eq 'O\'Brien'`, `id in ["1","2"]`,
|
|
80
|
+
* `published bw ["2026-01-01","2026-12-31"]`. The value is written by `formatFilterLiteral()` (quoted, escaped,
|
|
81
|
+
* bracket list for list operators), so callers never concatenate values themselves — the client-side counterpart of
|
|
82
|
+
* `FiltersOptions::createExpression()`. Throws {@link QueryOptionsError} for an invalid property path or a value
|
|
83
|
+
* shape the backend rejects.
|
|
84
|
+
*/
|
|
85
|
+
declare function buildFieldFilter(property: string, value: FilterValue, operator?: FilterOperator): string;
|
|
86
|
+
/** `<property> in|ni|bw [<values>]`; see {@link buildFieldFilter}. */
|
|
87
|
+
declare function buildListFilter(property: string, operator: ListOperator, values: readonly FilterScalar[]): string;
|
|
88
|
+
/** `<property> in [<values>]` — the value is one of the list. */
|
|
89
|
+
declare function buildInFilter(property: string, values: readonly FilterScalar[]): string;
|
|
90
|
+
/** `<property> ni [<values>]` — the value is none of the list. */
|
|
91
|
+
declare function buildNotInFilter(property: string, values: readonly FilterScalar[]): string;
|
|
92
|
+
/** `<property> bw [<from>,<to>]` — inclusive range (SQL BETWEEN). */
|
|
93
|
+
declare function buildBetweenFilter(property: string, from: FilterScalar, to: FilterScalar): string;
|
|
94
|
+
/** `<property> eq null` (IS NULL) or, with `negate`, `<property> ne null` (IS NOT NULL). */
|
|
95
|
+
declare function buildNullFilter(property: string, negate?: boolean): string;
|
|
96
|
+
/**
|
|
97
|
+
* `<property> eq '*<term>*'` — a LIKE "contains" match. `*` is the only wildcard on the backend (LIKE's own `%`, `_`
|
|
98
|
+
* are literal, `FiltersOptions::getFiltersExpressionForDoctrineQueryBuilder()`); a `*` in the term cannot be matched
|
|
99
|
+
* literally and acts as a wildcard too. Returns `undefined` for a blank term.
|
|
100
|
+
*/
|
|
101
|
+
declare function buildContainsFilter(property: string, term: string, negate?: boolean): string | undefined;
|
|
102
|
+
/** Appends `*` to each word for boolean-mode fulltext prefix matching: `dune mess` → `dune* mess*`. */
|
|
103
|
+
declare function toBooleanPrefix(value: string): string;
|
|
104
|
+
/** Options of {@link buildFulltextFilter}. */
|
|
105
|
+
interface FulltextFilterOptions {
|
|
106
|
+
/** `ft` natural language mode (default) or `fb` boolean mode. */
|
|
107
|
+
mode?: FulltextOperator;
|
|
108
|
+
/** In boolean mode, append `*` to every word (prefix match). Default `true` for `fb`. */
|
|
109
|
+
prefix?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* `<property> ft|fb '<term>'` — fulltext search (MATCH AGAINST). Requires a FULLTEXT index on the backend
|
|
113
|
+
* (`FiltersDefinition::$supportsFulltext`). Returns `undefined` for a blank term.
|
|
114
|
+
*/
|
|
115
|
+
declare function buildFulltextFilter(property: string, term: string, options?: FulltextFilterOptions): string | undefined;
|
|
116
|
+
/** Options of {@link buildIntEqFilter}. */
|
|
117
|
+
interface IntEqFilterOptions {
|
|
118
|
+
/** A literal prefix to strip before the check, e.g. `#` in `#12`. */
|
|
119
|
+
stripLeadingChar?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* `<property> eq '<n>'` for a search term over an int column. Returns `undefined` unless the (optionally prefix-
|
|
123
|
+
* stripped) term is purely numeric: the backend answers 400 for a non-numeric value on an int column
|
|
124
|
+
* (`FiltersOptions::isFilterValueValidForColumnKind()`), so the clause is omitted instead.
|
|
125
|
+
*/
|
|
126
|
+
declare function buildIntEqFilter(rawValue: string, property: string, options?: IntEqFilterOptions): string | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* `<property> bw ["<day> 00:00:00","<day> 23:59:59"]` — a full UTC calendar day on a date-time column. Returns
|
|
129
|
+
* `undefined` unless `rawValue` is a real `YYYY-MM-DD` date: a partial date (`2026-10`) or one the calendar lacks
|
|
130
|
+
* (`2026-13-45`, `2026-02-30`) would answer 400 (`FiltersOptions::isFilterDateTimeLiteral()`).
|
|
131
|
+
*/
|
|
132
|
+
declare function buildFullDayFilter(rawValue: string, property: string): string | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* AND-joins filter clauses, skipping empty ones; `undefined` when none remain. A clause that contains a top-level
|
|
135
|
+
* `or` is parenthesised first: the backend parser has no precedence (`FiltersOptionsParser::parseExpression()` reads
|
|
136
|
+
* left to right), so `x and a or b` would mean `(x and a) or b`.
|
|
137
|
+
*/
|
|
138
|
+
declare function combineFilters(...parts: ReadonlyArray<string | null | undefined | false>): string | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* OR-joins filter clauses, skipping empty ones; `undefined` when none remain. A clause with a top-level `and` is
|
|
141
|
+
* parenthesised (no precedence on the backend). The result is not wrapped; {@link combineFilters} groups it when it
|
|
142
|
+
* is AND-joined with other clauses.
|
|
143
|
+
*/
|
|
144
|
+
declare function anyOfFilters(...parts: ReadonlyArray<string | null | undefined | false>): string | undefined;
|
|
145
|
+
|
|
146
|
+
/** One sort item: `'title'`, `'title desc'` or `{ property: 'title', direction: 'desc' }`. */
|
|
147
|
+
type OrderByItem = string | {
|
|
148
|
+
property: string;
|
|
149
|
+
direction?: OrderDirection;
|
|
150
|
+
};
|
|
151
|
+
/** Sort input: one item or a list (applied in order). */
|
|
152
|
+
type OrderByInput = OrderByItem | readonly OrderByItem[];
|
|
153
|
+
/** A parsed sort item. */
|
|
154
|
+
interface OrderByEntry {
|
|
155
|
+
property: string;
|
|
156
|
+
direction?: OrderDirection;
|
|
157
|
+
}
|
|
158
|
+
/** Normalises one sort item; throws for an invalid property or direction. */
|
|
159
|
+
declare function toOrderByEntry(item: OrderByItem): OrderByEntry;
|
|
160
|
+
/** Normalises sort input to a list of entries. */
|
|
161
|
+
declare function toOrderByEntries(input: OrderByInput | null | undefined): OrderByEntry[];
|
|
162
|
+
/**
|
|
163
|
+
* Builds the `orderBy` value, e.g. `title asc,id desc`; `undefined` for no items. Mirrors
|
|
164
|
+
* `OrderByOptions::fromString()`: items split on `,`, property and direction split on ONE space, direction `asc` /
|
|
165
|
+
* `desc` (case-insensitive, default asc). Dot-notation (`author.name`) and the fulltext `<property>Score` suffix are
|
|
166
|
+
* plain property paths here.
|
|
167
|
+
*/
|
|
168
|
+
declare function buildOrderBy(input: OrderByInput | null | undefined): string | undefined;
|
|
169
|
+
|
|
170
|
+
/** Select input: a list of property paths or one comma-separated string. */
|
|
171
|
+
type SelectInput = string | readonly string[];
|
|
172
|
+
/**
|
|
173
|
+
* Builds the `select` value, e.g. `id,title,author.name`; `undefined` for no fields. Mirrors
|
|
174
|
+
* `SelectOptions::fromString()`: properties unquoted, separated by `,`, dot-notation allowed; duplicates are dropped.
|
|
175
|
+
*/
|
|
176
|
+
declare function buildSelect(input: SelectInput | null | undefined): string | undefined;
|
|
177
|
+
|
|
178
|
+
/** What to do with a `top` above `maxTop`: `throw` (default) or `clamp` to `maxTop`. */
|
|
179
|
+
type TopOverflow = 'throw' | 'clamp';
|
|
180
|
+
/** Options of {@link normalizeTop}. */
|
|
181
|
+
interface TopOptions {
|
|
182
|
+
/** Upper bound (`#[QueryOptions(maxTop: …)]`, `x-ddd-query.maxTop`); null/undefined = none. */
|
|
183
|
+
maxTop?: number | null;
|
|
184
|
+
overflow?: TopOverflow;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Validates `top`. Mirrors `AppliedQueryOptions::setTop()`: above `maxTop` the backend answers 400, so this throws
|
|
188
|
+
* (or clamps with `overflow: 'clamp'`); below 1 the backend raises to 1, so this throws for a non-positive value
|
|
189
|
+
* instead of silently changing it. `undefined` stays `undefined` (backend default 50).
|
|
190
|
+
*/
|
|
191
|
+
declare function normalizeTop(top: number | null | undefined, options?: TopOptions): number | undefined;
|
|
192
|
+
/**
|
|
193
|
+
* Validates `skip`: a non-negative integer (`AppliedQueryOptions::setSkip()` clamps below 0). `undefined` and `0` stay
|
|
194
|
+
* as given.
|
|
195
|
+
*/
|
|
196
|
+
declare function normalizeSkip(skip: number | null | undefined): number | undefined;
|
|
197
|
+
/** `skip` for a zero-based page index and page size: `pageIndex * pageSize`. */
|
|
198
|
+
declare function pageToSkip(pageIndex: number, pageSize: number): number;
|
|
199
|
+
|
|
200
|
+
/** Clauses of one expand, written as `property(filters=…;orderBy=…;select=…;top=…;skip=…;expand=…)`. */
|
|
201
|
+
interface ExpandClauses {
|
|
202
|
+
/** Filter(s) on the expanded collection; a list is AND-combined. Cuts the expanded collection, not the roots. */
|
|
203
|
+
filters?: string | ReadonlyArray<string | null | undefined | false>;
|
|
204
|
+
orderBy?: OrderByInput;
|
|
205
|
+
select?: SelectInput;
|
|
206
|
+
top?: number;
|
|
207
|
+
skip?: number;
|
|
208
|
+
/** Nested expands. */
|
|
209
|
+
expand?: ExpandInput;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* One expand item: a property name, a dotted path (`author.books` = `author(expand=books)`), or an object with
|
|
213
|
+
* `property` and clauses.
|
|
214
|
+
*/
|
|
215
|
+
type ExpandItem = string | ({
|
|
216
|
+
property: string;
|
|
217
|
+
} & ExpandClauses);
|
|
218
|
+
/** A map form: `{ author: true, reviews: { top: 5 } }`. */
|
|
219
|
+
type ExpandMap = {
|
|
220
|
+
readonly [property: string]: true | ExpandClauses;
|
|
221
|
+
};
|
|
222
|
+
/** Expand input: one item, a list of items, or a map. */
|
|
223
|
+
type ExpandInput = ExpandItem | readonly ExpandItem[] | ExpandMap;
|
|
224
|
+
/**
|
|
225
|
+
* Builds the `expand` value, e.g. `author(select=id,name),reviews(filters=rating ge '4';orderBy=created desc;top=5)`;
|
|
226
|
+
* `undefined` for no items. Grammar of `ExpandOptions::fromString()` / `ExpandOption::parseExpandParameters()`:
|
|
227
|
+
* comma-separated property names (`\w+`), each with optional `;`-separated clauses in parentheses — `filters`,
|
|
228
|
+
* `orderBy`, `select`, `top`, `skip` and a recursive `expand`. Dotted paths (`author.books`) become nested expands;
|
|
229
|
+
* repeated properties are merged (filters AND-combined, later clause values win).
|
|
230
|
+
*/
|
|
231
|
+
declare function buildExpand(input: ExpandInput | null | undefined): string | undefined;
|
|
232
|
+
/** A normalised expand: one property with its merged clauses and nested expands. */
|
|
233
|
+
interface ExpandTreeNode {
|
|
234
|
+
property: string;
|
|
235
|
+
filters?: string;
|
|
236
|
+
orderBy?: OrderByInput;
|
|
237
|
+
select?: SelectInput;
|
|
238
|
+
top?: number;
|
|
239
|
+
skip?: number;
|
|
240
|
+
children: ExpandTreeNode[];
|
|
241
|
+
}
|
|
242
|
+
/** Normalises expand input into a tree (dotted paths nested, repeated properties merged). */
|
|
243
|
+
declare function toExpandTree(input: ExpandInput | null | undefined): ExpandTreeNode[];
|
|
244
|
+
/** Top-level property names of an expand input (e.g. to check a filter's `requiresExpand`). */
|
|
245
|
+
declare function expandedProperties(input: ExpandInput | null | undefined): string[];
|
|
246
|
+
|
|
247
|
+
/** Input of {@link buildQueryOptions}. */
|
|
248
|
+
interface QueryOptionsInput {
|
|
249
|
+
/** One filter expression or a list of clauses (AND-combined, `or` clauses parenthesised). */
|
|
250
|
+
filters?: string | ReadonlyArray<string | null | undefined | false> | null;
|
|
251
|
+
orderBy?: OrderByInput | null;
|
|
252
|
+
expand?: ExpandInput | null;
|
|
253
|
+
select?: SelectInput | null;
|
|
254
|
+
top?: number | null;
|
|
255
|
+
skip?: number | null;
|
|
256
|
+
}
|
|
257
|
+
/** Options of {@link buildQueryOptions}. */
|
|
258
|
+
interface BuildQueryOptionsOptions {
|
|
259
|
+
/** Upper bound for `top` (`x-ddd-query.maxTop`). */
|
|
260
|
+
maxTop?: number | null;
|
|
261
|
+
/** Above `maxTop`: `throw` (default, the backend would answer 400) or `clamp`. */
|
|
262
|
+
topOverflow?: TopOverflow;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Builds the QueryOptions request parameters with the wire names the backend reads (`filters`, `orderBy`,
|
|
266
|
+
* `expand`, `select`, `top`, `skip` — no `$` prefix, `DtoQueryOptionsTrait`). Empty parts are left out, so the result
|
|
267
|
+
* can be spread into a query-argument object directly.
|
|
268
|
+
*/
|
|
269
|
+
declare function buildQueryOptions(input: QueryOptionsInput, options?: BuildQueryOptionsOptions): QueryOptionsParams;
|
|
270
|
+
|
|
271
|
+
/** Removes leading whitespace from a search input (trailing whitespace is kept while the user is typing). */
|
|
272
|
+
declare function sanitizeSearchInput(value: string): string;
|
|
273
|
+
/** Sanitises every per-column search value and drops the empty ones. */
|
|
274
|
+
declare function sanitizeColumnSearches(columnSearches: Record<string, string>): Record<string, string>;
|
|
275
|
+
/**
|
|
276
|
+
* Builds a stable key from static query arguments, e.g. to reset paging when they change: the arguments sorted by
|
|
277
|
+
* name, serialised as a JSON list of `[name, value]` pairs (collision-free: `{ a: '1&b=2' }` and `{ a: '1', b: '2' }`
|
|
278
|
+
* differ). `undefined` counts as `null`. Empty for no arguments.
|
|
279
|
+
*/
|
|
280
|
+
declare function buildStaticArgsKey(staticArgs: Record<string, unknown> | null | undefined): string;
|
|
281
|
+
/** Builds a stable key from per-column search state (non-empty values, sorted by column key, JSON pairs). */
|
|
282
|
+
declare function buildColumnSearchesKey(searches: Record<string, string>): string;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Whether a string is a date-time filter literal the backend accepts. Mirrors `FiltersOptions::isFilterDateTimeLiteral()`
|
|
286
|
+
* over `DateTime::MODEL_INPUT_FORMATS` plus `Y-m-d`: `Y-m-d H:i:sP`, `Y-m-d\TH:i:sP`, `Y-m-d H:i:s`, `Y-m-d H:i`,
|
|
287
|
+
* `Y-m-d\TH:i:s`, `Y-m-d` (offset or `Z`); a date the calendar lacks (`2026-13-45`) fails.
|
|
288
|
+
*/
|
|
289
|
+
declare function isFilterDateTimeLiteral(value: string): boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Whether one value (its string form) fits a scalar column kind. Mirrors
|
|
292
|
+
* `FiltersOptions::isFilterValueValidForColumnKind()`: int / float `-?\d+(\.\d+)?` (a decimal is accepted on an int
|
|
293
|
+
* column), bool `1|0|true|false` (case-insensitive), datetime {@link isFilterDateTimeLiteral}; every other kind and
|
|
294
|
+
* null pass.
|
|
295
|
+
*/
|
|
296
|
+
declare function isFilterValueValidForColumnKind(value: string | null, columnKind: DddColumnKind): boolean;
|
|
297
|
+
|
|
298
|
+
/** Machine-readable reason of a {@link QueryIssue}. */
|
|
299
|
+
type QueryIssueCode = 'unknown-property' | 'operator-not-allowed' | 'fulltext-not-supported' | 'invalid-value-shape' | 'column-kind' | 'value-rule' | 'option-not-allowed' | 'expand-required' | 'unknown-expand' | 'computed-expand-clauses' | 'unknown-order-by' | 'select-not-supported' | 'unknown-select' | 'top-exceeds-max';
|
|
300
|
+
/** One problem found by the definition-driven validators; the backend would answer 400 for it. */
|
|
301
|
+
interface QueryIssue {
|
|
302
|
+
code: QueryIssueCode;
|
|
303
|
+
message: string;
|
|
304
|
+
}
|
|
305
|
+
/** One filter condition before it is written as a string. */
|
|
306
|
+
interface FilterCondition {
|
|
307
|
+
property: string;
|
|
308
|
+
operator: FilterOperator;
|
|
309
|
+
value: FilterValue;
|
|
310
|
+
}
|
|
311
|
+
/** Context of a filter validation: the expands that will be sent with the filter. */
|
|
312
|
+
interface FilterValidationContext {
|
|
313
|
+
expand?: ExpandInput | null;
|
|
314
|
+
}
|
|
315
|
+
/** Thrown by the `buildDefined*` helpers; carries every issue found. */
|
|
316
|
+
declare class QueryValidationError extends QueryOptionsError {
|
|
317
|
+
readonly issues: QueryIssue[];
|
|
318
|
+
constructor(issues: QueryIssue[]);
|
|
319
|
+
}
|
|
320
|
+
/** A resolved filter definition plus the expand chain it was reached through (`author.name` → `['author']`). */
|
|
321
|
+
interface ResolvedFilterDefinition {
|
|
322
|
+
definition: DddFilterDefinition;
|
|
323
|
+
expandPath: string[];
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Finds the definition of a filter property. Mirrors `FiltersOptions::validateAgainstDefinitions()`: an exact name
|
|
327
|
+
* match first; otherwise a dotted property (`author.name`) resolves through the expand definition of its first
|
|
328
|
+
* segment and that expand's own filters, recursively.
|
|
329
|
+
*/
|
|
330
|
+
declare function resolveFilterDefinition(query: Pick<DddQueryDefinition, 'filters' | 'expand'>, property: string): ResolvedFilterDefinition | undefined;
|
|
331
|
+
/** Shorthand of {@link resolveFilterDefinition} returning only the definition. */
|
|
332
|
+
declare function findFilterDefinition(query: Pick<DddQueryDefinition, 'filters' | 'expand'>, property: string): DddFilterDefinition | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* Validates a filter condition against an `x-ddd-query` definition and returns every issue (empty = the backend
|
|
335
|
+
* accepts it). Rules mirrored: unknown property (`validateAgainstDefinitions`), declared operators, fulltext only
|
|
336
|
+
* with `supportsFulltext` (strict fulltext default), the value shape (`FilterOptionsConstraintValidator`), column
|
|
337
|
+
* kinds (`validateValueAgainstColumnKind`), contract `valueRules`, `options`, and required expands.
|
|
338
|
+
*/
|
|
339
|
+
declare function validateFilter(query: Pick<DddQueryDefinition, 'filters' | 'expand'>, condition: FilterCondition, context?: FilterValidationContext): QueryIssue[];
|
|
340
|
+
/**
|
|
341
|
+
* Validates and builds a filter clause from a definition; throws {@link QueryValidationError} with every issue. A
|
|
342
|
+
* `Date` value on a `DAY` filter is written as `Y-m-d`; on other filters as a UTC DDD date-time.
|
|
343
|
+
*/
|
|
344
|
+
declare function buildDefinedFilter(query: Pick<DddQueryDefinition, 'filters' | 'expand'>, property: string, operator: FilterOperator, value: FilterValue, context?: FilterValidationContext): string;
|
|
345
|
+
/**
|
|
346
|
+
* Validates sort input against `x-ddd-query.orderBy` (`OrderByOptions::validateAgainstDefinitions()`): declared
|
|
347
|
+
* properties, `<filter>Score` for a fulltext filter, dotted paths through expands. Without an `orderBy` list nothing
|
|
348
|
+
* is checked.
|
|
349
|
+
*/
|
|
350
|
+
declare function validateOrderBy(query: Pick<DddQueryDefinition, 'filters' | 'orderBy' | 'expand'>, input: OrderByInput | null | undefined): QueryIssue[];
|
|
351
|
+
/**
|
|
352
|
+
* Validates expand input against `x-ddd-query.expand` (`ExpandOptions::validateAgainstDefinitionsFromReferenceClass()`):
|
|
353
|
+
* declared names at every nesting level, no clauses on computed fields, `top` within an expand's `maxTop`, sort
|
|
354
|
+
* properties of the expand. Without an `expand` list every expand is reported unknown.
|
|
355
|
+
*/
|
|
356
|
+
declare function validateExpand(query: Pick<DddQueryDefinition, 'expand'>, input: ExpandInput | null | undefined): QueryIssue[];
|
|
357
|
+
/** Validates `select` fields against `x-ddd-query.select` (`true` = any field, a list = those fields). */
|
|
358
|
+
declare function validateSelect(query: Pick<DddQueryDefinition, 'select'>, fields: readonly string[] | string | null | undefined): QueryIssue[];
|
|
359
|
+
/** Options of {@link buildDefinedQueryOptions}. */
|
|
360
|
+
interface DefinedQueryOptionsOptions {
|
|
361
|
+
/** Above `maxTop`: `throw` (default) or `clamp`. */
|
|
362
|
+
topOverflow?: TopOverflow;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* {@link buildQueryOptions} checked against an `x-ddd-query` definition: validates `orderBy`, `expand` and `select`
|
|
366
|
+
* and honours `maxTop`; throws {@link QueryValidationError} with every issue. `filters` are taken as given — build
|
|
367
|
+
* the clauses with {@link buildDefinedFilter} to validate them.
|
|
368
|
+
*/
|
|
369
|
+
declare function buildDefinedQueryOptions(query: DddQueryDefinition, input: QueryOptionsInput, options?: DefinedQueryOptionsOptions): QueryOptionsParams;
|
|
370
|
+
|
|
371
|
+
export { FilterJoinOperator, FilterOperator, FulltextOperator, ListOperator, OrderDirection, QueryOptionsError, QueryOptionsParams, QueryValidationError, anyOfFilters, assertPropertyPath, assertValueFitsOperator, buildBetweenFilter, buildColumnSearchesKey, buildContainsFilter, buildDefinedFilter, buildDefinedQueryOptions, buildExpand, buildFieldFilter, buildFullDayFilter, buildFulltextFilter, buildInFilter, buildIntEqFilter, buildListFilter, buildNotInFilter, buildNullFilter, buildOrderBy, buildQueryOptions, buildSelect, buildStaticArgsKey, combineFilters, escapeFilterString, escapeOData, expandedProperties, filterScalarToString, findFilterDefinition, formatFilterListItem, formatFilterLiteral, formatFilterScalar, groupFilter, isFilterDateTimeLiteral, isFilterValueValidForColumnKind, joinFilters, normalizeSkip, normalizeTop, pageToSkip, resolveFilterDefinition, sanitizeColumnSearches, sanitizeSearchInput, toBooleanPrefix, toExpandTree, toOrderByEntries, toOrderByEntry, topLevelJoinOperators, validateExpand, validateFilter, validateOrderBy, validateSelect };
|
|
372
|
+
export type { BuildQueryOptionsOptions, DefinedQueryOptionsOptions, ExpandClauses, ExpandInput, ExpandItem, ExpandMap, ExpandTreeNode, FilterCondition, FilterScalar, FilterValidationContext, FilterValue, FulltextFilterOptions, IntEqFilterOptions, OrderByEntry, OrderByInput, OrderByItem, QueryIssue, QueryIssueCode, QueryOptionsInput, ResolvedFilterDefinition, SelectInput, TopOptions, TopOverflow };
|