@jplorg/jpl 2.0.0 → 2.1.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 (320) hide show
  1. package/dist/esm/main.js +3474 -0
  2. package/dist/types/applyDefaults.d.ts +2 -0
  3. package/dist/types/builtins/funcContains.d.ts +3 -0
  4. package/dist/types/builtins/funcEndsWith.d.ts +3 -0
  5. package/dist/types/builtins/funcError.d.ts +3 -0
  6. package/dist/types/builtins/funcFromJSON.d.ts +3 -0
  7. package/dist/types/builtins/funcHas.d.ts +3 -0
  8. package/dist/types/builtins/funcIn.d.ts +3 -0
  9. package/dist/types/builtins/funcKeys.d.ts +3 -0
  10. package/dist/types/builtins/funcLength.d.ts +3 -0
  11. package/dist/types/builtins/funcNow.d.ts +3 -0
  12. package/dist/types/builtins/funcStartsWith.d.ts +3 -0
  13. package/dist/types/builtins/funcToJSON.d.ts +3 -0
  14. package/dist/types/builtins/funcToLowerCase.d.ts +3 -0
  15. package/dist/types/builtins/funcToNumber.d.ts +3 -0
  16. package/dist/types/builtins/funcToString.d.ts +3 -0
  17. package/dist/types/builtins/funcToUpperCase.d.ts +3 -0
  18. package/dist/types/builtins/funcTrim.d.ts +3 -0
  19. package/dist/types/builtins/funcTrimEnd.d.ts +3 -0
  20. package/dist/types/builtins/funcTrimStart.d.ts +3 -0
  21. package/dist/types/builtins/funcType.d.ts +3 -0
  22. package/dist/types/builtins/funcVoid.d.ts +3 -0
  23. package/dist/types/builtins/index.d.ts +2 -0
  24. package/dist/types/builtins/internals.d.ts +1 -0
  25. package/dist/types/builtins/math.d.ts +17 -0
  26. package/dist/types/createSingleton.d.ts +1 -0
  27. package/dist/types/interpreter/index.d.ts +21 -0
  28. package/dist/types/interpreter/parse.d.ts +194 -0
  29. package/{src/interpreter/parseFunction.js → dist/types/interpreter/parseFunction.d.ts} +2 -10
  30. package/dist/types/interpreter/system.d.ts +3 -0
  31. package/dist/types/interpreter/util.d.ts +89 -0
  32. package/dist/types/library/apply.d.ts +32 -0
  33. package/dist/types/library/definition.d.ts +79 -0
  34. package/dist/types/library/errors/adaptErrors.d.ts +6 -0
  35. package/dist/types/library/errors/enclosure.d.ts +6 -0
  36. package/dist/types/library/errors/error.d.ts +6 -0
  37. package/dist/types/library/errors/execution.d.ts +12 -0
  38. package/dist/types/library/errors/fatal.d.ts +4 -0
  39. package/dist/types/library/errors/runtime.d.ts +46 -0
  40. package/dist/types/library/errors/syntax.d.ts +7 -0
  41. package/{src/library/functions.js → dist/types/library/functions.d.ts} +9 -30
  42. package/dist/types/library/index.d.ts +18 -0
  43. package/dist/types/library/mux.d.ts +19 -0
  44. package/{src/library/ops/op.js → dist/types/library/ops/op.d.ts} +25 -49
  45. package/{src/library/ops/opa.js → dist/types/library/ops/opa.d.ts} +4 -7
  46. package/{src/library/ops/opc.js → dist/types/library/ops/opc.d.ts} +6 -11
  47. package/{src/library/ops/opm.js → dist/types/library/ops/opm.d.ts} +5 -9
  48. package/{src/library/ops/opu.js → dist/types/library/ops/opu.d.ts} +8 -15
  49. package/dist/types/library/runtimeScope.d.ts +23 -0
  50. package/dist/types/library/runtimeSignal.d.ts +25 -0
  51. package/dist/types/library/types.d.ts +97 -0
  52. package/dist/types/main.d.ts +19 -0
  53. package/dist/types/program/handler.d.ts +12 -0
  54. package/dist/types/program/index.d.ts +40 -0
  55. package/dist/types/program/ops/index.d.ts +5 -0
  56. package/dist/types/program/ops/opAccess/index.d.ts +11 -0
  57. package/dist/types/program/ops/opAccess/opaField.d.ts +11 -0
  58. package/dist/types/program/ops/opAccess/opaFunction.d.ts +11 -0
  59. package/dist/types/program/ops/opAccess/opaIter.d.ts +11 -0
  60. package/dist/types/program/ops/opAccess/opaSlice.d.ts +11 -0
  61. package/dist/types/program/ops/opAnd.d.ts +11 -0
  62. package/dist/types/program/ops/opArrayConstructor.d.ts +11 -0
  63. package/dist/types/program/ops/opAssignment/index.d.ts +11 -0
  64. package/dist/types/program/ops/opAssignment/opaAssignField.d.ts +11 -0
  65. package/dist/types/program/ops/opAssignment/opaAssignIter.d.ts +11 -0
  66. package/dist/types/program/ops/opAssignment/opaAssignSlice.d.ts +11 -0
  67. package/dist/types/program/ops/opAssignment/opuAddition.d.ts +11 -0
  68. package/dist/types/program/ops/opAssignment/opuDivision.d.ts +11 -0
  69. package/dist/types/program/ops/opAssignment/opuMultiplication.d.ts +11 -0
  70. package/dist/types/program/ops/opAssignment/opuNullCoalescence.d.ts +11 -0
  71. package/dist/types/program/ops/opAssignment/opuRemainder.d.ts +11 -0
  72. package/dist/types/program/ops/opAssignment/opuSet.d.ts +11 -0
  73. package/dist/types/program/ops/opAssignment/opuSubtraction.d.ts +11 -0
  74. package/dist/types/program/ops/opAssignment/opuUpdate.d.ts +11 -0
  75. package/dist/types/program/ops/opCalculation/index.d.ts +11 -0
  76. package/dist/types/program/ops/opCalculation/opmAddition.d.ts +11 -0
  77. package/dist/types/program/ops/opCalculation/opmDivision.d.ts +11 -0
  78. package/dist/types/program/ops/opCalculation/opmMultiplication.d.ts +11 -0
  79. package/dist/types/program/ops/opCalculation/opmRemainder.d.ts +11 -0
  80. package/dist/types/program/ops/opCalculation/opmSubtraction.d.ts +11 -0
  81. package/dist/types/program/ops/opComparison/index.d.ts +11 -0
  82. package/dist/types/program/ops/opComparison/opcEqual.d.ts +11 -0
  83. package/dist/types/program/ops/opComparison/opcGreater.d.ts +11 -0
  84. package/dist/types/program/ops/opComparison/opcGreaterEqual.d.ts +11 -0
  85. package/dist/types/program/ops/opComparison/opcLess.d.ts +11 -0
  86. package/dist/types/program/ops/opComparison/opcLessEqual.d.ts +11 -0
  87. package/dist/types/program/ops/opComparison/opcUnequal.d.ts +11 -0
  88. package/dist/types/program/ops/opConstant.d.ts +11 -0
  89. package/dist/types/program/ops/opConstantFalse.d.ts +11 -0
  90. package/dist/types/program/ops/opConstantNull.d.ts +11 -0
  91. package/dist/types/program/ops/opConstantTrue.d.ts +11 -0
  92. package/dist/types/program/ops/opFunctionDefinition.d.ts +11 -0
  93. package/dist/types/program/ops/opIf.d.ts +11 -0
  94. package/dist/types/program/ops/opInterpolatedString.d.ts +11 -0
  95. package/dist/types/program/ops/opNegation.d.ts +11 -0
  96. package/dist/types/program/ops/opNot.d.ts +11 -0
  97. package/dist/types/program/ops/opNullCoalescence.d.ts +11 -0
  98. package/dist/types/program/ops/opNumber.d.ts +11 -0
  99. package/dist/types/program/ops/opObjectConstructor.d.ts +11 -0
  100. package/dist/types/program/ops/opOr.d.ts +11 -0
  101. package/dist/types/program/ops/opOutputConcat.d.ts +11 -0
  102. package/dist/types/program/ops/opString.d.ts +11 -0
  103. package/dist/types/program/ops/opTry.d.ts +11 -0
  104. package/dist/types/program/ops/opVariable.d.ts +11 -0
  105. package/dist/types/program/ops/opVariableDefinition.d.ts +11 -0
  106. package/dist/types/program/ops/opVoid.d.ts +11 -0
  107. package/dist/types/program/ops/utils.d.ts +5 -0
  108. package/dist/types/program/params.d.ts +68 -0
  109. package/dist/types/runtime/index.d.ts +83 -0
  110. package/package.json +66 -49
  111. package/{repl.js → repl.ts} +85 -39
  112. package/lib/applyDefaults.js +0 -34
  113. package/lib/builtins/funcContains.js +0 -25
  114. package/lib/builtins/funcEndsWith.js +0 -21
  115. package/lib/builtins/funcError.js +0 -11
  116. package/lib/builtins/funcFromJSON.js +0 -26
  117. package/lib/builtins/funcHas.js +0 -24
  118. package/lib/builtins/funcIn.js +0 -24
  119. package/lib/builtins/funcKeys.js +0 -20
  120. package/lib/builtins/funcLength.js +0 -24
  121. package/lib/builtins/funcNow.js +0 -10
  122. package/lib/builtins/funcStartsWith.js +0 -21
  123. package/lib/builtins/funcToJSON.js +0 -10
  124. package/lib/builtins/funcToLowerCase.js +0 -17
  125. package/lib/builtins/funcToNumber.js +0 -26
  126. package/lib/builtins/funcToString.js +0 -10
  127. package/lib/builtins/funcToUpperCase.js +0 -17
  128. package/lib/builtins/funcTrim.js +0 -17
  129. package/lib/builtins/funcTrimEnd.js +0 -17
  130. package/lib/builtins/funcTrimStart.js +0 -17
  131. package/lib/builtins/funcType.js +0 -10
  132. package/lib/builtins/funcVoid.js +0 -10
  133. package/lib/builtins/index.js +0 -205
  134. package/lib/builtins/internals.js +0 -8
  135. package/lib/builtins/math.js +0 -40
  136. package/lib/builtins/native.js +0 -180
  137. package/lib/createSingleton.js +0 -14
  138. package/lib/index.js +0 -79
  139. package/lib/interpreter/index.js +0 -56
  140. package/lib/interpreter/parse.js +0 -2377
  141. package/lib/interpreter/parseFunction.js +0 -24
  142. package/lib/interpreter/system.js +0 -10
  143. package/lib/interpreter/util.js +0 -349
  144. package/lib/library/apply.js +0 -142
  145. package/lib/library/definition.js +0 -9
  146. package/lib/library/errors/adaptErrors.js +0 -34
  147. package/lib/library/errors/enclosure.js +0 -16
  148. package/lib/library/errors/error.js +0 -18
  149. package/lib/library/errors/execution.js +0 -20
  150. package/lib/library/errors/fatal.js +0 -15
  151. package/lib/library/errors/runtime.js +0 -78
  152. package/lib/library/errors/syntax.js +0 -17
  153. package/lib/library/functions.js +0 -82
  154. package/lib/library/index.js +0 -335
  155. package/lib/library/mux.js +0 -106
  156. package/lib/library/ops/index.js +0 -60
  157. package/lib/library/ops/op.js +0 -180
  158. package/lib/library/ops/opa.js +0 -41
  159. package/lib/library/ops/opc.js +0 -59
  160. package/lib/library/ops/opm.js +0 -50
  161. package/lib/library/ops/opu.js +0 -77
  162. package/lib/library/runtimeScope.js +0 -38
  163. package/lib/library/runtimeSignal.js +0 -72
  164. package/lib/library/types.js +0 -304
  165. package/lib/program/index.js +0 -101
  166. package/lib/program/ops/index.js +0 -61
  167. package/lib/program/ops/opAccess/index.js +0 -55
  168. package/lib/program/ops/opAccess/opaField.js +0 -50
  169. package/lib/program/ops/opAccess/opaFunction.js +0 -50
  170. package/lib/program/ops/opAccess/opaIter.js +0 -33
  171. package/lib/program/ops/opAccess/opaSlice.js +0 -46
  172. package/lib/program/ops/opAnd.js +0 -30
  173. package/lib/program/ops/opArrayConstructor.js +0 -20
  174. package/lib/program/ops/opAssignment/index.js +0 -90
  175. package/lib/program/ops/opAssignment/opaAssignField.js +0 -125
  176. package/lib/program/ops/opAssignment/opaAssignIter.js +0 -71
  177. package/lib/program/ops/opAssignment/opaAssignSlice.js +0 -101
  178. package/lib/program/ops/opAssignment/opuAddition.js +0 -31
  179. package/lib/program/ops/opAssignment/opuDivision.js +0 -31
  180. package/lib/program/ops/opAssignment/opuMultiplication.js +0 -31
  181. package/lib/program/ops/opAssignment/opuNullCoalescence.js +0 -25
  182. package/lib/program/ops/opAssignment/opuRemainder.js +0 -31
  183. package/lib/program/ops/opAssignment/opuSet.js +0 -19
  184. package/lib/program/ops/opAssignment/opuSubtraction.js +0 -31
  185. package/lib/program/ops/opAssignment/opuUpdate.js +0 -19
  186. package/lib/program/ops/opCalculation/index.js +0 -57
  187. package/lib/program/ops/opCalculation/opmAddition.js +0 -49
  188. package/lib/program/ops/opCalculation/opmDivision.js +0 -42
  189. package/lib/program/ops/opCalculation/opmMultiplication.js +0 -40
  190. package/lib/program/ops/opCalculation/opmRemainder.js +0 -34
  191. package/lib/program/ops/opCalculation/opmSubtraction.js +0 -53
  192. package/lib/program/ops/opComparison/index.js +0 -59
  193. package/lib/program/ops/opComparison/opcEqual.js +0 -19
  194. package/lib/program/ops/opComparison/opcGreater.js +0 -19
  195. package/lib/program/ops/opComparison/opcGreaterEqual.js +0 -19
  196. package/lib/program/ops/opComparison/opcLess.js +0 -19
  197. package/lib/program/ops/opComparison/opcLessEqual.js +0 -19
  198. package/lib/program/ops/opComparison/opcUnequal.js +0 -19
  199. package/lib/program/ops/opConstant.js +0 -18
  200. package/lib/program/ops/opConstantFalse.js +0 -16
  201. package/lib/program/ops/opConstantNull.js +0 -16
  202. package/lib/program/ops/opConstantTrue.js +0 -16
  203. package/lib/program/ops/opFunctionDefinition.js +0 -21
  204. package/lib/program/ops/opIf.js +0 -38
  205. package/lib/program/ops/opInterpolatedString.js +0 -24
  206. package/lib/program/ops/opNegation.js +0 -25
  207. package/lib/program/ops/opNot.js +0 -16
  208. package/lib/program/ops/opNullCoalescence.js +0 -34
  209. package/lib/program/ops/opNumber.js +0 -18
  210. package/lib/program/ops/opObjectConstructor.js +0 -37
  211. package/lib/program/ops/opOr.js +0 -30
  212. package/lib/program/ops/opOutputConcat.js +0 -19
  213. package/lib/program/ops/opString.js +0 -18
  214. package/lib/program/ops/opTry.js +0 -37
  215. package/lib/program/ops/opVariable.js +0 -20
  216. package/lib/program/ops/opVariableDefinition.js +0 -24
  217. package/lib/program/ops/opVoid.js +0 -16
  218. package/lib/program/ops/utils.js +0 -35
  219. package/lib/runtime/index.js +0 -258
  220. package/src/applyDefaults.js +0 -35
  221. package/src/builtins/funcContains.js +0 -27
  222. package/src/builtins/funcEndsWith.js +0 -21
  223. package/src/builtins/funcError.js +0 -7
  224. package/src/builtins/funcFromJSON.js +0 -24
  225. package/src/builtins/funcHas.js +0 -25
  226. package/src/builtins/funcIn.js +0 -25
  227. package/src/builtins/funcKeys.js +0 -20
  228. package/src/builtins/funcLength.js +0 -26
  229. package/src/builtins/funcNow.js +0 -5
  230. package/src/builtins/funcStartsWith.js +0 -21
  231. package/src/builtins/funcToJSON.js +0 -5
  232. package/src/builtins/funcToLowerCase.js +0 -20
  233. package/src/builtins/funcToNumber.js +0 -25
  234. package/src/builtins/funcToString.js +0 -5
  235. package/src/builtins/funcToUpperCase.js +0 -20
  236. package/src/builtins/funcTrim.js +0 -16
  237. package/src/builtins/funcTrimEnd.js +0 -16
  238. package/src/builtins/funcTrimStart.js +0 -16
  239. package/src/builtins/funcType.js +0 -5
  240. package/src/builtins/funcVoid.js +0 -5
  241. package/src/builtins/index.js +0 -193
  242. package/src/builtins/internals.js +0 -9
  243. package/src/builtins/math.js +0 -44
  244. package/src/createSingleton.js +0 -9
  245. package/src/index.js +0 -44
  246. package/src/interpreter/index.js +0 -48
  247. package/src/interpreter/parse.js +0 -1473
  248. package/src/interpreter/system.js +0 -5
  249. package/src/interpreter/util.js +0 -237
  250. package/src/library/apply.js +0 -135
  251. package/src/library/definition.js +0 -3
  252. package/src/library/errors/adaptErrors.js +0 -28
  253. package/src/library/errors/enclosure.js +0 -11
  254. package/src/library/errors/error.js +0 -14
  255. package/src/library/errors/execution.js +0 -15
  256. package/src/library/errors/fatal.js +0 -10
  257. package/src/library/errors/runtime.js +0 -71
  258. package/src/library/errors/syntax.js +0 -12
  259. package/src/library/index.js +0 -41
  260. package/src/library/mux.js +0 -98
  261. package/src/library/runtimeScope.js +0 -35
  262. package/src/library/runtimeSignal.js +0 -67
  263. package/src/library/types.js +0 -299
  264. package/src/program/index.js +0 -114
  265. package/src/program/ops/index.js +0 -82
  266. package/src/program/ops/opAccess/index.js +0 -55
  267. package/src/program/ops/opAccess/opaField.js +0 -58
  268. package/src/program/ops/opAccess/opaFunction.js +0 -52
  269. package/src/program/ops/opAccess/opaIter.js +0 -34
  270. package/src/program/ops/opAccess/opaSlice.js +0 -61
  271. package/src/program/ops/opAnd.js +0 -32
  272. package/src/program/ops/opArrayConstructor.js +0 -16
  273. package/src/program/ops/opAssignment/index.js +0 -102
  274. package/src/program/ops/opAssignment/opaAssignField.js +0 -156
  275. package/src/program/ops/opAssignment/opaAssignIter.js +0 -77
  276. package/src/program/ops/opAssignment/opaAssignSlice.js +0 -160
  277. package/src/program/ops/opAssignment/opuAddition.js +0 -29
  278. package/src/program/ops/opAssignment/opuDivision.js +0 -29
  279. package/src/program/ops/opAssignment/opuMultiplication.js +0 -29
  280. package/src/program/ops/opAssignment/opuNullCoalescence.js +0 -26
  281. package/src/program/ops/opAssignment/opuRemainder.js +0 -29
  282. package/src/program/ops/opAssignment/opuSet.js +0 -15
  283. package/src/program/ops/opAssignment/opuSubtraction.js +0 -29
  284. package/src/program/ops/opAssignment/opuUpdate.js +0 -15
  285. package/src/program/ops/opCalculation/index.js +0 -64
  286. package/src/program/ops/opCalculation/opmAddition.js +0 -63
  287. package/src/program/ops/opCalculation/opmDivision.js +0 -47
  288. package/src/program/ops/opCalculation/opmMultiplication.js +0 -52
  289. package/src/program/ops/opCalculation/opmRemainder.js +0 -49
  290. package/src/program/ops/opCalculation/opmSubtraction.js +0 -72
  291. package/src/program/ops/opComparison/index.js +0 -67
  292. package/src/program/ops/opComparison/opcEqual.js +0 -17
  293. package/src/program/ops/opComparison/opcGreater.js +0 -17
  294. package/src/program/ops/opComparison/opcGreaterEqual.js +0 -17
  295. package/src/program/ops/opComparison/opcLess.js +0 -17
  296. package/src/program/ops/opComparison/opcLessEqual.js +0 -17
  297. package/src/program/ops/opComparison/opcUnequal.js +0 -17
  298. package/src/program/ops/opConstant.js +0 -13
  299. package/src/program/ops/opConstantFalse.js +0 -11
  300. package/src/program/ops/opConstantNull.js +0 -11
  301. package/src/program/ops/opConstantTrue.js +0 -11
  302. package/src/program/ops/opFunctionDefinition.js +0 -17
  303. package/src/program/ops/opIf.js +0 -44
  304. package/src/program/ops/opInterpolatedString.js +0 -27
  305. package/src/program/ops/opNegation.js +0 -26
  306. package/src/program/ops/opNot.js +0 -11
  307. package/src/program/ops/opNullCoalescence.js +0 -36
  308. package/src/program/ops/opNumber.js +0 -13
  309. package/src/program/ops/opObjectConstructor.js +0 -40
  310. package/src/program/ops/opOr.js +0 -32
  311. package/src/program/ops/opOutputConcat.js +0 -17
  312. package/src/program/ops/opString.js +0 -13
  313. package/src/program/ops/opTry.js +0 -38
  314. package/src/program/ops/opVariable.js +0 -17
  315. package/src/program/ops/opVariableDefinition.js +0 -18
  316. package/src/program/ops/opVoid.js +0 -11
  317. package/src/program/ops/utils.js +0 -19
  318. package/src/runtime/index.js +0 -309
  319. /package/{src/builtins/native.js → dist/types/builtins/native.d.ts} +0 -0
  320. /package/{src/library/ops/index.js → dist/types/library/ops/index.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ /** Apply the specified defaults to the config */
2
+ export default function applyDefaults<T>(config: T, defaults: T, ...strictPaths: (string | string[])[]): T;
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown, arg0: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown, arg0: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(_runtime: JPLRuntime, _signal: JPLRuntimeSignal, _next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): never;
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown, arg0: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown, arg0: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): unknown[] | Promise<unknown[]>;
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(_runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], _input: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown, arg0: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]>;
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]>;
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]>;
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]>;
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]>;
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(runtime: JPLRuntime, _signal: JPLRuntimeSignal, next: (output: unknown) => Promise<unknown[]> | unknown[], input: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,3 @@
1
+ import { default as JPLRuntimeSignal } from '../library/runtimeSignal';
2
+ import { default as JPLRuntime } from '../runtime';
3
+ export default function builtin(_runtime: JPLRuntime, _signal: JPLRuntimeSignal, _next: (output: unknown) => Promise<unknown[]> | unknown[], _input: unknown): Promise<unknown[]> | unknown[];
@@ -0,0 +1,2 @@
1
+ declare const getBuiltins: () => Promise<Record<string, unknown>>;
2
+ export default getBuiltins;
@@ -0,0 +1 @@
1
+ export declare const sortEntries: import('../library').JPLFunc;
@@ -0,0 +1,17 @@
1
+ import { JPLFunc } from '../library';
2
+ export declare const pow: JPLFunc;
3
+ export declare const sqrt: JPLFunc;
4
+ export declare const exp: JPLFunc;
5
+ export declare const log: JPLFunc;
6
+ export declare const log10: JPLFunc;
7
+ export declare const sin: JPLFunc;
8
+ export declare const cos: JPLFunc;
9
+ export declare const tan: JPLFunc;
10
+ export declare const asin: JPLFunc;
11
+ export declare const acos: JPLFunc;
12
+ export declare const atan: JPLFunc;
13
+ export declare const ceil: JPLFunc;
14
+ export declare const floor: JPLFunc;
15
+ export declare const round: JPLFunc;
16
+ export declare const trunc: JPLFunc;
17
+ export declare const abs: JPLFunc;
@@ -0,0 +1 @@
1
+ export default function createSingleton<T>(generatorFn: () => T): () => T;
@@ -0,0 +1,21 @@
1
+ import { Pipe } from '../library/definition';
2
+ import { default as JPLProgram, JPLProgramOptions } from '../program';
3
+ import { JPLRuntimeOptions } from '../runtime';
4
+ export type JPLInterpreterConfig = {
5
+ interpreter?: JPLInterpreterOptions;
6
+ program?: JPLProgramOptions;
7
+ runtime?: JPLRuntimeOptions;
8
+ };
9
+ export type JPLInterpreterOptions = Record<string, never>;
10
+ export declare function applyInterpreterDefaults(options?: JPLInterpreterOptions, defaults?: JPLInterpreterOptions): JPLInterpreterOptions;
11
+ /** JPL interpreter */
12
+ export default class JPLInterpreter {
13
+ #private;
14
+ constructor(options?: JPLInterpreterConfig);
15
+ /** Return the interpreter's options */
16
+ get options(): JPLInterpreterOptions;
17
+ /** Parse the specified source program string into a reusable JPLProgram instance */
18
+ parse: (source: string, options?: JPLInterpreterConfig) => Promise<JPLProgram>;
19
+ /** Parse the specified source program string */
20
+ parseInstructions: (source: string) => Promise<Pipe>;
21
+ }
@@ -0,0 +1,194 @@
1
+ import { JPLAssignment, JPLSelector, Pipe } from '../library/definition';
2
+ import { default as JPLInterpreter } from '.';
3
+ export type ParserContext = {
4
+ interpreter: JPLInterpreter;
5
+ };
6
+ /**
7
+ * Parse a single program at i.
8
+ * Throws an error if src contains additional content.
9
+ */
10
+ export declare function parseEntrypoint(src: string, i: number, c: ParserContext): Promise<{
11
+ i: number;
12
+ ops: Pipe;
13
+ }>;
14
+ /** Parse program at i */
15
+ export declare function parseProgram(src: string, i: number, c: ParserContext): Promise<{
16
+ i: number;
17
+ ops: Pipe;
18
+ }>;
19
+ /** Parse function header at i */
20
+ export declare function parseFunctionHeader(src: string, i: number, c: ParserContext): {
21
+ i: number;
22
+ argNames: string[];
23
+ };
24
+ type AccessOptions = {
25
+ identity?: boolean;
26
+ };
27
+ /** Parse access at i */
28
+ export declare function parseAccess(src: string, i: number, c: ParserContext, { identity }?: AccessOptions): Promise<{
29
+ i: number;
30
+ is: boolean;
31
+ selectors: JPLSelector[];
32
+ canAssign: boolean;
33
+ }>;
34
+ /** Parse assignment at i */
35
+ export declare function parseAssignment(src: string, i: number, c: ParserContext): Promise<{
36
+ i: number;
37
+ is: false;
38
+ } | {
39
+ i: number;
40
+ is: true;
41
+ assignment: JPLAssignment;
42
+ }>;
43
+ /** Parse number at i */
44
+ export declare function parseNumber(src: string, i: number, c: ParserContext): {
45
+ i: number;
46
+ is: false;
47
+ } | {
48
+ i: number;
49
+ is: true;
50
+ ops: Pipe;
51
+ };
52
+ /** Parse string at i */
53
+ export declare function parseString(src: string, i: number, c: ParserContext): Promise<{
54
+ i: number;
55
+ is: false;
56
+ } | {
57
+ i: number;
58
+ is: true;
59
+ ops: Pipe;
60
+ }>;
61
+ /** Parse pipe at i */
62
+ export declare function opPipe(src: string, i: number, c: ParserContext): Promise<{
63
+ i: number;
64
+ ops: Pipe;
65
+ }>;
66
+ /** Parse subpipe at i */
67
+ export declare function opSubPipe(src: string, i: number, c: ParserContext): Promise<{
68
+ i: number;
69
+ ops: Pipe;
70
+ }>;
71
+ /** Parse subroute at i */
72
+ export declare function opSubRoute(src: string, i: number, c: ParserContext): Promise<{
73
+ i: number;
74
+ ops: Pipe;
75
+ }>;
76
+ /** Parse output concat at i */
77
+ export declare function opOutputConcat(src: string, i: number, c: ParserContext): Promise<{
78
+ i: number;
79
+ ops: Pipe;
80
+ }>;
81
+ /** Parse try at i */
82
+ export declare function opTry(src: string, i: number, c: ParserContext): Promise<{
83
+ i: number;
84
+ ops: Pipe;
85
+ }>;
86
+ /** Parse or at i */
87
+ export declare function opOr(src: string, i: number, c: ParserContext): Promise<{
88
+ i: number;
89
+ ops: Pipe;
90
+ }>;
91
+ /** Parse and at i */
92
+ export declare function opAnd(src: string, i: number, c: ParserContext): Promise<{
93
+ i: number;
94
+ ops: Pipe;
95
+ }>;
96
+ /** Parse equality at i */
97
+ export declare function opEquality(src: string, i: number, c: ParserContext): Promise<{
98
+ i: number;
99
+ ops: Pipe;
100
+ }>;
101
+ /** Parse comparison at i */
102
+ export declare function opComparison(src: string, i: number, c: ParserContext): Promise<{
103
+ i: number;
104
+ ops: Pipe;
105
+ }>;
106
+ /** Parse not at i */
107
+ export declare function opNot(src: string, i: number, c: ParserContext): Promise<{
108
+ i: number;
109
+ ops: Pipe;
110
+ }>;
111
+ /** Parse error suppression at i */
112
+ export declare function opErrorSuppression(src: string, i: number, c: ParserContext): Promise<{
113
+ i: number;
114
+ ops: Pipe;
115
+ }>;
116
+ /** Parse difference at i */
117
+ export declare function opDifference(src: string, i: number, c: ParserContext): Promise<{
118
+ i: number;
119
+ ops: Pipe;
120
+ }>;
121
+ /** Parse multiplication at i */
122
+ export declare function opMultiplication(src: string, i: number, c: ParserContext): Promise<{
123
+ i: number;
124
+ ops: Pipe;
125
+ }>;
126
+ /** Parse null coalescence at i */
127
+ export declare function opNullCoalescence(src: string, i: number, c: ParserContext): Promise<{
128
+ i: number;
129
+ ops: Pipe;
130
+ }>;
131
+ /** Parse negation at i */
132
+ export declare function opNegation(src: string, i: number, c: ParserContext): Promise<{
133
+ i: number;
134
+ ops: Pipe;
135
+ }>;
136
+ /** Parse if at i */
137
+ export declare function opIf(src: string, i: number, c: ParserContext): Promise<{
138
+ i: number;
139
+ ops: Pipe;
140
+ }>;
141
+ /** Parse constant at i */
142
+ export declare function opConstant(src: string, i: number, c: ParserContext): Promise<{
143
+ i: number;
144
+ ops: Pipe;
145
+ }> | {
146
+ i: number;
147
+ ops: Pipe;
148
+ };
149
+ /** Parse number at i */
150
+ export declare function opNumber(src: string, i: number, c: ParserContext): Promise<{
151
+ i: number;
152
+ ops: Pipe;
153
+ }>;
154
+ /** Parse named function definition at i */
155
+ export declare function opNamedFunctionDefinition(src: string, i: number, c: ParserContext): Promise<{
156
+ i: number;
157
+ ops: Pipe;
158
+ }>;
159
+ /** Parse function definition at i */
160
+ export declare function opFunctionDefinition(src: string, i: number, c: ParserContext): Promise<{
161
+ i: number;
162
+ ops: Pipe;
163
+ }>;
164
+ /** Parse variable definition at i */
165
+ export declare function opVariableAccess(src: string, i: number, c: ParserContext): Promise<{
166
+ i: number;
167
+ ops: Pipe;
168
+ }>;
169
+ /** Parse variable access at i */
170
+ export declare function opValueAccess(src: string, i: number, c: ParserContext): Promise<{
171
+ i: number;
172
+ ops: Pipe;
173
+ }>;
174
+ /** Parse object constructor at i */
175
+ export declare function opObjectConstructor(src: string, i: number, c: ParserContext): Promise<{
176
+ i: number;
177
+ ops: Pipe;
178
+ }>;
179
+ /** Parse array constructor at i */
180
+ export declare function opArrayConstructor(src: string, i: number, c: ParserContext): Promise<{
181
+ i: number;
182
+ ops: Pipe;
183
+ }>;
184
+ /** Parse string literal at i */
185
+ export declare function opStringLiteral(src: string, i: number, c: ParserContext): Promise<{
186
+ i: number;
187
+ ops: Pipe;
188
+ }>;
189
+ /** Parse group at i */
190
+ export declare function opGroup(src: string, i: number, c: ParserContext): Promise<{
191
+ i: number;
192
+ ops: Pipe;
193
+ }>;
194
+ export {};
@@ -1,6 +1,4 @@
1
- import { orphanFunction } from '../library';
2
- import systemInterpreter from './system';
3
-
1
+ import { JPLFunc, JPLRuntimeScopeConfig } from '../library';
4
2
  /**
5
3
  * Create an orphan JPL function from the specified source program string.
6
4
  *
@@ -11,10 +9,4 @@ import systemInterpreter from './system';
11
9
  * @param {string} source Source program string to execute
12
10
  * @param {{ vars: object? }} [presets] Optional scope presets
13
11
  */
14
- async function parseFunction(argNames, source, presets) {
15
- const instructions = await systemInterpreter.parseInstructions(source);
16
-
17
- return orphanFunction(argNames, instructions, presets);
18
- }
19
-
20
- export default parseFunction;
12
+ export default function parseFunction(argNames: string[], source: string, presets?: JPLRuntimeScopeConfig): Promise<JPLFunc>;
@@ -0,0 +1,3 @@
1
+ import { default as JPLInterpreter } from '.';
2
+ declare const systemInterpreter: JPLInterpreter;
3
+ export default systemInterpreter;
@@ -0,0 +1,89 @@
1
+ import { ParserContext } from './parse';
2
+ /** Walk whitespace at i */
3
+ export declare function walkWhitespace(src: string, i: number, c: ParserContext): {
4
+ i: number;
5
+ is: boolean;
6
+ };
7
+ type MatchOptions = {
8
+ phrase: string;
9
+ notBeforeSet?: string;
10
+ spaceBefore?: boolean;
11
+ spaceAfter?: boolean;
12
+ };
13
+ /**
14
+ * Check if src matches phrase at i.
15
+ * If notBeforeSet is provided, the phrase is only considered to be matching if it is not immediately followed by one of the symbols of the set.
16
+ * If spaceBefore is true, the phrase is only considered to be matching if there is space (not to be confused with whitespace) before i (or i is 0).
17
+ * If spaceAfter is true, the phrase is only considered to be matching if there is space (not to be confused with whitespace) after the phrase (or the end is reached).
18
+ * The returned index is positioned directly after the phrase or at the first unmatched character, even if spaceAfter is true.
19
+ * Space is defined as anything that cannot occur in a variable name.
20
+ */
21
+ export declare function match(src: string, i: number, c: ParserContext, { phrase, notBeforeSet, spaceBefore, spaceAfter }: MatchOptions): {
22
+ i: number;
23
+ is: boolean;
24
+ };
25
+ /** The same as match, but also walk whitespace after the match if present */
26
+ export declare function matchWord(src: string, i: number, c: ParserContext, { phrase, notBeforeSet, spaceBefore, spaceAfter }: MatchOptions): {
27
+ i: number;
28
+ is: boolean;
29
+ };
30
+ /** Check if i is a hexadecimal value */
31
+ export declare function hex(src: string, i: number, c: ParserContext): {
32
+ i: number;
33
+ is: boolean;
34
+ value: string;
35
+ };
36
+ type MatchSetOptions = {
37
+ set: string;
38
+ exclusive?: boolean;
39
+ };
40
+ /**
41
+ * Check if i is one of the chars in set.
42
+ * If exclusive is true, i must not be one of the chars in set for the check to succeed.
43
+ */
44
+ export declare function matchSet(src: string, i: number, c: ParserContext, { set, exclusive }: MatchSetOptions): {
45
+ i: number;
46
+ is: boolean;
47
+ value: string;
48
+ };
49
+ /** Parse variable selector at i */
50
+ export declare function variable(src: string, i: number, c: ParserContext): {
51
+ i: number;
52
+ is: boolean;
53
+ value: string;
54
+ };
55
+ /** The same as variable, but also check that the result is not a reserved term */
56
+ export declare function safeVariable(src: string, i: number, c: ParserContext): {
57
+ i: number;
58
+ is: boolean;
59
+ value: string;
60
+ reserved?: boolean;
61
+ };
62
+ /** Check if i is at the end of src */
63
+ export declare function eot(src: string, i: number, _c: ParserContext): {
64
+ i: number;
65
+ is: boolean;
66
+ };
67
+ /** Get (zero based) line and column for i */
68
+ export declare function whereIs(src: string, i: number, _c: ParserContext): {
69
+ i: number;
70
+ line: number;
71
+ column: number;
72
+ };
73
+ type HighlightOptions = {
74
+ area?: number;
75
+ };
76
+ /** Get a descriptive text highlighting i */
77
+ export declare function highlightLocation(src: string, i: number, _c: ParserContext, { area }?: HighlightOptions): {
78
+ i: number;
79
+ value: string;
80
+ };
81
+ type ErrorOptions = {
82
+ operator?: string;
83
+ message?: string;
84
+ };
85
+ /** Throw an error caused by an unexpected token at i */
86
+ export declare function errorUnexpectedToken(src: string, i: number, c: ParserContext, { operator, message }?: ErrorOptions): never;
87
+ /** Throw an error caused by a generic parser error at i */
88
+ export declare function errorGeneric(src: string, i: number, c: ParserContext, { operator, message }?: ErrorOptions): never;
89
+ export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Apply all changes immutably to the source object.
3
+ *
4
+ * @param {[key: string, value: any][]} changes The changes to be applied
5
+ */
6
+ export declare function applyObject(source: unknown, changes: [key: string, value?: unknown][]): unknown;
7
+ /**
8
+ * Apply all changes immutably to the source array.
9
+ * Indices can be negative to be applied from the end of the array.
10
+ *
11
+ * @param {[index: number, value: any][]} changes The changes to be applied
12
+ * @param filler Value to be used as padding
13
+ */
14
+ export declare function applyArray(source: unknown[], changes: [index: number, value: unknown][], filler?: unknown): unknown[];
15
+ /**
16
+ * Create all possible combinations immutably based on the specified source array.
17
+ * If the specified `combinations` array is empty, the resulting array contains a single empty array.
18
+ * This function has essentially the same base functionality as the `mux` function, but uses a more performant approach for generating immutable arrays as it reduces the number of necessary array copies.
19
+ *
20
+ * `applyCombinations([], [[1, 2], [3, 4]])` for example produces:
21
+ * - `[1, 3]`
22
+ * - `[1, 4]`
23
+ * - `[2, 3]`
24
+ * - `[2, 4]`
25
+ *
26
+ * If the values of `source` are equal to the values of one of the combinations, it is used instead of a copy in the output array, e.g.:
27
+ * `let i = [1, 2]; applyCombinations(i, [[1], [2]])[0] == i`
28
+ * - `true`
29
+ *
30
+ * @param {any[][]} combinations The combinations
31
+ */
32
+ export declare function applyCombinations<T>(source: T[], combinations: T[][]): T[][];
@@ -0,0 +1,79 @@
1
+ import { OPU_MULTIPLICATION, OPU_NULL_COALESCENCE, OPU_REMAINDER, OPU_SET, OPU_SUBTRACTION, OPU_UPDATE, OP_ACCESS, OP_AND, OP_ARRAY_CONSTRUCTOR, OP_ASSIGNMENT, OP_CALCULATION, OP_COMPARISON, OP_CONSTANT, OP_CONSTANT_FALSE, OP_CONSTANT_NULL, OP_CONSTANT_TRUE, OP_FUNCTION_DEFINITION, OP_IF, OP_INTERPOLATED_STRING, OP_NEGATION, OP_NOT, OP_NULL_COALESCENCE, OP_NUMBER, OP_OBJECT_CONSTRUCTOR, OP_OR, OP_OUTPUT_CONCAT, OP_STRING, OP_TRY, OP_VARIABLE, OP_VARIABLE_DEFINITION, OP_VOID, OPA_FIELD, OPA_FUNCTION, OPA_ITER, OPA_SLICE, OPC_EQUAL, OPC_GREATER, OPC_GREATEREQUAL, OPC_LESS, OPC_LESSEQUAL, OPC_UNEQUAL, OPM_ADDITION, OPM_DIVISION, OPM_MULTIPLICATION, OPM_REMAINDER, OPM_SUBTRACTION, OPU_ADDITION, OPU_DIVISION } from './ops';
2
+ export declare const DEFINITION_VERSION_MAJOR = 1;
3
+ export declare const DEFINITION_VERSION_MINOR = 0;
4
+ export declare const DEFINITION_VERSION = "1.0";
5
+ export type JPLDefinition = {
6
+ version: string;
7
+ instructions: Pipe;
8
+ };
9
+ export type Pipe = JPLInstruction[];
10
+ export type JPLInstruction = {
11
+ op: typeof OP_ACCESS | typeof OP_AND | typeof OP_ARRAY_CONSTRUCTOR | typeof OP_ASSIGNMENT | typeof OP_CALCULATION | typeof OP_COMPARISON | typeof OP_CONSTANT | typeof OP_CONSTANT_FALSE | typeof OP_CONSTANT_NULL | typeof OP_CONSTANT_TRUE | typeof OP_FUNCTION_DEFINITION | typeof OP_IF | typeof OP_INTERPOLATED_STRING | typeof OP_NEGATION | typeof OP_NOT | typeof OP_NULL_COALESCENCE | typeof OP_NUMBER | typeof OP_OBJECT_CONSTRUCTOR | typeof OP_OR | typeof OP_OUTPUT_CONCAT | typeof OP_STRING | typeof OP_TRY | typeof OP_VARIABLE | typeof OP_VARIABLE_DEFINITION | typeof OP_VOID;
12
+ params: JPLInstructionParams;
13
+ };
14
+ export type JPLInstructionParams = {
15
+ after?: string;
16
+ argNames?: string[];
17
+ assignment?: JPLAssignment;
18
+ catch?: Pipe;
19
+ comparisons?: JPLComparison[];
20
+ else?: Pipe;
21
+ fields?: JPLField[];
22
+ ifs?: JPLIfThen[];
23
+ interpolations?: JPLInterpolation[];
24
+ name?: string;
25
+ number?: number;
26
+ operations?: JPLOperation[];
27
+ pipe?: Pipe;
28
+ pipes?: Pipe[];
29
+ selectors?: JPLSelector[];
30
+ string?: string;
31
+ try?: Pipe;
32
+ value?: unknown;
33
+ };
34
+ export type JPLComparison = {
35
+ op: typeof OPC_EQUAL | typeof OPC_GREATER | typeof OPC_GREATEREQUAL | typeof OPC_LESS | typeof OPC_LESSEQUAL | typeof OPC_UNEQUAL;
36
+ params: JPLComparisonParams;
37
+ };
38
+ export type JPLComparisonParams = {
39
+ by: Pipe;
40
+ };
41
+ export type JPLSelector = {
42
+ op: typeof OPA_FIELD | typeof OPA_FUNCTION | typeof OPA_ITER | typeof OPA_SLICE;
43
+ params: JPLSelectorParams;
44
+ };
45
+ export type JPLSelectorParams = {
46
+ args?: Pipe[];
47
+ bound?: boolean;
48
+ from?: Pipe;
49
+ optional?: boolean;
50
+ pipe?: Pipe;
51
+ to?: Pipe;
52
+ };
53
+ export type JPLOperation = {
54
+ op: typeof OPM_ADDITION | typeof OPM_DIVISION | typeof OPM_MULTIPLICATION | typeof OPM_REMAINDER | typeof OPM_SUBTRACTION;
55
+ params: JPLOperationParams;
56
+ };
57
+ export type JPLOperationParams = {
58
+ by: Pipe;
59
+ };
60
+ export type JPLIfThen = {
61
+ if: Pipe;
62
+ then: Pipe;
63
+ };
64
+ export type JPLAssignment = {
65
+ op: typeof OPU_ADDITION | typeof OPU_DIVISION | typeof OPU_MULTIPLICATION | typeof OPU_NULL_COALESCENCE | typeof OPU_REMAINDER | typeof OPU_SET | typeof OPU_SUBTRACTION | typeof OPU_UPDATE;
66
+ params: JPLAssignmentParams;
67
+ };
68
+ export type JPLAssignmentParams = {
69
+ pipe: Pipe;
70
+ };
71
+ export type JPLField = {
72
+ key: Pipe;
73
+ value: Pipe;
74
+ optional: boolean;
75
+ };
76
+ export type JPLInterpolation = {
77
+ before: string;
78
+ pipe: Pipe;
79
+ };
@@ -0,0 +1,6 @@
1
+ /** Wrap occuring errors in a JPLExecutionError if they are not already a JPLError */
2
+ export default function adaptErrors<T>(cb: () => T): T;
3
+ /** Wrap occuring errors in a JPLExecutionError if they are not already a JPLError */
4
+ export declare function adaptErrorsAsync<T>(cb: () => Promise<T>): Promise<T>;
5
+ /** Wrap error in a JPLExecutionError if it is not already a JPLError */
6
+ export declare function adaptError(error: unknown): unknown;
@@ -0,0 +1,6 @@
1
+ import { default as JPLError } from './error';
2
+ /** JPL error type for wrapping errors that should be handled elsewhere */
3
+ export default class JPLErrorEnclosure extends JPLError {
4
+ readonly inner: unknown;
5
+ constructor(inner: unknown);
6
+ }
@@ -0,0 +1,6 @@
1
+ /** Generic JPL error type */
2
+ export default class JPLError extends Error {
3
+ /** Detect whether the provided value is an instance of this error or one of its subclasses */
4
+ static is(value: unknown): boolean;
5
+ constructor(message?: string, name?: string);
6
+ }
@@ -0,0 +1,12 @@
1
+ import { default as JPLError } from './error';
2
+ /**
3
+ * JPL error type for execution errors.
4
+ *
5
+ * All error types that infer this type can be caught in a program.
6
+ */
7
+ export default class JPLExecutionError extends JPLError {
8
+ #private;
9
+ constructor(message?: string, name?: string);
10
+ protected set value(value: unknown);
11
+ get value(): unknown;
12
+ }
@@ -0,0 +1,4 @@
1
+ import { default as JPLError } from './error';
2
+ export default class JPLFatalError extends JPLError {
3
+ constructor(error: string);
4
+ }