angular-odata 0.100.0 → 0.102.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 (78) hide show
  1. package/esm2020/lib/api.mjs +65 -55
  2. package/esm2020/lib/cache/cache.mjs +56 -4
  3. package/esm2020/lib/cache/memory.mjs +16 -6
  4. package/esm2020/lib/cache/storage.mjs +23 -4
  5. package/esm2020/lib/client.mjs +3 -3
  6. package/esm2020/lib/constants.mjs +2 -1
  7. package/esm2020/lib/helper.mjs +91 -86
  8. package/esm2020/lib/models/collection.mjs +103 -43
  9. package/esm2020/lib/models/model.mjs +20 -7
  10. package/esm2020/lib/models/options.mjs +200 -133
  11. package/esm2020/lib/module.mjs +5 -5
  12. package/esm2020/lib/options.mjs +3 -8
  13. package/esm2020/lib/resources/query/builder.mjs +2 -2
  14. package/esm2020/lib/resources/query/expressions/syntax.mjs +1 -1
  15. package/esm2020/lib/resources/query/handlers.mjs +233 -34
  16. package/esm2020/lib/resources/query/options.mjs +45 -35
  17. package/esm2020/lib/resources/request.mjs +24 -35
  18. package/esm2020/lib/resources/resource.mjs +27 -11
  19. package/esm2020/lib/resources/responses/annotations.mjs +6 -6
  20. package/esm2020/lib/resources/responses/metadata.mjs +1 -1
  21. package/esm2020/lib/resources/responses/options.mjs +1 -1
  22. package/esm2020/lib/resources/responses/response.mjs +4 -4
  23. package/esm2020/lib/resources/types/batch.mjs +108 -97
  24. package/esm2020/lib/resources/types/function.mjs +3 -2
  25. package/esm2020/lib/resources/types/navigation-property.mjs +4 -2
  26. package/esm2020/lib/resources/types/options.mjs +1 -1
  27. package/esm2020/lib/schema/callable.mjs +3 -3
  28. package/esm2020/lib/schema/enum-type.mjs +5 -2
  29. package/esm2020/lib/schema/parsers/callable.mjs +10 -20
  30. package/esm2020/lib/schema/parsers/enum-type.mjs +13 -16
  31. package/esm2020/lib/schema/parsers/structured-type.mjs +15 -27
  32. package/esm2020/lib/schema/structured-type.mjs +10 -11
  33. package/esm2020/lib/services/base.mjs +1 -1
  34. package/esm2020/lib/services/factory.mjs +3 -3
  35. package/esm2020/lib/types.mjs +1 -1
  36. package/esm2020/lib/utils/arrays.mjs +10 -0
  37. package/esm2020/lib/utils/enums.mjs +3 -3
  38. package/esm2020/lib/utils/objects.mjs +10 -5
  39. package/esm2020/lib/utils/types.mjs +5 -1
  40. package/esm2020/lib/utils/urls.mjs +2 -2
  41. package/fesm2015/angular-odata.mjs +3343 -2886
  42. package/fesm2015/angular-odata.mjs.map +1 -1
  43. package/fesm2020/angular-odata.mjs +3336 -2879
  44. package/fesm2020/angular-odata.mjs.map +1 -1
  45. package/{angular-odata.d.ts → index.d.ts} +0 -0
  46. package/lib/cache/cache.d.ts +62 -1
  47. package/lib/cache/memory.d.ts +10 -0
  48. package/lib/cache/storage.d.ts +19 -0
  49. package/lib/constants.d.ts +1 -0
  50. package/lib/helper.d.ts +28 -57
  51. package/lib/models/collection.d.ts +12 -8
  52. package/lib/models/model.d.ts +13 -16
  53. package/lib/models/options.d.ts +22 -16
  54. package/lib/options.d.ts +3 -7
  55. package/lib/resources/query/builder.d.ts +2 -2
  56. package/lib/resources/query/handlers.d.ts +158 -6
  57. package/lib/resources/query/options.d.ts +21 -21
  58. package/lib/resources/request.d.ts +2 -1
  59. package/lib/resources/resource.d.ts +7 -6
  60. package/lib/resources/responses/annotations.d.ts +12 -18
  61. package/lib/resources/responses/options.d.ts +2 -2
  62. package/lib/resources/responses/response.d.ts +1 -3
  63. package/lib/resources/types/batch.d.ts +8 -11
  64. package/lib/resources/types/options.d.ts +4 -2
  65. package/lib/schema/callable.d.ts +4 -4
  66. package/lib/schema/enum-type.d.ts +4 -4
  67. package/lib/schema/parsers/callable.d.ts +10 -10
  68. package/lib/schema/parsers/enum-type.d.ts +7 -7
  69. package/lib/schema/parsers/structured-type.d.ts +11 -11
  70. package/lib/schema/structured-type.d.ts +4 -4
  71. package/lib/services/base.d.ts +9 -9
  72. package/lib/types.d.ts +6 -8
  73. package/lib/utils/arrays.d.ts +3 -0
  74. package/lib/utils/enums.d.ts +2 -2
  75. package/lib/utils/objects.d.ts +1 -1
  76. package/lib/utils/strings.d.ts +1 -1
  77. package/lib/utils/types.d.ts +1 -0
  78. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- import { EnumTypeConfig, EnumTypeFieldConfig, OptionsHelper, Parser } from '../../types';
1
+ import { EnumTypeConfig, EnumTypeFieldConfig, ParserOptions, Parser } from '../../types';
2
2
  import { ODataAnnotatable } from '../annotation';
3
3
  export declare class ODataEnumTypeFieldParser extends ODataAnnotatable {
4
4
  name: string;
@@ -18,7 +18,7 @@ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements
18
18
  };
19
19
  fields: ODataEnumTypeFieldParser[];
20
20
  stringAsEnum?: boolean;
21
- optionsHelper?: OptionsHelper;
21
+ parserOptions?: ParserOptions;
22
22
  constructor(config: EnumTypeConfig<T>, namespace: string, alias?: string);
23
23
  /**
24
24
  * Create a nicer looking title.
@@ -27,14 +27,14 @@ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements
27
27
  * @returns The titleized string.
28
28
  */
29
29
  ttitelize(term?: string | RegExp): string;
30
- configure({ stringAsEnum, options }: {
30
+ configure({ stringAsEnum, options, }: {
31
31
  stringAsEnum: boolean;
32
- options: OptionsHelper;
32
+ options: ParserOptions;
33
33
  }): void;
34
34
  isTypeOf(type: string): boolean;
35
- deserialize(value: string, options?: OptionsHelper): T;
36
- serialize(value: T, options?: OptionsHelper): string;
37
- encode(value: T, options?: OptionsHelper): any;
35
+ deserialize(value: string, options?: ParserOptions): T;
36
+ serialize(value: T, options?: ParserOptions): string | undefined;
37
+ encode(value: T, options?: ParserOptions): any;
38
38
  toJsonSchema(): any;
39
39
  validate(member: string | number, { method, navigation, }?: {
40
40
  method?: 'create' | 'update' | 'modify';
@@ -1,4 +1,4 @@
1
- import { OptionsHelper, Parser, StructuredTypeConfig, StructuredTypeFieldConfig } from '../../types';
1
+ import { ParserOptions, Parser, StructuredTypeConfig, StructuredTypeFieldConfig } from '../../types';
2
2
  import { ODataAnnotatable } from '../annotation';
3
3
  import { ODataEnumTypeParser } from './enum-type';
4
4
  declare type JsonSchemaSelect<T> = Array<keyof T>;
@@ -46,7 +46,7 @@ export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable
46
46
  precision?: number;
47
47
  scale?: number;
48
48
  referentials: ODataReferential[];
49
- optionsHelper?: OptionsHelper;
49
+ parserOptions?: ParserOptions;
50
50
  constructor(name: string, structuredType: ODataStructuredTypeParser<any>, field: StructuredTypeFieldConfig);
51
51
  validate(value: any, { method, navigation, }?: {
52
52
  method?: 'create' | 'update' | 'modify';
@@ -57,13 +57,13 @@ export declare class ODataStructuredTypeFieldParser<T> extends ODataAnnotatable
57
57
  [name: string]: any;
58
58
  }[] | string[] | undefined;
59
59
  private parse;
60
- deserialize(value: any, options?: OptionsHelper): T;
60
+ deserialize(value: any, options?: ParserOptions): T;
61
61
  private toJson;
62
- serialize(value: T, options?: OptionsHelper): any;
63
- encode(value: T, options?: OptionsHelper): string;
62
+ serialize(value: T, options?: ParserOptions): any;
63
+ encode(value: T, options?: ParserOptions): string;
64
64
  configure({ parserForType, options, }: {
65
65
  parserForType: (type: string) => Parser<any>;
66
- options: OptionsHelper;
66
+ options: ParserOptions;
67
67
  }): void;
68
68
  toJsonSchema(options?: JsonSchemaOptions<T>): any;
69
69
  isKey(): boolean;
@@ -84,7 +84,7 @@ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable imple
84
84
  parent?: ODataStructuredTypeParser<any>;
85
85
  keys?: ODataEntityTypeKey[];
86
86
  fields: ODataStructuredTypeFieldParser<any>[];
87
- optionsHelper?: OptionsHelper;
87
+ parserOptions?: ParserOptions;
88
88
  constructor(config: StructuredTypeConfig<T>, namespace: string, alias?: string);
89
89
  /**
90
90
  * Create a nicer looking title.
@@ -97,12 +97,12 @@ export declare class ODataStructuredTypeParser<T> extends ODataAnnotatable imple
97
97
  isSubtypeOf(type: string): boolean;
98
98
  findChildParser(predicate: (p: ODataStructuredTypeParser<any>) => boolean): ODataStructuredTypeParser<any> | undefined;
99
99
  childParser(predicate: (p: ODataStructuredTypeParser<any>) => boolean): Parser<any>;
100
- deserialize(value: any, options?: OptionsHelper): T;
101
- serialize(value: T, options?: OptionsHelper): any;
102
- encode(value: T, options?: OptionsHelper): any;
100
+ deserialize(value: any, options?: ParserOptions): T;
101
+ serialize(value: T, options?: ParserOptions): any;
102
+ encode(value: T, options?: ParserOptions): any;
103
103
  configure({ parserForType, options, }: {
104
104
  parserForType: (type: string) => Parser<any>;
105
- options: OptionsHelper;
105
+ options: ParserOptions;
106
106
  }): void;
107
107
  resolveKey(value: any): any;
108
108
  defaults(): {
@@ -1,6 +1,6 @@
1
1
  import { ODataCollection } from '../models';
2
2
  import { ODataModel } from '../models/model';
3
- import { OptionsHelper, StructuredTypeConfig } from '../types';
3
+ import { ParserOptions, StructuredTypeConfig } from '../types';
4
4
  import { ODataSchemaElement } from './element';
5
5
  import { JsonSchemaOptions, ODataEntityTypeKey, ODataStructuredTypeFieldParser, ODataStructuredTypeParser } from './parsers';
6
6
  import { ODataSchema } from './schema';
@@ -96,21 +96,21 @@ export declare class ODataStructuredType<T> extends ODataSchemaElement {
96
96
  * @param options Options for deserialization
97
97
  * @returns Deserialized value
98
98
  */
99
- deserialize(value: any, options?: OptionsHelper): T;
99
+ deserialize(value: any, options?: ParserOptions): T;
100
100
  /**
101
101
  * Serialize the given value for the structured type.
102
102
  * @param value Value to serialize
103
103
  * @param options Options for serialization
104
104
  * @returns Serialized value
105
105
  */
106
- serialize(value: T, options?: OptionsHelper): any;
106
+ serialize(value: T, options?: ParserOptions): any;
107
107
  /**
108
108
  * Encode the given value for the structured type.
109
109
  * @param value Value to encode
110
110
  * @param options Options for encoding
111
111
  * @returns Encoded value
112
112
  */
113
- encode(value: T, options?: OptionsHelper): any;
113
+ encode(value: T, options?: ParserOptions): any;
114
114
  /**
115
115
  * Resolve the key of the structured type for the given value.
116
116
  * @param attrs Attributes of the value
@@ -1,20 +1,20 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { ODataClient } from '../client';
3
- import { ODataActionResource, ODataEntities, ODataEntity, ODataFunctionResource, ODataNavigationPropertyResource, ODataProperty, ODataQueryArgumentsOptions } from '../resources';
3
+ import { ODataActionOptions, ODataActionResource, ODataEntities, ODataEntity, ODataFunctionOptions, ODataFunctionResource, ODataNavigationPropertyResource, ODataProperty, ODataQueryArgumentsOptions } from '../resources';
4
4
  export declare abstract class ODataBaseService {
5
5
  protected client: ODataClient;
6
6
  protected name: string;
7
7
  protected apiNameOrEntityType?: string | undefined;
8
8
  constructor(client: ODataClient, name: string, apiNameOrEntityType?: string | undefined);
9
9
  get api(): import("angular-odata").ODataApi;
10
- protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entity', options?: ODataQueryArgumentsOptions<R>): Observable<ODataEntity<R>>;
11
- protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entities', options?: ODataQueryArgumentsOptions<R>): Observable<ODataEntities<R>>;
12
- protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'property', options?: ODataQueryArgumentsOptions<R>): Observable<ODataProperty<R>>;
13
- protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'none', options?: ODataQueryArgumentsOptions<R>): Observable<null>;
14
- protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entity', options?: ODataQueryArgumentsOptions<R>): Observable<ODataEntity<R>>;
15
- protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entities', options?: ODataQueryArgumentsOptions<R>): Observable<ODataEntities<R>>;
16
- protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'property', options?: ODataQueryArgumentsOptions<R>): Observable<ODataProperty<R>>;
17
- protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'none', options?: ODataQueryArgumentsOptions<R>): Observable<null>;
10
+ protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entity', options?: ODataFunctionOptions<R>): Observable<ODataEntity<R>>;
11
+ protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'entities', options?: ODataFunctionOptions<R>): Observable<ODataEntities<R>>;
12
+ protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'property', options?: ODataFunctionOptions<R>): Observable<ODataProperty<R>>;
13
+ protected callFunction<P, R>(params: P | null, resource: ODataFunctionResource<P, R>, responseType: 'none', options?: ODataFunctionOptions<R>): Observable<null>;
14
+ protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entity', options?: ODataActionOptions<R>): Observable<ODataEntity<R>>;
15
+ protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'entities', options?: ODataActionOptions<R>): Observable<ODataEntities<R>>;
16
+ protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'property', options?: ODataActionOptions<R>): Observable<ODataProperty<R>>;
17
+ protected callAction<P, R>(params: P | null, resource: ODataActionResource<P, R>, responseType: 'none', options?: ODataActionOptions<R>): Observable<null>;
18
18
  protected fetchNavigationProperty<S>(resource: ODataNavigationPropertyResource<S>, responseType: 'entity', options?: ODataQueryArgumentsOptions<S>): Observable<ODataEntity<S>>;
19
19
  protected fetchNavigationProperty<S>(resource: ODataNavigationPropertyResource<S>, responseType: 'entities', options?: ODataQueryArgumentsOptions<S>): Observable<ODataEntities<S>>;
20
20
  }
package/lib/types.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { ODataVersionHelper } from './helper';
2
1
  import { Observable } from 'rxjs';
3
2
  export declare type ODataVersion = '2.0' | '3.0' | '4.0';
4
3
  export declare type FetchPolicy = 'cache-first' | 'cache-and-network' | 'network-only' | 'no-cache' | 'cache-only';
@@ -65,25 +64,24 @@ export interface ApiOptions {
65
64
  deleteRefBy?: 'path' | 'id';
66
65
  nonParenthesisForEmptyParameterFunction?: boolean;
67
66
  }
68
- export interface OptionsHelper {
67
+ export interface ParserOptions {
69
68
  version?: ODataVersion;
70
- helper: ODataVersionHelper;
71
69
  exponentialDecimals?: boolean;
72
70
  metadata?: ODataMetadataType;
73
71
  ieee754Compatible?: boolean;
74
72
  streaming?: boolean;
75
73
  }
76
- export interface ResponseOptions extends OptionsHelper {
74
+ export interface ResponseOptions extends ParserOptions {
77
75
  cacheability?: CacheCacheability;
78
76
  maxAge?: number;
79
77
  }
80
- export interface StructuredTypeFieldOptions extends OptionsHelper {
78
+ export interface StructuredTypeFieldOptions extends ParserOptions {
81
79
  field: StructuredTypeFieldConfig;
82
80
  }
83
81
  export interface Parser<T> {
84
- deserialize(value: any, options?: OptionsHelper | StructuredTypeFieldOptions): T;
85
- serialize(value: any, options?: OptionsHelper | StructuredTypeFieldOptions): any;
86
- encode(value: any, options?: OptionsHelper | StructuredTypeFieldOptions): any;
82
+ deserialize(value: any, options?: ParserOptions | StructuredTypeFieldOptions): T;
83
+ serialize(value: any, options?: ParserOptions | StructuredTypeFieldOptions): any;
84
+ encode(value: any, options?: ParserOptions | StructuredTypeFieldOptions): any;
87
85
  }
88
86
  export declare const NONE_PARSER: Parser<any>;
89
87
  export interface Cache {
@@ -0,0 +1,3 @@
1
+ export declare const Arrays: {
2
+ zip: (...arrays: any[][]) => any[][];
3
+ };
@@ -1,8 +1,8 @@
1
1
  export declare const Enums: {
2
2
  names<E>(Enum: E): string[];
3
3
  values<E_1>(Enum: E_1): number[];
4
- toValue<E_2>(Enum: E_2, value: any): number;
4
+ toValue<E_2>(Enum: E_2, value: any): number | undefined;
5
5
  toValues<E_3>(Enum: E_3, value: any): number[];
6
- toName<E_4>(Enum: E_4, value: any): string;
6
+ toName<E_4>(Enum: E_4, value: any): string | undefined;
7
7
  toNames<E_5>(Enum: E_5, value: any): string[];
8
8
  };
@@ -19,5 +19,5 @@ export declare const Objects: {
19
19
  resolveKey(key: any, { single }?: {
20
20
  single?: boolean | undefined;
21
21
  }): any;
22
- clone(target: any, map?: WeakMap<object, any> | undefined): any;
22
+ clone(target: any, map?: WeakMap<object, any>): any;
23
23
  };
@@ -1,4 +1,4 @@
1
1
  export declare const Strings: {
2
- uniqueId(prefix?: string | undefined, suffix?: string | undefined): string;
2
+ uniqueId(prefix?: string, suffix?: string): string;
3
3
  titleCase(text: string): string;
4
4
  };
@@ -4,6 +4,7 @@ export declare const Types: {
4
4
  isPlainObject(value: any): boolean;
5
5
  isFunction(value: any): boolean;
6
6
  isArray(value: any): boolean;
7
+ isMap(value: any): boolean;
7
8
  isEmpty(value: any): boolean;
8
9
  isEqual(value1: any, value2: any): boolean;
9
10
  clone(target: any): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-odata",
3
- "version": "0.100.0",
3
+ "version": "0.102.0",
4
4
  "license": "MIT",
5
5
  "description": "Client side OData typescript library for Angular",
6
6
  "repository": {
@@ -25,8 +25,8 @@
25
25
  "homepage": "https://github.com/diegomvh/angular-odata",
26
26
  "private": false,
27
27
  "peerDependencies": {
28
- "@angular/common": "^13.1.0",
29
- "@angular/core": "^13.1.0"
28
+ "@angular/common": ">=13.0.0",
29
+ "@angular/core": ">=13.0.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "tslib": "^2.3.0"
@@ -36,13 +36,13 @@
36
36
  "esm2020": "esm2020/angular-odata.mjs",
37
37
  "fesm2020": "fesm2020/angular-odata.mjs",
38
38
  "fesm2015": "fesm2015/angular-odata.mjs",
39
- "typings": "angular-odata.d.ts",
39
+ "typings": "index.d.ts",
40
40
  "exports": {
41
41
  "./package.json": {
42
42
  "default": "./package.json"
43
43
  },
44
44
  ".": {
45
- "types": "./angular-odata.d.ts",
45
+ "types": "./index.d.ts",
46
46
  "esm2020": "./esm2020/angular-odata.mjs",
47
47
  "es2020": "./fesm2020/angular-odata.mjs",
48
48
  "es2015": "./fesm2015/angular-odata.mjs",