@shwfed/nuxt 0.7.8 → 0.7.10
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.
- package/dist/module.json +1 -1
- package/dist/runtime/components/app.d.vue.ts +7 -58
- package/dist/runtime/components/app.vue +18 -411
- package/dist/runtime/components/app.vue.d.ts +7 -58
- package/dist/runtime/components/fields.d.vue.ts +177 -0
- package/dist/runtime/components/fields.vue +47 -0
- package/dist/runtime/components/fields.vue.d.ts +177 -0
- package/dist/runtime/components/table.d.vue.ts +63 -59
- package/dist/runtime/components/table.vue +52 -617
- package/dist/runtime/components/table.vue.d.ts +63 -59
- package/dist/runtime/components/ui/app/App.d.vue.ts +86 -0
- package/dist/runtime/components/ui/app/App.vue +414 -0
- package/dist/runtime/components/ui/app/App.vue.d.ts +86 -0
- package/dist/runtime/components/ui/button-group/ButtonGroupSeparator.vue +1 -1
- package/dist/runtime/components/ui/button-group/ButtonGroupText.vue +1 -1
- package/dist/runtime/components/ui/calendar/Calendar.d.vue.ts +5 -12
- package/dist/runtime/components/ui/calendar/Calendar.vue +77 -92
- package/dist/runtime/components/ui/calendar/Calendar.vue.d.ts +5 -12
- package/dist/runtime/components/ui/calendar/CalendarCellTrigger.vue +1 -1
- package/dist/runtime/components/ui/calendar/index.d.ts +1 -1
- package/dist/runtime/components/ui/checkbox/Checkbox.vue +6 -2
- package/dist/runtime/components/ui/command/CommandGroup.vue +4 -0
- package/dist/runtime/components/ui/dialog/DialogOverlay.vue +1 -1
- package/dist/runtime/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue +1 -1
- package/dist/runtime/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue +1 -1
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.d.vue.ts +30 -0
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +87 -0
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue.d.ts +30 -0
- package/dist/runtime/components/ui/expression-editor/index.d.ts +1 -0
- package/dist/runtime/components/ui/expression-editor/index.js +1 -0
- package/dist/runtime/components/ui/field/FieldContent.vue +1 -1
- package/dist/runtime/components/ui/field/FieldDescription.vue +1 -1
- package/dist/runtime/components/ui/field/FieldError.vue +2 -2
- package/dist/runtime/components/ui/field/FieldLabel.vue +1 -1
- package/dist/runtime/components/ui/field/FieldSeparator.vue +1 -1
- package/dist/runtime/components/ui/field/index.js +7 -5
- package/dist/runtime/components/ui/fields/Fields.d.vue.ts +376 -0
- package/dist/runtime/components/ui/fields/Fields.vue +441 -0
- package/dist/runtime/components/ui/fields/Fields.vue.d.ts +376 -0
- package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.d.vue.ts +163 -0
- package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue +363 -0
- package/dist/runtime/components/ui/fields-configurator/FieldsConfiguratorDialog.vue.d.ts +163 -0
- package/dist/runtime/components/ui/input/Input.d.vue.ts +1 -0
- package/dist/runtime/components/ui/input/Input.vue +3 -1
- package/dist/runtime/components/ui/input/Input.vue.d.ts +1 -0
- package/dist/runtime/components/ui/input-group/InputGroup.vue +3 -0
- package/dist/runtime/components/ui/input-group/InputGroupAddon.vue +4 -1
- package/dist/runtime/components/ui/input-group/InputGroupCombobox.d.vue.ts +11 -3
- package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue +16 -5
- package/dist/runtime/components/ui/input-group/InputGroupCombobox.vue.d.ts +11 -3
- package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.d.vue.ts +8 -1
- package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue +12 -1
- package/dist/runtime/components/ui/input-group/InputGroupComboboxInput.vue.d.ts +8 -1
- package/dist/runtime/components/ui/input-group/InputGroupInput.vue +1 -1
- package/dist/runtime/components/ui/input-group/InputGroupNumberField.d.vue.ts +5 -2
- package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +10 -4
- package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue.d.ts +5 -2
- package/dist/runtime/components/ui/input-group/InputGroupText.vue +1 -1
- package/dist/runtime/components/ui/input-group/InputGroupTextarea.vue +1 -1
- package/dist/runtime/components/ui/input-group/index.js +2 -2
- package/dist/runtime/components/ui/label/Label.vue +1 -1
- package/dist/runtime/components/ui/locale/Locale.d.vue.ts +20 -0
- package/dist/runtime/components/ui/locale/Locale.vue +291 -0
- package/dist/runtime/components/ui/locale/Locale.vue.d.ts +20 -0
- package/dist/runtime/components/ui/locale/index.d.ts +1 -0
- package/dist/runtime/components/ui/locale/index.js +1 -0
- package/dist/runtime/components/ui/native-select/NativeSelect.vue +3 -3
- package/dist/runtime/components/ui/native-select/NativeSelectOption.d.vue.ts +1 -0
- package/dist/runtime/components/ui/native-select/NativeSelectOption.vue +4 -1
- package/dist/runtime/components/ui/native-select/NativeSelectOption.vue.d.ts +1 -0
- package/dist/runtime/components/ui/navigation-menu/NavigationMenuLink.vue +1 -1
- package/dist/runtime/components/ui/navigation-menu/NavigationMenuViewport.vue +1 -1
- package/dist/runtime/components/ui/number-field/NumberFieldInput.vue +1 -1
- package/dist/runtime/components/ui/range-calendar/RangeCalendarCell.vue +1 -1
- package/dist/runtime/components/ui/range-calendar/RangeCalendarCellTrigger.vue +1 -1
- package/dist/runtime/components/ui/sheet/SheetOverlay.vue +1 -1
- package/dist/runtime/components/ui/switch/Switch.d.vue.ts +24 -0
- package/dist/runtime/components/ui/switch/Switch.vue +46 -0
- package/dist/runtime/components/ui/switch/Switch.vue.d.ts +24 -0
- package/dist/runtime/components/ui/switch/index.d.ts +1 -0
- package/dist/runtime/components/ui/switch/index.js +1 -0
- package/dist/runtime/components/ui/table/Table.d.vue.ts +81 -0
- package/dist/runtime/components/ui/table/Table.vue +792 -0
- package/dist/runtime/components/ui/table/Table.vue.d.ts +81 -0
- package/dist/runtime/components/ui/table/schema.d.ts +48 -0
- package/dist/runtime/components/ui/table/schema.js +126 -0
- package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.d.vue.ts +62 -0
- package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue +2233 -0
- package/dist/runtime/components/ui/table-configurator/TableConfiguratorDialog.vue.d.ts +62 -0
- package/dist/runtime/components/ui/table-configurator/menu.d.ts +37 -0
- package/dist/runtime/components/ui/table-configurator/menu.js +227 -0
- package/dist/runtime/components/ui/tabs/Tabs.d.vue.ts +24 -0
- package/dist/runtime/components/ui/tabs/Tabs.vue +30 -0
- package/dist/runtime/components/ui/tabs/Tabs.vue.d.ts +24 -0
- package/dist/runtime/components/ui/tabs/TabsContent.d.vue.ts +18 -0
- package/dist/runtime/components/ui/tabs/TabsContent.vue +23 -0
- package/dist/runtime/components/ui/tabs/TabsContent.vue.d.ts +18 -0
- package/dist/runtime/components/ui/tabs/TabsList.d.vue.ts +18 -0
- package/dist/runtime/components/ui/tabs/TabsList.vue +25 -0
- package/dist/runtime/components/ui/tabs/TabsList.vue.d.ts +18 -0
- package/dist/runtime/components/ui/tabs/TabsTrigger.d.vue.ts +18 -0
- package/dist/runtime/components/ui/tabs/TabsTrigger.vue +27 -0
- package/dist/runtime/components/ui/tabs/TabsTrigger.vue.d.ts +18 -0
- package/dist/runtime/components/ui/tabs/index.d.ts +4 -0
- package/dist/runtime/components/ui/tabs/index.js +4 -0
- package/dist/runtime/components/ui/textarea/Textarea.d.vue.ts +1 -0
- package/dist/runtime/components/ui/textarea/Textarea.vue +4 -2
- package/dist/runtime/components/ui/textarea/Textarea.vue.d.ts +1 -0
- package/dist/runtime/components/ui/toggle/Toggle.d.vue.ts +34 -0
- package/dist/runtime/components/ui/toggle/Toggle.vue +32 -0
- package/dist/runtime/components/ui/toggle/Toggle.vue.d.ts +34 -0
- package/dist/runtime/components/ui/toggle/index.d.ts +7 -0
- package/dist/runtime/components/ui/toggle/index.js +22 -0
- package/dist/runtime/composables/useTableRenderers.d.ts +2 -1
- package/dist/runtime/composables/useTableRenderers.js +2 -1
- package/dist/runtime/plugins/cel/env.d.ts +2 -2
- package/dist/runtime/plugins/cel/env.js +5 -4
- package/dist/runtime/plugins/cel/index.d.ts +3 -3
- package/dist/runtime/plugins/cel/index.js +7 -3
- package/dist/runtime/plugins/markdown/index.d.ts +1 -1
- package/dist/runtime/style.css +1 -1
- package/dist/runtime/table-renderers/builtins.js +213 -98
- package/dist/runtime/table-renderers/registry.d.ts +1 -0
- package/dist/runtime/table-renderers/registry.js +3 -0
- package/dist/runtime/utils/coders.d.ts +32 -0
- package/dist/runtime/utils/coders.js +64 -0
- package/dist/runtime/vendor/cel/index.d.ts +17 -0
- package/dist/runtime/vendor/cel/index.js +10 -0
- package/dist/runtime/vendor/cel-js/LICENSE +21 -0
- package/dist/runtime/vendor/cel-js/UPSTREAM.md +17 -0
- package/dist/runtime/vendor/cel-js/lib/errors.d.ts +21 -0
- package/dist/runtime/vendor/cel-js/lib/errors.js +97 -0
- package/dist/runtime/vendor/cel-js/lib/evaluator.d.ts +4 -0
- package/dist/runtime/vendor/cel-js/lib/evaluator.js +192 -0
- package/dist/runtime/vendor/cel-js/lib/functions.d.ts +53 -0
- package/dist/runtime/vendor/cel-js/lib/functions.js +513 -0
- package/dist/runtime/vendor/cel-js/lib/globals.d.ts +27 -0
- package/dist/runtime/vendor/cel-js/lib/globals.js +33 -0
- package/dist/runtime/vendor/cel-js/lib/index.d.ts +469 -0
- package/dist/runtime/vendor/cel-js/lib/index.js +18 -0
- package/dist/runtime/vendor/cel-js/lib/macros.d.ts +1 -0
- package/dist/runtime/vendor/cel-js/lib/macros.js +230 -0
- package/dist/runtime/vendor/cel-js/lib/operators.d.ts +117 -0
- package/dist/runtime/vendor/cel-js/lib/operators.js +739 -0
- package/dist/runtime/vendor/cel-js/lib/optional.d.ts +14 -0
- package/dist/runtime/vendor/cel-js/lib/optional.js +161 -0
- package/dist/runtime/vendor/cel-js/lib/options.d.ts +23 -0
- package/dist/runtime/vendor/cel-js/lib/options.js +47 -0
- package/dist/runtime/vendor/cel-js/lib/overloads.d.ts +1 -0
- package/dist/runtime/vendor/cel-js/lib/overloads.js +214 -0
- package/dist/runtime/vendor/cel-js/lib/parser.d.ts +56 -0
- package/dist/runtime/vendor/cel-js/lib/parser.js +827 -0
- package/dist/runtime/vendor/cel-js/lib/registry.d.ts +279 -0
- package/dist/runtime/vendor/cel-js/lib/registry.js +1596 -0
- package/dist/runtime/vendor/cel-js/lib/serialize.d.ts +1 -0
- package/dist/runtime/vendor/cel-js/lib/serialize.js +259 -0
- package/dist/runtime/vendor/cel-js/lib/type-checker.d.ts +26 -0
- package/dist/runtime/vendor/cel-js/lib/type-checker.js +81 -0
- package/package.json +9 -4
- package/dist/runtime/components/locale.d.vue.ts +0 -14
- package/dist/runtime/components/locale.vue +0 -89
- package/dist/runtime/components/locale.vue.d.ts +0 -14
- package/dist/runtime/components/query.d.vue.ts +0 -30
- package/dist/runtime/components/query.vue +0 -266
- package/dist/runtime/components/query.vue.d.ts +0 -30
- package/dist/runtime/utilities/query-config/global.d.ts +0 -4
- package/dist/runtime/utilities/query-config/global.js +0 -18
- package/dist/runtime/utilities/query-config/index.d.ts +0 -3
- package/dist/runtime/utilities/query-config/index.js +0 -14
- package/dist/runtime/utilities/query-config/schema.d.ts +0 -96
- package/dist/runtime/utilities/query-config/schema.js +0 -51
- /package/dist/runtime/components/{logo.d.vue.ts → ui/logo/Logo.d.vue.ts} +0 -0
- /package/dist/runtime/components/{logo.vue → ui/logo/Logo.vue} +0 -0
- /package/dist/runtime/components/{logo.vue.d.ts → ui/logo/Logo.vue.d.ts} +0 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import {EvaluationError, ParseError} from './errors.js'
|
|
2
|
+
import {OPERATORS as OPS} from './operators.js'
|
|
3
|
+
const identity = (x) => x
|
|
4
|
+
|
|
5
|
+
function assertIdentifier(node, message) {
|
|
6
|
+
if (node.op === 'id') return node.args
|
|
7
|
+
throw new ParseError(message, node)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function createMapExpander(hasFilter) {
|
|
11
|
+
const functionDesc = hasFilter ? 'map(var, filter, transform)' : 'map(var, transform)'
|
|
12
|
+
const invalidMsg = `${functionDesc} invalid predicate iteration variable`
|
|
13
|
+
const label = `${functionDesc} filter predicate must return bool`
|
|
14
|
+
|
|
15
|
+
return ({args, receiver, ast: callAst}) => {
|
|
16
|
+
const [iterVar, predicate, transform] = hasFilter ? args : [args[0], null, args[1]]
|
|
17
|
+
|
|
18
|
+
let step = transform.clone(OPS.accuPush, transform)
|
|
19
|
+
if (predicate) {
|
|
20
|
+
const accuValue = predicate.clone(OPS.accuValue)
|
|
21
|
+
step = predicate.clone(OPS.ternary, [predicate.setMeta('label', label), step, accuValue])
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
callAst: callAst.clone(OPS.comprehension, {
|
|
26
|
+
errorsAreFatal: true,
|
|
27
|
+
iterable: receiver,
|
|
28
|
+
iterVarName: assertIdentifier(iterVar, invalidMsg),
|
|
29
|
+
init: callAst.clone(OPS.list, []),
|
|
30
|
+
step,
|
|
31
|
+
result: identity
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function createFilterExpander() {
|
|
38
|
+
const functionDesc = 'filter(var, predicate)'
|
|
39
|
+
const invalidMsg = `${functionDesc} invalid predicate iteration variable`
|
|
40
|
+
const label = `${functionDesc} predicate must return bool`
|
|
41
|
+
|
|
42
|
+
return ({args, receiver, ast: callAst}) => {
|
|
43
|
+
const iterVarName = assertIdentifier(args[0], invalidMsg)
|
|
44
|
+
const accuValue = callAst.clone(OPS.accuValue)
|
|
45
|
+
const predicate = args[1].setMeta('label', label)
|
|
46
|
+
const appendItem = callAst.clone(OPS.accuPush, callAst.clone(OPS.id, iterVarName))
|
|
47
|
+
const step = predicate.clone(OPS.ternary, [predicate, appendItem, accuValue])
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
callAst: callAst.clone(OPS.comprehension, {
|
|
51
|
+
errorsAreFatal: true,
|
|
52
|
+
iterable: receiver,
|
|
53
|
+
iterVarName,
|
|
54
|
+
init: callAst.clone(OPS.list, []),
|
|
55
|
+
step,
|
|
56
|
+
result: identity
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function createQuantifierExpander(opts) {
|
|
63
|
+
const invalidMsg = `${opts.name}(var, predicate) invalid predicate iteration variable`
|
|
64
|
+
const label = `${opts.name}(var, predicate) predicate must return bool`
|
|
65
|
+
return ({args, receiver, ast: callAst}) => {
|
|
66
|
+
const predicate = args[1].setMeta('label', label)
|
|
67
|
+
const transform = opts.transform({args, ast: callAst, predicate, opts})
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
callAst: callAst.clone(OPS.comprehension, {
|
|
71
|
+
kind: 'quantifier',
|
|
72
|
+
errorsAreFatal: opts.errorsAreFatal || false,
|
|
73
|
+
iterable: receiver,
|
|
74
|
+
iterVarName: assertIdentifier(args[0], invalidMsg),
|
|
75
|
+
init: transform.init,
|
|
76
|
+
condition: transform.condition,
|
|
77
|
+
step: transform.step,
|
|
78
|
+
result: transform.result || identity
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function createHasExpander() {
|
|
85
|
+
const invalidHasArgument = 'has() invalid argument'
|
|
86
|
+
|
|
87
|
+
function evaluate(ev, macro, ctx) {
|
|
88
|
+
const nodes = macro.macroHasProps
|
|
89
|
+
let i = nodes.length
|
|
90
|
+
let obj = ev.eval(nodes[--i], ctx)
|
|
91
|
+
let inOptionalContext
|
|
92
|
+
while (i--) {
|
|
93
|
+
const node = nodes[i]
|
|
94
|
+
if (node.op === '.?') inOptionalContext ??= true
|
|
95
|
+
obj = ev.debugType(obj).fieldLazy(obj, node.args[1], node, ev)
|
|
96
|
+
if (obj !== undefined) continue
|
|
97
|
+
if (!(!inOptionalContext && i && node.op === '.')) break
|
|
98
|
+
throw new EvaluationError(`No such key: ${node.args[1]}`, node)
|
|
99
|
+
}
|
|
100
|
+
return obj !== undefined
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function typeCheck(checker, macro, ctx) {
|
|
104
|
+
let node = macro.args[0]
|
|
105
|
+
if (node.op !== '.') throw new checker.Error(invalidHasArgument, node)
|
|
106
|
+
if (!macro.macroHasProps) {
|
|
107
|
+
const props = []
|
|
108
|
+
while (node.op === '.' || node.op === '.?') node = props.push(node) && node.args[0]
|
|
109
|
+
if (node.op !== 'id') throw new checker.Error(invalidHasArgument, node)
|
|
110
|
+
checker.check(node, ctx)
|
|
111
|
+
props.push(node)
|
|
112
|
+
macro.macroHasProps = props
|
|
113
|
+
}
|
|
114
|
+
return checker.getType('bool')
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return function ({args}) {
|
|
118
|
+
return {args, evaluate, typeCheck, async: false}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function registerMacros(registry) {
|
|
123
|
+
const functionOverload = (sig, handler) => registry.registerFunctionOverload(sig, handler)
|
|
124
|
+
|
|
125
|
+
functionOverload('has(ast): bool', createHasExpander())
|
|
126
|
+
|
|
127
|
+
functionOverload(
|
|
128
|
+
'list.all(ast, ast): bool',
|
|
129
|
+
createQuantifierExpander({
|
|
130
|
+
name: 'all',
|
|
131
|
+
transform({ast: callAst, predicate, opts}) {
|
|
132
|
+
return {
|
|
133
|
+
init: callAst.clone(OPS.value, true),
|
|
134
|
+
condition: identity,
|
|
135
|
+
step: predicate.clone(OPS.ternary, [
|
|
136
|
+
predicate,
|
|
137
|
+
predicate.clone(OPS.value, true),
|
|
138
|
+
predicate.clone(OPS.value, false)
|
|
139
|
+
])
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
functionOverload(
|
|
146
|
+
'list.exists(ast, ast): bool',
|
|
147
|
+
createQuantifierExpander({
|
|
148
|
+
name: 'exists',
|
|
149
|
+
condition(accu) {
|
|
150
|
+
return !accu
|
|
151
|
+
},
|
|
152
|
+
transform({ast: callAst, predicate, opts}) {
|
|
153
|
+
return {
|
|
154
|
+
init: callAst.clone(OPS.value, false),
|
|
155
|
+
condition: opts.condition,
|
|
156
|
+
step: predicate.clone(OPS.ternary, [
|
|
157
|
+
predicate,
|
|
158
|
+
predicate.clone(OPS.value, true),
|
|
159
|
+
predicate.clone(OPS.value, false)
|
|
160
|
+
])
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
functionOverload(
|
|
167
|
+
'list.exists_one(ast, ast): bool',
|
|
168
|
+
createQuantifierExpander({
|
|
169
|
+
name: 'exists_one',
|
|
170
|
+
errorsAreFatal: true,
|
|
171
|
+
result(accu) {
|
|
172
|
+
return accu === 1
|
|
173
|
+
},
|
|
174
|
+
transform({ast: callAst, predicate, opts}) {
|
|
175
|
+
const accuValue = callAst.clone(OPS.accuValue)
|
|
176
|
+
return {
|
|
177
|
+
init: callAst.clone(OPS.value, 0),
|
|
178
|
+
step: predicate.clone(OPS.ternary, [predicate, callAst.clone(OPS.accuInc), accuValue]),
|
|
179
|
+
result: opts.result
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
functionOverload('list.map(ast, ast): list<dyn>', createMapExpander(false))
|
|
186
|
+
functionOverload('list.map(ast, ast, ast): list<dyn>', createMapExpander(true))
|
|
187
|
+
functionOverload('list.filter(ast, ast): list<dyn>', createFilterExpander())
|
|
188
|
+
|
|
189
|
+
class CelNamespace {}
|
|
190
|
+
const celNamespace = new CelNamespace()
|
|
191
|
+
registry.registerType('CelNamespace', CelNamespace)
|
|
192
|
+
registry.registerConstant('cel', 'CelNamespace', celNamespace)
|
|
193
|
+
|
|
194
|
+
function bindTypeCheck(checker, m, ctx) {
|
|
195
|
+
m.bindCtx = ctx.forkWithVariable(m.var, checker.check(m.val, ctx))
|
|
196
|
+
const type = checker.check(m.exp, m.bindCtx)
|
|
197
|
+
if (m.val.maybeAsync || m.exp.maybeAsync) return type
|
|
198
|
+
m.ast.setMeta('async', false)
|
|
199
|
+
m.evaluate = bindEvaluateSync
|
|
200
|
+
return type
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function bindOptionalEvaluate(ev, exp, bindCtx, ctx, boundValue) {
|
|
204
|
+
const res = ev.eval(exp, (ctx = bindCtx.reuse(ctx).setIterValue(boundValue, ev)))
|
|
205
|
+
if (res instanceof Promise && ctx === bindCtx) ctx.async = true
|
|
206
|
+
return res
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function bindEvaluate(ev, {val, exp, bindCtx}, ctx) {
|
|
210
|
+
const v = ev.eval(val, ctx)
|
|
211
|
+
if (v instanceof Promise) return v.then((_v) => bindOptionalEvaluate(ev, exp, bindCtx, ctx, _v))
|
|
212
|
+
return bindOptionalEvaluate(ev, exp, bindCtx, ctx, v)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function bindEvaluateSync(ev, {val, exp, bindCtx}, ctx) {
|
|
216
|
+
return ev.eval(exp, bindCtx.reuse(ctx).setIterValue(ev.eval(val, ctx), ev))
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
functionOverload('CelNamespace.bind(ast, dyn, ast): dyn', ({ast, args}) => {
|
|
220
|
+
return {
|
|
221
|
+
ast,
|
|
222
|
+
var: assertIdentifier(args[0], 'invalid variable argument'),
|
|
223
|
+
val: args[1],
|
|
224
|
+
exp: args[2],
|
|
225
|
+
bindCtx: undefined,
|
|
226
|
+
typeCheck: bindTypeCheck,
|
|
227
|
+
evaluate: bindEvaluate
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export class Base {
|
|
2
|
+
constructor(opts: any);
|
|
3
|
+
dynType: import("./registry.js.js").TypeDeclaration;
|
|
4
|
+
optionalType: any;
|
|
5
|
+
stringType: import("./registry.js.js").TypeDeclaration;
|
|
6
|
+
intType: import("./registry.js.js").TypeDeclaration;
|
|
7
|
+
doubleType: import("./registry.js.js").TypeDeclaration;
|
|
8
|
+
boolType: import("./registry.js.js").TypeDeclaration;
|
|
9
|
+
nullType: import("./registry.js.js").TypeDeclaration;
|
|
10
|
+
listType: import("./registry.js.js").TypeDeclaration;
|
|
11
|
+
mapType: import("./registry.js.js").TypeDeclaration;
|
|
12
|
+
opts: any;
|
|
13
|
+
registry: any;
|
|
14
|
+
objectTypes: any;
|
|
15
|
+
objectTypesByConstructor: any;
|
|
16
|
+
/**
|
|
17
|
+
* Get a TypeDeclaration instance for a type name
|
|
18
|
+
* @param {string} typeName - The type name (e.g., 'string', 'int', 'dyn')
|
|
19
|
+
* @returns {TypeDeclaration} The type declaration instance
|
|
20
|
+
*/
|
|
21
|
+
getType(typeName: string): TypeDeclaration;
|
|
22
|
+
debugType(v: any): any;
|
|
23
|
+
}
|
|
24
|
+
export const OPERATORS: {
|
|
25
|
+
value: {
|
|
26
|
+
check(chk: any, ast: any): any;
|
|
27
|
+
evaluate(_ev: any, ast: any): any;
|
|
28
|
+
};
|
|
29
|
+
id: {
|
|
30
|
+
check(chk: any, ast: any, ctx: any): any;
|
|
31
|
+
evaluate(ev: any, ast: any, ctx: any): any;
|
|
32
|
+
};
|
|
33
|
+
'.': {
|
|
34
|
+
alias: string;
|
|
35
|
+
check: typeof checkAccessNode;
|
|
36
|
+
evaluate: typeof evaluateBinaryFirst;
|
|
37
|
+
};
|
|
38
|
+
'.?': {
|
|
39
|
+
alias: string;
|
|
40
|
+
check: typeof checkOptionalAccessNode;
|
|
41
|
+
evaluate: typeof evaluateBinaryFirst;
|
|
42
|
+
};
|
|
43
|
+
'[]': {
|
|
44
|
+
alias: string;
|
|
45
|
+
check: typeof checkAccessNode;
|
|
46
|
+
evaluate: typeof evaluateBinary;
|
|
47
|
+
};
|
|
48
|
+
'[?]': {
|
|
49
|
+
alias: string;
|
|
50
|
+
check: typeof checkOptionalAccessNode;
|
|
51
|
+
evaluate: typeof evaluateBinary;
|
|
52
|
+
};
|
|
53
|
+
call: {
|
|
54
|
+
check(chk: any, ast: any, ctx: any): any;
|
|
55
|
+
evaluate(ev: any, ast: any, ctx: any): any;
|
|
56
|
+
};
|
|
57
|
+
rcall: {
|
|
58
|
+
check(chk: any, ast: any, ctx: any): any;
|
|
59
|
+
evaluate(ev: any, ast: any, ctx: any): any;
|
|
60
|
+
};
|
|
61
|
+
list: {
|
|
62
|
+
check(chk: any, ast: any, ctx: any): any;
|
|
63
|
+
evaluate(ev: any, ast: any, ctx: any): any[] | Promise<any[]>;
|
|
64
|
+
};
|
|
65
|
+
map: {
|
|
66
|
+
check(chk: any, ast: any, ctx: any): any;
|
|
67
|
+
evaluate(ev: any, ast: any, ctx: any): {};
|
|
68
|
+
};
|
|
69
|
+
comprehension: {
|
|
70
|
+
check(chk: any, ast: any, ctx: any): any;
|
|
71
|
+
evaluate(ev: any, ast: any, ctx: any): any;
|
|
72
|
+
};
|
|
73
|
+
accuValue: {
|
|
74
|
+
check(_chk: any, _ast: any, ctx: any): any;
|
|
75
|
+
evaluate(_ev: any, _ast: any, ctx: any): any;
|
|
76
|
+
};
|
|
77
|
+
accuInc: {
|
|
78
|
+
check(_chk: any, _ast: any, ctx: any): any;
|
|
79
|
+
evaluate(_ev: any, _ast: any, ctx: any): any;
|
|
80
|
+
};
|
|
81
|
+
accuPush: {
|
|
82
|
+
check(chk: any, ast: any, ctx: any): any;
|
|
83
|
+
evaluateSync(ev: any, ast: any, ctx: any): any;
|
|
84
|
+
evaluate(ev: any, ast: any, ctx: any): any;
|
|
85
|
+
};
|
|
86
|
+
'?:': {
|
|
87
|
+
alias: string;
|
|
88
|
+
check(chk: any, ast: any, ctx: any): any;
|
|
89
|
+
evaluate(ev: any, ast: any, ctx: any): any;
|
|
90
|
+
};
|
|
91
|
+
'||': {
|
|
92
|
+
check: typeof checkLogicalOp;
|
|
93
|
+
evaluate(ev: any, ast: any, ctx: any): any;
|
|
94
|
+
};
|
|
95
|
+
'&&': {
|
|
96
|
+
check: typeof checkLogicalOp;
|
|
97
|
+
evaluate(ev: any, ast: any, ctx: any): any;
|
|
98
|
+
};
|
|
99
|
+
'!_': {
|
|
100
|
+
alias: string;
|
|
101
|
+
check: typeof checkUnary;
|
|
102
|
+
evaluate: typeof evaluateUnary;
|
|
103
|
+
};
|
|
104
|
+
'-_': {
|
|
105
|
+
alias: string;
|
|
106
|
+
check: typeof checkUnary;
|
|
107
|
+
evaluate: typeof evaluateUnary;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
declare function checkAccessNode(chk: any, ast: any, ctx: any): any;
|
|
111
|
+
declare function evaluateBinaryFirst(ev: any, ast: any, ctx: any): any;
|
|
112
|
+
declare function checkOptionalAccessNode(chk: any, ast: any, ctx: any): any;
|
|
113
|
+
declare function evaluateBinary(ev: any, ast: any, ctx: any): any;
|
|
114
|
+
declare function checkLogicalOp(chk: any, ast: any, ctx: any): any;
|
|
115
|
+
declare function checkUnary(chk: any, ast: any, ctx: any): any;
|
|
116
|
+
declare function evaluateUnary(ev: any, ast: any, ctx: any): any;
|
|
117
|
+
export {};
|