@opra/common 0.15.0 → 0.16.1

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 (284) hide show
  1. package/cjs/document/factory/import-resource-class.js +1 -0
  2. package/cjs/document/factory/import-type-class.js +9 -2
  3. package/cjs/document/resource/collection.js +9 -9
  4. package/cjs/document/resource/singleton.js +4 -4
  5. package/cjs/url/opra-url.js +7 -7
  6. package/esm/document/api-document.js +37 -33
  7. package/esm/document/constants.js +6 -3
  8. package/esm/document/data-type/api-field.js +15 -12
  9. package/esm/document/data-type/builtin/any.type.js +8 -5
  10. package/esm/document/data-type/builtin/base64.type.js +8 -5
  11. package/esm/document/data-type/builtin/bigint.type.js +8 -5
  12. package/esm/document/data-type/builtin/boolean.type.js +11 -8
  13. package/esm/document/data-type/builtin/date.type.js +10 -7
  14. package/esm/document/data-type/builtin/guid.type.js +12 -9
  15. package/esm/document/data-type/builtin/index.js +13 -10
  16. package/esm/document/data-type/builtin/integer.type.js +13 -10
  17. package/esm/document/data-type/builtin/number.type.js +10 -7
  18. package/esm/document/data-type/builtin/object.type.js +8 -5
  19. package/esm/document/data-type/builtin/string.type.js +11 -8
  20. package/esm/document/data-type/builtin/time.type.js +10 -7
  21. package/esm/document/data-type/builtin/timestamp.type.js +12 -9
  22. package/esm/document/data-type/complex-type.js +34 -30
  23. package/esm/document/data-type/data-type.js +12 -9
  24. package/esm/document/data-type/enum-type.js +19 -15
  25. package/esm/document/data-type/mapped-type.js +29 -24
  26. package/esm/document/data-type/simple-type.js +21 -17
  27. package/esm/document/data-type/union-type.js +29 -26
  28. package/esm/document/factory/add-references.js +7 -3
  29. package/esm/document/factory/create-document.js +16 -10
  30. package/esm/document/factory/factory.js +37 -33
  31. package/esm/document/factory/import-resource-class.js +22 -15
  32. package/esm/document/factory/import-type-class.js +43 -26
  33. package/esm/document/factory/index.js +4 -1
  34. package/esm/document/factory/process-resources.js +16 -10
  35. package/esm/document/factory/process-types.js +37 -31
  36. package/esm/document/index.js +17 -14
  37. package/esm/document/resource/collection.js +50 -46
  38. package/esm/document/resource/resource.js +12 -9
  39. package/esm/document/resource/singleton.js +29 -25
  40. package/esm/document/utils/inspect.util.js +7 -4
  41. package/esm/document/utils/string-compare.util.js +5 -1
  42. package/esm/exception/enums/issue-severity.enum.js +5 -2
  43. package/esm/exception/error-issue.js +2 -1
  44. package/esm/exception/http-errors/bad-request.error.js +8 -4
  45. package/esm/exception/http-errors/failed-dependency.error.js +8 -4
  46. package/esm/exception/http-errors/forbidden.error.js +8 -4
  47. package/esm/exception/http-errors/internal-server.error.js +8 -4
  48. package/esm/exception/http-errors/method-not-allowed.error.js +8 -4
  49. package/esm/exception/http-errors/not-acceptable.error.js +8 -4
  50. package/esm/exception/http-errors/not-found.error.js +8 -4
  51. package/esm/exception/http-errors/unauthorized.error.js +8 -4
  52. package/esm/exception/http-errors/unprocessable-entity.error.js +8 -4
  53. package/esm/exception/index.js +18 -15
  54. package/esm/exception/opra-exception.js +7 -3
  55. package/esm/exception/resource-errors/resource-conflict.error.js +8 -4
  56. package/esm/exception/resource-errors/resource-not-found.error.js +8 -4
  57. package/esm/exception/wrap-exception.js +24 -20
  58. package/esm/filter/antlr/OpraFilterLexer.js +9 -6
  59. package/esm/filter/antlr/OpraFilterListener.js +5 -2
  60. package/esm/filter/antlr/OpraFilterParser.js +126 -79
  61. package/esm/filter/antlr/OpraFilterVisitor.js +5 -2
  62. package/esm/filter/ast/abstract/ast.js +5 -1
  63. package/esm/filter/ast/abstract/expression.js +6 -2
  64. package/esm/filter/ast/abstract/literal.js +6 -2
  65. package/esm/filter/ast/abstract/term.js +6 -2
  66. package/esm/filter/ast/expressions/arithmetic-expression.js +8 -3
  67. package/esm/filter/ast/expressions/array-expression.js +6 -2
  68. package/esm/filter/ast/expressions/comparison-expression.js +6 -2
  69. package/esm/filter/ast/expressions/logical-expression.js +6 -2
  70. package/esm/filter/ast/expressions/parentheses-expression.js +6 -2
  71. package/esm/filter/ast/index.js +19 -16
  72. package/esm/filter/ast/terms/boolean-literal.js +6 -2
  73. package/esm/filter/ast/terms/date-literal.js +12 -8
  74. package/esm/filter/ast/terms/external-constant.js +6 -2
  75. package/esm/filter/ast/terms/null-literal.js +6 -2
  76. package/esm/filter/ast/terms/number-literal.js +8 -4
  77. package/esm/filter/ast/terms/qualified-identifier.js +6 -2
  78. package/esm/filter/ast/terms/string-literal.js +8 -4
  79. package/esm/filter/ast/terms/time-literal.js +10 -6
  80. package/esm/filter/build.js +69 -45
  81. package/esm/filter/errors.js +9 -3
  82. package/esm/filter/filter-tree-visitor.js +31 -26
  83. package/esm/filter/index.js +8 -5
  84. package/esm/filter/opra-error-listener.js +8 -4
  85. package/esm/filter/parse.js +19 -14
  86. package/esm/filter/utils.js +7 -2
  87. package/esm/helpers/function-utils.js +14 -8
  88. package/esm/helpers/get-stack-filename.js +5 -1
  89. package/esm/helpers/index.js +11 -8
  90. package/esm/helpers/is-url.js +5 -1
  91. package/esm/helpers/mixin-utils.js +7 -2
  92. package/esm/helpers/object-utils.js +12 -6
  93. package/esm/helpers/path-to-object-tree.js +5 -1
  94. package/esm/helpers/responsive-map.js +5 -1
  95. package/esm/helpers/type-guards.js +17 -7
  96. package/esm/http/codecs/boolean-codec.js +5 -1
  97. package/esm/http/codecs/date-codec.js +5 -1
  98. package/esm/http/codecs/filter-codec.js +9 -5
  99. package/esm/http/codecs/integer-codec.js +6 -2
  100. package/esm/http/codecs/number-codec.js +5 -1
  101. package/esm/http/codecs/string-codec.js +5 -1
  102. package/esm/http/enums/http-headers-codes.enum.js +5 -2
  103. package/esm/http/enums/http-status-codes.enum.js +5 -2
  104. package/esm/http/enums/http-status-messages.js +4 -1
  105. package/esm/http/http-headers.js +9 -5
  106. package/esm/http/http-message.host.js +18 -13
  107. package/esm/http/http-params.js +25 -20
  108. package/esm/http/http-request-message.js +22 -18
  109. package/esm/http/http-response-message.js +28 -23
  110. package/esm/http/index.js +17 -14
  111. package/esm/http/interfaces/client-http-headers.interface.js +2 -1
  112. package/esm/http/interfaces/cookie-options.interface.js +2 -1
  113. package/esm/http/interfaces/server-http-headers.interface.js +2 -1
  114. package/esm/i18n/i18n.js +28 -23
  115. package/esm/i18n/index.js +9 -5
  116. package/esm/i18n/string-utils.js +7 -2
  117. package/esm/i18n/translate.js +7 -3
  118. package/esm/index.js +16 -11
  119. package/esm/schema/constants.js +4 -1
  120. package/esm/schema/data-type/complex-type.interface.js +5 -2
  121. package/esm/schema/data-type/data-type.interface.js +2 -1
  122. package/esm/schema/data-type/enum-type.interface.js +5 -2
  123. package/esm/schema/data-type/field.interface.js +2 -1
  124. package/esm/schema/data-type/mapped-type.interface.js +5 -2
  125. package/esm/schema/data-type/simple-type.interface.js +5 -2
  126. package/esm/schema/data-type/union-type.interface.js +5 -2
  127. package/esm/schema/document.interface.js +2 -1
  128. package/esm/schema/index.js +34 -31
  129. package/esm/schema/resource/collection.interface.js +5 -2
  130. package/esm/schema/resource/container.interface.js +5 -2
  131. package/esm/schema/resource/endpoint.interface.js +2 -1
  132. package/esm/schema/resource/resource.interface.js +2 -1
  133. package/esm/schema/resource/singleton.interface.js +5 -2
  134. package/esm/schema/type-guards.js +53 -40
  135. package/esm/types.js +2 -1
  136. package/esm/url/index.js +8 -5
  137. package/esm/url/opra-url-path-component.js +7 -3
  138. package/esm/url/opra-url-path.js +18 -14
  139. package/esm/url/opra-url.js +25 -21
  140. package/esm/url/utils/decode-path-component.js +8 -4
  141. package/esm/url/utils/encode-path-component.js +8 -3
  142. package/esm/utils/path-utils.js +7 -2
  143. package/package.json +5 -4
  144. package/{esm → types}/document/factory/import-resource-class.d.ts +1 -0
  145. package/{esm → types}/document/resource/collection.d.ts +10 -10
  146. package/{esm → types}/document/resource/singleton.d.ts +4 -4
  147. package/{esm → types}/schema/resource/collection.interface.d.ts +6 -6
  148. package/{esm → types}/url/opra-url.d.ts +3 -3
  149. package/{esm → types}/document/api-document.d.ts +0 -0
  150. package/{esm → types}/document/constants.d.ts +0 -0
  151. package/{esm → types}/document/data-type/api-field.d.ts +0 -0
  152. package/{esm → types}/document/data-type/builtin/any.type.d.ts +0 -0
  153. package/{esm → types}/document/data-type/builtin/base64.type.d.ts +0 -0
  154. package/{esm → types}/document/data-type/builtin/bigint.type.d.ts +0 -0
  155. package/{esm → types}/document/data-type/builtin/boolean.type.d.ts +0 -0
  156. package/{esm → types}/document/data-type/builtin/date.type.d.ts +0 -0
  157. package/{esm → types}/document/data-type/builtin/guid.type.d.ts +0 -0
  158. package/{esm → types}/document/data-type/builtin/index.d.ts +0 -0
  159. package/{esm → types}/document/data-type/builtin/integer.type.d.ts +0 -0
  160. package/{esm → types}/document/data-type/builtin/number.type.d.ts +0 -0
  161. package/{esm → types}/document/data-type/builtin/object.type.d.ts +0 -0
  162. package/{esm → types}/document/data-type/builtin/string.type.d.ts +0 -0
  163. package/{esm → types}/document/data-type/builtin/time.type.d.ts +0 -0
  164. package/{esm → types}/document/data-type/builtin/timestamp.type.d.ts +0 -0
  165. package/{esm → types}/document/data-type/complex-type.d.ts +0 -0
  166. package/{esm → types}/document/data-type/data-type.d.ts +0 -0
  167. package/{esm → types}/document/data-type/enum-type.d.ts +0 -0
  168. package/{esm → types}/document/data-type/mapped-type.d.ts +0 -0
  169. package/{esm → types}/document/data-type/simple-type.d.ts +0 -0
  170. package/{esm → types}/document/data-type/union-type.d.ts +0 -0
  171. package/{esm → types}/document/factory/add-references.d.ts +0 -0
  172. package/{esm → types}/document/factory/create-document.d.ts +0 -0
  173. package/{esm → types}/document/factory/factory.d.ts +0 -0
  174. package/{esm → types}/document/factory/import-type-class.d.ts +0 -0
  175. package/{esm → types}/document/factory/index.d.ts +0 -0
  176. package/{esm → types}/document/factory/process-resources.d.ts +0 -0
  177. package/{esm → types}/document/factory/process-types.d.ts +0 -0
  178. package/{esm → types}/document/index.d.ts +0 -0
  179. package/{esm → types}/document/resource/resource.d.ts +0 -0
  180. package/{esm → types}/document/utils/inspect.util.d.ts +0 -0
  181. package/{esm → types}/document/utils/string-compare.util.d.ts +0 -0
  182. package/{esm → types}/exception/enums/issue-severity.enum.d.ts +0 -0
  183. package/{esm → types}/exception/error-issue.d.ts +0 -0
  184. package/{esm → types}/exception/http-errors/bad-request.error.d.ts +0 -0
  185. package/{esm → types}/exception/http-errors/failed-dependency.error.d.ts +0 -0
  186. package/{esm → types}/exception/http-errors/forbidden.error.d.ts +0 -0
  187. package/{esm → types}/exception/http-errors/internal-server.error.d.ts +0 -0
  188. package/{esm → types}/exception/http-errors/method-not-allowed.error.d.ts +0 -0
  189. package/{esm → types}/exception/http-errors/not-acceptable.error.d.ts +0 -0
  190. package/{esm → types}/exception/http-errors/not-found.error.d.ts +0 -0
  191. package/{esm → types}/exception/http-errors/unauthorized.error.d.ts +0 -0
  192. package/{esm → types}/exception/http-errors/unprocessable-entity.error.d.ts +0 -0
  193. package/{esm → types}/exception/index.d.ts +0 -0
  194. package/{esm → types}/exception/opra-exception.d.ts +0 -0
  195. package/{esm → types}/exception/resource-errors/resource-conflict.error.d.ts +0 -0
  196. package/{esm → types}/exception/resource-errors/resource-not-found.error.d.ts +0 -0
  197. package/{esm → types}/exception/wrap-exception.d.ts +0 -0
  198. package/{esm → types}/filter/antlr/OpraFilterLexer.d.ts +0 -0
  199. package/{esm → types}/filter/antlr/OpraFilterListener.d.ts +0 -0
  200. package/{esm → types}/filter/antlr/OpraFilterParser.d.ts +0 -0
  201. package/{esm → types}/filter/antlr/OpraFilterVisitor.d.ts +0 -0
  202. package/{esm → types}/filter/ast/abstract/ast.d.ts +0 -0
  203. package/{esm → types}/filter/ast/abstract/expression.d.ts +0 -0
  204. package/{esm → types}/filter/ast/abstract/literal.d.ts +0 -0
  205. package/{esm → types}/filter/ast/abstract/term.d.ts +0 -0
  206. package/{esm → types}/filter/ast/expressions/arithmetic-expression.d.ts +0 -0
  207. package/{esm → types}/filter/ast/expressions/array-expression.d.ts +0 -0
  208. package/{esm → types}/filter/ast/expressions/comparison-expression.d.ts +0 -0
  209. package/{esm → types}/filter/ast/expressions/logical-expression.d.ts +0 -0
  210. package/{esm → types}/filter/ast/expressions/parentheses-expression.d.ts +0 -0
  211. package/{esm → types}/filter/ast/index.d.ts +0 -0
  212. package/{esm → types}/filter/ast/terms/boolean-literal.d.ts +0 -0
  213. package/{esm → types}/filter/ast/terms/date-literal.d.ts +0 -0
  214. package/{esm → types}/filter/ast/terms/external-constant.d.ts +0 -0
  215. package/{esm → types}/filter/ast/terms/null-literal.d.ts +0 -0
  216. package/{esm → types}/filter/ast/terms/number-literal.d.ts +0 -0
  217. package/{esm → types}/filter/ast/terms/qualified-identifier.d.ts +0 -0
  218. package/{esm → types}/filter/ast/terms/string-literal.d.ts +0 -0
  219. package/{esm → types}/filter/ast/terms/time-literal.d.ts +0 -0
  220. package/{esm → types}/filter/build.d.ts +0 -0
  221. package/{esm → types}/filter/errors.d.ts +0 -0
  222. package/{esm → types}/filter/filter-tree-visitor.d.ts +0 -0
  223. package/{esm → types}/filter/index.d.ts +0 -0
  224. package/{esm → types}/filter/opra-error-listener.d.ts +0 -0
  225. package/{esm → types}/filter/parse.d.ts +0 -0
  226. package/{esm → types}/filter/utils.d.ts +0 -0
  227. package/{esm → types}/helpers/function-utils.d.ts +0 -0
  228. package/{esm → types}/helpers/get-stack-filename.d.ts +0 -0
  229. package/{esm → types}/helpers/index.d.ts +0 -0
  230. package/{esm → types}/helpers/is-url.d.ts +0 -0
  231. package/{esm → types}/helpers/mixin-utils.d.ts +0 -0
  232. package/{esm → types}/helpers/object-utils.d.ts +0 -0
  233. package/{esm → types}/helpers/path-to-object-tree.d.ts +0 -0
  234. package/{esm → types}/helpers/responsive-map.d.ts +0 -0
  235. package/{esm → types}/helpers/type-guards.d.ts +0 -0
  236. package/{esm → types}/http/codecs/boolean-codec.d.ts +0 -0
  237. package/{esm → types}/http/codecs/date-codec.d.ts +0 -0
  238. package/{esm → types}/http/codecs/filter-codec.d.ts +0 -0
  239. package/{esm → types}/http/codecs/integer-codec.d.ts +0 -0
  240. package/{esm → types}/http/codecs/number-codec.d.ts +0 -0
  241. package/{esm → types}/http/codecs/string-codec.d.ts +0 -0
  242. package/{esm → types}/http/enums/http-headers-codes.enum.d.ts +0 -0
  243. package/{esm → types}/http/enums/http-status-codes.enum.d.ts +0 -0
  244. package/{esm → types}/http/enums/http-status-messages.d.ts +0 -0
  245. package/{esm → types}/http/http-headers.d.ts +0 -0
  246. package/{esm → types}/http/http-message.host.d.ts +0 -0
  247. package/{esm → types}/http/http-params.d.ts +0 -0
  248. package/{esm → types}/http/http-request-message.d.ts +0 -0
  249. package/{esm → types}/http/http-response-message.d.ts +0 -0
  250. package/{esm → types}/http/index.d.ts +0 -0
  251. package/{esm → types}/http/interfaces/client-http-headers.interface.d.ts +0 -0
  252. package/{esm → types}/http/interfaces/cookie-options.interface.d.ts +0 -0
  253. package/{esm → types}/http/interfaces/server-http-headers.interface.d.ts +0 -0
  254. package/{esm → types}/http/multipart/batch-multipart.d.ts +0 -0
  255. package/{esm → types}/http/multipart/http-request-content.d.ts +0 -0
  256. package/{esm → types}/http/multipart/http-response-content.d.ts +0 -0
  257. package/{esm → types}/http/multipart/index.d.ts +0 -0
  258. package/{esm → types}/i18n/i18n.d.ts +0 -0
  259. package/{esm → types}/i18n/index.d.ts +0 -0
  260. package/{esm → types}/i18n/string-utils.d.ts +0 -0
  261. package/{esm → types}/i18n/translate.d.ts +0 -0
  262. package/{esm → types}/index.d.ts +0 -0
  263. package/{esm → types}/schema/constants.d.ts +0 -0
  264. package/{esm → types}/schema/data-type/complex-type.interface.d.ts +0 -0
  265. package/{esm → types}/schema/data-type/data-type.interface.d.ts +0 -0
  266. package/{esm → types}/schema/data-type/enum-type.interface.d.ts +0 -0
  267. package/{esm → types}/schema/data-type/field.interface.d.ts +0 -0
  268. package/{esm → types}/schema/data-type/mapped-type.interface.d.ts +0 -0
  269. package/{esm → types}/schema/data-type/simple-type.interface.d.ts +0 -0
  270. package/{esm → types}/schema/data-type/union-type.interface.d.ts +0 -0
  271. package/{esm → types}/schema/document.interface.d.ts +0 -0
  272. package/{esm → types}/schema/index.d.ts +0 -0
  273. package/{esm → types}/schema/resource/container.interface.d.ts +0 -0
  274. package/{esm → types}/schema/resource/endpoint.interface.d.ts +0 -0
  275. package/{esm → types}/schema/resource/resource.interface.d.ts +0 -0
  276. package/{esm → types}/schema/resource/singleton.interface.d.ts +2 -2
  277. /package/{esm → types}/schema/type-guards.d.ts +0 -0
  278. /package/{esm → types}/types.d.ts +0 -0
  279. /package/{esm → types}/url/index.d.ts +0 -0
  280. /package/{esm → types}/url/opra-url-path-component.d.ts +0 -0
  281. /package/{esm → types}/url/opra-url-path.d.ts +0 -0
  282. /package/{esm → types}/url/utils/decode-path-component.d.ts +0 -0
  283. /package/{esm → types}/url/utils/encode-path-component.d.ts +0 -0
  284. /package/{esm → types}/utils/path-utils.d.ts +0 -0
@@ -1,5 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
1
3
  // Generated from ./src/filter/antlr/OpraFilter.g4 by ANTLR 4.11.2-SNAPSHOT
2
- import { ParseTreeVisitor } from '@browsery/antlr4';
4
+ const antlr4_1 = require("@browsery/antlr4");
3
5
  /**
4
6
  * This interface defines a complete generic visitor for a parse tree produced
5
7
  * by `OpraFilterParser`.
@@ -7,5 +9,6 @@ import { ParseTreeVisitor } from '@browsery/antlr4';
7
9
  * @param <Result> The return type of the visit operation. Use `void` for
8
10
  * operations with no return type.
9
11
  */
10
- export default class OpraFilterVisitor extends ParseTreeVisitor {
12
+ class OpraFilterVisitor extends antlr4_1.ParseTreeVisitor {
11
13
  }
14
+ exports.default = OpraFilterVisitor;
@@ -1,5 +1,9 @@
1
- export class Ast {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Ast = void 0;
4
+ class Ast {
2
5
  constructor() {
3
6
  this.kind = Object.getPrototypeOf(this).constructor.name;
4
7
  }
5
8
  }
9
+ exports.Ast = Ast;
@@ -1,3 +1,7 @@
1
- import { Ast } from './ast.js';
2
- export class Expression extends Ast {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Expression = void 0;
4
+ const ast_js_1 = require("./ast.js");
5
+ class Expression extends ast_js_1.Ast {
3
6
  }
7
+ exports.Expression = Expression;
@@ -1,5 +1,8 @@
1
- import { Term } from './term.js';
2
- export class Literal extends Term {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Literal = void 0;
4
+ const term_js_1 = require("./term.js");
5
+ class Literal extends term_js_1.Term {
3
6
  constructor(value) {
4
7
  super();
5
8
  this.value = value;
@@ -8,3 +11,4 @@ export class Literal extends Term {
8
11
  return '' + this.value;
9
12
  }
10
13
  }
14
+ exports.Literal = Literal;
@@ -1,3 +1,7 @@
1
- import { Expression } from './expression.js';
2
- export class Term extends Expression {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Term = void 0;
4
+ const expression_js_1 = require("./expression.js");
5
+ class Term extends expression_js_1.Expression {
3
6
  }
7
+ exports.Term = Term;
@@ -1,5 +1,8 @@
1
- import { Expression } from '../abstract/expression.js';
2
- export class ArithmeticExpression extends Expression {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArithmeticExpressionItem = exports.ArithmeticExpression = void 0;
4
+ const expression_js_1 = require("../abstract/expression.js");
5
+ class ArithmeticExpression extends expression_js_1.Expression {
3
6
  constructor() {
4
7
  super();
5
8
  this.items = [];
@@ -15,8 +18,10 @@ export class ArithmeticExpression extends Expression {
15
18
  return this.items.map((child, i) => (i > 0 ? child.op : '') + child.expression).join('');
16
19
  }
17
20
  }
18
- export class ArithmeticExpressionItem {
21
+ exports.ArithmeticExpression = ArithmeticExpression;
22
+ class ArithmeticExpressionItem {
19
23
  constructor(o) {
20
24
  Object.assign(this, o);
21
25
  }
22
26
  }
27
+ exports.ArithmeticExpressionItem = ArithmeticExpressionItem;
@@ -1,5 +1,8 @@
1
- import { Term } from '../abstract/term.js';
2
- export class ArrayExpression extends Term {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArrayExpression = void 0;
4
+ const term_js_1 = require("../abstract/term.js");
5
+ class ArrayExpression extends term_js_1.Term {
3
6
  constructor(items) {
4
7
  super();
5
8
  this.items = items;
@@ -8,3 +11,4 @@ export class ArrayExpression extends Term {
8
11
  return '[' + this.items.map(child => '' + child).join(',') + ']';
9
12
  }
10
13
  }
14
+ exports.ArrayExpression = ArrayExpression;
@@ -1,6 +1,9 @@
1
- import { Expression } from '../abstract/expression.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComparisonExpression = void 0;
4
+ const expression_js_1 = require("../abstract/expression.js");
2
5
  const WORD_PATTERN = /\w/;
3
- export class ComparisonExpression extends Expression {
6
+ class ComparisonExpression extends expression_js_1.Expression {
4
7
  constructor(o) {
5
8
  super();
6
9
  Object.assign(this, o);
@@ -9,3 +12,4 @@ export class ComparisonExpression extends Expression {
9
12
  return `${this.left}${WORD_PATTERN.test(this.op) ? ' ' + this.op + ' ' : this.op}${this.right}`;
10
13
  }
11
14
  }
15
+ exports.ComparisonExpression = ComparisonExpression;
@@ -1,5 +1,8 @@
1
- import { Expression } from '../abstract/expression.js';
2
- export class LogicalExpression extends Expression {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogicalExpression = void 0;
4
+ const expression_js_1 = require("../abstract/expression.js");
5
+ class LogicalExpression extends expression_js_1.Expression {
3
6
  constructor(o) {
4
7
  super();
5
8
  Object.assign(this, o);
@@ -10,3 +13,4 @@ export class LogicalExpression extends Expression {
10
13
  .join(' ' + this.op + ' ');
11
14
  }
12
15
  }
16
+ exports.LogicalExpression = LogicalExpression;
@@ -1,5 +1,8 @@
1
- import { Expression } from '../abstract/expression.js';
2
- export class ParenthesesExpression extends Expression {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParenthesesExpression = void 0;
4
+ const expression_js_1 = require("../abstract/expression.js");
5
+ class ParenthesesExpression extends expression_js_1.Expression {
3
6
  constructor(expression) {
4
7
  super();
5
8
  this.expression = expression;
@@ -8,3 +11,4 @@ export class ParenthesesExpression extends Expression {
8
11
  return `(${this.expression})`;
9
12
  }
10
13
  }
14
+ exports.ParenthesesExpression = ParenthesesExpression;
@@ -1,16 +1,19 @@
1
- export * from './abstract/ast.js';
2
- export * from './abstract/expression.js';
3
- export * from './abstract/literal.js';
4
- export * from './abstract/term.js';
5
- export * from './expressions/arithmetic-expression.js';
6
- export * from './expressions/array-expression.js';
7
- export * from './expressions/comparison-expression.js';
8
- export * from './expressions/logical-expression.js';
9
- export * from './expressions/parentheses-expression.js';
10
- export * from './terms/boolean-literal.js';
11
- export * from './terms/date-literal.js';
12
- export * from './terms/null-literal.js';
13
- export * from './terms/number-literal.js';
14
- export * from './terms/qualified-identifier.js';
15
- export * from './terms/string-literal.js';
16
- export * from './terms/time-literal.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./abstract/ast.js"), exports);
5
+ tslib_1.__exportStar(require("./abstract/expression.js"), exports);
6
+ tslib_1.__exportStar(require("./abstract/literal.js"), exports);
7
+ tslib_1.__exportStar(require("./abstract/term.js"), exports);
8
+ tslib_1.__exportStar(require("./expressions/arithmetic-expression.js"), exports);
9
+ tslib_1.__exportStar(require("./expressions/array-expression.js"), exports);
10
+ tslib_1.__exportStar(require("./expressions/comparison-expression.js"), exports);
11
+ tslib_1.__exportStar(require("./expressions/logical-expression.js"), exports);
12
+ tslib_1.__exportStar(require("./expressions/parentheses-expression.js"), exports);
13
+ tslib_1.__exportStar(require("./terms/boolean-literal.js"), exports);
14
+ tslib_1.__exportStar(require("./terms/date-literal.js"), exports);
15
+ tslib_1.__exportStar(require("./terms/null-literal.js"), exports);
16
+ tslib_1.__exportStar(require("./terms/number-literal.js"), exports);
17
+ tslib_1.__exportStar(require("./terms/qualified-identifier.js"), exports);
18
+ tslib_1.__exportStar(require("./terms/string-literal.js"), exports);
19
+ tslib_1.__exportStar(require("./terms/time-literal.js"), exports);
@@ -1,6 +1,10 @@
1
- import { Literal } from '../abstract/literal.js';
2
- export class BooleanLiteral extends Literal {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BooleanLiteral = void 0;
4
+ const literal_js_1 = require("../abstract/literal.js");
5
+ class BooleanLiteral extends literal_js_1.Literal {
3
6
  constructor(value) {
4
7
  super(value);
5
8
  }
6
9
  }
10
+ exports.BooleanLiteral = BooleanLiteral;
@@ -1,10 +1,13 @@
1
- import { toDateDef } from 'putil-varhelpers';
2
- import { ValidationError } from '../../errors.js';
3
- import { quoteFilterString } from '../../utils.js';
4
- import { Literal } from '../abstract/literal.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateLiteral = void 0;
4
+ const putil_varhelpers_1 = require("putil-varhelpers");
5
+ const errors_js_1 = require("../../errors.js");
6
+ const utils_js_1 = require("../../utils.js");
7
+ const literal_js_1 = require("../abstract/literal.js");
5
8
  // const DATE_PATTERN = /^(\d{4})-(0[1-9]|1[012])-([123]0|[012][1-9]|31)/;
6
9
  const NullDate = new Date(0);
7
- export class DateLiteral extends Literal {
10
+ class DateLiteral extends literal_js_1.Literal {
8
11
  constructor(value) {
9
12
  super('');
10
13
  if (value instanceof Date) {
@@ -12,13 +15,14 @@ export class DateLiteral extends Literal {
12
15
  return;
13
16
  }
14
17
  // noinspection SuspiciousTypeOfGuard
15
- if (typeof value === 'string' && toDateDef(value, NullDate) !== NullDate) {
18
+ if (typeof value === 'string' && (0, putil_varhelpers_1.toDateDef)(value, NullDate) !== NullDate) {
16
19
  this.value = value;
17
20
  return;
18
21
  }
19
- throw new ValidationError(`Invalid date value "${value}"`);
22
+ throw new errors_js_1.ValidationError(`Invalid date value "${value}"`);
20
23
  }
21
24
  toString() {
22
- return quoteFilterString(this.value);
25
+ return (0, utils_js_1.quoteFilterString)(this.value);
23
26
  }
24
27
  }
28
+ exports.DateLiteral = DateLiteral;
@@ -1,5 +1,8 @@
1
- import { Literal } from '../abstract/literal.js';
2
- export class ExternalConstant extends Literal {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExternalConstant = void 0;
4
+ const literal_js_1 = require("../abstract/literal.js");
5
+ class ExternalConstant extends literal_js_1.Literal {
3
6
  constructor(value) {
4
7
  super('' + value);
5
8
  }
@@ -7,3 +10,4 @@ export class ExternalConstant extends Literal {
7
10
  return '@' + super.toString();
8
11
  }
9
12
  }
13
+ exports.ExternalConstant = ExternalConstant;
@@ -1,7 +1,11 @@
1
- import { Literal } from '../abstract/literal.js';
2
- export class NullLiteral extends Literal {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NullLiteral = void 0;
4
+ const literal_js_1 = require("../abstract/literal.js");
5
+ class NullLiteral extends literal_js_1.Literal {
3
6
  constructor() {
4
7
  super(null);
5
8
  this.value = null;
6
9
  }
7
10
  }
11
+ exports.NullLiteral = NullLiteral;
@@ -1,6 +1,9 @@
1
- import { ValidationError } from '../../errors.js';
2
- import { Literal } from '../abstract/literal.js';
3
- export class NumberLiteral extends Literal {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NumberLiteral = void 0;
4
+ const errors_js_1 = require("../../errors.js");
5
+ const literal_js_1 = require("../abstract/literal.js");
6
+ class NumberLiteral extends literal_js_1.Literal {
4
7
  constructor(value) {
5
8
  super(0);
6
9
  if (typeof value === 'number' || typeof value === 'bigint') {
@@ -25,7 +28,7 @@ export class NumberLiteral extends Literal {
25
28
  catch {
26
29
  //
27
30
  }
28
- throw new ValidationError(`Invalid number literal ${value}`);
31
+ throw new errors_js_1.ValidationError(`Invalid number literal ${value}`);
29
32
  }
30
33
  toString() {
31
34
  return typeof this.value === 'bigint'
@@ -33,3 +36,4 @@ export class NumberLiteral extends Literal {
33
36
  : ('' + this.value);
34
37
  }
35
38
  }
39
+ exports.NumberLiteral = NumberLiteral;
@@ -1,6 +1,10 @@
1
- import { Literal } from '../abstract/literal.js';
2
- export class QualifiedIdentifier extends Literal {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QualifiedIdentifier = void 0;
4
+ const literal_js_1 = require("../abstract/literal.js");
5
+ class QualifiedIdentifier extends literal_js_1.Literal {
3
6
  constructor(value) {
4
7
  super('' + value);
5
8
  }
6
9
  }
10
+ exports.QualifiedIdentifier = QualifiedIdentifier;
@@ -1,10 +1,14 @@
1
- import { quoteFilterString } from '../../utils.js';
2
- import { Literal } from '../abstract/literal.js';
3
- export class StringLiteral extends Literal {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StringLiteral = void 0;
4
+ const utils_js_1 = require("../../utils.js");
5
+ const literal_js_1 = require("../abstract/literal.js");
6
+ class StringLiteral extends literal_js_1.Literal {
4
7
  constructor(value) {
5
8
  super('' + value);
6
9
  }
7
10
  toString() {
8
- return quoteFilterString(this.value);
11
+ return (0, utils_js_1.quoteFilterString)(this.value);
9
12
  }
10
13
  }
14
+ exports.StringLiteral = StringLiteral;
@@ -1,8 +1,11 @@
1
- import { ValidationError } from '../../errors.js';
2
- import { quoteFilterString } from '../../utils.js';
3
- import { Literal } from '../abstract/literal.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimeLiteral = void 0;
4
+ const errors_js_1 = require("../../errors.js");
5
+ const utils_js_1 = require("../../utils.js");
6
+ const literal_js_1 = require("../abstract/literal.js");
4
7
  const TIME_PATTERN = /^([01]\d|2[0-3]):([0-5]\d)(:[0-5]\d)?(\.(\d+))?$/;
5
- export class TimeLiteral extends Literal {
8
+ class TimeLiteral extends literal_js_1.Literal {
6
9
  constructor(value) {
7
10
  super('');
8
11
  if (value instanceof Date) {
@@ -17,12 +20,13 @@ export class TimeLiteral extends Literal {
17
20
  this.value = value;
18
21
  return;
19
22
  }
20
- throw new ValidationError(`Invalid time value "${value}"`);
23
+ throw new errors_js_1.ValidationError(`Invalid time value "${value}"`);
21
24
  }
22
25
  toString() {
23
- return quoteFilterString(this.value);
26
+ return (0, utils_js_1.quoteFilterString)(this.value);
24
27
  }
25
28
  }
29
+ exports.TimeLiteral = TimeLiteral;
26
30
  function pad(n) {
27
31
  return n <= 9 ? '0' + n : '' + n;
28
32
  }
@@ -1,66 +1,89 @@
1
- import { ArithmeticExpression, ArrayExpression, BooleanLiteral, ComparisonExpression, DateLiteral, Expression, LogicalExpression, NullLiteral, NumberLiteral, ParenthesesExpression, QualifiedIdentifier, StringLiteral, TimeLiteral } from './ast/index.js';
2
- export function $or(...items) {
3
- return new LogicalExpression({ op: 'or', items });
4
- }
5
- export function $and(...items) {
6
- return new LogicalExpression({ op: 'and', items });
7
- }
8
- export function $date(v) {
9
- return new DateLiteral(v);
10
- }
11
- export function $time(v) {
12
- return new TimeLiteral(v);
13
- }
14
- export function $number(v) {
15
- return new NumberLiteral(v);
16
- }
17
- export function $array(...items) {
18
- return new ArrayExpression(items.map(wrapEntryValue));
19
- }
20
- export function $field(v) {
21
- return new QualifiedIdentifier(v);
22
- }
23
- export function $eq(left, right) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.$arithmetic = exports.$paren = exports.$notILike = exports.$ilike = exports.$notLike = exports.$like = exports.$notIn = exports.$in = exports.$lte = exports.$lt = exports.$gte = exports.$gt = exports.$ne = exports.$eq = exports.$field = exports.$array = exports.$number = exports.$time = exports.$date = exports.$and = exports.$or = void 0;
4
+ const index_js_1 = require("./ast/index.js");
5
+ function $or(...items) {
6
+ return new index_js_1.LogicalExpression({ op: 'or', items });
7
+ }
8
+ exports.$or = $or;
9
+ function $and(...items) {
10
+ return new index_js_1.LogicalExpression({ op: 'and', items });
11
+ }
12
+ exports.$and = $and;
13
+ function $date(v) {
14
+ return new index_js_1.DateLiteral(v);
15
+ }
16
+ exports.$date = $date;
17
+ function $time(v) {
18
+ return new index_js_1.TimeLiteral(v);
19
+ }
20
+ exports.$time = $time;
21
+ function $number(v) {
22
+ return new index_js_1.NumberLiteral(v);
23
+ }
24
+ exports.$number = $number;
25
+ function $array(...items) {
26
+ return new index_js_1.ArrayExpression(items.map(wrapEntryValue));
27
+ }
28
+ exports.$array = $array;
29
+ function $field(v) {
30
+ return new index_js_1.QualifiedIdentifier(v);
31
+ }
32
+ exports.$field = $field;
33
+ function $eq(left, right) {
24
34
  return comparisonExpression('=', left, right);
25
35
  }
26
- export function $ne(left, right) {
36
+ exports.$eq = $eq;
37
+ function $ne(left, right) {
27
38
  return comparisonExpression('!=', left, right);
28
39
  }
29
- export function $gt(left, right) {
40
+ exports.$ne = $ne;
41
+ function $gt(left, right) {
30
42
  return comparisonExpression('>', left, right);
31
43
  }
32
- export function $gte(left, right) {
44
+ exports.$gt = $gt;
45
+ function $gte(left, right) {
33
46
  return comparisonExpression('>=', left, right);
34
47
  }
35
- export function $lt(left, right) {
48
+ exports.$gte = $gte;
49
+ function $lt(left, right) {
36
50
  return comparisonExpression('<', left, right);
37
51
  }
38
- export function $lte(left, right) {
52
+ exports.$lt = $lt;
53
+ function $lte(left, right) {
39
54
  return comparisonExpression('<=', left, right);
40
55
  }
41
- export function $in(left, right) {
56
+ exports.$lte = $lte;
57
+ function $in(left, right) {
42
58
  return comparisonExpression('in', left, right);
43
59
  }
44
- export function $notIn(left, right) {
60
+ exports.$in = $in;
61
+ function $notIn(left, right) {
45
62
  return comparisonExpression('!in', left, right);
46
63
  }
47
- export function $like(left, right) {
64
+ exports.$notIn = $notIn;
65
+ function $like(left, right) {
48
66
  return comparisonExpression('like', left, right);
49
67
  }
50
- export function $notLike(left, right) {
68
+ exports.$like = $like;
69
+ function $notLike(left, right) {
51
70
  return comparisonExpression('!like', left, right);
52
71
  }
53
- export function $ilike(left, right) {
72
+ exports.$notLike = $notLike;
73
+ function $ilike(left, right) {
54
74
  return comparisonExpression('ilike', left, right);
55
75
  }
56
- export function $notILike(left, right) {
76
+ exports.$ilike = $ilike;
77
+ function $notILike(left, right) {
57
78
  return comparisonExpression('!ilike', left, right);
58
79
  }
59
- export function $paren(expression) {
60
- return new ParenthesesExpression(expression);
80
+ exports.$notILike = $notILike;
81
+ function $paren(expression) {
82
+ return new index_js_1.ParenthesesExpression(expression);
61
83
  }
62
- export function $arithmetic(n) {
63
- const exp = new ArithmeticExpression();
84
+ exports.$paren = $paren;
85
+ function $arithmetic(n) {
86
+ const exp = new index_js_1.ArithmeticExpression();
64
87
  exp.add = (expression) => {
65
88
  exp.append('+', _wrapEntryValue(expression));
66
89
  return exp;
@@ -80,10 +103,11 @@ export function $arithmetic(n) {
80
103
  exp.append('+', wrapEntryValue(n));
81
104
  return exp;
82
105
  }
106
+ exports.$arithmetic = $arithmetic;
83
107
  function comparisonExpression(op, left, right) {
84
108
  const lex = wrapEntryValue(left);
85
109
  const rex = wrapEntryValue(right);
86
- return new ComparisonExpression({ op, left: lex, right: rex });
110
+ return new index_js_1.ComparisonExpression({ op, left: lex, right: rex });
87
111
  }
88
112
  const wrapEntryValue = (v) => {
89
113
  return Array.isArray(v)
@@ -91,15 +115,15 @@ const wrapEntryValue = (v) => {
91
115
  : _wrapEntryValue(v);
92
116
  };
93
117
  const _wrapEntryValue = (v) => {
94
- if (v instanceof Expression)
118
+ if (v instanceof index_js_1.Expression)
95
119
  return v;
96
120
  if (typeof v === 'boolean')
97
- return new BooleanLiteral(v);
121
+ return new index_js_1.BooleanLiteral(v);
98
122
  if (typeof v === 'number' || typeof v === 'bigint')
99
- return new NumberLiteral(v);
123
+ return new index_js_1.NumberLiteral(v);
100
124
  if (v == null)
101
- return new NullLiteral();
125
+ return new index_js_1.NullLiteral();
102
126
  if (v instanceof Date)
103
- return new DateLiteral(v);
104
- return new StringLiteral('' + v);
127
+ return new index_js_1.DateLiteral(v);
128
+ return new index_js_1.StringLiteral('' + v);
105
129
  };
@@ -1,10 +1,16 @@
1
- export class SyntaxError extends TypeError {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FilterParseError = exports.ValidationError = exports.SyntaxError = void 0;
4
+ class SyntaxError extends TypeError {
2
5
  }
3
- export class ValidationError extends TypeError {
6
+ exports.SyntaxError = SyntaxError;
7
+ class ValidationError extends TypeError {
4
8
  }
5
- export class FilterParseError extends Error {
9
+ exports.ValidationError = ValidationError;
10
+ class FilterParseError extends Error {
6
11
  constructor(message, args) {
7
12
  super(message);
8
13
  Object.assign(this, args);
9
14
  }
10
15
  }
16
+ exports.FilterParseError = FilterParseError;