angular-odata 0.80.0 → 0.99.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 (237) hide show
  1. package/README.md +69 -34
  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} +3 -3
  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} +1 -1
  7. package/{esm2015/lib/cache/storage.js → esm2020/lib/cache/storage.mjs} +2 -2
  8. package/esm2020/lib/client.mjs +271 -0
  9. package/{esm2015/lib/constants.js → esm2020/lib/constants.mjs} +8 -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} +7 -7
  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/base.mjs +20 -0
  24. package/esm2020/lib/resources/query/expressions/compute.mjs +38 -0
  25. package/esm2020/lib/resources/query/expressions/expand.mjs +57 -0
  26. package/esm2020/lib/resources/query/expressions/filter.mjs +154 -0
  27. package/esm2020/lib/resources/query/expressions/index.mjs +7 -0
  28. package/esm2020/lib/resources/query/expressions/orderby.mjs +54 -0
  29. package/esm2020/lib/resources/query/expressions/search.mjs +113 -0
  30. package/esm2020/lib/resources/query/expressions/select.mjs +32 -0
  31. package/esm2020/lib/resources/query/expressions/syntax.mjs +371 -0
  32. package/esm2020/lib/resources/query/handlers.mjs +188 -0
  33. package/esm2020/lib/resources/query/index.mjs +4 -0
  34. package/esm2020/lib/resources/query/options.mjs +103 -0
  35. package/esm2020/lib/resources/request.mjs +167 -0
  36. package/esm2020/lib/resources/resource.mjs +326 -0
  37. package/esm2020/lib/resources/responses/annotations.mjs +119 -0
  38. package/{esm2015/lib/resources/responses/csdl/csdl-annotation.js → esm2020/lib/resources/responses/csdl/csdl-annotation.mjs} +0 -0
  39. package/{esm2015/lib/resources/responses/csdl/csdl-entity-container.js → esm2020/lib/resources/responses/csdl/csdl-entity-container.mjs} +0 -0
  40. package/{esm2015/lib/resources/responses/csdl/csdl-entity-set.js → esm2020/lib/resources/responses/csdl/csdl-entity-set.mjs} +0 -0
  41. package/{esm2015/lib/resources/responses/csdl/csdl-enum-type.js → esm2020/lib/resources/responses/csdl/csdl-enum-type.mjs} +0 -0
  42. package/{esm2015/lib/resources/responses/csdl/csdl-function-action.js → esm2020/lib/resources/responses/csdl/csdl-function-action.mjs} +0 -0
  43. package/{esm2015/lib/resources/responses/csdl/csdl-navigation-property-binding.js → esm2020/lib/resources/responses/csdl/csdl-navigation-property-binding.mjs} +0 -0
  44. package/{esm2015/lib/resources/responses/csdl/csdl-reference.js → esm2020/lib/resources/responses/csdl/csdl-reference.mjs} +0 -0
  45. package/{esm2015/lib/resources/responses/csdl/csdl-schema.js → esm2020/lib/resources/responses/csdl/csdl-schema.mjs} +0 -0
  46. package/{esm2015/lib/resources/responses/csdl/csdl-singleton.js → esm2020/lib/resources/responses/csdl/csdl-singleton.mjs} +0 -0
  47. package/{esm2015/lib/resources/responses/csdl/csdl-structural-property.js → esm2020/lib/resources/responses/csdl/csdl-structural-property.mjs} +0 -0
  48. package/{esm2015/lib/resources/responses/csdl/csdl-structured-type.js → esm2020/lib/resources/responses/csdl/csdl-structured-type.mjs} +0 -0
  49. package/{esm2015/lib/resources/responses/csdl/csdl-type-definition.js → esm2020/lib/resources/responses/csdl/csdl-type-definition.mjs} +0 -0
  50. package/{esm2015/lib/resources/responses/index.js → esm2020/lib/resources/responses/index.mjs} +0 -0
  51. package/esm2020/lib/resources/responses/metadata.mjs +547 -0
  52. package/{esm2015/lib/resources/responses/options.js → esm2020/lib/resources/responses/options.mjs} +0 -0
  53. package/{esm2015/lib/resources/responses/response.js → esm2020/lib/resources/responses/response.mjs} +0 -0
  54. package/{esm2015/lib/resources/responses/types.js → esm2020/lib/resources/responses/types.mjs} +0 -0
  55. package/esm2020/lib/resources/types/action.mjs +101 -0
  56. package/esm2020/lib/resources/types/batch.mjs +309 -0
  57. package/esm2020/lib/resources/types/count.mjs +27 -0
  58. package/esm2020/lib/resources/types/entity-set.mjs +94 -0
  59. package/esm2020/lib/resources/types/entity.mjs +106 -0
  60. package/esm2020/lib/resources/types/function.mjs +137 -0
  61. package/{esm2015/lib/resources/types/index.js → esm2020/lib/resources/types/index.mjs} +0 -0
  62. package/esm2020/lib/resources/types/media.mjs +41 -0
  63. package/esm2020/lib/resources/types/metadata.mjs +30 -0
  64. package/esm2020/lib/resources/types/navigation-property.mjs +226 -0
  65. package/esm2020/lib/resources/types/options.mjs +2 -0
  66. package/esm2020/lib/resources/types/property.mjs +183 -0
  67. package/esm2020/lib/resources/types/reference.mjs +85 -0
  68. package/esm2020/lib/resources/types/singleton.mjs +126 -0
  69. package/esm2020/lib/resources/types/value.mjs +41 -0
  70. package/esm2020/lib/schema/annotation.mjs +37 -0
  71. package/esm2020/lib/schema/callable.mjs +62 -0
  72. package/esm2020/lib/schema/element.mjs +51 -0
  73. package/esm2020/lib/schema/entity-container.mjs +9 -0
  74. package/esm2020/lib/schema/entity-set.mjs +9 -0
  75. package/esm2020/lib/schema/enum-type.mjs +71 -0
  76. package/{esm2015/lib/schema/index.js → esm2020/lib/schema/index.mjs} +2 -1
  77. package/esm2020/lib/schema/parsers/callable.mjs +113 -0
  78. package/esm2020/lib/schema/parsers/edm.mjs +95 -0
  79. package/esm2020/lib/schema/parsers/enum-type.mjs +107 -0
  80. package/esm2020/lib/schema/parsers/index.mjs +5 -0
  81. package/esm2020/lib/schema/parsers/structured-type.mjs +412 -0
  82. package/esm2020/lib/schema/schema.mjs +61 -0
  83. package/esm2020/lib/schema/structured-type.mjs +198 -0
  84. package/esm2020/lib/services/base.mjs +29 -0
  85. package/esm2020/lib/services/entity-set.mjs +143 -0
  86. package/esm2020/lib/services/entity.mjs +12 -0
  87. package/{esm2015/lib/services/factory.js → esm2020/lib/services/factory.mjs} +3 -3
  88. package/{esm2015/lib/services/index.js → esm2020/lib/services/index.mjs} +0 -0
  89. package/esm2020/lib/services/singleton.mjs +48 -0
  90. package/{esm2015/lib/settings.js → esm2020/lib/settings.mjs} +1 -1
  91. package/{esm2015/lib/tokens.js → esm2020/lib/tokens.mjs} +0 -0
  92. package/esm2020/lib/types.mjs +37 -0
  93. package/esm2020/lib/utils/arraybuffers.mjs +46 -0
  94. package/{esm2015/lib/utils/dates.js → esm2020/lib/utils/dates.mjs} +0 -0
  95. package/esm2020/lib/utils/durations.mjs +40 -0
  96. package/{esm2015/lib/utils/enums.js → esm2020/lib/utils/enums.mjs} +0 -0
  97. package/esm2020/lib/utils/http.mjs +93 -0
  98. package/esm2020/lib/utils/index.mjs +10 -0
  99. package/esm2020/lib/utils/objects.mjs +195 -0
  100. package/esm2020/lib/utils/odata.mjs +22 -0
  101. package/esm2020/lib/utils/strings.mjs +20 -0
  102. package/esm2020/lib/utils/types.mjs +134 -0
  103. package/{esm2015/lib/utils/urls.js → esm2020/lib/utils/urls.mjs} +0 -0
  104. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  105. package/fesm2015/{angular-odata.js → angular-odata.mjs} +4508 -3427
  106. package/fesm2015/angular-odata.mjs.map +1 -0
  107. package/fesm2020/angular-odata.mjs +10510 -0
  108. package/fesm2020/angular-odata.mjs.map +1 -0
  109. package/lib/api.d.ts +14 -14
  110. package/lib/cache/cache.d.ts +2 -2
  111. package/lib/cache/storage.d.ts +1 -1
  112. package/lib/client.d.ts +60 -9
  113. package/lib/constants.d.ts +5 -2
  114. package/lib/index.d.ts +0 -1
  115. package/lib/models/collection.d.ts +30 -42
  116. package/lib/models/model.d.ts +37 -30
  117. package/lib/models/options.d.ts +30 -38
  118. package/lib/module.d.ts +1 -1
  119. package/lib/options.d.ts +47 -0
  120. package/lib/resources/index.d.ts +2 -3
  121. package/lib/resources/path/handlers.d.ts +27 -0
  122. package/lib/resources/path/index.d.ts +2 -0
  123. package/lib/resources/{path-segments.d.ts → path/segments.d.ts} +4 -16
  124. package/lib/resources/{builder.d.ts → query/builder.d.ts} +12 -7
  125. package/lib/resources/query/expressions/base.d.ts +19 -0
  126. package/lib/resources/query/expressions/compute.d.ts +26 -0
  127. package/lib/resources/query/expressions/expand.d.ts +40 -0
  128. package/lib/resources/query/expressions/filter.d.ts +58 -0
  129. package/lib/resources/query/expressions/index.d.ts +6 -0
  130. package/lib/resources/query/expressions/orderby.d.ts +37 -0
  131. package/lib/resources/query/expressions/search.d.ts +47 -0
  132. package/lib/resources/query/expressions/select.d.ts +21 -0
  133. package/lib/resources/query/expressions/syntax.d.ts +177 -0
  134. package/lib/resources/query/handlers.d.ts +104 -0
  135. package/lib/resources/query/index.d.ts +3 -0
  136. package/lib/resources/query/options.d.ts +38 -0
  137. package/lib/resources/request.d.ts +4 -3
  138. package/lib/resources/resource.d.ts +42 -48
  139. package/lib/resources/types/action.d.ts +14 -61
  140. package/lib/resources/types/batch.d.ts +16 -3
  141. package/lib/resources/types/count.d.ts +9 -17
  142. package/lib/resources/types/entity-set.d.ts +12 -51
  143. package/lib/resources/types/entity.d.ts +13 -31
  144. package/lib/resources/types/function.d.ts +13 -60
  145. package/lib/resources/types/media.d.ts +9 -8
  146. package/lib/resources/types/metadata.d.ts +3 -5
  147. package/lib/resources/types/navigation-property.d.ts +74 -65
  148. package/lib/resources/types/options.d.ts +1 -1
  149. package/lib/resources/types/property.d.ts +49 -57
  150. package/lib/resources/types/reference.d.ts +65 -9
  151. package/lib/resources/types/singleton.d.ts +53 -31
  152. package/lib/resources/types/value.d.ts +16 -7
  153. package/lib/schema/annotation.d.ts +18 -0
  154. package/lib/schema/callable.d.ts +4 -20
  155. package/lib/schema/element.d.ts +39 -0
  156. package/lib/schema/entity-container.d.ts +2 -12
  157. package/lib/schema/entity-set.d.ts +2 -18
  158. package/lib/schema/enum-type.d.ts +19 -25
  159. package/lib/schema/index.d.ts +1 -0
  160. package/lib/{parsers → schema/parsers}/callable.d.ts +2 -2
  161. package/lib/schema/parsers/edm.d.ts +4 -0
  162. package/lib/{parsers → schema/parsers}/enum-type.d.ts +12 -11
  163. package/lib/{parsers → schema/parsers}/index.d.ts +0 -0
  164. package/lib/{parsers → schema/parsers}/structured-type.d.ts +12 -12
  165. package/lib/schema/schema.d.ts +3 -10
  166. package/lib/schema/structured-type.d.ts +65 -27
  167. package/lib/services/base.d.ts +2 -2
  168. package/lib/services/entity-set.d.ts +5 -2
  169. package/lib/services/entity.d.ts +4 -1
  170. package/lib/services/singleton.d.ts +5 -2
  171. package/lib/settings.d.ts +5 -5
  172. package/lib/types.d.ts +1 -0
  173. package/lib/utils/arraybuffers.d.ts +4 -0
  174. package/lib/{parsers/edm.d.ts → utils/durations.d.ts} +3 -3
  175. package/lib/utils/http.d.ts +1 -0
  176. package/lib/utils/index.d.ts +1 -0
  177. package/lib/utils/objects.d.ts +1 -0
  178. package/lib/utils/strings.d.ts +1 -0
  179. package/lib/utils/types.d.ts +2 -0
  180. package/package.json +21 -8
  181. package/bundles/angular-odata.umd.js +0 -11048
  182. package/bundles/angular-odata.umd.js.map +0 -1
  183. package/esm2015/lib/api.js +0 -297
  184. package/esm2015/lib/client.js +0 -221
  185. package/esm2015/lib/helper.js +0 -271
  186. package/esm2015/lib/index.js +0 -21
  187. package/esm2015/lib/models/collection.js +0 -687
  188. package/esm2015/lib/models/model.js +0 -423
  189. package/esm2015/lib/models/options.js +0 -909
  190. package/esm2015/lib/options.js +0 -31
  191. package/esm2015/lib/parsers/callable.js +0 -107
  192. package/esm2015/lib/parsers/edm.js +0 -192
  193. package/esm2015/lib/parsers/enum-type.js +0 -102
  194. package/esm2015/lib/parsers/index.js +0 -5
  195. package/esm2015/lib/parsers/structured-type.js +0 -389
  196. package/esm2015/lib/resources/builder.js +0 -537
  197. package/esm2015/lib/resources/index.js +0 -8
  198. package/esm2015/lib/resources/path-segments.js +0 -156
  199. package/esm2015/lib/resources/query-options.js +0 -157
  200. package/esm2015/lib/resources/request.js +0 -149
  201. package/esm2015/lib/resources/resource.js +0 -337
  202. package/esm2015/lib/resources/responses/annotations.js +0 -121
  203. package/esm2015/lib/resources/responses/metadata.js +0 -548
  204. package/esm2015/lib/resources/types/action.js +0 -180
  205. package/esm2015/lib/resources/types/batch.js +0 -288
  206. package/esm2015/lib/resources/types/count.js +0 -55
  207. package/esm2015/lib/resources/types/entity-set.js +0 -169
  208. package/esm2015/lib/resources/types/entity.js +0 -170
  209. package/esm2015/lib/resources/types/function.js +0 -205
  210. package/esm2015/lib/resources/types/media.js +0 -47
  211. package/esm2015/lib/resources/types/metadata.js +0 -36
  212. package/esm2015/lib/resources/types/navigation-property.js +0 -232
  213. package/esm2015/lib/resources/types/options.js +0 -2
  214. package/esm2015/lib/resources/types/property.js +0 -195
  215. package/esm2015/lib/resources/types/reference.js +0 -50
  216. package/esm2015/lib/resources/types/singleton.js +0 -159
  217. package/esm2015/lib/resources/types/value.js +0 -30
  218. package/esm2015/lib/schema/annotation.js +0 -7
  219. package/esm2015/lib/schema/callable.js +0 -82
  220. package/esm2015/lib/schema/entity-container.js +0 -22
  221. package/esm2015/lib/schema/entity-set.js +0 -33
  222. package/esm2015/lib/schema/enum-type.js +0 -101
  223. package/esm2015/lib/schema/schema.js +0 -60
  224. package/esm2015/lib/schema/structured-type.js +0 -148
  225. package/esm2015/lib/services/base.js +0 -23
  226. package/esm2015/lib/services/entity-set.js +0 -143
  227. package/esm2015/lib/services/entity.js +0 -10
  228. package/esm2015/lib/services/singleton.js +0 -46
  229. package/esm2015/lib/types.js +0 -37
  230. package/esm2015/lib/utils/http.js +0 -89
  231. package/esm2015/lib/utils/index.js +0 -9
  232. package/esm2015/lib/utils/objects.js +0 -139
  233. package/esm2015/lib/utils/odata.js +0 -21
  234. package/esm2015/lib/utils/strings.js +0 -13
  235. package/esm2015/lib/utils/types.js +0 -103
  236. package/fesm2015/angular-odata.js.map +0 -1
  237. package/lib/resources/query-options.d.ts +0 -57
package/lib/options.d.ts CHANGED
@@ -1,17 +1,45 @@
1
1
  import { ApiOptions, FetchPolicy, ODataMetadataType, ODataVersion, Options, OptionsHelper, QueryOptionNames } from './types';
2
2
  export declare class ODataApiOptions implements ApiOptions, OptionsHelper {
3
+ /**
4
+ * Default OData version
5
+ */
3
6
  version: ODataVersion;
7
+ /**
8
+ * Send enum as string in the request
9
+ */
4
10
  stringAsEnum?: boolean;
11
+ /**
12
+ * Strip metadata from the response
13
+ */
5
14
  stripMetadata: ODataMetadataType;
15
+ /**
16
+ * Cache fetch policy
17
+ */
6
18
  fetchPolicy: FetchPolicy;
19
+ /**
20
+ * Extra params to be sent in the request
21
+ */
7
22
  params: {
8
23
  [param: string]: string | string[];
9
24
  };
25
+ /**
26
+ * Extra headers to be sent in the request
27
+ */
10
28
  headers: {
11
29
  [param: string]: string | string[];
12
30
  };
31
+ /**
32
+ * Http request with credentials
33
+ */
13
34
  withCredentials?: boolean;
35
+ /**
36
+ * Send query options in the request body
37
+ */
14
38
  bodyQueryOptions: QueryOptionNames[];
39
+ /**
40
+ * Customize accept header with OData options
41
+ * @link http://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html#sec_RequestingtheJSONFormat
42
+ */
15
43
  accept?: {
16
44
  exponentialDecimals?: boolean;
17
45
  ieee754Compatible?: boolean;
@@ -19,15 +47,34 @@ export declare class ODataApiOptions implements ApiOptions, OptionsHelper {
19
47
  streaming?: boolean;
20
48
  };
21
49
  etag: {
50
+ /**
51
+ * @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
52
+ */
22
53
  ifMatch: boolean;
54
+ /**
55
+ * @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
56
+ */
23
57
  ifNoneMatch: boolean;
24
58
  };
25
59
  prefer?: {
60
+ /**
61
+ * @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
62
+ */
26
63
  maxPageSize?: number;
64
+ /**
65
+ * @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
66
+ */
27
67
  return?: 'representation' | 'minimal';
68
+ /**
69
+ * @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
70
+ */
28
71
  continueOnError?: boolean;
72
+ /**
73
+ * @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
74
+ */
29
75
  includeAnnotations?: string;
30
76
  };
77
+ deleteRefBy: 'path' | 'id';
31
78
  constructor(config: ApiOptions);
32
79
  get helper(): import("./helper").ODataVersionHelper;
33
80
  }
@@ -1,6 +1,5 @@
1
- export * from './builder';
2
- export * from './query-options';
3
- export * from './path-segments';
1
+ export * from './query';
2
+ export * from './path';
4
3
  export * from './request';
5
4
  export * from './resource';
6
5
  export * from './types';
@@ -0,0 +1,27 @@
1
+ import { PathSegmentNames } from '../../types';
2
+ import { EntityKey } from '../resource';
3
+ import type { ODataPathSegments, ODataSegment } from './segments';
4
+ export declare class SegmentHandler {
5
+ private segment;
6
+ constructor(segment: ODataSegment);
7
+ get name(): PathSegmentNames;
8
+ type(value?: string): string | undefined;
9
+ path(value?: string): string;
10
+ key<T>(value?: EntityKey<T>): EntityKey<T>;
11
+ hasKey(): boolean;
12
+ clearKey(): void;
13
+ parameters<T>(value?: T): T;
14
+ hasParameters(): boolean;
15
+ clearParameters(): void;
16
+ }
17
+ export declare class ODataPathSegmentsHandler<T> {
18
+ protected segments: ODataPathSegments;
19
+ constructor(segments: ODataPathSegments);
20
+ entitySet(): SegmentHandler;
21
+ singleton(): SegmentHandler;
22
+ action(): SegmentHandler;
23
+ function(): SegmentHandler;
24
+ keys(values?: (EntityKey<T> | undefined)[]): (EntityKey<any> | undefined)[];
25
+ property(): SegmentHandler;
26
+ navigationProperty(): SegmentHandler;
27
+ }
@@ -0,0 +1,2 @@
1
+ export * from './segments';
2
+ export * from './handlers';
@@ -1,5 +1,6 @@
1
- import { EntityKey } from './resource';
2
- import { PathSegmentNames } from '../types';
1
+ import { PathSegmentNames } from '../../types';
2
+ import { EntityKey } from '../resource';
3
+ import { SegmentHandler } from './handlers';
3
4
  export declare type ODataSegment = {
4
5
  name: PathSegmentNames;
5
6
  path: string;
@@ -10,7 +11,7 @@ export declare type ODataSegment = {
10
11
  export declare class ODataPathSegments {
11
12
  private _segments;
12
13
  constructor(segments?: ODataSegment[]);
13
- pathAndParams(): [string, {
14
+ pathAndParams(escape?: boolean): [string, {
14
15
  [name: string]: any;
15
16
  }];
16
17
  types({ key }?: {
@@ -33,16 +34,3 @@ export declare class ODataPathSegments {
33
34
  add(name: string, path: string): SegmentHandler;
34
35
  get(name: string): SegmentHandler;
35
36
  }
36
- export declare class SegmentHandler {
37
- private segment;
38
- constructor(segment: ODataSegment);
39
- get name(): PathSegmentNames;
40
- type(value?: string): string | undefined;
41
- path(value?: string): string;
42
- key<T>(value?: EntityKey<T>): EntityKey<T>;
43
- hasKey(): boolean;
44
- clearKey(): void;
45
- parameters<T>(value?: T): T;
46
- hasParameters(): boolean;
47
- clearParameters(): void;
48
- }
@@ -1,7 +1,7 @@
1
1
  export declare type Unpacked<T> = T extends (infer U)[] ? U : T;
2
2
  export declare type Select<T> = SelectType<T> | SelectType<T>[];
3
3
  export declare type SelectType<T> = string | keyof T;
4
- export declare type Filter = FilterType | FilterType[];
4
+ export declare type Filter<T> = FilterType | FilterType[];
5
5
  export declare type FilterType = string | {
6
6
  [name: string]: any;
7
7
  };
@@ -29,16 +29,16 @@ export declare type NestedExpandOptions<T> = {
29
29
  };
30
30
  export declare type ExpandOptions<T> = {
31
31
  select?: Select<T>;
32
- filter?: Filter;
32
+ filter?: Filter<T>;
33
33
  orderBy?: OrderBy<T>;
34
34
  top?: number;
35
35
  levels?: number | 'max';
36
- count?: boolean | Filter;
36
+ count?: boolean | Filter<T>;
37
37
  expand?: Expand<T>;
38
38
  };
39
39
  export declare type Transform<T> = {
40
40
  aggregate?: Aggregate | Array<Aggregate>;
41
- filter?: Filter;
41
+ filter?: Filter<T>;
42
42
  groupBy?: GroupBy<T>;
43
43
  };
44
44
  export declare type GroupBy<T> = {
@@ -74,7 +74,7 @@ export declare type QueryOptions<T> = ExpandOptions<T> & {
74
74
  key: string | number | {
75
75
  [name: string]: any;
76
76
  };
77
- count: boolean | Filter;
77
+ count: boolean | Filter<T>;
78
78
  action: string;
79
79
  func: string | {
80
80
  [functionName: string]: {
@@ -83,9 +83,14 @@ export declare type QueryOptions<T> = ExpandOptions<T> & {
83
83
  };
84
84
  format: string;
85
85
  aliases: QueryCustomType[];
86
+ escape: boolean;
86
87
  };
87
88
  export declare const ITEM_ROOT = "";
88
- export default function <T>({ select, search, skiptoken, format, top, skip, filter, transform, orderBy, key, count, expand, action, func, }?: Partial<QueryOptions<T>>): string;
89
- export declare function buildPathAndQuery<T>({ select, search, skiptoken, format, top, skip, filter, transform, orderBy, key, count, expand, action, func, }?: Partial<QueryOptions<T>>): [string, {
89
+ export default function <T>({ select, search, skiptoken, format, top, skip, filter, transform, orderBy, key, count, expand, action, func, aliases, escape, }?: Partial<QueryOptions<T>>): string;
90
+ export declare function buildPathAndQuery<T>({ select, search, skiptoken, format, top, skip, filter, transform, orderBy, key, count, expand, action, func, aliases, escape, }?: Partial<QueryOptions<T>>): [string, {
90
91
  [name: string]: any;
91
92
  }];
93
+ export declare function normalizeValue(value: Value, { aliases, escape }: {
94
+ aliases?: QueryCustomType[];
95
+ escape?: boolean;
96
+ }): any;
@@ -0,0 +1,19 @@
1
+ import type { QueryCustomType } from '../builder';
2
+ import { Renderable } from './syntax';
3
+ export declare abstract class Expression<T> implements Renderable {
4
+ protected _children: Renderable[];
5
+ constructor({ children, }?: {
6
+ children?: Renderable[];
7
+ });
8
+ get [Symbol.toStringTag](): string;
9
+ abstract render({ aliases, escape, prefix, }: {
10
+ aliases?: QueryCustomType[] | undefined;
11
+ escape?: boolean | undefined;
12
+ prefix?: string | undefined;
13
+ }): string;
14
+ children(): Renderable[];
15
+ length(): number;
16
+ toJSON(): {
17
+ children: any[];
18
+ };
19
+ }
@@ -0,0 +1,26 @@
1
+ import type { QueryCustomType } from '../builder';
2
+ import { Expression } from './base';
3
+ import { ODataFunctions, ODataOperators, Renderable } from './syntax';
4
+ export declare class ComputeExpression<T> extends Expression<T> {
5
+ names: string[];
6
+ constructor({ children, names, }?: {
7
+ children?: Renderable[];
8
+ names?: string[];
9
+ });
10
+ static e<T>(): ComputeExpression<T>;
11
+ static s<T extends object>(): T;
12
+ static compute<T extends object>(opts: (e: {
13
+ s: T;
14
+ e: () => ComputeExpression<T>;
15
+ }) => ComputeExpression<T>): ComputeExpression<T>;
16
+ render({ aliases, escape, prefix, }?: {
17
+ aliases?: QueryCustomType[] | undefined;
18
+ escape?: boolean | undefined;
19
+ prefix?: string | undefined;
20
+ }): string;
21
+ private _add;
22
+ field<T extends object>(name: string, opts: (e: {
23
+ o: ODataOperators<T>;
24
+ f: ODataFunctions<T>;
25
+ }) => Renderable): ComputeExpression<T>;
26
+ }
@@ -0,0 +1,40 @@
1
+ import type { QueryCustomType } from '../builder';
2
+ import { Expression } from './base';
3
+ import { Renderable } from './syntax';
4
+ export declare class ExpandField<T> implements Renderable {
5
+ protected field: Renderable;
6
+ constructor(field: Renderable);
7
+ get [Symbol.toStringTag](): string;
8
+ toJSON(): {
9
+ field: any;
10
+ };
11
+ render({ aliases, escape, prefix, }: {
12
+ aliases?: QueryCustomType[];
13
+ escape?: boolean;
14
+ prefix?: string;
15
+ }): string;
16
+ select(): void;
17
+ filter(): void;
18
+ levels(): void;
19
+ orderBy(): void;
20
+ top(): void;
21
+ skip(): void;
22
+ }
23
+ export declare class ExpandExpression<T> extends Expression<T> {
24
+ constructor({ children, }?: {
25
+ children?: Renderable[];
26
+ });
27
+ static e<T>(): ExpandExpression<T>;
28
+ static s<T extends object>(): T;
29
+ static expand<T extends object>(opts: (e: {
30
+ s: T;
31
+ e: () => ExpandExpression<T>;
32
+ }) => ExpandExpression<T>): ExpandExpression<T>;
33
+ render({ aliases, escape, prefix, }?: {
34
+ aliases?: QueryCustomType[] | undefined;
35
+ escape?: boolean | undefined;
36
+ prefix?: string | undefined;
37
+ }): string;
38
+ private _add;
39
+ field<T extends object>(field: any, opts?: (e: ExpandField<keyof T>) => void): ExpandExpression<T>;
40
+ }
@@ -0,0 +1,58 @@
1
+ import type { QueryCustomType } from '../builder';
2
+ import { Expression } from './base';
3
+ import { ODataFunctions, ODataOperators, Renderable } from './syntax';
4
+ export declare type FilterConnector = 'and' | 'or';
5
+ export declare class FilterExpression<T> extends Expression<T> {
6
+ private _connector;
7
+ private _negated;
8
+ constructor({ children, connector, negated, }?: {
9
+ children?: Renderable[];
10
+ connector?: FilterConnector;
11
+ negated?: boolean;
12
+ });
13
+ static s<T extends object>(): T;
14
+ static e<T>(connector?: FilterConnector): FilterExpression<T>;
15
+ static filter<T extends object>(opts: (e: {
16
+ s: T;
17
+ e: (connector?: FilterConnector) => FilterExpression<T>;
18
+ o: ODataOperators<T>;
19
+ f: ODataFunctions<T>;
20
+ }) => FilterExpression<T>): FilterExpression<T>;
21
+ toJSON(): {
22
+ children: any[];
23
+ connector: FilterConnector;
24
+ negated: boolean;
25
+ };
26
+ connector(): FilterConnector;
27
+ negated(): boolean;
28
+ render({ aliases, escape, prefix, }?: {
29
+ aliases?: QueryCustomType[];
30
+ escape?: boolean;
31
+ prefix?: string;
32
+ }): string;
33
+ private _add;
34
+ or(exp: FilterExpression<T>): FilterExpression<T>;
35
+ and(exp: FilterExpression<T>): FilterExpression<T>;
36
+ not(exp: FilterExpression<T>): FilterExpression<T>;
37
+ eq(left: any, right: any, normalize?: boolean): FilterExpression<T>;
38
+ ne(left: any, right: any, normalize?: boolean): FilterExpression<T>;
39
+ gt(left: any, right: any, normalize?: boolean): FilterExpression<T>;
40
+ ge(left: any, right: any, normalize?: boolean): FilterExpression<T>;
41
+ lt(left: any, right: any, normalize?: boolean): FilterExpression<T>;
42
+ le(left: any, right: any, normalize?: boolean): FilterExpression<T>;
43
+ has(left: any, right: any, normalize?: boolean): FilterExpression<T>;
44
+ in(left: any, right: any, normalize?: boolean): FilterExpression<T>;
45
+ contains(left: any, right: any, normalize?: boolean): FilterExpression<T>;
46
+ startsWith(left: any, right: any, normalize?: boolean): FilterExpression<T>;
47
+ endsWith(left: any, right: any, normalize?: boolean): FilterExpression<T>;
48
+ any<N extends object>(left: N[], opts: (e: {
49
+ s: N;
50
+ e: (connector?: FilterConnector) => FilterExpression<N>;
51
+ }) => FilterExpression<N>, alias?: string): FilterExpression<T>;
52
+ all<N extends object>(left: N[], opts: (e: {
53
+ s: N;
54
+ e: (connector?: FilterConnector) => FilterExpression<N>;
55
+ }) => FilterExpression<N>, alias?: string): FilterExpression<T>;
56
+ isof(type: string): FilterExpression<T>;
57
+ isof(left: T, type: string): FilterExpression<T>;
58
+ }
@@ -0,0 +1,6 @@
1
+ export * from './base';
2
+ export * from './compute';
3
+ export * from './filter';
4
+ export * from './orderby';
5
+ export * from './search';
6
+ export * from './syntax';
@@ -0,0 +1,37 @@
1
+ import type { QueryCustomType } from '../builder';
2
+ import { Expression } from './base';
3
+ import { Renderable } from './syntax';
4
+ export declare class OrderByField implements Renderable {
5
+ protected field: Renderable;
6
+ protected order: 'asc' | 'desc';
7
+ constructor(field: Renderable, order: 'asc' | 'desc');
8
+ get [Symbol.toStringTag](): string;
9
+ toJSON(): {
10
+ field: any;
11
+ order: "desc" | "asc";
12
+ };
13
+ render({ aliases, escape, prefix, }: {
14
+ aliases?: QueryCustomType[];
15
+ escape?: boolean;
16
+ prefix?: string;
17
+ }): string;
18
+ }
19
+ export declare class OrderByExpression<T> extends Expression<T> {
20
+ constructor({ children, }?: {
21
+ children?: Renderable[];
22
+ });
23
+ static e<T>(): OrderByExpression<T>;
24
+ static s<T extends object>(): T;
25
+ static orderBy<T extends object>(opts: (e: {
26
+ s: T;
27
+ e: () => OrderByExpression<T>;
28
+ }) => OrderByExpression<T>): OrderByExpression<T>;
29
+ private _add;
30
+ render({ aliases, escape, prefix, }?: {
31
+ aliases?: QueryCustomType[] | undefined;
32
+ escape?: boolean | undefined;
33
+ prefix?: string | undefined;
34
+ }): string;
35
+ ascending(field: any): OrderByExpression<T>;
36
+ descending(field: any): OrderByExpression<T>;
37
+ }
@@ -0,0 +1,47 @@
1
+ import type { QueryCustomType } from '../builder';
2
+ import { Expression } from './base';
3
+ import { Renderable } from './syntax';
4
+ export declare type SearchConnector = 'AND' | 'OR';
5
+ export declare class SearchTerm implements Renderable {
6
+ protected value: string;
7
+ constructor(value: string);
8
+ get [Symbol.toStringTag](): string;
9
+ toJSON(): {
10
+ value: string;
11
+ };
12
+ render({ aliases, escape, prefix, }: {
13
+ aliases?: QueryCustomType[];
14
+ escape?: boolean;
15
+ prefix?: string;
16
+ }): string;
17
+ }
18
+ export declare class SearchExpression<T> extends Expression<T> {
19
+ private _connector;
20
+ private _negated;
21
+ constructor({ children, connector, negated, }?: {
22
+ children?: Renderable[];
23
+ connector?: SearchConnector;
24
+ negated?: boolean;
25
+ });
26
+ static e<T>(connector?: SearchConnector): SearchExpression<T>;
27
+ static search<T extends object>(opts: (e: {
28
+ e: (connector?: SearchConnector) => SearchExpression<T>;
29
+ }) => SearchExpression<T>): SearchExpression<T>;
30
+ private _add;
31
+ render({ aliases, escape, prefix, }?: {
32
+ aliases?: QueryCustomType[] | undefined;
33
+ escape?: boolean | undefined;
34
+ prefix?: string | undefined;
35
+ }): string;
36
+ toJSON(): {
37
+ children: any[];
38
+ connector: SearchConnector;
39
+ negated: boolean;
40
+ };
41
+ connector(): SearchConnector;
42
+ negated(): boolean;
43
+ or(exp: SearchExpression<T>): SearchExpression<T>;
44
+ and(exp: SearchExpression<T>): SearchExpression<T>;
45
+ not(exp: SearchExpression<T>): SearchExpression<T>;
46
+ term(value: any): SearchExpression<T>;
47
+ }
@@ -0,0 +1,21 @@
1
+ import type { QueryCustomType } from '../builder';
2
+ import { Expression } from './base';
3
+ import { Renderable } from './syntax';
4
+ export declare class SelectExpression<T> extends Expression<T> {
5
+ constructor({ children, }?: {
6
+ children?: Renderable[];
7
+ });
8
+ static e<T>(): SelectExpression<T>;
9
+ static s<T extends object>(): T;
10
+ static select<T extends object>(opts: (e: {
11
+ s: T;
12
+ e: () => SelectExpression<T>;
13
+ }) => SelectExpression<T>): SelectExpression<T>;
14
+ render({ aliases, escape, prefix, }?: {
15
+ aliases?: QueryCustomType[] | undefined;
16
+ escape?: boolean | undefined;
17
+ prefix?: string | undefined;
18
+ }): string;
19
+ private _add;
20
+ field(field: any): SelectExpression<T>;
21
+ }
@@ -0,0 +1,177 @@
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 class Field<T extends object> implements ProxyHandler<T> {
12
+ name: string;
13
+ constructor(name?: string);
14
+ static factory<T extends object>(): T;
15
+ get(target: T, p: string | symbol): any;
16
+ }
17
+ export declare function render(value: any, { aliases, normalize, escape, prefix, }?: {
18
+ aliases?: QueryCustomType[];
19
+ normalize?: boolean;
20
+ escape?: boolean;
21
+ prefix?: string;
22
+ }): string | number | boolean | null;
23
+ export declare class Function<T> implements Renderable {
24
+ protected name: string;
25
+ protected values: any[];
26
+ protected normalize: boolean;
27
+ protected escape: boolean;
28
+ constructor(name: string, values: any[], normalize?: boolean, escape?: boolean);
29
+ get [Symbol.toStringTag](): string;
30
+ toJSON(): {
31
+ name: string;
32
+ values: any[];
33
+ normalize: boolean;
34
+ };
35
+ render({ aliases, escape, prefix, }: {
36
+ aliases?: QueryCustomType[];
37
+ escape?: boolean;
38
+ prefix?: string;
39
+ }): string;
40
+ }
41
+ export declare class StringAndCollectionFunctions<T> {
42
+ concat(field: any, value: any, normalize?: boolean): Function<T>;
43
+ contains(field: any, value: any, normalize?: boolean): Function<T>;
44
+ endsWith(field: any, value: any, normalize?: boolean): Function<T>;
45
+ indexOf(field: any, value: any, normalize?: boolean): Function<T>;
46
+ length(value: any, normalize?: boolean): Function<T>;
47
+ startsWith(field: any, value: any, normalize?: boolean): Function<T>;
48
+ subString(field: any, start: number, length?: number): Function<T>;
49
+ }
50
+ export declare class CollectionFunctions<T> {
51
+ hasSubset(s1: T, s2: any): Function<T>;
52
+ hasSubsequence(s1: T, s2: any): Function<T>;
53
+ }
54
+ export declare class StringFunctions<T> {
55
+ matchesPattern(value: T | string, pattern: string): Function<T>;
56
+ toLower(value: T): Function<T>;
57
+ toUpper(value: T): Function<T>;
58
+ trim(value: T): Function<T>;
59
+ }
60
+ export declare class DateAndTimeFunctions<T> {
61
+ date(value: any): Function<T>;
62
+ day(value: any): Function<T>;
63
+ fractionalseconds(value: any): Function<T>;
64
+ hour(value: any): Function<T>;
65
+ maxdatetime(value: any): Function<T>;
66
+ mindatetime(value: any): Function<T>;
67
+ minute(value: any): Function<T>;
68
+ month(value: any): Function<T>;
69
+ now(): Function<T>;
70
+ second(value: any): Function<T>;
71
+ time(value: any): Function<T>;
72
+ totaloffsetminutes(value: any): Function<T>;
73
+ totalseconds(value: any): Function<T>;
74
+ year(value: any): Function<T>;
75
+ }
76
+ export declare class ArithmeticFunctions<T> {
77
+ ceiling(value: T | string): Function<T>;
78
+ floor(value: T | string): Function<T>;
79
+ round(value: T | string): Function<T>;
80
+ }
81
+ export declare class TypeFunctions<T> {
82
+ cast(value: T | string, type?: string): Function<T>;
83
+ isof(value: T | string, type?: string): Function<T>;
84
+ }
85
+ export declare class GeoFunctions<T> {
86
+ geoDistance(value: T, point: string, normalize?: boolean): Function<T>;
87
+ geoIntersects(value: T, polygon: string, normalize?: boolean): Function<T>;
88
+ geoLength(line: T, normalize?: boolean): Function<T>;
89
+ }
90
+ export declare class ConditionalFunctions<T> {
91
+ case(condition: T | string, value: any): Function<T>;
92
+ }
93
+ export declare class Operator<T> implements Renderable {
94
+ protected op: string;
95
+ protected values: any[];
96
+ protected normalize: boolean;
97
+ constructor(op: string, values: any[], normalize?: boolean);
98
+ get [Symbol.toStringTag](): string;
99
+ toJSON(): {
100
+ op: string;
101
+ values: any[];
102
+ normalize: boolean;
103
+ };
104
+ render({ aliases, escape, prefix, }: {
105
+ aliases?: QueryCustomType[];
106
+ escape?: boolean;
107
+ prefix?: string;
108
+ }): string;
109
+ }
110
+ export declare class LogicalOperators<T> {
111
+ eq(left: any, right: any, normalize?: boolean): Operator<unknown>;
112
+ ne(left: any, right: any, normalize?: boolean): Operator<unknown>;
113
+ gt(left: any, right: any, normalize?: boolean): Operator<unknown>;
114
+ ge(left: any, right: any, normalize?: boolean): Operator<unknown>;
115
+ lt(left: any, right: any, normalize?: boolean): Operator<unknown>;
116
+ le(left: any, right: any, normalize?: boolean): Operator<unknown>;
117
+ not(value: any, normalize?: boolean): Operator<T>;
118
+ has(left: any, right: any, normalize?: boolean): Operator<unknown>;
119
+ in(left: any, right: any, normalize?: boolean): Operator<unknown>;
120
+ }
121
+ export declare class ArithmeticOperators<T> {
122
+ add(left: any, right: any, normalize?: boolean): Operator<T>;
123
+ sub(left: any, right: any, normalize?: boolean): Operator<unknown>;
124
+ mul(left: any, right: any, normalize?: boolean): Operator<unknown>;
125
+ div(left: any, right: any, normalize?: boolean): Operator<unknown>;
126
+ mod(left: any, right: any, normalize?: boolean): Operator<unknown>;
127
+ neg(value: any, normalize?: boolean): Operator<unknown>;
128
+ }
129
+ export declare class Grouping<T> implements Renderable {
130
+ protected group: Renderable;
131
+ constructor(group: Renderable);
132
+ get [Symbol.toStringTag](): string;
133
+ toJSON(): {
134
+ group: any;
135
+ };
136
+ render({ aliases, escape, prefix, }: {
137
+ aliases?: QueryCustomType[];
138
+ escape?: boolean;
139
+ prefix?: string;
140
+ }): string;
141
+ }
142
+ export declare class Lambda<T> implements Renderable {
143
+ protected op: string;
144
+ protected values: any[];
145
+ protected alias?: string | undefined;
146
+ constructor(op: string, values: any[], alias?: string | undefined);
147
+ get [Symbol.toStringTag](): string;
148
+ toJSON(): {
149
+ op: string;
150
+ values: any[];
151
+ alias: string | undefined;
152
+ };
153
+ render({ aliases, escape, prefix, }: {
154
+ aliases?: QueryCustomType[];
155
+ escape?: boolean;
156
+ prefix?: string;
157
+ }): string;
158
+ }
159
+ export declare class LambdaOperators<T> {
160
+ any(field: T, value: any, alias?: string): Lambda<unknown>;
161
+ all(field: T, value: any, alias?: string): Lambda<unknown>;
162
+ }
163
+ export declare class ODataOperators<T> {
164
+ }
165
+ export interface ODataOperators<T> extends LogicalOperators<T>, ArithmeticOperators<T>, LambdaOperators<T> {
166
+ }
167
+ export declare const operators: ODataOperators<any>;
168
+ export declare class ODataFunctions<T> {
169
+ }
170
+ export interface ODataFunctions<T> extends StringAndCollectionFunctions<T>, CollectionFunctions<T>, StringFunctions<T>, DateAndTimeFunctions<T>, ArithmeticFunctions<T>, TypeFunctions<T>, GeoFunctions<T>, ConditionalFunctions<T> {
171
+ }
172
+ export declare const functions: ODataFunctions<any>;
173
+ export declare class ODataSyntax<T> {
174
+ }
175
+ export interface ODataSyntax<T> extends ODataOperators<T>, ODataFunctions<T> {
176
+ }
177
+ export declare const syntax: ODataSyntax<any>;