angular-odata 0.100.1 → 0.102.5

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.
Files changed (88) hide show
  1. package/esm2020/lib/api.mjs +84 -64
  2. package/esm2020/lib/cache/cache.mjs +56 -4
  3. package/esm2020/lib/cache/memory.mjs +16 -6
  4. package/esm2020/lib/cache/storage.mjs +23 -4
  5. package/esm2020/lib/client.mjs +3 -3
  6. package/esm2020/lib/constants.mjs +2 -1
  7. package/esm2020/lib/models/collection.mjs +103 -43
  8. package/esm2020/lib/models/model.mjs +17 -4
  9. package/esm2020/lib/models/options.mjs +200 -122
  10. package/esm2020/lib/module.mjs +5 -5
  11. package/esm2020/lib/options.mjs +3 -8
  12. package/esm2020/lib/resources/query/builder.mjs +1 -1
  13. package/esm2020/lib/resources/query/expressions/compute.mjs +5 -5
  14. package/esm2020/lib/resources/query/expressions/expand.mjs +6 -6
  15. package/esm2020/lib/resources/query/expressions/filter.mjs +9 -9
  16. package/esm2020/lib/resources/query/expressions/index.mjs +3 -1
  17. package/esm2020/lib/resources/query/expressions/orderby.mjs +5 -5
  18. package/esm2020/lib/resources/query/expressions/search.mjs +3 -3
  19. package/esm2020/lib/resources/query/expressions/select.mjs +7 -7
  20. package/esm2020/lib/resources/query/expressions/syntax.mjs +1 -1
  21. package/esm2020/lib/resources/query/handlers.mjs +208 -22
  22. package/esm2020/lib/resources/query/options.mjs +16 -13
  23. package/esm2020/lib/resources/request.mjs +31 -36
  24. package/esm2020/lib/resources/resource.mjs +27 -11
  25. package/esm2020/lib/resources/responses/annotations.mjs +1 -1
  26. package/esm2020/lib/resources/responses/metadata.mjs +1 -1
  27. package/esm2020/lib/resources/responses/options.mjs +1 -1
  28. package/esm2020/lib/resources/responses/response.mjs +2 -2
  29. package/esm2020/lib/resources/types/batch.mjs +108 -97
  30. package/esm2020/lib/resources/types/navigation-property.mjs +5 -3
  31. package/esm2020/lib/resources/types/options.mjs +1 -1
  32. package/esm2020/lib/resources/types/property.mjs +4 -4
  33. package/esm2020/lib/schema/callable.mjs +3 -3
  34. package/esm2020/lib/schema/enum-type.mjs +13 -26
  35. package/esm2020/lib/schema/parsers/callable.mjs +15 -20
  36. package/esm2020/lib/schema/parsers/enum-type.mjs +35 -18
  37. package/esm2020/lib/schema/parsers/structured-type.mjs +132 -66
  38. package/esm2020/lib/schema/structured-type.mjs +31 -39
  39. package/esm2020/lib/services/base.mjs +1 -1
  40. package/esm2020/lib/services/factory.mjs +3 -3
  41. package/esm2020/lib/types.mjs +1 -1
  42. package/esm2020/lib/utils/arrays.mjs +10 -0
  43. package/esm2020/lib/utils/enums.mjs +3 -3
  44. package/esm2020/lib/utils/objects.mjs +11 -6
  45. package/esm2020/lib/utils/types.mjs +6 -7
  46. package/fesm2015/angular-odata.mjs +3451 -2918
  47. package/fesm2015/angular-odata.mjs.map +1 -1
  48. package/fesm2020/angular-odata.mjs +3454 -2919
  49. package/fesm2020/angular-odata.mjs.map +1 -1
  50. package/{angular-odata.d.ts → index.d.ts} +0 -0
  51. package/lib/api.d.ts +2 -4
  52. package/lib/cache/cache.d.ts +62 -1
  53. package/lib/cache/memory.d.ts +10 -0
  54. package/lib/cache/storage.d.ts +19 -0
  55. package/lib/constants.d.ts +1 -0
  56. package/lib/models/collection.d.ts +14 -9
  57. package/lib/models/model.d.ts +10 -7
  58. package/lib/models/options.d.ts +31 -22
  59. package/lib/options.d.ts +3 -7
  60. package/lib/resources/query/builder.d.ts +1 -1
  61. package/lib/resources/query/expressions/compute.d.ts +7 -6
  62. package/lib/resources/query/expressions/expand.d.ts +17 -32
  63. package/lib/resources/query/expressions/filter.d.ts +11 -10
  64. package/lib/resources/query/expressions/index.d.ts +2 -0
  65. package/lib/resources/query/expressions/orderby.d.ts +7 -6
  66. package/lib/resources/query/expressions/search.d.ts +5 -4
  67. package/lib/resources/query/expressions/select.d.ts +7 -6
  68. package/lib/resources/query/handlers.d.ts +158 -33
  69. package/lib/resources/query/options.d.ts +14 -12
  70. package/lib/resources/request.d.ts +2 -1
  71. package/lib/resources/resource.d.ts +7 -6
  72. package/lib/resources/responses/options.d.ts +2 -2
  73. package/lib/resources/types/batch.d.ts +8 -11
  74. package/lib/resources/types/options.d.ts +4 -2
  75. package/lib/schema/callable.d.ts +4 -4
  76. package/lib/schema/enum-type.d.ts +11 -23
  77. package/lib/schema/parsers/callable.d.ts +11 -10
  78. package/lib/schema/parsers/enum-type.d.ts +22 -14
  79. package/lib/schema/parsers/structured-type.d.ts +58 -14
  80. package/lib/schema/structured-type.d.ts +23 -23
  81. package/lib/services/base.d.ts +9 -9
  82. package/lib/types.d.ts +11 -13
  83. package/lib/utils/arrays.d.ts +3 -0
  84. package/lib/utils/enums.d.ts +2 -2
  85. package/lib/utils/objects.d.ts +1 -1
  86. package/lib/utils/strings.d.ts +1 -1
  87. package/lib/utils/types.d.ts +1 -1
  88. package/package.json +5 -5
@@ -17,6 +17,9 @@ export declare class SearchTerm implements Renderable {
17
17
  }): string;
18
18
  clone(): SearchTerm;
19
19
  }
20
+ export declare type SearchExpressionBuilder<T> = {
21
+ e: (connector?: SearchConnector) => SearchExpression<T>;
22
+ };
20
23
  export declare class SearchExpression<T> extends Expression<T> {
21
24
  private _connector;
22
25
  private _negated;
@@ -25,10 +28,8 @@ export declare class SearchExpression<T> extends Expression<T> {
25
28
  connector?: SearchConnector;
26
29
  negated?: boolean;
27
30
  });
28
- static e<T>(connector?: SearchConnector): SearchExpression<T>;
29
- static search<T extends object>(opts: (builder: {
30
- e: (connector?: SearchConnector) => SearchExpression<T>;
31
- }, current?: SearchExpression<T>) => SearchExpression<T>, current?: SearchExpression<T>): SearchExpression<T>;
31
+ static expression<T>(connector?: SearchConnector): SearchExpression<T>;
32
+ static search<T extends object>(opts: (builder: SearchExpressionBuilder<T>, current?: SearchExpression<T>) => SearchExpression<T>, current?: SearchExpression<T>): SearchExpression<T>;
32
33
  private _add;
33
34
  render({ aliases, escape, prefix, }?: {
34
35
  aliases?: QueryCustomType[] | undefined;
@@ -1,16 +1,17 @@
1
1
  import type { QueryCustomType } from '../builder';
2
2
  import { Expression } from './base';
3
3
  import { Renderable } from './syntax';
4
+ export declare type SelectExpressionBuilder<T> = {
5
+ t: T;
6
+ e: () => SelectExpression<T>;
7
+ };
4
8
  export declare class SelectExpression<T> extends Expression<T> {
5
9
  constructor({ children, }?: {
6
10
  children?: Renderable[];
7
11
  });
8
- static e<T>(): SelectExpression<T>;
9
- static s<T extends object>(): T;
10
- static select<T extends object>(builder: (b: {
11
- s: T;
12
- e: () => SelectExpression<T>;
13
- }, c?: SelectExpression<T>) => SelectExpression<T>, current?: SelectExpression<T>): SelectExpression<T>;
12
+ static expression<T>(): SelectExpression<T>;
13
+ static type<T extends object>(): T;
14
+ static select<T extends object>(opts: (builder: SelectExpressionBuilder<T>, current?: SelectExpression<T>) => SelectExpression<T>, current?: SelectExpression<T>): SelectExpression<T>;
14
15
  render({ aliases, escape, prefix, }?: {
15
16
  aliases?: QueryCustomType[] | undefined;
16
17
  escape?: boolean | undefined;
@@ -1,34 +1,98 @@
1
1
  import { QueryOptionNames } from '../../types';
2
2
  import { Expand, Filter, OrderBy, Select, Transform } from './builder';
3
- import { ComputeExpression, FilterConnector, FilterExpression, OrderByExpression, SearchConnector, SearchExpression, ODataFunctions, ODataOperators } from './expressions';
4
- import { ExpandExpression } from './expressions/expand';
5
- import { SelectExpression } from './expressions/select';
3
+ import { ComputeExpression, ComputeExpressionBuilder, FilterExpression, FilterExpressionBuilder, OrderByExpression, OrderByExpressionBuilder, SearchExpression, SearchExpressionBuilder, ExpandExpression, ExpandExpressionBuilder, SelectExpression, SelectExpressionBuilder } from './expressions';
6
4
  import type { ODataQueryArguments, ODataQueryOptions } from './options';
7
5
  export declare class ODataQueryOptionHandler<T> {
8
6
  private o;
9
7
  private n;
10
8
  constructor(o: Map<QueryOptionNames, any>, n: QueryOptionNames);
9
+ /**
10
+ * The name of the managed odata query option.
11
+ */
11
12
  get name(): QueryOptionNames;
13
+ /**
14
+ * Converts the managed odata query option to a json object.
15
+ * @returns {any}
16
+ */
12
17
  toJSON(): any;
18
+ /**
19
+ * Returns a boolean indicating if the managed odata query option is empty.
20
+ * @returns True if the managed odata query option is empty.
21
+ */
13
22
  empty(): boolean;
23
+ /**
24
+ * Get or Set the value of the managed odata query option.
25
+ * @param v The value to set.
26
+ * @returns
27
+ */
14
28
  value(v?: any): any;
15
29
  private assertArray;
30
+ /**
31
+ * Push value to the managed odata query option.
32
+ * @param value Value to push
33
+ */
16
34
  push(value: any): void;
35
+ /**
36
+ * Remove value from the managed odata query option.
37
+ * @param value Value to remove
38
+ */
17
39
  remove(value: any): void;
40
+ /**
41
+ * Return value at index of the managed odata query option.
42
+ * @param index Index of the value
43
+ * @returns The value
44
+ */
18
45
  at(index: number): any;
46
+ some(predicate: (value: any) => boolean): boolean;
47
+ every(predicate: (value: any) => boolean): boolean;
48
+ find(predicate: (value: any) => boolean): any;
19
49
  private assertObject;
50
+ /**
51
+ * Set the value for path in the managed odata query option.
52
+ * @param path Path for set the value
53
+ * @param value Value to set
54
+ */
20
55
  set(path: string, value: any): void;
56
+ /**
57
+ * Get the value for path from the managed odata query option.
58
+ * @param path The path from get the value
59
+ * @param def Default if not found
60
+ * @returns
61
+ */
21
62
  get(path: string, def?: any): any;
63
+ /**
64
+ * Unset the value for path in the managed odata query option.
65
+ * @param path
66
+ */
22
67
  unset(path: string): void;
68
+ /**
69
+ * Test if the managed odata query option has the value.
70
+ * @param path The path fot test if the value is set
71
+ * @returns Boolean indicating if the value is set
72
+ */
23
73
  has(path: string): boolean;
74
+ /**
75
+ * Merge values from object into the managed odata query option.
76
+ * @param values Object to merge
77
+ * @returns
78
+ */
24
79
  assign(values: {
25
80
  [attr: string]: any;
26
81
  }): Object;
82
+ /**
83
+ * Clear the managed odata query option.
84
+ */
27
85
  clear(): void;
28
86
  }
29
87
  export declare class ODataQueryOptionsHandler<T> {
30
88
  protected options: ODataQueryOptions<T>;
31
89
  constructor(options: ODataQueryOptions<T>);
90
+ /**
91
+ * Create a raw odata value
92
+ * @param value The value to raw
93
+ * @returns The raw value
94
+ */
95
+ raw(value: any): import("./builder").QueryCustomType;
32
96
  /**
33
97
  * Create a new odata alias parameter
34
98
  * @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_ParameterAliases
@@ -37,72 +101,133 @@ export declare class ODataQueryOptionsHandler<T> {
37
101
  * @returns The alias
38
102
  */
39
103
  alias(value: any, name?: string): import("./builder").QueryCustomType;
104
+ /**
105
+ * Create a duration odata value
106
+ * @param value The value to duration
107
+ * @returns The duration value
108
+ */
109
+ duration(value: any): import("./builder").QueryCustomType;
110
+ /**
111
+ * Create a binary odata value
112
+ * @param value The value to binary
113
+ * @returns The binary value
114
+ */
115
+ binary(value: any): import("./builder").QueryCustomType;
40
116
  /**
41
117
  * Normalize the given value to a valid odata value
42
118
  * @param value The value to normalize
43
119
  * @returns The normalized value
44
120
  */
45
121
  normalize(value: any): any;
46
- select(opts: (builder: {
47
- s: T;
48
- e: () => SelectExpression<T>;
49
- }, current?: SelectExpression<T>) => SelectExpression<T>): SelectExpression<T>;
122
+ /**
123
+ * Build and return a handler for modifying the $select option.
124
+ * If opts is given then set te value as new value for $select.
125
+ * @param opts Select<T> value or builder function for SelectExpression<T>
126
+ */
127
+ select(opts: SelectExpressionBuilder<T>): SelectExpression<T>;
50
128
  select(opts: Select<T>): ODataQueryOptionHandler<T>;
51
129
  select(): ODataQueryOptionHandler<T>;
52
- expand(opts: (builder: {
53
- s: T;
54
- e: () => ExpandExpression<T>;
55
- }, current?: ExpandExpression<T>) => ExpandExpression<T>): ExpandExpression<T>;
130
+ /**
131
+ * Build and return a handler for modifying the $expand option.
132
+ * If opts is given then set te value as new value for $expand.
133
+ * @param opts Expand<T> value or builder function for ExpandExpression<T>
134
+ */
135
+ expand(opts: ExpandExpressionBuilder<T>): ExpandExpression<T>;
56
136
  expand(opts: Expand<T>): ODataQueryOptionHandler<T>;
57
137
  expand(): ODataQueryOptionHandler<T>;
58
138
  /**
139
+ * Build and return a handler for modifying the $compute option.
140
+ * If opts is given then set te value as new value for $compute.
59
141
  * @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptioncompute
142
+ * @param opts string value or builder function for ComputeExpression<T>
60
143
  */
61
- compute(opts: (builder: {
62
- s: T;
63
- e: () => ComputeExpression<T>;
64
- o: ODataOperators<T>;
65
- f: ODataFunctions<T>;
66
- }, current?: ComputeExpression<T>) => ComputeExpression<T>): ComputeExpression<T>;
144
+ compute(opts: (builder: ComputeExpressionBuilder<T>, current?: ComputeExpression<T>) => ComputeExpression<T>): ComputeExpression<T>;
67
145
  compute(opts: string): ODataQueryOptionHandler<T>;
68
146
  compute(): ODataQueryOptionHandler<T>;
69
147
  /**
148
+ * Build and return a handler for modifying the $format option.
149
+ * If opts is given then set te value as new value for $format.
70
150
  * @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptionformat
151
+ * @param opts string value for format
71
152
  */
72
153
  format(opts: string): ODataQueryOptionHandler<T>;
73
154
  format(): ODataQueryOptionHandler<T>;
155
+ /**
156
+ * Build and return a handler for modifying the $transform option.
157
+ * If opts is given then set te value as new value for $transform.
158
+ * @param opts string value for transform
159
+ */
74
160
  transform(opts: Transform<T>): ODataQueryOptionHandler<T>;
75
161
  transform(): ODataQueryOptionHandler<T>;
76
- search(opts: (builder: {
77
- e: (connector: SearchConnector) => SearchExpression<T>;
78
- }, current?: SearchExpression<T>) => SearchExpression<T>): SearchExpression<T>;
162
+ /**
163
+ * Build and return a handler for modifying the $search option.
164
+ * If opts is given then set te value as new value for $search.
165
+ * @param opts string value or builder function for SearchExpression<T>
166
+ */
167
+ search(opts: (builder: SearchExpressionBuilder<T>, current?: SearchExpression<T>) => SearchExpression<T>): SearchExpression<T>;
79
168
  search(opts: string): ODataQueryOptionHandler<T>;
80
169
  search(): ODataQueryOptionHandler<T>;
81
- filter(opts: (builder: {
82
- s: T;
83
- e: (connector?: FilterConnector) => FilterExpression<T>;
84
- o: ODataOperators<T>;
85
- f: ODataFunctions<T>;
86
- }, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
170
+ /**
171
+ * Build and return a handler for modifying the $filter option.
172
+ * If opts is given then set te value as new value for $filter.
173
+ * @param opts Filter<T> value or builder function for FilterExpression<T>
174
+ */
175
+ filter(opts: (builder: FilterExpressionBuilder<T>, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
87
176
  filter(opts: Filter<T>): ODataQueryOptionHandler<T>;
88
177
  filter(): ODataQueryOptionHandler<T>;
89
- orderBy(opts: (builder: {
90
- s: T;
91
- e: () => OrderByExpression<T>;
92
- }, current?: OrderByExpression<T>) => OrderByExpression<T>): OrderByExpression<T>;
178
+ /**
179
+ * Build and return a handler for modifying the $orderby option.
180
+ * If opts is given then set te value as new value for $orderby.
181
+ * @param opts OrderBy<T> value or builder function for OrderByExpression<T>
182
+ */
183
+ orderBy(opts: (builder: OrderByExpressionBuilder<T>, current?: OrderByExpression<T>) => OrderByExpression<T>): OrderByExpression<T>;
93
184
  orderBy(opts: OrderBy<T>): ODataQueryOptionHandler<T>;
94
185
  orderBy(): ODataQueryOptionHandler<T>;
186
+ /**
187
+ * Build and return a handler for modifying the $top option.
188
+ * If opts is given then set te value as new value for $top.
189
+ * @param opts number value
190
+ */
95
191
  top(opts: number): ODataQueryOptionHandler<T>;
96
192
  top(): ODataQueryOptionHandler<T>;
193
+ /**
194
+ * Build and return a handler for modifying the $skip option.
195
+ * If opts is given then set te value as new value for $skip.
196
+ * @param opts number value
197
+ */
97
198
  skip(opts: number): ODataQueryOptionHandler<T>;
98
199
  skip(): ODataQueryOptionHandler<T>;
200
+ /**
201
+ * Build and return a handler for modifying the $skiptoken option.
202
+ * If opts is given then set te value as new value for $skiptoken.
203
+ * @param opts string value
204
+ */
99
205
  skiptoken(opts: string): ODataQueryOptionHandler<T>;
100
206
  skiptoken(): ODataQueryOptionHandler<T>;
207
+ /**
208
+ * Shortcut for set $top, $skip, $skiptoken.
209
+ * @param param0 skip or top or skiptoken
210
+ */
101
211
  paging({ skip, skiptoken, top, }?: {
102
- skip?: number;
103
- skiptoken?: string;
104
- top?: number;
212
+ skip?: number | null;
213
+ skiptoken?: string | null;
214
+ top?: number | null;
105
215
  }): void;
216
+ /**
217
+ * Shortcut for clear pagination by unset $top, $skip, $skiptoken.
218
+ */
106
219
  clearPaging(): void;
220
+ /**
221
+ * Shortcut for clear query.
222
+ */
223
+ clear(): void;
224
+ /**
225
+ * Retrun the query.
226
+ */
227
+ query(): ODataQueryArguments<T>;
228
+ /**
229
+ * Apply the given query options to the current query.
230
+ * @param query The query to be applied.
231
+ */
107
232
  apply(query: ODataQueryArguments<T>): void;
108
233
  }
@@ -1,21 +1,23 @@
1
1
  import { QueryOptionNames } from '../../types';
2
2
  import { Expand, Filter, OrderBy, Select, Transform } from './builder';
3
- import { Expression, FilterExpression, OrderByExpression, SearchExpression } from './expressions';
3
+ import { ComputeExpression, Expression, FilterExpression, OrderByExpression, SearchExpression } from './expressions';
4
4
  import { ExpandExpression } from './expressions/expand';
5
5
  import { SelectExpression } from './expressions/select';
6
6
  import { ODataQueryOptionHandler } from './handlers';
7
7
  export declare type ODataQueryArguments<T> = {
8
- [QueryOptionNames.select]?: Select<T> | SelectExpression<T>;
9
- [QueryOptionNames.filter]?: Filter<T> | FilterExpression<T>;
10
- [QueryOptionNames.search]?: string | SearchExpression<T>;
11
- [QueryOptionNames.compute]?: string;
12
- [QueryOptionNames.transform]?: Transform<T>;
13
- [QueryOptionNames.orderBy]?: OrderBy<T> | OrderByExpression<T>;
14
- [QueryOptionNames.top]?: number;
15
- [QueryOptionNames.skip]?: number;
16
- [QueryOptionNames.skiptoken]?: string;
17
- [QueryOptionNames.expand]?: Expand<T> | ExpandExpression<T>;
18
- [QueryOptionNames.format]?: string;
8
+ [QueryOptionNames.select]?: Select<T> | SelectExpression<T> | null;
9
+ [QueryOptionNames.expand]?: Expand<T> | ExpandExpression<T> | null;
10
+ [QueryOptionNames.compute]?: string | ComputeExpression<T> | null;
11
+ [QueryOptionNames.filter]?: Filter<T> | FilterExpression<T> | null;
12
+ [QueryOptionNames.search]?: string | SearchExpression<T> | null;
13
+ [QueryOptionNames.transform]?: Transform<T> | null;
14
+ [QueryOptionNames.orderBy]?: OrderBy<T> | OrderByExpression<T> | null;
15
+ [QueryOptionNames.top]?: number | null;
16
+ [QueryOptionNames.skip]?: number | null;
17
+ [QueryOptionNames.skiptoken]?: string | null;
18
+ [QueryOptionNames.format]?: string | null;
19
+ [QueryOptionNames.levels]?: number | 'max' | null;
20
+ [QueryOptionNames.count]?: boolean | null;
19
21
  };
20
22
  export declare class ODataQueryOptions<T> {
21
23
  values: Map<QueryOptionNames, any>;
@@ -16,7 +16,6 @@ export declare class ODataRequest<T> {
16
16
  private readonly _headers;
17
17
  private readonly _params;
18
18
  private readonly _path;
19
- private readonly _queryBody;
20
19
  constructor(init: {
21
20
  method: string;
22
21
  api: ODataApi;
@@ -45,6 +44,8 @@ export declare class ODataRequest<T> {
45
44
  get pathWithParams(): string;
46
45
  get url(): string;
47
46
  get urlWithParams(): string;
47
+ get cacheKey(): string;
48
+ isQueryBody(): boolean;
48
49
  isBatch(): boolean;
49
50
  isFetch(): boolean;
50
51
  isMutate(): boolean;
@@ -3,7 +3,7 @@ import { ODataApi } from '../api';
3
3
  import { ODataCollection, ODataModel } from '../models';
4
4
  import { ODataStructuredType } from '../schema';
5
5
  import { ODataSchemaElement } from '../schema/element';
6
- import { OptionsHelper, QueryOptionNames } from '../types';
6
+ import { ParserOptions, QueryOptionNames } from '../types';
7
7
  import { ODataPathSegments, ODataPathSegmentsHandler } from './path';
8
8
  import { ODataQueryOptions, ODataQueryOptionsHandler, QueryCustomType } from './query';
9
9
  import { ODataEntitiesAnnotations, ODataEntityAnnotations } from './responses/index';
@@ -37,6 +37,7 @@ export declare class ODataResource<T> {
37
37
  * @returns boolean The resource has key ?
38
38
  */
39
39
  hasKey(): boolean;
40
+ hasEntityKey(): boolean;
40
41
  clearKey(): void | undefined;
41
42
  asModel<M extends ODataModel<T>>(entity?: Partial<T> | {
42
43
  [name: string]: any;
@@ -60,9 +61,9 @@ export declare class ODataResource<T> {
60
61
  toString(): string;
61
62
  clone(): ODataResource<T>;
62
63
  private __parser;
63
- deserialize(value: any, options?: OptionsHelper): any;
64
- serialize(value: any, options?: OptionsHelper): any;
65
- encode(value: any, options?: OptionsHelper): any;
64
+ deserialize(value: any, options?: ParserOptions): any;
65
+ serialize(value: any, options?: ParserOptions): any;
66
+ encode(value: any, options?: ParserOptions): any;
66
67
  toJSON(): {
67
68
  segments: any[];
68
69
  options: {};
@@ -76,13 +77,13 @@ export declare class ODataResource<T> {
76
77
  * @param f Function context for handle the segments
77
78
  * @returns ODataActionResource
78
79
  */
79
- segment(f: (q: ODataPathSegmentsHandler<T>) => void): this;
80
+ segment(f: (q: ODataPathSegmentsHandler<T>, s?: ODataStructuredType<T>) => void): this;
80
81
  /**
81
82
  * Handle the query options of the resource
82
83
  * Create an object handler for mutate the query options of the resource
83
84
  * @param f Function context for handle the query options
84
85
  */
85
- query(f: (q: ODataQueryOptionsHandler<T>) => void): this;
86
+ query(f: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): this;
86
87
  static resolveKey<T>(value: any, schema?: ODataStructuredType<T>): EntityKey<T> | undefined;
87
88
  protected resolveKey(value: any): EntityKey<T> | undefined;
88
89
  protected request(method: string, options: ODataOptions & {
@@ -1,4 +1,4 @@
1
- import { ODataMetadataType, ODataVersion, OptionsHelper, ResponseOptions } from '../../types';
1
+ import { ODataMetadataType, ODataVersion, ParserOptions, ResponseOptions } from '../../types';
2
2
  export declare class ODataResponseOptions implements ResponseOptions {
3
3
  version: ODataVersion;
4
4
  streaming?: boolean;
@@ -7,7 +7,7 @@ export declare class ODataResponseOptions implements ResponseOptions {
7
7
  location?: string;
8
8
  cacheability?: 'public' | 'private' | 'no-cache' | 'no-store';
9
9
  maxAge?: number;
10
- constructor(config: OptionsHelper);
10
+ constructor(config: ParserOptions);
11
11
  get helper(): import("../../helper").ODataVersionHelper;
12
12
  clone(): ODataResponseOptions;
13
13
  setFeatures(features: string): void;
@@ -1,21 +1,16 @@
1
+ import { HttpErrorResponse, HttpResponseBase } from '@angular/common/http';
1
2
  import { Observable, Subject } from 'rxjs';
2
3
  import { ODataApi } from '../../api';
3
4
  import { ODataRequest } from '../request';
4
5
  import { ODataResource } from '../resource';
5
6
  import { ODataResponse } from '../responses';
6
7
  import { ODataOptions } from './options';
7
- export declare class ODataBatchRequest<T> extends Subject<ODataResponse<T>> {
8
+ export declare class ODataBatchRequest<T> extends Subject<HttpResponseBase> {
8
9
  request: ODataRequest<any>;
9
10
  constructor(request: ODataRequest<any>);
10
11
  toString(): string;
11
- onLoad(content: string[], status: {
12
- code: number;
13
- message: string;
14
- }): void;
15
- onError(content: string[], status: {
16
- code: number;
17
- text: string;
18
- }): void;
12
+ onLoad(response: HttpResponseBase): void;
13
+ onError(response: HttpErrorResponse): void;
19
14
  }
20
15
  /**
21
16
  * OData Batch Resource
@@ -24,6 +19,8 @@ export declare class ODataBatchRequest<T> extends Subject<ODataResponse<T>> {
24
19
  export declare class ODataBatchResource extends ODataResource<any> {
25
20
  private _requests;
26
21
  requests(): ODataRequest<any>[];
22
+ private _responses;
23
+ responses(): HttpResponseBase[] | null;
27
24
  static factory(api: ODataApi): ODataBatchResource;
28
25
  clone(): ODataBatchResource;
29
26
  private storeRequester;
@@ -34,7 +31,7 @@ export declare class ODataBatchResource extends ODataResource<any> {
34
31
  * @returns The result of execute the context
35
32
  */
36
33
  add<R>(ctx: (batch: this) => Observable<R>): Observable<R>;
37
- send(options?: ODataOptions): void;
34
+ send(options?: ODataOptions): Observable<null | ODataResponse<string>>;
38
35
  /**
39
36
  * Execute the batch request
40
37
  * @param ctx The context for the request
@@ -44,5 +41,5 @@ export declare class ODataBatchResource extends ODataResource<any> {
44
41
  exec<R>(ctx: (batch: this) => Observable<R>, options?: ODataOptions): Observable<R>;
45
42
  body(): string;
46
43
  static buildBody(batchBoundary: string, requests: ODataBatchRequest<any>[]): string;
47
- static handleResponse(requests: ODataBatchRequest<any>[], response: ODataResponse<any>): void;
44
+ static parseResponse(requests: ODataBatchRequest<any>[], response: ODataResponse<string>): HttpResponseBase[];
48
45
  }
@@ -25,6 +25,8 @@ export declare type ODataPropertyOptions = ODataOptions & {
25
25
  export declare type ODataNoneOptions = ODataOptions & {
26
26
  responseType?: 'none';
27
27
  };
28
- export declare type ODataQueryArgumentsOptions<T> = ODataQueryArguments<T> & {
28
+ export declare type ODataQueryArgumentsOptions<T> = ODataOptions & ODataQueryArguments<T>;
29
+ export declare type ODataActionOptions<T> = ODataQueryArgumentsOptions<T>;
30
+ export declare type ODataFunctionOptions<T> = ODataQueryArgumentsOptions<T> & {
29
31
  alias?: boolean;
30
- } & ODataOptions;
32
+ };
@@ -1,4 +1,4 @@
1
- import { CallableConfig, OptionsHelper, Parser } from '../types';
1
+ import { CallableConfig, ParserOptions, Parser } from '../types';
2
2
  import { ODataSchemaElement } from './element';
3
3
  import { ODataCallableParser } from './parsers';
4
4
  import { ODataSchema } from './schema';
@@ -18,21 +18,21 @@ export declare class ODataCallable<R> extends ODataSchemaElement {
18
18
  * @param options Options for deserialization
19
19
  * @returns Deserialized value
20
20
  */
21
- deserialize(value: any, options?: OptionsHelper): any;
21
+ deserialize(value: any, options?: ParserOptions): any;
22
22
  /**
23
23
  * Serialize the given value for the callable.
24
24
  * @param value Value to serialize
25
25
  * @param options Options for serialization
26
26
  * @returns Serialized value
27
27
  */
28
- serialize(value: any, options?: OptionsHelper): any;
28
+ serialize(value: any, options?: ParserOptions): any;
29
29
  /**
30
30
  * Encode the given value for the callable.
31
31
  * @param value Value to encode
32
32
  * @param options Options for encoding
33
33
  * @returns Encoded value
34
34
  */
35
- encode(value: any, options?: OptionsHelper): any;
35
+ encode(value: any, options?: ParserOptions): any;
36
36
  /**
37
37
  * Returns the binding parameter of the callable.
38
38
  * @returns The binding parameter of the callable.
@@ -1,11 +1,11 @@
1
- import { EnumTypeConfig, OptionsHelper } from '../types';
1
+ import { EnumTypeConfig, ParserOptions } from '../types';
2
2
  import { ODataSchemaElement } from './element';
3
3
  import { ODataEnumTypeFieldParser, ODataEnumTypeParser } from './parsers';
4
4
  import { ODataSchema } from './schema';
5
5
  export declare class ODataEnumType<E> extends ODataSchemaElement {
6
6
  parser: ODataEnumTypeParser<E>;
7
7
  members: {
8
- [name: string]: number;
8
+ [name: string]: E;
9
9
  } | {
10
10
  [value: number]: string;
11
11
  };
@@ -15,50 +15,38 @@ export declare class ODataEnumType<E> extends ODataSchemaElement {
15
15
  * Returns the fields of the enum type.
16
16
  * @returns The fields of the enum type.
17
17
  */
18
- fields(): ODataEnumTypeFieldParser[];
18
+ fields(value?: E): ODataEnumTypeFieldParser<E>[];
19
19
  /**
20
- * Find a field by name.
21
- * @param name The name of the field
22
- * @returns The field with the given name
20
+ * Find a field by name or value.
21
+ * @param enu The name or value of the field
22
+ * @returns The field with the given name or value
23
23
  */
24
- findFieldByName(name: string): ODataEnumTypeFieldParser | undefined;
25
- /**
26
- * Find a field by value.
27
- * @param value The value of the field
28
- * @returns The field with the given value
29
- */
30
- findFieldByValue(value: number): ODataEnumTypeFieldParser | undefined;
31
- /**
32
- * Find a fields by flag.
33
- * @param value The value of the field
34
- * @returns The fields with the given flag
35
- */
36
- findFieldsByValue(value: number): ODataEnumTypeFieldParser[];
24
+ field(enu: string | E): ODataEnumTypeFieldParser<E>;
37
25
  /**
38
26
  * Map the fields of the enum type.
39
27
  * @param mapper Function that maps the value to the new value
40
28
  * @returns The fields mapped by the mapper
41
29
  */
42
- mapFields<T>(mapper: (field: ODataEnumTypeFieldParser) => T): T[];
30
+ mapFields<T>(mapper: (field: ODataEnumTypeFieldParser<E>) => T): T[];
43
31
  /**
44
32
  * Deseialize the given value from the enum type.
45
33
  * @param value Value to deserialize
46
34
  * @param options Options for deserialization
47
35
  * @returns Deserialized value
48
36
  */
49
- deserialize(value: any, options?: OptionsHelper): E;
37
+ deserialize(value: any, options?: ParserOptions): E;
50
38
  /**
51
39
  * Serialize the given value for the enum type.
52
40
  * @param value Value to serialize
53
41
  * @param options Options for serialization
54
42
  * @returns Serialized value
55
43
  */
56
- serialize(value: E, options?: OptionsHelper): any;
44
+ serialize(value: E, options?: ParserOptions): any;
57
45
  /**
58
46
  * Encode the given value for the enum type.
59
47
  * @param value Value to encode
60
48
  * @param options Options for encoding
61
49
  * @returns Encoded value
62
50
  */
63
- encode(value: E, options?: OptionsHelper): any;
51
+ encode(value: E, options?: ParserOptions): any;
64
52
  }
@@ -1,4 +1,4 @@
1
- import { CallableConfig, OptionsHelper, Parameter, Parser } from '../../types';
1
+ import { CallableConfig, ParserOptions, Parameter, Parser } from '../../types';
2
2
  import { ODataEnumTypeParser } from './enum-type';
3
3
  import { ODataStructuredTypeParser } from './structured-type';
4
4
  export declare class ODataParameterParser<T> {
@@ -7,19 +7,20 @@ export declare class ODataParameterParser<T> {
7
7
  private parser;
8
8
  collection?: boolean;
9
9
  nullable?: boolean;
10
- optionsHelper?: OptionsHelper;
10
+ parserOptions?: ParserOptions;
11
11
  constructor(name: string, parameter: Parameter);
12
- serialize(value: T, options?: OptionsHelper): any;
13
- encode(value: any, options?: OptionsHelper): string;
12
+ serialize(value: T, options?: ParserOptions): any;
13
+ encode(value: any, options?: ParserOptions): string;
14
14
  configure({ parserForType, options, }: {
15
15
  parserForType: (type: string) => Parser<any>;
16
- options: OptionsHelper;
16
+ options: ParserOptions;
17
17
  }): void;
18
18
  isEdmType(): boolean;
19
19
  isEnumType(): boolean;
20
20
  enum(): ODataEnumTypeParser<T>;
21
21
  isStructuredType(): boolean;
22
22
  structured(): ODataStructuredTypeParser<T>;
23
+ field<F>(name: string): import("./structured-type").ODataStructuredTypeFieldParser<F>;
23
24
  }
24
25
  export declare class ODataCallableParser<R> implements Parser<R> {
25
26
  name: string;
@@ -32,16 +33,16 @@ export declare class ODataCallableParser<R> implements Parser<R> {
32
33
  parser: Parser<any>;
33
34
  parameters: ODataParameterParser<any>[];
34
35
  nonParenthesisForEmptyParameterFunction?: boolean;
35
- optionsHelper?: OptionsHelper;
36
+ parserOptions?: ParserOptions;
36
37
  constructor(config: CallableConfig, namespace: string, alias?: string);
37
38
  isTypeOf(type: string): boolean;
38
- deserialize(value: any, options?: OptionsHelper): R;
39
- serialize(params: any, options?: OptionsHelper): any;
40
- encode(params: any, options?: OptionsHelper): any;
39
+ deserialize(value: any, options?: ParserOptions): R;
40
+ serialize(params: any, options?: ParserOptions): any;
41
+ encode(params: any, options?: ParserOptions): any;
41
42
  configure({ nonParenthesisForEmptyParameterFunction, parserForType, options, }: {
42
43
  nonParenthesisForEmptyParameterFunction: boolean;
43
44
  parserForType: (type: string) => Parser<any>;
44
- options: OptionsHelper;
45
+ options: ParserOptions;
45
46
  }): void;
46
47
  binding(): ODataParameterParser<any> | undefined;
47
48
  }