angular-odata 0.100.1 → 0.101.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.
Files changed (58) hide show
  1. package/esm2020/lib/api.mjs +2 -2
  2. package/esm2020/lib/cache/cache.mjs +56 -4
  3. package/esm2020/lib/cache/memory.mjs +14 -4
  4. package/esm2020/lib/cache/storage.mjs +21 -2
  5. package/esm2020/lib/client.mjs +3 -3
  6. package/esm2020/lib/constants.mjs +2 -1
  7. package/esm2020/lib/models/collection.mjs +100 -39
  8. package/esm2020/lib/models/model.mjs +17 -2
  9. package/esm2020/lib/models/options.mjs +119 -81
  10. package/esm2020/lib/module.mjs +4 -4
  11. package/esm2020/lib/options.mjs +3 -8
  12. package/esm2020/lib/resources/query/expressions/syntax.mjs +1 -1
  13. package/esm2020/lib/resources/query/handlers.mjs +69 -1
  14. package/esm2020/lib/resources/resource.mjs +13 -9
  15. package/esm2020/lib/resources/responses/annotations.mjs +1 -1
  16. package/esm2020/lib/resources/responses/metadata.mjs +1 -1
  17. package/esm2020/lib/resources/responses/options.mjs +1 -1
  18. package/esm2020/lib/resources/responses/response.mjs +2 -2
  19. package/esm2020/lib/resources/types/batch.mjs +108 -97
  20. package/esm2020/lib/schema/callable.mjs +3 -3
  21. package/esm2020/lib/schema/enum-type.mjs +5 -2
  22. package/esm2020/lib/schema/parsers/callable.mjs +10 -20
  23. package/esm2020/lib/schema/parsers/enum-type.mjs +13 -16
  24. package/esm2020/lib/schema/parsers/structured-type.mjs +13 -25
  25. package/esm2020/lib/schema/structured-type.mjs +8 -4
  26. package/esm2020/lib/services/factory.mjs +3 -3
  27. package/esm2020/lib/types.mjs +1 -1
  28. package/esm2020/lib/utils/arrays.mjs +10 -0
  29. package/esm2020/lib/utils/enums.mjs +3 -3
  30. package/esm2020/lib/utils/objects.mjs +10 -5
  31. package/esm2020/lib/utils/types.mjs +5 -1
  32. package/fesm2015/angular-odata.mjs +2927 -2651
  33. package/fesm2015/angular-odata.mjs.map +1 -1
  34. package/fesm2020/angular-odata.mjs +2927 -2650
  35. package/fesm2020/angular-odata.mjs.map +1 -1
  36. package/lib/cache/cache.d.ts +62 -1
  37. package/lib/cache/memory.d.ts +10 -0
  38. package/lib/cache/storage.d.ts +19 -0
  39. package/lib/constants.d.ts +1 -0
  40. package/lib/models/collection.d.ts +9 -5
  41. package/lib/models/model.d.ts +6 -3
  42. package/lib/models/options.d.ts +11 -10
  43. package/lib/options.d.ts +3 -7
  44. package/lib/resources/query/handlers.d.ts +119 -0
  45. package/lib/resources/resource.d.ts +4 -4
  46. package/lib/resources/responses/options.d.ts +2 -2
  47. package/lib/resources/types/batch.d.ts +8 -11
  48. package/lib/schema/callable.d.ts +4 -4
  49. package/lib/schema/enum-type.d.ts +4 -4
  50. package/lib/schema/parsers/callable.d.ts +10 -10
  51. package/lib/schema/parsers/enum-type.d.ts +7 -7
  52. package/lib/schema/parsers/structured-type.d.ts +11 -11
  53. package/lib/schema/structured-type.d.ts +4 -4
  54. package/lib/types.d.ts +6 -8
  55. package/lib/utils/arrays.d.ts +3 -0
  56. package/lib/utils/enums.d.ts +2 -2
  57. package/lib/utils/types.d.ts +1 -0
  58. package/package.json +1 -1
@@ -1,6 +1,13 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { ODataRequest, ODataResponse } from '../resources';
3
3
  import { Cache } from '../types';
4
+ /**
5
+ * A cache entry that holds a payload, a last read time, and a timeout for the entry.
6
+ * @param payload The payload to cache.
7
+ * @param lastRead The last read time.
8
+ * @param timeout The timeout.
9
+ * @param tags Some tags to identify the entry.
10
+ */
4
11
  export interface ODataCacheEntry<T> {
5
12
  payload: T;
6
13
  lastRead: number;
@@ -15,28 +22,82 @@ export declare abstract class ODataCache implements Cache {
15
22
  });
16
23
  abstract getResponse(req: ODataRequest<any>): ODataResponse<any> | undefined;
17
24
  abstract putResponse(req: ODataRequest<any>, res: ODataResponse<any>): void;
25
+ /**
26
+ * Using the resource on the request build an array of string to identify the scope of the request
27
+ * @param req The request with the resource to build the scope
28
+ * @returns Array of string to identify the scope of the request
29
+ */
18
30
  scope(req: ODataRequest<any>): string[];
19
- tags(req: ODataRequest<any>, res: ODataResponse<any>): string[];
31
+ /**
32
+ * Using the odata context on the response build an array of string to identify the tags of the response
33
+ * @param res The response to build the tags
34
+ * @returns Array of string to identify the tags of the response
35
+ */
36
+ tags(res: ODataResponse<any>): string[];
37
+ /**
38
+ * Build an entry from a payload and some options
39
+ * @param payload The payload to store in the cache
40
+ * @param timeout The timeout for the entry
41
+ * @param tags The tags for the entry
42
+ * @returns The entry to store in the cache
43
+ */
20
44
  buildEntry<T>(payload: T, { timeout, tags }: {
21
45
  timeout?: number;
22
46
  tags?: string[];
23
47
  }): ODataCacheEntry<T>;
48
+ /**
49
+ * Build a key from store an entry in the cache
50
+ * @param names The names of the entry
51
+ * @returns The key for the entry
52
+ */
24
53
  buildKey(names: string[]): string;
54
+ /**
55
+ * Put some payload in the cache
56
+ * @param name The name for the entry
57
+ * @param payload The payload to store in the cache
58
+ * @param timeout The timeout for the entry
59
+ * @param scope The scope for the entry
60
+ * @param tags The tags for the entry
61
+ */
25
62
  put<T>(name: string, payload: T, { timeout, scope, tags, }?: {
26
63
  timeout?: number;
27
64
  scope?: string[];
28
65
  tags?: string[];
29
66
  }): void;
67
+ /**
68
+ * Return the payload from the cache if it exists and is not expired
69
+ * @param name The name of the entry
70
+ * @param scope The scope of the entry
71
+ * @returns The payload of the entry
72
+ */
30
73
  get<T>(name: string, { scope }?: {
31
74
  scope?: string[];
32
75
  }): T;
76
+ /**
77
+ * Remove all cache entries that are matching with the given options
78
+ * @param options The options to forget
79
+ */
33
80
  forget({ name, scope, tags, }?: {
34
81
  name?: string;
35
82
  scope?: string[];
36
83
  tags?: string[];
37
84
  }): void;
85
+ /**
86
+ * Remove all cache entries
87
+ */
38
88
  flush(): void;
89
+ /**
90
+ * Check if the entry is expired
91
+ * @param entry The cache entry
92
+ * @returns Boolean indicating if the entry is expired
93
+ */
39
94
  isExpired(entry: ODataCacheEntry<any>): boolean;
95
+ /**
96
+ * Using the request, handle the fetching of the response
97
+ * @param req The request to fetch
98
+ * @param res$ Observable of the response
99
+ * @returns
100
+ */
40
101
  handleRequest(req: ODataRequest<any>, res$: Observable<ODataResponse<any>>): Observable<ODataResponse<any>>;
41
102
  private handleFetch;
42
103
  private handleMutate;
@@ -4,6 +4,16 @@ export declare class ODataInMemoryCache extends ODataCache {
4
4
  constructor({ timeout }?: {
5
5
  timeout?: number;
6
6
  });
7
+ /**
8
+ * Store the response in the cache
9
+ * @param req The request with the resource to store the response
10
+ * @param res The response to store in the cache
11
+ */
7
12
  putResponse(req: ODataRequest<any>, res: ODataResponse<any>): void;
13
+ /**
14
+ * Restore the response from the cache
15
+ * @param req The request with the resource to get the response
16
+ * @returns The response from the cache
17
+ */
8
18
  getResponse(req: ODataRequest<any>): ODataResponse<any> | undefined;
9
19
  }
@@ -8,9 +8,28 @@ export declare class ODataInStorageCache extends ODataCache {
8
8
  name: string;
9
9
  storage?: Storage;
10
10
  });
11
+ /**
12
+ * Store the cache in the storage
13
+ */
11
14
  store(): void;
15
+ /**
16
+ * Restore the cache from the storage
17
+ */
12
18
  restore(): void;
19
+ /**
20
+ * Flush the cache and clean the storage
21
+ */
13
22
  flush(): void;
23
+ /**
24
+ * Store the response in the cache
25
+ * @param req The request with the resource to store the response
26
+ * @param res The response to store in the cache
27
+ */
14
28
  putResponse(req: ODataRequest<any>, res: ODataResponse<any>): void;
29
+ /**
30
+ * Restore the response from the cache
31
+ * @param req The request with the resource to get the response
32
+ * @returns The response from the cache
33
+ */
15
34
  getResponse(req: ODataRequest<any>): ODataResponse<any> | undefined;
16
35
  }
@@ -42,6 +42,7 @@ export declare const BINARY = "binary";
42
42
  export declare const BOUNDARY_PREFIX_SUFFIX = "--";
43
43
  export declare const BATCH_PREFIX = "batch_";
44
44
  export declare const CHANGESET_PREFIX = "changeset_";
45
+ export declare const DEFAULT_METADATA = "minimal";
45
46
  export declare const DEFAULT_STRIP_METADATA = "full";
46
47
  export declare const DEFAULT_FETCH_POLICY = "network-only";
47
48
  export declare const DEFAULT_TIMEOUT = 60;
@@ -68,19 +68,20 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
68
68
  private addReference;
69
69
  private _addModel;
70
70
  private addModel;
71
- add(model: M, { silent, reparent, server, position, }?: {
71
+ add(model: M, { silent, reparent, server, merge, position, }?: {
72
72
  silent?: boolean;
73
73
  reparent?: boolean;
74
74
  server?: boolean;
75
+ merge?: boolean;
75
76
  position?: number;
76
- }): Observable<this>;
77
+ }): Observable<M>;
77
78
  private removeReference;
78
79
  private _removeModel;
79
80
  private removeModel;
80
81
  remove(model: M, { silent, server, }?: {
81
82
  silent?: boolean;
82
83
  server?: boolean;
83
- }): Observable<this>;
84
+ }): Observable<M>;
84
85
  create(attrs?: T, { silent, server, }?: {
85
86
  silent?: boolean;
86
87
  server?: boolean;
@@ -92,6 +93,9 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
92
93
  path?: string | string[];
93
94
  silent?: boolean;
94
95
  }): void;
96
+ clear({ silent }?: {
97
+ silent?: boolean;
98
+ }): void;
95
99
  assign(objects: Partial<T>[] | {
96
100
  [name: string]: any;
97
101
  }[] | M[], { reset, reparent, silent, }?: {
@@ -102,8 +106,8 @@ export declare class ODataCollection<T, M extends ODataModel<T>> implements Iter
102
106
  query(func: (q: ODataQueryOptionsHandler<T>) => void): this;
103
107
  callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataQueryArgumentsOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
104
108
  callAction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none', { ...options }?: {} & ODataQueryArgumentsOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null>;
105
- private _unsubscribe;
106
- private _subscribe;
109
+ private _unlink;
110
+ private _link;
107
111
  private _findEntry;
108
112
  equals(other: ODataCollection<T, ODataModel<T>>): boolean;
109
113
  get [Symbol.toStringTag](): string;
@@ -55,13 +55,13 @@ export declare class ODataModel<T> {
55
55
  resolve?: boolean;
56
56
  }): {
57
57
  [name: string]: any;
58
- } | undefined;
58
+ } | null | undefined;
59
59
  referenced(field: ODataModelField<any>, { field_mapping, resolve, }?: {
60
60
  field_mapping?: boolean;
61
61
  resolve?: boolean;
62
62
  }): {
63
63
  [name: string]: any;
64
- } | undefined;
64
+ } | null | undefined;
65
65
  _errors?: {
66
66
  [key: string]: any;
67
67
  };
@@ -109,6 +109,9 @@ export declare class ODataModel<T> {
109
109
  path?: string | string[];
110
110
  silent?: boolean;
111
111
  }): void;
112
+ clear({ silent }?: {
113
+ silent?: boolean;
114
+ }): void;
112
115
  assign(entity: Partial<T> | {
113
116
  [name: string]: any;
114
117
  }, { reset, reparent, silent, }?: {
@@ -155,7 +158,7 @@ export declare class ODataModel<T> {
155
158
  fetchNavigationProperty<S>(name: keyof T | string, responseType: 'model' | 'collection', { ...options }?: {} & ODataQueryArgumentsOptions<S>): Observable<ODataModel<S> | ODataCollection<S, ODataModel<S>> | null>;
156
159
  getValue<P>(name: keyof T | string, options?: ODataOptions): Observable<P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null>;
157
160
  setReference<N>(name: keyof T | string, model: ODataModel<N> | ODataCollection<N, ODataModel<N>> | null, options?: ODataOptions): Observable<this>;
158
- getReference<P>(name: keyof T | string): ODataModel<P> | ODataCollection<P, ODataModel<P>>;
161
+ getReference<P>(name: keyof T | string): ODataModel<P> | ODataCollection<P, ODataModel<P>> | null;
159
162
  equals(other: ODataModel<T>): boolean;
160
163
  get [Symbol.toStringTag](): string;
161
164
  collection(): ODataCollection<T, ODataModel<T>> | undefined;
@@ -1,7 +1,7 @@
1
1
  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
- import { OptionsHelper } from '../types';
4
+ import { ParserOptions } from '../types';
5
5
  import type { ODataCollection } from './collection';
6
6
  import type { ODataModel } from './model';
7
7
  export declare type ODataModelEventType = 'change' | 'reset' | 'update' | 'destroy' | 'add' | 'remove' | 'invalid' | 'request' | 'sync' | 'attach';
@@ -93,6 +93,7 @@ export declare class ODataModelField<F> {
93
93
  min?: number;
94
94
  max?: number;
95
95
  pattern?: RegExp;
96
+ parserOptions?: ParserOptions;
96
97
  constructor(options: ODataModelOptions<any>, { name, field, parser, ...opts }: ODataModelFieldOptions<F>);
97
98
  get api(): import("angular-odata").ODataApi;
98
99
  get type(): string;
@@ -102,7 +103,7 @@ export declare class ODataModelField<F> {
102
103
  configure({ findOptionsForType, concurrency, options, }: {
103
104
  findOptionsForType: (type: string) => ODataModelOptions<any> | undefined;
104
105
  concurrency: boolean;
105
- options: OptionsHelper;
106
+ options: ParserOptions;
106
107
  }): void;
107
108
  isKey(): boolean;
108
109
  hasReferentials(): boolean;
@@ -116,9 +117,9 @@ export declare class ODataModelField<F> {
116
117
  navigation?: boolean;
117
118
  }): any;
118
119
  defaults(): any;
119
- deserialize(value: any, options?: OptionsHelper): F;
120
- serialize(value: F, options?: OptionsHelper): any;
121
- encode(value: F, options?: OptionsHelper): any;
120
+ deserialize(value: any, options?: ParserOptions): F;
121
+ serialize(value: F, options?: ParserOptions): any;
122
+ encode(value: F, options?: ParserOptions): any;
122
123
  resourceFactory<T, F>(base: ODataResource<T>): ODataNavigationPropertyResource<F> | ODataPropertyResource<F>;
123
124
  annotationsFactory(base: ODataEntityAnnotations): ODataEntityAnnotations | ODataEntitiesAnnotations;
124
125
  schemaFactory<T, F>(base: ODataStructuredType<T>): ODataStructuredType<F> | undefined;
@@ -166,7 +167,7 @@ export declare class ODataModelOptions<T> {
166
167
  findChildOptions(predicate: (options: ODataModelOptions<any>) => boolean): ODataModelOptions<any> | undefined;
167
168
  configure({ findOptionsForType, options, }: {
168
169
  findOptionsForType: (type: string) => ODataModelOptions<any> | undefined;
169
- options: OptionsHelper;
170
+ options: ParserOptions;
170
171
  }): void;
171
172
  fields({ include_navigation, include_parents, }?: {
172
173
  include_parents?: boolean;
@@ -206,7 +207,7 @@ export declare class ODataModelOptions<T> {
206
207
  resolve?: boolean;
207
208
  }): {
208
209
  [name: string]: any;
209
- } | undefined;
210
+ } | null | undefined;
210
211
  resolveReferenced(value: ODataModel<T> | T | {
211
212
  [name: string]: any;
212
213
  } | null, field: ODataModelField<any>, { field_mapping, resolve, }?: {
@@ -214,7 +215,7 @@ export declare class ODataModelOptions<T> {
214
215
  resolve?: boolean;
215
216
  }): {
216
217
  [name: string]: any;
217
- } | undefined;
218
+ } | null | undefined;
218
219
  validate(self: ODataModel<T>, { method, navigation, }?: {
219
220
  method?: 'create' | 'update' | 'modify';
220
221
  navigation?: boolean;
@@ -269,6 +270,6 @@ export declare class ODataModelOptions<T> {
269
270
  private _setStructured;
270
271
  private _setValue;
271
272
  private _set;
272
- private _unsubscribe;
273
- private _subscribe;
273
+ private _unlink;
274
+ private _link;
274
275
  }
package/lib/options.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ApiOptions, FetchPolicy, ODataMetadataType, ODataVersion, OptionsHelper, QueryOptionNames } from './types';
2
- export declare class ODataApiOptions implements ApiOptions, OptionsHelper {
1
+ import { ApiOptions, FetchPolicy, ODataMetadataType, ODataVersion, ParserOptions, QueryOptionNames } from './types';
2
+ export declare class ODataApiOptions implements ApiOptions {
3
3
  /**
4
4
  * Default OData version
5
5
  */
@@ -77,10 +77,6 @@ export declare class ODataApiOptions implements ApiOptions, OptionsHelper {
77
77
  deleteRefBy: 'path' | 'id';
78
78
  nonParenthesisForEmptyParameterFunction: boolean;
79
79
  constructor(config: ApiOptions);
80
- get helper(): import("./helper").ODataVersionHelper;
81
- }
82
- export declare class ODataParserOptions implements OptionsHelper {
83
- version: ODataVersion;
84
- constructor(config: OptionsHelper);
80
+ get parserOptions(): ParserOptions;
85
81
  get helper(): import("./helper").ODataVersionHelper;
86
82
  }
@@ -8,22 +8,79 @@ export declare class ODataQueryOptionHandler<T> {
8
8
  private o;
9
9
  private n;
10
10
  constructor(o: Map<QueryOptionNames, any>, n: QueryOptionNames);
11
+ /**
12
+ * The name of the managed odata query option.
13
+ */
11
14
  get name(): QueryOptionNames;
15
+ /**
16
+ * Converts the managed odata query option to a json object.
17
+ * @returns {any}
18
+ */
12
19
  toJSON(): any;
20
+ /**
21
+ * Returns a boolean indicating if the managed odata query option is empty.
22
+ * @returns True if the managed odata query option is empty.
23
+ */
13
24
  empty(): boolean;
25
+ /**
26
+ * Get or Set the value of the managed odata query option.
27
+ * @param v The value to set.
28
+ * @returns
29
+ */
14
30
  value(v?: any): any;
15
31
  private assertArray;
32
+ /**
33
+ * Push value to the managed odata query option.
34
+ * @param value Value to push
35
+ */
16
36
  push(value: any): void;
37
+ /**
38
+ * Remove value from the managed odata query option.
39
+ * @param value Value to remove
40
+ */
17
41
  remove(value: any): void;
42
+ /**
43
+ * Return value at index of the managed odata query option.
44
+ * @param index Index of the value
45
+ * @returns The value
46
+ */
18
47
  at(index: number): any;
19
48
  private assertObject;
49
+ /**
50
+ * Set the value for path in the managed odata query option.
51
+ * @param path Path for set the value
52
+ * @param value Value to set
53
+ */
20
54
  set(path: string, value: any): void;
55
+ /**
56
+ * Get the value for path from the managed odata query option.
57
+ * @param path The path from get the value
58
+ * @param def Default if not found
59
+ * @returns
60
+ */
21
61
  get(path: string, def?: any): any;
62
+ /**
63
+ * Unset the value for path in the managed odata query option.
64
+ * @param path
65
+ */
22
66
  unset(path: string): void;
67
+ /**
68
+ * Test if the managed odata query option has the value.
69
+ * @param path The path fot test if the value is set
70
+ * @returns Boolean indicating if the value is set
71
+ */
23
72
  has(path: string): boolean;
73
+ /**
74
+ * Merge values from object into the managed odata query option.
75
+ * @param values Object to merge
76
+ * @returns
77
+ */
24
78
  assign(values: {
25
79
  [attr: string]: any;
26
80
  }): Object;
81
+ /**
82
+ * Clear the managed odata query option.
83
+ */
27
84
  clear(): void;
28
85
  }
29
86
  export declare class ODataQueryOptionsHandler<T> {
@@ -43,12 +100,22 @@ export declare class ODataQueryOptionsHandler<T> {
43
100
  * @returns The normalized value
44
101
  */
45
102
  normalize(value: any): any;
103
+ /**
104
+ * Build and return a handler for modifying the $select option.
105
+ * If opts is given then set te value as new value for $select.
106
+ * @param opts Select<T> value or builder function for SelectExpression<T>
107
+ */
46
108
  select(opts: (builder: {
47
109
  s: T;
48
110
  e: () => SelectExpression<T>;
49
111
  }, current?: SelectExpression<T>) => SelectExpression<T>): SelectExpression<T>;
50
112
  select(opts: Select<T>): ODataQueryOptionHandler<T>;
51
113
  select(): ODataQueryOptionHandler<T>;
114
+ /**
115
+ * Build and return a handler for modifying the $expand option.
116
+ * If opts is given then set te value as new value for $expand.
117
+ * @param opts Expand<T> value or builder function for ExpandExpression<T>
118
+ */
52
119
  expand(opts: (builder: {
53
120
  s: T;
54
121
  e: () => ExpandExpression<T>;
@@ -56,7 +123,10 @@ export declare class ODataQueryOptionsHandler<T> {
56
123
  expand(opts: Expand<T>): ODataQueryOptionHandler<T>;
57
124
  expand(): ODataQueryOptionHandler<T>;
58
125
  /**
126
+ * Build and return a handler for modifying the $compute option.
127
+ * If opts is given then set te value as new value for $compute.
59
128
  * @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptioncompute
129
+ * @param opts string value or builder function for ComputeExpression<T>
60
130
  */
61
131
  compute(opts: (builder: {
62
132
  s: T;
@@ -67,17 +137,35 @@ export declare class ODataQueryOptionsHandler<T> {
67
137
  compute(opts: string): ODataQueryOptionHandler<T>;
68
138
  compute(): ODataQueryOptionHandler<T>;
69
139
  /**
140
+ * Build and return a handler for modifying the $format option.
141
+ * If opts is given then set te value as new value for $format.
70
142
  * @link https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptionformat
143
+ * @param opts string value for format
71
144
  */
72
145
  format(opts: string): ODataQueryOptionHandler<T>;
73
146
  format(): ODataQueryOptionHandler<T>;
147
+ /**
148
+ * Build and return a handler for modifying the $transform option.
149
+ * If opts is given then set te value as new value for $transform.
150
+ * @param opts string value for transform
151
+ */
74
152
  transform(opts: Transform<T>): ODataQueryOptionHandler<T>;
75
153
  transform(): ODataQueryOptionHandler<T>;
154
+ /**
155
+ * Build and return a handler for modifying the $search option.
156
+ * If opts is given then set te value as new value for $search.
157
+ * @param opts string value or builder function for SearchExpression<T>
158
+ */
76
159
  search(opts: (builder: {
77
160
  e: (connector: SearchConnector) => SearchExpression<T>;
78
161
  }, current?: SearchExpression<T>) => SearchExpression<T>): SearchExpression<T>;
79
162
  search(opts: string): ODataQueryOptionHandler<T>;
80
163
  search(): ODataQueryOptionHandler<T>;
164
+ /**
165
+ * Build and return a handler for modifying the $filter option.
166
+ * If opts is given then set te value as new value for $filter.
167
+ * @param opts Filter<T> value or builder function for FilterExpression<T>
168
+ */
81
169
  filter(opts: (builder: {
82
170
  s: T;
83
171
  e: (connector?: FilterConnector) => FilterExpression<T>;
@@ -86,23 +174,54 @@ export declare class ODataQueryOptionsHandler<T> {
86
174
  }, current?: FilterExpression<T>) => FilterExpression<T>): FilterExpression<T>;
87
175
  filter(opts: Filter<T>): ODataQueryOptionHandler<T>;
88
176
  filter(): ODataQueryOptionHandler<T>;
177
+ /**
178
+ * Build and return a handler for modifying the $orderby option.
179
+ * If opts is given then set te value as new value for $orderby.
180
+ * @param opts OrderBy<T> value or builder function for OrderByExpression<T>
181
+ */
89
182
  orderBy(opts: (builder: {
90
183
  s: T;
91
184
  e: () => OrderByExpression<T>;
92
185
  }, current?: OrderByExpression<T>) => OrderByExpression<T>): OrderByExpression<T>;
93
186
  orderBy(opts: OrderBy<T>): ODataQueryOptionHandler<T>;
94
187
  orderBy(): ODataQueryOptionHandler<T>;
188
+ /**
189
+ * Build and return a handler for modifying the $top option.
190
+ * If opts is given then set te value as new value for $top.
191
+ * @param opts number value
192
+ */
95
193
  top(opts: number): ODataQueryOptionHandler<T>;
96
194
  top(): ODataQueryOptionHandler<T>;
195
+ /**
196
+ * Build and return a handler for modifying the $skip option.
197
+ * If opts is given then set te value as new value for $skip.
198
+ * @param opts number value
199
+ */
97
200
  skip(opts: number): ODataQueryOptionHandler<T>;
98
201
  skip(): ODataQueryOptionHandler<T>;
202
+ /**
203
+ * Build and return a handler for modifying the $skiptoken option.
204
+ * If opts is given then set te value as new value for $skiptoken.
205
+ * @param opts string value
206
+ */
99
207
  skiptoken(opts: string): ODataQueryOptionHandler<T>;
100
208
  skiptoken(): ODataQueryOptionHandler<T>;
209
+ /**
210
+ * Shortcut for set $top, $skip, $skiptoken.
211
+ * @param param0 skip or top or skiptoken
212
+ */
101
213
  paging({ skip, skiptoken, top, }?: {
102
214
  skip?: number;
103
215
  skiptoken?: string;
104
216
  top?: number;
105
217
  }): void;
218
+ /**
219
+ * Shortcut for clear pagination by unset $top, $skip, $skiptoken.
220
+ */
106
221
  clearPaging(): void;
222
+ /**
223
+ * Apply the given query options to the current query.
224
+ * @param query The query to be applied.
225
+ */
107
226
  apply(query: ODataQueryArguments<T>): void;
108
227
  }
@@ -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';
@@ -60,9 +60,9 @@ export declare class ODataResource<T> {
60
60
  toString(): string;
61
61
  clone(): ODataResource<T>;
62
62
  private __parser;
63
- deserialize(value: any, options?: OptionsHelper): any;
64
- serialize(value: any, options?: OptionsHelper): any;
65
- encode(value: any, options?: OptionsHelper): any;
63
+ deserialize(value: any, options?: ParserOptions): any;
64
+ serialize(value: any, options?: ParserOptions): any;
65
+ encode(value: any, options?: ParserOptions): any;
66
66
  toJSON(): {
67
67
  segments: any[];
68
68
  options: {};
@@ -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
  }
@@ -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.