angular-odata 0.144.2 → 0.145.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.
@@ -1,387 +1,73 @@
1
1
  import * as json_schema from 'json-schema';
2
2
  import { JSONSchema7 } from 'json-schema';
3
3
  import { Observable, Subject, Subscription } from 'rxjs';
4
- import * as angular_odata from 'angular-odata';
5
4
  import { HttpContext, HttpHeaders, HttpParams, HttpResponseBase, HttpErrorResponse, HttpResponse, HttpClient, HttpEvent } from '@angular/common/http';
5
+ import * as angular_odata from 'angular-odata';
6
6
  import * as i0 from '@angular/core';
7
7
  import { EventEmitter, Provider, InjectionToken, EnvironmentProviders, ModuleWithProviders } from '@angular/core';
8
8
  import * as i1 from '@angular/common';
9
9
 
10
- type ODataVersion = '2.0' | '3.0' | '4.0';
11
- type FetchPolicy = 'cache-first' | 'cache-and-network' | 'network-only' | 'no-cache' | 'cache-only';
12
- type ODataMetadataType = 'minimal' | 'full' | 'none';
13
- type CacheCacheability = 'public' | 'private' | 'no-cache' | 'no-store';
14
- declare enum PathSegment {
15
- batch = "batch",
16
- metadata = "metadata",
17
- entitySet = "entitySet",
18
- singleton = "singleton",
19
- type = "type",
20
- property = "property",
21
- navigationProperty = "navigationProperty",
22
- reference = "reference",
23
- value = "value",
24
- count = "count",
25
- function = "function",
26
- action = "action"
27
- }
28
- declare enum QueryOption {
29
- select = "select",
30
- expand = "expand",
31
- compute = "compute",
32
- apply = "apply",
33
- filter = "filter",
34
- search = "search",
35
- transform = "transform",
36
- orderBy = "orderBy",
37
- top = "top",
38
- skip = "skip",
39
- skiptoken = "skiptoken",
40
- format = "format",
41
- levels = "levels",
42
- count = "count"
43
- }
44
- declare enum EdmType {
45
- Guid = "Edm.Guid",
46
- Int16 = "Edm.Int16",
47
- String = "Edm.String",
48
- Boolean = "Edm.Boolean",
49
- Byte = "Edm.Byte",
50
- SByte = "Edm.SByte",
51
- Int32 = "Edm.Int32",
52
- Int64 = "Edm.Int64",
53
- Date = "Edm.Date",
54
- TimeOfDay = "Edm.TimeOfDay",
55
- DateTimeOffset = "Edm.DateTimeOffset",
56
- Duration = "Edm.Duration",
57
- Decimal = "Edm.Decimal",
58
- Double = "Edm.Double",
59
- Single = "Edm.Single",
60
- Binary = "Edm.Binary",
61
- Stream = "Edm.Stream",
62
- Geography = "Edm.Geography",
63
- GeographyPoint = "Edm.GeographyPoint",
64
- GeographyLineString = "Edm.GeographyLineString",
65
- GeographyPolygon = "Edm.GeographyPolygon",
66
- GeographyMultiPoint = "Edm.GeographyMultiPoint",
67
- GeographyMultiLineString = "Edm.GeographyMultiLineString",
68
- GeographyMultiPolygon = "Edm.GeographyMultiPolygon",
69
- GeographyCollection = "Edm.GeographyCollection",
70
- Geometry = "Edm.Geometry",
71
- GeometryPoint = "Edm.GeometryPoint",
72
- GeometryLineString = "Edm.GeometryLineString",
73
- GeometryPolygon = "Edm.GeometryPolygon",
74
- GeometryMultiPoint = "Edm.GeometryMultiPoint",
75
- GeometryMultiLineString = "Edm.GeometryMultiLineString",
76
- GeometryMultiPolygon = "Edm.GeometryMultiPolygon",
77
- GeometryCollection = "Edm.GeometryCollection"
78
- }
79
- declare enum JsonSchemaType {
80
- string = "string",
81
- number = "number",
82
- integer = "integer",
83
- object = "object",
84
- array = "array",
85
- boolean = "boolean",
86
- null = "null"
87
- }
88
- type JsonSchemaSelect<T> = Array<keyof T>;
89
- type JsonSchemaCustom<T> = {
90
- [P in keyof T]?: (schema: JSONSchema7, field: FieldParser<T[P]>) => JSONSchema7;
10
+ type LooseUnion<U> = U | (U extends string ? Record<never, never> & string : never);
11
+ type ObjectValues<T> = T[keyof T];
12
+ type Unpacked<T> = NonNullable<T> extends (infer U)[] ? U : NonNullable<T>;
13
+ type Select<T> = SelectType<T> | SelectType<T>[];
14
+ type SelectType<T> = LooseUnion<keyof T>;
15
+ type Filter<T> = FilterType<T> | FilterType<T>[];
16
+ type FilterType<T> = string | Record<string | keyof T, any>;
17
+ declare const StandardAggregateMethods: {
18
+ readonly sum: "sum";
19
+ readonly min: "min";
20
+ readonly max: "max";
21
+ readonly average: "average";
22
+ readonly countdistinct: "countdistinct";
91
23
  };
92
- type JsonSchemaExpand<T> = {
93
- [P in keyof T]?: JsonSchemaFieldOptions<T[P]>;
24
+ type StandardAggregateMethods = ObjectValues<typeof StandardAggregateMethods>;
25
+ type AggregateType<T> = string | Record<string | keyof T, {
26
+ with: StandardAggregateMethods;
27
+ as: string;
28
+ }>;
29
+ type OrderBy<T> = OrderByType<T> | OrderByType<T>[];
30
+ type OrderByType<T> = LooseUnion<OrderByObject<T>>;
31
+ type OrderByObject<T> = keyof T | [keyof T | string, 'asc' | 'desc'] | NestedOrderBy<T>;
32
+ type NestedOrderBy<T> = {
33
+ [P in keyof T]?: T[P] extends Array<infer E> ? OrderBy<E> : OrderBy<T[P]>;
94
34
  };
95
- type JsonSchemaRequired<T> = {
96
- [P in keyof T]?: boolean;
35
+ type Expand<T> = ExpandType<T> | ExpandType<T>[];
36
+ type ExpandType<T> = LooseUnion<ExpandObject<T>>;
37
+ type ExpandObject<T> = keyof T | NestedExpandOptions<T>;
38
+ type NestedExpandOptions<T> = {
39
+ [P in keyof T]?: ExpandOptions<Unpacked<T[P]>>;
97
40
  };
98
- type JsonSchemaFieldOptions<T> = {
99
- select?: JsonSchemaSelect<T>;
100
- custom?: JsonSchemaCustom<T>;
101
- expand?: JsonSchemaExpand<T>;
102
- required?: JsonSchemaRequired<T>;
41
+ type ExpandOptions<T> = {
42
+ select?: Select<T>;
43
+ filter?: Filter<T>;
44
+ orderBy?: OrderBy<T>;
45
+ top?: number;
46
+ skip?: number;
47
+ levels?: number | 'max';
48
+ count?: boolean | Filter<T>;
49
+ expand?: Expand<T>;
103
50
  };
104
- type JsonSchemaOptions<T> = JsonSchemaFieldOptions<T> & {
105
- map?: (schema: JSONSchema7, parent?: JSONSchema7) => JSONSchema7;
51
+ type Transform<T> = {
52
+ aggregate?: AggregateType<T> | Array<AggregateType<T>>;
53
+ filter?: Filter<T> | null;
54
+ groupBy?: GroupByType<T>;
106
55
  };
107
- interface ParserOptions {
108
- version?: ODataVersion;
109
- exponentialDecimals?: boolean;
110
- metadata?: ODataMetadataType;
111
- ieee754Compatible?: boolean;
112
- streaming?: boolean;
113
- stringAsEnum?: boolean;
114
- deleteRefBy?: 'path' | 'id';
115
- nonParenthesisForEmptyParameterFunction?: boolean;
116
- }
117
- interface ResponseOptions extends ParserOptions {
118
- cacheability?: CacheCacheability;
119
- maxAge?: number;
120
- }
121
- interface StructuredTypeFieldOptions extends ParserOptions {
122
- field: ODataStructuredTypeFieldConfig;
123
- }
124
- interface Parser<T> {
125
- deserialize(value: any, options?: ParserOptions | StructuredTypeFieldOptions): T | T[];
126
- serialize(value: T, options?: ParserOptions | StructuredTypeFieldOptions): any;
127
- encode(value: T, options?: ParserOptions | StructuredTypeFieldOptions): any;
128
- }
129
- interface FieldParser<T> extends Parser<T> {
130
- nullable?: boolean;
131
- default?: any;
132
- maxLength?: number;
133
- precision?: number;
134
- scale?: number | 'variable';
135
- }
136
- declare const NONE_PARSER: Parser<any>;
137
- interface ODataCache {
138
- put<T>(key: string, payload: T, ...opts: any[]): void;
139
- get<T>(key: string, ...opts: any[]): T | undefined;
140
- handleRequest(req: any, res$: Observable<any>): Observable<any>;
141
- flush(): void;
142
- }
143
- interface ODataApiConfigOptions {
144
- version?: ODataVersion;
145
- params?: {
146
- [param: string]: string | string[];
147
- };
148
- headers?: {
149
- [param: string]: string | string[];
150
- };
151
- withCredentials?: boolean;
152
- accept?: {
153
- exponentialDecimals?: boolean;
154
- metadata?: ODataMetadataType;
155
- ieee754Compatible?: boolean;
156
- streaming?: boolean;
157
- };
158
- etag?: {
159
- ifMatch?: boolean;
160
- ifNoneMatch?: boolean;
161
- };
162
- prefer?: {
163
- maxPageSize?: number;
164
- return?: 'representation' | 'minimal';
165
- continueOnError?: boolean;
166
- includeAnnotations?: string;
167
- };
168
- stripMetadata?: ODataMetadataType;
169
- fetchPolicy?: FetchPolicy;
170
- bodyQueryOptions?: QueryOption[];
171
- stringAsEnum?: boolean;
172
- deleteRefBy?: 'path' | 'id';
173
- nonParenthesisForEmptyParameterFunction?: boolean;
174
- jsonBatchFormat?: boolean;
175
- relativeUrls?: boolean;
176
- }
177
- type ODataApiConfig = {
178
- serviceRootUrl: string;
179
- metadataUrl?: string;
180
- name?: string;
181
- version?: ODataVersion;
182
- default?: boolean;
183
- creation?: Date;
184
- cache?: ODataCache;
185
- errorHandler?: (error: any, caught: Observable<any>) => Observable<never>;
186
- options?: ODataApiConfigOptions;
187
- parsers?: {
188
- [type: string]: Parser<any>;
189
- };
190
- schemas?: ODataSchemaConfig[];
191
- references?: ODataReferenceConfig[];
192
- models?: {
193
- [type: string]: {
194
- new (...params: any[]): any;
195
- };
196
- };
197
- collections?: {
198
- [type: string]: {
199
- new (...params: any[]): any;
200
- };
201
- };
56
+ type GroupByType<T> = {
57
+ properties: Array<LooseUnion<keyof T>>;
58
+ transform?: Transform<T>;
202
59
  };
203
- type ODataAnnotationConfig = {
204
- term: string;
205
- string?: string;
206
- bool?: boolean;
207
- int?: number;
208
- permissions?: string[];
209
- properties?: string[];
60
+ declare const QueryCustomTypes: {
61
+ readonly Raw: "Raw";
62
+ readonly Alias: "Alias";
63
+ readonly Duration: "Duration";
64
+ readonly Binary: "Binary";
210
65
  };
211
- type ODataReferenceConfig = {
212
- uri: string;
213
- includes?: string;
214
- annotations?: ODataAnnotationConfig[];
215
- enums?: ODataEnumTypeConfig[];
216
- entities?: ODataStructuredTypeConfig[];
217
- callables?: ODataCallableConfig[];
218
- containers?: ODataEntityContainerConfig[];
219
- };
220
- type ODataSchemaConfig = {
221
- namespace: string;
222
- alias?: string;
223
- annotations?: ODataAnnotationConfig[];
224
- enums?: ODataEnumTypeConfig[];
225
- entities?: ODataStructuredTypeConfig[];
226
- callables?: ODataCallableConfig[];
227
- containers?: ODataEntityContainerConfig[];
228
- };
229
- type ODataEntityContainerConfig = {
230
- name: string;
231
- annotations?: ODataAnnotationConfig[];
232
- entitySets?: ODataEntitySetConfig[];
233
- singletons?: ODataSingletonConfig[];
234
- };
235
- type ODataEnumTypeFieldConfig = {
236
- value: number;
237
- annotations?: ODataAnnotationConfig[];
238
- };
239
- type ODataEnumTypeConfig = {
240
- name: string;
241
- flags?: boolean;
242
- annotations?: ODataAnnotationConfig[];
243
- members: {
244
- [name: string]: number;
245
- } | {
246
- [value: number]: string;
247
- };
248
- fields: {
249
- [member: string]: ODataEnumTypeFieldConfig;
250
- };
251
- };
252
- type ODataStructuredTypeFieldConfig = {
253
- type: string;
254
- default?: any;
255
- maxLength?: number;
256
- key?: boolean;
257
- collection?: boolean;
258
- nullable?: boolean;
259
- navigation?: boolean;
260
- precision?: number;
261
- annotations?: ODataAnnotationConfig[];
262
- scale?: number | 'variable';
263
- referentials?: {
264
- property: string;
265
- referencedProperty: string;
266
- }[];
267
- referential?: string;
268
- referenced?: string;
269
- };
270
- type ODataStructuredTypeConfig = {
271
- name: string;
272
- base?: string;
273
- open?: boolean;
274
- model?: {
275
- new (...params: any[]): any;
276
- };
277
- collection?: {
278
- new (...params: any[]): any;
279
- };
280
- annotations?: ODataAnnotationConfig[];
281
- keys?: {
282
- name: string;
283
- alias?: string;
284
- }[];
285
- fields?: {
286
- [name: string]: ODataStructuredTypeFieldConfig;
287
- };
288
- };
289
- type ODataParameterConfig = {
290
- type: string;
291
- nullable?: boolean;
292
- collection?: boolean;
293
- };
294
- type ODataCallableConfig = {
295
- name: string;
296
- entitySetPath?: string;
297
- bound?: boolean;
298
- composable?: boolean;
299
- parameters?: {
300
- [name: string]: ODataParameterConfig;
301
- };
302
- return?: {
303
- type: string;
304
- collection?: boolean;
305
- };
306
- };
307
- type ODataEntitySetConfig = {
308
- name: string;
309
- entityType: string;
310
- service: {
311
- new (...params: any[]): any;
312
- };
313
- annotations?: ODataAnnotationConfig[];
314
- };
315
- type ODataSingletonConfig = {
316
- name: string;
317
- type: string;
318
- service: {
319
- new (...params: any[]): any;
320
- };
321
- annotations?: ODataAnnotationConfig[];
322
- };
323
-
324
- type LooseUnion<U> = U | (U extends string ? Record<never, never> & string : never);
325
- type ObjectValues<T> = T[keyof T];
326
- type Unpacked<T> = NonNullable<T> extends (infer U)[] ? U : NonNullable<T>;
327
- type Select<T> = SelectType<T> | SelectType<T>[];
328
- type SelectType<T> = LooseUnion<keyof T>;
329
- type Filter<T> = FilterType<T> | FilterType<T>[];
330
- type FilterType<T> = string | Record<string | keyof T, any>;
331
- declare const StandardAggregateMethods: {
332
- readonly sum: "sum";
333
- readonly min: "min";
334
- readonly max: "max";
335
- readonly average: "average";
336
- readonly countdistinct: "countdistinct";
337
- };
338
- type StandardAggregateMethods = ObjectValues<typeof StandardAggregateMethods>;
339
- type AggregateType<T> = string | Record<string | keyof T, {
340
- with: StandardAggregateMethods;
341
- as: string;
342
- }>;
343
- type OrderBy<T> = OrderByType<T> | OrderByType<T>[];
344
- type OrderByType<T> = LooseUnion<OrderByObject<T>>;
345
- type OrderByObject<T> = keyof T | [keyof T | string, 'asc' | 'desc'] | NestedOrderBy<T>;
346
- type NestedOrderBy<T> = {
347
- [P in keyof T]?: T[P] extends Array<infer E> ? OrderBy<E> : OrderBy<T[P]>;
348
- };
349
- type Expand<T> = ExpandType<T> | ExpandType<T>[];
350
- type ExpandType<T> = LooseUnion<ExpandObject<T>>;
351
- type ExpandObject<T> = keyof T | NestedExpandOptions<T>;
352
- type NestedExpandOptions<T> = {
353
- [P in keyof T]?: ExpandOptions<Unpacked<T[P]>>;
354
- };
355
- type ExpandOptions<T> = {
356
- select?: Select<T>;
357
- filter?: Filter<T>;
358
- orderBy?: OrderBy<T>;
359
- top?: number;
360
- skip?: number;
361
- levels?: number | 'max';
362
- count?: boolean | Filter<T>;
363
- expand?: Expand<T>;
364
- };
365
- type Transform<T> = {
366
- aggregate?: AggregateType<T> | Array<AggregateType<T>>;
367
- filter?: Filter<T> | null;
368
- groupBy?: GroupByType<T>;
369
- };
370
- type GroupByType<T> = {
371
- properties: Array<LooseUnion<keyof T>>;
372
- transform?: Transform<T>;
373
- };
374
- declare const QueryCustomTypes: {
375
- readonly Raw: "Raw";
376
- readonly Alias: "Alias";
377
- readonly Duration: "Duration";
378
- readonly Binary: "Binary";
379
- };
380
- type QueryCustomTypes = ObjectValues<typeof QueryCustomTypes>;
381
- type QueryCustomType = {
382
- type: QueryCustomTypes;
383
- value: any;
384
- name?: string;
66
+ type QueryCustomTypes = ObjectValues<typeof QueryCustomTypes>;
67
+ type QueryCustomType = {
68
+ type: QueryCustomTypes;
69
+ value: any;
70
+ name?: string;
385
71
  };
386
72
  type Value = string | Date | number | boolean | QueryCustomType;
387
73
  declare const raw: (value: string) => QueryCustomType;
@@ -591,6 +277,9 @@ declare class GroupingOperators<T> {
591
277
  group(value: any): Grouping<T>;
592
278
  rollup(...values: any): Function<T>;
593
279
  }
280
+ declare class CastingOperators<T> {
281
+ cast<N>(left: T | string, type?: string): N;
282
+ }
594
283
  type AggregateMethod = 'sum' | 'min' | 'max' | 'average' | 'countdistinct';
595
284
  declare class Aggregate<T> implements Renderable {
596
285
  protected value: Renderable;
@@ -681,6 +370,29 @@ declare class Type<T> implements Renderable {
681
370
  clone(): Type<unknown>;
682
371
  resolve(parser: any): any;
683
372
  }
373
+ declare class Casting<T> implements Renderable {
374
+ protected type: string;
375
+ protected value?: any | undefined;
376
+ constructor(type: string, value?: any | undefined);
377
+ get [Symbol.toStringTag](): string;
378
+ toJson(): {
379
+ $type: string;
380
+ type: string;
381
+ value: any;
382
+ };
383
+ static fromJson<T>(json: {
384
+ [name: string]: any;
385
+ }): Casting<T>;
386
+ render({ aliases, escape, prefix, parser, options, }: {
387
+ aliases?: QueryCustomType[];
388
+ escape?: boolean;
389
+ prefix?: string;
390
+ parser?: Parser<T>;
391
+ options?: ParserOptions;
392
+ }): string;
393
+ clone(): Type<unknown>;
394
+ resolve(parser: any): any;
395
+ }
684
396
  declare class Lambda<T> implements Renderable {
685
397
  protected op: string;
686
398
  protected values: any[];
@@ -712,7 +424,7 @@ declare class LambdaOperators<T> {
712
424
  }
713
425
  declare class ODataOperators<T> {
714
426
  }
715
- interface ODataOperators<T> extends LogicalOperators<T>, ArithmeticOperators<T>, GroupingOperators<T>, LambdaOperators<T> {
427
+ interface ODataOperators<T> extends LogicalOperators<T>, ArithmeticOperators<T>, GroupingOperators<T>, CastingOperators<T>, LambdaOperators<T> {
716
428
  }
717
429
  declare const operators: ODataOperators<any>;
718
430
  declare class ODataFunctions<T> {
@@ -725,11 +437,6 @@ declare class ODataTransformations<T> {
725
437
  interface ODataTransformations<T> extends Transformations<T> {
726
438
  }
727
439
  declare const transformations: ODataTransformations<any>;
728
- declare class ODataSyntax<T> {
729
- }
730
- interface ODataSyntax<T> extends ODataOperators<T>, ODataFunctions<T>, ODataTransformations<T> {
731
- }
732
- declare const syntax: ODataSyntax<any>;
733
440
 
734
441
  declare abstract class Expression<T> implements Renderable {
735
442
  protected _children: Renderable[];
@@ -1122,6 +829,7 @@ declare class OrderByField implements Renderable {
1122
829
  type OrderByExpressionBuilder<T> = {
1123
830
  t: Required<T>;
1124
831
  e: () => OrderByExpression<T>;
832
+ o: ODataOperators<T>;
1125
833
  };
1126
834
  declare class OrderByExpression<T> extends Expression<T> {
1127
835
  constructor({ children, }?: {
@@ -1153,6 +861,7 @@ declare class OrderByExpression<T> extends Expression<T> {
1153
861
  type SelectExpressionBuilder<T> = {
1154
862
  t: Required<T>;
1155
863
  e: () => SelectExpression<T>;
864
+ o: ODataOperators<T>;
1156
865
  };
1157
866
  declare class SelectExpression<T> extends Expression<T> {
1158
867
  constructor({ children, }?: {
@@ -1215,6 +924,7 @@ declare class ExpandField<T> implements Renderable {
1215
924
  type ExpandExpressionBuilder<T> = {
1216
925
  t: Required<T>;
1217
926
  e: () => ExpandExpression<T>;
927
+ o: ODataOperators<T>;
1218
928
  };
1219
929
  declare class ExpandExpression<T> extends Expression<T> {
1220
930
  constructor({ children, }?: {
@@ -2151,6 +1861,7 @@ type ODataOptions = {
2151
1861
  reportProgress?: boolean;
2152
1862
  withCredentials?: boolean;
2153
1863
  fetchPolicy?: FetchPolicy;
1864
+ maxAge?: number;
2154
1865
  parserOptions?: ParserOptions;
2155
1866
  };
2156
1867
  type ODataEntityOptions = ODataOptions & {
@@ -3792,7 +3503,8 @@ declare class ODataRequest<T> {
3792
3503
  readonly reportProgress?: boolean;
3793
3504
  readonly withCredentials?: boolean;
3794
3505
  readonly bodyQueryOptions: QueryOption[];
3795
- readonly fetchPolicy: 'cache-first' | 'cache-and-network' | 'network-only' | 'no-cache' | 'cache-only';
3506
+ readonly fetchPolicy: FetchPolicy;
3507
+ readonly maxAge?: number;
3796
3508
  readonly resource: ODataResource<T>;
3797
3509
  private readonly _responseType?;
3798
3510
  private readonly _method;
@@ -3817,6 +3529,7 @@ declare class ODataRequest<T> {
3817
3529
  };
3818
3530
  responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
3819
3531
  fetchPolicy?: FetchPolicy;
3532
+ maxAge?: number;
3820
3533
  parserOptions?: ParserOptions;
3821
3534
  withCredentials?: boolean;
3822
3535
  bodyQueryOptions?: QueryOption[];
@@ -3945,10 +3658,6 @@ declare class ODataModel<T> {
3945
3658
  _annotations: ODataEntityAnnotations<T>;
3946
3659
  _meta: ODataModelOptions<T>;
3947
3660
  events$: ODataModelEventEmitter<T>;
3948
- static buildMetaOptions<T>({ config, structuredType, }: {
3949
- config?: ModelOptions;
3950
- structuredType: ODataStructuredType<T>;
3951
- }): ODataModelOptions<T>;
3952
3661
  constructor(data?: Partial<T> | {
3953
3662
  [name: string]: any;
3954
3663
  }, { parent, resource, annots, reset, }?: {
@@ -3956,10 +3665,21 @@ declare class ODataModel<T> {
3956
3665
  ODataModel<any> | ODataCollection<any, ODataModel<any>>,
3957
3666
  ODataModelField<any> | null
3958
3667
  ];
3959
- resource?: ODataResource<T> | null;
3668
+ resource?: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>;
3960
3669
  annots?: ODataEntityAnnotations<T>;
3961
3670
  reset?: boolean;
3962
3671
  });
3672
+ static factory<T>(data?: Partial<T> | {
3673
+ [name: string]: any;
3674
+ }, { parent, resource, annots, reset, }?: {
3675
+ parent?: [
3676
+ ODataModel<any> | ODataCollection<any, ODataModel<any>>,
3677
+ ODataModelField<any> | null
3678
+ ];
3679
+ resource?: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>;
3680
+ annots?: ODataEntityAnnotations<T>;
3681
+ reset?: boolean;
3682
+ }): ODataModel<T>;
3963
3683
  resource(): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | null;
3964
3684
  pushResource(resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | null): void;
3965
3685
  popResource(): {
@@ -4116,11 +3836,20 @@ declare class ODataCollection<T, M extends ODataModel<T>> implements Iterable<M>
4116
3836
  [name: string]: any;
4117
3837
  }[], { parent, resource, annots, model, reset, }?: {
4118
3838
  parent?: [ODataModel<any>, ODataModelField<any>];
4119
- resource?: ODataResource<T> | null;
3839
+ resource?: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>;
4120
3840
  annots?: ODataEntitiesAnnotations<T>;
4121
3841
  model?: typeof ODataModel;
4122
3842
  reset?: boolean;
4123
3843
  });
3844
+ static factory<T>(entities?: Partial<T>[] | {
3845
+ [name: string]: any;
3846
+ }[], { parent, resource, annots, model, reset, }?: {
3847
+ parent?: [ODataModel<any>, ODataModelField<any>];
3848
+ resource?: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>;
3849
+ annots?: ODataEntitiesAnnotations<T>;
3850
+ model?: typeof ODataModel;
3851
+ reset?: boolean;
3852
+ }): ODataCollection<T, ODataModel<T>>;
4124
3853
  isParentOf(child: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
4125
3854
  resource(): ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null;
4126
3855
  pushResource(resource: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null): void;
@@ -4435,267 +4164,36 @@ declare class ODataSchema extends ODataAnnotatable {
4435
4164
  }): void;
4436
4165
  }
4437
4166
 
4438
- type EntityKey<T> = {
4439
- readonly [P in keyof T]?: T[P];
4440
- } | QueryCustomType | string | number;
4441
- declare class ODataResource<T> {
4442
- api: ODataApi;
4443
- protected pathSegments: ODataPathSegments;
4444
- protected queryOptions: ODataQueryOptions<T>;
4445
- constructor(api: ODataApi, { segments, query, }?: {
4446
- segments?: ODataPathSegments;
4447
- query?: ODataQueryOptions<T>;
4448
- });
4449
- /**
4450
- * @returns string The outgoing type of the resource
4451
- */
4452
- outgoingType(): string | undefined;
4453
- /**
4454
- * @returns string The incoming type of the resource
4455
- */
4456
- incomingType(): string | undefined;
4457
- /**
4458
- * @returns string The binding type of the resource
4459
- */
4460
- bindingType(): string | undefined;
4461
- /**
4462
- * @returns string All covered types of the resource
4463
- */
4464
- types(): string[];
4465
- callable(): angular_odata.ODataCallable<any> | undefined;
4466
- enumType(): angular_odata.ODataEnumType<any> | angular_odata.ODataEnumType<T> | undefined;
4467
- structuredType(): ODataStructuredType<any> | ODataStructuredType<T> | undefined;
4468
- /**
4469
- * @returns boolean The resource has key ?
4470
- */
4471
- hasKey(): boolean;
4472
- hasEntityKey(): boolean;
4473
- clearKey(): void | undefined;
4474
- asModel(entity?: Partial<T> | {
4475
- [name: string]: any;
4476
- }): ODataModel<T> & ModelInterface<T>;
4477
- asModel(entity: Partial<T> | {
4478
- [name: string]: any;
4479
- }, { reset, annots, ModelType, }: {
4480
- reset?: boolean;
4481
- annots?: ODataEntityAnnotations<T>;
4482
- ModelType?: typeof ODataModel<any>;
4483
- }): ODataModel<T> & ModelInterface<T>;
4484
- asModel<M extends ODataModel<T>>(entity?: Partial<T> | {
4485
- [name: string]: any;
4486
- }): M;
4487
- asModel<M extends ODataModel<T>>(entity: Partial<T> | {
4488
- [name: string]: any;
4489
- }, { reset, annots, ModelType, }: {
4490
- reset?: boolean;
4491
- annots?: ODataEntityAnnotations<T>;
4492
- ModelType?: typeof ODataModel<any>;
4493
- }): M;
4494
- asCollection(entities?: Partial<T>[] | {
4495
- [name: string]: any;
4496
- }[]): ODataCollection<T, ODataModel<T> & ModelInterface<T>>;
4497
- asCollection(entities: Partial<T>[] | {
4498
- [name: string]: any;
4499
- }[], { reset, annots, CollectionType, }: {
4500
- reset?: boolean;
4501
- annots?: ODataEntitiesAnnotations<T>;
4502
- CollectionType?: typeof ODataCollection<any, ODataModel<any>>;
4503
- }): ODataCollection<T, ODataModel<T> & ModelInterface<T>>;
4504
- asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities?: Partial<T>[] | {
4505
- [name: string]: any;
4506
- }[]): C;
4507
- asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities: Partial<T>[] | {
4508
- [name: string]: any;
4509
- }[], { reset, annots, CollectionType, }: {
4510
- reset?: boolean;
4511
- annots?: ODataEntitiesAnnotations<T>;
4512
- CollectionType?: typeof ODataCollection<any, ODataModel<any>>;
4513
- }): C;
4514
- isTypeOf(other: ODataResource<any>): boolean;
4515
- isSubtypeOf(other: ODataResource<any>): boolean;
4516
- isSupertypeOf(other: ODataResource<any>): boolean;
4517
- isEqualTo(other: ODataResource<any>, test?: 'path' | 'params'): boolean;
4518
- pathAndParams({ escape, ...options }?: ParserOptions & {
4519
- escape?: boolean;
4520
- }): [string, {
4521
- [name: string]: any;
4522
- }];
4523
- endpointUrl({ escape, params, ...options }?: ParserOptions & {
4524
- escape?: boolean;
4525
- params?: boolean;
4526
- }): string;
4527
- toString({ escape, ...options }?: ParserOptions & {
4528
- escape?: boolean;
4529
- }): string;
4530
- clone(): ODataResource<T>;
4531
- private __parser;
4532
- deserialize(value: any, options?: ParserOptions): any;
4533
- serialize(value: any, options?: ParserOptions): any;
4534
- encode(value: any, options?: ParserOptions): any;
4535
- toJson(): {
4536
- segments: any[];
4537
- options: {};
4538
- };
4539
- cloneSegments(): ODataPathSegments;
4540
- clearQuery(): this;
4541
- cloneQuery<P>(): ODataQueryOptions<P>;
4542
- /**
4543
- * Handle the path segments of the resource
4544
- * Create an object handler for mutate the path segments of the resource
4545
- * @param f Function context for handle the segments
4546
- * @returns ODataActionResource
4547
- */
4548
- segment(f: (q: ODataPathSegmentsHandler<T>, s?: ODataStructuredType<T>) => void): this;
4549
- /**
4550
- * Handle the query options of the resource
4551
- * Create an object handler for mutate the query options of the resource
4552
- * @param f Function context for handle the query options
4553
- */
4554
- query(f: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): this;
4555
- transform<R>(opts: (builder: ApplyExpressionBuilder<T>, current?: ApplyExpression<T>) => ApplyExpression<T>, { type, fields, }?: {
4556
- type?: string;
4557
- fields?: {
4558
- [name: string]: ODataStructuredTypeFieldConfig;
4559
- };
4560
- }): ODataResource<R>;
4561
- static resolveKey<T>(value: any, schema?: ODataStructuredType<T>): EntityKey<T> | undefined;
4562
- protected resolveKey(value: any): EntityKey<T> | undefined;
4563
- protected get(options?: ODataOptions & {
4564
- etag?: string;
4565
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4566
- withCount?: boolean;
4567
- bodyQueryOptions?: QueryOption[];
4568
- }): Observable<any>;
4569
- protected post(body: any, options?: ODataOptions & {
4570
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4571
- withCount?: boolean;
4572
- }): Observable<any>;
4573
- protected put(body: any, options?: ODataOptions & {
4574
- etag?: string;
4575
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4576
- withCount?: boolean;
4577
- }): Observable<any>;
4578
- protected patch(body: any, options?: ODataOptions & {
4579
- etag?: string;
4580
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4581
- withCount?: boolean;
4582
- }): Observable<any>;
4583
- protected delete(options?: ODataOptions & {
4584
- etag?: string;
4585
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4586
- withCount?: boolean;
4587
- }): Observable<any>;
4588
- }
4589
-
4590
- declare class SegmentHandler {
4591
- private segment;
4592
- constructor(segment: ODataSegment);
4593
- get name(): PathSegment;
4594
- outgoingType(value?: string): string | undefined;
4595
- incomingType(value?: string): string | undefined;
4596
- bindingType(value?: string): string | undefined;
4597
- path(value?: string): string;
4598
- key<T>(value?: EntityKey<T>): EntityKey<T>;
4599
- hasKey(): boolean;
4600
- clearKey(): void;
4601
- parameters<T>(value?: T): T;
4602
- hasParameters(): boolean;
4603
- clearParameters(): void;
4604
- }
4605
- declare class ODataPathSegmentsHandler<T> {
4606
- protected segments: ODataPathSegments;
4607
- constructor(segments: ODataPathSegments);
4608
- entitySet(): SegmentHandler;
4609
- singleton(): SegmentHandler;
4610
- action(): SegmentHandler;
4611
- function(): SegmentHandler;
4612
- keys(values?: (EntityKey<T> | undefined)[]): (EntityKey<any> | undefined)[];
4613
- property(): SegmentHandler;
4614
- navigationProperty(): SegmentHandler;
4615
- }
4616
-
4617
- type ODataSegment = {
4618
- name: PathSegment;
4619
- path: string;
4620
- outgoingType?: string;
4621
- incomingType?: string;
4622
- bindingType?: string;
4623
- key?: any;
4624
- parameters?: any;
4625
- };
4626
- declare const pathAndParamsFromSegments: (segments: ODataSegment[], { escape, parser, options, }?: {
4627
- escape?: boolean;
4628
- parser?: Parser<any>;
4629
- options?: ParserOptions;
4630
- }) => [string, {
4631
- [name: string]: any;
4632
- }];
4633
- declare class ODataPathSegments {
4634
- private _segments;
4635
- constructor(segments?: ODataSegment[]);
4636
- pathAndParams({ escape, parser, options, }?: {
4637
- escape?: boolean;
4638
- parser?: Parser<any>;
4639
- options?: ParserOptions;
4640
- }): [string, {
4641
- [name: string]: any;
4642
- }];
4643
- types({ key }?: {
4644
- key?: boolean;
4645
- }): string[];
4646
- keys(values?: (EntityKey<any> | undefined)[]): (EntityKey<any> | undefined)[];
4647
- toString({ escape }?: {
4648
- escape?: boolean;
4649
- }): string;
4650
- toJson(): any[];
4651
- static fromJson(json: {
4652
- [name: string]: any;
4653
- }[]): ODataPathSegments;
4654
- clone(): ODataPathSegments;
4655
- find(predicate: (segment: ODataSegment) => boolean): ODataSegment | undefined;
4656
- segments({ key }?: {
4657
- key?: boolean;
4658
- }): SegmentHandler[];
4659
- first({ key }?: {
4660
- key?: boolean;
4661
- }): SegmentHandler | undefined;
4662
- last({ key }?: {
4663
- key?: boolean;
4664
- }): SegmentHandler | undefined;
4665
- add(name: string, path: string): SegmentHandler;
4666
- get(name: string): SegmentHandler;
4667
- }
4668
-
4669
- declare enum ODataModelEventType {
4670
- Change = "change",
4671
- Reset = "reset",
4672
- Update = "update",
4673
- Sort = "sort",
4674
- Destroy = "destroy",
4675
- Add = "add",
4676
- Remove = "remove",
4677
- Invalid = "invalid",
4678
- Request = "request",
4679
- Sync = "sync",
4680
- Attach = "attach"
4681
- }
4682
- declare class ODataModelEvent<T> {
4683
- type: ODataModelEventType | string;
4684
- value?: any;
4685
- previous?: any;
4686
- options?: any;
4687
- constructor(type: ODataModelEventType | string, { model, collection, previous, value, attr, options, bubbles, chain, }?: {
4688
- model?: ODataModel<T>;
4689
- collection?: ODataCollection<T, ODataModel<T>>;
4690
- attr?: ODataModelAttribute<any> | number;
4691
- previous?: any;
4692
- value?: any;
4693
- options?: any;
4694
- bubbles?: boolean;
4695
- chain?: [
4696
- ODataModel<any> | ODataCollection<any, ODataModel<any>>,
4697
- ODataModelAttribute<any> | number | null
4698
- ][];
4167
+ declare enum ODataModelEventType {
4168
+ Change = "change",
4169
+ Reset = "reset",
4170
+ Update = "update",
4171
+ Sort = "sort",
4172
+ Destroy = "destroy",
4173
+ Add = "add",
4174
+ Remove = "remove",
4175
+ Invalid = "invalid",
4176
+ Request = "request",
4177
+ Sync = "sync",
4178
+ Attach = "attach"
4179
+ }
4180
+ declare class ODataModelEvent<T> {
4181
+ type: ODataModelEventType | string;
4182
+ value?: any;
4183
+ previous?: any;
4184
+ options?: any;
4185
+ constructor(type: ODataModelEventType | string, { model, collection, previous, value, attr, options, bubbles, chain, }?: {
4186
+ model?: ODataModel<T>;
4187
+ collection?: ODataCollection<T, ODataModel<T>>;
4188
+ attr?: ODataModelAttribute<any> | number;
4189
+ previous?: any;
4190
+ value?: any;
4191
+ options?: any;
4192
+ bubbles?: boolean;
4193
+ chain?: [
4194
+ ODataModel<any> | ODataCollection<any, ODataModel<any>>,
4195
+ ODataModelAttribute<any> | number | null
4196
+ ][];
4699
4197
  });
4700
4198
  chain: [
4701
4199
  ODataModel<any> | ODataCollection<any, ODataModel<any>>,
@@ -4820,6 +4318,7 @@ declare class ODataModelField<F> {
4820
4318
  isStructuredType(): boolean;
4821
4319
  structuredType(): ODataStructuredType<F>;
4822
4320
  isEnumType(): boolean;
4321
+ isEdmType(): boolean;
4823
4322
  enumType(): ODataEnumType<F>;
4824
4323
  validate(value: any, { method, navigation, }?: {
4825
4324
  method?: 'create' | 'update' | 'modify';
@@ -4863,6 +4362,7 @@ declare class ODataModelAttribute<T> {
4863
4362
  get options(): ODataModelOptions<any>;
4864
4363
  get name(): string;
4865
4364
  get fieldName(): string;
4365
+ isStructuredType(): boolean;
4866
4366
  get(): T | ODataModel<T> | ODataCollection<T, ODataModel<T>> | null | undefined;
4867
4367
  set(value: T | ODataModel<T> | ODataCollection<T, ODataModel<T>> | null | undefined, reset?: boolean, reparent?: boolean): boolean;
4868
4368
  isChanged({ include_navigation }?: {
@@ -4881,6 +4381,7 @@ type ODataModelEntry<T, M extends ODataModel<T>> = {
4881
4381
  subscription?: Subscription;
4882
4382
  };
4883
4383
  declare class ODataModelOptions<T> {
4384
+ pool: Map<string, ODataModel<any>>;
4884
4385
  name: string;
4885
4386
  cid: string;
4886
4387
  base?: string;
@@ -4894,12 +4395,32 @@ declare class ODataModelOptions<T> {
4894
4395
  config: ModelOptions;
4895
4396
  structuredType: ODataStructuredType<T>;
4896
4397
  });
4897
- get api(): angular_odata.ODataApi;
4898
- type({ alias }?: {
4899
- alias?: boolean;
4900
- }): string;
4901
- isOpenType(): boolean;
4902
- isEntityType(): boolean;
4398
+ modelFactory<T>(Model: typeof ODataModel<T>, data?: Partial<T> | {
4399
+ [name: string]: any;
4400
+ }, { parent, resource, annots, reset, }?: {
4401
+ parent?: [
4402
+ ODataModel<any> | ODataCollection<any, ODataModel<any>>,
4403
+ ODataModelField<any> | null
4404
+ ];
4405
+ resource?: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>;
4406
+ annots?: ODataEntityAnnotations<T>;
4407
+ reset?: boolean;
4408
+ }): ODataModel<T>;
4409
+ collectionFactory<T>(Collection: typeof ODataCollection<T, ODataModel<T>>, entities?: Partial<T>[] | {
4410
+ [name: string]: any;
4411
+ }[], { parent, resource, annots, model, reset, }?: {
4412
+ parent?: [ODataModel<any>, ODataModelField<any>];
4413
+ resource?: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T>;
4414
+ annots?: ODataEntitiesAnnotations<T>;
4415
+ model?: typeof ODataModel;
4416
+ reset?: boolean;
4417
+ }): ODataCollection<T, ODataModel<T>>;
4418
+ get api(): angular_odata.ODataApi;
4419
+ type({ alias }?: {
4420
+ alias?: boolean;
4421
+ }): string;
4422
+ isOpenType(): boolean;
4423
+ isEntityType(): boolean;
4903
4424
  isComplexType(): boolean;
4904
4425
  isTypeOf(type: string): boolean;
4905
4426
  toJsonSchema(options?: JsonSchemaOptions<T>): json_schema.JSONSchema7;
@@ -5030,132 +4551,707 @@ declare class ODataModelOptions<T> {
5030
4551
  declare class ODataApi {
5031
4552
  requester?: (request: ODataRequest<any>) => Observable<any>;
5032
4553
  serviceRootUrl: string;
5033
- metadataUrl: string;
4554
+ metadataUrl: string;
4555
+ name?: string;
4556
+ version: ODataVersion;
4557
+ default: boolean;
4558
+ creation: Date;
4559
+ options: ODataApiOptions;
4560
+ cache?: ODataCache;
4561
+ errorHandler?: (error: any, caught: Observable<any>) => Observable<never>;
4562
+ parsers: Map<string, Parser<any>>;
4563
+ schemas: ODataSchema[];
4564
+ models: {
4565
+ [type: string]: typeof ODataModel<any>;
4566
+ };
4567
+ collections: {
4568
+ [type: string]: typeof ODataCollection<any, ODataModel<any>>;
4569
+ };
4570
+ constructor(config: ODataApiConfig);
4571
+ configure(settings?: {
4572
+ requester?: (request: ODataRequest<any>) => Observable<any>;
4573
+ }): void;
4574
+ populate(metadata: ODataMetadata): void;
4575
+ fromJson<P, R>(json: {
4576
+ segments: ODataSegment[];
4577
+ options: {
4578
+ [name: string]: any;
4579
+ };
4580
+ }): ODataActionResource<P, R> | ODataFunctionResource<P, R>;
4581
+ fromJson<E>(json: {
4582
+ segments: ODataSegment[];
4583
+ options: {
4584
+ [name: string]: any;
4585
+ };
4586
+ }): ODataEntityResource<E> | ODataEntitySetResource<E> | ODataNavigationPropertyResource<E> | ODataSingletonResource<E>;
4587
+ /**
4588
+ * Build a metadata resource.
4589
+ * @returns ODataMetadataResource
4590
+ */
4591
+ metadata(): ODataMetadataResource;
4592
+ /**
4593
+ * Build a batch resource.
4594
+ * @returns ODataBatchResource
4595
+ */
4596
+ batch(): ODataBatchResource;
4597
+ /**
4598
+ * Build a singleton resource.
4599
+ * @param path Name of the singleton
4600
+ * @returns
4601
+ */
4602
+ singleton<T>(name: string): ODataSingletonResource<T>;
4603
+ /**
4604
+ * Build an entity set resource.
4605
+ * @param path Name of the entity set
4606
+ * @returns
4607
+ */
4608
+ entitySet<T>(name: string): ODataEntitySetResource<T>;
4609
+ /**
4610
+ * Unbound Action
4611
+ * @param {string} path?
4612
+ * @returns ODataActionResource
4613
+ */
4614
+ action<P, R>(path: string): ODataActionResource<P, R>;
4615
+ /**
4616
+ * Unbound Function
4617
+ * @param {string} path?
4618
+ * @returns ODataFunctionResource
4619
+ */
4620
+ function<P, R>(path: string): ODataFunctionResource<P, R>;
4621
+ callable<T>(type: string): ODataCallable<any> | undefined;
4622
+ enumType<T>(type: string): ODataEnumType<any> | ODataEnumType<T> | undefined;
4623
+ structuredType<T>(type: string): ODataStructuredType<any> | ODataStructuredType<T> | undefined;
4624
+ request<T>(method: string, resource: ODataResource<any>, options: ODataOptions & {
4625
+ body?: any;
4626
+ etag?: string;
4627
+ responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4628
+ observe?: 'body' | 'events' | 'response';
4629
+ withCount?: boolean;
4630
+ bodyQueryOptions?: QueryOption[];
4631
+ }): Observable<any>;
4632
+ /**
4633
+ * Using the request, handle the fetching of the response
4634
+ * @param req The request to fetch
4635
+ * @param res$ Observable of the response
4636
+ * @returns
4637
+ */
4638
+ private handleRequest;
4639
+ private handleFetch;
4640
+ private handleMutate;
4641
+ private memo;
4642
+ createSchema(config: ODataSchemaConfig): ODataSchema;
4643
+ findSchema(type: string): ODataSchema | undefined;
4644
+ findEnumType<T>(value: string): ODataEnumType<any> | ODataEnumType<T> | undefined;
4645
+ findStructuredType<T>(value: string): ODataStructuredType<any> | ODataStructuredType<T> | undefined;
4646
+ findCallable<R>(value: string, bindingType?: string): ODataCallable<any> | undefined;
4647
+ findEntitySet(value: string): ODataEntitySet | undefined;
4648
+ findSingleton(value: string): ODataSingleton | undefined;
4649
+ configureModel<T>(structured: ODataStructuredType<T>, model: typeof ODataModel<T>): void;
4650
+ findModel<T>(type: string): typeof ODataModel<T> | undefined;
4651
+ createModel<T>(structured: ODataStructuredType<T>): typeof ODataModel<any> | typeof ODataModel<T>;
4652
+ modelForType<T>(type: string): {
4653
+ new (data?: {
4654
+ [name: string]: any;
4655
+ } | Partial<T>, { parent, resource, annots, reset, }?: {
4656
+ parent?: [ODataModel<any> | ODataCollection<any, ODataModel<any>>, ODataModelField<any> | null];
4657
+ resource?: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | undefined;
4658
+ annots?: ODataEntityAnnotations<T> | undefined;
4659
+ reset?: boolean;
4660
+ }): ODataModel<T>;
4661
+ options: ModelOptions;
4662
+ meta: ODataModelOptions<any>;
4663
+ factory<T_1>(data?: Partial<T_1> | {
4664
+ [name: string]: any;
4665
+ }, { parent, resource, annots, reset, }?: {
4666
+ parent?: [ODataModel<any> | ODataCollection<any, ODataModel<any>>, ODataModelField<any> | null];
4667
+ resource?: ODataEntityResource<T_1> | ODataNavigationPropertyResource<T_1> | ODataPropertyResource<T_1> | ODataSingletonResource<T_1>;
4668
+ annots?: ODataEntityAnnotations<T_1>;
4669
+ reset?: boolean;
4670
+ }): ODataModel<T_1>;
4671
+ };
4672
+ findCollection<T>(type: string): typeof ODataCollection<T, ODataModel<T>> | undefined;
4673
+ createCollection<T>(structured: ODataStructuredType<T>, model?: typeof ODataModel<T>): typeof ODataCollection<any, ODataModel<any>> | typeof ODataCollection<T, ODataModel<T>>;
4674
+ collectionForType<T>(type: string): {
4675
+ new (entities?: {
4676
+ [name: string]: any;
4677
+ }[] | Partial<T>[], { parent, resource, annots, model, reset, }?: {
4678
+ parent?: [ODataModel<any>, ODataModelField<any>];
4679
+ resource?: ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | undefined;
4680
+ annots?: angular_odata.ODataEntitiesAnnotations<T> | undefined;
4681
+ model?: typeof ODataModel;
4682
+ reset?: boolean;
4683
+ }): ODataCollection<T, ODataModel<T>>;
4684
+ model: typeof ODataModel<any> | null;
4685
+ factory<T_1>(entities?: Partial<T_1>[] | {
4686
+ [name: string]: any;
4687
+ }[], { parent, resource, annots, model, reset, }?: {
4688
+ parent?: [ODataModel<any>, ODataModelField<any>];
4689
+ resource?: ODataEntitySetResource<T_1> | ODataNavigationPropertyResource<T_1> | ODataPropertyResource<T_1>;
4690
+ annots?: angular_odata.ODataEntitiesAnnotations<T_1>;
4691
+ model?: typeof ODataModel;
4692
+ reset?: boolean;
4693
+ }): ODataCollection<T_1, ODataModel<T_1>>;
4694
+ };
4695
+ findEntitySetForEntityType(entityType: string): ODataEntitySet | undefined;
4696
+ parserForType<T>(type: string | EdmType, bindingType?: string): Parser<T>;
4697
+ optionsForType<T>(type: string, { structuredType, config, }?: {
4698
+ structuredType?: ODataStructuredType<T>;
4699
+ config?: ModelOptions;
4700
+ }): ODataModelOptions<T> | undefined;
4701
+ }
4702
+
4703
+ type EntityKey<T> = {
4704
+ readonly [P in keyof T]?: T[P];
4705
+ } | QueryCustomType | string | number;
4706
+ declare class ODataResource<T> {
4707
+ api: ODataApi;
4708
+ protected pathSegments: ODataPathSegments;
4709
+ protected queryOptions: ODataQueryOptions<T>;
4710
+ constructor(api: ODataApi, { segments, query, }?: {
4711
+ segments?: ODataPathSegments;
4712
+ query?: ODataQueryOptions<T>;
4713
+ });
4714
+ /**
4715
+ * @returns string The outgoing type of the resource
4716
+ */
4717
+ outgoingType(): string | undefined;
4718
+ /**
4719
+ * @returns string The incoming type of the resource
4720
+ */
4721
+ incomingType(): string | undefined;
4722
+ /**
4723
+ * @returns string The binding type of the resource
4724
+ */
4725
+ bindingType(): string | undefined;
4726
+ /**
4727
+ * @returns string All covered types of the resource
4728
+ */
4729
+ types(): string[];
4730
+ callable(): angular_odata.ODataCallable<any> | undefined;
4731
+ enumType(): angular_odata.ODataEnumType<any> | angular_odata.ODataEnumType<T> | undefined;
4732
+ structuredType(): ODataStructuredType<any> | ODataStructuredType<T> | undefined;
4733
+ /**
4734
+ * @returns boolean The resource has key ?
4735
+ */
4736
+ hasKey(): boolean;
4737
+ hasEntityKey(): boolean;
4738
+ clearKey(): void | undefined;
4739
+ asModel(entity?: Partial<T> | {
4740
+ [name: string]: any;
4741
+ }): ODataModel<T> & ModelInterface<T>;
4742
+ asModel(entity: Partial<T> | {
4743
+ [name: string]: any;
4744
+ }, { reset, annots, ModelType, }: {
4745
+ reset?: boolean;
4746
+ annots?: ODataEntityAnnotations<T>;
4747
+ ModelType?: typeof ODataModel<any>;
4748
+ }): ODataModel<T> & ModelInterface<T>;
4749
+ asModel<M extends ODataModel<T>>(entity?: Partial<T> | {
4750
+ [name: string]: any;
4751
+ }): M;
4752
+ asModel<M extends ODataModel<T>>(entity: Partial<T> | {
4753
+ [name: string]: any;
4754
+ }, { reset, annots, ModelType, }: {
4755
+ reset?: boolean;
4756
+ annots?: ODataEntityAnnotations<T>;
4757
+ ModelType?: typeof ODataModel<any>;
4758
+ }): M;
4759
+ asCollection(entities?: Partial<T>[] | {
4760
+ [name: string]: any;
4761
+ }[]): ODataCollection<T, ODataModel<T> & ModelInterface<T>>;
4762
+ asCollection(entities: Partial<T>[] | {
4763
+ [name: string]: any;
4764
+ }[], { reset, annots, CollectionType, }: {
4765
+ reset?: boolean;
4766
+ annots?: ODataEntitiesAnnotations<T>;
4767
+ CollectionType?: typeof ODataCollection<any, ODataModel<any>>;
4768
+ }): ODataCollection<T, ODataModel<T> & ModelInterface<T>>;
4769
+ asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities?: Partial<T>[] | {
4770
+ [name: string]: any;
4771
+ }[]): C;
4772
+ asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities: Partial<T>[] | {
4773
+ [name: string]: any;
4774
+ }[], { reset, annots, CollectionType, }: {
4775
+ reset?: boolean;
4776
+ annots?: ODataEntitiesAnnotations<T>;
4777
+ CollectionType?: typeof ODataCollection<any, ODataModel<any>>;
4778
+ }): C;
4779
+ isTypeOf(other: ODataResource<any>): boolean;
4780
+ isSubtypeOf(other: ODataResource<any>): boolean;
4781
+ isSupertypeOf(other: ODataResource<any>): boolean;
4782
+ isEqualTo(other: ODataResource<any>, test?: 'path' | 'params'): boolean;
4783
+ pathAndParams({ escape, ...options }?: ParserOptions & {
4784
+ escape?: boolean;
4785
+ }): [string, {
4786
+ [name: string]: any;
4787
+ }];
4788
+ endpointUrl({ escape, params, ...options }?: ParserOptions & {
4789
+ escape?: boolean;
4790
+ params?: boolean;
4791
+ }): string;
4792
+ toString({ escape, ...options }?: ParserOptions & {
4793
+ escape?: boolean;
4794
+ }): string;
4795
+ clone(): ODataResource<T>;
4796
+ private __parser;
4797
+ deserialize(value: any, options?: ParserOptions): any;
4798
+ serialize(value: any, options?: ParserOptions): any;
4799
+ encode(value: any, options?: ParserOptions): any;
4800
+ toJson(): {
4801
+ segments: any[];
4802
+ options: {};
4803
+ };
4804
+ cloneSegments(): ODataPathSegments;
4805
+ clearQuery(): this;
4806
+ cloneQuery<P>(): ODataQueryOptions<P>;
4807
+ /**
4808
+ * Handle the path segments of the resource
4809
+ * Create an object handler for mutate the path segments of the resource
4810
+ * @param f Function context for handle the segments
4811
+ * @returns ODataActionResource
4812
+ */
4813
+ segment(f: (q: ODataPathSegmentsHandler<T>, s?: ODataStructuredType<T>) => void): this;
4814
+ /**
4815
+ * Handle the query options of the resource
4816
+ * Create an object handler for mutate the query options of the resource
4817
+ * @param f Function context for handle the query options
4818
+ */
4819
+ query(f: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): this;
4820
+ transform<R>(opts: (builder: ApplyExpressionBuilder<T>, current?: ApplyExpression<T>) => ApplyExpression<T>, { type, fields, }?: {
4821
+ type?: string;
4822
+ fields?: {
4823
+ [name: string]: ODataStructuredTypeFieldConfig;
4824
+ };
4825
+ }): ODataResource<R>;
4826
+ static resolveKey<T>(value: any, schema?: ODataStructuredType<T>): EntityKey<T> | undefined;
4827
+ protected resolveKey(value: any): EntityKey<T> | undefined;
4828
+ protected get(options?: ODataOptions & {
4829
+ etag?: string;
4830
+ responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4831
+ withCount?: boolean;
4832
+ bodyQueryOptions?: QueryOption[];
4833
+ }): Observable<any>;
4834
+ protected post(body: any, options?: ODataOptions & {
4835
+ responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4836
+ withCount?: boolean;
4837
+ }): Observable<any>;
4838
+ protected put(body: any, options?: ODataOptions & {
4839
+ etag?: string;
4840
+ responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4841
+ withCount?: boolean;
4842
+ }): Observable<any>;
4843
+ protected patch(body: any, options?: ODataOptions & {
4844
+ etag?: string;
4845
+ responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4846
+ withCount?: boolean;
4847
+ }): Observable<any>;
4848
+ protected delete(options?: ODataOptions & {
4849
+ etag?: string;
4850
+ responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
4851
+ withCount?: boolean;
4852
+ }): Observable<any>;
4853
+ }
4854
+
4855
+ declare class SegmentHandler {
4856
+ private segment;
4857
+ constructor(segment: ODataSegment);
4858
+ get name(): PathSegment;
4859
+ outgoingType(value?: string): string | undefined;
4860
+ incomingType(value?: string): string | undefined;
4861
+ bindingType(value?: string): string | undefined;
4862
+ path(value?: string): string;
4863
+ key<T>(value?: EntityKey<T>): EntityKey<T>;
4864
+ hasKey(): boolean;
4865
+ clearKey(): void;
4866
+ parameters<T>(value?: T): T;
4867
+ hasParameters(): boolean;
4868
+ clearParameters(): void;
4869
+ }
4870
+ declare class ODataPathSegmentsHandler<T> {
4871
+ protected segments: ODataPathSegments;
4872
+ constructor(segments: ODataPathSegments);
4873
+ entitySet(): SegmentHandler;
4874
+ singleton(): SegmentHandler;
4875
+ action(): SegmentHandler;
4876
+ function(): SegmentHandler;
4877
+ keys(values?: (EntityKey<T> | undefined)[]): (EntityKey<any> | undefined)[];
4878
+ property(): SegmentHandler;
4879
+ navigationProperty(): SegmentHandler;
4880
+ }
4881
+
4882
+ type ODataSegment = {
4883
+ name: PathSegment;
4884
+ path: string;
4885
+ outgoingType?: string;
4886
+ incomingType?: string;
4887
+ bindingType?: string;
4888
+ key?: any;
4889
+ parameters?: any;
4890
+ };
4891
+ declare const pathAndParamsFromSegments: (segments: ODataSegment[], { escape, parser, options, }?: {
4892
+ escape?: boolean;
4893
+ parser?: Parser<any>;
4894
+ options?: ParserOptions;
4895
+ }) => [string, {
4896
+ [name: string]: any;
4897
+ }];
4898
+ declare class ODataPathSegments {
4899
+ private _segments;
4900
+ constructor(segments?: ODataSegment[]);
4901
+ pathAndParams({ escape, parser, options, }?: {
4902
+ escape?: boolean;
4903
+ parser?: Parser<any>;
4904
+ options?: ParserOptions;
4905
+ }): [string, {
4906
+ [name: string]: any;
4907
+ }];
4908
+ types({ key }?: {
4909
+ key?: boolean;
4910
+ }): string[];
4911
+ keys(values?: (EntityKey<any> | undefined)[]): (EntityKey<any> | undefined)[];
4912
+ toString({ escape }?: {
4913
+ escape?: boolean;
4914
+ }): string;
4915
+ toJson(): any[];
4916
+ static fromJson(json: {
4917
+ [name: string]: any;
4918
+ }[]): ODataPathSegments;
4919
+ clone(): ODataPathSegments;
4920
+ find(predicate: (segment: ODataSegment) => boolean): ODataSegment | undefined;
4921
+ segments({ key }?: {
4922
+ key?: boolean;
4923
+ }): SegmentHandler[];
4924
+ first({ key }?: {
4925
+ key?: boolean;
4926
+ }): SegmentHandler | undefined;
4927
+ last({ key }?: {
4928
+ key?: boolean;
4929
+ }): SegmentHandler | undefined;
4930
+ add(name: string, path: string): SegmentHandler;
4931
+ get(name: string): SegmentHandler;
4932
+ }
4933
+
4934
+ type ODataVersion = '2.0' | '3.0' | '4.0';
4935
+ type FetchPolicy = 'cache-first' | 'cache-and-network' | 'network-only' | 'no-cache' | 'cache-only';
4936
+ type ODataMetadataType = 'minimal' | 'full' | 'none';
4937
+ type CacheCacheability = 'public' | 'private' | 'no-cache' | 'no-store';
4938
+ declare enum PathSegment {
4939
+ batch = "batch",
4940
+ metadata = "metadata",
4941
+ entitySet = "entitySet",
4942
+ singleton = "singleton",
4943
+ type = "type",
4944
+ property = "property",
4945
+ navigationProperty = "navigationProperty",
4946
+ reference = "reference",
4947
+ value = "value",
4948
+ count = "count",
4949
+ function = "function",
4950
+ action = "action"
4951
+ }
4952
+ declare enum QueryOption {
4953
+ select = "select",
4954
+ expand = "expand",
4955
+ compute = "compute",
4956
+ apply = "apply",
4957
+ filter = "filter",
4958
+ search = "search",
4959
+ transform = "transform",
4960
+ orderBy = "orderBy",
4961
+ top = "top",
4962
+ skip = "skip",
4963
+ skiptoken = "skiptoken",
4964
+ format = "format",
4965
+ levels = "levels",
4966
+ count = "count"
4967
+ }
4968
+ declare enum EdmType {
4969
+ Guid = "Edm.Guid",
4970
+ Int16 = "Edm.Int16",
4971
+ String = "Edm.String",
4972
+ Boolean = "Edm.Boolean",
4973
+ Byte = "Edm.Byte",
4974
+ SByte = "Edm.SByte",
4975
+ Int32 = "Edm.Int32",
4976
+ Int64 = "Edm.Int64",
4977
+ Date = "Edm.Date",
4978
+ TimeOfDay = "Edm.TimeOfDay",
4979
+ DateTimeOffset = "Edm.DateTimeOffset",
4980
+ Duration = "Edm.Duration",
4981
+ Decimal = "Edm.Decimal",
4982
+ Double = "Edm.Double",
4983
+ Single = "Edm.Single",
4984
+ Binary = "Edm.Binary",
4985
+ Stream = "Edm.Stream",
4986
+ Geography = "Edm.Geography",
4987
+ GeographyPoint = "Edm.GeographyPoint",
4988
+ GeographyLineString = "Edm.GeographyLineString",
4989
+ GeographyPolygon = "Edm.GeographyPolygon",
4990
+ GeographyMultiPoint = "Edm.GeographyMultiPoint",
4991
+ GeographyMultiLineString = "Edm.GeographyMultiLineString",
4992
+ GeographyMultiPolygon = "Edm.GeographyMultiPolygon",
4993
+ GeographyCollection = "Edm.GeographyCollection",
4994
+ Geometry = "Edm.Geometry",
4995
+ GeometryPoint = "Edm.GeometryPoint",
4996
+ GeometryLineString = "Edm.GeometryLineString",
4997
+ GeometryPolygon = "Edm.GeometryPolygon",
4998
+ GeometryMultiPoint = "Edm.GeometryMultiPoint",
4999
+ GeometryMultiLineString = "Edm.GeometryMultiLineString",
5000
+ GeometryMultiPolygon = "Edm.GeometryMultiPolygon",
5001
+ GeometryCollection = "Edm.GeometryCollection"
5002
+ }
5003
+ declare enum JsonSchemaType {
5004
+ string = "string",
5005
+ number = "number",
5006
+ integer = "integer",
5007
+ object = "object",
5008
+ array = "array",
5009
+ boolean = "boolean",
5010
+ null = "null"
5011
+ }
5012
+ type JsonSchemaSelect<T> = Array<keyof T>;
5013
+ type JsonSchemaCustom<T> = {
5014
+ [P in keyof T]?: (schema: JSONSchema7, field: FieldParser<T[P]>) => JSONSchema7;
5015
+ };
5016
+ type JsonSchemaExpand<T> = {
5017
+ [P in keyof T]?: JsonSchemaFieldOptions<T[P]>;
5018
+ };
5019
+ type JsonSchemaRequired<T> = {
5020
+ [P in keyof T]?: boolean;
5021
+ };
5022
+ type JsonSchemaFieldOptions<T> = {
5023
+ select?: JsonSchemaSelect<T>;
5024
+ custom?: JsonSchemaCustom<T>;
5025
+ expand?: JsonSchemaExpand<T>;
5026
+ required?: JsonSchemaRequired<T>;
5027
+ };
5028
+ type JsonSchemaOptions<T> = JsonSchemaFieldOptions<T> & {
5029
+ map?: (field: FieldParser<T>, schema: JSONSchema7, parent?: JSONSchema7) => JSONSchema7;
5030
+ };
5031
+ interface ParserOptions {
5032
+ version?: ODataVersion;
5033
+ exponentialDecimals?: boolean;
5034
+ metadata?: ODataMetadataType;
5035
+ ieee754Compatible?: boolean;
5036
+ streaming?: boolean;
5037
+ stringAsEnum?: boolean;
5038
+ deleteRefBy?: 'path' | 'id';
5039
+ nonParenthesisForEmptyParameterFunction?: boolean;
5040
+ }
5041
+ interface ResponseOptions extends ParserOptions {
5042
+ cacheability?: CacheCacheability;
5043
+ maxAge?: number;
5044
+ }
5045
+ interface StructuredTypeFieldOptions extends ParserOptions {
5046
+ field: ODataStructuredTypeFieldConfig;
5047
+ }
5048
+ interface Parser<T> {
5049
+ deserialize(value: any, options?: ParserOptions | StructuredTypeFieldOptions): T | T[];
5050
+ serialize(value: T, options?: ParserOptions | StructuredTypeFieldOptions): any;
5051
+ encode(value: T, options?: ParserOptions | StructuredTypeFieldOptions): any;
5052
+ }
5053
+ interface FieldParser<T> extends Parser<T> {
5054
+ nullable?: boolean;
5055
+ default?: any;
5056
+ maxLength?: number;
5057
+ precision?: number;
5058
+ scale?: number | 'variable';
5059
+ }
5060
+ declare const NONE_PARSER: Parser<any>;
5061
+ interface ODataCache {
5062
+ put<T>(key: string, payload: T, ...opts: any[]): void;
5063
+ get<T>(key: string, ...opts: any[]): T | undefined;
5064
+ getResponse(req: ODataRequest<any>): ODataResponse<any> | undefined;
5065
+ putResponse(req: ODataRequest<any>, res: ODataResponse<any>): void;
5066
+ flush(): void;
5067
+ forget({ name, scope, tags }: {
5068
+ name?: string;
5069
+ scope?: string[];
5070
+ tags?: string[];
5071
+ }): void;
5072
+ scope(obj: ODataRequest<any>): string[];
5073
+ tags(obj: ODataResponse<any>): string[];
5074
+ }
5075
+ interface ODataApiConfigOptions {
5076
+ version?: ODataVersion;
5077
+ params?: {
5078
+ [param: string]: string | string[];
5079
+ };
5080
+ headers?: {
5081
+ [param: string]: string | string[];
5082
+ };
5083
+ withCredentials?: boolean;
5084
+ accept?: {
5085
+ exponentialDecimals?: boolean;
5086
+ metadata?: ODataMetadataType;
5087
+ ieee754Compatible?: boolean;
5088
+ streaming?: boolean;
5089
+ };
5090
+ etag?: {
5091
+ ifMatch?: boolean;
5092
+ ifNoneMatch?: boolean;
5093
+ };
5094
+ prefer?: {
5095
+ maxPageSize?: number;
5096
+ return?: 'representation' | 'minimal';
5097
+ continueOnError?: boolean;
5098
+ includeAnnotations?: string;
5099
+ };
5100
+ stripMetadata?: ODataMetadataType;
5101
+ fetchPolicy?: FetchPolicy;
5102
+ bodyQueryOptions?: QueryOption[];
5103
+ stringAsEnum?: boolean;
5104
+ deleteRefBy?: 'path' | 'id';
5105
+ nonParenthesisForEmptyParameterFunction?: boolean;
5106
+ jsonBatchFormat?: boolean;
5107
+ relativeUrls?: boolean;
5108
+ }
5109
+ type ODataApiConfig = {
5110
+ serviceRootUrl: string;
5111
+ metadataUrl?: string;
5034
5112
  name?: string;
5035
- version: ODataVersion;
5036
- default: boolean;
5037
- creation: Date;
5038
- options: ODataApiOptions;
5113
+ version?: ODataVersion;
5114
+ default?: boolean;
5115
+ creation?: Date;
5039
5116
  cache?: ODataCache;
5040
5117
  errorHandler?: (error: any, caught: Observable<any>) => Observable<never>;
5041
- parsers: Map<string, Parser<any>>;
5042
- schemas: ODataSchema[];
5043
- models: {
5044
- [type: string]: typeof ODataModel<any>;
5045
- };
5046
- collections: {
5047
- [type: string]: typeof ODataCollection<any, ODataModel<any>>;
5118
+ options?: ODataApiConfigOptions;
5119
+ parsers?: {
5120
+ [type: string]: Parser<any>;
5048
5121
  };
5049
- constructor(config: ODataApiConfig);
5050
- configure(settings?: {
5051
- requester?: (request: ODataRequest<any>) => Observable<any>;
5052
- }): void;
5053
- populate(metadata: ODataMetadata): void;
5054
- fromJson<P, R>(json: {
5055
- segments: ODataSegment[];
5056
- options: {
5057
- [name: string]: any;
5122
+ schemas?: ODataSchemaConfig[];
5123
+ references?: ODataReferenceConfig[];
5124
+ models?: {
5125
+ [type: string]: {
5126
+ new (...params: any[]): any;
5058
5127
  };
5059
- }): ODataActionResource<P, R> | ODataFunctionResource<P, R>;
5060
- fromJson<E>(json: {
5061
- segments: ODataSegment[];
5062
- options: {
5063
- [name: string]: any;
5128
+ };
5129
+ collections?: {
5130
+ [type: string]: {
5131
+ new (...params: any[]): any;
5064
5132
  };
5065
- }): ODataEntityResource<E> | ODataEntitySetResource<E> | ODataNavigationPropertyResource<E> | ODataSingletonResource<E>;
5066
- /**
5067
- * Build a metadata resource.
5068
- * @returns ODataMetadataResource
5069
- */
5070
- metadata(): ODataMetadataResource;
5071
- /**
5072
- * Build a batch resource.
5073
- * @returns ODataBatchResource
5074
- */
5075
- batch(): ODataBatchResource;
5076
- /**
5077
- * Build a singleton resource.
5078
- * @param path Name of the singleton
5079
- * @returns
5080
- */
5081
- singleton<T>(name: string): ODataSingletonResource<T>;
5082
- /**
5083
- * Build an entity set resource.
5084
- * @param path Name of the entity set
5085
- * @returns
5086
- */
5087
- entitySet<T>(name: string): ODataEntitySetResource<T>;
5088
- /**
5089
- * Unbound Action
5090
- * @param {string} path?
5091
- * @returns ODataActionResource
5092
- */
5093
- action<P, R>(path: string): ODataActionResource<P, R>;
5094
- /**
5095
- * Unbound Function
5096
- * @param {string} path?
5097
- * @returns ODataFunctionResource
5098
- */
5099
- function<P, R>(path: string): ODataFunctionResource<P, R>;
5100
- callable<T>(type: string): ODataCallable<any> | undefined;
5101
- enumType<T>(type: string): ODataEnumType<any> | ODataEnumType<T> | undefined;
5102
- structuredType<T>(type: string): ODataStructuredType<any> | ODataStructuredType<T> | undefined;
5103
- request<T>(method: string, resource: ODataResource<any>, options: ODataOptions & {
5104
- body?: any;
5105
- etag?: string;
5106
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
5107
- observe?: 'body' | 'events' | 'response';
5108
- withCount?: boolean;
5109
- bodyQueryOptions?: QueryOption[];
5110
- }): Observable<any>;
5111
- private memo;
5112
- createSchema(config: ODataSchemaConfig): ODataSchema;
5113
- findSchema(type: string): ODataSchema | undefined;
5114
- findEnumType<T>(value: string): ODataEnumType<any> | ODataEnumType<T> | undefined;
5115
- findStructuredType<T>(value: string): ODataStructuredType<any> | ODataStructuredType<T> | undefined;
5116
- findCallable<R>(value: string, bindingType?: string): ODataCallable<any> | undefined;
5117
- findEntitySet(value: string): ODataEntitySet | undefined;
5118
- findSingleton(value: string): ODataSingleton | undefined;
5119
- configureModel<T>(structured: ODataStructuredType<T>, model: typeof ODataModel<T>): void;
5120
- findModel<T>(type: string): typeof ODataModel<T> | undefined;
5121
- createModel<T>(structured: ODataStructuredType<T>): typeof ODataModel<any> | typeof ODataModel<T>;
5122
- modelForType<T>(type: string): {
5123
- new (data?: {
5124
- [name: string]: any;
5125
- } | Partial<T>, { parent, resource, annots, reset, }?: {
5126
- parent?: [ODataModel<any> | ODataCollection<any, ODataModel<any>>, angular_odata.ODataModelField<any> | null];
5127
- resource?: ODataResource<T> | null | undefined;
5128
- annots?: angular_odata.ODataEntityAnnotations<T> | undefined;
5129
- reset?: boolean;
5130
- }): ODataModel<T>;
5131
- options: ModelOptions;
5132
- meta: ODataModelOptions<any>;
5133
- buildMetaOptions<T_1>({ config, structuredType, }: {
5134
- config?: ModelOptions;
5135
- structuredType: ODataStructuredType<T_1>;
5136
- }): ODataModelOptions<T_1>;
5137
5133
  };
5138
- findCollection<T>(type: string): typeof ODataCollection<T, ODataModel<T>> | undefined;
5139
- createCollection<T>(structured: ODataStructuredType<T>, model?: typeof ODataModel<T>): typeof ODataCollection<any, ODataModel<any>> | typeof ODataCollection<T, ODataModel<T>>;
5140
- collectionForType<T>(type: string): {
5141
- new (entities?: {
5142
- [name: string]: any;
5143
- }[] | Partial<T>[], { parent, resource, annots, model, reset, }?: {
5144
- parent?: [ODataModel<any>, angular_odata.ODataModelField<any>];
5145
- resource?: ODataResource<T> | null | undefined;
5146
- annots?: angular_odata.ODataEntitiesAnnotations<T> | undefined;
5147
- model?: typeof ODataModel;
5148
- reset?: boolean;
5149
- }): ODataCollection<T, ODataModel<T>>;
5150
- model: typeof ODataModel<any> | null;
5134
+ };
5135
+ type ODataAnnotationConfig = {
5136
+ term: string;
5137
+ string?: string;
5138
+ bool?: boolean;
5139
+ int?: number;
5140
+ permissions?: string[];
5141
+ properties?: string[];
5142
+ };
5143
+ type ODataReferenceConfig = {
5144
+ uri: string;
5145
+ includes?: string;
5146
+ annotations?: ODataAnnotationConfig[];
5147
+ enums?: ODataEnumTypeConfig[];
5148
+ entities?: ODataStructuredTypeConfig[];
5149
+ callables?: ODataCallableConfig[];
5150
+ containers?: ODataEntityContainerConfig[];
5151
+ };
5152
+ type ODataSchemaConfig = {
5153
+ namespace: string;
5154
+ alias?: string;
5155
+ annotations?: ODataAnnotationConfig[];
5156
+ enums?: ODataEnumTypeConfig[];
5157
+ entities?: ODataStructuredTypeConfig[];
5158
+ callables?: ODataCallableConfig[];
5159
+ containers?: ODataEntityContainerConfig[];
5160
+ };
5161
+ type ODataEntityContainerConfig = {
5162
+ name: string;
5163
+ annotations?: ODataAnnotationConfig[];
5164
+ entitySets?: ODataEntitySetConfig[];
5165
+ singletons?: ODataSingletonConfig[];
5166
+ };
5167
+ type ODataEnumTypeFieldConfig = {
5168
+ value: number;
5169
+ annotations?: ODataAnnotationConfig[];
5170
+ };
5171
+ type ODataEnumTypeConfig = {
5172
+ name: string;
5173
+ flags?: boolean;
5174
+ annotations?: ODataAnnotationConfig[];
5175
+ members: {
5176
+ [name: string]: number;
5177
+ } | {
5178
+ [value: number]: string;
5151
5179
  };
5152
- findEntitySetForEntityType(entityType: string): ODataEntitySet | undefined;
5153
- parserForType<T>(type: string | EdmType, bindingType?: string): Parser<T>;
5154
- optionsForType<T>(type: string, { structuredType, config, }?: {
5155
- structuredType?: ODataStructuredType<T>;
5156
- config?: ModelOptions;
5157
- }): ODataModelOptions<T> | undefined;
5158
- }
5180
+ fields: {
5181
+ [member: string]: ODataEnumTypeFieldConfig;
5182
+ };
5183
+ };
5184
+ type ODataStructuredTypeFieldConfig = {
5185
+ type: string;
5186
+ default?: any;
5187
+ maxLength?: number;
5188
+ key?: boolean;
5189
+ collection?: boolean;
5190
+ nullable?: boolean;
5191
+ navigation?: boolean;
5192
+ precision?: number;
5193
+ annotations?: ODataAnnotationConfig[];
5194
+ scale?: number | 'variable';
5195
+ referentials?: {
5196
+ property: string;
5197
+ referencedProperty: string;
5198
+ }[];
5199
+ referential?: string;
5200
+ referenced?: string;
5201
+ };
5202
+ type ODataStructuredTypeConfig = {
5203
+ name: string;
5204
+ base?: string;
5205
+ open?: boolean;
5206
+ model?: {
5207
+ new (...params: any[]): any;
5208
+ };
5209
+ collection?: {
5210
+ new (...params: any[]): any;
5211
+ };
5212
+ annotations?: ODataAnnotationConfig[];
5213
+ keys?: {
5214
+ name: string;
5215
+ alias?: string;
5216
+ }[];
5217
+ fields?: {
5218
+ [name: string]: ODataStructuredTypeFieldConfig;
5219
+ };
5220
+ };
5221
+ type ODataParameterConfig = {
5222
+ type: string;
5223
+ nullable?: boolean;
5224
+ collection?: boolean;
5225
+ };
5226
+ type ODataCallableConfig = {
5227
+ name: string;
5228
+ entitySetPath?: string;
5229
+ bound?: boolean;
5230
+ composable?: boolean;
5231
+ parameters?: {
5232
+ [name: string]: ODataParameterConfig;
5233
+ };
5234
+ return?: {
5235
+ type: string;
5236
+ collection?: boolean;
5237
+ };
5238
+ };
5239
+ type ODataEntitySetConfig = {
5240
+ name: string;
5241
+ entityType: string;
5242
+ service: {
5243
+ new (...params: any[]): any;
5244
+ };
5245
+ annotations?: ODataAnnotationConfig[];
5246
+ };
5247
+ type ODataSingletonConfig = {
5248
+ name: string;
5249
+ type: string;
5250
+ service: {
5251
+ new (...params: any[]): any;
5252
+ };
5253
+ annotations?: ODataAnnotationConfig[];
5254
+ };
5159
5255
 
5160
5256
  declare class ODataSettings {
5161
5257
  apis: ODataApi[];
@@ -6167,23 +6263,23 @@ declare class ODataServiceFactory {
6167
6263
  }
6168
6264
 
6169
6265
  /**
6170
- * A cache entry that holds a payload, a last read time, and a timeout for the entry.
6266
+ * A cache entry that holds a payload, a date when it was last read from the backend, and a maxAge for the entry.
6171
6267
  * @param payload The payload to cache.
6172
- * @param lastread The last read time.
6173
- * @param timeout The timeout in seconds.
6268
+ * @param date The date when the entry was last read from the backend.
6269
+ * @param maxAge The maximum age for the entry.
6174
6270
  * @param tags Some tags to identify the entry.
6175
6271
  */
6176
6272
  interface ODataCacheEntry<T> {
6177
6273
  payload: T;
6178
- lastread: number;
6179
- timeout: number;
6274
+ date: number;
6275
+ maxAge: number;
6180
6276
  tags: string[];
6181
6277
  }
6182
6278
  declare abstract class ODataBaseCache implements ODataCache {
6183
- timeout: number;
6279
+ maxAge: number;
6184
6280
  entries: Map<string, ODataCacheEntry<any>>;
6185
- constructor({ timeout }: {
6186
- timeout?: number;
6281
+ constructor({ maxAge }: {
6282
+ maxAge?: number;
6187
6283
  });
6188
6284
  abstract getResponse(req: ODataRequest<any>): ODataResponse<any> | undefined;
6189
6285
  abstract putResponse(req: ODataRequest<any>, res: ODataResponse<any>): void;
@@ -6202,12 +6298,12 @@ declare abstract class ODataBaseCache implements ODataCache {
6202
6298
  /**
6203
6299
  * Build an entry from a payload and some options
6204
6300
  * @param payload The payload to store in the cache
6205
- * @param timeout The timeout for the entry
6301
+ * @param maxAge The maximum age for the entry
6206
6302
  * @param tags The tags for the entry
6207
6303
  * @returns The entry to store in the cache
6208
6304
  */
6209
- buildEntry<T>(payload: T, { timeout, tags }: {
6210
- timeout?: number;
6305
+ buildEntry<T>(payload: T, { maxAge, tags }: {
6306
+ maxAge?: number;
6211
6307
  tags?: string[];
6212
6308
  }): ODataCacheEntry<T>;
6213
6309
  /**
@@ -6220,12 +6316,12 @@ declare abstract class ODataBaseCache implements ODataCache {
6220
6316
  * Put some payload in the cache
6221
6317
  * @param name The name for the entry
6222
6318
  * @param payload The payload to store in the cache
6223
- * @param timeout The timeout for the entry
6319
+ * @param maxAge The maximum age for the entry
6224
6320
  * @param scope The scope for the entry
6225
6321
  * @param tags The tags for the entry
6226
6322
  */
6227
- put<T>(name: string, payload: T, { timeout, scope, tags }?: {
6228
- timeout?: number;
6323
+ put<T>(name: string, payload: T, { maxAge, scope, tags }?: {
6324
+ maxAge?: number;
6229
6325
  scope?: string[];
6230
6326
  tags?: string[];
6231
6327
  }): void;
@@ -6257,20 +6353,11 @@ declare abstract class ODataBaseCache implements ODataCache {
6257
6353
  * @returns Boolean indicating if the entry is expired
6258
6354
  */
6259
6355
  isExpired(entry: ODataCacheEntry<any>): boolean;
6260
- /**
6261
- * Using the request, handle the fetching of the response
6262
- * @param req The request to fetch
6263
- * @param res$ Observable of the response
6264
- * @returns
6265
- */
6266
- handleRequest(req: ODataRequest<any>, res$: Observable<ODataResponse<any>>): Observable<ODataResponse<any>>;
6267
- private handleFetch;
6268
- private handleMutate;
6269
6356
  }
6270
6357
 
6271
6358
  declare class ODataInMemoryCache extends ODataBaseCache {
6272
- constructor({ timeout }?: {
6273
- timeout?: number;
6359
+ constructor({ maxAge }?: {
6360
+ maxAge?: number;
6274
6361
  });
6275
6362
  /**
6276
6363
  * Store the response in the cache
@@ -6289,8 +6376,8 @@ declare class ODataInMemoryCache extends ODataBaseCache {
6289
6376
  declare class ODataInStorageCache extends ODataBaseCache {
6290
6377
  name: string;
6291
6378
  storage: Storage;
6292
- constructor({ name, storage, timeout, }: {
6293
- timeout?: number;
6379
+ constructor({ name, storage, maxAge, }: {
6380
+ maxAge?: number;
6294
6381
  name: string;
6295
6382
  storage?: Storage;
6296
6383
  });
@@ -6429,5 +6516,5 @@ declare class ODataMetadataParser {
6429
6516
  protected propertyValueToDate(attributeValue?: string): Date | undefined;
6430
6517
  }
6431
6518
 
6432
- export { Aggregate, ApplyExpression, ArithmeticFunctions, ArithmeticOperators, BUBBLES, CollectionFunctions, ComputeExpression, ConditionalFunctions, DateAndTimeFunctions, Dates, Durations, EDM_PARSERS, EdmType, Enums, ExpandExpression, ExpandField, Expression, FieldFactory, FilterExpression, Function, GeoFunctions, GroupBy, GroupByTransformations, Grouping, GroupingOperators, Http, INCLUDE_DEEP, INCLUDE_SHALLOW, ITEM_ROOT, JsonSchemaType, Lambda, LambdaOperators, LogicalOperators, Model, ModelField, NONE_PARSER, ODATA_CONFIG, OData, ODataActionResource, ODataAnnotations, ODataApi, ODataBaseCache, ODataBaseService, ODataBatchRequest, ODataBatchResource, ODataCallable, ODataCallableParser, ODataClient, ODataCollection, ODataConfigAsyncLoader, ODataConfigLoader, ODataConfigSyncLoader, ODataCountResource, ODataEntitiesAnnotations, ODataEntityAnnotations, ODataEntityContainer, ODataEntityResource, ODataEntitySet, ODataEntitySetResource, ODataEntitySetService, ODataEntityTypeKey, ODataEnumType, ODataEnumTypeFieldParser, ODataEnumTypeParser, ODataFunctionResource, ODataFunctions, ODataInMemoryCache, ODataInStorageCache, ODataMediaResource, ODataMetadata, ODataMetadataLoader, ODataMetadataParser, ODataMetadataResource, ODataModel, ODataModelAttribute, ODataModelEvent, ODataModelEventEmitter, ODataModelEventType, ODataModelField, ODataModelOptions, ODataModelState, ODataModule, ODataNavigationPropertyResource, ODataOperators, ODataParameterParser, ODataPathSegments, ODataPathSegmentsHandler, ODataPropertyAnnotations, ODataPropertyResource, ODataQueryOptionHandler, ODataQueryOptions, ODataQueryOptionsHandler, ODataReferenceResource, ODataReferential, ODataRequest, ODataResource, ODataResponse, ODataSchema, ODataServiceFactory, ODataSettings, ODataSingleton, ODataSingletonResource, ODataSingletonService, ODataStructuredType, ODataStructuredTypeFieldParser, ODataStructuredTypeParser, ODataSyntax, ODataTransformations, ODataValueResource, Objects, Operator, OrderByExpression, OrderByField, PathSegment, QueryCustomTypes, QueryOption, RenderableFactory, SearchExpression, SearchTerm, SegmentHandler, SelectExpression, StandardAggregateMethods, StringAndCollectionFunctions, StringFunctions, Strings, Transformations, Type, TypeFunctions, Types, Urls, alias, binary, buildPathAndQuery, createSyncLoader, duration, encode, functions, isQueryCustomType, isRawType, normalizeValue, operators, pathAndParamsFromQueryOptions, pathAndParamsFromSegments, provideODataClient, raw, render, resolve, syntax, transformations };
6519
+ export { Aggregate, ApplyExpression, ArithmeticFunctions, ArithmeticOperators, BUBBLES, Casting, CastingOperators, CollectionFunctions, ComputeExpression, ConditionalFunctions, DateAndTimeFunctions, Dates, Durations, EDM_PARSERS, EdmType, Enums, ExpandExpression, ExpandField, Expression, FieldFactory, FilterExpression, Function, GeoFunctions, GroupBy, GroupByTransformations, Grouping, GroupingOperators, Http, INCLUDE_DEEP, INCLUDE_SHALLOW, ITEM_ROOT, JsonSchemaType, Lambda, LambdaOperators, LogicalOperators, Model, ModelField, NONE_PARSER, ODATA_CONFIG, OData, ODataActionResource, ODataAnnotations, ODataApi, ODataBaseCache, ODataBaseService, ODataBatchRequest, ODataBatchResource, ODataCallable, ODataCallableParser, ODataClient, ODataCollection, ODataConfigAsyncLoader, ODataConfigLoader, ODataConfigSyncLoader, ODataCountResource, ODataEntitiesAnnotations, ODataEntityAnnotations, ODataEntityContainer, ODataEntityResource, ODataEntitySet, ODataEntitySetResource, ODataEntitySetService, ODataEntityTypeKey, ODataEnumType, ODataEnumTypeFieldParser, ODataEnumTypeParser, ODataFunctionResource, ODataFunctions, ODataInMemoryCache, ODataInStorageCache, ODataMediaResource, ODataMetadata, ODataMetadataLoader, ODataMetadataParser, ODataMetadataResource, ODataModel, ODataModelAttribute, ODataModelEvent, ODataModelEventEmitter, ODataModelEventType, ODataModelField, ODataModelOptions, ODataModelState, ODataModule, ODataNavigationPropertyResource, ODataOperators, ODataParameterParser, ODataPathSegments, ODataPathSegmentsHandler, ODataPropertyAnnotations, ODataPropertyResource, ODataQueryOptionHandler, ODataQueryOptions, ODataQueryOptionsHandler, ODataReferenceResource, ODataReferential, ODataRequest, ODataResource, ODataResponse, ODataSchema, ODataServiceFactory, ODataSettings, ODataSingleton, ODataSingletonResource, ODataSingletonService, ODataStructuredType, ODataStructuredTypeFieldParser, ODataStructuredTypeParser, ODataTransformations, ODataValueResource, Objects, Operator, OrderByExpression, OrderByField, PathSegment, QueryCustomTypes, QueryOption, RenderableFactory, SearchExpression, SearchTerm, SegmentHandler, SelectExpression, StandardAggregateMethods, StringAndCollectionFunctions, StringFunctions, Strings, Transformations, Type, TypeFunctions, Types, Urls, alias, binary, buildPathAndQuery, createSyncLoader, duration, encode, functions, isQueryCustomType, isRawType, normalizeValue, operators, pathAndParamsFromQueryOptions, pathAndParamsFromSegments, provideODataClient, raw, render, resolve, transformations };
6433
6520
  export type { AggregateMethod, AggregateType, ApplyExpressionBuilder, CacheCacheability, ComputeExpressionBuilder, Duration, EntityKey, Expand, ExpandExpressionBuilder, ExpandObject, ExpandOptions, ExpandType, FetchPolicy, FieldParser, Filter, FilterConnector, FilterExpressionBuilder, FilterType, GroupByType, JsonSchemaCustom, JsonSchemaExpand, JsonSchemaFieldOptions, JsonSchemaOptions, JsonSchemaRequired, JsonSchemaSelect, LooseUnion, ModelFieldOptions, ModelInterface, ModelOptions, NestedExpandOptions, NestedOrderBy, Normalize, ODataActionOptions, ODataAnnotationConfig, ODataApiConfig, ODataApiConfigOptions, ODataCache, ODataCacheEntry, ODataCallableConfig, ODataEntities, ODataEntitiesOptions, ODataEntity, ODataEntityContainerConfig, ODataEntityOptions, ODataEntitySetConfig, ODataEnumTypeConfig, ODataEnumTypeFieldConfig, ODataFunctionOptions, ODataMetadataType, ODataModelEntry, ODataModelFieldOptions, ODataOptions, ODataParameterConfig, ODataProperty, ODataPropertyOptions, ODataQueryArguments, ODataQueryArgumentsOptions, ODataReferenceConfig, ODataResponseJson, ODataSchemaConfig, ODataSegment, ODataSingletonConfig, ODataStructuredTypeConfig, ODataStructuredTypeFieldConfig, ODataVersion, ObjectValues, OrderAttribute, OrderBy, OrderByExpressionBuilder, OrderByObject, OrderByType, Parser, ParserOptions, PassedInitialConfig, QueryCustomType, QueryOptions, Renderable, ResponseOptions, SearchConnector, SearchExpressionBuilder, Select, SelectExpressionBuilder, SelectType, StructuredTypeFieldOptions, Transform, Unpacked, Value };