angular-odata 0.99.0 → 0.99.2

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 (46) hide show
  1. package/README.md +31 -25
  2. package/esm2020/lib/client.mjs +3 -3
  3. package/esm2020/lib/models/collection.mjs +23 -7
  4. package/esm2020/lib/models/model.mjs +1 -1
  5. package/esm2020/lib/models/options.mjs +25 -14
  6. package/esm2020/lib/module.mjs +4 -4
  7. package/esm2020/lib/resources/resource.mjs +6 -14
  8. package/esm2020/lib/resources/types/action.mjs +4 -1
  9. package/esm2020/lib/resources/types/batch.mjs +6 -1
  10. package/esm2020/lib/resources/types/count.mjs +4 -1
  11. package/esm2020/lib/resources/types/entity-set.mjs +4 -1
  12. package/esm2020/lib/resources/types/entity.mjs +4 -1
  13. package/esm2020/lib/resources/types/function.mjs +4 -1
  14. package/esm2020/lib/resources/types/media.mjs +4 -1
  15. package/esm2020/lib/resources/types/metadata.mjs +4 -1
  16. package/esm2020/lib/resources/types/navigation-property.mjs +4 -1
  17. package/esm2020/lib/resources/types/property.mjs +4 -1
  18. package/esm2020/lib/resources/types/reference.mjs +4 -1
  19. package/esm2020/lib/resources/types/singleton.mjs +4 -1
  20. package/esm2020/lib/resources/types/value.mjs +4 -1
  21. package/esm2020/lib/schema/element.mjs +12 -2
  22. package/esm2020/lib/schema/structured-type.mjs +11 -2
  23. package/esm2020/lib/services/factory.mjs +3 -3
  24. package/fesm2015/angular-odata.mjs +123 -43
  25. package/fesm2015/angular-odata.mjs.map +1 -1
  26. package/fesm2020/angular-odata.mjs +122 -43
  27. package/fesm2020/angular-odata.mjs.map +1 -1
  28. package/lib/models/model.d.ts +1 -1
  29. package/lib/models/options.d.ts +3 -3
  30. package/lib/resources/resource.d.ts +2 -1
  31. package/lib/resources/types/action.d.ts +1 -0
  32. package/lib/resources/types/batch.d.ts +1 -0
  33. package/lib/resources/types/count.d.ts +1 -0
  34. package/lib/resources/types/entity-set.d.ts +1 -0
  35. package/lib/resources/types/entity.d.ts +1 -0
  36. package/lib/resources/types/function.d.ts +1 -0
  37. package/lib/resources/types/media.d.ts +1 -0
  38. package/lib/resources/types/metadata.d.ts +1 -0
  39. package/lib/resources/types/navigation-property.d.ts +1 -0
  40. package/lib/resources/types/property.d.ts +1 -0
  41. package/lib/resources/types/reference.d.ts +1 -0
  42. package/lib/resources/types/singleton.d.ts +1 -0
  43. package/lib/resources/types/value.d.ts +1 -0
  44. package/lib/schema/element.d.ts +7 -1
  45. package/lib/schema/structured-type.d.ts +7 -1
  46. package/package.json +1 -1
@@ -45,7 +45,7 @@ export declare class ODataModel<T> {
45
45
  resource(): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>;
46
46
  navigationProperty<N>(name: keyof T | string): ODataNavigationPropertyResource<N>;
47
47
  property<N>(name: string): ODataPropertyResource<N>;
48
- attach(resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>): void;
48
+ attach<R>(resource: ODataEntityResource<R> | ODataNavigationPropertyResource<R> | ODataPropertyResource<R> | ODataSingletonResource<R>): void;
49
49
  schema(): ODataStructuredType<T>;
50
50
  annots(): ODataEntityAnnotations;
51
51
  key({ field_mapping, resolve, }?: {
@@ -170,13 +170,13 @@ export declare class ODataModelOptions<T> {
170
170
  include_parents?: boolean;
171
171
  include_navigation?: boolean;
172
172
  }): ODataModelField<any>[];
173
- field<F>(name: keyof T | string): ODataModelField<any>;
174
- attach(self: ODataModel<T>, resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>): void;
173
+ field<F>(name: keyof T | string): ODataModelField<F>;
174
+ attach<R>(self: ODataModel<T>, resource: ODataEntityResource<R> | ODataNavigationPropertyResource<R> | ODataPropertyResource<R> | ODataSingletonResource<R>): void;
175
175
  static chain(child: ODataModel<any> | ODataCollection<any, ODataModel<any>>): [
176
176
  ODataModel<any> | ODataCollection<any, ODataModel<any>>,
177
177
  ODataModelField<any> | null
178
178
  ][];
179
- static resource<T>(child: ODataModel<T> | ODataCollection<T, ODataModel<T>>): ODataResource<T> | ODataResource<T>;
179
+ static resource<T>(child: ODataModel<T> | ODataCollection<T, ODataModel<T>>): ODataResource<T>;
180
180
  collectionResourceFactory(query?: ODataQueryOptions<T>): ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | undefined;
181
181
  modelResourceFactory(query?: ODataQueryOptions<T>): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | undefined;
182
182
  entityResource(self: ODataModel<T>): ODataResource<T>;
@@ -51,13 +51,14 @@ export declare class ODataResource<T> {
51
51
  reset?: boolean;
52
52
  }): C;
53
53
  isSubtypeOf(other: ODataResource<any>): boolean;
54
+ isSupertypeOf(other: ODataResource<any>): boolean;
54
55
  isEqualTo(other: ODataResource<any>, test?: 'path' | 'params'): boolean;
55
56
  pathAndParams(escape?: boolean): [string, {
56
57
  [name: string]: any;
57
58
  }];
58
59
  endpointUrl(params?: boolean): string;
59
60
  toString(): string;
60
- clone<R extends ODataResource<T>>(): R;
61
+ clone(): ODataResource<T>;
61
62
  deserialize(value: any, options?: OptionsHelper): any;
62
63
  serialize(value: any, options?: OptionsHelper): any;
63
64
  encode(value: any, options?: OptionsHelper): any;
@@ -15,6 +15,7 @@ export declare class ODataActionResource<P, R> extends ODataResource<R> {
15
15
  query?: ODataQueryOptions<R>;
16
16
  }): ODataActionResource<P, R>;
17
17
  static fromResource<P, R>(resource: ODataResource<any>, path: string): ODataActionResource<P, R>;
18
+ clone(): ODataActionResource<P, R>;
18
19
  returnType(): string | undefined;
19
20
  protected post(params: P | null, options?: ODataEntityOptions & ODataEntitiesOptions & ODataPropertyOptions): Observable<any>;
20
21
  /**
@@ -25,6 +25,7 @@ export declare class ODataBatchResource extends ODataResource<any> {
25
25
  private _requests;
26
26
  requests(): ODataRequest<any>[];
27
27
  static factory(api: ODataApi): ODataBatchResource;
28
+ clone(): ODataBatchResource;
28
29
  private storeRequester;
29
30
  private restoreRequester;
30
31
  /**
@@ -9,6 +9,7 @@ export declare class ODataCountResource<T> extends ODataResource<T> {
9
9
  segments: ODataPathSegments;
10
10
  query?: ODataQueryOptions<T>;
11
11
  }): ODataCountResource<T>;
12
+ clone(): ODataCountResource<T>;
12
13
  protected get(options?: ODataOptions): Observable<number>;
13
14
  /**
14
15
  * Fetch the count of the set.
@@ -17,6 +17,7 @@ export declare class ODataEntitySetResource<T> extends ODataResource<T> {
17
17
  schema?: ODataStructuredType<E>;
18
18
  query?: ODataQueryOptions<E>;
19
19
  }): ODataEntitySetResource<E>;
20
+ clone(): ODataEntitySetResource<T>;
20
21
  entity(key?: any): ODataEntityResource<T>;
21
22
  action<P, R>(path: string): ODataActionResource<P, R>;
22
23
  function<P, R>(path: string): ODataFunctionResource<P, R>;
@@ -19,6 +19,7 @@ export declare class ODataEntityResource<T> extends ODataResource<T> {
19
19
  segments: ODataPathSegments;
20
20
  query?: ODataQueryOptions<E>;
21
21
  }): ODataEntityResource<E>;
22
+ clone(): ODataEntityResource<T>;
22
23
  key(value: any): ODataEntityResource<T>;
23
24
  keys(values: any[]): ODataEntityResource<T>;
24
25
  media(): ODataMediaResource;
@@ -16,6 +16,7 @@ export declare class ODataFunctionResource<P, R> extends ODataResource<R> {
16
16
  query?: ODataQueryOptions<R>;
17
17
  }): ODataFunctionResource<P, R>;
18
18
  static fromResource<P, R>(resource: ODataResource<any>, path: string): ODataFunctionResource<P, R>;
19
+ clone(): ODataFunctionResource<P, R>;
19
20
  returnType(): string | undefined;
20
21
  parameters(params: P | null, { alias }?: {
21
22
  alias?: boolean;
@@ -9,6 +9,7 @@ export declare class ODataMediaResource extends ODataResource<any> {
9
9
  segments: ODataPathSegments;
10
10
  query?: ODataQueryOptions<V>;
11
11
  }): ODataMediaResource;
12
+ clone(): ODataMediaResource;
12
13
  protected get(options: {
13
14
  responseType: any;
14
15
  } & ODataOptions): Observable<any>;
@@ -7,6 +7,7 @@ import { ODataOptions } from './options';
7
7
  export declare class ODataMetadataResource extends ODataResource<any> {
8
8
  constructor(api: ODataApi, segments?: ODataPathSegments);
9
9
  static factory(api: ODataApi): ODataMetadataResource;
10
+ clone(): ODataMetadataResource;
10
11
  protected get(options?: ODataOptions): Observable<ODataMetadata>;
11
12
  fetch(options?: ODataOptions): Observable<ODataMetadata>;
12
13
  }
@@ -26,6 +26,7 @@ export declare class ODataNavigationPropertyResource<T> extends ODataResource<T>
26
26
  query?: ODataQueryOptions<N>;
27
27
  }): ODataNavigationPropertyResource<N>;
28
28
  static fromResource<N>(resource: ODataResource<any>, path: string): ODataNavigationPropertyResource<N>;
29
+ clone(): ODataNavigationPropertyResource<T>;
29
30
  key(value: any): ODataNavigationPropertyResource<T>;
30
31
  keys(values: any[]): ODataNavigationPropertyResource<T>;
31
32
  media(): ODataMediaResource;
@@ -17,6 +17,7 @@ export declare class ODataPropertyResource<T> extends ODataResource<T> {
17
17
  query?: ODataQueryOptions<P>;
18
18
  }): ODataPropertyResource<P>;
19
19
  static fromResource<N>(resource: ODataResource<any>, path: string): ODataPropertyResource<N>;
20
+ clone(): ODataPropertyResource<T>;
20
21
  key(value: any): ODataPropertyResource<T>;
21
22
  keys(values: any[]): ODataPropertyResource<T>;
22
23
  value(): ODataValueResource<T>;
@@ -12,6 +12,7 @@ export declare class ODataReferenceResource<T> extends ODataResource<T> {
12
12
  segments: ODataPathSegments;
13
13
  query?: ODataQueryOptions<P>;
14
14
  }): ODataReferenceResource<P>;
15
+ clone(): ODataReferenceResource<T>;
15
16
  protected post(target: ODataEntityResource<any>, options?: ODataOptions): Observable<any>;
16
17
  protected put(target: ODataEntityResource<any>, options?: ODataOptions & {
17
18
  etag?: string;
@@ -17,6 +17,7 @@ export declare class ODataSingletonResource<T> extends ODataResource<T> {
17
17
  schema?: ODataStructuredType<S>;
18
18
  query?: ODataQueryOptions<S>;
19
19
  }): ODataSingletonResource<S>;
20
+ clone(): ODataSingletonResource<T>;
20
21
  key(value: any): ODataSingletonResource<T>;
21
22
  keys(values: any[]): ODataSingletonResource<T>;
22
23
  navigationProperty<N>(path: string): ODataNavigationPropertyResource<N>;
@@ -12,6 +12,7 @@ export declare class ODataValueResource<T> extends ODataResource<T> {
12
12
  segments: ODataPathSegments;
13
13
  query?: ODataQueryOptions<V>;
14
14
  }): ODataValueResource<V>;
15
+ clone(): ODataValueResource<T>;
15
16
  protected get(options?: ODataOptions): Observable<T>;
16
17
  /**
17
18
  * Fetch the value of the resource.
@@ -31,9 +31,15 @@ export declare class ODataSchemaElement extends ODataAnnotatable {
31
31
  */
32
32
  isTypeOf(type: string): boolean;
33
33
  /**
34
- * Returns a boolean indicating if the structured type is a sub type of the given type.
34
+ * Returns a boolean indicating if the structured type is a subtype of the given type.
35
35
  * @param type String representation of the type
36
36
  * @returns True if the callable is type of the given type
37
37
  */
38
38
  isSubtypeOf(schema: ODataSchemaElement): boolean;
39
+ /**
40
+ * Returns a boolean indicating if the structured type is a supertype of the given type.
41
+ * @param type String representation of the type
42
+ * @returns True if the callable is type of the given type
43
+ */
44
+ isSupertypeOf(schema: ODataSchemaElement): boolean;
39
45
  }
@@ -18,11 +18,17 @@ export declare class ODataStructuredType<T> extends ODataSchemaElement {
18
18
  findOptionsForType: (type: string) => any;
19
19
  }): void;
20
20
  /**
21
- * Returns a boolean indicating if the structured type is a sub type of the given type.
21
+ * Returns a boolean indicating if the structured type is a subtype of the given type.
22
22
  * @param type String representation of the type
23
23
  * @returns True if the callable is type of the given type
24
24
  */
25
25
  isSubtypeOf(schema: ODataStructuredType<any>): boolean;
26
+ /**
27
+ * Returns a boolean indicating if the structured type is a supertype of the given type.
28
+ * @param type String representation of the type
29
+ * @returns True if the callable is type of the given type
30
+ */
31
+ isSupertypeOf(schema: ODataStructuredType<any>): boolean;
26
32
  /**
27
33
  * Returns a boolean indicating if the structured type has a simple key.
28
34
  * @returns True if the structured type has a simple key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-odata",
3
- "version": "0.99.0",
3
+ "version": "0.99.2",
4
4
  "license": "MIT",
5
5
  "description": "Client side OData typescript library for Angular",
6
6
  "repository": {