inputlayer-js-dev 0.1.0-dev.ec507e7

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.
@@ -0,0 +1,253 @@
1
+ import {
2
+ funcCall,
3
+ literal
4
+ } from "./chunk-S3PNNRWY.mjs";
5
+
6
+ // src/functions.ts
7
+ function e(v) {
8
+ if (typeof v === "object" && v !== null && "toAst" in v && typeof v.toAst === "function") {
9
+ return v.toAst();
10
+ }
11
+ if (typeof v === "object" && v !== null && !Array.isArray(v) && "_tag" in v) {
12
+ return v;
13
+ }
14
+ return literal(v);
15
+ }
16
+ function euclidean(v1, v2) {
17
+ return funcCall("euclidean", [e(v1), e(v2)]);
18
+ }
19
+ function cosine(v1, v2) {
20
+ return funcCall("cosine", [e(v1), e(v2)]);
21
+ }
22
+ function dot(v1, v2) {
23
+ return funcCall("dot", [e(v1), e(v2)]);
24
+ }
25
+ function manhattan(v1, v2) {
26
+ return funcCall("manhattan", [e(v1), e(v2)]);
27
+ }
28
+ function normalize(v) {
29
+ return funcCall("normalize", [e(v)]);
30
+ }
31
+ function vecDim(v) {
32
+ return funcCall("vec_dim", [e(v)]);
33
+ }
34
+ function vecAdd(v1, v2) {
35
+ return funcCall("vec_add", [e(v1), e(v2)]);
36
+ }
37
+ function vecScale(v, s) {
38
+ return funcCall("vec_scale", [e(v), e(s)]);
39
+ }
40
+ function lshBucket(v, tableIdx, numHp) {
41
+ return funcCall("lsh_bucket", [e(v), e(tableIdx), e(numHp)]);
42
+ }
43
+ function lshProbes(bucket, numHp, numProbes) {
44
+ return funcCall("lsh_probes", [e(bucket), e(numHp), e(numProbes)]);
45
+ }
46
+ function lshMultiProbe(v, tableIdx, numHp, numProbes) {
47
+ return funcCall("lsh_multi_probe", [e(v), e(tableIdx), e(numHp), e(numProbes)]);
48
+ }
49
+ function quantizeLinear(v) {
50
+ return funcCall("quantize_linear", [e(v)]);
51
+ }
52
+ function quantizeSymmetric(v) {
53
+ return funcCall("quantize_symmetric", [e(v)]);
54
+ }
55
+ function dequantize(v) {
56
+ return funcCall("dequantize", [e(v)]);
57
+ }
58
+ function dequantizeScaled(v, s) {
59
+ return funcCall("dequantize_scaled", [e(v), e(s)]);
60
+ }
61
+ function euclideanInt8(v1, v2) {
62
+ return funcCall("euclidean_int8", [e(v1), e(v2)]);
63
+ }
64
+ function cosineInt8(v1, v2) {
65
+ return funcCall("cosine_int8", [e(v1), e(v2)]);
66
+ }
67
+ function dotInt8(v1, v2) {
68
+ return funcCall("dot_int8", [e(v1), e(v2)]);
69
+ }
70
+ function manhattanInt8(v1, v2) {
71
+ return funcCall("manhattan_int8", [e(v1), e(v2)]);
72
+ }
73
+ function timeNow() {
74
+ return funcCall("time_now", []);
75
+ }
76
+ function timeDiff(t1, t2) {
77
+ return funcCall("time_diff", [e(t1), e(t2)]);
78
+ }
79
+ function timeAdd(ts, dur) {
80
+ return funcCall("time_add", [e(ts), e(dur)]);
81
+ }
82
+ function timeSub(ts, dur) {
83
+ return funcCall("time_sub", [e(ts), e(dur)]);
84
+ }
85
+ function timeDecay(ts, now, halfLife) {
86
+ return funcCall("time_decay", [e(ts), e(now), e(halfLife)]);
87
+ }
88
+ function timeDecayLinear(ts, now, maxAge) {
89
+ return funcCall("time_decay_linear", [e(ts), e(now), e(maxAge)]);
90
+ }
91
+ function timeBefore(t1, t2) {
92
+ return funcCall("time_before", [e(t1), e(t2)]);
93
+ }
94
+ function timeAfter(t1, t2) {
95
+ return funcCall("time_after", [e(t1), e(t2)]);
96
+ }
97
+ function timeBetween(ts, start, end) {
98
+ return funcCall("time_between", [e(ts), e(start), e(end)]);
99
+ }
100
+ function withinLast(ts, now, dur) {
101
+ return funcCall("within_last", [e(ts), e(now), e(dur)]);
102
+ }
103
+ function intervalsOverlap(s1, e1, s2, e2) {
104
+ return funcCall("intervals_overlap", [e(s1), e(e1), e(s2), e(e2)]);
105
+ }
106
+ function intervalContains(s1, e1Arg, s2, e2) {
107
+ return funcCall("interval_contains", [e(s1), e(e1Arg), e(s2), e(e2)]);
108
+ }
109
+ function intervalDuration(s, end) {
110
+ return funcCall("interval_duration", [e(s), e(end)]);
111
+ }
112
+ function pointInInterval(ts, s, end) {
113
+ return funcCall("point_in_interval", [e(ts), e(s), e(end)]);
114
+ }
115
+ function abs(x) {
116
+ return funcCall("abs", [e(x)]);
117
+ }
118
+ function absInt64(x) {
119
+ return funcCall("abs_int64", [e(x)]);
120
+ }
121
+ function absFloat64(x) {
122
+ return funcCall("abs_float64", [e(x)]);
123
+ }
124
+ function sqrt(x) {
125
+ return funcCall("sqrt", [e(x)]);
126
+ }
127
+ function pow(base, exp2) {
128
+ return funcCall("pow", [e(base), e(exp2)]);
129
+ }
130
+ function log(x) {
131
+ return funcCall("log", [e(x)]);
132
+ }
133
+ function exp(x) {
134
+ return funcCall("exp", [e(x)]);
135
+ }
136
+ function sin(x) {
137
+ return funcCall("sin", [e(x)]);
138
+ }
139
+ function cos(x) {
140
+ return funcCall("cos", [e(x)]);
141
+ }
142
+ function tan(x) {
143
+ return funcCall("tan", [e(x)]);
144
+ }
145
+ function floor(x) {
146
+ return funcCall("floor", [e(x)]);
147
+ }
148
+ function ceil(x) {
149
+ return funcCall("ceil", [e(x)]);
150
+ }
151
+ function sign(x) {
152
+ return funcCall("sign", [e(x)]);
153
+ }
154
+ function minVal(a, b) {
155
+ return funcCall("min_val", [e(a), e(b)]);
156
+ }
157
+ function maxVal(a, b) {
158
+ return funcCall("max_val", [e(a), e(b)]);
159
+ }
160
+ function len(s) {
161
+ return funcCall("len", [e(s)]);
162
+ }
163
+ function upper(s) {
164
+ return funcCall("upper", [e(s)]);
165
+ }
166
+ function lower(s) {
167
+ return funcCall("lower", [e(s)]);
168
+ }
169
+ function trim(s) {
170
+ return funcCall("trim", [e(s)]);
171
+ }
172
+ function substr(s, start, length) {
173
+ return funcCall("substr", [e(s), e(start), e(length)]);
174
+ }
175
+ function replace(s, find, repl) {
176
+ return funcCall("replace", [e(s), e(find), e(repl)]);
177
+ }
178
+ function concat(...args) {
179
+ return funcCall("concat", args.map(e));
180
+ }
181
+ function toFloat(x) {
182
+ return funcCall("to_float", [e(x)]);
183
+ }
184
+ function toInt(x) {
185
+ return funcCall("to_int", [e(x)]);
186
+ }
187
+ function hnswNearest(indexName, queryVec, k, opts) {
188
+ const args = [literal(indexName), e(queryVec), literal(k)];
189
+ if (opts?.efSearch !== void 0) {
190
+ args.push(literal(opts.efSearch));
191
+ }
192
+ return funcCall("hnsw_nearest", args);
193
+ }
194
+ export {
195
+ abs,
196
+ absFloat64,
197
+ absInt64,
198
+ ceil,
199
+ concat,
200
+ cos,
201
+ cosine,
202
+ cosineInt8,
203
+ dequantize,
204
+ dequantizeScaled,
205
+ dot,
206
+ dotInt8,
207
+ euclidean,
208
+ euclideanInt8,
209
+ exp,
210
+ floor,
211
+ hnswNearest,
212
+ intervalContains,
213
+ intervalDuration,
214
+ intervalsOverlap,
215
+ len,
216
+ log,
217
+ lower,
218
+ lshBucket,
219
+ lshMultiProbe,
220
+ lshProbes,
221
+ manhattan,
222
+ manhattanInt8,
223
+ maxVal,
224
+ minVal,
225
+ normalize,
226
+ pointInInterval,
227
+ pow,
228
+ quantizeLinear,
229
+ quantizeSymmetric,
230
+ replace,
231
+ sign,
232
+ sin,
233
+ sqrt,
234
+ substr,
235
+ tan,
236
+ timeAdd,
237
+ timeAfter,
238
+ timeBefore,
239
+ timeBetween,
240
+ timeDecay,
241
+ timeDecayLinear,
242
+ timeDiff,
243
+ timeNow,
244
+ timeSub,
245
+ toFloat,
246
+ toInt,
247
+ trim,
248
+ upper,
249
+ vecAdd,
250
+ vecDim,
251
+ vecScale,
252
+ withinLast
253
+ };