@bilig/formula 0.1.82 → 0.1.84

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 (167) hide show
  1. package/dist/addressing.d.ts +6 -6
  2. package/dist/addressing.js +16 -16
  3. package/dist/addressing.js.map +1 -1
  4. package/dist/ast.d.ts +18 -18
  5. package/dist/binder-wasm-rules.d.ts +2 -2
  6. package/dist/binder-wasm-rules.js +677 -724
  7. package/dist/binder-wasm-rules.js.map +1 -1
  8. package/dist/binder.d.ts +2 -2
  9. package/dist/binder.js +133 -137
  10. package/dist/binder.js.map +1 -1
  11. package/dist/builtin-capabilities.d.ts +4 -4
  12. package/dist/builtin-capabilities.js +777 -816
  13. package/dist/builtin-capabilities.js.map +1 -1
  14. package/dist/builtins/complex.d.ts +3 -3
  15. package/dist/builtins/complex.js +20 -48
  16. package/dist/builtins/complex.js.map +1 -1
  17. package/dist/builtins/convert.d.ts +1 -1
  18. package/dist/builtins/convert.js +180 -181
  19. package/dist/builtins/convert.js.map +1 -1
  20. package/dist/builtins/datetime.d.ts +1 -1
  21. package/dist/builtins/datetime.js +60 -72
  22. package/dist/builtins/datetime.js.map +1 -1
  23. package/dist/builtins/distribution-builtins.d.ts +2 -2
  24. package/dist/builtins/distribution-builtins.js +62 -112
  25. package/dist/builtins/distribution-builtins.js.map +1 -1
  26. package/dist/builtins/distributions.js +17 -54
  27. package/dist/builtins/distributions.js.map +1 -1
  28. package/dist/builtins/financial-builtins.d.ts +2 -2
  29. package/dist/builtins/financial-builtins.js +9 -42
  30. package/dist/builtins/financial-builtins.js.map +1 -1
  31. package/dist/builtins/financial.js +4 -18
  32. package/dist/builtins/financial.js.map +1 -1
  33. package/dist/builtins/fixed-income-builtins.d.ts +2 -2
  34. package/dist/builtins/fixed-income-builtins.js +18 -60
  35. package/dist/builtins/fixed-income-builtins.js.map +1 -1
  36. package/dist/builtins/fixed-income.js +25 -96
  37. package/dist/builtins/fixed-income.js.map +1 -1
  38. package/dist/builtins/formatting.js +9 -9
  39. package/dist/builtins/formatting.js.map +1 -1
  40. package/dist/builtins/logical.d.ts +1 -1
  41. package/dist/builtins/logical.js +5 -5
  42. package/dist/builtins/logical.js.map +1 -1
  43. package/dist/builtins/lookup-array-shape-builtins.d.ts +3 -3
  44. package/dist/builtins/lookup-array-shape-builtins.js +8 -15
  45. package/dist/builtins/lookup-array-shape-builtins.js.map +1 -1
  46. package/dist/builtins/lookup-criteria-builtins.d.ts +2 -2
  47. package/dist/builtins/lookup-criteria-builtins.js +1 -1
  48. package/dist/builtins/lookup-criteria-builtins.js.map +1 -1
  49. package/dist/builtins/lookup-database-builtins.d.ts +2 -2
  50. package/dist/builtins/lookup-database-builtins.js +20 -24
  51. package/dist/builtins/lookup-database-builtins.js.map +1 -1
  52. package/dist/builtins/lookup-financial-builtins.d.ts +3 -3
  53. package/dist/builtins/lookup-financial-builtins.js +14 -30
  54. package/dist/builtins/lookup-financial-builtins.js.map +1 -1
  55. package/dist/builtins/lookup-hypothesis-builtins.d.ts +2 -2
  56. package/dist/builtins/lookup-hypothesis-builtins.js +23 -58
  57. package/dist/builtins/lookup-hypothesis-builtins.js.map +1 -1
  58. package/dist/builtins/lookup-matrix-builtins.d.ts +3 -3
  59. package/dist/builtins/lookup-matrix-builtins.js +5 -3
  60. package/dist/builtins/lookup-matrix-builtins.js.map +1 -1
  61. package/dist/builtins/lookup-order-statistics-builtins.d.ts +3 -3
  62. package/dist/builtins/lookup-order-statistics-builtins.js +18 -30
  63. package/dist/builtins/lookup-order-statistics-builtins.js.map +1 -1
  64. package/dist/builtins/lookup-reference-builtins.d.ts +2 -2
  65. package/dist/builtins/lookup-reference-builtins.js +10 -26
  66. package/dist/builtins/lookup-reference-builtins.js.map +1 -1
  67. package/dist/builtins/lookup-regression-builtins.d.ts +2 -2
  68. package/dist/builtins/lookup-regression-builtins.js +52 -69
  69. package/dist/builtins/lookup-regression-builtins.js.map +1 -1
  70. package/dist/builtins/lookup-sort-filter-builtins.d.ts +3 -3
  71. package/dist/builtins/lookup-sort-filter-builtins.js +5 -13
  72. package/dist/builtins/lookup-sort-filter-builtins.js.map +1 -1
  73. package/dist/builtins/lookup.d.ts +5 -5
  74. package/dist/builtins/lookup.js +61 -73
  75. package/dist/builtins/lookup.js.map +1 -1
  76. package/dist/builtins/math-builtins.d.ts +2 -2
  77. package/dist/builtins/math-builtins.js +11 -17
  78. package/dist/builtins/math-builtins.js.map +1 -1
  79. package/dist/builtins/numeric.d.ts +2 -2
  80. package/dist/builtins/numeric.js +2 -2
  81. package/dist/builtins/numeric.js.map +1 -1
  82. package/dist/builtins/placeholder.d.ts +1 -1
  83. package/dist/builtins/placeholder.js +505 -505
  84. package/dist/builtins/placeholder.js.map +1 -1
  85. package/dist/builtins/radix.d.ts +2 -2
  86. package/dist/builtins/radix.js +33 -39
  87. package/dist/builtins/radix.js.map +1 -1
  88. package/dist/builtins/statistical-builtins.d.ts +2 -2
  89. package/dist/builtins/statistical-builtins.js +29 -56
  90. package/dist/builtins/statistical-builtins.js.map +1 -1
  91. package/dist/builtins/statistics.d.ts +1 -1
  92. package/dist/builtins/statistics.js +3 -7
  93. package/dist/builtins/statistics.js.map +1 -1
  94. package/dist/builtins/text-core-builtins.d.ts +2 -2
  95. package/dist/builtins/text-core-builtins.js +110 -110
  96. package/dist/builtins/text-core-builtins.js.map +1 -1
  97. package/dist/builtins/text-format-builtins.d.ts +2 -2
  98. package/dist/builtins/text-format-builtins.js +109 -141
  99. package/dist/builtins/text-format-builtins.js.map +1 -1
  100. package/dist/builtins/text-search-builtins.d.ts +2 -2
  101. package/dist/builtins/text-search-builtins.js +37 -44
  102. package/dist/builtins/text-search-builtins.js.map +1 -1
  103. package/dist/builtins/text.d.ts +2 -2
  104. package/dist/builtins/text.js +19 -29
  105. package/dist/builtins/text.js.map +1 -1
  106. package/dist/builtins.d.ts +3 -3
  107. package/dist/builtins.js +55 -75
  108. package/dist/builtins.js.map +1 -1
  109. package/dist/compatibility.js +425 -430
  110. package/dist/compatibility.js.map +1 -1
  111. package/dist/compiler.d.ts +7 -7
  112. package/dist/compiler.js +212 -228
  113. package/dist/compiler.js.map +1 -1
  114. package/dist/external-function-adapter.d.ts +6 -6
  115. package/dist/external-function-adapter.js +3 -3
  116. package/dist/external-function-adapter.js.map +1 -1
  117. package/dist/formula-template-key.js +25 -26
  118. package/dist/formula-template-key.js.map +1 -1
  119. package/dist/generated/formula-inventory.js +3567 -3567
  120. package/dist/generated/formula-inventory.js.map +1 -1
  121. package/dist/group-pivot-evaluator.d.ts +2 -2
  122. package/dist/group-pivot-evaluator.js +27 -32
  123. package/dist/group-pivot-evaluator.js.map +1 -1
  124. package/dist/index.d.ts +20 -20
  125. package/dist/index.js +20 -20
  126. package/dist/index.js.map +1 -1
  127. package/dist/js-evaluator-array-special-calls.d.ts +3 -3
  128. package/dist/js-evaluator-array-special-calls.js +25 -34
  129. package/dist/js-evaluator-array-special-calls.js.map +1 -1
  130. package/dist/js-evaluator-context-special-calls.d.ts +2 -2
  131. package/dist/js-evaluator-context-special-calls.js +23 -27
  132. package/dist/js-evaluator-context-special-calls.js.map +1 -1
  133. package/dist/js-evaluator-reference-context.d.ts +2 -2
  134. package/dist/js-evaluator-reference-context.js +22 -24
  135. package/dist/js-evaluator-reference-context.js.map +1 -1
  136. package/dist/js-evaluator-workbook-special-calls.d.ts +2 -2
  137. package/dist/js-evaluator-workbook-special-calls.js +18 -24
  138. package/dist/js-evaluator-workbook-special-calls.js.map +1 -1
  139. package/dist/js-evaluator.d.ts +40 -40
  140. package/dist/js-evaluator.js +135 -147
  141. package/dist/js-evaluator.js.map +1 -1
  142. package/dist/js-plan-lowering.d.ts +2 -2
  143. package/dist/js-plan-lowering.js +103 -108
  144. package/dist/js-plan-lowering.js.map +1 -1
  145. package/dist/lexer.d.ts +1 -1
  146. package/dist/lexer.js +34 -43
  147. package/dist/lexer.js.map +1 -1
  148. package/dist/optimizer.d.ts +1 -1
  149. package/dist/optimizer.js +99 -108
  150. package/dist/optimizer.js.map +1 -1
  151. package/dist/parser.d.ts +1 -1
  152. package/dist/parser.js +129 -136
  153. package/dist/parser.js.map +1 -1
  154. package/dist/program-arena.js.map +1 -1
  155. package/dist/runtime-inventory.d.ts +2 -2
  156. package/dist/runtime-inventory.js +14 -20
  157. package/dist/runtime-inventory.js.map +1 -1
  158. package/dist/runtime-values.d.ts +4 -4
  159. package/dist/runtime-values.js +2 -2
  160. package/dist/runtime-values.js.map +1 -1
  161. package/dist/special-call-rewrites.d.ts +1 -1
  162. package/dist/special-call-rewrites.js +14 -18
  163. package/dist/special-call-rewrites.js.map +1 -1
  164. package/dist/translation.d.ts +7 -7
  165. package/dist/translation.js +323 -366
  166. package/dist/translation.js.map +1 -1
  167. package/package.json +2 -2
@@ -1,12 +1,12 @@
1
- import { ErrorCode, type CellValue } from "@bilig/protocol";
2
- import type { FormulaNode } from "./ast.js";
3
- import { type LookupBuiltin } from "./builtins/lookup.js";
4
- import { type ArrayValue, type EvaluationResult } from "./runtime-values.js";
1
+ import { ErrorCode, type CellValue } from '@bilig/protocol';
2
+ import type { FormulaNode } from './ast.js';
3
+ import { type LookupBuiltin } from './builtins/lookup.js';
4
+ import { type ArrayValue, type EvaluationResult } from './runtime-values.js';
5
5
  export interface EvaluationContext {
6
6
  sheetName: string;
7
7
  currentAddress?: string;
8
8
  resolveCell: (sheetName: string, address: string) => CellValue;
9
- resolveRange: (sheetName: string, start: string, end: string, refKind: "cells" | "rows" | "cols") => CellValue[];
9
+ resolveRange: (sheetName: string, start: string, end: string, refKind: 'cells' | 'rows' | 'cols') => CellValue[];
10
10
  resolveName?: (name: string) => CellValue;
11
11
  resolveFormula?: (sheetName: string, address: string) => string | undefined;
12
12
  resolvePivotData?: (request: {
@@ -67,41 +67,41 @@ export type ExactVectorMatchResult = {
67
67
  };
68
68
  export type ApproximateVectorMatchResult = ExactVectorMatchResult;
69
69
  export interface ReferenceOperand {
70
- kind: "cell" | "range" | "row" | "col";
70
+ kind: 'cell' | 'range' | 'row' | 'col';
71
71
  sheetName?: string;
72
72
  address?: string;
73
73
  start?: string;
74
74
  end?: string;
75
- refKind?: "cells" | "rows" | "cols";
75
+ refKind?: 'cells' | 'rows' | 'cols';
76
76
  }
77
77
  export type JsPlanInstruction = {
78
- opcode: "push-number";
78
+ opcode: 'push-number';
79
79
  value: number;
80
80
  } | {
81
- opcode: "push-boolean";
81
+ opcode: 'push-boolean';
82
82
  value: boolean;
83
83
  } | {
84
- opcode: "push-string";
84
+ opcode: 'push-string';
85
85
  value: string;
86
86
  } | {
87
- opcode: "push-error";
87
+ opcode: 'push-error';
88
88
  code: ErrorCode;
89
89
  } | {
90
- opcode: "push-name";
90
+ opcode: 'push-name';
91
91
  name: string;
92
92
  } | {
93
- opcode: "push-cell";
93
+ opcode: 'push-cell';
94
94
  sheetName?: string;
95
95
  address: string;
96
96
  } | {
97
- opcode: "push-range";
97
+ opcode: 'push-range';
98
98
  sheetName?: string;
99
99
  start: string;
100
100
  end: string;
101
- refKind: "cells" | "rows" | "cols";
101
+ refKind: 'cells' | 'rows' | 'cols';
102
102
  } | {
103
- opcode: "lookup-exact-match";
104
- callee: "MATCH" | "XMATCH";
103
+ opcode: 'lookup-exact-match';
104
+ callee: 'MATCH' | 'XMATCH';
105
105
  sheetName?: string;
106
106
  start: string;
107
107
  end: string;
@@ -109,11 +109,11 @@ export type JsPlanInstruction = {
109
109
  endRow: number;
110
110
  startCol: number;
111
111
  endCol: number;
112
- refKind: "cells";
112
+ refKind: 'cells';
113
113
  searchMode: 1 | -1;
114
114
  } | {
115
- opcode: "lookup-approximate-match";
116
- callee: "MATCH" | "XMATCH";
115
+ opcode: 'lookup-approximate-match';
116
+ callee: 'MATCH' | 'XMATCH';
117
117
  sheetName?: string;
118
118
  start: string;
119
119
  end: string;
@@ -121,63 +121,63 @@ export type JsPlanInstruction = {
121
121
  endRow: number;
122
122
  startCol: number;
123
123
  endCol: number;
124
- refKind: "cells";
124
+ refKind: 'cells';
125
125
  matchMode: 1 | -1;
126
126
  } | {
127
- opcode: "push-lambda";
127
+ opcode: 'push-lambda';
128
128
  params: string[];
129
129
  body: JsPlanInstruction[];
130
130
  } | {
131
- opcode: "unary";
132
- operator: "+" | "-";
131
+ opcode: 'unary';
132
+ operator: '+' | '-';
133
133
  } | {
134
- opcode: "binary";
135
- operator: "+" | "-" | "*" | "/" | "^" | "&" | "=" | "<>" | ">" | ">=" | "<" | "<=";
134
+ opcode: 'binary';
135
+ operator: '+' | '-' | '*' | '/' | '^' | '&' | '=' | '<>' | '>' | '>=' | '<' | '<=';
136
136
  } | {
137
- opcode: "call";
137
+ opcode: 'call';
138
138
  callee: string;
139
139
  argc: number;
140
140
  argRefs?: Array<ReferenceOperand | undefined>;
141
141
  } | {
142
- opcode: "invoke";
142
+ opcode: 'invoke';
143
143
  argc: number;
144
144
  } | {
145
- opcode: "begin-scope";
145
+ opcode: 'begin-scope';
146
146
  } | {
147
- opcode: "bind-name";
147
+ opcode: 'bind-name';
148
148
  name: string;
149
149
  } | {
150
- opcode: "end-scope";
150
+ opcode: 'end-scope';
151
151
  } | {
152
- opcode: "jump-if-false";
152
+ opcode: 'jump-if-false';
153
153
  target: number;
154
154
  } | {
155
- opcode: "jump";
155
+ opcode: 'jump';
156
156
  target: number;
157
157
  } | {
158
- opcode: "return";
158
+ opcode: 'return';
159
159
  };
160
160
  export type StackValue = {
161
- kind: "scalar";
161
+ kind: 'scalar';
162
162
  value: CellValue;
163
163
  } | {
164
- kind: "omitted";
164
+ kind: 'omitted';
165
165
  } | {
166
- kind: "range";
166
+ kind: 'range';
167
167
  values: CellValue[];
168
- refKind: "cells" | "rows" | "cols";
168
+ refKind: 'cells' | 'rows' | 'cols';
169
169
  rows: number;
170
170
  cols: number;
171
171
  sheetName?: string;
172
172
  start?: string;
173
173
  end?: string;
174
174
  } | {
175
- kind: "lambda";
175
+ kind: 'lambda';
176
176
  params: string[];
177
177
  body: JsPlanInstruction[];
178
178
  scopes: Array<Map<string, StackValue>>;
179
179
  } | ArrayValue;
180
- export { lowerToPlan } from "./js-plan-lowering.js";
180
+ export { lowerToPlan } from './js-plan-lowering.js';
181
181
  export declare function evaluatePlanResult(plan: readonly JsPlanInstruction[], context: EvaluationContext): EvaluationResult;
182
182
  export declare function evaluatePlan(plan: readonly JsPlanInstruction[], context: EvaluationContext): CellValue;
183
183
  export declare function evaluateAst(node: FormulaNode, context: EvaluationContext): CellValue;