angular-odata 0.131.0 → 0.140.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 (139) hide show
  1. package/fesm2022/angular-odata.mjs +276 -543
  2. package/fesm2022/angular-odata.mjs.map +1 -1
  3. package/index.d.ts +6403 -3
  4. package/package.json +3 -3
  5. package/schematics/apigen/angular/base.js +2 -6
  6. package/schematics/apigen/angular/base.js.map +1 -1
  7. package/schematics/apigen/angular/entity.js +1 -2
  8. package/schematics/apigen/angular/entity.js.map +1 -1
  9. package/schematics/apigen/index.js +2 -6
  10. package/schematics/apigen/index.js.map +1 -1
  11. package/schematics/apigen/metadata/csdl/csdl-annotation.js +1 -2
  12. package/schematics/apigen/metadata/csdl/csdl-annotation.js.map +1 -1
  13. package/schematics/apigen/metadata/csdl/csdl-entity-container.js.map +1 -1
  14. package/schematics/apigen/metadata/csdl/csdl-entity-set.js.map +1 -1
  15. package/schematics/apigen/metadata/csdl/csdl-enum-type.d.ts +1 -1
  16. package/schematics/apigen/metadata/csdl/csdl-enum-type.js +1 -1
  17. package/schematics/apigen/metadata/csdl/csdl-enum-type.js.map +1 -1
  18. package/schematics/apigen/metadata/csdl/csdl-function-action.d.ts +1 -1
  19. package/schematics/apigen/metadata/csdl/csdl-reference.js +1 -2
  20. package/schematics/apigen/metadata/csdl/csdl-reference.js.map +1 -1
  21. package/schematics/apigen/metadata/csdl/csdl-schema.js +1 -2
  22. package/schematics/apigen/metadata/csdl/csdl-schema.js.map +1 -1
  23. package/schematics/apigen/metadata/csdl/csdl-singleton.js.map +1 -1
  24. package/schematics/apigen/metadata/csdl/csdl-structural-property.d.ts +1 -1
  25. package/schematics/apigen/metadata/csdl/csdl-structural-property.js +2 -3
  26. package/schematics/apigen/metadata/csdl/csdl-structural-property.js.map +1 -1
  27. package/schematics/apigen/metadata/csdl/csdl-structured-type.d.ts +1 -1
  28. package/schematics/apigen/metadata/csdl/csdl-structured-type.js +1 -2
  29. package/schematics/apigen/metadata/csdl/csdl-structured-type.js.map +1 -1
  30. package/schematics/apigen/metadata/parser.js +1 -3
  31. package/schematics/apigen/metadata/parser.js.map +1 -1
  32. package/schematics/apigen/utils.js +2 -4
  33. package/schematics/apigen/utils.js.map +1 -1
  34. package/lib/annotations.d.ts +0 -75
  35. package/lib/api.d.ts +0 -107
  36. package/lib/cache/cache.d.ts +0 -104
  37. package/lib/cache/index.d.ts +0 -3
  38. package/lib/cache/memory.d.ts +0 -19
  39. package/lib/cache/storage.d.ts +0 -35
  40. package/lib/client.d.ts +0 -613
  41. package/lib/constants.d.ts +0 -70
  42. package/lib/helper.d.ts +0 -75
  43. package/lib/index.d.ts +0 -14
  44. package/lib/loaders.d.ts +0 -21
  45. package/lib/metadata/csdl/csdl-annotation.d.ts +0 -159
  46. package/lib/metadata/csdl/csdl-entity-container.d.ts +0 -31
  47. package/lib/metadata/csdl/csdl-entity-set.d.ts +0 -25
  48. package/lib/metadata/csdl/csdl-enum-type.d.ts +0 -37
  49. package/lib/metadata/csdl/csdl-function-action.d.ts +0 -148
  50. package/lib/metadata/csdl/csdl-navigation-property-binding.d.ts +0 -12
  51. package/lib/metadata/csdl/csdl-reference.d.ts +0 -53
  52. package/lib/metadata/csdl/csdl-schema.d.ts +0 -37
  53. package/lib/metadata/csdl/csdl-singleton.d.ts +0 -21
  54. package/lib/metadata/csdl/csdl-structural-property.d.ts +0 -86
  55. package/lib/metadata/csdl/csdl-structured-type.d.ts +0 -94
  56. package/lib/metadata/csdl/csdl-type-definition.d.ts +0 -25
  57. package/lib/metadata/index.d.ts +0 -2
  58. package/lib/metadata/metadata.d.ts +0 -23
  59. package/lib/metadata/parser.d.ts +0 -110
  60. package/lib/models/collection.d.ts +0 -183
  61. package/lib/models/index.d.ts +0 -3
  62. package/lib/models/model.d.ts +0 -176
  63. package/lib/models/options.d.ts +0 -368
  64. package/lib/module.d.ts +0 -19
  65. package/lib/options.d.ts +0 -101
  66. package/lib/resources/index.d.ts +0 -6
  67. package/lib/resources/options.d.ts +0 -18
  68. package/lib/resources/path/handlers.d.ts +0 -29
  69. package/lib/resources/path/index.d.ts +0 -2
  70. package/lib/resources/path/segments.d.ts +0 -54
  71. package/lib/resources/query/builder.d.ts +0 -103
  72. package/lib/resources/query/expressions/apply.d.ts +0 -125
  73. package/lib/resources/query/expressions/base.d.ts +0 -25
  74. package/lib/resources/query/expressions/compute.d.ts +0 -39
  75. package/lib/resources/query/expressions/count.d.ts +0 -58
  76. package/lib/resources/query/expressions/expand.d.ts +0 -69
  77. package/lib/resources/query/expressions/filter.d.ts +0 -77
  78. package/lib/resources/query/expressions/index.d.ts +0 -9
  79. package/lib/resources/query/expressions/orderby.d.ts +0 -55
  80. package/lib/resources/query/expressions/search.d.ts +0 -63
  81. package/lib/resources/query/expressions/select.d.ts +0 -34
  82. package/lib/resources/query/expressions/syntax.d.ts +0 -313
  83. package/lib/resources/query/handlers.d.ts +0 -270
  84. package/lib/resources/query/index.d.ts +0 -4
  85. package/lib/resources/query/options.d.ts +0 -60
  86. package/lib/resources/request.d.ts +0 -64
  87. package/lib/resources/resource.d.ts +0 -161
  88. package/lib/resources/response.d.ts +0 -82
  89. package/lib/resources/types/action.d.ts +0 -84
  90. package/lib/resources/types/batch.d.ts +0 -62
  91. package/lib/resources/types/count.d.ts +0 -20
  92. package/lib/resources/types/entity-set.d.ts +0 -79
  93. package/lib/resources/types/entity.d.ts +0 -54
  94. package/lib/resources/types/function.d.ts +0 -108
  95. package/lib/resources/types/index.d.ts +0 -14
  96. package/lib/resources/types/media.d.ts +0 -28
  97. package/lib/resources/types/metadata.d.ts +0 -13
  98. package/lib/resources/types/navigation-property.d.ts +0 -157
  99. package/lib/resources/types/options.d.ts +0 -32
  100. package/lib/resources/types/property.d.ts +0 -115
  101. package/lib/resources/types/reference.d.ts +0 -74
  102. package/lib/resources/types/singleton.d.ts +0 -87
  103. package/lib/resources/types/value.d.ts +0 -19
  104. package/lib/schema/annotation.d.ts +0 -28
  105. package/lib/schema/callable.d.ts +0 -41
  106. package/lib/schema/element.d.ts +0 -52
  107. package/lib/schema/entity-container.d.ts +0 -10
  108. package/lib/schema/entity-set.d.ts +0 -10
  109. package/lib/schema/enum-type.d.ts +0 -55
  110. package/lib/schema/index.d.ts +0 -8
  111. package/lib/schema/parsers/callable.d.ts +0 -47
  112. package/lib/schema/parsers/edm.d.ts +0 -4
  113. package/lib/schema/parsers/enum-type.d.ts +0 -56
  114. package/lib/schema/parsers/index.d.ts +0 -4
  115. package/lib/schema/parsers/structured-type.d.ts +0 -172
  116. package/lib/schema/schema.d.ts +0 -26
  117. package/lib/schema/singleton.d.ts +0 -10
  118. package/lib/schema/structured-type.d.ts +0 -152
  119. package/lib/services/base.d.ts +0 -20
  120. package/lib/services/entity-set.d.ts +0 -120
  121. package/lib/services/entity.d.ts +0 -11
  122. package/lib/services/factory.d.ts +0 -33
  123. package/lib/services/index.d.ts +0 -4
  124. package/lib/services/singleton.d.ts +0 -44
  125. package/lib/settings.d.ts +0 -26
  126. package/lib/types.d.ts +0 -285
  127. package/lib/utils/arraybuffers.d.ts +0 -4
  128. package/lib/utils/arrays.d.ts +0 -3
  129. package/lib/utils/dates.d.ts +0 -3
  130. package/lib/utils/durations.d.ts +0 -14
  131. package/lib/utils/enums.d.ts +0 -23
  132. package/lib/utils/http.d.ts +0 -22
  133. package/lib/utils/index.d.ts +0 -9
  134. package/lib/utils/objects.d.ts +0 -37
  135. package/lib/utils/odata.d.ts +0 -4
  136. package/lib/utils/strings.d.ts +0 -7
  137. package/lib/utils/types.d.ts +0 -11
  138. package/lib/utils/urls.d.ts +0 -4
  139. package/public-api.d.ts +0 -1
@@ -1,176 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { EntityKey, ODataActionOptions, ODataEntityResource, ODataFunctionOptions, ODataNavigationPropertyResource, ODataOptions, ODataPropertyResource, ODataQueryArgumentsOptions, ODataQueryOptionsHandler, ODataResource, ODataSingletonResource } from '../resources';
3
- import { ODataStructuredType } from '../schema';
4
- import { ODataCollection } from './collection';
5
- import { ModelOptions, ODataModelField, ODataModelOptions, ODataModelAttribute, ODataModelEventEmitter, ModelInterface } from './options';
6
- import { EdmType, ParserOptions } from '../types';
7
- import { ODataEntityAnnotations } from '../annotations';
8
- export declare class ODataModel<T> {
9
- static options: ModelOptions;
10
- static meta: ODataModelOptions<any>;
11
- _parent: [
12
- ODataModel<any> | ODataCollection<any, ODataModel<any>>,
13
- ODataModelField<any> | null
14
- ] | null;
15
- _resource: ODataResource<T> | null;
16
- _resources: {
17
- parent: [
18
- ODataModel<any> | ODataCollection<any, ODataModel<any>>,
19
- ODataModelField<any> | null
20
- ] | null;
21
- resource: ODataResource<T> | null;
22
- }[];
23
- _attributes: Map<string, ODataModelAttribute<any>>;
24
- _annotations: ODataEntityAnnotations<T>;
25
- _meta: ODataModelOptions<any>;
26
- events$: ODataModelEventEmitter<T>;
27
- static buildMetaOptions<T>({ config, structuredType, }: {
28
- config?: ModelOptions;
29
- structuredType: ODataStructuredType<T>;
30
- }): ODataModelOptions<T>;
31
- constructor(data?: Partial<T> | {
32
- [name: string]: any;
33
- }, { parent, resource, annots, reset, }?: {
34
- parent?: [
35
- ODataModel<any> | ODataCollection<any, ODataModel<any>>,
36
- ODataModelField<any> | null
37
- ];
38
- resource?: ODataResource<T> | null;
39
- annots?: ODataEntityAnnotations<T>;
40
- reset?: boolean;
41
- });
42
- resource(): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | null;
43
- pushResource(resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | null): void;
44
- popResource(): {
45
- parent: [ODataModel<any> | ODataCollection<any, ODataModel<any>>, ODataModelField<any> | null] | null;
46
- resource: ODataResource<T> | null;
47
- } | undefined;
48
- navigationProperty<N>(name: keyof T | string): ODataNavigationPropertyResource<N>;
49
- property<N>(name: string): ODataPropertyResource<N>;
50
- attach(resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>): void;
51
- schema(): ODataStructuredType<any>;
52
- annots(): ODataEntityAnnotations<T>;
53
- key({ field_mapping, resolve, }?: {
54
- field_mapping?: boolean;
55
- resolve?: boolean;
56
- }): EntityKey<T> | {
57
- [name: string]: any;
58
- } | undefined;
59
- isOpenModel(): boolean;
60
- isParentOf(child: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
61
- referential(attr: ODataModelAttribute<any> | ODataModelField<any>, { field_mapping, resolve, }?: {
62
- field_mapping?: boolean;
63
- resolve?: boolean;
64
- }): {
65
- [name: string]: any;
66
- } | null | undefined;
67
- referenced(attr: ODataModelAttribute<any> | ODataModelField<any>, { field_mapping, resolve, }?: {
68
- field_mapping?: boolean;
69
- resolve?: boolean;
70
- }): {
71
- [name: string]: any;
72
- } | null | undefined;
73
- _errors?: {
74
- [name: string]: any;
75
- };
76
- validate({ method, navigation, }?: {
77
- method?: 'create' | 'update' | 'modify';
78
- navigation?: boolean;
79
- }): {
80
- [name: string]: string[];
81
- } | undefined;
82
- isValid({ method, navigation, }?: {
83
- method?: 'create' | 'update' | 'modify';
84
- navigation?: boolean;
85
- }): boolean;
86
- defaults(): any;
87
- toEntity({ client_id, include_navigation, include_concurrency, include_computed, include_key, include_id, include_non_field, changes_only, field_mapping, chain, }?: {
88
- client_id?: boolean;
89
- include_navigation?: boolean;
90
- include_concurrency?: boolean;
91
- include_computed?: boolean;
92
- include_key?: boolean;
93
- include_id?: boolean;
94
- include_non_field?: boolean;
95
- changes_only?: boolean;
96
- field_mapping?: boolean;
97
- chain?: (ODataModel<any> | ODataCollection<any, ODataModel<any>>)[];
98
- }): T | {
99
- [name: string]: any;
100
- };
101
- toJson(): T | {
102
- [name: string]: any;
103
- };
104
- set(path: keyof T | string | string[], value: any, { type }?: {
105
- type?: EdmType | string;
106
- }): any;
107
- get(path: keyof T | string | string[]): any;
108
- has(path: keyof T | string | string[]): boolean;
109
- reset({ path, silent, }?: {
110
- path?: keyof T | string | string[];
111
- silent?: boolean;
112
- }): void;
113
- clear({ silent }?: {
114
- silent?: boolean;
115
- }): void;
116
- assign(entity: Partial<T> | {
117
- [name: string]: any;
118
- }, { add, merge, remove, reset, reparent, silent, }?: {
119
- add?: boolean;
120
- merge?: boolean;
121
- remove?: boolean;
122
- reset?: boolean;
123
- reparent?: boolean;
124
- silent?: boolean;
125
- }): this;
126
- clone<M extends ODataModel<T>>(): M;
127
- private _request;
128
- fetch({ ...options }?: ODataOptions & {
129
- options?: ODataOptions;
130
- }): Observable<this>;
131
- save({ method, navigation, validate, ...options }?: ODataOptions & {
132
- method?: 'create' | 'update' | 'modify';
133
- navigation?: boolean;
134
- validate?: boolean;
135
- options?: ODataOptions;
136
- }): Observable<this>;
137
- destroy({ ...options }?: ODataOptions & {
138
- options?: ODataOptions;
139
- }): Observable<any>;
140
- /**
141
- * Create an execution context for change the internal query of a resource
142
- * @param ctx Function to execute
143
- */
144
- query(ctx: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): this;
145
- /**
146
- * Perform a check on the internal state of the model and return true if the model is changed.
147
- * @param include_navigation Check in navigation properties
148
- * @returns true if the model has changed, false otherwise
149
- */
150
- hasChanged({ include_navigation, }?: {
151
- include_navigation?: boolean;
152
- }): boolean;
153
- encode<E>(name: keyof T, options?: ParserOptions): any;
154
- isNew(): boolean;
155
- withResource<R>(resource: any, ctx: (model: this) => R): R;
156
- /**
157
- * Create an execution context for a given function, where the model is bound to its entity endpoint
158
- * @param ctx Context function
159
- * @returns The result of the context
160
- */
161
- asEntity<R>(ctx: (model: this) => R): R;
162
- callFunction<P, R>(name: string, params: P | null, responseType: 'property' | 'model' | 'collection' | 'none' | 'blob' | 'arraybuffer', options?: ODataFunctionOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null | Blob | ArrayBuffer>;
163
- callAction<P, R>(name: string, params: P | null, responseType?: 'property' | 'model' | 'collection' | 'none' | 'blob' | 'arraybuffer', { ...options }?: {} & ODataActionOptions<R>): Observable<R | ODataModel<R> | ODataCollection<R, ODataModel<R>> | null | Blob | ArrayBuffer>;
164
- cast<S>(type: string, ModelType?: typeof ODataModel): ODataModel<T> & ModelInterface<T>;
165
- cast<S, M extends ODataModel<S>>(type: string, ModelType?: typeof ODataModel): M;
166
- fetchNavigationProperty<S>(name: keyof T | string, responseType: 'model' | 'collection', options?: ODataQueryArgumentsOptions<S>): Observable<ODataModel<S> | ODataCollection<S, ODataModel<S>> | null>;
167
- fetchAttribute<P>(name: keyof T, options?: ODataQueryArgumentsOptions<P>): Observable<P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null>;
168
- getAttribute<P>(name: keyof T | string): P | ODataModel<P> | ODataCollection<P, ODataModel<P>> | null;
169
- setAttribute<N>(name: keyof T, model: ODataModel<N> | ODataCollection<N, ODataModel<N>> | null, options?: ODataOptions): Observable<this>;
170
- setReference<N>(name: keyof T | string, model: ODataModel<N> | ODataCollection<N, ODataModel<N>> | null, options?: ODataOptions): Observable<this>;
171
- get [Symbol.toStringTag](): string;
172
- equals(other: ODataModel<T>): boolean;
173
- collection(): ODataCollection<T, ODataModel<T>> | undefined;
174
- next(): ODataModel<T> | undefined;
175
- prev(): ODataModel<T> | undefined;
176
- }
@@ -1,368 +0,0 @@
1
- import { Subscription } from 'rxjs';
2
- import { EntityKey, ODataQueryOptions, ODataQueryOptionsHandler, ODataResource, ODataSingletonResource } from '../resources';
3
- import { ODataEntityResource, ODataEntitySetResource, ODataNavigationPropertyResource, ODataPropertyResource } from '../resources';
4
- import { ODataEntitySet, ODataEnumType, ODataStructuredType, ODataStructuredTypeFieldParser } from '../schema';
5
- import { EdmType, ParserOptions } from '../types';
6
- import { ODataCollection } from './collection';
7
- import { ODataModel } from './model';
8
- import { EventEmitter } from '@angular/core';
9
- import { ODataEntitiesAnnotations, ODataEntityAnnotations } from '../annotations';
10
- export declare enum ODataModelEventType {
11
- Change = "change",
12
- Reset = "reset",
13
- Update = "update",
14
- Sort = "sort",
15
- Destroy = "destroy",
16
- Add = "add",
17
- Remove = "remove",
18
- Invalid = "invalid",
19
- Request = "request",
20
- Sync = "sync",
21
- Attach = "attach"
22
- }
23
- export declare class ODataModelEvent<T> {
24
- type: ODataModelEventType | string;
25
- value?: any;
26
- previous?: any;
27
- options?: any;
28
- constructor(type: ODataModelEventType | string, { model, collection, previous, value, attr, options, bubbles, chain, }?: {
29
- model?: ODataModel<T>;
30
- collection?: ODataCollection<T, ODataModel<T>>;
31
- attr?: ODataModelAttribute<any> | number;
32
- previous?: any;
33
- value?: any;
34
- options?: any;
35
- bubbles?: boolean;
36
- chain?: [
37
- ODataModel<any> | ODataCollection<any, ODataModel<any>>,
38
- ODataModelAttribute<any> | number | null
39
- ][];
40
- });
41
- chain: [
42
- ODataModel<any> | ODataCollection<any, ODataModel<any>>,
43
- ODataModelAttribute<any> | number | null
44
- ][];
45
- push(model: ODataModel<any> | ODataCollection<any, ODataModel<any>>, attr: ODataModelAttribute<any> | number): ODataModelEvent<any>;
46
- bubbles: boolean;
47
- stopPropagation(): void;
48
- visited(model: ODataModel<any> | ODataCollection<any, ODataModel<any>>): boolean;
49
- canContinueWith(self: ODataModel<T> | ODataCollection<T, ODataModel<T>>): boolean;
50
- get path(): string;
51
- model?: ODataModel<T>;
52
- get currentModel(): ODataModel<any> | undefined;
53
- collection?: ODataCollection<T, ODataModel<T>>;
54
- get currentCollection(): ODataCollection<any, ODataModel<any>> | undefined;
55
- }
56
- export declare class ODataModelEventEmitter<T> extends EventEmitter<ODataModelEvent<T>> {
57
- model?: ODataModel<T>;
58
- collection?: ODataCollection<T, ODataModel<T>>;
59
- constructor({ model, collection, }?: {
60
- model?: ODataModel<T>;
61
- collection?: ODataCollection<T, ODataModel<T>>;
62
- });
63
- trigger(type: ODataModelEventType | string, { collection, previous, value, attr, options, bubbles, }?: {
64
- collection?: ODataCollection<T, ODataModel<T>>;
65
- attr?: ODataModelAttribute<any> | number;
66
- previous?: any;
67
- value?: any;
68
- options?: any;
69
- bubbles?: boolean;
70
- }): void;
71
- }
72
- export declare const BUBBLES: (ODataModelEventType | string)[];
73
- export declare const INCLUDE_SHALLOW: {
74
- include_concurrency: boolean;
75
- include_computed: boolean;
76
- include_key: boolean;
77
- include_id: boolean;
78
- };
79
- export declare const INCLUDE_DEEP: {
80
- include_concurrency: boolean;
81
- include_computed: boolean;
82
- include_key: boolean;
83
- include_id: boolean;
84
- include_navigation: boolean;
85
- include_non_field: boolean;
86
- };
87
- export declare enum ODataModelState {
88
- Added = 0,
89
- Removed = 1,
90
- Changed = 2,
91
- Unchanged = 3
92
- }
93
- export type ModelInterface<T> = {
94
- [P in keyof T]: T[P] extends (infer U)[] ? ODataCollection<U, ODataModel<U> & ModelInterface<U>> : T[P] extends object ? ODataModel<T[P]> & ModelInterface<T[P]> : T[P];
95
- };
96
- export type ModelOptions = {
97
- cid?: string;
98
- fields: Map<string, ModelFieldOptions>;
99
- };
100
- export type ModelFieldOptions = {
101
- field?: string;
102
- parser?: ODataStructuredTypeFieldParser<any>;
103
- default?: any;
104
- required?: boolean;
105
- concurrency?: boolean;
106
- maxLength?: number;
107
- minLength?: number;
108
- min?: number;
109
- max?: number;
110
- pattern?: RegExp;
111
- };
112
- export declare function Model({ cid }?: {
113
- cid?: string;
114
- }): <T extends {
115
- new (...args: any[]): {};
116
- }>(constructor: T) => T;
117
- export declare function ModelField({ name, ...options }?: {
118
- name?: string;
119
- } & ModelFieldOptions): (target: any, key: string) => void;
120
- export type ODataModelFieldOptions<F> = ModelFieldOptions & {
121
- name: string;
122
- field: string;
123
- parser: ODataStructuredTypeFieldParser<F>;
124
- };
125
- export declare class ODataModelField<F> {
126
- name: string;
127
- field: string;
128
- parser: ODataStructuredTypeFieldParser<F>;
129
- options: ODataModelOptions<any>;
130
- optionsForType?: (type: string) => ODataModelOptions<any> | undefined;
131
- modelForType?: (t: string) => typeof ODataModel<any> | undefined;
132
- collectionForType?: (t: string) => typeof ODataCollection<any, ODataModel<any>> | undefined;
133
- enumForType?: (t: string) => ODataEnumType<F> | undefined;
134
- structuredForType?: (t: string) => ODataStructuredType<F> | undefined;
135
- default?: any;
136
- required: boolean;
137
- concurrency: boolean;
138
- maxLength?: number;
139
- minLength?: number;
140
- min?: number;
141
- max?: number;
142
- pattern?: RegExp;
143
- parserOptions?: ParserOptions;
144
- constructor(options: ODataModelOptions<any>, { name, field, parser, ...opts }: ODataModelFieldOptions<F>);
145
- get type(): string;
146
- get navigation(): boolean;
147
- get collection(): boolean;
148
- annotatedValue<T>(term: string | RegExp): T | undefined;
149
- configure({ optionsForType, modelForType, collectionForType, enumForType, structuredForType, concurrency, options, }: {
150
- optionsForType: (type: string) => ODataModelOptions<any> | undefined;
151
- modelForType: (t: string) => typeof ODataModel<any> | undefined;
152
- collectionForType: (t: string) => typeof ODataCollection<any, any> | undefined;
153
- enumForType: (t: string) => ODataEnumType<any> | undefined;
154
- structuredForType: (t: string) => ODataStructuredType<any> | undefined;
155
- concurrency: boolean;
156
- options: ParserOptions;
157
- }): void;
158
- isKey(): boolean;
159
- hasReferentials(): boolean;
160
- get referentials(): import("angular-odata").ODataReferential[];
161
- isStructuredType(): boolean;
162
- structuredType(): ODataStructuredType<F>;
163
- isEnumType(): boolean;
164
- enumType(): ODataEnumType<F>;
165
- validate(value: any, { method, navigation, }?: {
166
- method?: 'create' | 'update' | 'modify';
167
- navigation?: boolean;
168
- }): any;
169
- defaults(): any;
170
- deserialize(value: any, options?: ParserOptions): F;
171
- serialize(value: F, options?: ParserOptions): any;
172
- encode(value: F, options?: ParserOptions): any;
173
- resourceFactory<T, F>(base: ODataResource<T>): ODataNavigationPropertyResource<F> | ODataPropertyResource<F>;
174
- annotationsFactory<T, F>(base: ODataEntityAnnotations<T>): ODataEntityAnnotations<F> | ODataEntitiesAnnotations<F>;
175
- modelFactory<F>({ parent, value, reset, }: {
176
- parent: ODataModel<any>;
177
- value?: Partial<F> | {
178
- [name: string]: any;
179
- };
180
- reset?: boolean;
181
- }): ODataModel<F>;
182
- collectionFactory<F>({ parent, value, reset, }: {
183
- parent: ODataModel<any>;
184
- value?: Partial<F>[] | {
185
- [name: string]: any;
186
- }[];
187
- reset?: boolean;
188
- }): ODataCollection<F, ODataModel<F>>;
189
- }
190
- export declare class ODataModelAttribute<T> {
191
- private _model;
192
- private _field;
193
- private state;
194
- private value?;
195
- private change?;
196
- private subscription?;
197
- events$: ODataModelEventEmitter<T>;
198
- constructor(_model: ODataModel<any>, _field: ODataModelField<T>);
199
- get type(): string;
200
- get navigation(): boolean;
201
- get computed(): boolean | undefined;
202
- get concurrency(): boolean;
203
- get referentials(): import("angular-odata").ODataReferential[];
204
- get options(): ODataModelOptions<any>;
205
- get name(): string;
206
- get fieldName(): string;
207
- get(): T | ODataModel<T> | ODataCollection<T, ODataModel<T>> | null | undefined;
208
- set(value: T | ODataModel<T> | ODataCollection<T, ODataModel<T>> | null | undefined, reset?: boolean, reparent?: boolean): boolean;
209
- isChanged({ include_navigation, }?: {
210
- include_navigation?: boolean;
211
- }): boolean;
212
- reset(): void;
213
- private link;
214
- private unlink;
215
- }
216
- export type ODataModelEntry<T, M extends ODataModel<T>> = {
217
- state: ODataModelState;
218
- model: M;
219
- key?: EntityKey<T> | {
220
- [name: string]: any;
221
- };
222
- subscription?: Subscription;
223
- };
224
- export declare class ODataModelOptions<T> {
225
- name: string;
226
- cid: string;
227
- base?: string;
228
- private _fields;
229
- structuredType: ODataStructuredType<T>;
230
- entitySet?: ODataEntitySet;
231
- parent?: ODataModelOptions<any>;
232
- children: ODataModelOptions<any>[];
233
- events$: ODataModelEventEmitter<T>;
234
- constructor({ config, structuredType, }: {
235
- config: ModelOptions;
236
- structuredType: ODataStructuredType<T>;
237
- });
238
- get api(): import("angular-odata").ODataApi;
239
- type({ alias }?: {
240
- alias?: boolean;
241
- }): string;
242
- isOpenType(): boolean;
243
- isEntityType(): boolean;
244
- isComplexType(): boolean;
245
- isTypeOf(type: string): boolean;
246
- isModelFor(entity: T | {
247
- [name: string]: any;
248
- }): boolean;
249
- findChildOptions(predicate: (options: ODataModelOptions<any>) => boolean): ODataModelOptions<any> | undefined;
250
- configure({ options }: {
251
- options: ParserOptions;
252
- }): void;
253
- fields({ include_navigation, include_parents, }: {
254
- include_parents: boolean;
255
- include_navigation: boolean;
256
- }): ODataModelField<any>[];
257
- field<F>(name: keyof T | string): ODataModelField<F>;
258
- findField<F>(name: keyof T | string, { reset }?: {
259
- reset?: boolean;
260
- }): ODataModelField<F> | undefined;
261
- addField<F>(name: string, options: ModelFieldOptions): ODataModelField<F>;
262
- tsToEdm: Record<string, EdmType>;
263
- private modelFieldFactory;
264
- attach(self: ODataModel<T>, resource: ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T>): void;
265
- static chain(child: ODataModel<any> | ODataCollection<any, ODataModel<any>>): [
266
- ODataModel<any> | ODataCollection<any, ODataModel<any>>,
267
- ODataModelField<any> | null
268
- ][];
269
- static resource<T>(child: ODataModel<T> | ODataCollection<T, ODataModel<T>>): ODataResource<T> | null;
270
- collectionResourceFactory(query?: ODataQueryOptions<T>): ODataEntitySetResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | null;
271
- modelResourceFactory(query?: ODataQueryOptions<T>): ODataEntityResource<T> | ODataNavigationPropertyResource<T> | ODataPropertyResource<T> | ODataSingletonResource<T> | null;
272
- bind(self: ODataModel<T>, { parent, resource, annots, }?: {
273
- parent?: [
274
- ODataModel<any> | ODataCollection<any, ODataModel<any>>,
275
- ODataModelField<any> | null
276
- ];
277
- resource?: ODataResource<T> | null;
278
- annots?: ODataEntityAnnotations<T>;
279
- }): void;
280
- query(self: ODataModel<T>, resource: ODataEntityResource<T> | ODataPropertyResource<T> | ODataNavigationPropertyResource<T> | ODataSingletonResource<T>, func: (q: ODataQueryOptionsHandler<T>, s?: ODataStructuredType<T>) => void): ODataModel<T>;
281
- resolveKey(value: ODataModel<T> | T | {
282
- [name: string]: any;
283
- }, { field_mapping, resolve, single, }?: {
284
- field_mapping?: boolean;
285
- resolve?: boolean;
286
- single?: boolean;
287
- }): EntityKey<T> | {
288
- [name: string]: any;
289
- } | undefined;
290
- resolveReferential(value: ODataModel<T> | T | {
291
- [name: string]: any;
292
- } | null, attr: ODataModelAttribute<any> | ODataModelField<any>, { field_mapping, resolve, single, }?: {
293
- field_mapping?: boolean;
294
- resolve?: boolean;
295
- single?: boolean;
296
- }): {
297
- [name: string]: any;
298
- } | null | undefined;
299
- resolveReferenced(value: ODataModel<T> | T | {
300
- [name: string]: any;
301
- } | null, attr: ODataModelAttribute<any> | ODataModelField<any>, { field_mapping, resolve, single, }?: {
302
- field_mapping?: boolean;
303
- resolve?: boolean;
304
- single?: boolean;
305
- }): {
306
- [name: string]: any;
307
- } | null | undefined;
308
- validate(self: ODataModel<T>, { method, navigation, }?: {
309
- method?: 'create' | 'update' | 'modify';
310
- navigation?: boolean;
311
- }): {
312
- [name: string]: string[];
313
- } | undefined;
314
- defaults(): T | {
315
- [name: string]: any;
316
- } | undefined;
317
- hasChanged(self: ODataModel<T>, { include_navigation }?: {
318
- include_navigation?: boolean;
319
- }): boolean;
320
- hasKey(self: ODataModel<T>): boolean;
321
- withResource<R, M extends ODataModel<T>>(self: M, resource: ODataEntityResource<T> | ODataPropertyResource<T> | ODataNavigationPropertyResource<T> | ODataSingletonResource<T> | null, ctx: (model: M) => R): R;
322
- asEntity<R, M extends ODataModel<T>>(self: M, ctx: (model: M) => R): R;
323
- toEntity(self: ODataModel<T>, { client_id, include_navigation, include_concurrency, include_computed, include_key, include_id, include_non_field, changes_only, field_mapping, chain, }?: {
324
- client_id?: boolean;
325
- include_navigation?: boolean;
326
- include_concurrency?: boolean;
327
- include_computed?: boolean;
328
- include_key?: boolean;
329
- include_id?: boolean;
330
- include_non_field?: boolean;
331
- changes_only?: boolean;
332
- field_mapping?: boolean;
333
- chain?: (ODataModel<any> | ODataCollection<any, ODataModel<any>>)[];
334
- }): T | {
335
- [name: string]: any;
336
- };
337
- reset(self: ODataModel<T>, { name, silent }?: {
338
- name?: string;
339
- silent?: boolean;
340
- }): void;
341
- assign(self: ODataModel<T>, entity: Partial<T> | {
342
- [name: string]: any;
343
- }, { add, merge, remove, reset, reparent, silent, }?: {
344
- add?: boolean;
345
- merge?: boolean;
346
- remove?: boolean;
347
- reset?: boolean;
348
- reparent?: boolean;
349
- silent?: boolean;
350
- }): ODataModel<T>;
351
- static isModel(obj: any): boolean;
352
- static isCollection(obj: any): boolean;
353
- get<F>(self: ODataModel<T>, field: ODataModelField<F> | string): F | ODataModel<F> | ODataCollection<F, ODataModel<F>> | null | undefined;
354
- set<F>(self: ODataModel<T>, field: ODataModelField<F> | string, value: F | F[] | {
355
- [name: string]: any;
356
- } | {
357
- [name: string]: any;
358
- }[] | ODataModel<F> | ODataCollection<F, ODataModel<F>> | null, { add, merge, remove, reset, reparent, silent, type, }?: {
359
- add?: boolean;
360
- merge?: boolean;
361
- remove?: boolean;
362
- reset?: boolean;
363
- reparent?: boolean;
364
- silent?: boolean;
365
- type?: EdmType | string;
366
- }): boolean;
367
- private _link;
368
- }
package/lib/module.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import { EnvironmentProviders, InjectionToken, ModuleWithProviders, Provider } from '@angular/core';
2
- import { ODataConfigSyncLoader } from './loaders';
3
- import { ODataApiConfig } from './types';
4
- import * as i0 from "@angular/core";
5
- import * as i1 from "@angular/common";
6
- import * as i2 from "@angular/common/http";
7
- export interface PassedInitialConfig {
8
- config?: ODataApiConfig | ODataApiConfig[];
9
- loader?: Provider;
10
- }
11
- export declare const ODATA_CONFIG: InjectionToken<ODataApiConfig>;
12
- export declare function createSyncLoader(passedConfig: PassedInitialConfig): ODataConfigSyncLoader;
13
- export declare function provideODataClient(passedConfig: PassedInitialConfig): EnvironmentProviders;
14
- export declare class ODataModule {
15
- static forRoot(passedConfig: PassedInitialConfig): ModuleWithProviders<ODataModule>;
16
- static ɵfac: i0.ɵɵFactoryDeclaration<ODataModule, never>;
17
- static ɵmod: i0.ɵɵNgModuleDeclaration<ODataModule, never, [typeof i1.CommonModule, typeof i2.HttpClientModule], never>;
18
- static ɵinj: i0.ɵɵInjectorDeclaration<ODataModule>;
19
- }
package/lib/options.d.ts DELETED
@@ -1,101 +0,0 @@
1
- import { ODataApiConfigOptions, FetchPolicy, ODataMetadataType, ODataVersion, ParserOptions, QueryOption } from './types';
2
- export declare class ODataApiOptions implements ODataApiConfigOptions {
3
- /**
4
- * Default OData version
5
- */
6
- version: ODataVersion;
7
- /**
8
- * Send enum as string in the request
9
- */
10
- stringAsEnum: boolean;
11
- /**
12
- * Delete reference by path or by id
13
- */
14
- deleteRefBy: 'path' | 'id';
15
- /**
16
- * No use parenthesis for empty parameters functions
17
- */
18
- nonParenthesisForEmptyParameterFunction: boolean;
19
- /**
20
- * Strip metadata from the response
21
- */
22
- stripMetadata: ODataMetadataType;
23
- /**
24
- * Use JSON Batch Format
25
- */
26
- jsonBatchFormat: boolean;
27
- /**
28
- * Relative urls
29
- * http://docs.oasis-open.org/odata/odata-json-format/v4.0/cs01/odata-json-format-v4.0-cs01.html#_Toc365464682
30
- */
31
- relativeUrls: boolean;
32
- /**
33
- * Cache fetch policy
34
- */
35
- fetchPolicy: FetchPolicy;
36
- /**
37
- * Extra params to be sent in the request
38
- */
39
- params: {
40
- [param: string]: string | string[];
41
- };
42
- /**
43
- * Extra headers to be sent in the request
44
- */
45
- headers: {
46
- [param: string]: string | string[];
47
- };
48
- /**
49
- * Http request with credentials
50
- */
51
- withCredentials?: boolean;
52
- /**
53
- * Send query options in the request body
54
- */
55
- bodyQueryOptions: QueryOption[];
56
- /**
57
- * Customize accept header with OData options
58
- * @link http://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html#sec_RequestingtheJSONFormat
59
- */
60
- accept?: {
61
- exponentialDecimals?: boolean;
62
- ieee754Compatible?: boolean;
63
- metadata?: ODataMetadataType;
64
- streaming?: boolean;
65
- };
66
- etag: {
67
- /**
68
- * @link http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398229
69
- */
70
- ifMatch: boolean;
71
- /**
72
- * @link http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398230
73
- */
74
- ifNoneMatch: boolean;
75
- };
76
- prefer?: {
77
- /**
78
- * @link http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398238
79
- */
80
- maxPageSize?: number;
81
- /**
82
- * @link http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398240
83
- */
84
- return?: 'representation' | 'minimal';
85
- /**
86
- * @link http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398236
87
- */
88
- continueOnError?: boolean;
89
- /**
90
- * @link http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398237
91
- */
92
- includeAnnotations?: string;
93
- /**
94
- * @link https://devblogs.microsoft.com/odata/extension-omit-null-value-properties-in-asp-net-core-odata/
95
- */
96
- omitNullValues?: boolean;
97
- };
98
- constructor(config: ODataApiConfigOptions);
99
- get parserOptions(): ParserOptions;
100
- get helper(): import("./helper").ODataVersionHelper;
101
- }
@@ -1,6 +0,0 @@
1
- export * from './query';
2
- export * from './path';
3
- export * from './request';
4
- export * from './resource';
5
- export * from './types';
6
- export * from './response';