angular-odata 0.99.5 → 0.100.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 (33) hide show
  1. package/esm2020/lib/api.mjs +2 -2
  2. package/esm2020/lib/models/options.mjs +1 -1
  3. package/esm2020/lib/options.mjs +4 -3
  4. package/esm2020/lib/resources/query/builder.mjs +3 -6
  5. package/esm2020/lib/resources/resource.mjs +22 -61
  6. package/esm2020/lib/resources/responses/options.mjs +1 -2
  7. package/esm2020/lib/resources/types/entity-set.mjs +1 -1
  8. package/esm2020/lib/resources/types/function.mjs +8 -1
  9. package/esm2020/lib/schema/callable.mjs +6 -2
  10. package/esm2020/lib/schema/enum-type.mjs +2 -2
  11. package/esm2020/lib/schema/parsers/callable.mjs +3 -2
  12. package/esm2020/lib/schema/parsers/enum-type.mjs +6 -5
  13. package/esm2020/lib/schema/parsers/structured-type.mjs +1 -1
  14. package/esm2020/lib/schema/structured-type.mjs +1 -1
  15. package/esm2020/lib/types.mjs +1 -1
  16. package/fesm2015/angular-odata.mjs +46 -75
  17. package/fesm2015/angular-odata.mjs.map +1 -1
  18. package/fesm2020/angular-odata.mjs +46 -75
  19. package/fesm2020/angular-odata.mjs.map +1 -1
  20. package/lib/models/options.d.ts +4 -4
  21. package/lib/options.d.ts +4 -4
  22. package/lib/resources/resource.d.ts +1 -0
  23. package/lib/resources/responses/options.d.ts +2 -3
  24. package/lib/resources/types/entity-set.d.ts +1 -1
  25. package/lib/resources/types/function.d.ts +3 -0
  26. package/lib/schema/callable.d.ts +4 -4
  27. package/lib/schema/enum-type.d.ts +4 -4
  28. package/lib/schema/parsers/callable.d.ts +9 -7
  29. package/lib/schema/parsers/enum-type.d.ts +7 -5
  30. package/lib/schema/parsers/structured-type.d.ts +7 -7
  31. package/lib/schema/structured-type.d.ts +4 -4
  32. package/lib/types.d.ts +5 -5
  33. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { Subscription } from 'rxjs';
2
2
  import { EntityKey, ODataEntitiesAnnotations, ODataEntityAnnotations, ODataEntityResource, ODataEntitySetResource, ODataNavigationPropertyResource, ODataPropertyResource, ODataQueryOptions, ODataQueryOptionsHandler, ODataResource, ODataSingletonResource } from '../resources';
3
3
  import { ODataEntitySet, ODataStructuredType, ODataStructuredTypeFieldParser } from '../schema';
4
- import { Options, OptionsHelper } from '../types';
4
+ import { OptionsHelper } from '../types';
5
5
  import type { ODataCollection } from './collection';
6
6
  import type { ODataModel } from './model';
7
7
  export declare type ODataModelEventType = 'change' | 'reset' | 'update' | 'destroy' | 'add' | 'remove' | 'invalid' | 'request' | 'sync' | 'attach';
@@ -116,9 +116,9 @@ export declare class ODataModelField<F> {
116
116
  navigation?: boolean;
117
117
  }): any;
118
118
  defaults(): any;
119
- deserialize(value: any, options?: Options): F;
120
- serialize(value: F, options?: Options): any;
121
- encode(value: F, options?: Options): any;
119
+ deserialize(value: any, options?: OptionsHelper): F;
120
+ serialize(value: F, options?: OptionsHelper): any;
121
+ encode(value: F, options?: OptionsHelper): any;
122
122
  resourceFactory<T, F>(base: ODataResource<T>): ODataNavigationPropertyResource<F> | ODataPropertyResource<F>;
123
123
  annotationsFactory(base: ODataEntityAnnotations): ODataEntityAnnotations | ODataEntitiesAnnotations;
124
124
  schemaFactory<T, F>(base: ODataStructuredType<T>): ODataStructuredType<F> | undefined;
package/lib/options.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ApiOptions, FetchPolicy, ODataMetadataType, ODataVersion, Options, OptionsHelper, QueryOptionNames } from './types';
1
+ import { ApiOptions, FetchPolicy, ODataMetadataType, ODataVersion, OptionsHelper, QueryOptionNames } from './types';
2
2
  export declare class ODataApiOptions implements ApiOptions, OptionsHelper {
3
3
  /**
4
4
  * Default OData version
@@ -7,7 +7,7 @@ export declare class ODataApiOptions implements ApiOptions, OptionsHelper {
7
7
  /**
8
8
  * Send enum as string in the request
9
9
  */
10
- stringAsEnum?: boolean;
10
+ stringAsEnum: boolean;
11
11
  /**
12
12
  * Strip metadata from the response
13
13
  */
@@ -75,12 +75,12 @@ export declare class ODataApiOptions implements ApiOptions, OptionsHelper {
75
75
  includeAnnotations?: string;
76
76
  };
77
77
  deleteRefBy: 'path' | 'id';
78
+ nonParenthesisForEmptyParameterFunction: boolean;
78
79
  constructor(config: ApiOptions);
79
80
  get helper(): import("./helper").ODataVersionHelper;
80
81
  }
81
82
  export declare class ODataParserOptions implements OptionsHelper {
82
83
  version: ODataVersion;
83
- stringAsEnum?: boolean;
84
- constructor(config: Options);
84
+ constructor(config: OptionsHelper);
85
85
  get helper(): import("./helper").ODataVersionHelper;
86
86
  }
@@ -59,6 +59,7 @@ export declare class ODataResource<T> {
59
59
  endpointUrl(params?: boolean): string;
60
60
  toString(): string;
61
61
  clone(): ODataResource<T>;
62
+ private __parser;
62
63
  deserialize(value: any, options?: OptionsHelper): any;
63
64
  serialize(value: any, options?: OptionsHelper): any;
64
65
  encode(value: any, options?: OptionsHelper): any;
@@ -1,14 +1,13 @@
1
- import { ODataMetadataType, ODataVersion, Options, ResponseOptions } from '../../types';
1
+ import { ODataMetadataType, ODataVersion, OptionsHelper, ResponseOptions } from '../../types';
2
2
  export declare class ODataResponseOptions implements ResponseOptions {
3
3
  version: ODataVersion;
4
4
  streaming?: boolean;
5
5
  metadata?: ODataMetadataType;
6
- stringAsEnum?: boolean;
7
6
  ieee754Compatible?: boolean;
8
7
  location?: string;
9
8
  cacheability?: 'public' | 'private' | 'no-cache' | 'no-store';
10
9
  maxAge?: number;
11
- constructor(config: Options);
10
+ constructor(config: OptionsHelper);
12
11
  get helper(): import("../../helper").ODataVersionHelper;
13
12
  clone(): ODataResponseOptions;
14
13
  setFeatures(features: string): void;
@@ -40,7 +40,7 @@ export declare class ODataEntitySetResource<T> extends ODataResource<T> {
40
40
  fetchCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(options?: ODataOptions & {
41
41
  withCount?: boolean;
42
42
  bodyQueryOptions?: QueryOptionNames[];
43
- }): Observable<ODataCollection<T, ODataModel<T>> | null>;
43
+ }): Observable<C | null>;
44
44
  fetchAll(options?: ODataOptions & {
45
45
  bodyQueryOptions?: QueryOptionNames[];
46
46
  }): Observable<T[]>;
@@ -18,6 +18,9 @@ export declare class ODataFunctionResource<P, R> extends ODataResource<R> {
18
18
  static fromResource<P, R>(resource: ODataResource<any>, path: string): ODataFunctionResource<P, R>;
19
19
  clone(): ODataFunctionResource<P, R>;
20
20
  returnType(): string | undefined;
21
+ pathAndParams(escape?: boolean): [string, {
22
+ [name: string]: any;
23
+ }];
21
24
  parameters(params: P | null, { alias }?: {
22
25
  alias?: boolean;
23
26
  }): ODataFunctionResource<P, R>;
@@ -1,4 +1,4 @@
1
- import { CallableConfig, Options, Parser } from '../types';
1
+ import { CallableConfig, OptionsHelper, Parser } from '../types';
2
2
  import { ODataSchemaElement } from './element';
3
3
  import { ODataCallableParser } from './parsers';
4
4
  import { ODataSchema } from './schema';
@@ -18,21 +18,21 @@ export declare class ODataCallable<R> extends ODataSchemaElement {
18
18
  * @param options Options for deserialization
19
19
  * @returns Deserialized value
20
20
  */
21
- deserialize(value: any, options?: Options): any;
21
+ deserialize(value: any, options?: OptionsHelper): any;
22
22
  /**
23
23
  * Serialize the given value for the callable.
24
24
  * @param value Value to serialize
25
25
  * @param options Options for serialization
26
26
  * @returns Serialized value
27
27
  */
28
- serialize(value: any, options?: Options): any;
28
+ serialize(value: any, options?: OptionsHelper): any;
29
29
  /**
30
30
  * Encode the given value for the callable.
31
31
  * @param value Value to encode
32
32
  * @param options Options for encoding
33
33
  * @returns Encoded value
34
34
  */
35
- encode(value: any, options?: Options): any;
35
+ encode(value: any, options?: OptionsHelper): any;
36
36
  /**
37
37
  * Returns the binding parameter of the callable.
38
38
  * @returns The binding parameter of the callable.
@@ -1,4 +1,4 @@
1
- import { EnumTypeConfig, Options } from '../types';
1
+ import { EnumTypeConfig, OptionsHelper } from '../types';
2
2
  import { ODataSchemaElement } from './element';
3
3
  import { ODataEnumTypeFieldParser, ODataEnumTypeParser } from './parsers';
4
4
  import { ODataSchema } from './schema';
@@ -46,19 +46,19 @@ export declare class ODataEnumType<E> extends ODataSchemaElement {
46
46
  * @param options Options for deserialization
47
47
  * @returns Deserialized value
48
48
  */
49
- deserialize(value: any, options?: Options): E;
49
+ deserialize(value: any, options?: OptionsHelper): E;
50
50
  /**
51
51
  * Serialize the given value for the enum type.
52
52
  * @param value Value to serialize
53
53
  * @param options Options for serialization
54
54
  * @returns Serialized value
55
55
  */
56
- serialize(value: E, options?: Options): any;
56
+ serialize(value: E, options?: OptionsHelper): any;
57
57
  /**
58
58
  * Encode the given value for the enum type.
59
59
  * @param value Value to encode
60
60
  * @param options Options for encoding
61
61
  * @returns Encoded value
62
62
  */
63
- encode(value: E, options?: Options): any;
63
+ encode(value: E, options?: OptionsHelper): any;
64
64
  }
@@ -1,4 +1,4 @@
1
- import { CallableConfig, Options, OptionsHelper, Parameter, Parser } from '../../types';
1
+ import { CallableConfig, OptionsHelper, Parameter, Parser } from '../../types';
2
2
  import { ODataEnumTypeParser } from './enum-type';
3
3
  import { ODataStructuredTypeParser } from './structured-type';
4
4
  export declare class ODataParameterParser<T> {
@@ -9,8 +9,8 @@ export declare class ODataParameterParser<T> {
9
9
  nullable?: boolean;
10
10
  optionsHelper?: OptionsHelper;
11
11
  constructor(name: string, parameter: Parameter);
12
- serialize(value: T, options?: Options): any;
13
- encode(value: any, options?: Options): string;
12
+ serialize(value: T, options?: OptionsHelper): any;
13
+ encode(value: any, options?: OptionsHelper): string;
14
14
  configure({ parserForType, options, }: {
15
15
  parserForType: (type: string) => Parser<any>;
16
16
  options: OptionsHelper;
@@ -31,13 +31,15 @@ export declare class ODataCallableParser<R> implements Parser<R> {
31
31
  };
32
32
  parser: Parser<any>;
33
33
  parameters: ODataParameterParser<any>[];
34
+ nonParenthesisForEmptyParameterFunction?: boolean;
34
35
  optionsHelper?: OptionsHelper;
35
36
  constructor(config: CallableConfig, namespace: string, alias?: string);
36
37
  isTypeOf(type: string): boolean;
37
- deserialize(value: any, options?: Options): R;
38
- serialize(params: any, options?: Options): any;
39
- encode(params: any, options?: Options): any;
40
- configure({ parserForType, options, }: {
38
+ deserialize(value: any, options?: OptionsHelper): R;
39
+ serialize(params: any, options?: OptionsHelper): any;
40
+ encode(params: any, options?: OptionsHelper): any;
41
+ configure({ nonParenthesisForEmptyParameterFunction, parserForType, options, }: {
42
+ nonParenthesisForEmptyParameterFunction: boolean;
41
43
  parserForType: (type: string) => Parser<any>;
42
44
  options: OptionsHelper;
43
45
  }): void;
@@ -1,4 +1,4 @@
1
- import { EnumTypeConfig, EnumTypeFieldConfig, Options, OptionsHelper, Parser } from '../../types';
1
+ import { EnumTypeConfig, EnumTypeFieldConfig, OptionsHelper, Parser } from '../../types';
2
2
  import { ODataAnnotatable } from '../annotation';
3
3
  export declare class ODataEnumTypeFieldParser extends ODataAnnotatable {
4
4
  name: string;
@@ -17,6 +17,7 @@ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements
17
17
  [value: number]: string;
18
18
  };
19
19
  fields: ODataEnumTypeFieldParser[];
20
+ stringAsEnum?: boolean;
20
21
  optionsHelper?: OptionsHelper;
21
22
  constructor(config: EnumTypeConfig<T>, namespace: string, alias?: string);
22
23
  /**
@@ -26,13 +27,14 @@ export declare class ODataEnumTypeParser<T> extends ODataAnnotatable implements
26
27
  * @returns The titleized string.
27
28
  */
28
29
  ttitelize(term?: string | RegExp): string;
29
- configure({ options }: {
30
+ configure({ stringAsEnum, options }: {
31
+ stringAsEnum: boolean;
30
32
  options: OptionsHelper;
31
33
  }): void;
32
34
  isTypeOf(type: string): boolean;
33
- deserialize(value: string, options?: Options): T;
34
- serialize(value: T, options?: Options): string;
35
- encode(value: T, options?: Options): any;
35
+ deserialize(value: string, options?: OptionsHelper): T;
36
+ serialize(value: T, options?: OptionsHelper): string;
37
+ encode(value: T, options?: OptionsHelper): any;
36
38
  toJsonSchema(): any;
37
39
  validate(member: string | number, { method, navigation, }?: {
38
40
  method?: 'create' | 'update' | 'modify';
@@ -1,4 +1,4 @@
1
- import { Options, OptionsHelper, Parser, StructuredTypeConfig, StructuredTypeFieldConfig } from '../../types';
1
+ import { OptionsHelper, 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>;
@@ -57,10 +57,10 @@ 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?: Options): T;
60
+ deserialize(value: any, options?: OptionsHelper): T;
61
61
  private toJson;
62
- serialize(value: T, options?: Options): any;
63
- encode(value: T, options?: Options): string;
62
+ serialize(value: T, options?: OptionsHelper): any;
63
+ encode(value: T, options?: OptionsHelper): string;
64
64
  configure({ parserForType, options, }: {
65
65
  parserForType: (type: string) => Parser<any>;
66
66
  options: OptionsHelper;
@@ -97,9 +97,9 @@ 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?: Options): T;
101
- serialize(value: T, options?: Options): any;
102
- encode(value: T, options?: Options): any;
100
+ deserialize(value: any, options?: OptionsHelper): T;
101
+ serialize(value: T, options?: OptionsHelper): any;
102
+ encode(value: T, options?: OptionsHelper): any;
103
103
  configure({ parserForType, options, }: {
104
104
  parserForType: (type: string) => Parser<any>;
105
105
  options: OptionsHelper;
@@ -1,6 +1,6 @@
1
1
  import { ODataCollection } from '../models';
2
2
  import { ODataModel } from '../models/model';
3
- import { Options, StructuredTypeConfig } from '../types';
3
+ import { OptionsHelper, 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?: Options): T;
99
+ deserialize(value: any, options?: OptionsHelper): 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?: Options): any;
106
+ serialize(value: T, options?: OptionsHelper): 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?: Options): any;
113
+ encode(value: T, options?: OptionsHelper): any;
114
114
  /**
115
115
  * Resolve the key of the structured type for the given value.
116
116
  * @param attrs Attributes of the value
package/lib/types.d.ts CHANGED
@@ -33,11 +33,8 @@ export declare enum QueryOptionNames {
33
33
  levels = "levels",
34
34
  count = "count"
35
35
  }
36
- export interface Options {
36
+ export interface ApiOptions {
37
37
  version?: ODataVersion;
38
- stringAsEnum?: boolean;
39
- }
40
- export interface ApiOptions extends Options {
41
38
  params?: {
42
39
  [param: string]: string | string[];
43
40
  };
@@ -64,9 +61,12 @@ export interface ApiOptions extends Options {
64
61
  stripMetadata?: ODataMetadataType;
65
62
  fetchPolicy?: FetchPolicy;
66
63
  bodyQueryOptions?: QueryOptionNames[];
64
+ stringAsEnum?: boolean;
67
65
  deleteRefBy?: 'path' | 'id';
66
+ nonParenthesisForEmptyParameterFunction?: boolean;
68
67
  }
69
- export interface OptionsHelper extends Options {
68
+ export interface OptionsHelper {
69
+ version?: ODataVersion;
70
70
  helper: ODataVersionHelper;
71
71
  exponentialDecimals?: boolean;
72
72
  metadata?: ODataMetadataType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-odata",
3
- "version": "0.99.5",
3
+ "version": "0.100.0",
4
4
  "license": "MIT",
5
5
  "description": "Client side OData typescript library for Angular",
6
6
  "repository": {