angular-odata 0.121.0 → 0.123.0
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/esm2022/lib/client.mjs +253 -0
- package/esm2022/lib/models/collection.mjs +862 -0
- package/esm2022/lib/models/model.mjs +519 -0
- package/esm2022/lib/models/options.mjs +1110 -0
- package/esm2022/lib/module.mjs +43 -0
- package/esm2022/lib/resources/query/builder.mjs +619 -0
- package/{esm2020 → esm2022}/lib/resources/query/expressions/base.mjs +1 -1
- package/{esm2020 → esm2022}/lib/resources/query/expressions/compute.mjs +1 -1
- package/{esm2020 → esm2022}/lib/resources/query/expressions/count.mjs +1 -1
- package/esm2022/lib/resources/query/expressions/expand.mjs +119 -0
- package/esm2022/lib/resources/query/expressions/filter.mjs +161 -0
- package/{esm2020 → esm2022}/lib/resources/query/expressions/orderby.mjs +1 -1
- package/{esm2020 → esm2022}/lib/resources/query/expressions/search.mjs +1 -1
- package/{esm2020 → esm2022}/lib/resources/query/expressions/select.mjs +1 -1
- package/esm2022/lib/resources/query/expressions/syntax.mjs +409 -0
- package/{esm2020 → esm2022}/lib/resources/query/handlers.mjs +1 -1
- package/esm2022/lib/resources/query/options.mjs +115 -0
- package/esm2022/lib/resources/responses/metadata.mjs +548 -0
- package/esm2022/lib/schema/parsers/edm.mjs +99 -0
- package/{esm2020 → esm2022}/lib/schema/parsers/enum-type.mjs +2 -2
- package/esm2022/lib/services/factory.mjs +34 -0
- package/esm2022/lib/utils/enums.mjs +61 -0
- package/{fesm2020 → fesm2022}/angular-odata.mjs +643 -614
- package/fesm2022/angular-odata.mjs.map +1 -0
- package/lib/helper.d.ts +1 -1
- package/lib/models/model.d.ts +7 -16
- package/lib/models/options.d.ts +51 -33
- package/lib/resources/path/segments.d.ts +1 -1
- package/lib/resources/query/builder.d.ts +21 -20
- package/lib/resources/query/expressions/base.d.ts +3 -3
- package/lib/resources/query/expressions/compute.d.ts +2 -2
- package/lib/resources/query/expressions/count.d.ts +3 -3
- package/lib/resources/query/expressions/expand.d.ts +13 -12
- package/lib/resources/query/expressions/filter.d.ts +15 -15
- package/lib/resources/query/expressions/orderby.d.ts +3 -3
- package/lib/resources/query/expressions/search.d.ts +3 -3
- package/lib/resources/query/expressions/select.d.ts +2 -2
- package/lib/resources/query/expressions/syntax.d.ts +59 -58
- package/lib/resources/query/handlers.d.ts +2 -2
- package/lib/resources/query/options.d.ts +1 -1
- package/lib/resources/resource.d.ts +1 -1
- package/lib/resources/responses/types.d.ts +3 -3
- package/lib/resources/types/options.d.ts +7 -7
- package/lib/schema/parsers/structured-type.d.ts +5 -5
- package/lib/types.d.ts +15 -15
- package/lib/utils/durations.d.ts +1 -1
- package/lib/utils/enums.d.ts +3 -0
- package/package.json +9 -15
- package/esm2020/lib/client.mjs +0 -252
- package/esm2020/lib/models/collection.mjs +0 -857
- package/esm2020/lib/models/model.mjs +0 -518
- package/esm2020/lib/models/options.mjs +0 -1130
- package/esm2020/lib/module.mjs +0 -42
- package/esm2020/lib/resources/query/builder.mjs +0 -588
- package/esm2020/lib/resources/query/expressions/expand.mjs +0 -115
- package/esm2020/lib/resources/query/expressions/filter.mjs +0 -161
- package/esm2020/lib/resources/query/expressions/syntax.mjs +0 -409
- package/esm2020/lib/resources/query/options.mjs +0 -115
- package/esm2020/lib/resources/responses/metadata.mjs +0 -547
- package/esm2020/lib/schema/parsers/edm.mjs +0 -104
- package/esm2020/lib/services/factory.mjs +0 -33
- package/esm2020/lib/utils/enums.mjs +0 -45
- package/fesm2015/angular-odata.mjs +0 -11841
- package/fesm2015/angular-odata.mjs.map +0 -1
- package/fesm2020/angular-odata.mjs.map +0 -1
- /package/{esm2020 → esm2022}/angular-odata.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/api.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/cache/cache.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/cache/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/cache/memory.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/cache/storage.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/constants.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/helper.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/loaders.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/models/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/options.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/path/handlers.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/path/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/path/segments.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/query/expressions/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/query/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/request.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/resource.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/annotations.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-annotation.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-entity-container.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-entity-set.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-enum-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-function-action.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-navigation-property-binding.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-reference.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-schema.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-singleton.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-structural-property.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-structured-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/csdl/csdl-type-definition.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/options.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/response.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/responses/types.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/action.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/batch.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/count.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/entity-set.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/entity.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/function.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/media.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/metadata.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/navigation-property.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/options.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/property.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/reference.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/singleton.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/resources/types/value.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/annotation.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/callable.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/element.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/entity-container.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/entity-set.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/enum-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/parsers/callable.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/parsers/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/parsers/structured-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/schema.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/schema/structured-type.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/services/base.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/services/entity-set.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/services/entity.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/services/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/services/singleton.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/settings.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/types.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/arraybuffers.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/arrays.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/dates.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/durations.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/http.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/objects.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/odata.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/strings.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/types.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/utils/urls.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
package/lib/helper.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ODataMetadataType } from './types';
|
|
|
2
2
|
export declare const COLLECTION: RegExp;
|
|
3
3
|
export declare const PROPERTY: RegExp;
|
|
4
4
|
export declare const EXPAND: RegExp;
|
|
5
|
-
export
|
|
5
|
+
export type ODataContext = {
|
|
6
6
|
serviceRootUrl?: string;
|
|
7
7
|
metadataUrl?: string;
|
|
8
8
|
entitySet?: string;
|
package/lib/models/model.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { EntityKey, ODataActionOptions, ODataEntityAnnotations, ODataEntityResource, ODataFunctionOptions, ODataNavigationPropertyResource, ODataOptions, ODataPropertyResource, ODataQueryArgumentsOptions, ODataQueryOptionsHandler, ODataResource, ODataSingletonResource } from '../resources';
|
|
4
4
|
import { ODataStructuredType } from '../schema';
|
|
5
5
|
import { ODataCollection } from './collection';
|
|
6
|
-
import { ModelOptions, ODataModelEvent, ODataModelField, ODataModelOptions,
|
|
6
|
+
import { ModelOptions, ODataModelEvent, ODataModelField, ODataModelOptions, ODataModelAttribute } from './options';
|
|
7
|
+
import { ParserOptions } from '../types';
|
|
7
8
|
export declare class ODataModel<T> {
|
|
8
9
|
static options: ModelOptions;
|
|
9
10
|
static meta: ODataModelOptions<any>;
|
|
@@ -23,9 +24,7 @@ export declare class ODataModel<T> {
|
|
|
23
24
|
] | null;
|
|
24
25
|
resource: ODataResource<T> | null;
|
|
25
26
|
}[];
|
|
26
|
-
_attributes: Map<string, any
|
|
27
|
-
_changes: Map<string, any>;
|
|
28
|
-
_relations: Map<string, ODataModelRelation<any>>;
|
|
27
|
+
_attributes: Map<string, ODataModelAttribute<any>>;
|
|
29
28
|
_annotations: ODataEntityAnnotations<T> | null;
|
|
30
29
|
_reset: boolean;
|
|
31
30
|
_reparent: boolean;
|
|
@@ -62,13 +61,13 @@ export declare class ODataModel<T> {
|
|
|
62
61
|
} | undefined;
|
|
63
62
|
isOpenModel(): boolean;
|
|
64
63
|
isParentOf(child: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
|
|
65
|
-
referential(
|
|
64
|
+
referential(attr: ODataModelAttribute<any> | ODataModelField<any>, { field_mapping, resolve, }?: {
|
|
66
65
|
field_mapping?: boolean;
|
|
67
66
|
resolve?: boolean;
|
|
68
67
|
}): {
|
|
69
68
|
[name: string]: any;
|
|
70
69
|
} | null | undefined;
|
|
71
|
-
referenced(
|
|
70
|
+
referenced(attr: ODataModelAttribute<any> | ODataModelField<any>, { field_mapping, resolve, }?: {
|
|
72
71
|
field_mapping?: boolean;
|
|
73
72
|
resolve?: boolean;
|
|
74
73
|
}): {
|
|
@@ -104,15 +103,6 @@ export declare class ODataModel<T> {
|
|
|
104
103
|
toJSON(): T | {
|
|
105
104
|
[name: string]: any;
|
|
106
105
|
};
|
|
107
|
-
attributes({ changes_only, include_concurrency, include_computed, include_non_field, field_mapping, }?: {
|
|
108
|
-
changes_only?: boolean;
|
|
109
|
-
include_concurrency?: boolean;
|
|
110
|
-
include_computed?: boolean;
|
|
111
|
-
include_non_field?: boolean;
|
|
112
|
-
field_mapping?: boolean;
|
|
113
|
-
}): {
|
|
114
|
-
[name: string]: any;
|
|
115
|
-
};
|
|
116
106
|
set(path: string | string[], value: any, { type }?: {
|
|
117
107
|
type?: string;
|
|
118
108
|
}): any;
|
|
@@ -159,6 +149,7 @@ export declare class ODataModel<T> {
|
|
|
159
149
|
hasChanged({ include_navigation, }?: {
|
|
160
150
|
include_navigation?: boolean;
|
|
161
151
|
}): boolean;
|
|
152
|
+
encode<E>(name: keyof T, options?: ParserOptions): any;
|
|
162
153
|
isNew(): boolean;
|
|
163
154
|
withResource<R>(resource: any, ctx: (model: this) => R): R;
|
|
164
155
|
/**
|
|
@@ -174,8 +165,8 @@ export declare class ODataModel<T> {
|
|
|
174
165
|
getValue<P>(name: keyof T | string, options?: ODataOptions): Observable<P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null>;
|
|
175
166
|
setReference<N>(name: keyof T | string, model: ODataModel<N> | ODataCollection<N, ODataModel<N>> | null, options?: ODataOptions): Observable<this>;
|
|
176
167
|
getReference<P>(name: keyof T | string): ODataModel<P> | ODataCollection<P, ODataModel<P>> | null;
|
|
177
|
-
equals(other: ODataModel<T>): boolean;
|
|
178
168
|
get [Symbol.toStringTag](): string;
|
|
169
|
+
equals(other: ODataModel<T>): boolean;
|
|
179
170
|
collection(): ODataCollection<T, ODataModel<T>> | undefined;
|
|
180
171
|
next(): ODataModel<T> | undefined;
|
|
181
172
|
prev(): ODataModel<T> | undefined;
|
package/lib/models/options.d.ts
CHANGED
|
@@ -2,18 +2,30 @@ import { Subscription } from 'rxjs';
|
|
|
2
2
|
import { EntityKey, ODataEntitiesAnnotations, ODataEntityAnnotations, ODataEntityResource, ODataEntitySetResource, ODataNavigationPropertyResource, ODataPropertyResource, ODataQueryOptions, ODataQueryOptionsHandler, ODataResource, ODataSingletonResource } from '../resources';
|
|
3
3
|
import { ODataEntitySet, ODataStructuredType, ODataStructuredTypeFieldParser } from '../schema';
|
|
4
4
|
import { EdmType, Parser, ParserOptions } from '../types';
|
|
5
|
-
import
|
|
5
|
+
import { ODataCollection } from './collection';
|
|
6
6
|
import type { ODataModel } from './model';
|
|
7
|
-
|
|
7
|
+
import { EventEmitter } from '@angular/core';
|
|
8
|
+
export declare enum ODataModelEventType {
|
|
9
|
+
Change = "change",
|
|
10
|
+
Reset = "reset",
|
|
11
|
+
Update = "update",
|
|
12
|
+
Destroy = "destroy",
|
|
13
|
+
Add = "add",
|
|
14
|
+
Remove = "remove",
|
|
15
|
+
Invalid = "invalid",
|
|
16
|
+
Request = "request",
|
|
17
|
+
Sync = "sync",
|
|
18
|
+
Attach = "attach"
|
|
19
|
+
}
|
|
8
20
|
export declare class ODataModelEvent<T> {
|
|
9
21
|
name: ODataModelEventType;
|
|
10
22
|
value?: any;
|
|
11
23
|
previous?: any;
|
|
12
24
|
options?: any;
|
|
13
|
-
constructor(name: ODataModelEventType, { model, collection, previous, value,
|
|
25
|
+
constructor(name: ODataModelEventType, { model, collection, previous, value, attr, options, }?: {
|
|
14
26
|
model?: ODataModel<T>;
|
|
15
27
|
collection?: ODataCollection<T, ODataModel<T>>;
|
|
16
|
-
|
|
28
|
+
attr?: ODataModelAttribute<any> | number;
|
|
17
29
|
previous?: any;
|
|
18
30
|
value?: any;
|
|
19
31
|
options?: any;
|
|
@@ -22,9 +34,9 @@ export declare class ODataModelEvent<T> {
|
|
|
22
34
|
stopPropagation(): void;
|
|
23
35
|
chain: [
|
|
24
36
|
ODataModel<any> | ODataCollection<any, ODataModel<any>>,
|
|
25
|
-
|
|
37
|
+
ODataModelAttribute<any> | number | null
|
|
26
38
|
][];
|
|
27
|
-
push(model: ODataModel<any> | ODataCollection<any, ODataModel<any>>,
|
|
39
|
+
push(model: ODataModel<any> | ODataCollection<any, ODataModel<any>>, attr: ODataModelAttribute<any> | number): ODataModelEvent<T>;
|
|
28
40
|
visited(model: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
|
|
29
41
|
get path(): string;
|
|
30
42
|
model?: ODataModel<T>;
|
|
@@ -32,7 +44,7 @@ export declare class ODataModelEvent<T> {
|
|
|
32
44
|
collection?: ODataCollection<T, ODataModel<T>>;
|
|
33
45
|
get currentCollection(): ODataCollection<any, ODataModel<any>> | undefined;
|
|
34
46
|
}
|
|
35
|
-
export declare const BUBBLING:
|
|
47
|
+
export declare const BUBBLING: ODataModelEventType[];
|
|
36
48
|
export declare const INCLUDE_SHALLOW: {
|
|
37
49
|
include_concurrency: boolean;
|
|
38
50
|
include_computed: boolean;
|
|
@@ -48,16 +60,15 @@ export declare const INCLUDE_DEEP: {
|
|
|
48
60
|
export declare enum ODataModelState {
|
|
49
61
|
Added = 0,
|
|
50
62
|
Removed = 1,
|
|
51
|
-
|
|
52
|
-
Unchanged = 3
|
|
63
|
+
Unchanged = 2
|
|
53
64
|
}
|
|
54
|
-
export
|
|
65
|
+
export type ModelOptions = {
|
|
55
66
|
cid?: string;
|
|
56
67
|
fields: {
|
|
57
68
|
[name: string]: ModelFieldOptions;
|
|
58
69
|
};
|
|
59
70
|
};
|
|
60
|
-
export
|
|
71
|
+
export type ModelFieldOptions = {
|
|
61
72
|
field?: string;
|
|
62
73
|
parser?: ODataStructuredTypeFieldParser<any>;
|
|
63
74
|
default?: any;
|
|
@@ -75,7 +86,7 @@ export declare function Model({ cid }?: {
|
|
|
75
86
|
export declare function ModelField({ name, ...options }?: {
|
|
76
87
|
name?: string;
|
|
77
88
|
} & ModelFieldOptions): (target: any, key: string) => void;
|
|
78
|
-
export
|
|
89
|
+
export type ODataModelFieldOptions<F> = ModelFieldOptions & {
|
|
79
90
|
name: string;
|
|
80
91
|
field: string;
|
|
81
92
|
parser: ODataStructuredTypeFieldParser<F>;
|
|
@@ -139,13 +150,32 @@ export declare class ODataModelField<F> {
|
|
|
139
150
|
reset?: boolean;
|
|
140
151
|
}): ODataCollection<F, ODataModel<F>>;
|
|
141
152
|
}
|
|
142
|
-
export declare
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
export declare class ODataModelAttribute<T> {
|
|
154
|
+
private _model;
|
|
155
|
+
private _field;
|
|
156
|
+
private value?;
|
|
157
|
+
private change?;
|
|
158
|
+
private subscription?;
|
|
159
|
+
events$: EventEmitter<ODataModelEvent<T>>;
|
|
160
|
+
constructor(_model: ODataModel<any>, _field: ODataModelField<T>);
|
|
161
|
+
get navigation(): boolean;
|
|
162
|
+
get computed(): boolean | undefined;
|
|
163
|
+
get concurrency(): boolean;
|
|
164
|
+
get referentials(): import("../schema").ODataReferential[];
|
|
165
|
+
get options(): ODataModelOptions<any>;
|
|
166
|
+
get meta(): ODataModelOptions<any> | undefined;
|
|
167
|
+
get name(): string;
|
|
168
|
+
get fieldName(): string;
|
|
169
|
+
get(): T | ODataModel<T> | ODataCollection<T, ODataModel<T>> | null | undefined;
|
|
170
|
+
set(value: T | ODataModel<T> | ODataCollection<T, ODataModel<T>> | null | undefined, reset?: boolean, reparent?: boolean): boolean;
|
|
171
|
+
isChanged({ include_navigation, }?: {
|
|
172
|
+
include_navigation?: boolean;
|
|
173
|
+
}): boolean;
|
|
174
|
+
reset(): void;
|
|
175
|
+
private link;
|
|
176
|
+
private unlink;
|
|
177
|
+
}
|
|
178
|
+
export type ODataModelEntry<T, M extends ODataModel<T>> = {
|
|
149
179
|
state: ODataModelState;
|
|
150
180
|
model: M;
|
|
151
181
|
key?: EntityKey<T> | {
|
|
@@ -220,7 +250,7 @@ export declare class ODataModelOptions<T> {
|
|
|
220
250
|
} | undefined;
|
|
221
251
|
resolveReferential(value: ODataModel<T> | T | {
|
|
222
252
|
[name: string]: any;
|
|
223
|
-
} | null,
|
|
253
|
+
} | null, attr: ODataModelAttribute<any> | ODataModelField<any>, { field_mapping, resolve, single, }?: {
|
|
224
254
|
field_mapping?: boolean;
|
|
225
255
|
resolve?: boolean;
|
|
226
256
|
single?: boolean;
|
|
@@ -229,7 +259,7 @@ export declare class ODataModelOptions<T> {
|
|
|
229
259
|
} | null | undefined;
|
|
230
260
|
resolveReferenced(value: ODataModel<T> | T | {
|
|
231
261
|
[name: string]: any;
|
|
232
|
-
} | null,
|
|
262
|
+
} | null, attr: ODataModelAttribute<any> | ODataModelField<any>, { field_mapping, resolve, single, }?: {
|
|
233
263
|
field_mapping?: boolean;
|
|
234
264
|
resolve?: boolean;
|
|
235
265
|
single?: boolean;
|
|
@@ -264,15 +294,6 @@ export declare class ODataModelOptions<T> {
|
|
|
264
294
|
}): T | {
|
|
265
295
|
[name: string]: any;
|
|
266
296
|
};
|
|
267
|
-
attributes(self: ODataModel<T>, { changes_only, include_concurrency, include_computed, include_non_field, field_mapping, }?: {
|
|
268
|
-
changes_only?: boolean;
|
|
269
|
-
include_concurrency?: boolean;
|
|
270
|
-
include_computed?: boolean;
|
|
271
|
-
include_non_field?: boolean;
|
|
272
|
-
field_mapping?: boolean;
|
|
273
|
-
}): {
|
|
274
|
-
[name: string]: any;
|
|
275
|
-
};
|
|
276
297
|
reset(self: ODataModel<T>, { name, silent }?: {
|
|
277
298
|
name?: string;
|
|
278
299
|
silent?: boolean;
|
|
@@ -289,8 +310,6 @@ export declare class ODataModelOptions<T> {
|
|
|
289
310
|
private _updateCollection;
|
|
290
311
|
private _updateModel;
|
|
291
312
|
get<F>(self: ODataModel<T>, field: ODataModelField<F> | string): F | ODataModel<F> | ODataCollection<F, ODataModel<F>> | null | undefined;
|
|
292
|
-
private _setStructured;
|
|
293
|
-
private _setValue;
|
|
294
313
|
set<F>(self: ODataModel<T>, field: ODataModelField<F> | string, value: F | F[] | {
|
|
295
314
|
[name: string]: any;
|
|
296
315
|
} | {
|
|
@@ -298,6 +317,5 @@ export declare class ODataModelOptions<T> {
|
|
|
298
317
|
}[] | ODataModel<F> | ODataCollection<F, ODataModel<F>> | null, { type }?: {
|
|
299
318
|
type?: string;
|
|
300
319
|
}): boolean;
|
|
301
|
-
private _unlink;
|
|
302
320
|
private _link;
|
|
303
321
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export type Unpacked<T> = T extends (infer U)[] ? U : T;
|
|
2
|
+
export type Select<T> = SelectType<T> | SelectType<T>[];
|
|
3
|
+
export type SelectType<T> = string | keyof T;
|
|
4
|
+
export type Filter<T> = FilterType | FilterType[];
|
|
5
|
+
export type FilterType = string | {
|
|
6
6
|
[name: string]: any;
|
|
7
7
|
};
|
|
8
8
|
export declare enum StandardAggregateMethods {
|
|
@@ -12,25 +12,25 @@ export declare enum StandardAggregateMethods {
|
|
|
12
12
|
average = "average",
|
|
13
13
|
countdistinct = "countdistinct"
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type Aggregate = string | {
|
|
16
16
|
[propertyName: string]: {
|
|
17
17
|
with: StandardAggregateMethods;
|
|
18
18
|
as: string;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
21
|
+
export type OrderBy<T> = OrderByType<T> | OrderByType<T>[];
|
|
22
|
+
export type OrderByType<T> = string | OrderByObject<T>;
|
|
23
|
+
export type OrderByObject<T> = keyof T | [keyof T | string, 'asc' | 'desc'] | NestedOrderBy<T>;
|
|
24
|
+
export type NestedOrderBy<T> = {
|
|
25
25
|
[P in keyof T]?: T[P] extends Array<infer E> ? OrderBy<E> : OrderBy<T[P]>;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
27
|
+
export type Expand<T> = ExpandType<T> | ExpandType<T>[];
|
|
28
|
+
export type ExpandType<T> = string | ExpandObject<T>;
|
|
29
|
+
export type ExpandObject<T> = keyof T | NestedExpandOptions<T>;
|
|
30
|
+
export type NestedExpandOptions<T> = {
|
|
31
31
|
[P in keyof T]?: ExpandOptions<Unpacked<T[P]>>;
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type ExpandOptions<T> = {
|
|
34
34
|
select?: Select<T>;
|
|
35
35
|
filter?: Filter<T>;
|
|
36
36
|
orderBy?: OrderBy<T>;
|
|
@@ -40,12 +40,12 @@ export declare type ExpandOptions<T> = {
|
|
|
40
40
|
count?: boolean | Filter<T>;
|
|
41
41
|
expand?: Expand<T>;
|
|
42
42
|
};
|
|
43
|
-
export
|
|
43
|
+
export type Transform<T> = {
|
|
44
44
|
aggregate?: Aggregate | Array<Aggregate>;
|
|
45
45
|
filter?: Filter<T>;
|
|
46
46
|
groupBy?: GroupBy<T>;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type GroupBy<T> = {
|
|
49
49
|
properties: Array<keyof T>;
|
|
50
50
|
transform?: Transform<T>;
|
|
51
51
|
};
|
|
@@ -55,18 +55,19 @@ export declare enum QueryCustomTypes {
|
|
|
55
55
|
Duration = 2,
|
|
56
56
|
Binary = 3
|
|
57
57
|
}
|
|
58
|
-
export
|
|
58
|
+
export type QueryCustomType = {
|
|
59
59
|
type: QueryCustomTypes;
|
|
60
60
|
value: any;
|
|
61
61
|
name?: string;
|
|
62
62
|
};
|
|
63
|
-
export
|
|
63
|
+
export type Value = string | Date | number | boolean | QueryCustomType;
|
|
64
64
|
export declare const raw: (value: string) => QueryCustomType;
|
|
65
65
|
export declare const alias: (value: any, name?: string) => QueryCustomType;
|
|
66
66
|
export declare const duration: (value: string) => QueryCustomType;
|
|
67
67
|
export declare const binary: (value: string) => QueryCustomType;
|
|
68
68
|
export declare const isQueryCustomType: (value: any) => boolean;
|
|
69
|
-
export declare
|
|
69
|
+
export declare const isRawType: (value: any) => boolean;
|
|
70
|
+
export type QueryOptions<T> = ExpandOptions<T> & {
|
|
70
71
|
search: string;
|
|
71
72
|
transform: {
|
|
72
73
|
[name: string]: any;
|
|
@@ -7,9 +7,9 @@ export declare abstract class Expression<T> implements Renderable {
|
|
|
7
7
|
});
|
|
8
8
|
get [Symbol.toStringTag](): string;
|
|
9
9
|
abstract render({ aliases, escape, prefix, }: {
|
|
10
|
-
aliases?: QueryCustomType[]
|
|
11
|
-
escape?: boolean
|
|
12
|
-
prefix?: string
|
|
10
|
+
aliases?: QueryCustomType[];
|
|
11
|
+
escape?: boolean;
|
|
12
|
+
prefix?: string;
|
|
13
13
|
}): string;
|
|
14
14
|
abstract clone(): Expression<T>;
|
|
15
15
|
children(): Renderable[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QueryCustomType } from '../builder';
|
|
2
2
|
import { Expression } from './base';
|
|
3
3
|
import { ODataFunctions, ODataOperators, Renderable } from './syntax';
|
|
4
|
-
export
|
|
4
|
+
export type ComputeExpressionBuilder<T> = {
|
|
5
5
|
t: Required<Readonly<T>>;
|
|
6
6
|
e: () => ComputeExpression<T>;
|
|
7
7
|
};
|
|
@@ -17,7 +17,7 @@ export declare class ComputeExpression<T> extends Expression<T> {
|
|
|
17
17
|
escape?: boolean | undefined;
|
|
18
18
|
prefix?: string | undefined;
|
|
19
19
|
}): string;
|
|
20
|
-
clone(): ComputeExpression<
|
|
20
|
+
clone(): ComputeExpression<T>;
|
|
21
21
|
private _add;
|
|
22
22
|
field<T extends object>(name: string, opts: (e: {
|
|
23
23
|
o: ODataOperators<T>;
|
|
@@ -18,10 +18,10 @@ export declare class CountField<T extends object> implements Renderable {
|
|
|
18
18
|
prefix?: string;
|
|
19
19
|
}): string;
|
|
20
20
|
filter(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>): any;
|
|
21
|
-
clone(): CountField<
|
|
21
|
+
clone(): CountField<T>;
|
|
22
22
|
private option;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type CountExpressionBuilder<T> = {
|
|
25
25
|
t: Readonly<Required<T>>;
|
|
26
26
|
e: () => CountExpression<T>;
|
|
27
27
|
};
|
|
@@ -36,7 +36,7 @@ export declare class CountExpression<T> extends Expression<T> {
|
|
|
36
36
|
escape?: boolean | undefined;
|
|
37
37
|
prefix?: string | undefined;
|
|
38
38
|
}): string;
|
|
39
|
-
clone(): CountExpression<
|
|
39
|
+
clone(): CountExpression<T>;
|
|
40
40
|
field<F extends Object>(field: F[], opts?: (e: {
|
|
41
41
|
t: F;
|
|
42
42
|
f: CountField<F>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QueryCustomType } from '../builder';
|
|
1
|
+
import type { QueryCustomType, Unpacked } from '../builder';
|
|
2
2
|
import { Expression } from './base';
|
|
3
3
|
import { FilterExpression, FilterExpressionBuilder } from './filter';
|
|
4
4
|
import { OrderByExpression, OrderByExpressionBuilder } from './orderby';
|
|
@@ -20,18 +20,19 @@ export declare class ExpandField<T> implements Renderable {
|
|
|
20
20
|
escape?: boolean;
|
|
21
21
|
prefix?: string;
|
|
22
22
|
}): string;
|
|
23
|
-
clone(): ExpandField<
|
|
23
|
+
clone(): ExpandField<T>;
|
|
24
24
|
select<T extends object>(opts: (builder: SelectExpressionBuilder<T>, current?: SelectExpression<T>) => SelectExpression<T>): SelectExpression<T>;
|
|
25
|
-
expand<T extends object>(opts: (builder: ExpandExpressionBuilder<T>, current?: ExpandExpression<T>) => ExpandExpression<T>):
|
|
26
|
-
filter<T extends object>(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>):
|
|
27
|
-
search<T extends object>(opts: (builder: SearchExpressionBuilder<T>) => SearchExpression<T>):
|
|
28
|
-
orderBy<T extends object>(opts: (builder: OrderByExpressionBuilder<T>, current?: OrderByExpression<T>) => OrderByExpression<T>):
|
|
29
|
-
skip(n: number):
|
|
30
|
-
top(n: number):
|
|
31
|
-
levels(n: number | 'max'):
|
|
25
|
+
expand<T extends object>(opts: (builder: ExpandExpressionBuilder<T>, current?: ExpandExpression<T>) => ExpandExpression<T>): ExpandExpression<T>;
|
|
26
|
+
filter<T extends object>(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
|
|
27
|
+
search<T extends object>(opts: (builder: SearchExpressionBuilder<T>) => SearchExpression<T>): SearchExpression<T>;
|
|
28
|
+
orderBy<T extends object>(opts: (builder: OrderByExpressionBuilder<T>, current?: OrderByExpression<T>) => OrderByExpression<T>): OrderByExpression<T>;
|
|
29
|
+
skip(n: number): number;
|
|
30
|
+
top(n: number): number;
|
|
31
|
+
levels(n: number | 'max'): number | "max";
|
|
32
|
+
count(): boolean;
|
|
32
33
|
private option;
|
|
33
34
|
}
|
|
34
|
-
export
|
|
35
|
+
export type ExpandExpressionBuilder<T> = {
|
|
35
36
|
t: Readonly<Required<T>>;
|
|
36
37
|
e: () => ExpandExpression<T>;
|
|
37
38
|
};
|
|
@@ -45,7 +46,7 @@ export declare class ExpandExpression<T> extends Expression<T> {
|
|
|
45
46
|
escape?: boolean | undefined;
|
|
46
47
|
prefix?: string | undefined;
|
|
47
48
|
}): string;
|
|
48
|
-
clone(): ExpandExpression<
|
|
49
|
+
clone(): ExpandExpression<T>;
|
|
49
50
|
private _add;
|
|
50
|
-
field<F>(field: F, opts?: (e: ExpandField<F
|
|
51
|
+
field<F extends keyof T>(field: T[F], opts?: (e: ExpandField<Unpacked<T[F]>>) => void): ExpandExpression<T>;
|
|
51
52
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { QueryCustomType } from '../builder';
|
|
2
2
|
import { Expression } from './base';
|
|
3
3
|
import { CountExpression, CountField } from './count';
|
|
4
|
-
import { ODataFunctions, ODataOperators, Renderable } from './syntax';
|
|
5
|
-
export
|
|
6
|
-
export
|
|
4
|
+
import { Normalize, ODataFunctions, ODataOperators, Renderable } from './syntax';
|
|
5
|
+
export type FilterConnector = 'and' | 'or';
|
|
6
|
+
export type FilterExpressionBuilder<T> = {
|
|
7
7
|
t: Readonly<Required<T>>;
|
|
8
8
|
e: (connector?: FilterConnector) => FilterExpression<T>;
|
|
9
9
|
o: ODataOperators<T>;
|
|
@@ -30,22 +30,22 @@ export declare class FilterExpression<F> extends Expression<F> {
|
|
|
30
30
|
escape?: boolean;
|
|
31
31
|
prefix?: string;
|
|
32
32
|
}): string;
|
|
33
|
-
clone(): FilterExpression<
|
|
33
|
+
clone(): FilterExpression<F>;
|
|
34
34
|
private _add;
|
|
35
35
|
or(exp: FilterExpression<F>): FilterExpression<F>;
|
|
36
36
|
and(exp: FilterExpression<F>): FilterExpression<F>;
|
|
37
37
|
not(exp: FilterExpression<F>): FilterExpression<F>;
|
|
38
|
-
eq(left: any, right: any, normalize?:
|
|
39
|
-
ne(left: any, right: any, normalize?:
|
|
40
|
-
gt(left: any, right: any, normalize?:
|
|
41
|
-
ge(left: any, right: any, normalize?:
|
|
42
|
-
lt(left: any, right: any, normalize?:
|
|
43
|
-
le(left: any, right: any, normalize?:
|
|
44
|
-
has(left: any, right: any, normalize?:
|
|
45
|
-
in(left: any, right: any, normalize?:
|
|
46
|
-
contains(left: any, right: any, normalize?:
|
|
47
|
-
startsWith(left: any, right: any, normalize?:
|
|
48
|
-
endsWith(left: any, right: any, normalize?:
|
|
38
|
+
eq(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
39
|
+
ne(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
40
|
+
gt(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
41
|
+
ge(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
42
|
+
lt(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
43
|
+
le(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
44
|
+
has(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
45
|
+
in(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
46
|
+
contains(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
47
|
+
startsWith(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
48
|
+
endsWith(left: any, right: any, normalize?: Normalize): FilterExpression<F>;
|
|
49
49
|
any<N extends object>(left: N[], opts?: (e: {
|
|
50
50
|
e: (connector?: FilterConnector) => FilterExpression<N>;
|
|
51
51
|
t: N;
|
|
@@ -8,7 +8,7 @@ export declare class OrderByField implements Renderable {
|
|
|
8
8
|
get [Symbol.toStringTag](): string;
|
|
9
9
|
toJSON(): {
|
|
10
10
|
field: any;
|
|
11
|
-
order: "
|
|
11
|
+
order: "asc" | "desc";
|
|
12
12
|
};
|
|
13
13
|
render({ aliases, escape, prefix, }: {
|
|
14
14
|
aliases?: QueryCustomType[];
|
|
@@ -17,7 +17,7 @@ export declare class OrderByField implements Renderable {
|
|
|
17
17
|
}): string;
|
|
18
18
|
clone(): OrderByField;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export type OrderByExpressionBuilder<T> = {
|
|
21
21
|
t: Readonly<Required<T>>;
|
|
22
22
|
e: () => OrderByExpression<T>;
|
|
23
23
|
};
|
|
@@ -32,7 +32,7 @@ export declare class OrderByExpression<T> extends Expression<T> {
|
|
|
32
32
|
escape?: boolean | undefined;
|
|
33
33
|
prefix?: string | undefined;
|
|
34
34
|
}): string;
|
|
35
|
-
clone(): OrderByExpression<
|
|
35
|
+
clone(): OrderByExpression<T>;
|
|
36
36
|
ascending(field: any): OrderByExpression<T>;
|
|
37
37
|
descending(field: any): OrderByExpression<T>;
|
|
38
38
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QueryCustomType } from '../builder';
|
|
2
2
|
import { Expression } from './base';
|
|
3
3
|
import { Renderable } from './syntax';
|
|
4
|
-
export
|
|
4
|
+
export type SearchConnector = 'AND' | 'OR';
|
|
5
5
|
export declare class SearchTerm implements Renderable {
|
|
6
6
|
protected value: string;
|
|
7
7
|
constructor(value: string);
|
|
@@ -17,7 +17,7 @@ export declare class SearchTerm implements Renderable {
|
|
|
17
17
|
}): string;
|
|
18
18
|
clone(): SearchTerm;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export type SearchExpressionBuilder<T> = {
|
|
21
21
|
e: (connector?: SearchConnector) => SearchExpression<T>;
|
|
22
22
|
};
|
|
23
23
|
export declare class SearchExpression<T> extends Expression<T> {
|
|
@@ -35,7 +35,7 @@ export declare class SearchExpression<T> extends Expression<T> {
|
|
|
35
35
|
escape?: boolean | undefined;
|
|
36
36
|
prefix?: string | undefined;
|
|
37
37
|
}): string;
|
|
38
|
-
clone(): SearchExpression<
|
|
38
|
+
clone(): SearchExpression<T>;
|
|
39
39
|
toJSON(): {
|
|
40
40
|
children: any[];
|
|
41
41
|
connector: SearchConnector;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QueryCustomType } from '../builder';
|
|
2
2
|
import { Expression } from './base';
|
|
3
3
|
import { Renderable } from './syntax';
|
|
4
|
-
export
|
|
4
|
+
export type SelectExpressionBuilder<T> = {
|
|
5
5
|
t: Readonly<Required<T>>;
|
|
6
6
|
e: () => SelectExpression<T>;
|
|
7
7
|
};
|
|
@@ -15,7 +15,7 @@ export declare class SelectExpression<T> extends Expression<T> {
|
|
|
15
15
|
escape?: boolean | undefined;
|
|
16
16
|
prefix?: string | undefined;
|
|
17
17
|
}): string;
|
|
18
|
-
clone(): SelectExpression<
|
|
18
|
+
clone(): SelectExpression<T>;
|
|
19
19
|
private _add;
|
|
20
20
|
field(field: any): SelectExpression<T>;
|
|
21
21
|
}
|