@math.gl/sql 0.0.0-stage → 5.0.0-beta.12

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 (353) hide show
  1. package/LICENSE +249 -0
  2. package/README.md +26 -2
  3. package/THIRD-PARTY-NOTICES.md +5 -0
  4. package/dist/arrow/aggregates.d.ts +46 -0
  5. package/dist/arrow/aggregates.d.ts.map +1 -0
  6. package/dist/arrow/aggregates.js +289 -0
  7. package/dist/arrow/aggregates.js.map +1 -0
  8. package/dist/arrow/buffers.d.ts +30 -0
  9. package/dist/arrow/buffers.d.ts.map +1 -0
  10. package/dist/arrow/buffers.js +177 -0
  11. package/dist/arrow/buffers.js.map +1 -0
  12. package/dist/arrow/cast.d.ts +19 -0
  13. package/dist/arrow/cast.d.ts.map +1 -0
  14. package/dist/arrow/cast.js +138 -0
  15. package/dist/arrow/cast.js.map +1 -0
  16. package/dist/arrow/compiler.d.ts +10 -0
  17. package/dist/arrow/compiler.d.ts.map +1 -0
  18. package/dist/arrow/compiler.js +1538 -0
  19. package/dist/arrow/compiler.js.map +1 -0
  20. package/dist/arrow/float16.d.ts +7 -0
  21. package/dist/arrow/float16.d.ts.map +1 -0
  22. package/dist/arrow/float16.js +26 -0
  23. package/dist/arrow/float16.js.map +1 -0
  24. package/dist/arrow/index.cjs +3321 -0
  25. package/dist/arrow/index.cjs.map +6 -0
  26. package/dist/arrow/index.d.ts +5 -0
  27. package/dist/arrow/index.d.ts.map +1 -0
  28. package/dist/arrow/index.js +7 -0
  29. package/dist/arrow/index.js.map +1 -0
  30. package/dist/arrow/like.d.ts +3 -0
  31. package/dist/arrow/like.d.ts.map +1 -0
  32. package/dist/arrow/like.js +75 -0
  33. package/dist/arrow/like.js.map +1 -0
  34. package/dist/arrow/list-values.d.ts +14 -0
  35. package/dist/arrow/list-values.d.ts.map +1 -0
  36. package/dist/arrow/list-values.js +201 -0
  37. package/dist/arrow/list-values.js.map +1 -0
  38. package/dist/arrow/predicate.d.ts +7 -0
  39. package/dist/arrow/predicate.d.ts.map +1 -0
  40. package/dist/arrow/predicate.js +10 -0
  41. package/dist/arrow/predicate.js.map +1 -0
  42. package/dist/arrow/query-arrow-aggregate-snapshots.d.ts +24 -0
  43. package/dist/arrow/query-arrow-aggregate-snapshots.d.ts.map +1 -0
  44. package/dist/arrow/query-arrow-aggregate-snapshots.js +64 -0
  45. package/dist/arrow/query-arrow-aggregate-snapshots.js.map +1 -0
  46. package/dist/arrow/query-arrow-sql.d.ts +8 -0
  47. package/dist/arrow/query-arrow-sql.d.ts.map +1 -0
  48. package/dist/arrow/query-arrow-sql.js +223 -0
  49. package/dist/arrow/query-arrow-sql.js.map +1 -0
  50. package/dist/arrow/query-arrow-table.d.ts +36 -0
  51. package/dist/arrow/query-arrow-table.d.ts.map +1 -0
  52. package/dist/arrow/query-arrow-table.js +208 -0
  53. package/dist/arrow/query-arrow-table.js.map +1 -0
  54. package/dist/arrow/query-worker-entry.d.ts +2 -0
  55. package/dist/arrow/query-worker-entry.d.ts.map +1 -0
  56. package/dist/arrow/query-worker-entry.js +7 -0
  57. package/dist/arrow/query-worker-entry.js.map +1 -0
  58. package/dist/arrow/query-worker.d.ts +65 -0
  59. package/dist/arrow/query-worker.d.ts.map +1 -0
  60. package/dist/arrow/query-worker.js +135 -0
  61. package/dist/arrow/query-worker.js.map +1 -0
  62. package/dist/arrow/registry.d.ts +4 -0
  63. package/dist/arrow/registry.d.ts.map +1 -0
  64. package/dist/arrow/registry.js +66 -0
  65. package/dist/arrow/registry.js.map +1 -0
  66. package/dist/arrow/relational-query.d.ts +36 -0
  67. package/dist/arrow/relational-query.d.ts.map +1 -0
  68. package/dist/arrow/relational-query.js +174 -0
  69. package/dist/arrow/relational-query.js.map +1 -0
  70. package/dist/arrow/replace-arrow-columns.d.ts +8 -0
  71. package/dist/arrow/replace-arrow-columns.d.ts.map +1 -0
  72. package/dist/arrow/replace-arrow-columns.js +63 -0
  73. package/dist/arrow/replace-arrow-columns.js.map +1 -0
  74. package/dist/arrow/signature.d.ts +6 -0
  75. package/dist/arrow/signature.d.ts.map +1 -0
  76. package/dist/arrow/signature.js +51 -0
  77. package/dist/arrow/signature.js.map +1 -0
  78. package/dist/arrow/temporal-cast.d.ts +9 -0
  79. package/dist/arrow/temporal-cast.d.ts.map +1 -0
  80. package/dist/arrow/temporal-cast.js +60 -0
  81. package/dist/arrow/temporal-cast.js.map +1 -0
  82. package/dist/arrow/types.d.ts +62 -0
  83. package/dist/arrow/types.d.ts.map +1 -0
  84. package/dist/arrow/types.js +5 -0
  85. package/dist/arrow/types.js.map +1 -0
  86. package/dist/arrow/unnest-arrow-column.d.ts +22 -0
  87. package/dist/arrow/unnest-arrow-column.d.ts.map +1 -0
  88. package/dist/arrow/unnest-arrow-column.js +112 -0
  89. package/dist/arrow/unnest-arrow-column.js.map +1 -0
  90. package/dist/arrow/worker-entry.d.ts +2 -0
  91. package/dist/arrow/worker-entry.d.ts.map +1 -0
  92. package/dist/arrow/worker-entry.js +9 -0
  93. package/dist/arrow/worker-entry.js.map +1 -0
  94. package/dist/arrow/worker.cjs +4074 -0
  95. package/dist/arrow/worker.cjs.map +6 -0
  96. package/dist/arrow/worker.d.ts +58 -0
  97. package/dist/arrow/worker.d.ts.map +1 -0
  98. package/dist/arrow/worker.js +84 -0
  99. package/dist/arrow/worker.js.map +1 -0
  100. package/dist/color-functions/index.cjs +382 -0
  101. package/dist/color-functions/index.cjs.map +6 -0
  102. package/dist/color-functions/index.d.ts +26 -0
  103. package/dist/color-functions/index.d.ts.map +1 -0
  104. package/dist/color-functions/index.js +306 -0
  105. package/dist/color-functions/index.js.map +1 -0
  106. package/dist/diagnostic-log.d.ts +8 -0
  107. package/dist/diagnostic-log.d.ts.map +1 -0
  108. package/dist/diagnostic-log.js +15 -0
  109. package/dist/diagnostic-log.js.map +1 -0
  110. package/dist/expressions/ast.d.ts +12 -0
  111. package/dist/expressions/ast.d.ts.map +1 -0
  112. package/dist/expressions/ast.js +114 -0
  113. package/dist/expressions/ast.js.map +1 -0
  114. package/dist/expressions/columnar-predicate.d.ts +56 -0
  115. package/dist/expressions/columnar-predicate.d.ts.map +1 -0
  116. package/dist/expressions/columnar-predicate.js +176 -0
  117. package/dist/expressions/columnar-predicate.js.map +1 -0
  118. package/dist/expressions/evaluation-error.d.ts +14 -0
  119. package/dist/expressions/evaluation-error.d.ts.map +1 -0
  120. package/dist/expressions/evaluation-error.js +26 -0
  121. package/dist/expressions/evaluation-error.js.map +1 -0
  122. package/dist/expressions/expression-eval.d.ts +105 -0
  123. package/dist/expressions/expression-eval.d.ts.map +1 -0
  124. package/dist/expressions/expression-eval.js +330 -0
  125. package/dist/expressions/expression-eval.js.map +1 -0
  126. package/dist/expressions/function-libraries.d.ts +63 -0
  127. package/dist/expressions/function-libraries.d.ts.map +1 -0
  128. package/dist/expressions/function-libraries.js +69 -0
  129. package/dist/expressions/function-libraries.js.map +1 -0
  130. package/dist/expressions/function-registry.d.ts +93 -0
  131. package/dist/expressions/function-registry.d.ts.map +1 -0
  132. package/dist/expressions/function-registry.js +139 -0
  133. package/dist/expressions/function-registry.js.map +1 -0
  134. package/dist/expressions/get.d.ts +9 -0
  135. package/dist/expressions/get.d.ts.map +1 -0
  136. package/dist/expressions/get.js +32 -0
  137. package/dist/expressions/get.js.map +1 -0
  138. package/dist/expressions/index.cjs +1888 -0
  139. package/dist/expressions/index.cjs.map +6 -0
  140. package/dist/expressions/index.d.ts +13 -0
  141. package/dist/expressions/index.d.ts.map +1 -0
  142. package/dist/expressions/index.js +14 -0
  143. package/dist/expressions/index.js.map +1 -0
  144. package/dist/expressions/numeric-functions.d.ts +277 -0
  145. package/dist/expressions/numeric-functions.d.ts.map +1 -0
  146. package/dist/expressions/numeric-functions.js +52 -0
  147. package/dist/expressions/numeric-functions.js.map +1 -0
  148. package/dist/expressions/parse-expression-string.d.ts +21 -0
  149. package/dist/expressions/parse-expression-string.d.ts.map +1 -0
  150. package/dist/expressions/parse-expression-string.js +61 -0
  151. package/dist/expressions/parse-expression-string.js.map +1 -0
  152. package/dist/expressions/predicate-expression.d.ts +7 -0
  153. package/dist/expressions/predicate-expression.d.ts.map +1 -0
  154. package/dist/expressions/predicate-expression.js +112 -0
  155. package/dist/expressions/predicate-expression.js.map +1 -0
  156. package/dist/expressions/scalar-type.d.ts +6 -0
  157. package/dist/expressions/scalar-type.d.ts.map +1 -0
  158. package/dist/expressions/scalar-type.js +23 -0
  159. package/dist/expressions/scalar-type.js.map +1 -0
  160. package/dist/expressions/vendor/jsep/runtime.d.ts +3 -0
  161. package/dist/expressions/vendor/jsep/runtime.d.ts.map +1 -0
  162. package/dist/expressions/vendor/jsep/runtime.js +972 -0
  163. package/dist/expressions/vendor/jsep/runtime.js.map +1 -0
  164. package/dist/expressions/vendor/jsep/types.d.ts +148 -0
  165. package/dist/expressions/vendor/jsep/types.d.ts.map +1 -0
  166. package/dist/expressions/vendor/jsep/types.js +6 -0
  167. package/dist/expressions/vendor/jsep/types.js.map +1 -0
  168. package/dist/index.cjs +5294 -0
  169. package/dist/index.cjs.map +6 -0
  170. package/dist/index.d.ts +11 -0
  171. package/dist/index.d.ts.map +1 -0
  172. package/dist/index.js +11 -0
  173. package/dist/index.js.map +1 -0
  174. package/dist/math-functions/index.cjs +444 -0
  175. package/dist/math-functions/index.cjs.map +6 -0
  176. package/dist/math-functions/index.d.ts +44 -0
  177. package/dist/math-functions/index.d.ts.map +1 -0
  178. package/dist/math-functions/index.js +182 -0
  179. package/dist/math-functions/index.js.map +1 -0
  180. package/dist/parser/bind-sql-predicate.d.ts +4 -0
  181. package/dist/parser/bind-sql-predicate.d.ts.map +1 -0
  182. package/dist/parser/bind-sql-predicate.js +11 -0
  183. package/dist/parser/bind-sql-predicate.js.map +1 -0
  184. package/dist/parser/index.cjs +1807 -0
  185. package/dist/parser/index.cjs.map +6 -0
  186. package/dist/parser/index.d.ts +12 -0
  187. package/dist/parser/index.d.ts.map +1 -0
  188. package/dist/parser/index.js +11 -0
  189. package/dist/parser/index.js.map +1 -0
  190. package/dist/parser/parameter-snapshots.d.ts +21 -0
  191. package/dist/parser/parameter-snapshots.d.ts.map +1 -0
  192. package/dist/parser/parameter-snapshots.js +85 -0
  193. package/dist/parser/parameter-snapshots.js.map +1 -0
  194. package/dist/parser/parse-sql-expression.d.ts +50 -0
  195. package/dist/parser/parse-sql-expression.d.ts.map +1 -0
  196. package/dist/parser/parse-sql-expression.js +501 -0
  197. package/dist/parser/parse-sql-expression.js.map +1 -0
  198. package/dist/parser/parse-sql-predicate.d.ts +13 -0
  199. package/dist/parser/parse-sql-predicate.d.ts.map +1 -0
  200. package/dist/parser/parse-sql-predicate.js +365 -0
  201. package/dist/parser/parse-sql-predicate.js.map +1 -0
  202. package/dist/parser/parse-sql-query.d.ts +9 -0
  203. package/dist/parser/parse-sql-query.d.ts.map +1 -0
  204. package/dist/parser/parse-sql-query.js +81 -0
  205. package/dist/parser/parse-sql-query.js.map +1 -0
  206. package/dist/parser/parse-sql-select.d.ts +57 -0
  207. package/dist/parser/parse-sql-select.d.ts.map +1 -0
  208. package/dist/parser/parse-sql-select.js +247 -0
  209. package/dist/parser/parse-sql-select.js.map +1 -0
  210. package/dist/parser/parse-sql-statement.d.ts +54 -0
  211. package/dist/parser/parse-sql-statement.d.ts.map +1 -0
  212. package/dist/parser/parse-sql-statement.js +207 -0
  213. package/dist/parser/parse-sql-statement.js.map +1 -0
  214. package/dist/parser/query-types.d.ts +56 -0
  215. package/dist/parser/query-types.d.ts.map +1 -0
  216. package/dist/parser/query-types.js +5 -0
  217. package/dist/parser/query-types.js.map +1 -0
  218. package/dist/parser/sql-parameters.d.ts +29 -0
  219. package/dist/parser/sql-parameters.d.ts.map +1 -0
  220. package/dist/parser/sql-parameters.js +110 -0
  221. package/dist/parser/sql-parameters.js.map +1 -0
  222. package/dist/parser/sql-parse-error.d.ts +13 -0
  223. package/dist/parser/sql-parse-error.d.ts.map +1 -0
  224. package/dist/parser/sql-parse-error.js +20 -0
  225. package/dist/parser/sql-parse-error.js.map +1 -0
  226. package/dist/parser/sql-predicate-schema.d.ts +164 -0
  227. package/dist/parser/sql-predicate-schema.d.ts.map +1 -0
  228. package/dist/parser/sql-predicate-schema.js +249 -0
  229. package/dist/parser/sql-predicate-schema.js.map +1 -0
  230. package/dist/parser/sql-predicate-types.d.ts +48 -0
  231. package/dist/parser/sql-predicate-types.d.ts.map +1 -0
  232. package/dist/parser/sql-predicate-types.js +9 -0
  233. package/dist/parser/sql-predicate-types.js.map +1 -0
  234. package/dist/parser/sql-predicate.d.ts +6 -0
  235. package/dist/parser/sql-predicate.d.ts.map +1 -0
  236. package/dist/parser/sql-predicate.js +8 -0
  237. package/dist/parser/sql-predicate.js.map +1 -0
  238. package/dist/scales/arrow-domains.d.ts +22 -0
  239. package/dist/scales/arrow-domains.d.ts.map +1 -0
  240. package/dist/scales/arrow-domains.js +166 -0
  241. package/dist/scales/arrow-domains.js.map +1 -0
  242. package/dist/scales/arrow-scales.d.ts +44 -0
  243. package/dist/scales/arrow-scales.d.ts.map +1 -0
  244. package/dist/scales/arrow-scales.js +255 -0
  245. package/dist/scales/arrow-scales.js.map +1 -0
  246. package/dist/scales/compile-scale.d.ts +2 -0
  247. package/dist/scales/compile-scale.d.ts.map +1 -0
  248. package/dist/scales/compile-scale.js +5 -0
  249. package/dist/scales/compile-scale.js.map +1 -0
  250. package/dist/scales/conformance.cjs +180 -0
  251. package/dist/scales/conformance.cjs.map +6 -0
  252. package/dist/scales/conformance.d.ts +26 -0
  253. package/dist/scales/conformance.d.ts.map +1 -0
  254. package/dist/scales/conformance.js +164 -0
  255. package/dist/scales/conformance.js.map +1 -0
  256. package/dist/scales/hdr-colors.d.ts +2 -0
  257. package/dist/scales/hdr-colors.d.ts.map +1 -0
  258. package/dist/scales/hdr-colors.js +5 -0
  259. package/dist/scales/hdr-colors.js.map +1 -0
  260. package/dist/scales/index.cjs +4334 -0
  261. package/dist/scales/index.cjs.map +6 -0
  262. package/dist/scales/index.d.ts +10 -0
  263. package/dist/scales/index.d.ts.map +1 -0
  264. package/dist/scales/index.js +11 -0
  265. package/dist/scales/index.js.map +1 -0
  266. package/dist/scales/palettes.d.ts +2 -0
  267. package/dist/scales/palettes.d.ts.map +1 -0
  268. package/dist/scales/palettes.js +5 -0
  269. package/dist/scales/palettes.js.map +1 -0
  270. package/dist/scales/parse-sql-scale.d.ts +27 -0
  271. package/dist/scales/parse-sql-scale.d.ts.map +1 -0
  272. package/dist/scales/parse-sql-scale.js +257 -0
  273. package/dist/scales/parse-sql-scale.js.map +1 -0
  274. package/dist/scales/quantile-sketch.d.ts +2 -0
  275. package/dist/scales/quantile-sketch.d.ts.map +1 -0
  276. package/dist/scales/quantile-sketch.js +5 -0
  277. package/dist/scales/quantile-sketch.js.map +1 -0
  278. package/dist/scales/scale-types.d.ts +2 -0
  279. package/dist/scales/scale-types.d.ts.map +1 -0
  280. package/dist/scales/scale-types.js +5 -0
  281. package/dist/scales/scale-types.js.map +1 -0
  282. package/dist/scales/streaming-domains.d.ts +18 -0
  283. package/dist/scales/streaming-domains.d.ts.map +1 -0
  284. package/dist/scales/streaming-domains.js +115 -0
  285. package/dist/scales/streaming-domains.js.map +1 -0
  286. package/package.json +92 -4
  287. package/src/arrow/aggregates.ts +386 -0
  288. package/src/arrow/buffers.ts +177 -0
  289. package/src/arrow/cast.ts +160 -0
  290. package/src/arrow/compiler.ts +1778 -0
  291. package/src/arrow/float16.ts +25 -0
  292. package/src/arrow/index.ts +22 -0
  293. package/src/arrow/like.ts +72 -0
  294. package/src/arrow/list-values.ts +221 -0
  295. package/src/arrow/predicate.ts +19 -0
  296. package/src/arrow/query-arrow-aggregate-snapshots.ts +107 -0
  297. package/src/arrow/query-arrow-sql.ts +255 -0
  298. package/src/arrow/query-arrow-table.ts +298 -0
  299. package/src/arrow/query-worker-entry.ts +8 -0
  300. package/src/arrow/query-worker.ts +194 -0
  301. package/src/arrow/registry.ts +87 -0
  302. package/src/arrow/relational-query.ts +247 -0
  303. package/src/arrow/replace-arrow-columns.ts +71 -0
  304. package/src/arrow/signature.ts +50 -0
  305. package/src/arrow/temporal-cast.ts +66 -0
  306. package/src/arrow/types.ts +76 -0
  307. package/src/arrow/unnest-arrow-column.ts +145 -0
  308. package/src/arrow/worker-entry.ts +10 -0
  309. package/src/arrow/worker.ts +143 -0
  310. package/src/color-functions/index.ts +405 -0
  311. package/src/diagnostic-log.ts +20 -0
  312. package/src/expressions/ast.ts +143 -0
  313. package/src/expressions/columnar-predicate.ts +293 -0
  314. package/src/expressions/evaluation-error.ts +29 -0
  315. package/src/expressions/expression-eval.ts +489 -0
  316. package/src/expressions/function-libraries.ts +126 -0
  317. package/src/expressions/function-registry.ts +171 -0
  318. package/src/expressions/get.ts +37 -0
  319. package/src/expressions/index.ts +40 -0
  320. package/src/expressions/numeric-functions.ts +99 -0
  321. package/src/expressions/parse-expression-string.ts +80 -0
  322. package/src/expressions/predicate-expression.ts +128 -0
  323. package/src/expressions/scalar-type.ts +39 -0
  324. package/src/expressions/vendor/jsep/LICENSE.txt +23 -0
  325. package/src/expressions/vendor/jsep/runtime.ts +949 -0
  326. package/src/expressions/vendor/jsep/types.ts +191 -0
  327. package/src/index.ts +54 -0
  328. package/src/math-functions/index.ts +235 -0
  329. package/src/parser/bind-sql-predicate.ts +21 -0
  330. package/src/parser/index.ts +43 -0
  331. package/src/parser/parameter-snapshots.ts +103 -0
  332. package/src/parser/parse-sql-expression.ts +500 -0
  333. package/src/parser/parse-sql-predicate.ts +454 -0
  334. package/src/parser/parse-sql-query.ts +90 -0
  335. package/src/parser/parse-sql-select.ts +272 -0
  336. package/src/parser/parse-sql-statement.ts +260 -0
  337. package/src/parser/query-types.ts +71 -0
  338. package/src/parser/sql-parameters.ts +174 -0
  339. package/src/parser/sql-parse-error.ts +33 -0
  340. package/src/parser/sql-predicate-schema.ts +279 -0
  341. package/src/parser/sql-predicate-types.ts +91 -0
  342. package/src/parser/sql-predicate.ts +28 -0
  343. package/src/scales/arrow-domains.ts +190 -0
  344. package/src/scales/arrow-scales.ts +363 -0
  345. package/src/scales/compile-scale.ts +5 -0
  346. package/src/scales/conformance.ts +186 -0
  347. package/src/scales/hdr-colors.ts +5 -0
  348. package/src/scales/index.ts +37 -0
  349. package/src/scales/palettes.ts +5 -0
  350. package/src/scales/parse-sql-scale.ts +300 -0
  351. package/src/scales/quantile-sketch.ts +5 -0
  352. package/src/scales/scale-types.ts +5 -0
  353. package/src/scales/streaming-domains.ts +139 -0
@@ -0,0 +1,171 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import type {ExpressionFunction, ExpressionFunctionLibrary} from './function-libraries';
6
+
7
+ const FUNCTION_NAME_PATTERN = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
8
+ const DISALLOWED_FUNCTION_NAMES = new Set([
9
+ '__proto__',
10
+ 'prototype',
11
+ 'constructor',
12
+ 'true',
13
+ 'false',
14
+ 'null',
15
+ 'this'
16
+ ]);
17
+
18
+ /**
19
+ * Options for registering functions with an {@link ExpressionFunctionRegistry}.
20
+ */
21
+ export type FunctionRegistrationOptions = {
22
+ /**
23
+ * Replace an existing function with the same name.
24
+ *
25
+ * @defaultValue false
26
+ */
27
+ replace?: boolean;
28
+ };
29
+
30
+ /**
31
+ * An isolated collection of named functions available to expression evaluators.
32
+ *
33
+ * @remarks
34
+ * Registries are instance scoped. Registering a function does not affect other
35
+ * registries or evaluators that do not receive the registry.
36
+ *
37
+ * Function names must be valid JavaScript-style identifiers so they can be
38
+ * called directly from JSEP expressions.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const registry = new ExpressionFunctionRegistry()
43
+ * .registerFunction('double', (value) => value * 2)
44
+ * .registerFunctions(BASIC_MATH_FUNCTION_LIBRARY);
45
+ *
46
+ * const evaluate = compile('double(round(value))', {registry});
47
+ * evaluate({value: 2.4});
48
+ * ```
49
+ */
50
+ export class ExpressionFunctionRegistry {
51
+ private readonly functions = Object.create(null) as ExpressionFunctionLibrary;
52
+
53
+ /**
54
+ * Creates a function registry.
55
+ *
56
+ * @param functionTables - Function tables to register in order.
57
+ * @throws If a table contains an invalid or duplicate function name.
58
+ */
59
+ constructor(functionTables: readonly ExpressionFunctionLibrary[] = []) {
60
+ for (const functionTable of functionTables) {
61
+ this.registerFunctions(functionTable);
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Registers one named function.
67
+ *
68
+ * @param name - Identifier used to call the function from an expression.
69
+ * @param fn - JavaScript function invoked with evaluated expression arguments.
70
+ * @param options - Duplicate registration behavior.
71
+ * @returns This registry.
72
+ * @throws If the name is invalid, the value is not a function, or the name is
73
+ * already registered and replacement was not requested.
74
+ */
75
+ registerFunction(
76
+ name: string,
77
+ fn: ExpressionFunction,
78
+ options: FunctionRegistrationOptions = {}
79
+ ): this {
80
+ validateFunction(name, fn);
81
+ if (this.hasFunction(name) && !options.replace) {
82
+ throw new Error(`Expression function "${name}" is already registered.`);
83
+ }
84
+ this.functions[name] = fn;
85
+ return this;
86
+ }
87
+
88
+ /**
89
+ * Registers all entries in a function table.
90
+ *
91
+ * @param functionTable - Map from expression identifiers to JavaScript functions.
92
+ * @param options - Duplicate registration behavior.
93
+ * @returns This registry.
94
+ * @throws If any entry is invalid or conflicts with an existing registration.
95
+ *
96
+ * @remarks
97
+ * Validation is atomic: no entries are registered when any entry is invalid.
98
+ */
99
+ registerFunctions(
100
+ functionTable: ExpressionFunctionLibrary,
101
+ options: FunctionRegistrationOptions = {}
102
+ ): this {
103
+ const entries = Object.entries(functionTable);
104
+ const names = new Set<string>();
105
+
106
+ for (const [name, fn] of entries) {
107
+ validateFunction(name, fn);
108
+ if (names.has(name) || (this.hasFunction(name) && !options.replace)) {
109
+ throw new Error(`Expression function "${name}" is already registered.`);
110
+ }
111
+ names.add(name);
112
+ }
113
+
114
+ for (const [name, fn] of entries) {
115
+ this.functions[name] = fn;
116
+ }
117
+ return this;
118
+ }
119
+
120
+ /**
121
+ * Removes a registered function.
122
+ *
123
+ * @param name - Function name to remove.
124
+ * @returns `true` when a function was removed.
125
+ */
126
+ unregisterFunction(name: string): boolean {
127
+ if (!this.hasFunction(name)) {
128
+ return false;
129
+ }
130
+ return delete this.functions[name];
131
+ }
132
+
133
+ /**
134
+ * Tests whether a function is registered.
135
+ *
136
+ * @param name - Function name to inspect.
137
+ * @returns `true` when the registry contains the name.
138
+ */
139
+ hasFunction(name: string): boolean {
140
+ return Object.prototype.hasOwnProperty.call(this.functions, name);
141
+ }
142
+
143
+ /**
144
+ * Returns a registered function.
145
+ *
146
+ * @param name - Function name to retrieve.
147
+ * @returns The registered function, or `undefined`.
148
+ */
149
+ getFunction(name: string): ExpressionFunction | undefined {
150
+ return this.functions[name];
151
+ }
152
+
153
+ /**
154
+ * Returns an immutable snapshot of all registered functions.
155
+ *
156
+ * @returns A frozen function table.
157
+ */
158
+ getFunctionTable(): Readonly<ExpressionFunctionLibrary> {
159
+ return Object.freeze({...this.functions});
160
+ }
161
+ }
162
+
163
+ /** Validates one registry entry. */
164
+ function validateFunction(name: string, fn: ExpressionFunction): void {
165
+ if (!FUNCTION_NAME_PATTERN.test(name) || DISALLOWED_FUNCTION_NAMES.has(name)) {
166
+ throw new Error(`Invalid expression function name "${name}".`);
167
+ }
168
+ if (typeof fn !== 'function') {
169
+ throw new TypeError(`Expression function "${name}" must be a function.`);
170
+ }
171
+ }
@@ -0,0 +1,37 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ /**
6
+ * Access properties of nested containers using dot-path notation.
7
+ *
8
+ * @param container - Object from which to read a value.
9
+ * @param compositeKey - Dot-separated property path.
10
+ * @returns The nested value, or `undefined` when the path cannot be resolved.
11
+ */
12
+ export function get(container: Record<string, unknown>, compositeKey: string): unknown {
13
+ let value: unknown = container;
14
+
15
+ for (const key of getKeys(compositeKey)) {
16
+ value = isObject(value) ? value[key] : undefined;
17
+ }
18
+
19
+ return value;
20
+ }
21
+
22
+ /** Tests whether a value can be used for property access. */
23
+ function isObject(value: unknown): value is Record<string, unknown> {
24
+ return value !== null && typeof value === 'object';
25
+ }
26
+
27
+ const keyMap: Record<string, string[]> = Object.create(null);
28
+
29
+ /** Returns a cached list of property names for a dot-separated path. */
30
+ function getKeys(compositeKey: string): string[] {
31
+ let keyList = keyMap[compositeKey];
32
+ if (!keyList) {
33
+ keyList = compositeKey.split('.');
34
+ keyMap[compositeKey] = keyList;
35
+ }
36
+ return keyList;
37
+ }
@@ -0,0 +1,40 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ export type {
6
+ ExpressionEvaluationOptions,
7
+ ExpressionFunction,
8
+ ExpressionFunctionLibrary
9
+ } from './function-libraries';
10
+ export {ExpressionFunctionRegistry, type FunctionRegistrationOptions} from './function-registry';
11
+ export type {BinaryOperator, Expression, ExpressionContext, UnaryOperator} from './expression-eval';
12
+ export {
13
+ addBinaryOp,
14
+ addUnaryOp,
15
+ compile,
16
+ compileAsync,
17
+ evaluate,
18
+ evaluateAsync,
19
+ parse
20
+ } from './expression-eval';
21
+ export {BASIC_MATH_FUNCTION_LIBRARY, mergeFunctionLibraries} from './function-libraries';
22
+ export {parseExpressionString, type AccessorFunction} from './parse-expression-string';
23
+
24
+ export * from './columnar-predicate';
25
+
26
+ export {isColumnarScalarType, COLUMNAR_SCALAR_TYPES, type ColumnarScalarType} from './scalar-type';
27
+
28
+ export {validateExpressionAST, getExpressionColumns, type ExpressionASTOptions} from './ast';
29
+ export {columnarPredicateToExpression} from './predicate-expression';
30
+ export {
31
+ ExpressionEvaluationError,
32
+ isExpressionEvaluationError,
33
+ type ExpressionEvaluationErrorCode
34
+ } from './evaluation-error';
35
+ export {
36
+ NUMERIC_FUNCTION_DEFINITIONS,
37
+ type NumericFunctionDefinition,
38
+ type NumericFunctionPrototype,
39
+ type ExpressionNumericType
40
+ } from './numeric-functions';
@@ -0,0 +1,99 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ import type {ExpressionEvaluationErrorCode} from './evaluation-error';
5
+
6
+ /** Logical numeric types, independent of Arrow fields, GPU formats, or shader spelling. */
7
+ export type ExpressionNumericType =
8
+ | 'int8'
9
+ | 'int16'
10
+ | 'int32'
11
+ | 'int64'
12
+ | 'uint8'
13
+ | 'uint16'
14
+ | 'uint32'
15
+ | 'uint64'
16
+ | 'float16'
17
+ | 'float32'
18
+ | 'float64';
19
+ /** One exact numeric function signature; conversions are chosen by a backend at binding time. */
20
+ export type NumericFunctionPrototype = Readonly<{
21
+ arguments: readonly ExpressionNumericType[];
22
+ result: ExpressionNumericType;
23
+ }>;
24
+ /** Portable numeric semantics consumed by CPU or GPU compilers without Arrow dependencies. */
25
+ export type NumericFunctionDefinition = Readonly<{
26
+ name: string;
27
+ prototypes: readonly NumericFunctionPrototype[];
28
+ nullHandling: 'propagate';
29
+ overloadResolution: 'exactThenFloatingWidening';
30
+ nanHandling: 'propagate';
31
+ errors: readonly ExpressionEvaluationErrorCode[];
32
+ domain?: 'nonNegative' | 'positive' | 'signedUnitInterval' | 'power';
33
+ angleUnit?: 'radians';
34
+ rounding?: 'tiesAwayFromZero';
35
+ remainderSign?: 'dividend';
36
+ }>;
37
+ const numericTypes: readonly ExpressionNumericType[] = [
38
+ 'int8',
39
+ 'int16',
40
+ 'int32',
41
+ 'int64',
42
+ 'uint8',
43
+ 'uint16',
44
+ 'uint32',
45
+ 'uint64',
46
+ 'float16',
47
+ 'float32',
48
+ 'float64'
49
+ ];
50
+ function definition(
51
+ name: string,
52
+ arity = 1,
53
+ preserveInteger = false,
54
+ semantics: Partial<
55
+ Pick<NumericFunctionDefinition, 'domain' | 'angleUnit' | 'rounding' | 'remainderSign'>
56
+ > = {},
57
+ errors: readonly ExpressionEvaluationErrorCode[] = ['domain', 'overflow']
58
+ ): NumericFunctionDefinition {
59
+ return Object.freeze({
60
+ name,
61
+ prototypes: Object.freeze(
62
+ numericTypes.map(type =>
63
+ Object.freeze({
64
+ arguments: Object.freeze(Array.from({length: arity}, () => type)),
65
+ result: preserveInteger || type.startsWith('float') ? type : 'float64'
66
+ })
67
+ )
68
+ ),
69
+ nullHandling: 'propagate',
70
+ overloadResolution: 'exactThenFloatingWidening',
71
+ nanHandling: 'propagate',
72
+ errors: Object.freeze([...errors]),
73
+ ...semantics
74
+ });
75
+ }
76
+ /** Standard numeric declarations. These describe semantics and contain no executable callbacks. */
77
+ export const NUMERIC_FUNCTION_DEFINITIONS = Object.freeze({
78
+ ABS: definition('ABS', 1, true, {}, ['overflow']),
79
+ SIGN: definition('SIGN', 1, true, {}, []),
80
+ FLOOR: definition('FLOOR', 1, true, {}, []),
81
+ CEILING: definition('CEILING', 1, true, {}, []),
82
+ ROUND: definition('ROUND', 1, true, {rounding: 'tiesAwayFromZero'}, []),
83
+ TRUNC: definition('TRUNC', 1, true, {}, []),
84
+ SQRT: definition('SQRT', 1, false, {domain: 'nonNegative'}),
85
+ POWER: definition('POWER', 2, false, {domain: 'power'}),
86
+ EXP: definition('EXP'),
87
+ LN: definition('LN', 1, false, {domain: 'positive'}),
88
+ LOG10: definition('LOG10', 1, false, {domain: 'positive'}),
89
+ SIN: definition('SIN', 1, false, {angleUnit: 'radians'}),
90
+ COS: definition('COS', 1, false, {angleUnit: 'radians'}),
91
+ TAN: definition('TAN', 1, false, {angleUnit: 'radians'}),
92
+ ASIN: definition('ASIN', 1, false, {domain: 'signedUnitInterval', angleUnit: 'radians'}),
93
+ ACOS: definition('ACOS', 1, false, {domain: 'signedUnitInterval', angleUnit: 'radians'}),
94
+ ATAN: definition('ATAN', 1, false, {angleUnit: 'radians'}),
95
+ ATAN2: definition('ATAN2', 2, false, {angleUnit: 'radians'}),
96
+ DEGREES: definition('DEGREES'),
97
+ RADIANS: definition('RADIANS'),
98
+ MOD: definition('MOD', 2, true, {remainderSign: 'dividend'}, ['divisionByZero', 'domain'])
99
+ });
@@ -0,0 +1,80 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import type {Jsep as jsep} from './vendor/jsep/types';
6
+ import {evaluate, parse} from './expression-eval';
7
+ import {get} from './get';
8
+
9
+ /**
10
+ * An accessor compiled from a JSON-style expression string.
11
+ *
12
+ * @param row - Data object against which the expression is evaluated.
13
+ * @returns The value produced by the expression.
14
+ */
15
+ export type AccessorFunction = (row: Record<string, unknown>) => unknown;
16
+
17
+ const cachedExpressionMap = Object.assign(Object.create(null) as Record<string, AccessorFunction>, {
18
+ '-': (object: Record<string, unknown>) => object
19
+ });
20
+
21
+ /**
22
+ * Compiles a JSON-style expression string into an accessor function.
23
+ *
24
+ * @param propValue - Accessor expression to compile.
25
+ * @returns A cached accessor function.
26
+ * @throws If the expression is invalid or contains a function call.
27
+ *
28
+ * @remarks
29
+ * `-` maps to the identity accessor and `a.b.c` maps to nested property
30
+ * access. Function calls are rejected so accessors cannot execute functions
31
+ * supplied by input data.
32
+ */
33
+ export function parseExpressionString(propValue: string): AccessorFunction {
34
+ if (propValue in cachedExpressionMap) {
35
+ return cachedExpressionMap[propValue];
36
+ }
37
+
38
+ const ast = parse(propValue);
39
+ const func =
40
+ ast.type === 'Identifier'
41
+ ? (row: Record<string, unknown>) => get(row, propValue)
42
+ : compileAst(ast);
43
+
44
+ cachedExpressionMap[propValue] = func;
45
+ return func;
46
+ }
47
+
48
+ /** Validates and compiles a parsed accessor expression. */
49
+ function compileAst(ast: jsep.Expression): AccessorFunction {
50
+ traverse(ast, node => {
51
+ if (node.type === 'CallExpression') {
52
+ throw new Error('Function calls not allowed in expression accessors');
53
+ }
54
+ });
55
+
56
+ return (row: Record<string, unknown>) => evaluate(ast, row);
57
+ }
58
+
59
+ /** Visits each AST-like object in a parsed expression. */
60
+ // eslint-disable-next-line complexity
61
+ function traverse(node: unknown, visitor: (node: {type: string}) => void): void {
62
+ if (Array.isArray(node)) {
63
+ node.forEach(element => traverse(element, visitor));
64
+ return;
65
+ }
66
+
67
+ if (node && typeof node === 'object') {
68
+ if (isNodeLike(node)) {
69
+ visitor(node);
70
+ }
71
+ for (const key in node) {
72
+ traverse((node as Record<string, unknown>)[key], visitor);
73
+ }
74
+ }
75
+ }
76
+
77
+ /** Tests whether an object resembles a JSEP AST node. */
78
+ function isNodeLike(node: object): node is {type: string} {
79
+ return 'type' in node && typeof (node as {type?: unknown}).type === 'string';
80
+ }
@@ -0,0 +1,128 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+ import type {Expression} from './expression-eval';
5
+ import {MAXIMUM_EXPRESSION_NODES, validateExpressionAST} from './ast';
6
+ import {
7
+ bindColumnarPredicateParameters,
8
+ getColumnarPredicateColumns,
9
+ validateColumnarPredicate,
10
+ type ColumnarPredicate,
11
+ type ColumnarPredicateProperty,
12
+ type ParameterizedColumnarPredicate,
13
+ type ColumnarPredicateParameterValues
14
+ } from './columnar-predicate';
15
+
16
+ /** Normalizes bound or parameterized top-level predicates to the shared expression AST. */
17
+ export function columnarPredicateToExpression(
18
+ predicate: ParameterizedColumnarPredicate,
19
+ options: {parameters?: ColumnarPredicateParameterValues} = {}
20
+ ): Expression {
21
+ // Bound the input before the recursive predicate utilities inspect it.
22
+ const stack: {node: any; depth: number}[] = [{node: predicate, depth: 0}];
23
+ let count = 0;
24
+ let expressionNodes = 0;
25
+ while (stack.length) {
26
+ const {node, depth} = stack.pop()!;
27
+ if (++count > 4096 || depth > 64) throw new Error('Predicate exceeds node or depth limit');
28
+ if (
29
+ !node ||
30
+ typeof node !== 'object' ||
31
+ !Array.isArray(node.args) ||
32
+ !['and', 'or', 'not', 'isNull', 'in', '=', '<>', '<', '<=', '>', '>='].includes(node.op)
33
+ )
34
+ throw new Error('Invalid columnar predicate');
35
+ if (node.op === 'and' || node.op === 'or' || node.op === 'not') {
36
+ if (node.op === 'not' && node.args.length !== 1)
37
+ throw new Error('NOT requires one predicate');
38
+ if (node.args.length + count + stack.length > 4096)
39
+ throw new Error('Predicate exceeds node limit');
40
+ expressionNodes += node.op === 'not' ? 1 : Math.max(0, node.args.length - 1);
41
+ for (const child of node.args) stack.push({node: child, depth: depth + 1});
42
+ } else if (
43
+ node.args.length !== (node.op === 'isNull' ? 1 : 2) ||
44
+ !node.args[0] ||
45
+ typeof node.args[0] !== 'object' ||
46
+ (node.op === 'in' && !Array.isArray(node.args[1]))
47
+ )
48
+ throw new Error('Invalid predicate arguments');
49
+ if (node.op !== 'and' && node.op !== 'or' && node.op !== 'not') {
50
+ const property = node.args[0];
51
+ if (
52
+ typeof property.property !== 'string' &&
53
+ (!Array.isArray(property.property) || property.property.length !== 1)
54
+ )
55
+ throw new Error('Expression normalization requires top-level columns');
56
+ const casts = property.casts;
57
+ if (casts !== undefined && (!Array.isArray(casts) || casts.length > 64))
58
+ throw new Error('Invalid columnar predicate casts');
59
+ const literals = node.op === 'in' ? node.args[1].length : node.op === 'isNull' ? 0 : 1;
60
+ if (literals > 4096) throw new Error('Predicate membership exceeds node limit');
61
+ // The test and column contribute two nodes; each cast adds a call and a target literal.
62
+ expressionNodes += 2 + 2 * (casts?.length ?? 0) + literals;
63
+ }
64
+ if (expressionNodes > MAXIMUM_EXPRESSION_NODES)
65
+ throw new Error('Predicate exceeds normalized AST node limit');
66
+ }
67
+ const bound = bindColumnarPredicateParameters(predicate, options.parameters ?? {});
68
+ validateColumnarPredicate(bound, new Set(getColumnarPredicateColumns(bound)));
69
+ const expression = convert(bound);
70
+ validateExpressionAST(expression);
71
+ return expression;
72
+ }
73
+ function combine(operator: string, expressions: Expression[]): Expression {
74
+ // A balanced tree retains bounded depth for long IN lists and logical groups.
75
+ if (expressions.length === 1) return expressions[0]!;
76
+ const midpoint = Math.floor(expressions.length / 2);
77
+ return {
78
+ type: 'BinaryExpression',
79
+ operator,
80
+ left: combine(operator, expressions.slice(0, midpoint)),
81
+ right: combine(operator, expressions.slice(midpoint))
82
+ } as Expression;
83
+ }
84
+ function convert(predicate: ColumnarPredicate): Expression {
85
+ if (predicate.op === 'and' || predicate.op === 'or')
86
+ return combine(predicate.op === 'and' ? '&&' : '||', predicate.args.map(convert));
87
+ if (predicate.op === 'not')
88
+ return {
89
+ type: 'UnaryExpression',
90
+ operator: '!',
91
+ prefix: true,
92
+ argument: convert(predicate.args[0])
93
+ } as Expression;
94
+ const property = predicate.args[0] as ColumnarPredicateProperty;
95
+ const path = typeof property.property === 'string' ? [property.property] : property.property;
96
+ if (path.length !== 1) throw new Error('Expression normalization requires top-level columns');
97
+ let left = {type: 'Identifier', name: path[0]} as Expression;
98
+ const call = (name: string, args: Expression[]) =>
99
+ ({type: 'CallExpression', callee: {type: 'Identifier', name}, arguments: args}) as Expression;
100
+ for (const type of property.casts ?? [])
101
+ left = call('cast', [
102
+ left,
103
+ {type: 'Literal', value: type, raw: JSON.stringify(type)} as Expression
104
+ ]);
105
+ const literal = (value: unknown): Expression => {
106
+ if (value instanceof Date || value instanceof Uint8Array)
107
+ throw new Error('Date and binary predicate literals require explicit backend conversion');
108
+ if (
109
+ ['int64', 'uint64'].includes(property.casts?.at(-1) ?? '') &&
110
+ typeof value === 'number' &&
111
+ Number.isSafeInteger(value)
112
+ )
113
+ value = BigInt(value);
114
+ return {
115
+ type: 'Literal',
116
+ value,
117
+ raw: typeof value === 'bigint' ? String(value) : JSON.stringify(value)
118
+ } as Expression;
119
+ };
120
+ if (predicate.op === 'isNull') return call('isNull', [left]);
121
+ if (predicate.op === 'in') return call('in', [left, ...predicate.args[1].map(literal)]);
122
+ return {
123
+ type: 'BinaryExpression',
124
+ operator: predicate.op === '=' ? '==' : predicate.op === '<>' ? '!=' : predicate.op,
125
+ left,
126
+ right: literal(predicate.args[1])
127
+ } as Expression;
128
+ }
@@ -0,0 +1,39 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ /** Portable primitive conversion targets, independent of Arrow and SQL spelling. */
6
+ export type ColumnarScalarType =
7
+ | 'int8'
8
+ | 'int16'
9
+ | 'int32'
10
+ | 'int64'
11
+ | 'uint8'
12
+ | 'uint16'
13
+ | 'uint32'
14
+ | 'uint64'
15
+ | 'float16'
16
+ | 'float32'
17
+ | 'float64'
18
+ | 'bool'
19
+ | 'utf8';
20
+ export const COLUMNAR_SCALAR_TYPES: readonly ColumnarScalarType[] = Object.freeze([
21
+ 'int8',
22
+ 'int16',
23
+ 'int32',
24
+ 'int64',
25
+ 'uint8',
26
+ 'uint16',
27
+ 'uint32',
28
+ 'uint64',
29
+ 'float16',
30
+ 'float32',
31
+ 'float64',
32
+ 'bool',
33
+ 'utf8'
34
+ ]);
35
+
36
+ /** Rejects unknown conversion targets rather than silently applying JavaScript coercion. */
37
+ export function isColumnarScalarType(value: unknown): value is ColumnarScalarType {
38
+ return typeof value === 'string' && (COLUMNAR_SCALAR_TYPES as readonly string[]).includes(value);
39
+ }
@@ -0,0 +1,23 @@
1
+ SPDX-License-Identifier: MIT
2
+ SPDX-FileCopyrightText: Copyright (c) 2013 Stephen Oney
3
+
4
+ Copyright (c) 2013 Stephen Oney, https://ericsmekens.github.io/jsep/
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.