angular-odata 0.78.1 → 0.95.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 (224) hide show
  1. package/README.md +133 -62
  2. package/{esm2015/angular-odata.js → esm2020/angular-odata.mjs} +0 -0
  3. package/esm2020/lib/api.mjs +303 -0
  4. package/{esm2015/lib/cache/cache.js → esm2020/lib/cache/cache.mjs} +12 -5
  5. package/{esm2015/lib/cache/index.js → esm2020/lib/cache/index.mjs} +0 -0
  6. package/{esm2015/lib/cache/memory.js → esm2020/lib/cache/memory.mjs} +0 -0
  7. package/{esm2015/lib/cache/storage.js → esm2020/lib/cache/storage.mjs} +1 -1
  8. package/esm2020/lib/client.mjs +271 -0
  9. package/{esm2015/lib/constants.js → esm2020/lib/constants.mjs} +9 -3
  10. package/esm2020/lib/helper.mjs +268 -0
  11. package/esm2020/lib/index.mjs +19 -0
  12. package/esm2020/lib/models/collection.mjs +741 -0
  13. package/{esm2015/lib/models/index.js → esm2020/lib/models/index.mjs} +0 -0
  14. package/esm2020/lib/models/model.mjs +453 -0
  15. package/esm2020/lib/models/options.mjs +945 -0
  16. package/{esm2015/lib/module.js → esm2020/lib/module.mjs} +6 -6
  17. package/esm2020/lib/options.mjs +32 -0
  18. package/esm2020/lib/resources/index.mjs +7 -0
  19. package/esm2020/lib/resources/path/handlers.mjs +69 -0
  20. package/esm2020/lib/resources/path/index.mjs +3 -0
  21. package/esm2020/lib/resources/path/segments.mjs +124 -0
  22. package/esm2020/lib/resources/query/builder.mjs +590 -0
  23. package/esm2020/lib/resources/query/expressions.mjs +207 -0
  24. package/esm2020/lib/resources/query/handlers.mjs +186 -0
  25. package/esm2020/lib/resources/query/index.mjs +4 -0
  26. package/esm2020/lib/resources/query/options.mjs +103 -0
  27. package/esm2020/lib/resources/query/syntax.mjs +406 -0
  28. package/esm2020/lib/resources/request.mjs +167 -0
  29. package/esm2020/lib/resources/resource.mjs +326 -0
  30. package/esm2020/lib/resources/responses/annotations.mjs +119 -0
  31. package/{esm2015/lib/resources/responses/csdl/csdl-annotation.js → esm2020/lib/resources/responses/csdl/csdl-annotation.mjs} +0 -0
  32. package/{esm2015/lib/resources/responses/csdl/csdl-entity-container.js → esm2020/lib/resources/responses/csdl/csdl-entity-container.mjs} +0 -0
  33. package/{esm2015/lib/resources/responses/csdl/csdl-entity-set.js → esm2020/lib/resources/responses/csdl/csdl-entity-set.mjs} +0 -0
  34. package/{esm2015/lib/resources/responses/csdl/csdl-enum-type.js → esm2020/lib/resources/responses/csdl/csdl-enum-type.mjs} +0 -0
  35. package/{esm2015/lib/resources/responses/csdl/csdl-function-action.js → esm2020/lib/resources/responses/csdl/csdl-function-action.mjs} +0 -0
  36. package/{esm2015/lib/resources/responses/csdl/csdl-navigation-property-binding.js → esm2020/lib/resources/responses/csdl/csdl-navigation-property-binding.mjs} +0 -0
  37. package/{esm2015/lib/resources/responses/csdl/csdl-reference.js → esm2020/lib/resources/responses/csdl/csdl-reference.mjs} +0 -0
  38. package/{esm2015/lib/resources/responses/csdl/csdl-schema.js → esm2020/lib/resources/responses/csdl/csdl-schema.mjs} +0 -0
  39. package/{esm2015/lib/resources/responses/csdl/csdl-singleton.js → esm2020/lib/resources/responses/csdl/csdl-singleton.mjs} +0 -0
  40. package/{esm2015/lib/resources/responses/csdl/csdl-structural-property.js → esm2020/lib/resources/responses/csdl/csdl-structural-property.mjs} +0 -0
  41. package/{esm2015/lib/resources/responses/csdl/csdl-structured-type.js → esm2020/lib/resources/responses/csdl/csdl-structured-type.mjs} +0 -0
  42. package/{esm2015/lib/resources/responses/csdl/csdl-type-definition.js → esm2020/lib/resources/responses/csdl/csdl-type-definition.mjs} +0 -0
  43. package/{esm2015/lib/resources/responses/index.js → esm2020/lib/resources/responses/index.mjs} +0 -0
  44. package/esm2020/lib/resources/responses/metadata.mjs +547 -0
  45. package/{esm2015/lib/resources/responses/options.js → esm2020/lib/resources/responses/options.mjs} +1 -1
  46. package/esm2020/lib/resources/responses/response.mjs +170 -0
  47. package/{esm2015/lib/resources/responses/types.js → esm2020/lib/resources/responses/types.mjs} +1 -1
  48. package/esm2020/lib/resources/types/action.mjs +101 -0
  49. package/esm2020/lib/resources/types/batch.mjs +288 -0
  50. package/esm2020/lib/resources/types/count.mjs +27 -0
  51. package/esm2020/lib/resources/types/entity-set.mjs +94 -0
  52. package/esm2020/lib/resources/types/entity.mjs +106 -0
  53. package/esm2020/lib/resources/types/function.mjs +137 -0
  54. package/{esm2015/lib/resources/types/index.js → esm2020/lib/resources/types/index.mjs} +0 -0
  55. package/esm2020/lib/resources/types/media.mjs +41 -0
  56. package/esm2020/lib/resources/types/metadata.mjs +30 -0
  57. package/esm2020/lib/resources/types/navigation-property.mjs +226 -0
  58. package/esm2020/lib/resources/types/options.mjs +2 -0
  59. package/esm2020/lib/resources/types/property.mjs +183 -0
  60. package/esm2020/lib/resources/types/reference.mjs +85 -0
  61. package/esm2020/lib/resources/types/singleton.mjs +126 -0
  62. package/esm2020/lib/resources/types/value.mjs +41 -0
  63. package/esm2020/lib/schema/annotation.mjs +37 -0
  64. package/esm2020/lib/schema/callable.mjs +62 -0
  65. package/esm2020/lib/schema/element.mjs +51 -0
  66. package/esm2020/lib/schema/entity-container.mjs +9 -0
  67. package/esm2020/lib/schema/entity-set.mjs +9 -0
  68. package/esm2020/lib/schema/enum-type.mjs +71 -0
  69. package/{esm2015/lib/schema/index.js → esm2020/lib/schema/index.mjs} +2 -1
  70. package/esm2020/lib/schema/parsers/callable.mjs +113 -0
  71. package/esm2020/lib/schema/parsers/edm.mjs +95 -0
  72. package/esm2020/lib/schema/parsers/enum-type.mjs +107 -0
  73. package/esm2020/lib/schema/parsers/index.mjs +5 -0
  74. package/esm2020/lib/schema/parsers/structured-type.mjs +412 -0
  75. package/esm2020/lib/schema/schema.mjs +61 -0
  76. package/esm2020/lib/schema/structured-type.mjs +198 -0
  77. package/esm2020/lib/services/base.mjs +29 -0
  78. package/esm2020/lib/services/entity-set.mjs +143 -0
  79. package/esm2020/lib/services/entity.mjs +12 -0
  80. package/{esm2015/lib/services/factory.js → esm2020/lib/services/factory.mjs} +3 -3
  81. package/{esm2015/lib/services/index.js → esm2020/lib/services/index.mjs} +0 -0
  82. package/esm2020/lib/services/singleton.mjs +48 -0
  83. package/{esm2015/lib/settings.js → esm2020/lib/settings.mjs} +1 -1
  84. package/{esm2015/lib/tokens.js → esm2020/lib/tokens.mjs} +0 -0
  85. package/esm2020/lib/types.mjs +37 -0
  86. package/esm2020/lib/utils/arraybuffers.mjs +46 -0
  87. package/{esm2015/lib/utils/dates.js → esm2020/lib/utils/dates.mjs} +0 -0
  88. package/esm2020/lib/utils/durations.mjs +40 -0
  89. package/{esm2015/lib/utils/enums.js → esm2020/lib/utils/enums.mjs} +0 -0
  90. package/esm2020/lib/utils/http.mjs +93 -0
  91. package/esm2020/lib/utils/index.mjs +10 -0
  92. package/esm2020/lib/utils/objects.mjs +195 -0
  93. package/esm2020/lib/utils/odata.mjs +22 -0
  94. package/esm2020/lib/utils/strings.mjs +20 -0
  95. package/esm2020/lib/utils/types.mjs +134 -0
  96. package/{esm2015/lib/utils/urls.js → esm2020/lib/utils/urls.mjs} +0 -0
  97. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  98. package/fesm2015/{angular-odata.js → angular-odata.mjs} +5068 -3943
  99. package/fesm2015/angular-odata.mjs.map +1 -0
  100. package/fesm2020/angular-odata.mjs +10274 -0
  101. package/fesm2020/angular-odata.mjs.map +1 -0
  102. package/lib/api.d.ts +17 -16
  103. package/lib/cache/cache.d.ts +2 -2
  104. package/lib/client.d.ts +93 -18
  105. package/lib/constants.d.ts +6 -2
  106. package/lib/helper.d.ts +3 -3
  107. package/lib/index.d.ts +0 -1
  108. package/lib/models/collection.d.ts +36 -47
  109. package/lib/models/model.d.ts +47 -40
  110. package/lib/models/options.d.ts +53 -52
  111. package/lib/options.d.ts +50 -2
  112. package/lib/resources/index.d.ts +2 -3
  113. package/lib/resources/path/handlers.d.ts +27 -0
  114. package/lib/resources/path/index.d.ts +2 -0
  115. package/lib/resources/{path-segments.d.ts → path/segments.d.ts} +4 -16
  116. package/lib/resources/{builder.d.ts → query/builder.d.ts} +12 -7
  117. package/lib/resources/query/expressions.d.ts +63 -0
  118. package/lib/resources/query/handlers.d.ts +89 -0
  119. package/lib/resources/query/index.d.ts +3 -0
  120. package/lib/resources/query/options.d.ts +38 -0
  121. package/lib/resources/query/syntax.d.ts +175 -0
  122. package/lib/resources/request.d.ts +8 -6
  123. package/lib/resources/resource.d.ts +49 -55
  124. package/lib/resources/responses/metadata.d.ts +1 -1
  125. package/lib/resources/responses/types.d.ts +1 -1
  126. package/lib/resources/types/action.d.ts +55 -69
  127. package/lib/resources/types/batch.d.ts +13 -8
  128. package/lib/resources/types/count.d.ts +16 -19
  129. package/lib/resources/types/entity-set.d.ts +24 -62
  130. package/lib/resources/types/entity.d.ts +35 -43
  131. package/lib/resources/types/function.d.ts +63 -71
  132. package/lib/resources/types/media.d.ts +20 -22
  133. package/lib/resources/types/metadata.d.ts +5 -7
  134. package/lib/resources/types/navigation-property.d.ts +100 -85
  135. package/lib/resources/types/options.d.ts +8 -8
  136. package/lib/resources/types/property.d.ts +63 -73
  137. package/lib/resources/types/reference.d.ts +72 -16
  138. package/lib/resources/types/singleton.d.ts +75 -43
  139. package/lib/resources/types/value.d.ts +18 -9
  140. package/lib/schema/annotation.d.ts +18 -0
  141. package/lib/schema/callable.d.ts +27 -11
  142. package/lib/schema/element.d.ts +39 -0
  143. package/lib/schema/entity-container.d.ts +3 -8
  144. package/lib/schema/entity-set.d.ts +3 -9
  145. package/lib/schema/enum-type.d.ts +41 -14
  146. package/lib/schema/index.d.ts +1 -0
  147. package/lib/{parsers → schema/parsers}/callable.d.ts +2 -2
  148. package/lib/schema/parsers/edm.d.ts +4 -0
  149. package/lib/{parsers → schema/parsers}/enum-type.d.ts +13 -7
  150. package/lib/{parsers → schema/parsers}/index.d.ts +0 -0
  151. package/lib/{parsers → schema/parsers}/structured-type.d.ts +14 -9
  152. package/lib/schema/schema.d.ts +6 -8
  153. package/lib/schema/structured-type.d.ts +97 -18
  154. package/lib/services/base.d.ts +12 -12
  155. package/lib/services/entity-set.d.ts +15 -12
  156. package/lib/services/entity.d.ts +4 -1
  157. package/lib/services/singleton.d.ts +6 -3
  158. package/lib/settings.d.ts +4 -4
  159. package/lib/types.d.ts +7 -3
  160. package/lib/utils/arraybuffers.d.ts +4 -0
  161. package/lib/{parsers/edm.d.ts → utils/durations.d.ts} +3 -3
  162. package/lib/utils/http.d.ts +9 -0
  163. package/lib/utils/index.d.ts +5 -2
  164. package/lib/utils/objects.d.ts +1 -1
  165. package/lib/utils/strings.d.ts +4 -0
  166. package/lib/utils/types.d.ts +2 -0
  167. package/package.json +21 -8
  168. package/bundles/angular-odata.umd.js +0 -10756
  169. package/bundles/angular-odata.umd.js.map +0 -1
  170. package/esm2015/lib/api.js +0 -251
  171. package/esm2015/lib/client.js +0 -197
  172. package/esm2015/lib/helper.js +0 -269
  173. package/esm2015/lib/index.js +0 -21
  174. package/esm2015/lib/models/collection.js +0 -660
  175. package/esm2015/lib/models/model.js +0 -421
  176. package/esm2015/lib/models/options.js +0 -889
  177. package/esm2015/lib/options.js +0 -31
  178. package/esm2015/lib/parsers/callable.js +0 -110
  179. package/esm2015/lib/parsers/edm.js +0 -310
  180. package/esm2015/lib/parsers/enum-type.js +0 -97
  181. package/esm2015/lib/parsers/index.js +0 -5
  182. package/esm2015/lib/parsers/structured-type.js +0 -394
  183. package/esm2015/lib/resources/builder.js +0 -537
  184. package/esm2015/lib/resources/index.js +0 -8
  185. package/esm2015/lib/resources/path-segments.js +0 -156
  186. package/esm2015/lib/resources/query-options.js +0 -157
  187. package/esm2015/lib/resources/request.js +0 -141
  188. package/esm2015/lib/resources/resource.js +0 -328
  189. package/esm2015/lib/resources/responses/annotations.js +0 -121
  190. package/esm2015/lib/resources/responses/metadata.js +0 -548
  191. package/esm2015/lib/resources/responses/response.js +0 -170
  192. package/esm2015/lib/resources/types/action.js +0 -146
  193. package/esm2015/lib/resources/types/batch.js +0 -330
  194. package/esm2015/lib/resources/types/count.js +0 -50
  195. package/esm2015/lib/resources/types/entity-set.js +0 -164
  196. package/esm2015/lib/resources/types/entity.js +0 -158
  197. package/esm2015/lib/resources/types/function.js +0 -166
  198. package/esm2015/lib/resources/types/media.js +0 -46
  199. package/esm2015/lib/resources/types/metadata.js +0 -36
  200. package/esm2015/lib/resources/types/navigation-property.js +0 -214
  201. package/esm2015/lib/resources/types/options.js +0 -2
  202. package/esm2015/lib/resources/types/property.js +0 -190
  203. package/esm2015/lib/resources/types/reference.js +0 -50
  204. package/esm2015/lib/resources/types/singleton.js +0 -147
  205. package/esm2015/lib/resources/types/value.js +0 -30
  206. package/esm2015/lib/schema/annotation.js +0 -7
  207. package/esm2015/lib/schema/callable.js +0 -50
  208. package/esm2015/lib/schema/entity-container.js +0 -17
  209. package/esm2015/lib/schema/entity-set.js +0 -23
  210. package/esm2015/lib/schema/enum-type.js +0 -68
  211. package/esm2015/lib/schema/schema.js +0 -55
  212. package/esm2015/lib/schema/structured-type.js +0 -107
  213. package/esm2015/lib/services/base.js +0 -23
  214. package/esm2015/lib/services/entity-set.js +0 -143
  215. package/esm2015/lib/services/entity.js +0 -10
  216. package/esm2015/lib/services/singleton.js +0 -46
  217. package/esm2015/lib/types.js +0 -37
  218. package/esm2015/lib/utils/http.js +0 -59
  219. package/esm2015/lib/utils/index.js +0 -7
  220. package/esm2015/lib/utils/objects.js +0 -140
  221. package/esm2015/lib/utils/odata.js +0 -21
  222. package/esm2015/lib/utils/types.js +0 -103
  223. package/fesm2015/angular-odata.js.map +0 -1
  224. package/lib/resources/query-options.d.ts +0 -57
@@ -0,0 +1,175 @@
1
+ import type { QueryCustomType } from './builder';
2
+ export interface Renderable {
3
+ render({ aliases, escape, prefix, }: {
4
+ aliases?: QueryCustomType[];
5
+ escape?: boolean;
6
+ prefix?: string;
7
+ }): string;
8
+ toString(): string;
9
+ toJSON(): any;
10
+ }
11
+ export declare type Funcs<T> = (x: ODataSyntax<T>) => Function<T> | Operator<T> | Grouping<T>;
12
+ export declare class Field<T extends object> implements ProxyHandler<T> {
13
+ name: string;
14
+ constructor(name?: string);
15
+ static factory<T extends object>(): T;
16
+ get(target: T, p: string | symbol): any;
17
+ }
18
+ export declare class Function<T> implements Renderable {
19
+ protected name: string;
20
+ protected values: any[];
21
+ protected normalize: boolean;
22
+ protected escape: boolean;
23
+ constructor(name: string, values: any[], normalize?: boolean, escape?: boolean);
24
+ get [Symbol.toStringTag](): string;
25
+ toJSON(): {
26
+ name: string;
27
+ values: any[];
28
+ normalize: boolean;
29
+ };
30
+ render({ aliases, escape, prefix, }: {
31
+ aliases?: QueryCustomType[];
32
+ escape?: boolean;
33
+ prefix?: string;
34
+ }): string;
35
+ }
36
+ export declare class StringAndCollectionFunctions<T> {
37
+ concat(field: any, value: any, normalize?: boolean): Function<T>;
38
+ contains(field: any, value: any, normalize?: boolean): Function<T>;
39
+ endsWith(field: any, value: any, normalize?: boolean): Function<T>;
40
+ indexOf(field: any, value: any, normalize?: boolean): Function<T>;
41
+ length(value: any, normalize?: boolean): Function<T>;
42
+ startsWith(field: any, value: any, normalize?: boolean): Function<T>;
43
+ subString(field: any, start: number, length?: number): Function<T>;
44
+ }
45
+ export declare class CollectionFunctions<T> {
46
+ hasSubset(s1: T, s2: any): Function<T>;
47
+ hasSubsequence(s1: T, s2: any): Function<T>;
48
+ }
49
+ export declare class StringFunctions<T> {
50
+ matchesPattern(value: T | string, pattern: string): Function<T>;
51
+ toLower(value: T): Function<T>;
52
+ toUpper(value: T): Function<T>;
53
+ trim(value: T): Function<T>;
54
+ }
55
+ export declare class DateAndTimeFunctions<T> {
56
+ date(value: any): Function<T>;
57
+ day(value: any): Function<T>;
58
+ fractionalseconds(value: any): Function<T>;
59
+ hour(value: any): Function<T>;
60
+ maxdatetime(value: any): Function<T>;
61
+ mindatetime(value: any): Function<T>;
62
+ minute(value: any): Function<T>;
63
+ month(value: any): Function<T>;
64
+ now(): Function<T>;
65
+ second(value: any): Function<T>;
66
+ time(value: any): Function<T>;
67
+ totaloffsetminutes(value: any): Function<T>;
68
+ totalseconds(value: any): Function<T>;
69
+ year(value: any): Function<T>;
70
+ }
71
+ export declare class ArithmeticFunctions<T> {
72
+ ceiling(value: T | string): Function<T>;
73
+ floor(value: T | string): Function<T>;
74
+ round(value: T | string): Function<T>;
75
+ }
76
+ export declare class TypeFunctions<T> {
77
+ cast(value: T | string, type?: string): Function<T>;
78
+ isof(value: T | string, type?: string): Function<T>;
79
+ }
80
+ export declare class GeoFunctions<T> {
81
+ geoDistance(value: T, point: string, normalize?: boolean): Function<T>;
82
+ geoIntersects(value: T, polygon: string, normalize?: boolean): Function<T>;
83
+ geoLength(line: T, normalize?: boolean): Function<T>;
84
+ }
85
+ export declare class ConditionalFunctions<T> {
86
+ case(condition: T | string, value: any): Function<T>;
87
+ }
88
+ export declare class Operator<T> implements Renderable {
89
+ protected op: string;
90
+ protected values: any[];
91
+ protected normalize: boolean;
92
+ constructor(op: string, values: any[], normalize?: boolean);
93
+ get [Symbol.toStringTag](): string;
94
+ toJSON(): {
95
+ op: string;
96
+ values: any[];
97
+ normalize: boolean;
98
+ };
99
+ render({ aliases, escape, prefix, }: {
100
+ aliases?: QueryCustomType[];
101
+ escape?: boolean;
102
+ prefix?: string;
103
+ }): string;
104
+ }
105
+ export declare class LogicalOperators<T> {
106
+ eq(left: any, right: any, normalize?: boolean): Operator<unknown>;
107
+ ne(left: any, right: any, normalize?: boolean): Operator<unknown>;
108
+ gt(left: any, right: any, normalize?: boolean): Operator<unknown>;
109
+ ge(left: any, right: any, normalize?: boolean): Operator<unknown>;
110
+ lt(left: any, right: any, normalize?: boolean): Operator<unknown>;
111
+ le(left: any, right: any, normalize?: boolean): Operator<unknown>;
112
+ not(value: any, normalize?: boolean): Operator<T>;
113
+ has(left: any, right: any, normalize?: boolean): Operator<unknown>;
114
+ in(left: any, right: any, normalize?: boolean): Operator<unknown>;
115
+ }
116
+ export declare class ArithmeticOperators<T> {
117
+ add(left: any, right: any, normalize?: boolean): Operator<T>;
118
+ sub(left: any, right: any, normalize?: boolean): Operator<unknown>;
119
+ mul(left: any, right: any, normalize?: boolean): Operator<unknown>;
120
+ div(left: any, right: any, normalize?: boolean): Operator<unknown>;
121
+ mod(left: any, right: any, normalize?: boolean): Operator<unknown>;
122
+ neg(value: any, normalize?: boolean): Operator<unknown>;
123
+ }
124
+ export declare class Grouping<T> implements Renderable {
125
+ protected group: Renderable;
126
+ constructor(group: Renderable);
127
+ get [Symbol.toStringTag](): string;
128
+ toJSON(): {
129
+ group: any;
130
+ };
131
+ render({ aliases, escape, prefix, }: {
132
+ aliases?: QueryCustomType[];
133
+ escape?: boolean;
134
+ prefix?: string;
135
+ }): string;
136
+ }
137
+ export declare class GroupingOperators<T> {
138
+ grouping(value: any): Grouping<unknown>;
139
+ }
140
+ export declare class Lambda<T> implements Renderable {
141
+ protected op: string;
142
+ protected values: any[];
143
+ protected alias?: string | undefined;
144
+ constructor(op: string, values: any[], alias?: string | undefined);
145
+ get [Symbol.toStringTag](): string;
146
+ toJSON(): {
147
+ op: string;
148
+ values: any[];
149
+ alias: string | undefined;
150
+ };
151
+ render({ aliases, escape, prefix, }: {
152
+ aliases?: QueryCustomType[];
153
+ escape?: boolean;
154
+ prefix?: string;
155
+ }): string;
156
+ }
157
+ export declare class LambdaOperators<T> {
158
+ any(field: T, value: any, alias?: string): Lambda<unknown>;
159
+ all(field: T, value: any, alias?: string): Lambda<unknown>;
160
+ }
161
+ export declare class ODataOperators<T> {
162
+ }
163
+ export interface ODataOperators<T> extends LogicalOperators<T>, ArithmeticOperators<T>, GroupingOperators<T>, LambdaOperators<T> {
164
+ }
165
+ export declare const operators: ODataOperators<any>;
166
+ export declare class ODataFunctions<T> {
167
+ }
168
+ export interface ODataFunctions<T> extends StringAndCollectionFunctions<T>, CollectionFunctions<T>, StringFunctions<T>, DateAndTimeFunctions<T>, ArithmeticFunctions<T>, TypeFunctions<T>, GeoFunctions<T>, ConditionalFunctions<T> {
169
+ }
170
+ export declare const functions: ODataFunctions<any>;
171
+ export declare class ODataSyntax<T> {
172
+ }
173
+ export interface ODataSyntax<T> extends ODataOperators<T>, ODataFunctions<T> {
174
+ }
175
+ export declare const syntax: ODataSyntax<any>;
@@ -3,19 +3,20 @@ import { ODataApi } from '../api';
3
3
  import { QueryOptionNames } from '../types';
4
4
  import { ODataResource } from './resource';
5
5
  export declare class ODataRequest<T> {
6
- private readonly _method;
7
6
  readonly api: ODataApi;
8
- private readonly _body;
9
7
  readonly observe: 'events' | 'response';
10
8
  readonly reportProgress?: boolean;
11
9
  readonly withCredentials?: boolean;
12
10
  readonly bodyQueryOptions: QueryOptionNames[];
13
- readonly responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
14
11
  readonly fetchPolicy: 'cache-first' | 'cache-and-network' | 'network-only' | 'no-cache' | 'cache-only';
12
+ readonly resource: ODataResource<T>;
13
+ private readonly _responseType?;
14
+ private readonly _method;
15
+ private readonly _body;
15
16
  private readonly _headers;
16
17
  private readonly _params;
17
18
  private readonly _path;
18
- readonly resource: ODataResource<T>;
19
+ private readonly _queryBody;
19
20
  constructor(init: {
20
21
  method: string;
21
22
  api: ODataApi;
@@ -30,11 +31,12 @@ export declare class ODataRequest<T> {
30
31
  params?: HttpParams | {
31
32
  [param: string]: string | string[];
32
33
  };
33
- responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
34
+ responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
34
35
  fetchPolicy?: 'cache-first' | 'cache-and-network' | 'network-only' | 'no-cache' | 'cache-only';
35
36
  withCredentials?: boolean;
36
37
  bodyQueryOptions?: QueryOptionNames[];
37
38
  });
39
+ get responseType(): 'arraybuffer' | 'blob' | 'json' | 'text';
38
40
  get path(): string;
39
41
  get method(): string;
40
42
  get body(): any;
@@ -43,7 +45,7 @@ export declare class ODataRequest<T> {
43
45
  get pathWithParams(): string;
44
46
  get url(): string;
45
47
  get urlWithParams(): string;
46
- isBodyQueryOptions(): boolean;
48
+ isBatch(): boolean;
47
49
  isFetch(): boolean;
48
50
  isMutate(): boolean;
49
51
  }
@@ -1,19 +1,26 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ODataPathSegments } from './path-segments';
3
- import { QueryArguments, ODataQueryOptions } from './query-options';
4
- import { HttpOptions } from './types';
5
2
  import { ODataApi } from '../api';
3
+ import { ODataCollection, ODataModel } from '../models';
4
+ import { ODataStructuredType } from '../schema';
5
+ import { ODataSchemaElement } from '../schema/element';
6
6
  import { OptionsHelper, QueryOptionNames } from '../types';
7
- import { Expand, Filter, OrderBy, Select, Transform, QueryCustomType } from './builder';
8
- import { ODataStructuredType, ODataCallable } from '../schema/index';
7
+ import { ODataPathSegments, ODataPathSegmentsHandler } from './path';
8
+ import { ODataQueryOptions, ODataQueryOptionsHandler, QueryCustomType } from './query';
9
+ import { ODataEntitiesAnnotations, ODataEntityAnnotations } from './responses/index';
10
+ import { ODataOptions } from './types';
9
11
  export declare type EntityKey<T> = {
10
12
  readonly [P in keyof T]?: T[P];
11
13
  } | QueryCustomType | string | number;
12
- export declare abstract class ODataResource<T> {
14
+ export declare class ODataResource<T> {
13
15
  api: ODataApi;
16
+ schema?: ODataSchemaElement;
14
17
  protected pathSegments: ODataPathSegments;
15
- protected queryOptions: ODataQueryOptions;
16
- constructor(api: ODataApi, segments?: ODataPathSegments, query?: ODataQueryOptions);
18
+ protected queryOptions: ODataQueryOptions<T>;
19
+ constructor(api: ODataApi, { segments, query, schema, }?: {
20
+ segments?: ODataPathSegments;
21
+ query?: ODataQueryOptions<T>;
22
+ schema?: ODataSchemaElement;
23
+ });
17
24
  /**
18
25
  * @returns string The type of the resource
19
26
  */
@@ -31,92 +38,79 @@ export declare abstract class ODataResource<T> {
31
38
  */
32
39
  hasKey(): boolean;
33
40
  clearKey(): void | undefined;
41
+ asModel<M extends ODataModel<T>>(entity?: Partial<T> | {
42
+ [name: string]: any;
43
+ }, { annots, reset }?: {
44
+ annots?: ODataEntityAnnotations;
45
+ reset?: boolean;
46
+ }): M;
47
+ asCollection<M extends ODataModel<T>, C extends ODataCollection<T, M>>(entities?: Partial<T>[] | {
48
+ [name: string]: any;
49
+ }[], { annots, reset, }?: {
50
+ annots?: ODataEntitiesAnnotations;
51
+ reset?: boolean;
52
+ }): C;
34
53
  isSubtypeOf(other: ODataResource<any>): boolean;
35
- isParentOf(other: ODataResource<any>): boolean;
36
- isChildOf(other: ODataResource<any>): boolean;
37
54
  isEqualTo(other: ODataResource<any>, test?: 'path' | 'params'): boolean;
38
- pathAndParams(): [string, {
55
+ pathAndParams(escape?: boolean): [string, {
39
56
  [name: string]: any;
40
57
  }];
41
58
  endpointUrl(params?: boolean): string;
42
59
  toString(): string;
43
- abstract clone(): ODataResource<T>;
44
- abstract schema(): ODataStructuredType<T> | ODataCallable<T> | undefined;
45
- serialize(value: any, options?: OptionsHelper): any;
60
+ clone<R extends ODataResource<T>>(): R;
46
61
  deserialize(value: any, options?: OptionsHelper): any;
62
+ serialize(value: any, options?: OptionsHelper): any;
47
63
  encode(value: any, options?: OptionsHelper): any;
48
64
  toJSON(): {
49
65
  segments: any[];
50
- options: any;
66
+ options: {};
51
67
  };
52
68
  cloneSegments(): ODataPathSegments;
53
69
  clearQuery(): void;
54
- cloneQuery(): ODataQueryOptions;
70
+ cloneQuery<P>(): ODataQueryOptions<P>;
55
71
  /**
56
- * Factorise an object handler for mutate query options for resources that match to entity
57
- * @returns Object handler for mutate query options
72
+ * Handle the path segments of the resource
73
+ * Create an object handler for mutate the path segments of the resource
74
+ * @param f Function context for handle the segments
75
+ * @returns ODataActionResource
58
76
  */
59
- protected entityQueryHandler(): {
60
- select(opts?: Select<T> | undefined): import("./query-options").OptionHandler<Select<T>>;
61
- expand(opts?: Expand<T> | undefined): import("./query-options").OptionHandler<Expand<T>>;
62
- compute(opts?: string | undefined): import("./query-options").OptionHandler<string>;
63
- format(opts?: string | undefined): import("./query-options").OptionHandler<string>;
64
- apply(query: QueryArguments<T>): void;
65
- };
66
- static resolveKey<T>(value: any, schema?: ODataStructuredType<T> | ODataCallable<T>): EntityKey<T> | undefined;
67
- protected resolveKey(value: any): EntityKey<T> | undefined;
77
+ segment(f: (q: ODataPathSegmentsHandler<T>) => void): this;
68
78
  /**
69
- * Factorise an object handler for mutate query options for resources that match to entities
70
- * @returns Object handler for mutate query options
79
+ * Handle the query options of the resource
80
+ * Create an object handler for mutate the query options of the resource
81
+ * @param f Function context for handle the query options
71
82
  */
72
- protected entitiesQueryHandler(): {
73
- select(opts?: Select<T> | undefined): import("./query-options").OptionHandler<Select<T>>;
74
- expand(opts?: Expand<T> | undefined): import("./query-options").OptionHandler<Expand<T>>;
75
- compute(opts?: string | undefined): import("./query-options").OptionHandler<string>;
76
- transform(opts?: Transform<T> | undefined): import("./query-options").OptionHandler<Transform<T>>;
77
- search(opts?: string | undefined): import("./query-options").OptionHandler<string>;
78
- filter(opts?: Filter | undefined): import("./query-options").OptionHandler<Filter>;
79
- orderBy(opts?: OrderBy<T> | undefined): import("./query-options").OptionHandler<OrderBy<T>>;
80
- format(opts?: string | undefined): import("./query-options").OptionHandler<string>;
81
- top(opts?: number | undefined): import("./query-options").OptionHandler<number>;
82
- skip(opts?: number | undefined): import("./query-options").OptionHandler<number>;
83
- skiptoken(opts?: string | undefined): import("./query-options").OptionHandler<string>;
84
- paging({ skip, skiptoken, top, }?: {
85
- skip?: number | undefined;
86
- skiptoken?: string | undefined;
87
- top?: number | undefined;
88
- }): void;
89
- clearPaging(): void;
90
- apply(query: QueryArguments<T>): void;
91
- };
92
- protected request(method: string, options: HttpOptions & {
83
+ query(f: (q: ODataQueryOptionsHandler<T>) => void): this;
84
+ static resolveKey<T>(value: any, schema?: ODataStructuredType<T>): EntityKey<T> | undefined;
85
+ protected resolveKey(value: any): EntityKey<T> | undefined;
86
+ protected request(method: string, options: ODataOptions & {
93
87
  body?: any;
94
88
  etag?: string;
95
89
  responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
96
90
  withCount?: boolean;
97
91
  bodyQueryOptions?: QueryOptionNames[];
98
92
  }): Observable<any>;
99
- protected get(options?: HttpOptions & {
93
+ protected get(options?: ODataOptions & {
100
94
  etag?: string;
101
95
  responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
102
96
  withCount?: boolean;
103
97
  bodyQueryOptions?: QueryOptionNames[];
104
98
  }): Observable<any>;
105
- protected post(body: any, options?: HttpOptions & {
99
+ protected post(body: any, options?: ODataOptions & {
106
100
  responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
107
101
  withCount?: boolean;
108
102
  }): Observable<any>;
109
- protected put(body: any, options?: HttpOptions & {
103
+ protected put(body: any, options?: ODataOptions & {
110
104
  etag?: string;
111
105
  responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
112
106
  withCount?: boolean;
113
107
  }): Observable<any>;
114
- protected patch(body: any, options?: HttpOptions & {
108
+ protected patch(body: any, options?: ODataOptions & {
115
109
  etag?: string;
116
110
  responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
117
111
  withCount?: boolean;
118
112
  }): Observable<any>;
119
- protected delete(options?: HttpOptions & {
113
+ protected delete(options?: ODataOptions & {
120
114
  etag?: string;
121
115
  responseType?: 'arraybuffer' | 'blob' | 'json' | 'text' | 'value' | 'property' | 'entity' | 'entities';
122
116
  withCount?: boolean;
@@ -1,5 +1,5 @@
1
- import { CsdlSchema } from './csdl/csdl-schema';
2
1
  import { CsdlReference } from './csdl/csdl-reference';
2
+ import { CsdlSchema } from './csdl/csdl-schema';
3
3
  declare enum FieldType {
4
4
  ATTRIBUTE = 0,
5
5
  TAG = 1
@@ -1,4 +1,4 @@
1
- import { ODataEntityAnnotations, ODataEntitiesAnnotations, ODataPropertyAnnotations } from './annotations';
1
+ import { ODataEntitiesAnnotations, ODataEntityAnnotations, ODataPropertyAnnotations } from './annotations';
2
2
  export declare type ODataEntity<T> = {
3
3
  entity: T | null;
4
4
  annots: ODataEntityAnnotations;
@@ -1,78 +1,64 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ODataPathSegments } from '../path-segments';
3
- import { ODataQueryOptions } from '../query-options';
4
- import { HttpEntityOptions, HttpEntitiesOptions, HttpPropertyOptions, HttpOptions, HttpNoneOptions } from './options';
5
- import { ODataProperty, ODataEntities, ODataEntity, ODataEntityAnnotations, ODataEntitiesAnnotations } from '../responses';
6
2
  import { ODataApi } from '../../api';
7
3
  import { ODataCollection, ODataModel } from '../../models';
8
- import { Expand, Filter, OrderBy, Select, Transform } from '../builder';
4
+ import { ODataCallable } from '../../schema/callable';
5
+ import { ODataPathSegments } from '../path';
6
+ import { ODataQueryOptions } from '../query';
9
7
  import { ODataResource } from '../resource';
8
+ import { ODataEntities, ODataEntity, ODataProperty } from '../responses';
9
+ import { ODataEntitiesOptions, ODataEntityOptions, ODataNoneOptions, ODataOptions, ODataPropertyOptions } from './options';
10
10
  export declare class ODataActionResource<P, R> extends ODataResource<R> {
11
- static factory<P, R>(api: ODataApi, path: string, type: string | undefined, segments: ODataPathSegments, query: ODataQueryOptions): ODataActionResource<P, R>;
12
- clone(): ODataActionResource<P, R>;
13
- schema(): import("angular-odata").ODataCallable<R> | undefined;
11
+ static factory<P, R>(api: ODataApi, { path, schema, segments, query, }: {
12
+ path?: string;
13
+ schema?: ODataCallable<R>;
14
+ segments?: ODataPathSegments;
15
+ query?: ODataQueryOptions<R>;
16
+ }): ODataActionResource<P, R>;
17
+ static fromResource<P, R>(resource: ODataResource<any>, path: string): ODataActionResource<P, R>;
14
18
  returnType(): string | undefined;
15
- asModel<M extends ODataModel<R>>(entity: Partial<R> | {
16
- [name: string]: any;
17
- }, { annots, reset }?: {
18
- annots?: ODataEntityAnnotations;
19
- reset?: boolean;
20
- }): M;
21
- asCollection<M extends ODataModel<R>, C extends ODataCollection<R, M>>(entities: Partial<R>[] | {
22
- [name: string]: any;
23
- }[], { annots, reset, }?: {
24
- annots?: ODataEntitiesAnnotations;
25
- reset?: boolean;
26
- }): C;
27
- select(opts: Select<R>): ODataActionResource<P, R>;
28
- expand(opts: Expand<R>): ODataActionResource<P, R>;
29
- transform(opts: Transform<R>): ODataActionResource<P, R>;
30
- search(opts: string): ODataActionResource<P, R>;
31
- filter(opts: Filter): ODataActionResource<P, R>;
32
- orderBy(opts: OrderBy<R>): ODataActionResource<P, R>;
33
- format(opts: string): ODataActionResource<P, R>;
34
- top(opts: number): ODataActionResource<P, R>;
35
- skip(opts: number): ODataActionResource<P, R>;
36
- skiptoken(opts: string): ODataActionResource<P, R>;
37
- get segment(): {
38
- entitySet(): import("../path-segments").SegmentHandler;
39
- singleton(): import("../path-segments").SegmentHandler;
40
- action(): import("../path-segments").SegmentHandler;
41
- };
19
+ protected post(params: P | null, options?: ODataEntityOptions & ODataEntitiesOptions & ODataPropertyOptions): Observable<any>;
42
20
  /**
43
- * Handle query options of the action
44
- * @returns Handler for mutate the query of the action
21
+ * Execute the action
22
+ * @param params Parameters to be sent to the action
23
+ * @param options Options for the request
45
24
  */
46
- get query(): {
47
- select(opts?: Select<R> | undefined): import("../query-options").OptionHandler<Select<R>>;
48
- expand(opts?: Expand<R> | undefined): import("../query-options").OptionHandler<Expand<R>>;
49
- compute(opts?: string | undefined): import("../query-options").OptionHandler<string>;
50
- transform(opts?: Transform<R> | undefined): import("../query-options").OptionHandler<Transform<R>>;
51
- search(opts?: string | undefined): import("../query-options").OptionHandler<string>;
52
- filter(opts?: Filter | undefined): import("../query-options").OptionHandler<Filter>;
53
- orderBy(opts?: OrderBy<R> | undefined): import("../query-options").OptionHandler<OrderBy<R>>;
54
- format(opts?: string | undefined): import("../query-options").OptionHandler<string>;
55
- top(opts?: number | undefined): import("../query-options").OptionHandler<number>;
56
- skip(opts?: number | undefined): import("../query-options").OptionHandler<number>;
57
- skiptoken(opts?: string | undefined): import("../query-options").OptionHandler<string>;
58
- paging({ skip, skiptoken, top, }?: {
59
- skip?: number | undefined;
60
- skiptoken?: string | undefined;
61
- top?: number | undefined;
62
- }): void;
63
- clearPaging(): void;
64
- apply(query: import("../query-options").QueryArguments<R>): void;
65
- };
66
- post(params: P | null, options?: HttpEntityOptions): Observable<ODataEntity<R>>;
67
- post(params: P | null, options?: HttpEntitiesOptions): Observable<ODataEntities<R>>;
68
- post(params: P | null, options?: HttpPropertyOptions): Observable<ODataProperty<R>>;
69
- call(params: P | null, options?: HttpEntityOptions & HttpOptions): Observable<ODataEntity<R>>;
70
- call(params: P | null, options?: HttpEntitiesOptions & HttpOptions): Observable<ODataEntities<R>>;
71
- call(params: P | null, options?: HttpPropertyOptions & HttpOptions): Observable<ODataProperty<R>>;
72
- call(params: P | null, options?: HttpNoneOptions & HttpOptions): Observable<null>;
73
- callProperty(params: P | null, options?: HttpOptions): Observable<R | null>;
74
- callEntity(params: P | null, options?: HttpOptions): Observable<R | null>;
75
- callModel(params: P | null, options?: HttpOptions): Observable<ODataModel<R> | null>;
76
- callEntities(params: P | null, options?: HttpOptions): Observable<R[] | null>;
77
- callCollection(params: P | null, options?: HttpOptions): Observable<ODataCollection<R, ODataModel<R>> | null>;
25
+ call(params: P | null, options?: ODataEntityOptions): Observable<ODataEntity<R>>;
26
+ call(params: P | null, options?: ODataEntitiesOptions): Observable<ODataEntities<R>>;
27
+ call(params: P | null, options?: ODataPropertyOptions): Observable<ODataProperty<R>>;
28
+ call(params: P | null, options?: ODataNoneOptions): Observable<null>;
29
+ /**
30
+ * Execute the action and return the result as a property
31
+ * @param params Parameters for the action
32
+ * @param options Options for the request
33
+ * @returns Observable of the result of the action
34
+ */
35
+ callProperty(params: P | null, options?: ODataOptions): Observable<R | null>;
36
+ /**
37
+ * Execute the action and return the result as a entity
38
+ * @param params Parameters for the action
39
+ * @param options Options for the request
40
+ * @returns Observable of the result of the action
41
+ */
42
+ callEntity(params: P | null, options?: ODataOptions): Observable<R | null>;
43
+ /**
44
+ * Execute the action and return the result as a model
45
+ * @param params Parameters for the action
46
+ * @param options Options for the request
47
+ * @returns Observable of the result of the action
48
+ */
49
+ callModel<M extends ODataModel<R>>(params: P | null, options?: ODataOptions): Observable<M | null>;
50
+ /**
51
+ * Execute the action and return the result as a entities
52
+ * @param params Parameters for the action
53
+ * @param options Options for the request
54
+ * @returns Observable of the result of the action
55
+ */
56
+ callEntities(params: P | null, options?: ODataOptions): Observable<R[] | null>;
57
+ /**
58
+ * Execute the action and return the result as a collection
59
+ * @param params Parameters for the action
60
+ * @param options Options for the request
61
+ * @returns Observable of the result of the action
62
+ */
63
+ callCollection<M extends ODataModel<R>, C extends ODataCollection<R, M>>(params: P | null, options?: ODataOptions): Observable<C | null>;
78
64
  }
@@ -1,16 +1,16 @@
1
1
  import { Observable, Subject } from 'rxjs';
2
- import { ODataResource } from '../resource';
3
- import { ODataRequest } from '../request';
4
2
  import { ODataApi } from '../../api';
3
+ import { ODataRequest } from '../request';
4
+ import { ODataResource } from '../resource';
5
5
  import { ODataResponse } from '../responses';
6
- import { HttpOptions } from './options';
6
+ import { ODataOptions } from './options';
7
7
  export declare class ODataBatchRequest<T> extends Subject<ODataResponse<T>> {
8
8
  request: ODataRequest<any>;
9
9
  constructor(request: ODataRequest<any>);
10
10
  toString(): string;
11
11
  onLoad(content: string[], status: {
12
12
  code: number;
13
- text: string;
13
+ message: string;
14
14
  }): void;
15
15
  onError(content: string[], status: {
16
16
  code: number;
@@ -22,11 +22,16 @@ export declare class ODataBatchRequest<T> extends Subject<ODataResponse<T>> {
22
22
  * https://www.odata.org/getting-started/advanced-tutorial/#batch
23
23
  */
24
24
  export declare class ODataBatchResource extends ODataResource<any> {
25
- private requests;
26
- clone(): ODataBatchResource;
27
- schema(): undefined;
25
+ private _requests;
26
+ requests(): ODataRequest<any>[];
28
27
  static factory(api: ODataApi): ODataBatchResource;
29
- post(func: (batch: ODataBatchResource) => void, options?: HttpOptions): Observable<ODataResponse<any>>;
28
+ /**
29
+ * Execute the batch request
30
+ * @param ctx The context for the request
31
+ * @param options The options of the batch request
32
+ * @returns The result of execute the context
33
+ */
34
+ exec<R>(ctx: (batch: this) => Observable<R>, options?: ODataOptions): Observable<R>;
30
35
  body(): string;
31
36
  static buildBody(batchBoundary: string, requests: ODataBatchRequest<any>[]): string;
32
37
  static handleResponse(requests: ODataBatchRequest<any>[], response: ODataResponse<any>): void;
@@ -1,22 +1,19 @@
1
1
  import { Observable } from 'rxjs';
2
- import { ODataPathSegments } from '../path-segments';
3
- import { ODataQueryOptions } from '../query-options';
4
- import { ODataResource } from '../resource';
5
- import { HttpOptions } from './options';
6
2
  import { ODataApi } from '../../api';
7
- import { Filter } from '../builder';
8
- export declare class ODataCountResource extends ODataResource<any> {
9
- static factory(api: ODataApi, segments: ODataPathSegments, query: ODataQueryOptions): ODataCountResource;
10
- clone(): ODataCountResource;
11
- schema(): undefined;
12
- get segment(): {
13
- entitySet(): import("../path-segments").SegmentHandler;
14
- navigationProperty(): import("../path-segments").SegmentHandler;
15
- };
16
- get query(): {
17
- search(opts?: string | undefined): import("../query-options").OptionHandler<string>;
18
- filter(opts?: Filter | undefined): import("../query-options").OptionHandler<Filter>;
19
- };
20
- get(options?: HttpOptions): Observable<number>;
21
- fetch(options?: HttpOptions): Observable<number>;
3
+ import { ODataPathSegments } from '../path';
4
+ import { ODataQueryOptions } from '../query';
5
+ import { ODataResource } from '../resource';
6
+ import { ODataOptions } from './options';
7
+ export declare class ODataCountResource<T> extends ODataResource<T> {
8
+ static factory<T>(api: ODataApi, { segments, query, }: {
9
+ segments: ODataPathSegments;
10
+ query?: ODataQueryOptions<T>;
11
+ }): ODataCountResource<T>;
12
+ protected get(options?: ODataOptions): Observable<number>;
13
+ /**
14
+ * Fetch the count of the set.
15
+ * @param options Options for the request
16
+ * @returns The count of the set
17
+ */
18
+ fetch(options?: ODataOptions): Observable<number>;
22
19
  }