trilean 0.0.0 → 1.0.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 (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +634 -0
  3. package/dist/computed-value.cjs +71 -0
  4. package/dist/computed-value.d.cts +43 -0
  5. package/dist/computed-value.d.ts +43 -0
  6. package/dist/computed-value.js +65 -0
  7. package/dist/derived-aggregates.cjs +74 -0
  8. package/dist/derived-aggregates.d.cts +12 -0
  9. package/dist/derived-aggregates.d.ts +12 -0
  10. package/dist/derived-aggregates.js +70 -0
  11. package/dist/derived-connectives.cjs +40 -0
  12. package/dist/derived-connectives.d.cts +17 -0
  13. package/dist/derived-connectives.d.ts +17 -0
  14. package/dist/derived-connectives.js +31 -0
  15. package/dist/evaluation.cjs +39 -0
  16. package/dist/evaluation.d.cts +29 -0
  17. package/dist/evaluation.d.ts +29 -0
  18. package/dist/evaluation.js +35 -0
  19. package/dist/evaluator.cjs +482 -0
  20. package/dist/evaluator.d.cts +18 -0
  21. package/dist/evaluator.d.ts +18 -0
  22. package/dist/evaluator.js +479 -0
  23. package/dist/functions.cjs +5 -0
  24. package/dist/functions.d.cts +11 -0
  25. package/dist/functions.d.ts +11 -0
  26. package/dist/functions.js +4 -0
  27. package/dist/index.cjs +69 -0
  28. package/dist/index.d.cts +10 -0
  29. package/dist/index.d.ts +10 -0
  30. package/dist/index.js +9 -0
  31. package/dist/json-value-B1Hjjjri.d.cts +11 -0
  32. package/dist/json-value-B1Hjjjri.d.ts +11 -0
  33. package/dist/json-value.cjs +13 -0
  34. package/dist/json-value.d.cts +2 -0
  35. package/dist/json-value.d.ts +2 -0
  36. package/dist/json-value.js +12 -0
  37. package/dist/resolvers.cjs +0 -0
  38. package/dist/resolvers.d.cts +28 -0
  39. package/dist/resolvers.d.ts +28 -0
  40. package/dist/resolvers.js +0 -0
  41. package/dist/tree.cjs +289 -0
  42. package/dist/tree.d.cts +368 -0
  43. package/dist/tree.d.ts +368 -0
  44. package/dist/tree.js +257 -0
  45. package/package.json +114 -2
  46. package/schemas/trilean.schema.json +1 -0
@@ -0,0 +1,368 @@
1
+ import { t as JsonValue } from "./json-value-B1Hjjjri.cjs";
2
+ import { z } from "zod";
3
+ //#region src/tree.d.ts
4
+ declare const ComparisonOperatorSchema: z.ZodEnum<{
5
+ gt: "gt";
6
+ gte: "gte";
7
+ lt: "lt";
8
+ lte: "lte";
9
+ eq: "eq";
10
+ neq: "neq";
11
+ }>;
12
+ type ComparisonOperator = z.infer<typeof ComparisonOperatorSchema>;
13
+ declare const TextComparisonOperatorSchema: z.ZodEnum<{
14
+ equals: "equals";
15
+ notEquals: "notEquals";
16
+ matches: "matches";
17
+ notMatches: "notMatches";
18
+ }>;
19
+ type TextComparisonOperator = z.infer<typeof TextComparisonOperatorSchema>;
20
+ declare const MembershipOperatorSchema: z.ZodEnum<{
21
+ in: "in";
22
+ notIn: "notIn";
23
+ }>;
24
+ type MembershipOperator = z.infer<typeof MembershipOperatorSchema>;
25
+ declare const ArithmeticOperatorSchema: z.ZodEnum<{
26
+ add: "add";
27
+ subtract: "subtract";
28
+ multiply: "multiply";
29
+ divide: "divide";
30
+ power: "power";
31
+ modulo: "modulo";
32
+ }>;
33
+ type ArithmeticOperator = z.infer<typeof ArithmeticOperatorSchema>;
34
+ declare const NotNodeSchema: z.ZodObject<{
35
+ kind: z.ZodLiteral<"not">;
36
+ operand: typeof PredicateNodeSchema;
37
+ }, z.core.$strip>;
38
+ type NotNode = z.infer<typeof NotNodeSchema>;
39
+ declare const AndNodeSchema: z.ZodObject<{
40
+ kind: z.ZodLiteral<"and">;
41
+ left: typeof PredicateNodeSchema;
42
+ right: typeof PredicateNodeSchema;
43
+ }, z.core.$strip>;
44
+ type AndNode = z.infer<typeof AndNodeSchema>;
45
+ declare const OrNodeSchema: z.ZodObject<{
46
+ kind: z.ZodLiteral<"or">;
47
+ left: typeof PredicateNodeSchema;
48
+ right: typeof PredicateNodeSchema;
49
+ }, z.core.$strip>;
50
+ type OrNode = z.infer<typeof OrNodeSchema>;
51
+ declare const AllOfNodeSchema: z.ZodObject<{
52
+ kind: z.ZodLiteral<"allOf">;
53
+ operands: z.ZodArray<typeof PredicateNodeSchema>;
54
+ }, z.core.$strip>;
55
+ type AllOfNode = z.infer<typeof AllOfNodeSchema>;
56
+ declare const AnyOfNodeSchema: z.ZodObject<{
57
+ kind: z.ZodLiteral<"anyOf">;
58
+ operands: z.ZodArray<typeof PredicateNodeSchema>;
59
+ }, z.core.$strip>;
60
+ type AnyOfNode = z.infer<typeof AnyOfNodeSchema>;
61
+ declare const CompareNodeSchema: z.ZodObject<{
62
+ kind: z.ZodLiteral<"compare">;
63
+ op: z.ZodEnum<{
64
+ gt: "gt";
65
+ gte: "gte";
66
+ lt: "lt";
67
+ lte: "lte";
68
+ eq: "eq";
69
+ neq: "neq";
70
+ }>;
71
+ left: typeof ExpressionNodeSchema;
72
+ right: typeof ExpressionNodeSchema;
73
+ }, z.core.$strip>;
74
+ type CompareNode = z.infer<typeof CompareNodeSchema>;
75
+ declare const TextCompareNodeSchema: z.ZodObject<{
76
+ kind: z.ZodLiteral<"textCompare">;
77
+ op: z.ZodEnum<{
78
+ equals: "equals";
79
+ notEquals: "notEquals";
80
+ matches: "matches";
81
+ notMatches: "notMatches";
82
+ }>;
83
+ left: typeof ExpressionNodeSchema;
84
+ right: typeof ExpressionNodeSchema;
85
+ }, z.core.$strip>;
86
+ type TextCompareNode = z.infer<typeof TextCompareNodeSchema>;
87
+ declare const MemberOfNodeSchema: z.ZodObject<{
88
+ kind: z.ZodLiteral<"memberOf">;
89
+ op: z.ZodEnum<{
90
+ in: "in";
91
+ notIn: "notIn";
92
+ }>;
93
+ operand: typeof ExpressionNodeSchema;
94
+ candidates: z.ZodArray<typeof ExpressionNodeSchema>;
95
+ }, z.core.$strip>;
96
+ type MemberOfNode = z.infer<typeof MemberOfNodeSchema>;
97
+ declare const ExistsNodeSchema: z.ZodObject<{
98
+ kind: z.ZodLiteral<"exists">;
99
+ operand: typeof ExpressionNodeSchema;
100
+ }, z.core.$strip>;
101
+ type ExistsNode = z.infer<typeof ExistsNodeSchema>;
102
+ declare const SomeNodeSchema: z.ZodObject<{
103
+ kind: z.ZodLiteral<"some">;
104
+ collection: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
105
+ item: typeof PredicateNodeSchema;
106
+ filter: z.ZodOptional<typeof PredicateNodeSchema>;
107
+ }, z.core.$strip>;
108
+ type SomeNode = z.infer<typeof SomeNodeSchema>;
109
+ declare const EveryNodeSchema: z.ZodObject<{
110
+ kind: z.ZodLiteral<"every">;
111
+ collection: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
112
+ item: typeof PredicateNodeSchema;
113
+ filter: z.ZodOptional<typeof PredicateNodeSchema>;
114
+ }, z.core.$strip>;
115
+ type EveryNode = z.infer<typeof EveryNodeSchema>;
116
+ declare const PredicateNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
117
+ kind: z.ZodLiteral<"not">;
118
+ operand: typeof PredicateNodeSchema;
119
+ }, z.core.$strip>, z.ZodObject<{
120
+ kind: z.ZodLiteral<"and">;
121
+ left: typeof PredicateNodeSchema;
122
+ right: typeof PredicateNodeSchema;
123
+ }, z.core.$strip>, z.ZodObject<{
124
+ kind: z.ZodLiteral<"or">;
125
+ left: typeof PredicateNodeSchema;
126
+ right: typeof PredicateNodeSchema;
127
+ }, z.core.$strip>, z.ZodObject<{
128
+ kind: z.ZodLiteral<"allOf">;
129
+ operands: z.ZodArray<typeof PredicateNodeSchema>;
130
+ }, z.core.$strip>, z.ZodObject<{
131
+ kind: z.ZodLiteral<"anyOf">;
132
+ operands: z.ZodArray<typeof PredicateNodeSchema>;
133
+ }, z.core.$strip>, z.ZodObject<{
134
+ kind: z.ZodLiteral<"compare">;
135
+ op: z.ZodEnum<{
136
+ gt: "gt";
137
+ gte: "gte";
138
+ lt: "lt";
139
+ lte: "lte";
140
+ eq: "eq";
141
+ neq: "neq";
142
+ }>;
143
+ left: typeof ExpressionNodeSchema;
144
+ right: typeof ExpressionNodeSchema;
145
+ }, z.core.$strip>, z.ZodObject<{
146
+ kind: z.ZodLiteral<"textCompare">;
147
+ op: z.ZodEnum<{
148
+ equals: "equals";
149
+ notEquals: "notEquals";
150
+ matches: "matches";
151
+ notMatches: "notMatches";
152
+ }>;
153
+ left: typeof ExpressionNodeSchema;
154
+ right: typeof ExpressionNodeSchema;
155
+ }, z.core.$strip>, z.ZodObject<{
156
+ kind: z.ZodLiteral<"memberOf">;
157
+ op: z.ZodEnum<{
158
+ in: "in";
159
+ notIn: "notIn";
160
+ }>;
161
+ operand: typeof ExpressionNodeSchema;
162
+ candidates: z.ZodArray<typeof ExpressionNodeSchema>;
163
+ }, z.core.$strip>, z.ZodObject<{
164
+ kind: z.ZodLiteral<"exists">;
165
+ operand: typeof ExpressionNodeSchema;
166
+ }, z.core.$strip>, z.ZodObject<{
167
+ kind: z.ZodLiteral<"some">;
168
+ collection: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
169
+ item: typeof PredicateNodeSchema;
170
+ filter: z.ZodOptional<typeof PredicateNodeSchema>;
171
+ }, z.core.$strip>, z.ZodObject<{
172
+ kind: z.ZodLiteral<"every">;
173
+ collection: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
174
+ item: typeof PredicateNodeSchema;
175
+ filter: z.ZodOptional<typeof PredicateNodeSchema>;
176
+ }, z.core.$strip>], "kind">;
177
+ type PredicateNode = z.infer<typeof PredicateNodeSchema>;
178
+ declare const NumberLiteralNodeSchema: z.ZodObject<{
179
+ kind: z.ZodLiteral<"numberLiteral">;
180
+ value: z.ZodNumber;
181
+ unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
182
+ }, z.core.$strip>;
183
+ type NumberLiteralNode = z.infer<typeof NumberLiteralNodeSchema>;
184
+ declare const TextLiteralNodeSchema: z.ZodObject<{
185
+ kind: z.ZodLiteral<"textLiteral">;
186
+ value: z.ZodString;
187
+ }, z.core.$strip>;
188
+ type TextLiteralNode = z.infer<typeof TextLiteralNodeSchema>;
189
+ declare const InstantLiteralNodeSchema: z.ZodObject<{
190
+ kind: z.ZodLiteral<"instantLiteral">;
191
+ value: z.ZodString;
192
+ }, z.core.$strip>;
193
+ type InstantLiteralNode = z.infer<typeof InstantLiteralNodeSchema>;
194
+ declare const DurationLiteralNodeSchema: z.ZodObject<{
195
+ kind: z.ZodLiteral<"durationLiteral">;
196
+ value: z.ZodNumber;
197
+ unit: z.ZodEnum<{
198
+ ms: "ms";
199
+ s: "s";
200
+ min: "min";
201
+ h: "h";
202
+ d: "d";
203
+ }>;
204
+ }, z.core.$strip>;
205
+ type DurationLiteralNode = z.infer<typeof DurationLiteralNodeSchema>;
206
+ declare const ReferenceNodeSchema: z.ZodObject<{
207
+ kind: z.ZodLiteral<"reference">;
208
+ key: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
209
+ unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
210
+ }, z.core.$strip>;
211
+ type ReferenceNode = z.infer<typeof ReferenceNodeSchema>;
212
+ declare const ArithmeticNodeSchema: z.ZodObject<{
213
+ kind: z.ZodLiteral<"arithmetic">;
214
+ op: z.ZodEnum<{
215
+ add: "add";
216
+ subtract: "subtract";
217
+ multiply: "multiply";
218
+ divide: "divide";
219
+ power: "power";
220
+ modulo: "modulo";
221
+ }>;
222
+ left: typeof ExpressionNodeSchema;
223
+ right: typeof ExpressionNodeSchema;
224
+ }, z.core.$strip>;
225
+ type ArithmeticNode = z.infer<typeof ArithmeticNodeSchema>;
226
+ declare const NegateNodeSchema: z.ZodObject<{
227
+ kind: z.ZodLiteral<"negate">;
228
+ operand: typeof ExpressionNodeSchema;
229
+ }, z.core.$strip>;
230
+ type NegateNode = z.infer<typeof NegateNodeSchema>;
231
+ declare const CallNodeSchema: z.ZodObject<{
232
+ kind: z.ZodLiteral<"call">;
233
+ fn: z.ZodString;
234
+ args: z.ZodArray<typeof ExpressionNodeSchema>;
235
+ }, z.core.$strip>;
236
+ type CallNode = z.infer<typeof CallNodeSchema>;
237
+ declare const LookupNodeSchema: z.ZodObject<{
238
+ kind: z.ZodLiteral<"lookup">;
239
+ table: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
240
+ keys: z.ZodArray<typeof ExpressionNodeSchema>;
241
+ }, z.core.$strip>;
242
+ type LookupNode = z.infer<typeof LookupNodeSchema>;
243
+ declare const ConditionalCaseSchema: z.ZodObject<{
244
+ when: typeof PredicateNodeSchema;
245
+ then: typeof ExpressionNodeSchema;
246
+ }, z.core.$strip>;
247
+ type ConditionalCase = z.infer<typeof ConditionalCaseSchema>;
248
+ declare const ConditionalNodeSchema: z.ZodObject<{
249
+ kind: z.ZodLiteral<"conditional">;
250
+ cases: z.ZodArray<typeof ConditionalCaseSchema>;
251
+ fallback: typeof ExpressionNodeSchema;
252
+ }, z.core.$strip>;
253
+ type ConditionalNode = z.infer<typeof ConditionalNodeSchema>;
254
+ declare const FoldCombinerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
255
+ mode: z.ZodLiteral<"max">;
256
+ item: typeof ExpressionNodeSchema;
257
+ }, z.core.$strip>, z.ZodObject<{
258
+ mode: z.ZodLiteral<"min">;
259
+ item: typeof ExpressionNodeSchema;
260
+ }, z.core.$strip>, z.ZodObject<{
261
+ mode: z.ZodLiteral<"reduce">;
262
+ initial: typeof ExpressionNodeSchema;
263
+ combine: typeof ExpressionNodeSchema;
264
+ }, z.core.$strip>], "mode">;
265
+ type FoldCombiner = z.infer<typeof FoldCombinerSchema>;
266
+ declare const FoldNodeSchema: z.ZodObject<{
267
+ kind: z.ZodLiteral<"fold">;
268
+ collection: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
269
+ filter: z.ZodOptional<typeof PredicateNodeSchema>;
270
+ combiner: z.ZodDiscriminatedUnion<[z.ZodObject<{
271
+ mode: z.ZodLiteral<"max">;
272
+ item: typeof ExpressionNodeSchema;
273
+ }, z.core.$strip>, z.ZodObject<{
274
+ mode: z.ZodLiteral<"min">;
275
+ item: typeof ExpressionNodeSchema;
276
+ }, z.core.$strip>, z.ZodObject<{
277
+ mode: z.ZodLiteral<"reduce">;
278
+ initial: typeof ExpressionNodeSchema;
279
+ combine: typeof ExpressionNodeSchema;
280
+ }, z.core.$strip>], "mode">;
281
+ }, z.core.$strip>;
282
+ type FoldNode = z.infer<typeof FoldNodeSchema>;
283
+ declare const AccumulatorNodeSchema: z.ZodObject<{
284
+ kind: z.ZodLiteral<"accumulator">;
285
+ }, z.core.$strip>;
286
+ type AccumulatorNode = z.infer<typeof AccumulatorNodeSchema>;
287
+ declare const DelegateNodeSchema: z.ZodObject<{
288
+ kind: z.ZodLiteral<"delegate">;
289
+ system: z.ZodString;
290
+ payload: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
291
+ }, z.core.$strip>;
292
+ type DelegateNode = z.infer<typeof DelegateNodeSchema>;
293
+ declare const ExpressionNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
294
+ kind: z.ZodLiteral<"numberLiteral">;
295
+ value: z.ZodNumber;
296
+ unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
297
+ }, z.core.$strip>, z.ZodObject<{
298
+ kind: z.ZodLiteral<"textLiteral">;
299
+ value: z.ZodString;
300
+ }, z.core.$strip>, z.ZodObject<{
301
+ kind: z.ZodLiteral<"instantLiteral">;
302
+ value: z.ZodString;
303
+ }, z.core.$strip>, z.ZodObject<{
304
+ kind: z.ZodLiteral<"durationLiteral">;
305
+ value: z.ZodNumber;
306
+ unit: z.ZodEnum<{
307
+ ms: "ms";
308
+ s: "s";
309
+ min: "min";
310
+ h: "h";
311
+ d: "d";
312
+ }>;
313
+ }, z.core.$strip>, z.ZodObject<{
314
+ kind: z.ZodLiteral<"reference">;
315
+ key: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
316
+ unit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
317
+ }, z.core.$strip>, z.ZodObject<{
318
+ kind: z.ZodLiteral<"arithmetic">;
319
+ op: z.ZodEnum<{
320
+ add: "add";
321
+ subtract: "subtract";
322
+ multiply: "multiply";
323
+ divide: "divide";
324
+ power: "power";
325
+ modulo: "modulo";
326
+ }>;
327
+ left: typeof ExpressionNodeSchema;
328
+ right: typeof ExpressionNodeSchema;
329
+ }, z.core.$strip>, z.ZodObject<{
330
+ kind: z.ZodLiteral<"negate">;
331
+ operand: typeof ExpressionNodeSchema;
332
+ }, z.core.$strip>, z.ZodObject<{
333
+ kind: z.ZodLiteral<"call">;
334
+ fn: z.ZodString;
335
+ args: z.ZodArray<typeof ExpressionNodeSchema>;
336
+ }, z.core.$strip>, z.ZodObject<{
337
+ kind: z.ZodLiteral<"lookup">;
338
+ table: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
339
+ keys: z.ZodArray<typeof ExpressionNodeSchema>;
340
+ }, z.core.$strip>, z.ZodObject<{
341
+ kind: z.ZodLiteral<"conditional">;
342
+ cases: z.ZodArray<typeof ConditionalCaseSchema>;
343
+ fallback: typeof ExpressionNodeSchema;
344
+ }, z.core.$strip>, z.ZodObject<{
345
+ kind: z.ZodLiteral<"fold">;
346
+ collection: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
347
+ filter: z.ZodOptional<typeof PredicateNodeSchema>;
348
+ combiner: z.ZodDiscriminatedUnion<[z.ZodObject<{
349
+ mode: z.ZodLiteral<"max">;
350
+ item: typeof ExpressionNodeSchema;
351
+ }, z.core.$strip>, z.ZodObject<{
352
+ mode: z.ZodLiteral<"min">;
353
+ item: typeof ExpressionNodeSchema;
354
+ }, z.core.$strip>, z.ZodObject<{
355
+ mode: z.ZodLiteral<"reduce">;
356
+ initial: typeof ExpressionNodeSchema;
357
+ combine: typeof ExpressionNodeSchema;
358
+ }, z.core.$strip>], "mode">;
359
+ }, z.core.$strip>, z.ZodObject<{
360
+ kind: z.ZodLiteral<"accumulator">;
361
+ }, z.core.$strip>, z.ZodObject<{
362
+ kind: z.ZodLiteral<"delegate">;
363
+ system: z.ZodString;
364
+ payload: z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
365
+ }, z.core.$strip>], "kind">;
366
+ type ExpressionNode = z.infer<typeof ExpressionNodeSchema>;
367
+ //#endregion
368
+ export { AccumulatorNode, AccumulatorNodeSchema, AllOfNode, AllOfNodeSchema, AndNode, AndNodeSchema, AnyOfNode, AnyOfNodeSchema, ArithmeticNode, ArithmeticNodeSchema, ArithmeticOperator, ArithmeticOperatorSchema, CallNode, CallNodeSchema, CompareNode, CompareNodeSchema, ComparisonOperator, ComparisonOperatorSchema, ConditionalCase, ConditionalCaseSchema, ConditionalNode, ConditionalNodeSchema, DelegateNode, DelegateNodeSchema, DurationLiteralNode, DurationLiteralNodeSchema, EveryNode, EveryNodeSchema, ExistsNode, ExistsNodeSchema, ExpressionNode, ExpressionNodeSchema, FoldCombiner, FoldCombinerSchema, FoldNode, FoldNodeSchema, InstantLiteralNode, InstantLiteralNodeSchema, LookupNode, LookupNodeSchema, MemberOfNode, MemberOfNodeSchema, MembershipOperator, MembershipOperatorSchema, NegateNode, NegateNodeSchema, NotNode, NotNodeSchema, NumberLiteralNode, NumberLiteralNodeSchema, OrNode, OrNodeSchema, PredicateNode, PredicateNodeSchema, ReferenceNode, ReferenceNodeSchema, SomeNode, SomeNodeSchema, TextCompareNode, TextCompareNodeSchema, TextComparisonOperator, TextComparisonOperatorSchema, TextLiteralNode, TextLiteralNodeSchema };