@xanots/sdk 0.0.1
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/LICENSE +21 -0
- package/README.md +384 -0
- package/dist/agent-file-refresh-7XCACU34.js +95 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +184 -0
- package/dist/capture-HUV5BNTC.js +32 -0
- package/dist/chunk-26CNBZE2.js +963 -0
- package/dist/chunk-33ND6LKO.js +78 -0
- package/dist/chunk-3DUAGYGP.js +1550 -0
- package/dist/chunk-3IGNIP6R.js +89 -0
- package/dist/chunk-47WDWMBJ.js +14 -0
- package/dist/chunk-4BXJGVZ3.js +318 -0
- package/dist/chunk-4HT3BNZ7.js +675 -0
- package/dist/chunk-4YMD2OOZ.js +23 -0
- package/dist/chunk-5WGEURVI.js +156 -0
- package/dist/chunk-5YTBTF25.js +29 -0
- package/dist/chunk-6DHBYBTO.js +166 -0
- package/dist/chunk-76QBEIGO.js +66 -0
- package/dist/chunk-7DKX2SPN.js +100 -0
- package/dist/chunk-7REDODS2.js +468 -0
- package/dist/chunk-C56BC2FY.js +254 -0
- package/dist/chunk-DGSF2Q5H.js +60 -0
- package/dist/chunk-EMCAWMHC.js +3982 -0
- package/dist/chunk-EZG76F7R.js +159 -0
- package/dist/chunk-FJ6ZS5KB.js +3607 -0
- package/dist/chunk-GNPVYOPB.js +17 -0
- package/dist/chunk-HJPTWBLH.js +38 -0
- package/dist/chunk-IZW6MK3U.js +248 -0
- package/dist/chunk-LH6Z6KFV.js +247 -0
- package/dist/chunk-MZUI3JNX.js +93 -0
- package/dist/chunk-NDZFBZHC.js +167 -0
- package/dist/chunk-NOO35BQ2.js +37 -0
- package/dist/chunk-NUQCEOKA.js +13 -0
- package/dist/chunk-QTNO2WD6.js +56 -0
- package/dist/chunk-RVB7ITKN.js +49 -0
- package/dist/chunk-TRU5OHQ5.js +6904 -0
- package/dist/chunk-VKFQJEMW.js +814 -0
- package/dist/chunk-VTIL47DT.js +125 -0
- package/dist/chunk-WHOJWOSV.js +112 -0
- package/dist/chunk-WKP4D5MO.js +1692 -0
- package/dist/chunk-X4DVXBFY.js +38 -0
- package/dist/chunk-XQ22GLYS.js +118 -0
- package/dist/chunk-YDZYMZBE.js +670 -0
- package/dist/chunk-YGPIY3WT.js +1146 -0
- package/dist/chunk-YYRDLFSJ.js +602 -0
- package/dist/chunk-ZUTSMMAG.js +46 -0
- package/dist/cli.d.ts +331 -0
- package/dist/cli.js +33 -0
- package/dist/codegen-command-OOKK6AZK.js +40 -0
- package/dist/codegen.d.ts +114 -0
- package/dist/codegen.js +71 -0
- package/dist/completion-TIPPZN7H.js +298 -0
- package/dist/config-NL33PN4D.js +84 -0
- package/dist/deploy-command-4EQ7XX5G.js +451 -0
- package/dist/env-target-IFJ5QDHC.js +16 -0
- package/dist/ephemeral-command-3X3I4ULC.js +242 -0
- package/dist/index.d.ts +4477 -0
- package/dist/index.js +300 -0
- package/dist/init-command-R6H7ZXW5.js +27 -0
- package/dist/internal.d.ts +74 -0
- package/dist/internal.js +2065 -0
- package/dist/io-AMIKRLPC.js +11 -0
- package/dist/live-diff-Y3AKETHE.js +196 -0
- package/dist/lock-3CVKALKT.js +37 -0
- package/dist/lock-commands-XTR2YKLY.js +232 -0
- package/dist/login-command-ACJF6KWQ.js +167 -0
- package/dist/logout-command-MX3MJS5U.js +68 -0
- package/dist/loop-OM3P2Z6O.js +93 -0
- package/dist/marketplace-command-RATXTKXN.js +379 -0
- package/dist/meta-client-OW5WKWW7.js +170 -0
- package/dist/node.d.ts +59 -0
- package/dist/node.js +442 -0
- package/dist/profile-command-SWJ3SPKR.js +77 -0
- package/dist/release-command-VV5UVZKL.js +427 -0
- package/dist/response-CVAE2kMj.d.ts +1915 -0
- package/dist/routes-manifest-SP3ZXLMR.js +244 -0
- package/dist/runtime-V4C3AC3A.js +13 -0
- package/dist/sandbox-details-command-HJE5SPVG.js +18 -0
- package/dist/sandbox-export-command-QCJY4GMV.js +24 -0
- package/dist/static-host-D6KS7X45.js +138 -0
- package/dist/store-BQ97nKIF.d.ts +7760 -0
- package/dist/test-command-TSPBQHBM.js +383 -0
- package/dist/validate-command-4ERHJSCO.js +122 -0
- package/dist/verify-rollout-FAVQ6EJY.js +40 -0
- package/dist/workspace-K72NP7SX.js +49 -0
- package/dist/workspace-command-OF23DPNI.js +156 -0
- package/dist/workspace-export-AJMGN3CQ.js +10 -0
- package/llms/fields.md +104 -0
- package/llms/filters.md +183 -0
- package/llms/kinds-agent-mcp.md +11 -0
- package/llms/kinds-core.md +68 -0
- package/llms/kinds-realtime.md +76 -0
- package/llms/lambda.md +111 -0
- package/llms/legacy.md +43 -0
- package/llms/object-kinds.md +31 -0
- package/llms/statements-calls.md +23 -0
- package/llms/statements-catalog.md +309 -0
- package/llms/statements-data.md +58 -0
- package/llms/statements-runtime.md +48 -0
- package/llms/tests.md +58 -0
- package/llms/triggers.md +22 -0
- package/llms/values.md +29 -0
- package/llms-full.txt +1672 -0
- package/llms.txt +483 -0
- package/manifest.json +9592 -0
- package/package.json +110 -0
|
@@ -0,0 +1,3607 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SCALAR_FAMILY,
|
|
3
|
+
and,
|
|
4
|
+
assertCanonical,
|
|
5
|
+
assertInputValue,
|
|
6
|
+
assertLambdaStatement,
|
|
7
|
+
assertStoredName,
|
|
8
|
+
barePatternRefusal,
|
|
9
|
+
buildWorkspaceHistory,
|
|
10
|
+
c,
|
|
11
|
+
coerceLambdaFields,
|
|
12
|
+
conditional,
|
|
13
|
+
encodeContainerHistory,
|
|
14
|
+
encodeExpression,
|
|
15
|
+
encodeHistory,
|
|
16
|
+
encodeInput,
|
|
17
|
+
encodeMiddlewareList,
|
|
18
|
+
encodeResponse,
|
|
19
|
+
encodeRuntimeCondition,
|
|
20
|
+
encodeTags,
|
|
21
|
+
f,
|
|
22
|
+
filter,
|
|
23
|
+
inp,
|
|
24
|
+
input,
|
|
25
|
+
isCmpNode,
|
|
26
|
+
isGroup,
|
|
27
|
+
isMixed,
|
|
28
|
+
isTaggedValue,
|
|
29
|
+
isValue,
|
|
30
|
+
leanInput,
|
|
31
|
+
obj,
|
|
32
|
+
ref,
|
|
33
|
+
registerKind,
|
|
34
|
+
tableColumns,
|
|
35
|
+
withFilters
|
|
36
|
+
} from "./chunk-EMCAWMHC.js";
|
|
37
|
+
import {
|
|
38
|
+
assertPathParamInputs,
|
|
39
|
+
fillPathParams,
|
|
40
|
+
parsePathParams
|
|
41
|
+
} from "./chunk-WHOJWOSV.js";
|
|
42
|
+
import {
|
|
43
|
+
annotate,
|
|
44
|
+
encodeStatement,
|
|
45
|
+
isRegisteredStatement,
|
|
46
|
+
registerStatement
|
|
47
|
+
} from "./chunk-LH6Z6KFV.js";
|
|
48
|
+
import {
|
|
49
|
+
deriveGuid,
|
|
50
|
+
realtimeChannelSeedName,
|
|
51
|
+
resolveRef
|
|
52
|
+
} from "./chunk-4HT3BNZ7.js";
|
|
53
|
+
|
|
54
|
+
// src/statements/set-var.ts
|
|
55
|
+
var SET_VAR = "mvp:set_var";
|
|
56
|
+
var UPDATE_VAR = "mvp:update_var";
|
|
57
|
+
function setVar(as, value, a) {
|
|
58
|
+
return annotate(
|
|
59
|
+
{
|
|
60
|
+
name: SET_VAR,
|
|
61
|
+
as,
|
|
62
|
+
context: { value: value.value, tag: value.tag, filters: value.filters }
|
|
63
|
+
},
|
|
64
|
+
a
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
function updateVar(name, value, a) {
|
|
68
|
+
return annotate(
|
|
69
|
+
{
|
|
70
|
+
name: UPDATE_VAR,
|
|
71
|
+
context: { name, value: value.value, tag: value.tag, filters: value.filters },
|
|
72
|
+
output: { filters: [] }
|
|
73
|
+
},
|
|
74
|
+
a
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
registerStatement(SET_VAR, setVar);
|
|
78
|
+
registerStatement(UPDATE_VAR, updateVar);
|
|
79
|
+
|
|
80
|
+
// src/statements/special/db-search.ts
|
|
81
|
+
var CONSTANT_WHERE_TAGS = /* @__PURE__ */ new Set([
|
|
82
|
+
"const:bool",
|
|
83
|
+
"const:int",
|
|
84
|
+
"const:decimal",
|
|
85
|
+
"const:null",
|
|
86
|
+
"const:epochms"
|
|
87
|
+
]);
|
|
88
|
+
function encodeSearch(where, additionalWhere) {
|
|
89
|
+
const nodes = [];
|
|
90
|
+
let raw;
|
|
91
|
+
for (const [field, w] of [["where", where], ["additionalWhere", additionalWhere]]) {
|
|
92
|
+
if (!w) continue;
|
|
93
|
+
if (Array.isArray(w)) nodes.push(...w);
|
|
94
|
+
else if (isGroup(w) || isMixed(w) || isCmpNode(w)) nodes.push(w);
|
|
95
|
+
else if (isValue(w)) {
|
|
96
|
+
if (CONSTANT_WHERE_TAGS.has(w.tag)) {
|
|
97
|
+
throw new Error(
|
|
98
|
+
`db search: \`${field}\` is the constant ${w.tag}:${JSON.stringify(w.value)}, which cannot be a search clause \u2014 a fixed literal states no condition, and the engine reads the resulting \`context.search\` as neither a predicate nor an absent one. To match EVERY row, omit \`${field}\` entirely (an empty search is how "no filter" is spelled). To filter, use expr(col("x"), "=", \u2026), cmp(...), or an and()/or() group. The raw Value form is the escape hatch for a clause built elsewhere \u2014 inp("clause"), ref("built_where"), or an expression value \u2014 not for a literal. (issue #51)`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
raw = w;
|
|
102
|
+
} else {
|
|
103
|
+
throw new Error(
|
|
104
|
+
"db search: `where` must be an expr(...)/cmp(...) comparison, an and()/or() group, an array of those, or a tagged Value (inp/ref/col/c.*) \u2014 got an object that is neither. Check for a typo (e.g. `operator` instead of `op`)."
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (raw !== void 0 && nodes.length) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
"db search: a raw Value `where` cannot be combined with expr()/cmp()/and()/or() clauses \u2014 use one form or the other."
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
if (nodes.length) return encodeExpression(nodes);
|
|
114
|
+
if (raw !== void 0) return raw;
|
|
115
|
+
return void 0;
|
|
116
|
+
}
|
|
117
|
+
function encodeSort(sort) {
|
|
118
|
+
return (sort ?? []).map((s2) => ({ sortBy: s2.sortBy, orderBy: s2.dir ?? "asc" }));
|
|
119
|
+
}
|
|
120
|
+
function encodeEval(evals) {
|
|
121
|
+
if (!evals?.length) return void 0;
|
|
122
|
+
return evals.map((e) => ({
|
|
123
|
+
as: e.as,
|
|
124
|
+
name: e.name,
|
|
125
|
+
filters: (e.filters ?? []).map((f2) => ({
|
|
126
|
+
name: f2.name,
|
|
127
|
+
arg: (f2.arg ?? []).map((v) => ({ value: v.value, tag: v.tag, filters: v.filters })),
|
|
128
|
+
...f2.disabled ? { disabled: true } : {}
|
|
129
|
+
}))
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
function qualifyAggregateEvals(evals, primaryAlias, kind) {
|
|
133
|
+
if (!evals?.length) return evals;
|
|
134
|
+
return evals.map((e) => {
|
|
135
|
+
const name = e.name.includes(".") ? e.name : `${primaryAlias}.${e.name}`;
|
|
136
|
+
if (!/^[^.]+\.[^.].*$/.test(name)) {
|
|
137
|
+
throw new Error(
|
|
138
|
+
`${kind === "query eval" ? "db.query eval" : `aggregate ${kind}`}: name "${e.name}" must be an alias-qualified column (e.g. "${primaryAlias || "<table>"}.${e.name}") \u2014 the engine rejects a bare column name there (\`Unsupported param format\`). Qualify it with the table alias, or the bind alias for a joined column.`
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
return { ...e, name };
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/statements/special/control-flow.ts
|
|
146
|
+
function asValue(arg) {
|
|
147
|
+
return "tag" in arg ? arg : arg.value;
|
|
148
|
+
}
|
|
149
|
+
function valueContext(arg) {
|
|
150
|
+
const value = asValue(arg);
|
|
151
|
+
return { value: value.value, tag: value.tag, filters: value.filters };
|
|
152
|
+
}
|
|
153
|
+
function returnValue(value, a) {
|
|
154
|
+
return annotate({ name: "mvp:return", context: valueContext(value) }, a);
|
|
155
|
+
}
|
|
156
|
+
function die(value, a) {
|
|
157
|
+
return annotate({ name: "mvp:die", context: valueContext(value) }, a);
|
|
158
|
+
}
|
|
159
|
+
function debugLog(value, a) {
|
|
160
|
+
return annotate({ name: "mvp:debug_log", context: valueContext(value) }, a);
|
|
161
|
+
}
|
|
162
|
+
function foreachBreak(a) {
|
|
163
|
+
return annotate({ name: "mvp:foreach_break", context: {} }, a);
|
|
164
|
+
}
|
|
165
|
+
function foreachContinue(a) {
|
|
166
|
+
return annotate({ name: "mvp:foreach_continue", context: {} }, a);
|
|
167
|
+
}
|
|
168
|
+
function foreachRemove(a) {
|
|
169
|
+
return annotate({ name: "mvp:foreach_remove", context: {} }, a);
|
|
170
|
+
}
|
|
171
|
+
registerStatement("mvp:return", returnValue);
|
|
172
|
+
registerStatement("mvp:die", die);
|
|
173
|
+
registerStatement("mvp:debug_log", debugLog);
|
|
174
|
+
registerStatement("mvp:foreach_break", foreachBreak);
|
|
175
|
+
registerStatement("mvp:foreach_continue", foreachContinue);
|
|
176
|
+
registerStatement("mvp:foreach_remove", foreachRemove);
|
|
177
|
+
|
|
178
|
+
// src/statements/special/loops.ts
|
|
179
|
+
function valueFields(v) {
|
|
180
|
+
return { value: v.value, tag: v.tag, filters: v.filters };
|
|
181
|
+
}
|
|
182
|
+
function run(body) {
|
|
183
|
+
return body.map(encodeStatement);
|
|
184
|
+
}
|
|
185
|
+
function forLoop(args) {
|
|
186
|
+
return annotate({
|
|
187
|
+
name: "mvp:for",
|
|
188
|
+
context: { as: args.as, cnt: valueFields(args.count), run: run(args.body) },
|
|
189
|
+
input: []
|
|
190
|
+
}, args);
|
|
191
|
+
}
|
|
192
|
+
function foreachLoop(args) {
|
|
193
|
+
return annotate({
|
|
194
|
+
name: "mvp:foreach",
|
|
195
|
+
context: { as: args.as, list: valueFields(args.list), run: run(args.body) },
|
|
196
|
+
input: []
|
|
197
|
+
}, args);
|
|
198
|
+
}
|
|
199
|
+
function whileLoop(args) {
|
|
200
|
+
return annotate({
|
|
201
|
+
name: "mvp:while",
|
|
202
|
+
context: { expr: encodeRuntimeCondition(args.when, "s.while `when`"), run: run(args.body) },
|
|
203
|
+
input: []
|
|
204
|
+
}, args);
|
|
205
|
+
}
|
|
206
|
+
function group(body, a) {
|
|
207
|
+
return annotate({ name: "mvp:group", context: { run: run(body) }, input: [] }, a);
|
|
208
|
+
}
|
|
209
|
+
registerStatement("mvp:for", forLoop);
|
|
210
|
+
registerStatement("mvp:foreach", foreachLoop);
|
|
211
|
+
registerStatement("mvp:while", whileLoop);
|
|
212
|
+
registerStatement("mvp:group", group);
|
|
213
|
+
|
|
214
|
+
// src/statements/special/branch.ts
|
|
215
|
+
function valueFields2(v) {
|
|
216
|
+
return { value: v.value, tag: v.tag, filters: v.filters };
|
|
217
|
+
}
|
|
218
|
+
function run2(body) {
|
|
219
|
+
return body.map(encodeStatement);
|
|
220
|
+
}
|
|
221
|
+
function switchCase(args) {
|
|
222
|
+
const context = { value: valueFields2(args.when) };
|
|
223
|
+
if (args.break !== void 0) {
|
|
224
|
+
context.break = args.break;
|
|
225
|
+
}
|
|
226
|
+
context.if = { run: run2(args.body) };
|
|
227
|
+
return annotate({ name: "mvp:switch_case", context, input: [] }, args);
|
|
228
|
+
}
|
|
229
|
+
function switchStatement(args) {
|
|
230
|
+
return annotate({
|
|
231
|
+
name: "mvp:switch",
|
|
232
|
+
context: {
|
|
233
|
+
value: valueFields2(args.on),
|
|
234
|
+
elif: { run: args.cases.map((c2) => encodeStatement(switchCase(c2))) },
|
|
235
|
+
else: { run: run2(args.default ?? []) }
|
|
236
|
+
},
|
|
237
|
+
input: []
|
|
238
|
+
}, args);
|
|
239
|
+
}
|
|
240
|
+
function tryCatch(args) {
|
|
241
|
+
return annotate({
|
|
242
|
+
name: "mvp:try_catch",
|
|
243
|
+
context: {
|
|
244
|
+
if: { run: run2(args.try) },
|
|
245
|
+
else: { run: run2(args.catch ?? []) },
|
|
246
|
+
then: { run: run2(args.finally ?? []) }
|
|
247
|
+
},
|
|
248
|
+
input: []
|
|
249
|
+
}, args);
|
|
250
|
+
}
|
|
251
|
+
registerStatement("mvp:switch", switchStatement);
|
|
252
|
+
registerStatement("mvp:switch_case", switchCase);
|
|
253
|
+
registerStatement("mvp:try_catch", tryCatch);
|
|
254
|
+
|
|
255
|
+
// src/statements/special/coerce.ts
|
|
256
|
+
function isValue2(w) {
|
|
257
|
+
return (typeof w === "object" || typeof w === "function") && w !== null && !Array.isArray(w) && "tag" in w && "value" in w;
|
|
258
|
+
}
|
|
259
|
+
var plain = (v) => {
|
|
260
|
+
if (typeof v !== "function") return v;
|
|
261
|
+
const { value, tag, filters } = v;
|
|
262
|
+
return { value, tag, filters };
|
|
263
|
+
};
|
|
264
|
+
var coerceText = (v) => v === void 0 ? void 0 : isValue2(v) ? plain(v) : c.text(v);
|
|
265
|
+
var coerceInt = (v) => v === void 0 ? void 0 : isValue2(v) ? plain(v) : c.int(v);
|
|
266
|
+
var coerceBool = (v) => v === void 0 ? void 0 : isValue2(v) ? plain(v) : c.bool(v);
|
|
267
|
+
var coerceObj = (v) => {
|
|
268
|
+
if (v === void 0) return void 0;
|
|
269
|
+
if (isTaggedValue(v)) return plain(v);
|
|
270
|
+
if (Array.isArray(v)) return c.obj(v);
|
|
271
|
+
const literals = {};
|
|
272
|
+
const valueEntries = [];
|
|
273
|
+
for (const [key, val] of Object.entries(v)) {
|
|
274
|
+
if (isTaggedValue(val)) valueEntries.push([key, val]);
|
|
275
|
+
else literals[key] = val;
|
|
276
|
+
}
|
|
277
|
+
const base = c.obj(literals);
|
|
278
|
+
if (valueEntries.length === 0) return base;
|
|
279
|
+
return withFilters(
|
|
280
|
+
base,
|
|
281
|
+
...valueEntries.map(([key, val]) => {
|
|
282
|
+
if (/[.[]/.test(key))
|
|
283
|
+
throw new Error(
|
|
284
|
+
`coerceObj: object key ${JSON.stringify(key)} carries a tagged value but contains "." or "[", which the engine's set filter reads as a nested path ("a.b" \u2192 {a:{b:\u2026}}) \u2014 the same key with a plain value would stay flat. Use a nested object, or a key without "." / "[".`
|
|
285
|
+
);
|
|
286
|
+
return filter("set", c.text(key), val);
|
|
287
|
+
})
|
|
288
|
+
);
|
|
289
|
+
};
|
|
290
|
+
var HEADER_NAME = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
291
|
+
var assertNoSplice = (line, what) => {
|
|
292
|
+
if (!/[\r\n]/.test(line)) return line;
|
|
293
|
+
throw new Error(
|
|
294
|
+
`headers: ${what} contains a newline, which would splice a second header into the request. Strip it, or send the content as the request body.`
|
|
295
|
+
);
|
|
296
|
+
};
|
|
297
|
+
var coerceHeaders = (v) => {
|
|
298
|
+
if (v === void 0) return void 0;
|
|
299
|
+
if (isTaggedValue(v)) return plain(v);
|
|
300
|
+
if (Array.isArray(v)) return c.array(v.map((line, i) => assertNoSplice(line, `line ${i}`)));
|
|
301
|
+
const entries = Object.entries(v);
|
|
302
|
+
const lines = [];
|
|
303
|
+
const computed = [];
|
|
304
|
+
for (const [name, val] of entries) {
|
|
305
|
+
if (!HEADER_NAME.test(name)) {
|
|
306
|
+
throw new Error(
|
|
307
|
+
`headers: ${JSON.stringify(name)} is not a valid header name. A header line is "Name: value", so a name carrying ":" , a space or a newline would splice a second header into the request. Use the token charset (letters, digits and !#$%&'*+-.^_\`|~).`
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
if (isValue2(val)) {
|
|
311
|
+
computed.push([name, plain(val)]);
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
lines.push(`${name}: ${assertNoSplice(val, `the value of ${JSON.stringify(name)}`)}`);
|
|
315
|
+
}
|
|
316
|
+
const base = c.array(lines);
|
|
317
|
+
if (computed.length === 0) return base;
|
|
318
|
+
return withFilters(
|
|
319
|
+
base,
|
|
320
|
+
...computed.map(
|
|
321
|
+
([name, val]) => filter("array_push", withFilters(c.text(`${name}: `), filter("concat", val)))
|
|
322
|
+
)
|
|
323
|
+
);
|
|
324
|
+
};
|
|
325
|
+
var coerceScalar = (v) => {
|
|
326
|
+
if (isValue2(v)) return plain(v);
|
|
327
|
+
if (typeof v === "number") return Number.isInteger(v) ? c.int(v) : c.decimal(v);
|
|
328
|
+
if (typeof v === "string") return c.text(v);
|
|
329
|
+
if (typeof v === "boolean") return c.bool(v);
|
|
330
|
+
return coerceObj(v);
|
|
331
|
+
};
|
|
332
|
+
function coerceHttpFields(a) {
|
|
333
|
+
return {
|
|
334
|
+
method: coerceText(a.method),
|
|
335
|
+
params: coerceObj(a.params),
|
|
336
|
+
headers: coerceHeaders(a.headers),
|
|
337
|
+
timeout: coerceInt(a.timeout),
|
|
338
|
+
follow_location: coerceBool(a.follow_location),
|
|
339
|
+
verify_host: coerceBool(a.verify_host),
|
|
340
|
+
verify_peer: coerceBool(a.verify_peer),
|
|
341
|
+
ca_certificate: coerceText(a.ca_certificate),
|
|
342
|
+
certificate: coerceText(a.certificate),
|
|
343
|
+
certificate_pass: coerceText(a.certificate_pass),
|
|
344
|
+
private_key: coerceText(a.private_key),
|
|
345
|
+
private_key_pass: coerceText(a.private_key_pass)
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function textState(v) {
|
|
349
|
+
if (v === void 0) return "empty";
|
|
350
|
+
if (typeof v === "string") return v === "" ? "empty" : "nonempty";
|
|
351
|
+
if (isValue2(v) && v.tag === "const") return v.value === "" ? "empty" : "nonempty";
|
|
352
|
+
return "unknown";
|
|
353
|
+
}
|
|
354
|
+
function boolState(v, engineDefault) {
|
|
355
|
+
if (v === void 0) return engineDefault ? "true" : "false";
|
|
356
|
+
if (typeof v === "boolean") return v ? "true" : "false";
|
|
357
|
+
if (isValue2(v) && v.tag === "const:bool") return v.value === "true" ? "true" : "false";
|
|
358
|
+
return "unknown";
|
|
359
|
+
}
|
|
360
|
+
function assertSslConsistency(label, a) {
|
|
361
|
+
const cert = textState(a.certificate);
|
|
362
|
+
const key = textState(a.private_key);
|
|
363
|
+
if (cert === "nonempty" && key === "empty")
|
|
364
|
+
throw new Error(`${label}: \`certificate\` requires \`private_key\` \u2014 a client certificate needs its matching key.`);
|
|
365
|
+
if (key === "nonempty" && cert === "empty")
|
|
366
|
+
throw new Error(`${label}: \`private_key\` requires \`certificate\` \u2014 a client key needs its matching certificate.`);
|
|
367
|
+
const ca = textState(a.ca_certificate);
|
|
368
|
+
const verifyPeer = boolState(a.verify_peer, true);
|
|
369
|
+
if (ca === "nonempty" && verifyPeer === "false")
|
|
370
|
+
throw new Error(`${label}: \`ca_certificate\` requires \`verify_peer: true\` \u2014 the engine only consults a CA cert when peer verification is on.`);
|
|
371
|
+
}
|
|
372
|
+
var CELL_KINDS = {
|
|
373
|
+
bool: { wants: "a boolean", takes: (x) => typeof x === "boolean", tag: (x) => c.bool(x) },
|
|
374
|
+
int: { wants: "a number", takes: (x) => typeof x === "number", tag: (x) => c.int(x) },
|
|
375
|
+
decimal: { wants: "a number", takes: (x) => typeof x === "number", tag: (x) => c.decimal(x) },
|
|
376
|
+
text: { wants: "a string", takes: (x) => typeof x === "string", tag: (x) => c.text(x) },
|
|
377
|
+
enum: {
|
|
378
|
+
wants: "a string or a number",
|
|
379
|
+
takes: (x) => typeof x === "string" || typeof x === "number",
|
|
380
|
+
tag: (x) => typeof x === "number" ? c.int(x) : c.text(x)
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
var CELL_KIND = {
|
|
384
|
+
...Object.fromEntries(
|
|
385
|
+
Object.entries(SCALAR_FAMILY).map(([type, family]) => [type, family === "epochms" ? "int" : family])
|
|
386
|
+
),
|
|
387
|
+
date: "text"
|
|
388
|
+
};
|
|
389
|
+
function coerceCell(table, col, cell) {
|
|
390
|
+
if (cell === null) return c.null();
|
|
391
|
+
const where = `db row: column "${col.name}" of table "${typeof table === "string" ? table : table.name}"`;
|
|
392
|
+
const isList = col.array === true || col.style?.type === "list";
|
|
393
|
+
const kind = isList ? void 0 : CELL_KIND[col.type];
|
|
394
|
+
if (kind === void 0) {
|
|
395
|
+
throw new Error(
|
|
396
|
+
`${where} is declared "${col.type}"${isList ? " (a list)" : ""}, which has no bare-literal form. Author it as a tagged value (\`c.obj({\u2026})\`, \`c.array([\u2026])\`, \`c.text(\u2026)\`) or pass the entry through \`data:\` instead.`
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
const spec2 = CELL_KINDS[kind];
|
|
400
|
+
if (!spec2.takes(cell)) {
|
|
401
|
+
throw new Error(
|
|
402
|
+
`${where} is declared "${col.type}", so its cell must be ${spec2.wants} \u2014 got ${typeof cell} (${JSON.stringify(cell)}). Fix the literal, or write the value you meant explicitly as a tagged value if the column's declared type is wrong.`
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
if (kind === "int" && !Number.isInteger(cell)) {
|
|
406
|
+
throw new Error(
|
|
407
|
+
`${where} is declared "${col.type}", so its cell must be a whole number \u2014 got ${String(cell)}. Round it, or change the column to \`f.decimal()\`.`
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
return spec2.tag(cell);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// src/statements/special/async-runtime.ts
|
|
414
|
+
function encodeAsyncRuntime(runtime) {
|
|
415
|
+
if (!runtime) return void 0;
|
|
416
|
+
if (runtime.mode !== "async-dedicated") return { mode: runtime.mode };
|
|
417
|
+
return {
|
|
418
|
+
mode: runtime.mode,
|
|
419
|
+
cpu: runtime.cpu ?? "",
|
|
420
|
+
memory: runtime.memory ?? "",
|
|
421
|
+
timeout: runtime.timeout === void 0 ? "" : String(runtime.timeout),
|
|
422
|
+
max_retry: runtime.maxRetry === void 0 ? "" : String(runtime.maxRetry)
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// src/statements/special/calls.ts
|
|
427
|
+
function vf(v) {
|
|
428
|
+
return { value: v.value, tag: v.tag, filters: v.filters };
|
|
429
|
+
}
|
|
430
|
+
function encodeCallInput(input2) {
|
|
431
|
+
if (!input2) return [];
|
|
432
|
+
return Object.entries(input2).map(([name, v]) => ({ name, ...vf(coerceScalar(v)) }));
|
|
433
|
+
}
|
|
434
|
+
function fnId(fn) {
|
|
435
|
+
return fn === null ? "" : resolveRef("function", fn);
|
|
436
|
+
}
|
|
437
|
+
function functionRun(args) {
|
|
438
|
+
return annotate({
|
|
439
|
+
name: "mvp:function",
|
|
440
|
+
context: { function: { id: fnId(args.fn) } },
|
|
441
|
+
as: args.as,
|
|
442
|
+
input: encodeCallInput(args.input),
|
|
443
|
+
runtime: encodeAsyncRuntime(args.runtime)
|
|
444
|
+
}, args);
|
|
445
|
+
}
|
|
446
|
+
function functionCall(args) {
|
|
447
|
+
return annotate({
|
|
448
|
+
name: "mvp:workspace_run_function",
|
|
449
|
+
context: { id: resolveRef("function", args.fn) },
|
|
450
|
+
as: args.as,
|
|
451
|
+
input: encodeCallInput(args.input)
|
|
452
|
+
}, args);
|
|
453
|
+
}
|
|
454
|
+
function apiCall(args) {
|
|
455
|
+
const context = { id: resolveRef("query", args.api) };
|
|
456
|
+
const headers = coerceHeaders(args.headers);
|
|
457
|
+
if (headers) context.headers = vf(headers);
|
|
458
|
+
if (args.auth) {
|
|
459
|
+
context.token = typeof args.auth.token === "string" ? args.auth.token : vf(args.auth.token);
|
|
460
|
+
if (args.auth.ignoreExpiration) context.token_ignore_expiration = true;
|
|
461
|
+
}
|
|
462
|
+
return annotate({
|
|
463
|
+
name: "mvp:workspace_run_endpoint",
|
|
464
|
+
context,
|
|
465
|
+
as: args.as,
|
|
466
|
+
input: encodeCallInput(args.input)
|
|
467
|
+
}, args);
|
|
468
|
+
}
|
|
469
|
+
function taskCall(args) {
|
|
470
|
+
return annotate({
|
|
471
|
+
name: "mvp:workspace_run_task",
|
|
472
|
+
context: { id: resolveRef("task", args.task) },
|
|
473
|
+
as: args.as,
|
|
474
|
+
input: []
|
|
475
|
+
}, args);
|
|
476
|
+
}
|
|
477
|
+
function toolCall(args) {
|
|
478
|
+
return annotate({
|
|
479
|
+
name: "mvp:workspace_run_tool",
|
|
480
|
+
context: { id: resolveRef("tool", args.tool) },
|
|
481
|
+
as: args.as,
|
|
482
|
+
input: encodeCallInput(args.input)
|
|
483
|
+
}, args);
|
|
484
|
+
}
|
|
485
|
+
function triggerCall(args) {
|
|
486
|
+
return annotate({
|
|
487
|
+
name: "mvp:workspace_run_trigger",
|
|
488
|
+
context: { id: resolveRef("trigger", args.trigger) },
|
|
489
|
+
as: args.as,
|
|
490
|
+
input: encodeCallInput(args.input)
|
|
491
|
+
}, args);
|
|
492
|
+
}
|
|
493
|
+
function middlewareCall(args) {
|
|
494
|
+
return annotate({
|
|
495
|
+
name: "mvp:workspace_run_middleware",
|
|
496
|
+
context: { id: resolveRef("middleware", args.middleware) },
|
|
497
|
+
as: args.as,
|
|
498
|
+
input: encodeCallInput(args.input)
|
|
499
|
+
}, args);
|
|
500
|
+
}
|
|
501
|
+
function addonCall(args) {
|
|
502
|
+
return annotate({
|
|
503
|
+
name: "mvp:workspace_run_addon",
|
|
504
|
+
context: { id: resolveRef("addon", args.addon) },
|
|
505
|
+
as: args.as,
|
|
506
|
+
input: encodeCallInput(args.input)
|
|
507
|
+
}, args);
|
|
508
|
+
}
|
|
509
|
+
function actionCall(args) {
|
|
510
|
+
return annotate({
|
|
511
|
+
name: "mvp:action",
|
|
512
|
+
context: { run_version: { id: resolveRef("function", args.action) } },
|
|
513
|
+
as: args.as,
|
|
514
|
+
input: encodeCallInput(args.input),
|
|
515
|
+
settings_registry: []
|
|
516
|
+
}, args);
|
|
517
|
+
}
|
|
518
|
+
function actionPackageCall(args) {
|
|
519
|
+
return annotate({
|
|
520
|
+
name: "mvp:action_package",
|
|
521
|
+
context: {
|
|
522
|
+
action: { trace_id: "" },
|
|
523
|
+
package: { slug: args.package ?? "" },
|
|
524
|
+
package_version: { id: "" }
|
|
525
|
+
},
|
|
526
|
+
as: args.as,
|
|
527
|
+
input: encodeCallInput(args.input),
|
|
528
|
+
settings_registry: []
|
|
529
|
+
}, args);
|
|
530
|
+
}
|
|
531
|
+
function workflowTestCall(args) {
|
|
532
|
+
return annotate({
|
|
533
|
+
name: "mvp:workspace_run_workflow_test",
|
|
534
|
+
context: {
|
|
535
|
+
datasource: args.datasource ?? "",
|
|
536
|
+
id: resolveRef("workflow_test", args.workflowTest)
|
|
537
|
+
},
|
|
538
|
+
as: args.as,
|
|
539
|
+
input: []
|
|
540
|
+
}, args);
|
|
541
|
+
}
|
|
542
|
+
registerStatement("mvp:function", functionRun);
|
|
543
|
+
registerStatement("mvp:action", actionCall);
|
|
544
|
+
registerStatement("mvp:action_package", actionPackageCall);
|
|
545
|
+
registerStatement("mvp:workspace_run_workflow_test", workflowTestCall);
|
|
546
|
+
registerStatement("mvp:workspace_run_function", functionCall);
|
|
547
|
+
registerStatement("mvp:workspace_run_endpoint", apiCall);
|
|
548
|
+
registerStatement("mvp:workspace_run_task", taskCall);
|
|
549
|
+
registerStatement("mvp:workspace_run_tool", toolCall);
|
|
550
|
+
registerStatement("mvp:workspace_run_trigger", triggerCall);
|
|
551
|
+
registerStatement("mvp:workspace_run_middleware", middlewareCall);
|
|
552
|
+
registerStatement("mvp:workspace_run_addon", addonCall);
|
|
553
|
+
|
|
554
|
+
// src/statements/special/ai-cloud.ts
|
|
555
|
+
function vf2(v) {
|
|
556
|
+
return { value: v.value, tag: v.tag, filters: v.filters };
|
|
557
|
+
}
|
|
558
|
+
function aiAgentRun(a) {
|
|
559
|
+
const input2 = [];
|
|
560
|
+
if (a.args !== void 0) {
|
|
561
|
+
const argsValue = isTaggedValue(a.args) ? a.args : obj(a.args);
|
|
562
|
+
input2.push({ name: "args", ...vf2(argsValue) });
|
|
563
|
+
}
|
|
564
|
+
if (a.allowToolExecution) input2.push({ name: "allow_tool_execution", ...vf2(a.allowToolExecution) });
|
|
565
|
+
if (a.version) input2.push({ name: "version", ...vf2(a.version) });
|
|
566
|
+
const stmt = {
|
|
567
|
+
name: "mvp:call_agent",
|
|
568
|
+
context: { toolset: { id: resolveRef("toolset", a.agent) } },
|
|
569
|
+
as: a.as ?? "",
|
|
570
|
+
input: input2
|
|
571
|
+
};
|
|
572
|
+
const runtime = encodeAsyncRuntime(a.runtime);
|
|
573
|
+
if (runtime) stmt.runtime = runtime;
|
|
574
|
+
return annotate(stmt, a);
|
|
575
|
+
}
|
|
576
|
+
function cloudJob(a) {
|
|
577
|
+
const input2 = [];
|
|
578
|
+
if (a.image) input2.push({ name: "image", ...vf2(a.image) });
|
|
579
|
+
if (a.command) input2.push({ name: "command", ...vf2(a.command) });
|
|
580
|
+
if (a.args) input2.push({ name: "args", ...vf2(a.args) });
|
|
581
|
+
if (a.secret) input2.push({ name: "secret", ...vf2(a.secret) });
|
|
582
|
+
if (a.template) input2.push({ name: "template", ...vf2(a.template) });
|
|
583
|
+
if (a.await) input2.push({ name: "await", ...vf2(a.await) });
|
|
584
|
+
return annotate({ name: "mvp:cloud_job", context: {}, as: a.as ?? "", input: input2 }, a);
|
|
585
|
+
}
|
|
586
|
+
function cloudJobAwait(a) {
|
|
587
|
+
return annotate({
|
|
588
|
+
name: "mvp:cloud_job_await",
|
|
589
|
+
context: {},
|
|
590
|
+
as: a.as ?? "",
|
|
591
|
+
input: [
|
|
592
|
+
{ name: "ids", ...vf2(a.ids) },
|
|
593
|
+
{ name: "timeout", ...vf2(a.timeout) }
|
|
594
|
+
]
|
|
595
|
+
}, a);
|
|
596
|
+
}
|
|
597
|
+
function cloudJobStatus(a) {
|
|
598
|
+
return annotate({
|
|
599
|
+
name: "mvp:cloud_job_status",
|
|
600
|
+
context: {},
|
|
601
|
+
as: a.as ?? "",
|
|
602
|
+
input: [{ name: "id", ...vf2(a.id) }]
|
|
603
|
+
}, a);
|
|
604
|
+
}
|
|
605
|
+
registerStatement("mvp:call_agent", aiAgentRun);
|
|
606
|
+
registerStatement("mvp:cloud_job", cloudJob);
|
|
607
|
+
registerStatement("mvp:cloud_job_await", cloudJobAwait);
|
|
608
|
+
registerStatement("mvp:cloud_job_status", cloudJobStatus);
|
|
609
|
+
|
|
610
|
+
// src/values/ignored.ts
|
|
611
|
+
var IGNORED = /* @__PURE__ */ Symbol.for("xanots.input.ignored");
|
|
612
|
+
function ignored(value) {
|
|
613
|
+
const marked = { ...value };
|
|
614
|
+
Object.defineProperty(marked, IGNORED, { value: true, enumerable: false });
|
|
615
|
+
return marked;
|
|
616
|
+
}
|
|
617
|
+
function isIgnored(value) {
|
|
618
|
+
return typeof value === "object" && value !== null && value[IGNORED] === true;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// src/statements/schema-dsl/enum-guard.ts
|
|
622
|
+
var CHECKABLE_TAGS = /* @__PURE__ */ new Set(["const"]);
|
|
623
|
+
function renderSet(values) {
|
|
624
|
+
return values.map((v) => JSON.stringify(v)).join(" | ");
|
|
625
|
+
}
|
|
626
|
+
function reject(statement, field, got, values) {
|
|
627
|
+
throw new Error(
|
|
628
|
+
`Statement "${statement}": field "${field}" accepts only ${renderSet(values)} \u2014 got ${JSON.stringify(got)}. Pass one of those (as a bare literal or via c.text), or a dynamic value (inp/ref/env/\u2026) if it has to be computed at runtime.`
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
function resolveEnumValue(statement, field, values, provided) {
|
|
632
|
+
if (typeof provided === "string") {
|
|
633
|
+
if (!values.includes(provided)) reject(statement, field, provided, values);
|
|
634
|
+
return c.text(provided);
|
|
635
|
+
}
|
|
636
|
+
if (isTaggedValue(provided)) {
|
|
637
|
+
const checkable = CHECKABLE_TAGS.has(provided.tag) && provided.filters.length === 0 && // The unconfigured box — always allowed, see the header note.
|
|
638
|
+
provided.value !== "";
|
|
639
|
+
if (checkable && !values.includes(provided.value)) {
|
|
640
|
+
reject(statement, field, provided.value, values);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return provided;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// src/statements/schema-dsl/interpret.ts
|
|
647
|
+
function valueFields3(v) {
|
|
648
|
+
return { value: v.value, tag: v.tag, filters: v.filters };
|
|
649
|
+
}
|
|
650
|
+
function nestedValueFields(v) {
|
|
651
|
+
const fields = { value: v.value, tag: v.tag };
|
|
652
|
+
if (Array.isArray(v.filters) && v.filters.length > 0) fields.filters = v.filters;
|
|
653
|
+
return fields;
|
|
654
|
+
}
|
|
655
|
+
function pickDefined(o) {
|
|
656
|
+
return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
|
|
657
|
+
}
|
|
658
|
+
function setPath(obj2, path, value) {
|
|
659
|
+
const parts = path.split(".");
|
|
660
|
+
let cur = obj2;
|
|
661
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
662
|
+
const key = parts[i];
|
|
663
|
+
if (typeof cur[key] !== "object" || cur[key] === null) cur[key] = {};
|
|
664
|
+
cur = cur[key];
|
|
665
|
+
}
|
|
666
|
+
cur[parts[parts.length - 1]] = value;
|
|
667
|
+
}
|
|
668
|
+
function assertIgnorable(statement, field, provided) {
|
|
669
|
+
if (!isIgnored(provided)) return;
|
|
670
|
+
throw new Error(
|
|
671
|
+
`Statement "${statement}": \`ignored()\` on \`${field}\` cannot be stored \u2014 the skip flag lives on an \`input[]\` entry, and this field is written into \`context\`, which has no slot for it. It would be silently dropped and the value bound anyway. Drop the \`ignored()\` wrapper, or omit the field.`
|
|
672
|
+
);
|
|
673
|
+
}
|
|
674
|
+
function inputEntry(name, v, full) {
|
|
675
|
+
const entry2 = { ...leanInput(name, v) };
|
|
676
|
+
const ignore = isIgnored(v);
|
|
677
|
+
if (full) {
|
|
678
|
+
entry2.ignore = ignore;
|
|
679
|
+
entry2.expand = false;
|
|
680
|
+
entry2.children = [];
|
|
681
|
+
} else if (ignore) {
|
|
682
|
+
entry2.ignore = true;
|
|
683
|
+
}
|
|
684
|
+
return entry2;
|
|
685
|
+
}
|
|
686
|
+
function encodeFromSpec(spec2, authored) {
|
|
687
|
+
authored = coerceLambdaFields(spec2.name, authored);
|
|
688
|
+
assertLambdaStatement(spec2.name, authored);
|
|
689
|
+
const env = spec2.envelope;
|
|
690
|
+
const context = {};
|
|
691
|
+
const input2 = [];
|
|
692
|
+
let as;
|
|
693
|
+
for (const rule of spec2.rules) {
|
|
694
|
+
let provided = authored[rule.field];
|
|
695
|
+
if (provided === void 0) {
|
|
696
|
+
if (rule.default !== void 0 && rule.type === "string") {
|
|
697
|
+
provided = rule.default;
|
|
698
|
+
} else if (rule.optional || rule.default !== void 0) {
|
|
699
|
+
continue;
|
|
700
|
+
} else {
|
|
701
|
+
throw new Error(`Statement "${spec2.name}": required field "${rule.field}" is missing.`);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
switch (rule.route.kind) {
|
|
705
|
+
case "as":
|
|
706
|
+
as = provided;
|
|
707
|
+
break;
|
|
708
|
+
case "context-plain":
|
|
709
|
+
assertIgnorable(spec2.name, rule.field, provided);
|
|
710
|
+
setPath(context, rule.route.path, provided);
|
|
711
|
+
break;
|
|
712
|
+
case "context-spread":
|
|
713
|
+
assertIgnorable(spec2.name, rule.field, provided);
|
|
714
|
+
Object.assign(context, valueFields3(provided));
|
|
715
|
+
break;
|
|
716
|
+
case "context-nest":
|
|
717
|
+
assertIgnorable(spec2.name, rule.field, provided);
|
|
718
|
+
setPath(
|
|
719
|
+
context,
|
|
720
|
+
rule.route.path,
|
|
721
|
+
typeof provided === "string" ? provided : nestedValueFields(provided)
|
|
722
|
+
);
|
|
723
|
+
break;
|
|
724
|
+
case "context-compare":
|
|
725
|
+
setPath(
|
|
726
|
+
context,
|
|
727
|
+
rule.route.path,
|
|
728
|
+
// Every statement carrying a `comparison` rule (`precondition`, the
|
|
729
|
+
// `array.*` predicates) has its condition evaluated by the runtime,
|
|
730
|
+
// so the operator set is the runtime one. See #260.
|
|
731
|
+
encodeRuntimeCondition(provided, `${spec2.name} "${rule.field}"`)
|
|
732
|
+
);
|
|
733
|
+
break;
|
|
734
|
+
case "input": {
|
|
735
|
+
const value = rule.enum ? resolveEnumValue(spec2.name, rule.field, rule.enum, provided) : provided;
|
|
736
|
+
input2.push(inputEntry(rule.route.name, value, env?.inputFull ?? false));
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
const stmt = { name: spec2.name, context, input: input2 };
|
|
742
|
+
if (as !== void 0) stmt.as = as;
|
|
743
|
+
else if (env?.emitAs) stmt.as = "";
|
|
744
|
+
if (env?.description) stmt.description = "";
|
|
745
|
+
const authoredOut = authored.output;
|
|
746
|
+
const asFilters = authored.asFilters;
|
|
747
|
+
if (asFilters?.length && authoredOut?.filters !== void 0) {
|
|
748
|
+
throw new Error(
|
|
749
|
+
`Statement "${spec2.name}": \`asFilters\` and \`output.filters\` both set the same filter chain. Keep \`asFilters\` and drop \`output.filters\`.`
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
annotate(stmt, {
|
|
753
|
+
disabled: typeof authored.disabled === "boolean" ? authored.disabled : void 0,
|
|
754
|
+
description: typeof authored.description === "string" ? authored.description : void 0,
|
|
755
|
+
asFilters,
|
|
756
|
+
mock: authored.mock
|
|
757
|
+
});
|
|
758
|
+
if (env?.settingsRegistry) stmt.settings_registry = [];
|
|
759
|
+
if (spec2.output) {
|
|
760
|
+
const base = env?.richOutput ? { customize: false, filters: [], items: [] } : { filters: [] };
|
|
761
|
+
const fromAnnotate = stmt.output ?? {};
|
|
762
|
+
stmt.output = { ...base, ...fromAnnotate, ...authoredOut ? pickDefined(authoredOut) : {} };
|
|
763
|
+
}
|
|
764
|
+
if (env?.addon) stmt.addon = [];
|
|
765
|
+
return stmt;
|
|
766
|
+
}
|
|
767
|
+
function registerSpec(spec2) {
|
|
768
|
+
const factory = (authored) => encodeFromSpec(spec2, authored);
|
|
769
|
+
registerStatement(spec2.name, factory);
|
|
770
|
+
return factory;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// src/statements/generated/specs.generated.ts
|
|
774
|
+
var GENERATED_SPECS = [
|
|
775
|
+
{ "name": "mvp:algolia_request", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "application_id", "type": "value", "optional": false, "route": { "kind": "input", "name": "application_id" } }, { "field": "api_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "api_key" } }, { "field": "url", "type": "value", "optional": false, "route": { "kind": "input", "name": "url" } }, { "field": "method", "type": "value", "optional": true, "enum": ["POST", "GET", "DELETE", "PUT"], "route": { "kind": "input", "name": "method" } }, { "field": "payload", "type": "value", "optional": false, "route": { "kind": "input", "name": "payload" } }], "envelope": { "inputFull": true, "description": true, "settingsRegistry": true, "addon": true, "richOutput": true } },
|
|
776
|
+
{ "name": "mvp:amazon_opensearch_document", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "auth_type", "type": "value", "optional": true, "default": "IAM", "enum": ["IAM", "master"], "route": { "kind": "input", "name": "auth_type" } }, { "field": "key_id", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "key_id" } }, { "field": "access_key", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "access_key" } }, { "field": "region", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "region" } }, { "field": "base_url", "type": "value", "optional": false, "route": { "kind": "input", "name": "base_url" } }, { "field": "method", "type": "value", "optional": true, "default": "GET", "enum": ["GET", "POST", "PUT", "DELETE"], "route": { "kind": "input", "name": "method" } }, { "field": "index", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "index" } }, { "field": "doc_id", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "doc_id" } }, { "field": "doc", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "doc" } }] },
|
|
777
|
+
{ "name": "mvp:amazon_opensearch_query", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "auth_type", "type": "value", "optional": true, "default": "IAM", "enum": ["IAM", "master"], "route": { "kind": "input", "name": "auth_type" } }, { "field": "key_id", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "key_id" } }, { "field": "access_key", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "access_key" } }, { "field": "region", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "region" } }, { "field": "base_url", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "base_url" } }, { "field": "index", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "index" } }, { "field": "payload", "type": "value", "optional": true, "default": "{}", "route": { "kind": "input", "name": "payload" } }, { "field": "size", "type": "value", "optional": true, "default": "null", "route": { "kind": "input", "name": "size" } }, { "field": "from", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "from" } }, { "field": "included_fields", "type": "value", "optional": true, "default": "[]", "route": { "kind": "input", "name": "included_fields" } }, { "field": "return_type", "type": "value", "optional": true, "default": "search", "enum": ["search", "count"], "route": { "kind": "input", "name": "return_type" } }, { "field": "expression", "type": "value", "optional": true, "default": "[]", "route": { "kind": "input", "name": "expression" } }, { "field": "sort", "type": "value", "optional": true, "default": "[]", "route": { "kind": "input", "name": "sort" } }] },
|
|
778
|
+
{ "name": "mvp:amazon_opensearch_request", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "auth_type", "type": "value", "optional": true, "default": "IAM", "enum": ["IAM", "master"], "route": { "kind": "input", "name": "auth_type" } }, { "field": "key_id", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "key_id" } }, { "field": "access_key", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "access_key" } }, { "field": "region", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "region" } }, { "field": "method", "type": "value", "optional": true, "default": "GET", "enum": ["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "PATCH"], "route": { "kind": "input", "name": "method" } }, { "field": "url", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "url" } }, { "field": "query", "type": "value", "optional": true, "default": "{}", "route": { "kind": "input", "name": "query" } }] },
|
|
779
|
+
{ "name": "mvp:amazon_s3_create_var_from_file_resource", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "region", "type": "value", "optional": false, "route": { "kind": "input", "name": "region" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "secret", "type": "value", "optional": false, "route": { "kind": "input", "name": "secret" } }, { "field": "file_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "file_key" } }] },
|
|
780
|
+
{ "name": "mvp:amazon_s3_delete_file", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "region", "type": "value", "optional": false, "route": { "kind": "input", "name": "region" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "secret", "type": "value", "optional": false, "route": { "kind": "input", "name": "secret" } }, { "field": "file_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "file_key" } }] },
|
|
781
|
+
{ "name": "mvp:amazon_s3_get_file_metadata", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "region", "type": "value", "optional": false, "route": { "kind": "input", "name": "region" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "secret", "type": "value", "optional": false, "route": { "kind": "input", "name": "secret" } }, { "field": "file_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "file_key" } }] },
|
|
782
|
+
{ "name": "mvp:amazon_s3_list_directory", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "region", "type": "value", "optional": false, "route": { "kind": "input", "name": "region" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "secret", "type": "value", "optional": false, "route": { "kind": "input", "name": "secret" } }, { "field": "prefix", "type": "value", "optional": true, "route": { "kind": "input", "name": "prefix" } }, { "field": "next_page_token", "type": "value", "optional": true, "route": { "kind": "input", "name": "next_page_token" } }] },
|
|
783
|
+
{ "name": "mvp:amazon_s3_signed_url", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "region", "type": "value", "optional": false, "route": { "kind": "input", "name": "region" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "secret", "type": "value", "optional": false, "route": { "kind": "input", "name": "secret" } }, { "field": "file_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "file_key" } }, { "field": "ttl", "type": "value", "optional": true, "default": "300", "route": { "kind": "input", "name": "ttl" } }] },
|
|
784
|
+
{ "name": "mvp:amazon_s3_upload_file", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "region", "type": "value", "optional": false, "route": { "kind": "input", "name": "region" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "secret", "type": "value", "optional": false, "route": { "kind": "input", "name": "secret" } }, { "field": "file_key", "type": "value", "optional": true, "route": { "kind": "input", "name": "file_key" } }, { "field": "file", "type": "value", "optional": false, "route": { "kind": "input", "name": "file" } }, { "field": "metadata", "type": "value", "optional": true, "route": { "kind": "input", "name": "metadata" } }, { "field": "object_lock_mode", "type": "value", "optional": true, "enum": ["compliance", "governance"], "route": { "kind": "input", "name": "object_lock_mode" } }, { "field": "object_lock_retain_until", "type": "value", "optional": true, "route": { "kind": "input", "name": "object_lock_retain_until" } }] },
|
|
785
|
+
{ "name": "mvp:api_request", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "url", "type": "value", "optional": true, "route": { "kind": "input", "name": "url" } }, { "field": "method", "type": "value", "optional": true, "enum": ["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "PATCH"], "route": { "kind": "input", "name": "method" } }, { "field": "params", "type": "value", "optional": true, "route": { "kind": "input", "name": "params" } }, { "field": "headers", "type": "value", "optional": true, "route": { "kind": "input", "name": "headers" } }, { "field": "timeout", "type": "value", "optional": true, "route": { "kind": "input", "name": "timeout" } }, { "field": "follow_location", "type": "value", "optional": true, "route": { "kind": "input", "name": "follow_location" } }, { "field": "verify_host", "type": "value", "optional": true, "route": { "kind": "input", "name": "verify_host" } }, { "field": "verify_peer", "type": "value", "optional": true, "route": { "kind": "input", "name": "verify_peer" } }, { "field": "ca_certificate", "type": "value", "optional": true, "route": { "kind": "input", "name": "ca_certificate" } }, { "field": "certificate", "type": "value", "optional": true, "route": { "kind": "input", "name": "certificate" } }, { "field": "certificate_pass", "type": "value", "optional": true, "route": { "kind": "input", "name": "certificate_pass" } }, { "field": "private_key", "type": "value", "optional": true, "route": { "kind": "input", "name": "private_key" } }, { "field": "private_key_pass", "type": "value", "optional": true, "route": { "kind": "input", "name": "private_key_pass" } }], "envelope": { "inputFull": true, "description": true, "settingsRegistry": true, "addon": true, "richOutput": true } },
|
|
786
|
+
{ "name": "mvp:array_difference", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "left" } }, { "field": "value", "type": "value", "optional": true, "default": "[]", "route": { "kind": "context-nest", "path": "right" } }, { "field": "by", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "transform_value" } }] },
|
|
787
|
+
{ "name": "mvp:array_every", "output": true, "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
|
|
788
|
+
{ "name": "mvp:array_filter", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
|
|
789
|
+
{ "name": "mvp:array_filter_count", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
|
|
790
|
+
{ "name": "mvp:array_find", "output": true, "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
|
|
791
|
+
{ "name": "mvp:array_find_index", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
|
|
792
|
+
{ "name": "mvp:array_group_by", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "collection" } }, { "field": "by", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "transform_value" } }] },
|
|
793
|
+
{ "name": "mvp:array_has", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
|
|
794
|
+
{ "name": "mvp:array_intersection", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "left" } }, { "field": "value", "type": "value", "optional": true, "default": "[]", "route": { "kind": "context-nest", "path": "right" } }, { "field": "by", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "transform_value" } }] },
|
|
795
|
+
{ "name": "mvp:array_merge", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": true, "route": { "kind": "context-spread" } }] },
|
|
796
|
+
{ "name": "mvp:array_partition", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
|
|
797
|
+
{ "name": "mvp:array_pop", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }] },
|
|
798
|
+
{ "name": "mvp:array_push", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
799
|
+
{ "name": "mvp:array_shift", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }] },
|
|
800
|
+
{ "name": "mvp:array_unshift", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
801
|
+
{ "name": "mvp:async_function_await", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "ids", "type": "value", "optional": true, "default": "[]", "route": { "kind": "input", "name": "ids" } }, { "field": "timeout", "type": "value", "optional": true, "default": "10", "route": { "kind": "input", "name": "timeout" } }] },
|
|
802
|
+
{ "name": "mvp:azure_blob_storage_create_var_from_file_resource", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }] },
|
|
803
|
+
{ "name": "mvp:azure_blob_storage_delete_file", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }] },
|
|
804
|
+
{ "name": "mvp:azure_blob_storage_get_file_metadata", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }] },
|
|
805
|
+
{ "name": "mvp:azure_blob_storage_list_directory", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "path", "type": "value", "optional": true, "route": { "kind": "input", "name": "path" } }] },
|
|
806
|
+
{ "name": "mvp:azure_blob_storage_signed_url", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "path", "type": "value", "optional": false, "route": { "kind": "input", "name": "path" } }, { "field": "ttl", "type": "value", "optional": true, "route": { "kind": "input", "name": "ttl" } }] },
|
|
807
|
+
{ "name": "mvp:azure_blob_storage_upload_file", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }, { "field": "file", "type": "value", "optional": false, "route": { "kind": "input", "name": "file" } }, { "field": "metadata", "type": "value", "optional": true, "route": { "kind": "input", "name": "metadata" } }] },
|
|
808
|
+
{ "name": "mvp:bitwise_and", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
809
|
+
{ "name": "mvp:bitwise_or", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
810
|
+
{ "name": "mvp:bitwise_xor", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
811
|
+
{ "name": "mvp:calculate_geo_distance", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "latitude_1", "type": "value", "optional": true, "route": { "kind": "input", "name": "latitude_1" } }, { "field": "longitude_1", "type": "value", "optional": true, "route": { "kind": "input", "name": "longitude_1" } }, { "field": "latitude_2", "type": "value", "optional": true, "route": { "kind": "input", "name": "latitude_2" } }, { "field": "longitude_2", "type": "value", "optional": true, "route": { "kind": "input", "name": "longitude_2" } }] },
|
|
812
|
+
{ "name": "mvp:check_pass", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "text_password", "type": "value", "optional": true, "route": { "kind": "input", "name": "text_password" } }, { "field": "hash_password", "type": "value", "optional": true, "route": { "kind": "input", "name": "hash_password" } }], "envelope": { "inputFull": true, "description": true, "settingsRegistry": true, "addon": true, "richOutput": true } },
|
|
813
|
+
{ "name": "mvp:connect_webflow_api_request", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "path", "type": "value", "optional": true, "route": { "kind": "input", "name": "path" } }, { "field": "method", "type": "value", "optional": true, "route": { "kind": "input", "name": "method" } }, { "field": "params", "type": "value", "optional": true, "route": { "kind": "input", "name": "params" } }, { "field": "headers", "type": "value", "optional": true, "route": { "kind": "input", "name": "headers" } }, { "field": "timeout", "type": "value", "optional": true, "route": { "kind": "input", "name": "timeout" } }, { "field": "follow_location", "type": "value", "optional": true, "route": { "kind": "input", "name": "follow_location" } }, { "field": "verify_host", "type": "value", "optional": true, "route": { "kind": "input", "name": "verify_host" } }, { "field": "verify_peer", "type": "value", "optional": true, "route": { "kind": "input", "name": "verify_peer" } }, { "field": "ca_certificate", "type": "value", "optional": true, "route": { "kind": "input", "name": "ca_certificate" } }, { "field": "certificate", "type": "value", "optional": true, "route": { "kind": "input", "name": "certificate" } }, { "field": "certificate_pass", "type": "value", "optional": true, "route": { "kind": "input", "name": "certificate_pass" } }, { "field": "private_key", "type": "value", "optional": true, "route": { "kind": "input", "name": "private_key" } }, { "field": "private_key_pass", "type": "value", "optional": true, "route": { "kind": "input", "name": "private_key_pass" } }] },
|
|
814
|
+
{ "name": "mvp:create_attachment", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }, { "field": "access", "type": "string", "optional": true, "default": "public", "route": { "kind": "context-plain", "path": "access" } }, { "field": "filename", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "filename" } }, { "field": "include_meta", "type": "boolean", "optional": true, "route": { "kind": "context-plain", "path": "include_meta" } }, { "field": "type", "type": "value", "optional": true, "route": { "kind": "input", "name": "type" } }] },
|
|
815
|
+
{ "name": "mvp:create_audio", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }, { "field": "access", "type": "string", "optional": true, "default": "public", "route": { "kind": "context-plain", "path": "access" } }, { "field": "filename", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "filename" } }] },
|
|
816
|
+
{ "name": "mvp:create_file_resource", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "filename", "type": "value", "optional": false, "route": { "kind": "input", "name": "filename" } }, { "field": "filedata", "type": "value", "optional": false, "route": { "kind": "input", "name": "filedata" } }], "envelope": { "inputFull": true, "description": true, "settingsRegistry": true, "addon": true, "richOutput": true } },
|
|
817
|
+
{ "name": "mvp:create_image", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }, { "field": "access", "type": "string", "optional": true, "default": "public", "route": { "kind": "context-plain", "path": "access" } }, { "field": "filename", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "filename" } }] },
|
|
818
|
+
{ "name": "mvp:create_var_from_file_resource", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
819
|
+
{ "name": "mvp:create_video", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }, { "field": "access", "type": "string", "optional": true, "default": "public", "route": { "kind": "context-plain", "path": "access" } }, { "field": "filename", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "filename" } }] },
|
|
820
|
+
{ "name": "mvp:crypto_create_ec_key", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "curve", "type": "value", "optional": true, "enum": ["P-256", "P-384", "P-521"], "route": { "kind": "input", "name": "curve" } }, { "field": "format", "type": "value", "optional": true, "enum": ["object", "base64"], "route": { "kind": "input", "name": "format" } }] },
|
|
821
|
+
{ "name": "mvp:crypto_create_octet_key", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bits", "type": "value", "optional": true, "route": { "kind": "input", "name": "bits" } }, { "field": "format", "type": "value", "optional": true, "enum": ["object", "base64"], "route": { "kind": "input", "name": "format" } }] },
|
|
822
|
+
{ "name": "mvp:crypto_create_rsa_key", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bits", "type": "value", "optional": true, "route": { "kind": "input", "name": "bits" } }, { "field": "format", "type": "value", "optional": true, "enum": ["object", "base64"], "route": { "kind": "input", "name": "format" } }] },
|
|
823
|
+
{ "name": "mvp:crypto_decrypt", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "data", "type": "value", "optional": true, "route": { "kind": "input", "name": "data" } }, { "field": "algorithm", "type": "value", "optional": true, "enum": ["aes-128-cbc", "aes-192-cbc", "aes-256-cbc", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm"], "route": { "kind": "input", "name": "algorithm" } }, { "field": "key", "type": "value", "optional": true, "route": { "kind": "input", "name": "key" } }, { "field": "iv", "type": "value", "optional": true, "route": { "kind": "input", "name": "iv" } }] },
|
|
824
|
+
{ "name": "mvp:crypto_encrypt", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "data", "type": "value", "optional": true, "route": { "kind": "input", "name": "data" } }, { "field": "algorithm", "type": "value", "optional": true, "enum": ["aes-128-cbc", "aes-192-cbc", "aes-256-cbc", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm"], "route": { "kind": "input", "name": "algorithm" } }, { "field": "key", "type": "value", "optional": true, "route": { "kind": "input", "name": "key" } }, { "field": "iv", "type": "value", "optional": true, "route": { "kind": "input", "name": "iv" } }] },
|
|
825
|
+
{ "name": "mvp:crypto_jwe_decode2", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "token", "type": "value", "optional": true, "route": { "kind": "input", "name": "token" } }, { "field": "key", "type": "value", "optional": true, "route": { "kind": "input", "name": "key" } }, { "field": "check_claims", "type": "value", "optional": true, "route": { "kind": "input", "name": "check_claims" } }, { "field": "key_algorithm", "type": "value", "optional": true, "enum": ["A128KW", "A192KW", "A256KW", "A128GCMKW", "A192GCMKW", "A256GCMKW", "ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW"], "route": { "kind": "input", "name": "key_algorithm" } }, { "field": "content_algorithm", "type": "value", "optional": true, "enum": ["A128GCM", "A192GCM", "A256GCM", "A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512"], "route": { "kind": "input", "name": "content_algorithm" } }, { "field": "timeDrift", "type": "value", "optional": true, "route": { "kind": "input", "name": "timeDrift" } }] },
|
|
826
|
+
{ "name": "mvp:crypto_jwe_encode3", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "headers", "type": "value", "optional": true, "route": { "kind": "input", "name": "headers" } }, { "field": "claims", "type": "value", "optional": true, "route": { "kind": "input", "name": "claims" } }, { "field": "key", "type": "value", "optional": true, "route": { "kind": "input", "name": "key" } }, { "field": "key_algorithm", "type": "value", "optional": true, "enum": ["A128KW", "A192KW", "A256KW", "A128GCMKW", "A192GCMKW", "A256GCMKW", "ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW"], "route": { "kind": "input", "name": "key_algorithm" } }, { "field": "content_algorithm", "type": "value", "optional": true, "enum": ["A128GCM", "A192GCM", "A256GCM", "A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512"], "route": { "kind": "input", "name": "content_algorithm" } }, { "field": "ttl", "type": "value", "optional": true, "route": { "kind": "input", "name": "ttl" } }] },
|
|
827
|
+
{ "name": "mvp:crypto_jws_decode2", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "token", "type": "value", "optional": true, "route": { "kind": "input", "name": "token" } }, { "field": "key", "type": "value", "optional": true, "route": { "kind": "input", "name": "key" } }, { "field": "check_claims", "type": "value", "optional": true, "route": { "kind": "input", "name": "check_claims" } }, { "field": "signature_algorithm", "type": "value", "optional": true, "enum": ["PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "HS256", "HS384", "HS512", "ES256", "ES384", "ES512"], "route": { "kind": "input", "name": "signature_algorithm" } }, { "field": "timeDrift", "type": "value", "optional": true, "route": { "kind": "input", "name": "timeDrift" } }] },
|
|
828
|
+
{ "name": "mvp:crypto_jws_encode2", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "headers", "type": "value", "optional": true, "route": { "kind": "input", "name": "headers" } }, { "field": "claims", "type": "value", "optional": true, "route": { "kind": "input", "name": "claims" } }, { "field": "key", "type": "value", "optional": true, "route": { "kind": "input", "name": "key" } }, { "field": "signature_algorithm", "type": "value", "optional": true, "enum": ["PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "HS256", "HS384", "HS512", "ES256", "ES384", "ES512"], "route": { "kind": "input", "name": "signature_algorithm" } }, { "field": "ttl", "type": "value", "optional": true, "route": { "kind": "input", "name": "ttl" } }] },
|
|
829
|
+
{ "name": "mvp:csv_stream", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }, { "field": "separator", "type": "value", "optional": true, "default": ",", "route": { "kind": "input", "name": "separator" } }, { "field": "enclosure", "type": "value", "optional": true, "default": '\\"', "route": { "kind": "input", "name": "enclosure" } }, { "field": "escape_char", "type": "value", "optional": true, "default": '\\"', "route": { "kind": "input", "name": "escape_char" } }], "envelope": { "inputFull": true } },
|
|
830
|
+
{ "name": "mvp:datadog_log", "rules": [{ "field": "message", "type": "value", "optional": true, "route": { "kind": "input", "name": "message" } }, { "field": "status", "type": "value", "optional": true, "enum": ["debug", "info", "notice", "warn", "error", "critical", "alert", "emergency"], "route": { "kind": "input", "name": "status" } }, { "field": "attributes", "type": "value", "optional": true, "route": { "kind": "input", "name": "attributes" } }, { "field": "service", "type": "value", "optional": true, "route": { "kind": "input", "name": "service" } }, { "field": "source", "type": "value", "optional": true, "route": { "kind": "input", "name": "source" } }, { "field": "env", "type": "value", "optional": true, "route": { "kind": "input", "name": "env" } }, { "field": "hostname", "type": "value", "optional": true, "route": { "kind": "input", "name": "hostname" } }, { "field": "tags", "type": "value", "optional": true, "route": { "kind": "input", "name": "tags" } }, { "field": "timestamp", "type": "value", "optional": true, "route": { "kind": "input", "name": "timestamp" } }, { "field": "connection", "type": "value", "optional": true, "route": { "kind": "input", "name": "connection" } }] },
|
|
831
|
+
{ "name": "mvp:datadog_log_bulk", "rules": [{ "field": "entries", "type": "value", "optional": false, "route": { "kind": "input", "name": "entries" } }, { "field": "connection", "type": "value", "optional": true, "route": { "kind": "input", "name": "connection" } }] },
|
|
832
|
+
{ "name": "mvp:datadog_metric", "rules": [{ "field": "metric", "type": "value", "optional": true, "route": { "kind": "input", "name": "metric" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "input", "name": "value" } }, { "field": "type", "type": "value", "optional": true, "enum": ["count", "gauge", "rate", "histogram", "distribution"], "route": { "kind": "input", "name": "type" } }, { "field": "tags", "type": "value", "optional": true, "route": { "kind": "input", "name": "tags" } }, { "field": "service", "type": "value", "optional": true, "route": { "kind": "input", "name": "service" } }, { "field": "source", "type": "value", "optional": true, "route": { "kind": "input", "name": "source" } }, { "field": "env", "type": "value", "optional": true, "route": { "kind": "input", "name": "env" } }, { "field": "hostname", "type": "value", "optional": true, "route": { "kind": "input", "name": "hostname" } }, { "field": "timestamp", "type": "value", "optional": true, "route": { "kind": "input", "name": "timestamp" } }, { "field": "connection", "type": "value", "optional": true, "route": { "kind": "input", "name": "connection" } }] },
|
|
833
|
+
{ "name": "mvp:datadog_metric_bulk", "rules": [{ "field": "entries", "type": "value", "optional": false, "route": { "kind": "input", "name": "entries" } }, { "field": "connection", "type": "value", "optional": true, "route": { "kind": "input", "name": "connection" } }] },
|
|
834
|
+
{ "name": "mvp:debug_log", "rules": [{ "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
835
|
+
{ "name": "mvp:delete_file", "output": true, "rules": [{ "field": "pathname", "type": "value", "optional": false, "route": { "kind": "input", "name": "pathname" } }], "envelope": { "inputFull": true, "emitAs": true, "description": true, "settingsRegistry": true, "addon": true, "richOutput": true } },
|
|
836
|
+
{ "name": "mvp:die", "rules": [{ "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
837
|
+
{ "name": "mvp:elasticsearch_document", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "auth_type", "type": "value", "optional": true, "default": "API Key", "enum": ["Basic", "Bearer", "API Key"], "route": { "kind": "input", "name": "auth_type" } }, { "field": "key_id", "type": "value", "optional": false, "route": { "kind": "input", "name": "key_id" } }, { "field": "access_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "access_key" } }, { "field": "base_url", "type": "value", "optional": false, "route": { "kind": "input", "name": "base_url" } }, { "field": "index", "type": "value", "optional": false, "route": { "kind": "input", "name": "index" } }, { "field": "method", "type": "value", "optional": true, "default": "GET", "enum": ["GET", "POST", "PUT", "DELETE"], "route": { "kind": "input", "name": "method" } }, { "field": "doc_id", "type": "value", "optional": false, "route": { "kind": "input", "name": "doc_id" } }, { "field": "doc", "type": "value", "optional": false, "route": { "kind": "input", "name": "doc" } }] },
|
|
838
|
+
{ "name": "mvp:elasticsearch_query", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "auth_type", "type": "value", "optional": true, "default": "API Key", "enum": ["Basic", "Bearer", "API Key"], "route": { "kind": "input", "name": "auth_type" } }, { "field": "key_id", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "key_id" } }, { "field": "access_key", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "access_key" } }, { "field": "base_url", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "base_url" } }, { "field": "index", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "index" } }, { "field": "payload", "type": "value", "optional": true, "default": "{}", "route": { "kind": "input", "name": "payload" } }, { "field": "size", "type": "value", "optional": true, "default": "null", "route": { "kind": "input", "name": "size" } }, { "field": "from", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "from" } }, { "field": "included_fields", "type": "value", "optional": true, "default": "[]", "route": { "kind": "input", "name": "included_fields" } }, { "field": "return_type", "type": "value", "optional": true, "default": "search", "enum": ["search", "count"], "route": { "kind": "input", "name": "return_type" } }, { "field": "expression", "type": "value", "optional": true, "default": "[]", "route": { "kind": "input", "name": "expression" } }, { "field": "sort", "type": "value", "optional": true, "default": "[]", "route": { "kind": "input", "name": "sort" } }] },
|
|
839
|
+
{ "name": "mvp:elasticsearch_request", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "auth_type", "type": "value", "optional": true, "default": "API Key", "enum": ["Basic", "Bearer", "API Key"], "route": { "kind": "input", "name": "auth_type" } }, { "field": "key_id", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "key_id" } }, { "field": "access_key", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "access_key" } }, { "field": "method", "type": "value", "optional": true, "default": "POST", "enum": ["POST", "GET", "PUT", "DELETE", "PATCH"], "route": { "kind": "input", "name": "method" } }, { "field": "url", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "url" } }, { "field": "payload", "type": "value", "optional": true, "default": "{}", "route": { "kind": "input", "name": "payload" } }] },
|
|
840
|
+
{ "name": "mvp:generate_pass", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "character_count", "type": "value", "optional": true, "route": { "kind": "input", "name": "character_count" } }, { "field": "require_lowercase", "type": "value", "optional": true, "route": { "kind": "input", "name": "require_lowercase" } }, { "field": "require_uppercase", "type": "value", "optional": true, "route": { "kind": "input", "name": "require_uppercase" } }, { "field": "require_digit", "type": "value", "optional": true, "route": { "kind": "input", "name": "require_digit" } }, { "field": "require_symbol", "type": "value", "optional": true, "route": { "kind": "input", "name": "require_symbol" } }, { "field": "symbol_whitelist", "type": "value", "optional": true, "route": { "kind": "input", "name": "symbol_whitelist" } }] },
|
|
841
|
+
{ "name": "mvp:get_all_input", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }] },
|
|
842
|
+
{ "name": "mvp:get_env", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }] },
|
|
843
|
+
{ "name": "mvp:get_session", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }] },
|
|
844
|
+
{ "name": "mvp:get_vars", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }] },
|
|
845
|
+
{ "name": "mvp:google_cloud_storage_create_var_from_file_resource", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "service_account", "type": "value", "optional": false, "route": { "kind": "input", "name": "service_account" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }] },
|
|
846
|
+
{ "name": "mvp:google_cloud_storage_delete_file", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "service_account", "type": "value", "optional": false, "route": { "kind": "input", "name": "service_account" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }] },
|
|
847
|
+
{ "name": "mvp:google_cloud_storage_get_file_metadata", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "service_account", "type": "value", "optional": false, "route": { "kind": "input", "name": "service_account" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }] },
|
|
848
|
+
{ "name": "mvp:google_cloud_storage_list_directory", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "service_account", "type": "value", "optional": false, "route": { "kind": "input", "name": "service_account" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "path", "type": "value", "optional": false, "route": { "kind": "input", "name": "path" } }] },
|
|
849
|
+
{ "name": "mvp:google_cloud_storage_signed_url", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "service_account", "type": "value", "optional": false, "route": { "kind": "input", "name": "service_account" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }, { "field": "method", "type": "value", "optional": true, "enum": ["GET", "POST"], "route": { "kind": "input", "name": "method" } }, { "field": "ttl", "type": "value", "optional": true, "route": { "kind": "input", "name": "ttl" } }] },
|
|
850
|
+
{ "name": "mvp:google_cloud_storage_upload_file", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "service_account", "type": "value", "optional": false, "route": { "kind": "input", "name": "service_account" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }, { "field": "file", "type": "value", "optional": false, "route": { "kind": "input", "name": "file" } }, { "field": "metadata", "type": "value", "optional": true, "route": { "kind": "input", "name": "metadata" } }] },
|
|
851
|
+
{ "name": "mvp:ipaddress_lookup", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "input", "name": "ip" } }] },
|
|
852
|
+
{ "name": "mvp:jsonl_stream", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
853
|
+
{ "name": "mvp:lambda", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "code", "type": "value", "optional": true, "route": { "kind": "input", "name": "code" } }, { "field": "timeout", "type": "value", "optional": true, "route": { "kind": "input", "name": "timeout" } }] },
|
|
854
|
+
{ "name": "mvp:math_add", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
855
|
+
{ "name": "mvp:math_div", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
856
|
+
{ "name": "mvp:math_mod", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
857
|
+
{ "name": "mvp:math_mul", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
858
|
+
{ "name": "mvp:math_sub", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
859
|
+
{ "name": "mvp:mcp_call_tool", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "url", "type": "value", "optional": true, "route": { "kind": "input", "name": "url" } }, { "field": "bearer_token", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "bearer_token" } }, { "field": "connection_type", "type": "value", "optional": true, "default": "sse", "enum": ["sse", "stream"], "route": { "kind": "input", "name": "connection_type" } }, { "field": "tool", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "tool_name" } }, { "field": "args", "type": "value", "optional": true, "route": { "kind": "input", "name": "args" } }] },
|
|
860
|
+
{ "name": "mvp:mcp_list_tools", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "url", "type": "value", "optional": true, "route": { "kind": "input", "name": "url" } }, { "field": "bearer_token", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "bearer_token" } }, { "field": "connection_type", "type": "value", "optional": true, "default": "sse", "enum": ["sse", "stream"], "route": { "kind": "input", "name": "connection_type" } }] },
|
|
861
|
+
{ "name": "mvp:mcp_server_details", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "url", "type": "value", "optional": true, "route": { "kind": "input", "name": "url" } }, { "field": "bearer_token", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "bearer_token" } }, { "field": "connection_type", "type": "value", "optional": true, "default": "sse", "enum": ["sse", "stream"], "route": { "kind": "input", "name": "connection_type" } }] },
|
|
862
|
+
{ "name": "mvp:microservice_request", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "host", "type": "value", "optional": false, "route": { "kind": "input", "name": "host" } }, { "field": "path", "type": "value", "optional": false, "route": { "kind": "input", "name": "path" } }, { "field": "method", "type": "value", "optional": true, "enum": ["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "PATCH"], "route": { "kind": "input", "name": "method" } }, { "field": "params", "type": "value", "optional": true, "route": { "kind": "input", "name": "params" } }, { "field": "headers", "type": "value", "optional": false, "route": { "kind": "input", "name": "headers" } }, { "field": "timeout", "type": "value", "optional": true, "route": { "kind": "input", "name": "timeout" } }, { "field": "follow_location", "type": "value", "optional": true, "route": { "kind": "input", "name": "follow_location" } }] },
|
|
863
|
+
{ "name": "mvp:object_entries", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "object" } }] },
|
|
864
|
+
{ "name": "mvp:object_keys", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "object" } }] },
|
|
865
|
+
{ "name": "mvp:object_values", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "object" } }] },
|
|
866
|
+
{ "name": "mvp:precondition", "rules": [{ "field": "expr", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }, { "field": "error_type", "type": "string", "optional": true, "default": "standard", "route": { "kind": "context-plain", "path": "error_type" } }, { "field": "error", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "error" } }, { "field": "payload", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "payload" } }] },
|
|
867
|
+
{ "name": "mvp:rand", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "min", "type": "value", "optional": true, "route": { "kind": "input", "name": "min" } }, { "field": "max", "type": "value", "optional": true, "route": { "kind": "input", "name": "max" } }] },
|
|
868
|
+
{ "name": "mvp:random_bytes", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "length", "type": "value", "optional": true, "route": { "kind": "input", "name": "length" } }] },
|
|
869
|
+
{ "name": "mvp:redis_countlist", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }] },
|
|
870
|
+
{ "name": "mvp:redis_decr", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "by", "type": "value", "optional": true, "route": { "kind": "input", "name": "by" } }] },
|
|
871
|
+
{ "name": "mvp:redis_del", "rules": [{ "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }] },
|
|
872
|
+
{ "name": "mvp:redis_get", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }] },
|
|
873
|
+
{ "name": "mvp:redis_has", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }] },
|
|
874
|
+
{ "name": "mvp:redis_incr", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "by", "type": "value", "optional": true, "route": { "kind": "input", "name": "by" } }] },
|
|
875
|
+
{ "name": "mvp:redis_keys", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "search", "type": "value", "optional": false, "route": { "kind": "input", "name": "search" } }] },
|
|
876
|
+
{ "name": "mvp:redis_poplist", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "count", "type": "value", "optional": true, "route": { "kind": "input", "name": "count" } }] },
|
|
877
|
+
{ "name": "mvp:redis_pushlist", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "input", "name": "value" } }] },
|
|
878
|
+
{ "name": "mvp:redis_rangelist", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "start", "type": "value", "optional": true, "route": { "kind": "input", "name": "start" } }, { "field": "stop", "type": "value", "optional": true, "route": { "kind": "input", "name": "stop" } }] },
|
|
879
|
+
{ "name": "mvp:redis_ratelimit", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "max", "type": "value", "optional": true, "route": { "kind": "input", "name": "max" } }, { "field": "ttl", "type": "value", "optional": true, "route": { "kind": "input", "name": "ttl" } }, { "field": "error", "type": "value", "optional": true, "route": { "kind": "input", "name": "error" } }] },
|
|
880
|
+
{ "name": "mvp:redis_remove_list", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "input", "name": "value" } }, { "field": "count", "type": "value", "optional": true, "route": { "kind": "input", "name": "count" } }] },
|
|
881
|
+
{ "name": "mvp:redis_set", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "data", "type": "value", "optional": false, "route": { "kind": "input", "name": "data" } }, { "field": "ttl", "type": "value", "optional": true, "route": { "kind": "input", "name": "ttl" } }, { "field": "create_only", "type": "value", "optional": true, "route": { "kind": "input", "name": "create_only" } }] },
|
|
882
|
+
{ "name": "mvp:redis_shiftlist", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "count", "type": "value", "optional": true, "route": { "kind": "input", "name": "count" } }] },
|
|
883
|
+
{ "name": "mvp:redis_unshiftlist", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "input", "name": "value" } }] },
|
|
884
|
+
{ "name": "mvp:send_email", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "service_provider", "type": "value", "optional": true, "enum": ["resend", "xano"], "route": { "kind": "input", "name": "service_provider" } }, { "field": "api_key", "type": "value", "optional": true, "route": { "kind": "input", "name": "api_key" } }, { "field": "subject", "type": "value", "optional": true, "route": { "kind": "input", "name": "subject" } }, { "field": "message", "type": "value", "optional": true, "route": { "kind": "input", "name": "message" } }, { "field": "to", "type": "value", "optional": true, "route": { "kind": "input", "name": "to" } }, { "field": "bcc", "type": "value", "optional": true, "route": { "kind": "input", "name": "bcc" } }, { "field": "cc", "type": "value", "optional": true, "route": { "kind": "input", "name": "cc" } }, { "field": "from", "type": "value", "optional": true, "route": { "kind": "input", "name": "from" } }, { "field": "reply_to", "type": "value", "optional": true, "route": { "kind": "input", "name": "reply_to" } }, { "field": "scheduled_at", "type": "value", "optional": true, "route": { "kind": "input", "name": "scheduled_at" } }] },
|
|
885
|
+
{ "name": "mvp:set_data_source", "rules": [{ "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }, { "field": "workspace_id", "type": "value", "optional": true, "route": { "kind": "input", "name": "workspace_id" } }] },
|
|
886
|
+
{ "name": "mvp:setheader", "rules": [{ "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }, { "field": "duplicates", "type": "string", "optional": true, "default": "replace", "route": { "kind": "context-plain", "path": "duplicates" } }] },
|
|
887
|
+
{ "name": "mvp:sleep", "rules": [{ "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
888
|
+
{ "name": "mvp:streaming_api_request", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "url", "type": "value", "optional": true, "route": { "kind": "input", "name": "url" } }, { "field": "method", "type": "value", "optional": true, "route": { "kind": "input", "name": "method" } }, { "field": "params", "type": "value", "optional": true, "route": { "kind": "input", "name": "params" } }, { "field": "headers", "type": "value", "optional": true, "route": { "kind": "input", "name": "headers" } }, { "field": "timeout", "type": "value", "optional": true, "route": { "kind": "input", "name": "timeout" } }, { "field": "follow_location", "type": "value", "optional": true, "route": { "kind": "input", "name": "follow_location" } }, { "field": "verify_host", "type": "value", "optional": true, "route": { "kind": "input", "name": "verify_host" } }, { "field": "verify_peer", "type": "value", "optional": true, "route": { "kind": "input", "name": "verify_peer" } }, { "field": "ca_certificate", "type": "value", "optional": true, "route": { "kind": "input", "name": "ca_certificate" } }, { "field": "certificate", "type": "value", "optional": true, "route": { "kind": "input", "name": "certificate" } }, { "field": "certificate_pass", "type": "value", "optional": true, "route": { "kind": "input", "name": "certificate_pass" } }, { "field": "private_key", "type": "value", "optional": true, "route": { "kind": "input", "name": "private_key" } }, { "field": "private_key_pass", "type": "value", "optional": true, "route": { "kind": "input", "name": "private_key_pass" } }] },
|
|
889
|
+
{ "name": "mvp:streaming_api_response", "rules": [{ "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
890
|
+
{ "name": "mvp:template_string", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "input", "name": "template" } }] },
|
|
891
|
+
{ "name": "mvp:test_expect_to_be_defined", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
|
|
892
|
+
{ "name": "mvp:test_expect_to_be_empty", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
|
|
893
|
+
{ "name": "mvp:test_expect_to_be_false", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
|
|
894
|
+
{ "name": "mvp:test_expect_to_be_greater_than", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
|
|
895
|
+
{ "name": "mvp:test_expect_to_be_in_the_future", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
|
|
896
|
+
{ "name": "mvp:test_expect_to_be_in_the_past", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
|
|
897
|
+
{ "name": "mvp:test_expect_to_be_less_than", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
|
|
898
|
+
{ "name": "mvp:test_expect_to_be_null", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
|
|
899
|
+
{ "name": "mvp:test_expect_to_be_true", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
|
|
900
|
+
{ "name": "mvp:test_expect_to_be_within", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "min", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }, { "field": "max", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value3" } }] },
|
|
901
|
+
{ "name": "mvp:test_expect_to_contain", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
|
|
902
|
+
{ "name": "mvp:test_expect_to_end_with", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
|
|
903
|
+
{ "name": "mvp:test_expect_to_equal", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
|
|
904
|
+
{ "name": "mvp:test_expect_to_match", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
|
|
905
|
+
{ "name": "mvp:test_expect_to_not_be_defined", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
|
|
906
|
+
{ "name": "mvp:test_expect_to_not_be_null", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
|
|
907
|
+
{ "name": "mvp:test_expect_to_not_equal", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
|
|
908
|
+
{ "name": "mvp:test_expect_to_start_with", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
|
|
909
|
+
{ "name": "mvp:text_append", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
910
|
+
{ "name": "mvp:text_contains", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
911
|
+
{ "name": "mvp:text_ends_with", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
912
|
+
{ "name": "mvp:text_icontains", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
913
|
+
{ "name": "mvp:text_iends_with", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
914
|
+
{ "name": "mvp:text_istarts_with", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
915
|
+
{ "name": "mvp:text_ltrim", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
916
|
+
{ "name": "mvp:text_prepend", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
917
|
+
{ "name": "mvp:text_rtrim", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
918
|
+
{ "name": "mvp:text_starts_with", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
919
|
+
{ "name": "mvp:text_trim", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
920
|
+
{ "name": "mvp:throw_error", "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
|
|
921
|
+
{ "name": "mvp:uuid4", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }] },
|
|
922
|
+
{ "name": "mvp:vault_sign_url", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "pathname", "type": "value", "optional": false, "route": { "kind": "input", "name": "pathname" } }, { "field": "ttl", "type": "value", "optional": true, "route": { "kind": "input", "name": "ttl" } }] },
|
|
923
|
+
{ "name": "mvp:zip_add_file_resource", "rules": [{ "field": "file", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "file" } }, { "field": "filename", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "filename" } }, { "field": "zip", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "zip" } }, { "field": "password", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "password" } }, { "field": "password_encryption", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "password_encryption" } }] },
|
|
924
|
+
{ "name": "mvp:zip_create_file_resource", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "filename", "type": "value", "optional": false, "route": { "kind": "input", "name": "filename" } }, { "field": "password", "type": "value", "optional": true, "route": { "kind": "input", "name": "password" } }, { "field": "password_encryption", "type": "value", "optional": true, "enum": ["standard", "AES-128", "AES-192", "AES-256"], "route": { "kind": "input", "name": "password_encryption" } }] },
|
|
925
|
+
{ "name": "mvp:zip_delete_file_resource", "rules": [{ "field": "filename", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "filename" } }, { "field": "zip", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "zip" } }, { "field": "password", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "password" } }] },
|
|
926
|
+
{ "name": "mvp:zip_extract_file_resource", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "zip", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "zip" } }, { "field": "password", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "password" } }] },
|
|
927
|
+
{ "name": "mvp:zip_view_contents", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "zip", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "zip" } }, { "field": "password", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "password" } }] }
|
|
928
|
+
];
|
|
929
|
+
|
|
930
|
+
// src/statements/generated/factories.generated.ts
|
|
931
|
+
var SPECS = new Map(GENERATED_SPECS.map((s2) => [s2.name, s2]));
|
|
932
|
+
var fromSpec = (name, a) => encodeFromSpec(SPECS.get(name), a);
|
|
933
|
+
var generated = {
|
|
934
|
+
ai: {
|
|
935
|
+
external: {
|
|
936
|
+
mcp: {
|
|
937
|
+
server_details: (
|
|
938
|
+
/** `mvp:mcp_server_details` — fields: as, url, bearer_token, connection_type */
|
|
939
|
+
(a = {}) => fromSpec("mvp:mcp_server_details", a)
|
|
940
|
+
),
|
|
941
|
+
tool: {
|
|
942
|
+
list: (
|
|
943
|
+
/** `mvp:mcp_list_tools` — fields: as, url, bearer_token, connection_type */
|
|
944
|
+
(a = {}) => fromSpec("mvp:mcp_list_tools", a)
|
|
945
|
+
),
|
|
946
|
+
run: (
|
|
947
|
+
/** `mvp:mcp_call_tool` — fields: as, url, bearer_token, connection_type, tool, args */
|
|
948
|
+
(a = {}) => fromSpec("mvp:mcp_call_tool", a)
|
|
949
|
+
)
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
},
|
|
954
|
+
api: {
|
|
955
|
+
request: (
|
|
956
|
+
/** `mvp:api_request` — fields: as, url, method, params, headers, timeout, follow_location, verify_host, verify_peer, ca_certificate, certificate, certificate_pass, private_key, private_key_pass */
|
|
957
|
+
(a = {}) => fromSpec("mvp:api_request", a)
|
|
958
|
+
),
|
|
959
|
+
stream: (
|
|
960
|
+
/** `mvp:streaming_api_response` — fields: value */
|
|
961
|
+
(a) => fromSpec("mvp:streaming_api_response", a)
|
|
962
|
+
)
|
|
963
|
+
},
|
|
964
|
+
array: {
|
|
965
|
+
difference: (
|
|
966
|
+
/** `mvp:array_difference` — fields: as, expr, value, by */
|
|
967
|
+
(a = {}) => fromSpec("mvp:array_difference", a)
|
|
968
|
+
),
|
|
969
|
+
every: (
|
|
970
|
+
/** `mvp:array_every` — fields: expr, as, if */
|
|
971
|
+
(a = {}) => fromSpec("mvp:array_every", a)
|
|
972
|
+
),
|
|
973
|
+
filter: (
|
|
974
|
+
/** `mvp:array_filter` — fields: expr, as, if */
|
|
975
|
+
(a = {}) => fromSpec("mvp:array_filter", a)
|
|
976
|
+
),
|
|
977
|
+
filter_count: (
|
|
978
|
+
/** `mvp:array_filter_count` — fields: expr, as, if */
|
|
979
|
+
(a = {}) => fromSpec("mvp:array_filter_count", a)
|
|
980
|
+
),
|
|
981
|
+
find: (
|
|
982
|
+
/** `mvp:array_find` — fields: expr, as, if */
|
|
983
|
+
(a = {}) => fromSpec("mvp:array_find", a)
|
|
984
|
+
),
|
|
985
|
+
find_index: (
|
|
986
|
+
/** `mvp:array_find_index` — fields: expr, as, if */
|
|
987
|
+
(a = {}) => fromSpec("mvp:array_find_index", a)
|
|
988
|
+
),
|
|
989
|
+
group_by: (
|
|
990
|
+
/** `mvp:array_group_by` — fields: as, expr, by */
|
|
991
|
+
(a = {}) => fromSpec("mvp:array_group_by", a)
|
|
992
|
+
),
|
|
993
|
+
has: (
|
|
994
|
+
/** `mvp:array_has` — fields: expr, as, if */
|
|
995
|
+
(a = {}) => fromSpec("mvp:array_has", a)
|
|
996
|
+
),
|
|
997
|
+
intersection: (
|
|
998
|
+
/** `mvp:array_intersection` — fields: as, expr, value, by */
|
|
999
|
+
(a = {}) => fromSpec("mvp:array_intersection", a)
|
|
1000
|
+
),
|
|
1001
|
+
merge: (
|
|
1002
|
+
/** `mvp:array_merge` — fields: name, value */
|
|
1003
|
+
(a = {}) => fromSpec("mvp:array_merge", a)
|
|
1004
|
+
),
|
|
1005
|
+
partition: (
|
|
1006
|
+
/** `mvp:array_partition` — fields: expr, as, if */
|
|
1007
|
+
(a = {}) => fromSpec("mvp:array_partition", a)
|
|
1008
|
+
),
|
|
1009
|
+
pop: (
|
|
1010
|
+
/** `mvp:array_pop` — fields: name, as */
|
|
1011
|
+
(a = {}) => fromSpec("mvp:array_pop", a)
|
|
1012
|
+
),
|
|
1013
|
+
push: (
|
|
1014
|
+
/** `mvp:array_push` — fields: name, value */
|
|
1015
|
+
(a) => fromSpec("mvp:array_push", a)
|
|
1016
|
+
),
|
|
1017
|
+
shift: (
|
|
1018
|
+
/** `mvp:array_shift` — fields: name, as */
|
|
1019
|
+
(a = {}) => fromSpec("mvp:array_shift", a)
|
|
1020
|
+
),
|
|
1021
|
+
unshift: (
|
|
1022
|
+
/** `mvp:array_unshift` — fields: name, value */
|
|
1023
|
+
(a) => fromSpec("mvp:array_unshift", a)
|
|
1024
|
+
)
|
|
1025
|
+
},
|
|
1026
|
+
await: (
|
|
1027
|
+
/** `mvp:async_function_await` — fields: as, ids, timeout */
|
|
1028
|
+
(a = {}) => fromSpec("mvp:async_function_await", a)
|
|
1029
|
+
),
|
|
1030
|
+
cloud: {
|
|
1031
|
+
algolia: {
|
|
1032
|
+
request: (
|
|
1033
|
+
/** `mvp:algolia_request` — fields: as, application_id, api_key, url, method, payload */
|
|
1034
|
+
(a) => fromSpec("mvp:algolia_request", a)
|
|
1035
|
+
)
|
|
1036
|
+
},
|
|
1037
|
+
aws: {
|
|
1038
|
+
opensearch: {
|
|
1039
|
+
document: (
|
|
1040
|
+
/** `mvp:amazon_opensearch_document` — fields: as, auth_type, key_id, access_key, region, base_url, method, index, doc_id, doc */
|
|
1041
|
+
(a) => fromSpec("mvp:amazon_opensearch_document", a)
|
|
1042
|
+
),
|
|
1043
|
+
query: (
|
|
1044
|
+
/** `mvp:amazon_opensearch_query` — fields: as, auth_type, key_id, access_key, region, base_url, index, payload, size, from, included_fields, return_type, expression, sort */
|
|
1045
|
+
(a = {}) => fromSpec("mvp:amazon_opensearch_query", a)
|
|
1046
|
+
),
|
|
1047
|
+
request: (
|
|
1048
|
+
/** `mvp:amazon_opensearch_request` — fields: as, auth_type, key_id, access_key, region, method, url, query */
|
|
1049
|
+
(a = {}) => fromSpec("mvp:amazon_opensearch_request", a)
|
|
1050
|
+
)
|
|
1051
|
+
},
|
|
1052
|
+
s3: {
|
|
1053
|
+
delete_file: (
|
|
1054
|
+
/** `mvp:amazon_s3_delete_file` — fields: as, bucket, region, key, secret, file_key */
|
|
1055
|
+
(a) => fromSpec("mvp:amazon_s3_delete_file", a)
|
|
1056
|
+
),
|
|
1057
|
+
get_file_info: (
|
|
1058
|
+
/** `mvp:amazon_s3_get_file_metadata` — fields: as, bucket, region, key, secret, file_key */
|
|
1059
|
+
(a) => fromSpec("mvp:amazon_s3_get_file_metadata", a)
|
|
1060
|
+
),
|
|
1061
|
+
list_directory: (
|
|
1062
|
+
/** `mvp:amazon_s3_list_directory` — fields: as, bucket, region, key, secret, prefix, next_page_token */
|
|
1063
|
+
(a) => fromSpec("mvp:amazon_s3_list_directory", a)
|
|
1064
|
+
),
|
|
1065
|
+
read_file: (
|
|
1066
|
+
/** `mvp:amazon_s3_create_var_from_file_resource` — fields: as, bucket, region, key, secret, file_key */
|
|
1067
|
+
(a) => fromSpec("mvp:amazon_s3_create_var_from_file_resource", a)
|
|
1068
|
+
),
|
|
1069
|
+
sign_url: (
|
|
1070
|
+
/** `mvp:amazon_s3_signed_url` — fields: as, bucket, region, key, secret, file_key, ttl */
|
|
1071
|
+
(a) => fromSpec("mvp:amazon_s3_signed_url", a)
|
|
1072
|
+
),
|
|
1073
|
+
upload_file: (
|
|
1074
|
+
/** `mvp:amazon_s3_upload_file` — fields: as, bucket, region, key, secret, file_key, file, metadata, object_lock_mode, object_lock_retain_until */
|
|
1075
|
+
(a) => fromSpec("mvp:amazon_s3_upload_file", a)
|
|
1076
|
+
)
|
|
1077
|
+
}
|
|
1078
|
+
},
|
|
1079
|
+
azure: {
|
|
1080
|
+
storage: {
|
|
1081
|
+
delete_file: (
|
|
1082
|
+
/** `mvp:azure_blob_storage_delete_file` — fields: as, account_name, account_key, container_name, filePath */
|
|
1083
|
+
(a) => fromSpec("mvp:azure_blob_storage_delete_file", a)
|
|
1084
|
+
),
|
|
1085
|
+
get_file_info: (
|
|
1086
|
+
/** `mvp:azure_blob_storage_get_file_metadata` — fields: as, account_name, account_key, container_name, filePath */
|
|
1087
|
+
(a) => fromSpec("mvp:azure_blob_storage_get_file_metadata", a)
|
|
1088
|
+
),
|
|
1089
|
+
list_directory: (
|
|
1090
|
+
/** `mvp:azure_blob_storage_list_directory` — fields: as, account_name, account_key, container_name, path */
|
|
1091
|
+
(a) => fromSpec("mvp:azure_blob_storage_list_directory", a)
|
|
1092
|
+
),
|
|
1093
|
+
read_file: (
|
|
1094
|
+
/** `mvp:azure_blob_storage_create_var_from_file_resource` — fields: as, account_name, account_key, container_name, filePath */
|
|
1095
|
+
(a) => fromSpec("mvp:azure_blob_storage_create_var_from_file_resource", a)
|
|
1096
|
+
),
|
|
1097
|
+
sign_url: (
|
|
1098
|
+
/** `mvp:azure_blob_storage_signed_url` — fields: as, account_name, account_key, container_name, path, ttl */
|
|
1099
|
+
(a) => fromSpec("mvp:azure_blob_storage_signed_url", a)
|
|
1100
|
+
),
|
|
1101
|
+
upload_file: (
|
|
1102
|
+
/** `mvp:azure_blob_storage_upload_file` — fields: as, account_name, account_key, container_name, filePath, file, metadata */
|
|
1103
|
+
(a) => fromSpec("mvp:azure_blob_storage_upload_file", a)
|
|
1104
|
+
)
|
|
1105
|
+
}
|
|
1106
|
+
},
|
|
1107
|
+
elasticsearch: {
|
|
1108
|
+
document: (
|
|
1109
|
+
/** `mvp:elasticsearch_document` — fields: as, auth_type, key_id, access_key, base_url, index, method, doc_id, doc */
|
|
1110
|
+
(a) => fromSpec("mvp:elasticsearch_document", a)
|
|
1111
|
+
),
|
|
1112
|
+
query: (
|
|
1113
|
+
/** `mvp:elasticsearch_query` — fields: as, auth_type, key_id, access_key, base_url, index, payload, size, from, included_fields, return_type, expression, sort */
|
|
1114
|
+
(a = {}) => fromSpec("mvp:elasticsearch_query", a)
|
|
1115
|
+
),
|
|
1116
|
+
request: (
|
|
1117
|
+
/** `mvp:elasticsearch_request` — fields: as, auth_type, key_id, access_key, method, url, payload */
|
|
1118
|
+
(a = {}) => fromSpec("mvp:elasticsearch_request", a)
|
|
1119
|
+
)
|
|
1120
|
+
},
|
|
1121
|
+
google: {
|
|
1122
|
+
storage: {
|
|
1123
|
+
delete_file: (
|
|
1124
|
+
/** `mvp:google_cloud_storage_delete_file` — fields: as, service_account, bucket, filePath */
|
|
1125
|
+
(a) => fromSpec("mvp:google_cloud_storage_delete_file", a)
|
|
1126
|
+
),
|
|
1127
|
+
get_file_info: (
|
|
1128
|
+
/** `mvp:google_cloud_storage_get_file_metadata` — fields: as, service_account, bucket, filePath */
|
|
1129
|
+
(a) => fromSpec("mvp:google_cloud_storage_get_file_metadata", a)
|
|
1130
|
+
),
|
|
1131
|
+
list_directory: (
|
|
1132
|
+
/** `mvp:google_cloud_storage_list_directory` — fields: as, service_account, bucket, path */
|
|
1133
|
+
(a) => fromSpec("mvp:google_cloud_storage_list_directory", a)
|
|
1134
|
+
),
|
|
1135
|
+
read_file: (
|
|
1136
|
+
/** `mvp:google_cloud_storage_create_var_from_file_resource` — fields: as, service_account, bucket, filePath */
|
|
1137
|
+
(a) => fromSpec("mvp:google_cloud_storage_create_var_from_file_resource", a)
|
|
1138
|
+
),
|
|
1139
|
+
sign_url: (
|
|
1140
|
+
/** `mvp:google_cloud_storage_signed_url` — fields: as, service_account, bucket, filePath, method, ttl */
|
|
1141
|
+
(a) => fromSpec("mvp:google_cloud_storage_signed_url", a)
|
|
1142
|
+
),
|
|
1143
|
+
upload_file: (
|
|
1144
|
+
/** `mvp:google_cloud_storage_upload_file` — fields: as, service_account, bucket, filePath, file, metadata */
|
|
1145
|
+
(a) => fromSpec("mvp:google_cloud_storage_upload_file", a)
|
|
1146
|
+
)
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
datadog: {
|
|
1151
|
+
log: (
|
|
1152
|
+
/** `mvp:datadog_log` — fields: message, status, attributes, service, source, env, hostname, tags, timestamp, connection */
|
|
1153
|
+
(a = {}) => fromSpec("mvp:datadog_log", a)
|
|
1154
|
+
),
|
|
1155
|
+
log_bulk: (
|
|
1156
|
+
/** `mvp:datadog_log_bulk` — fields: entries, connection */
|
|
1157
|
+
(a) => fromSpec("mvp:datadog_log_bulk", a)
|
|
1158
|
+
),
|
|
1159
|
+
metric: (
|
|
1160
|
+
/** `mvp:datadog_metric` — fields: metric, value, type, tags, service, source, env, hostname, timestamp, connection */
|
|
1161
|
+
(a) => fromSpec("mvp:datadog_metric", a)
|
|
1162
|
+
),
|
|
1163
|
+
metric_bulk: (
|
|
1164
|
+
/** `mvp:datadog_metric_bulk` — fields: entries, connection */
|
|
1165
|
+
(a) => fromSpec("mvp:datadog_metric_bulk", a)
|
|
1166
|
+
)
|
|
1167
|
+
},
|
|
1168
|
+
db: {
|
|
1169
|
+
set_datasource: (
|
|
1170
|
+
/** `mvp:set_data_source` — fields: value, workspace_id */
|
|
1171
|
+
(a) => fromSpec("mvp:set_data_source", a)
|
|
1172
|
+
)
|
|
1173
|
+
},
|
|
1174
|
+
debug: {
|
|
1175
|
+
log: (
|
|
1176
|
+
/** `mvp:debug_log` — fields: value */
|
|
1177
|
+
(a) => fromSpec("mvp:debug_log", a)
|
|
1178
|
+
),
|
|
1179
|
+
stop: (
|
|
1180
|
+
/** `mvp:die` — fields: value */
|
|
1181
|
+
(a) => fromSpec("mvp:die", a)
|
|
1182
|
+
)
|
|
1183
|
+
},
|
|
1184
|
+
expect: {
|
|
1185
|
+
to_be_defined: (
|
|
1186
|
+
/** `mvp:test_expect_to_be_defined` — fields: expr */
|
|
1187
|
+
(a = {}) => fromSpec("mvp:test_expect_to_be_defined", a)
|
|
1188
|
+
),
|
|
1189
|
+
to_be_empty: (
|
|
1190
|
+
/** `mvp:test_expect_to_be_empty` — fields: expr */
|
|
1191
|
+
(a = {}) => fromSpec("mvp:test_expect_to_be_empty", a)
|
|
1192
|
+
),
|
|
1193
|
+
to_be_false: (
|
|
1194
|
+
/** `mvp:test_expect_to_be_false` — fields: expr */
|
|
1195
|
+
(a = {}) => fromSpec("mvp:test_expect_to_be_false", a)
|
|
1196
|
+
),
|
|
1197
|
+
to_be_greater_than: (
|
|
1198
|
+
/** `mvp:test_expect_to_be_greater_than` — fields: expr, value */
|
|
1199
|
+
(a = {}) => fromSpec("mvp:test_expect_to_be_greater_than", a)
|
|
1200
|
+
),
|
|
1201
|
+
to_be_in_the_future: (
|
|
1202
|
+
/** `mvp:test_expect_to_be_in_the_future` — fields: expr */
|
|
1203
|
+
(a = {}) => fromSpec("mvp:test_expect_to_be_in_the_future", a)
|
|
1204
|
+
),
|
|
1205
|
+
to_be_in_the_past: (
|
|
1206
|
+
/** `mvp:test_expect_to_be_in_the_past` — fields: expr */
|
|
1207
|
+
(a = {}) => fromSpec("mvp:test_expect_to_be_in_the_past", a)
|
|
1208
|
+
),
|
|
1209
|
+
to_be_less_than: (
|
|
1210
|
+
/** `mvp:test_expect_to_be_less_than` — fields: expr, value */
|
|
1211
|
+
(a = {}) => fromSpec("mvp:test_expect_to_be_less_than", a)
|
|
1212
|
+
),
|
|
1213
|
+
to_be_null: (
|
|
1214
|
+
/** `mvp:test_expect_to_be_null` — fields: expr */
|
|
1215
|
+
(a = {}) => fromSpec("mvp:test_expect_to_be_null", a)
|
|
1216
|
+
),
|
|
1217
|
+
to_be_true: (
|
|
1218
|
+
/** `mvp:test_expect_to_be_true` — fields: expr */
|
|
1219
|
+
(a = {}) => fromSpec("mvp:test_expect_to_be_true", a)
|
|
1220
|
+
),
|
|
1221
|
+
to_be_within: (
|
|
1222
|
+
/** `mvp:test_expect_to_be_within` — fields: expr, min, max */
|
|
1223
|
+
(a = {}) => fromSpec("mvp:test_expect_to_be_within", a)
|
|
1224
|
+
),
|
|
1225
|
+
to_contain: (
|
|
1226
|
+
/** `mvp:test_expect_to_contain` — fields: expr, value */
|
|
1227
|
+
(a = {}) => fromSpec("mvp:test_expect_to_contain", a)
|
|
1228
|
+
),
|
|
1229
|
+
to_end_with: (
|
|
1230
|
+
/** `mvp:test_expect_to_end_with` — fields: expr, value */
|
|
1231
|
+
(a = {}) => fromSpec("mvp:test_expect_to_end_with", a)
|
|
1232
|
+
),
|
|
1233
|
+
to_equal: (
|
|
1234
|
+
/** `mvp:test_expect_to_equal` — fields: expr, value */
|
|
1235
|
+
(a = {}) => fromSpec("mvp:test_expect_to_equal", a)
|
|
1236
|
+
),
|
|
1237
|
+
to_match: (
|
|
1238
|
+
/** `mvp:test_expect_to_match` — fields: expr, value */
|
|
1239
|
+
(a = {}) => fromSpec("mvp:test_expect_to_match", a)
|
|
1240
|
+
),
|
|
1241
|
+
to_not_be_defined: (
|
|
1242
|
+
/** `mvp:test_expect_to_not_be_defined` — fields: expr */
|
|
1243
|
+
(a = {}) => fromSpec("mvp:test_expect_to_not_be_defined", a)
|
|
1244
|
+
),
|
|
1245
|
+
to_not_be_null: (
|
|
1246
|
+
/** `mvp:test_expect_to_not_be_null` — fields: expr */
|
|
1247
|
+
(a = {}) => fromSpec("mvp:test_expect_to_not_be_null", a)
|
|
1248
|
+
),
|
|
1249
|
+
to_not_equal: (
|
|
1250
|
+
/** `mvp:test_expect_to_not_equal` — fields: expr, value */
|
|
1251
|
+
(a = {}) => fromSpec("mvp:test_expect_to_not_equal", a)
|
|
1252
|
+
),
|
|
1253
|
+
to_start_with: (
|
|
1254
|
+
/** `mvp:test_expect_to_start_with` — fields: expr, value */
|
|
1255
|
+
(a = {}) => fromSpec("mvp:test_expect_to_start_with", a)
|
|
1256
|
+
)
|
|
1257
|
+
},
|
|
1258
|
+
lambda: (
|
|
1259
|
+
/** `mvp:lambda` — fields: as, code, timeout */
|
|
1260
|
+
(a = {}) => fromSpec("mvp:lambda", a)
|
|
1261
|
+
),
|
|
1262
|
+
math: {
|
|
1263
|
+
add: (
|
|
1264
|
+
/** `mvp:math_add` — fields: name, value */
|
|
1265
|
+
(a) => fromSpec("mvp:math_add", a)
|
|
1266
|
+
),
|
|
1267
|
+
bitwise: {
|
|
1268
|
+
and: (
|
|
1269
|
+
/** `mvp:bitwise_and` — fields: name, value */
|
|
1270
|
+
(a) => fromSpec("mvp:bitwise_and", a)
|
|
1271
|
+
),
|
|
1272
|
+
or: (
|
|
1273
|
+
/** `mvp:bitwise_or` — fields: name, value */
|
|
1274
|
+
(a) => fromSpec("mvp:bitwise_or", a)
|
|
1275
|
+
),
|
|
1276
|
+
xor: (
|
|
1277
|
+
/** `mvp:bitwise_xor` — fields: name, value */
|
|
1278
|
+
(a) => fromSpec("mvp:bitwise_xor", a)
|
|
1279
|
+
)
|
|
1280
|
+
},
|
|
1281
|
+
div: (
|
|
1282
|
+
/** `mvp:math_div` — fields: name, value */
|
|
1283
|
+
(a) => fromSpec("mvp:math_div", a)
|
|
1284
|
+
),
|
|
1285
|
+
mod: (
|
|
1286
|
+
/** `mvp:math_mod` — fields: name, value */
|
|
1287
|
+
(a) => fromSpec("mvp:math_mod", a)
|
|
1288
|
+
),
|
|
1289
|
+
mul: (
|
|
1290
|
+
/** `mvp:math_mul` — fields: name, value */
|
|
1291
|
+
(a) => fromSpec("mvp:math_mul", a)
|
|
1292
|
+
),
|
|
1293
|
+
sub: (
|
|
1294
|
+
/** `mvp:math_sub` — fields: name, value */
|
|
1295
|
+
(a) => fromSpec("mvp:math_sub", a)
|
|
1296
|
+
)
|
|
1297
|
+
},
|
|
1298
|
+
microservice: {
|
|
1299
|
+
request: (
|
|
1300
|
+
/** `mvp:microservice_request` — fields: as, host, path, method, params, headers, timeout, follow_location */
|
|
1301
|
+
(a) => fromSpec("mvp:microservice_request", a)
|
|
1302
|
+
)
|
|
1303
|
+
},
|
|
1304
|
+
object: {
|
|
1305
|
+
entries: (
|
|
1306
|
+
/** `mvp:object_entries` — fields: as, value */
|
|
1307
|
+
(a = {}) => fromSpec("mvp:object_entries", a)
|
|
1308
|
+
),
|
|
1309
|
+
keys: (
|
|
1310
|
+
/** `mvp:object_keys` — fields: as, value */
|
|
1311
|
+
(a = {}) => fromSpec("mvp:object_keys", a)
|
|
1312
|
+
),
|
|
1313
|
+
values: (
|
|
1314
|
+
/** `mvp:object_values` — fields: as, value */
|
|
1315
|
+
(a = {}) => fromSpec("mvp:object_values", a)
|
|
1316
|
+
)
|
|
1317
|
+
},
|
|
1318
|
+
precondition: (
|
|
1319
|
+
/** `mvp:precondition` — fields: expr, error_type, error, payload */
|
|
1320
|
+
(a = {}) => fromSpec("mvp:precondition", a)
|
|
1321
|
+
),
|
|
1322
|
+
realtime: {
|
|
1323
|
+
get_session: (
|
|
1324
|
+
/** `mvp:get_session` — fields: as */
|
|
1325
|
+
(a = {}) => fromSpec("mvp:get_session", a)
|
|
1326
|
+
)
|
|
1327
|
+
},
|
|
1328
|
+
redis: {
|
|
1329
|
+
count: (
|
|
1330
|
+
/** `mvp:redis_countlist` — fields: as, key */
|
|
1331
|
+
(a) => fromSpec("mvp:redis_countlist", a)
|
|
1332
|
+
),
|
|
1333
|
+
decr: (
|
|
1334
|
+
/** `mvp:redis_decr` — fields: as, key, by */
|
|
1335
|
+
(a) => fromSpec("mvp:redis_decr", a)
|
|
1336
|
+
),
|
|
1337
|
+
del: (
|
|
1338
|
+
/** `mvp:redis_del` — fields: key */
|
|
1339
|
+
(a) => fromSpec("mvp:redis_del", a)
|
|
1340
|
+
),
|
|
1341
|
+
get: (
|
|
1342
|
+
/** `mvp:redis_get` — fields: as, key */
|
|
1343
|
+
(a) => fromSpec("mvp:redis_get", a)
|
|
1344
|
+
),
|
|
1345
|
+
has: (
|
|
1346
|
+
/** `mvp:redis_has` — fields: as, key */
|
|
1347
|
+
(a) => fromSpec("mvp:redis_has", a)
|
|
1348
|
+
),
|
|
1349
|
+
incr: (
|
|
1350
|
+
/** `mvp:redis_incr` — fields: as, key, by */
|
|
1351
|
+
(a) => fromSpec("mvp:redis_incr", a)
|
|
1352
|
+
),
|
|
1353
|
+
keys: (
|
|
1354
|
+
/** `mvp:redis_keys` — fields: as, search */
|
|
1355
|
+
(a) => fromSpec("mvp:redis_keys", a)
|
|
1356
|
+
),
|
|
1357
|
+
pop: (
|
|
1358
|
+
/** `mvp:redis_poplist` — fields: as, key, count */
|
|
1359
|
+
(a) => fromSpec("mvp:redis_poplist", a)
|
|
1360
|
+
),
|
|
1361
|
+
push: (
|
|
1362
|
+
/** `mvp:redis_pushlist` — fields: as, key, value */
|
|
1363
|
+
(a) => fromSpec("mvp:redis_pushlist", a)
|
|
1364
|
+
),
|
|
1365
|
+
range: (
|
|
1366
|
+
/** `mvp:redis_rangelist` — fields: as, key, start, stop */
|
|
1367
|
+
(a) => fromSpec("mvp:redis_rangelist", a)
|
|
1368
|
+
),
|
|
1369
|
+
ratelimit: (
|
|
1370
|
+
/** `mvp:redis_ratelimit` — fields: as, key, max, ttl, error */
|
|
1371
|
+
(a) => fromSpec("mvp:redis_ratelimit", a)
|
|
1372
|
+
),
|
|
1373
|
+
remove: (
|
|
1374
|
+
/** `mvp:redis_remove_list` — fields: as, key, value, count */
|
|
1375
|
+
(a) => fromSpec("mvp:redis_remove_list", a)
|
|
1376
|
+
),
|
|
1377
|
+
set: (
|
|
1378
|
+
/** `mvp:redis_set` — fields: as, key, data, ttl, create_only */
|
|
1379
|
+
(a) => fromSpec("mvp:redis_set", a)
|
|
1380
|
+
),
|
|
1381
|
+
shift: (
|
|
1382
|
+
/** `mvp:redis_shiftlist` — fields: as, key, count */
|
|
1383
|
+
(a) => fromSpec("mvp:redis_shiftlist", a)
|
|
1384
|
+
),
|
|
1385
|
+
unshift: (
|
|
1386
|
+
/** `mvp:redis_unshiftlist` — fields: as, key, value */
|
|
1387
|
+
(a) => fromSpec("mvp:redis_unshiftlist", a)
|
|
1388
|
+
)
|
|
1389
|
+
},
|
|
1390
|
+
security: {
|
|
1391
|
+
check_password: (
|
|
1392
|
+
/** `mvp:check_pass` — fields: as, text_password, hash_password */
|
|
1393
|
+
(a = {}) => fromSpec("mvp:check_pass", a)
|
|
1394
|
+
),
|
|
1395
|
+
create_curve_key: (
|
|
1396
|
+
/** `mvp:crypto_create_ec_key` — fields: as, curve, format */
|
|
1397
|
+
(a = {}) => fromSpec("mvp:crypto_create_ec_key", a)
|
|
1398
|
+
),
|
|
1399
|
+
create_password: (
|
|
1400
|
+
/** `mvp:generate_pass` — fields: as, character_count, require_lowercase, require_uppercase, require_digit, require_symbol, symbol_whitelist */
|
|
1401
|
+
(a = {}) => fromSpec("mvp:generate_pass", a)
|
|
1402
|
+
),
|
|
1403
|
+
create_rsa_key: (
|
|
1404
|
+
/** `mvp:crypto_create_rsa_key` — fields: as, bits, format */
|
|
1405
|
+
(a = {}) => fromSpec("mvp:crypto_create_rsa_key", a)
|
|
1406
|
+
),
|
|
1407
|
+
create_secret_key: (
|
|
1408
|
+
/** `mvp:crypto_create_octet_key` — fields: as, bits, format */
|
|
1409
|
+
(a = {}) => fromSpec("mvp:crypto_create_octet_key", a)
|
|
1410
|
+
),
|
|
1411
|
+
create_uuid: (
|
|
1412
|
+
/** `mvp:uuid4` — fields: as */
|
|
1413
|
+
(a = {}) => fromSpec("mvp:uuid4", a)
|
|
1414
|
+
),
|
|
1415
|
+
decrypt: (
|
|
1416
|
+
/** `mvp:crypto_decrypt` — fields: as, data, algorithm, key, iv */
|
|
1417
|
+
(a = {}) => fromSpec("mvp:crypto_decrypt", a)
|
|
1418
|
+
),
|
|
1419
|
+
encrypt: (
|
|
1420
|
+
/** `mvp:crypto_encrypt` — fields: as, data, algorithm, key, iv */
|
|
1421
|
+
(a = {}) => fromSpec("mvp:crypto_encrypt", a)
|
|
1422
|
+
),
|
|
1423
|
+
jwe_decode: (
|
|
1424
|
+
/** `mvp:crypto_jwe_decode2` — fields: as, token, key, check_claims, key_algorithm, content_algorithm, timeDrift */
|
|
1425
|
+
(a = {}) => fromSpec("mvp:crypto_jwe_decode2", a)
|
|
1426
|
+
),
|
|
1427
|
+
jwe_encode: (
|
|
1428
|
+
/** `mvp:crypto_jwe_encode3` — fields: as, headers, claims, key, key_algorithm, content_algorithm, ttl */
|
|
1429
|
+
(a = {}) => fromSpec("mvp:crypto_jwe_encode3", a)
|
|
1430
|
+
),
|
|
1431
|
+
jws_decode: (
|
|
1432
|
+
/** `mvp:crypto_jws_decode2` — fields: as, token, key, check_claims, signature_algorithm, timeDrift */
|
|
1433
|
+
(a = {}) => fromSpec("mvp:crypto_jws_decode2", a)
|
|
1434
|
+
),
|
|
1435
|
+
jws_encode: (
|
|
1436
|
+
/** `mvp:crypto_jws_encode2` — fields: as, headers, claims, key, signature_algorithm, ttl */
|
|
1437
|
+
(a = {}) => fromSpec("mvp:crypto_jws_encode2", a)
|
|
1438
|
+
),
|
|
1439
|
+
random_bytes: (
|
|
1440
|
+
/** `mvp:random_bytes` — fields: as, length */
|
|
1441
|
+
(a = {}) => fromSpec("mvp:random_bytes", a)
|
|
1442
|
+
),
|
|
1443
|
+
random_number: (
|
|
1444
|
+
/** `mvp:rand` — fields: as, min, max */
|
|
1445
|
+
(a = {}) => fromSpec("mvp:rand", a)
|
|
1446
|
+
)
|
|
1447
|
+
},
|
|
1448
|
+
storage: {
|
|
1449
|
+
create_attachment: (
|
|
1450
|
+
/** `mvp:create_attachment` — fields: as, value, access, filename, include_meta, type */
|
|
1451
|
+
(a) => fromSpec("mvp:create_attachment", a)
|
|
1452
|
+
),
|
|
1453
|
+
create_audio: (
|
|
1454
|
+
/** `mvp:create_audio` — fields: as, value, access, filename */
|
|
1455
|
+
(a) => fromSpec("mvp:create_audio", a)
|
|
1456
|
+
),
|
|
1457
|
+
create_file_resource: (
|
|
1458
|
+
/** `mvp:create_file_resource` — fields: as, filename, filedata */
|
|
1459
|
+
(a) => fromSpec("mvp:create_file_resource", a)
|
|
1460
|
+
),
|
|
1461
|
+
create_image: (
|
|
1462
|
+
/** `mvp:create_image` — fields: as, value, access, filename */
|
|
1463
|
+
(a) => fromSpec("mvp:create_image", a)
|
|
1464
|
+
),
|
|
1465
|
+
create_video: (
|
|
1466
|
+
/** `mvp:create_video` — fields: as, value, access, filename */
|
|
1467
|
+
(a) => fromSpec("mvp:create_video", a)
|
|
1468
|
+
),
|
|
1469
|
+
delete_file: (
|
|
1470
|
+
/** `mvp:delete_file` — fields: pathname */
|
|
1471
|
+
(a) => fromSpec("mvp:delete_file", a)
|
|
1472
|
+
),
|
|
1473
|
+
read_file_resource: (
|
|
1474
|
+
/** `mvp:create_var_from_file_resource` — fields: as, value */
|
|
1475
|
+
(a) => fromSpec("mvp:create_var_from_file_resource", a)
|
|
1476
|
+
),
|
|
1477
|
+
sign_private_url: (
|
|
1478
|
+
/** `mvp:vault_sign_url` — fields: as, pathname, ttl */
|
|
1479
|
+
(a) => fromSpec("mvp:vault_sign_url", a)
|
|
1480
|
+
)
|
|
1481
|
+
},
|
|
1482
|
+
stream: {
|
|
1483
|
+
from_csv: (
|
|
1484
|
+
/** `mvp:csv_stream` — fields: as, value, separator, enclosure, escape_char */
|
|
1485
|
+
(a) => fromSpec("mvp:csv_stream", a)
|
|
1486
|
+
),
|
|
1487
|
+
from_jsonl: (
|
|
1488
|
+
/** `mvp:jsonl_stream` — fields: as, value */
|
|
1489
|
+
(a) => fromSpec("mvp:jsonl_stream", a)
|
|
1490
|
+
),
|
|
1491
|
+
from_request: (
|
|
1492
|
+
/** `mvp:streaming_api_request` — fields: as, url, method, params, headers, timeout, follow_location, verify_host, verify_peer, ca_certificate, certificate, certificate_pass, private_key, private_key_pass */
|
|
1493
|
+
(a = {}) => fromSpec("mvp:streaming_api_request", a)
|
|
1494
|
+
)
|
|
1495
|
+
},
|
|
1496
|
+
text: {
|
|
1497
|
+
append: (
|
|
1498
|
+
/** `mvp:text_append` — fields: name, value */
|
|
1499
|
+
(a) => fromSpec("mvp:text_append", a)
|
|
1500
|
+
),
|
|
1501
|
+
contains: (
|
|
1502
|
+
/** `mvp:text_contains` — fields: name, as, value */
|
|
1503
|
+
(a) => fromSpec("mvp:text_contains", a)
|
|
1504
|
+
),
|
|
1505
|
+
ends_with: (
|
|
1506
|
+
/** `mvp:text_ends_with` — fields: name, as, value */
|
|
1507
|
+
(a) => fromSpec("mvp:text_ends_with", a)
|
|
1508
|
+
),
|
|
1509
|
+
icontains: (
|
|
1510
|
+
/** `mvp:text_icontains` — fields: name, as, value */
|
|
1511
|
+
(a) => fromSpec("mvp:text_icontains", a)
|
|
1512
|
+
),
|
|
1513
|
+
iends_with: (
|
|
1514
|
+
/** `mvp:text_iends_with` — fields: name, as, value */
|
|
1515
|
+
(a) => fromSpec("mvp:text_iends_with", a)
|
|
1516
|
+
),
|
|
1517
|
+
istarts_with: (
|
|
1518
|
+
/** `mvp:text_istarts_with` — fields: name, as, value */
|
|
1519
|
+
(a) => fromSpec("mvp:text_istarts_with", a)
|
|
1520
|
+
),
|
|
1521
|
+
ltrim: (
|
|
1522
|
+
/** `mvp:text_ltrim` — fields: name, value */
|
|
1523
|
+
(a) => fromSpec("mvp:text_ltrim", a)
|
|
1524
|
+
),
|
|
1525
|
+
prepend: (
|
|
1526
|
+
/** `mvp:text_prepend` — fields: name, value */
|
|
1527
|
+
(a) => fromSpec("mvp:text_prepend", a)
|
|
1528
|
+
),
|
|
1529
|
+
rtrim: (
|
|
1530
|
+
/** `mvp:text_rtrim` — fields: name, value */
|
|
1531
|
+
(a) => fromSpec("mvp:text_rtrim", a)
|
|
1532
|
+
),
|
|
1533
|
+
starts_with: (
|
|
1534
|
+
/** `mvp:text_starts_with` — fields: name, as, value */
|
|
1535
|
+
(a) => fromSpec("mvp:text_starts_with", a)
|
|
1536
|
+
),
|
|
1537
|
+
trim: (
|
|
1538
|
+
/** `mvp:text_trim` — fields: name, value */
|
|
1539
|
+
(a) => fromSpec("mvp:text_trim", a)
|
|
1540
|
+
)
|
|
1541
|
+
},
|
|
1542
|
+
throw: (
|
|
1543
|
+
/** `mvp:throw_error` — fields: name, value */
|
|
1544
|
+
(a) => fromSpec("mvp:throw_error", a)
|
|
1545
|
+
),
|
|
1546
|
+
util: {
|
|
1547
|
+
geo_distance: (
|
|
1548
|
+
/** `mvp:calculate_geo_distance` — fields: as, latitude_1, longitude_1, latitude_2, longitude_2 */
|
|
1549
|
+
(a = {}) => fromSpec("mvp:calculate_geo_distance", a)
|
|
1550
|
+
),
|
|
1551
|
+
get_all_input: (
|
|
1552
|
+
/** `mvp:get_all_input` — fields: as */
|
|
1553
|
+
(a = {}) => fromSpec("mvp:get_all_input", a)
|
|
1554
|
+
),
|
|
1555
|
+
get_env: (
|
|
1556
|
+
/** `mvp:get_env` — fields: as */
|
|
1557
|
+
(a = {}) => fromSpec("mvp:get_env", a)
|
|
1558
|
+
),
|
|
1559
|
+
get_vars: (
|
|
1560
|
+
/** `mvp:get_vars` — fields: as */
|
|
1561
|
+
(a = {}) => fromSpec("mvp:get_vars", a)
|
|
1562
|
+
),
|
|
1563
|
+
ip_lookup: (
|
|
1564
|
+
/** `mvp:ipaddress_lookup` — fields: as, value */
|
|
1565
|
+
(a) => fromSpec("mvp:ipaddress_lookup", a)
|
|
1566
|
+
),
|
|
1567
|
+
send_email: (
|
|
1568
|
+
/** `mvp:send_email` — fields: as, service_provider, api_key, subject, message, to, bcc, cc, from, reply_to, scheduled_at */
|
|
1569
|
+
(a = {}) => fromSpec("mvp:send_email", a)
|
|
1570
|
+
),
|
|
1571
|
+
set_header: (
|
|
1572
|
+
/** `mvp:setheader` — fields: value, duplicates */
|
|
1573
|
+
(a) => fromSpec("mvp:setheader", a)
|
|
1574
|
+
),
|
|
1575
|
+
sleep: (
|
|
1576
|
+
/** `mvp:sleep` — fields: value */
|
|
1577
|
+
(a) => fromSpec("mvp:sleep", a)
|
|
1578
|
+
),
|
|
1579
|
+
template_engine: (
|
|
1580
|
+
/** `mvp:template_string` — fields: as, value */
|
|
1581
|
+
(a) => fromSpec("mvp:template_string", a)
|
|
1582
|
+
)
|
|
1583
|
+
},
|
|
1584
|
+
webflow: {
|
|
1585
|
+
request: (
|
|
1586
|
+
/** `mvp:connect_webflow_api_request` — fields: as, path, method, params, headers, timeout, follow_location, verify_host, verify_peer, ca_certificate, certificate, certificate_pass, private_key, private_key_pass */
|
|
1587
|
+
(a = {}) => fromSpec("mvp:connect_webflow_api_request", a)
|
|
1588
|
+
)
|
|
1589
|
+
},
|
|
1590
|
+
zip: {
|
|
1591
|
+
add_to_archive: (
|
|
1592
|
+
/** `mvp:zip_add_file_resource` — fields: file, filename, zip, password, password_encryption */
|
|
1593
|
+
(a) => fromSpec("mvp:zip_add_file_resource", a)
|
|
1594
|
+
),
|
|
1595
|
+
create_archive: (
|
|
1596
|
+
/** `mvp:zip_create_file_resource` — fields: as, filename, password, password_encryption */
|
|
1597
|
+
(a) => fromSpec("mvp:zip_create_file_resource", a)
|
|
1598
|
+
),
|
|
1599
|
+
delete_from_archive: (
|
|
1600
|
+
/** `mvp:zip_delete_file_resource` — fields: filename, zip, password */
|
|
1601
|
+
(a) => fromSpec("mvp:zip_delete_file_resource", a)
|
|
1602
|
+
),
|
|
1603
|
+
extract: (
|
|
1604
|
+
/** `mvp:zip_extract_file_resource` — fields: as, zip, password */
|
|
1605
|
+
(a) => fromSpec("mvp:zip_extract_file_resource", a)
|
|
1606
|
+
),
|
|
1607
|
+
view_contents: (
|
|
1608
|
+
/** `mvp:zip_view_contents` — fields: as, zip, password */
|
|
1609
|
+
(a) => fromSpec("mvp:zip_view_contents", a)
|
|
1610
|
+
)
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
|
|
1614
|
+
// src/statements/special/misc.ts
|
|
1615
|
+
function vf3(v) {
|
|
1616
|
+
return { value: v.value, tag: v.tag, filters: v.filters };
|
|
1617
|
+
}
|
|
1618
|
+
function isTransformRecord(t) {
|
|
1619
|
+
return !isTaggedValue(t) && !Array.isArray(t);
|
|
1620
|
+
}
|
|
1621
|
+
function arrayMap(a) {
|
|
1622
|
+
const context = { output_type: "value", collection: vf3(a.source) };
|
|
1623
|
+
if (a.transform !== void 0) {
|
|
1624
|
+
const pairs = isTransformRecord(a.transform) ? Object.entries(a.transform).map(([key, value]) => ({ key: c.text(key), value })) : Array.isArray(a.transform) ? a.transform : void 0;
|
|
1625
|
+
if (pairs) {
|
|
1626
|
+
if (pairs.length === 0) {
|
|
1627
|
+
throw new Error(
|
|
1628
|
+
"array.map: an object `transform` needs at least one key \u2014 the engine's object branch iterates `transform_object` and an empty one maps every item to `{}`. Pass a record of values (`{ id: ref('$this') }`), a list of `{ key, value }` pairs, or a single value for the scalar form."
|
|
1629
|
+
);
|
|
1630
|
+
}
|
|
1631
|
+
context.output_type = "object";
|
|
1632
|
+
context.transform_object = pairs.map(({ key, value }) => ({
|
|
1633
|
+
attribute_key: vf3(key),
|
|
1634
|
+
attribute_value: vf3(value)
|
|
1635
|
+
}));
|
|
1636
|
+
} else {
|
|
1637
|
+
context.transform_value = vf3(a.transform);
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
return annotate({ name: "mvp:array_map", context, as: a.as ?? "", input: [] }, a);
|
|
1641
|
+
}
|
|
1642
|
+
function arrayUnion(a) {
|
|
1643
|
+
const context = { left: vf3(a.source) };
|
|
1644
|
+
if (a.with) context.right = vf3(a.with);
|
|
1645
|
+
if (a.transform) context.transform_value = vf3(a.transform);
|
|
1646
|
+
return annotate({ name: "mvp:array_union", context, as: a.as ?? "", input: [] }, a);
|
|
1647
|
+
}
|
|
1648
|
+
function comment(text = "", a) {
|
|
1649
|
+
return annotate({ name: "mvp:comment", description: text, context: {}, input: [] }, a);
|
|
1650
|
+
}
|
|
1651
|
+
function getRawInput(a = {}) {
|
|
1652
|
+
return annotate({
|
|
1653
|
+
name: "mvp:get_input",
|
|
1654
|
+
context: {},
|
|
1655
|
+
as: a.as ?? "",
|
|
1656
|
+
// Both entries are `?=` optionals in the engine schema (`encoding?=json`,
|
|
1657
|
+
// `exclude_middleware_modification?=false`) and Xano's editor writes neither
|
|
1658
|
+
// for a plain body capture — so they are emitted only when authored.
|
|
1659
|
+
input: [
|
|
1660
|
+
...a.encoding === void 0 ? [] : [{ name: "encoding", ...vf3(a.encoding) }],
|
|
1661
|
+
...a.excludeMiddleware === void 0 ? [] : [{ name: "exclude_middleware_modification", ...vf3(a.excludeMiddleware) }]
|
|
1662
|
+
]
|
|
1663
|
+
}, a);
|
|
1664
|
+
}
|
|
1665
|
+
function postProcess(body, a) {
|
|
1666
|
+
return annotate(
|
|
1667
|
+
{ name: "mvp:post_process", context: { run: body.map(encodeStatement) }, input: [] },
|
|
1668
|
+
a
|
|
1669
|
+
);
|
|
1670
|
+
}
|
|
1671
|
+
function realtimeEvent(a) {
|
|
1672
|
+
const auth = { row_id: vf3(a.authId) };
|
|
1673
|
+
if (a.authTable !== void 0) auth.dbo_id = resolveRef("dbo", a.authTable);
|
|
1674
|
+
return annotate({
|
|
1675
|
+
name: "mvp:realtime_event",
|
|
1676
|
+
context: { channel: vf3(a.channel), data: vf3(a.data), auth },
|
|
1677
|
+
input: []
|
|
1678
|
+
}, a);
|
|
1679
|
+
}
|
|
1680
|
+
function realtimePublish(a) {
|
|
1681
|
+
const server = publishServerValue(a.server);
|
|
1682
|
+
if (!a.channel || a.channel.value === "") {
|
|
1683
|
+
throw new Error(
|
|
1684
|
+
"realtime.publish: `channel` is required \u2014 the filled-in channel path to publish onto (use `realtimeChannel().getChannel({\u2026})`)."
|
|
1685
|
+
);
|
|
1686
|
+
}
|
|
1687
|
+
assertFilledChannel(a.channel);
|
|
1688
|
+
const context = {
|
|
1689
|
+
realtime_server: server,
|
|
1690
|
+
channel: vf3(a.channel),
|
|
1691
|
+
data: vf3(a.data)
|
|
1692
|
+
};
|
|
1693
|
+
if (a.message !== void 0) context.message = vf3(a.message);
|
|
1694
|
+
const auth = {};
|
|
1695
|
+
if (a.authTable !== void 0) auth.dbo_id = resolveRef("dbo", a.authTable);
|
|
1696
|
+
if (a.authId !== void 0) auth.row_id = vf3(a.authId);
|
|
1697
|
+
if (Object.keys(auth).length > 0) context.auth = auth;
|
|
1698
|
+
return annotate({ name: "mvp:realtime_publish", context, input: [] }, a);
|
|
1699
|
+
}
|
|
1700
|
+
function assertFilledChannel(channel) {
|
|
1701
|
+
if (!channel.tag.startsWith("const")) return;
|
|
1702
|
+
if (typeof channel.value !== "string" || !/[{}]/.test(channel.value)) return;
|
|
1703
|
+
throw new Error(
|
|
1704
|
+
`realtime.publish: \`channel\` is "${channel.value}", which is still a TEMPLATE \u2014 its {param} was never filled in, so this publishes onto a path no client can join, and the engine swallows the miss silently. Fill it in with \`channel.getChannel({ \u2026 })\` (e.g. \`c.text(rooms.getChannel({ room_id: 42 }))\`), or build the path at runtime from a \`ref\`/\`inp\`.`
|
|
1705
|
+
);
|
|
1706
|
+
}
|
|
1707
|
+
function publishServerValue(server) {
|
|
1708
|
+
if (typeof server === "string") {
|
|
1709
|
+
if (server === "") throw new Error("realtime.publish: `server` is required \u2014 the owning realtime server's name.");
|
|
1710
|
+
return { value: server, tag: "const", filters: [] };
|
|
1711
|
+
}
|
|
1712
|
+
if (server && typeof server === "object" && "tag" in server) return vf3(server);
|
|
1713
|
+
const name = server && typeof server === "object" ? server.name : void 0;
|
|
1714
|
+
if (!name) {
|
|
1715
|
+
throw new Error(
|
|
1716
|
+
"realtime.publish: `server` is required \u2014 pass the `realtimeServer()` handle, its name, or a value naming it."
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
return { value: name, tag: "const", filters: [] };
|
|
1720
|
+
}
|
|
1721
|
+
function createAuthToken(a) {
|
|
1722
|
+
return annotate({
|
|
1723
|
+
name: "mvp:create_auth",
|
|
1724
|
+
context: {},
|
|
1725
|
+
as: a.as ?? "",
|
|
1726
|
+
// Entry order and optionality come straight from the engine's own input
|
|
1727
|
+
// schema — `id`, `dbtable`, `extras?={}`, `expiration?=86400`. The SDK
|
|
1728
|
+
// previously wrote a different order with both optionals always present;
|
|
1729
|
+
// Xano's editor writes this shape, so this is what a pulled workspace has.
|
|
1730
|
+
input: [
|
|
1731
|
+
{ name: "id", ...vf3(a.id) },
|
|
1732
|
+
{
|
|
1733
|
+
name: "dbtable",
|
|
1734
|
+
value: a.table === null ? "" : resolveRef("dbo", a.table),
|
|
1735
|
+
tag: "const",
|
|
1736
|
+
filters: []
|
|
1737
|
+
},
|
|
1738
|
+
...a.extras === void 0 ? [] : [{ name: "extras", ...vf3(a.extras) }],
|
|
1739
|
+
...a.expiration === void 0 ? [] : [{ name: "expiration", ...vf3(a.expiration) }]
|
|
1740
|
+
]
|
|
1741
|
+
}, a);
|
|
1742
|
+
}
|
|
1743
|
+
function createGuid(a = {}) {
|
|
1744
|
+
return annotate({
|
|
1745
|
+
name: "mvp:guid",
|
|
1746
|
+
context: {},
|
|
1747
|
+
as: a.as ?? "",
|
|
1748
|
+
input: []
|
|
1749
|
+
}, a);
|
|
1750
|
+
}
|
|
1751
|
+
function expectToThrow(a) {
|
|
1752
|
+
const context = { run: a.body.map(encodeStatement) };
|
|
1753
|
+
if (a.exception) context.value1 = vf3(a.exception);
|
|
1754
|
+
return annotate({ name: "mvp:test_expect_to_throw", context, input: [] }, a);
|
|
1755
|
+
}
|
|
1756
|
+
function expectToMatch(a = {}) {
|
|
1757
|
+
if (a.value) {
|
|
1758
|
+
const refusal = barePatternRefusal(a.value);
|
|
1759
|
+
if (refusal) throw new Error(`s.expect.to_match: ${refusal}. (issue #211)`);
|
|
1760
|
+
}
|
|
1761
|
+
return generated.expect.to_match(a);
|
|
1762
|
+
}
|
|
1763
|
+
registerStatement("mvp:array_map", arrayMap);
|
|
1764
|
+
registerStatement("mvp:guid", createGuid);
|
|
1765
|
+
registerStatement("mvp:array_union", arrayUnion);
|
|
1766
|
+
registerStatement("mvp:comment", comment);
|
|
1767
|
+
registerStatement("mvp:get_input", getRawInput);
|
|
1768
|
+
registerStatement("mvp:post_process", postProcess);
|
|
1769
|
+
registerStatement("mvp:realtime_event", realtimeEvent);
|
|
1770
|
+
registerStatement("mvp:realtime_publish", realtimePublish);
|
|
1771
|
+
registerStatement("mvp:create_auth", createAuthToken);
|
|
1772
|
+
registerStatement("mvp:test_expect_to_throw", expectToThrow);
|
|
1773
|
+
|
|
1774
|
+
// src/statements/special/ip-lookup.ts
|
|
1775
|
+
function ipLookup(a) {
|
|
1776
|
+
return generated.util.ip_lookup({
|
|
1777
|
+
as: a.as,
|
|
1778
|
+
value: a.value,
|
|
1779
|
+
disabled: a.disabled,
|
|
1780
|
+
description: a.description
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
// src/statements/special/output-select.ts
|
|
1785
|
+
function encodeOutputItems(paths) {
|
|
1786
|
+
const roots = [];
|
|
1787
|
+
const whole = /* @__PURE__ */ new Set();
|
|
1788
|
+
for (const path of paths) {
|
|
1789
|
+
const segments = path.split(".");
|
|
1790
|
+
if (segments.some((segment) => segment === "")) {
|
|
1791
|
+
throw new Error(
|
|
1792
|
+
`db output: "${path}" has an empty path segment \u2014 use "column" or "column.key".`
|
|
1793
|
+
);
|
|
1794
|
+
}
|
|
1795
|
+
let level = roots;
|
|
1796
|
+
let walked = "";
|
|
1797
|
+
for (let i = 0; i < segments.length; i++) {
|
|
1798
|
+
const name = segments[i];
|
|
1799
|
+
walked = walked === "" ? name : `${walked}.${name}`;
|
|
1800
|
+
let node = level.find((item) => item.name === name);
|
|
1801
|
+
if (!node) {
|
|
1802
|
+
node = { name, children: [] };
|
|
1803
|
+
level.push(node);
|
|
1804
|
+
} else if (whole.has(walked) || i === segments.length - 1) {
|
|
1805
|
+
throw new Error(
|
|
1806
|
+
`db output: "${walked}" is selected both whole and by sub-key \u2014 list either "${walked}" or its "${walked}.<key>" paths, not both.`
|
|
1807
|
+
);
|
|
1808
|
+
}
|
|
1809
|
+
if (i === segments.length - 1) whole.add(walked);
|
|
1810
|
+
level = node.children;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
return roots;
|
|
1814
|
+
}
|
|
1815
|
+
function outputPaths(items) {
|
|
1816
|
+
if (!Array.isArray(items)) return null;
|
|
1817
|
+
const out = [];
|
|
1818
|
+
const walk = (list, prefix) => list.every((raw) => {
|
|
1819
|
+
if (raw === null || typeof raw !== "object") return false;
|
|
1820
|
+
const node = raw;
|
|
1821
|
+
if (typeof node.name !== "string" || node.name === "" || node.name.includes(".")) return false;
|
|
1822
|
+
const path = prefix === "" ? node.name : `${prefix}.${node.name}`;
|
|
1823
|
+
const children = node.children;
|
|
1824
|
+
if (children === void 0 || Array.isArray(children) && children.length === 0) {
|
|
1825
|
+
out.push(path);
|
|
1826
|
+
return true;
|
|
1827
|
+
}
|
|
1828
|
+
if (!Array.isArray(children)) return false;
|
|
1829
|
+
return walk(children, path);
|
|
1830
|
+
});
|
|
1831
|
+
return walk(items, "") ? out : null;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
// src/statements/special/addon-encode.ts
|
|
1835
|
+
function encodeInput2(input2) {
|
|
1836
|
+
if (!input2) return [];
|
|
1837
|
+
return Object.entries(input2).map(([name, v]) => leanInput(name, v));
|
|
1838
|
+
}
|
|
1839
|
+
function encodeOutput(cols) {
|
|
1840
|
+
if (!cols?.length) return void 0;
|
|
1841
|
+
return { customize: true, items: encodeOutputItems(cols) };
|
|
1842
|
+
}
|
|
1843
|
+
function splitAs(as) {
|
|
1844
|
+
if (!as) {
|
|
1845
|
+
throw new Error('addon: `as` must be a non-empty destination, e.g. "items._book" or "_book".');
|
|
1846
|
+
}
|
|
1847
|
+
const dot = as.lastIndexOf(".");
|
|
1848
|
+
if (dot === -1) return { as };
|
|
1849
|
+
const offset = as.slice(0, dot);
|
|
1850
|
+
const alias = as.slice(dot + 1);
|
|
1851
|
+
if (!offset || !alias) {
|
|
1852
|
+
throw new Error(
|
|
1853
|
+
`addon: \`as\` "${as}" has an empty offset or alias segment \u2014 use "offset.alias" (e.g. "items._book") or a bare alias ("_book").`
|
|
1854
|
+
);
|
|
1855
|
+
}
|
|
1856
|
+
return { offset, as: alias };
|
|
1857
|
+
}
|
|
1858
|
+
function withEnvelopeOffset(offset, envelopeOffset) {
|
|
1859
|
+
if (offset?.startsWith(envelopeOffset)) return offset;
|
|
1860
|
+
return [envelopeOffset, offset].filter(Boolean).join(".");
|
|
1861
|
+
}
|
|
1862
|
+
function encodeOne(spec2, path, envelopeOffset) {
|
|
1863
|
+
if (path.includes(spec2)) {
|
|
1864
|
+
throw new Error("addon: `children` cannot reference an ancestor addon spec (cycle detected).");
|
|
1865
|
+
}
|
|
1866
|
+
const { offset, as } = splitAs(spec2.as);
|
|
1867
|
+
const finalOffset = envelopeOffset !== void 0 ? withEnvelopeOffset(offset, envelopeOffset) : offset;
|
|
1868
|
+
const stored = {
|
|
1869
|
+
// An unbound attachment stores a blank id — the same "no target" the engine
|
|
1870
|
+
// writes, and the same spelling `table: null` / `fn: null` already use.
|
|
1871
|
+
id: spec2.addon === null ? "" : resolveRef("addon", spec2.addon),
|
|
1872
|
+
as,
|
|
1873
|
+
input: encodeInput2(spec2.input)
|
|
1874
|
+
};
|
|
1875
|
+
if (finalOffset) stored.offset = finalOffset;
|
|
1876
|
+
const output = encodeOutput(spec2.output);
|
|
1877
|
+
if (output !== void 0) stored.output = output;
|
|
1878
|
+
if (spec2.children?.length) {
|
|
1879
|
+
const nextPath = [...path, spec2];
|
|
1880
|
+
stored.children = spec2.children.map((child) => encodeOne(child, nextPath));
|
|
1881
|
+
}
|
|
1882
|
+
return stored;
|
|
1883
|
+
}
|
|
1884
|
+
function encodeAddons(specs, envelopeOffset) {
|
|
1885
|
+
if (!specs?.length) return [];
|
|
1886
|
+
return specs.map((spec2) => encodeOne(spec2, [], envelopeOffset));
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
// src/statements/special/db.ts
|
|
1890
|
+
function entry(name, v, ignore = false, children = []) {
|
|
1891
|
+
assertInputValue(name, v);
|
|
1892
|
+
return {
|
|
1893
|
+
name,
|
|
1894
|
+
value: v.value,
|
|
1895
|
+
tag: v.tag,
|
|
1896
|
+
filters: v.filters,
|
|
1897
|
+
ignore,
|
|
1898
|
+
expand: children.length > 0,
|
|
1899
|
+
children
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
function envelope(opts = {}) {
|
|
1903
|
+
const { output: outputCols, addon: addons, addonOffset } = opts;
|
|
1904
|
+
return {
|
|
1905
|
+
description: "",
|
|
1906
|
+
settings_registry: [],
|
|
1907
|
+
// An empty selection normalizes to the full-record default — `[]` must not
|
|
1908
|
+
// emit the degenerate `{customize:true, items:[]}` shape no golden attests.
|
|
1909
|
+
output: outputCols?.length ? { customize: true, filters: [], items: encodeOutputItems(outputCols) } : { customize: false, filters: [], items: [] },
|
|
1910
|
+
// `encodeAddons` returns `[]` when omitted, preserving the empty-`addon:[]`
|
|
1911
|
+
// default byte-for-byte for statements that attach none.
|
|
1912
|
+
addon: encodeAddons(addons, addonOffset)
|
|
1913
|
+
};
|
|
1914
|
+
}
|
|
1915
|
+
function assertNoAddonShadow(table, addons) {
|
|
1916
|
+
if (!addons?.length) return;
|
|
1917
|
+
if (typeof table === "string" || !("schema" in table)) return;
|
|
1918
|
+
const cols = new Set(tableColumns(table).map((col) => col.name));
|
|
1919
|
+
for (const spec2 of addons) {
|
|
1920
|
+
const as = spec2.as;
|
|
1921
|
+
const dot = as.lastIndexOf(".");
|
|
1922
|
+
const alias = dot === -1 ? as : as.slice(dot + 1);
|
|
1923
|
+
if (cols.has(alias)) {
|
|
1924
|
+
throw new Error(
|
|
1925
|
+
`addon: alias "${alias}" (from as:"${as}") shadows an existing "${table.name}" column \u2014 the graft overwrites it at runtime and desyncs the row type. Rename the alias (Xano convention: a "_" prefix, e.g. as:"${dot === -1 ? "" : as.slice(0, dot + 1)}_${alias}").`
|
|
1926
|
+
);
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
function dboBinding(table, tableAlias) {
|
|
1931
|
+
const dbo = { id: table === null ? "" : resolveRef("dbo", table) };
|
|
1932
|
+
if (tableAlias !== void 0) dbo.as = tableAlias;
|
|
1933
|
+
return dbo;
|
|
1934
|
+
}
|
|
1935
|
+
function dboStatement(name, table, as, input2, opts = {}, tableAlias, enforceHiddenFields) {
|
|
1936
|
+
if (table !== null) assertNoAddonShadow(table, opts.addon);
|
|
1937
|
+
return {
|
|
1938
|
+
name,
|
|
1939
|
+
context: {
|
|
1940
|
+
dbo: dboBinding(table, tableAlias),
|
|
1941
|
+
// Written only when ON. The engine declares `enforce_hidden_fields?=false`
|
|
1942
|
+
// and reads it as `?? false`, so absent IS off — and every one of the 557
|
|
1943
|
+
// stored `dbo_add` statements in the offline corpus omits it.
|
|
1944
|
+
...enforceHiddenFields === true ? { enforce_hidden_fields: true } : {}
|
|
1945
|
+
},
|
|
1946
|
+
as: as ?? "",
|
|
1947
|
+
input: input2,
|
|
1948
|
+
...envelope(opts)
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
function dbGet(args) {
|
|
1952
|
+
return annotate(dboStatement(
|
|
1953
|
+
"mvp:dbo_getby",
|
|
1954
|
+
args.table,
|
|
1955
|
+
args.as,
|
|
1956
|
+
[
|
|
1957
|
+
entry("field_name", c.text(args.fieldName ?? "id")),
|
|
1958
|
+
entry("field_value", args.fieldValue),
|
|
1959
|
+
// `lock?=false` in the engine schema, and Xano's own editor omits the entry
|
|
1960
|
+
// when it is not set. Writing it unconditionally is a divergence, not a
|
|
1961
|
+
// clarification — so it is written only when the author asks for a lock.
|
|
1962
|
+
...args.lock === void 0 ? [] : [entry("lock", c.bool(args.lock))]
|
|
1963
|
+
],
|
|
1964
|
+
{ output: args.output, addon: args.addon },
|
|
1965
|
+
args.tableAlias
|
|
1966
|
+
), args);
|
|
1967
|
+
}
|
|
1968
|
+
function dbGetById(args) {
|
|
1969
|
+
return annotate(dboStatement(
|
|
1970
|
+
"mvp:dbo_get",
|
|
1971
|
+
args.table,
|
|
1972
|
+
args.as,
|
|
1973
|
+
[entry("id", args.id)],
|
|
1974
|
+
{ output: args.output, addon: args.addon },
|
|
1975
|
+
args.tableAlias
|
|
1976
|
+
), args);
|
|
1977
|
+
}
|
|
1978
|
+
function dbDel(args) {
|
|
1979
|
+
return annotate(dboStatement(
|
|
1980
|
+
"mvp:dbo_delby",
|
|
1981
|
+
args.table,
|
|
1982
|
+
args.as,
|
|
1983
|
+
[entry("field_name", c.text(args.fieldName ?? "id")), entry("field_value", args.fieldValue)],
|
|
1984
|
+
{},
|
|
1985
|
+
args.tableAlias
|
|
1986
|
+
), args);
|
|
1987
|
+
}
|
|
1988
|
+
function dbHas(args) {
|
|
1989
|
+
return annotate(dboStatement(
|
|
1990
|
+
"mvp:dbo_hasby",
|
|
1991
|
+
args.table,
|
|
1992
|
+
args.as,
|
|
1993
|
+
[entry("field_name", c.text(args.fieldName ?? "id")), entry("field_value", args.fieldValue)],
|
|
1994
|
+
{},
|
|
1995
|
+
args.tableAlias
|
|
1996
|
+
), args);
|
|
1997
|
+
}
|
|
1998
|
+
function dbPatch(args) {
|
|
1999
|
+
return annotate(dboStatement(
|
|
2000
|
+
"mvp:dbo_patch",
|
|
2001
|
+
args.table,
|
|
2002
|
+
args.as,
|
|
2003
|
+
[
|
|
2004
|
+
entry("field_name", c.text(args.fieldName ?? "id")),
|
|
2005
|
+
entry("field_value", args.fieldValue),
|
|
2006
|
+
entry("item", args.data)
|
|
2007
|
+
],
|
|
2008
|
+
{ output: args.output, addon: args.addon },
|
|
2009
|
+
args.tableAlias
|
|
2010
|
+
), args);
|
|
2011
|
+
}
|
|
2012
|
+
function dbTruncate(args) {
|
|
2013
|
+
return annotate(dboStatement(
|
|
2014
|
+
"mvp:dbo_truncate",
|
|
2015
|
+
args.table,
|
|
2016
|
+
args.as,
|
|
2017
|
+
args.reset === void 0 ? [] : [entry("reset", c.bool(args.reset))],
|
|
2018
|
+
{},
|
|
2019
|
+
args.tableAlias
|
|
2020
|
+
), args);
|
|
2021
|
+
}
|
|
2022
|
+
function rowEntries(data) {
|
|
2023
|
+
return data.map(
|
|
2024
|
+
(f2) => entry(f2.name, f2.value, f2.ignore ?? false, f2.children ? rowEntries(f2.children) : [])
|
|
2025
|
+
);
|
|
2026
|
+
}
|
|
2027
|
+
var SYSTEM_IGNORE = {
|
|
2028
|
+
add: /* @__PURE__ */ new Set(["id"]),
|
|
2029
|
+
edit: /* @__PURE__ */ new Set(["id", "created_at"])
|
|
2030
|
+
};
|
|
2031
|
+
function defaultCell(col) {
|
|
2032
|
+
if (col.default !== void 0 && col.default !== "") return c.text(String(col.default));
|
|
2033
|
+
if (col.array || col.style?.type === "list") return c.array([]);
|
|
2034
|
+
if (col.type === "obj" || col.type === "json") return c.obj({});
|
|
2035
|
+
return c.null();
|
|
2036
|
+
}
|
|
2037
|
+
function columnsOf(table) {
|
|
2038
|
+
if (typeof table === "object" && "schema" in table && table.schema) {
|
|
2039
|
+
return tableColumns(table);
|
|
2040
|
+
}
|
|
2041
|
+
throw new Error(
|
|
2042
|
+
"db row expansion needs the table definition (with a schema). Pass the table object, or author the row explicitly via `data: [...]`."
|
|
2043
|
+
);
|
|
2044
|
+
}
|
|
2045
|
+
function requireBoundTable(table, argName) {
|
|
2046
|
+
if (table === null) {
|
|
2047
|
+
throw new Error(
|
|
2048
|
+
`db: \`${argName}\` needs the table's columns, but \`table\` is null (an unbound statement). \`table: null\` represents a statement whose table was deleted \u2014 fix the binding, or pass the row values as \`data:\` instead of \`${argName}:\`.`
|
|
2049
|
+
);
|
|
2050
|
+
}
|
|
2051
|
+
return table;
|
|
2052
|
+
}
|
|
2053
|
+
function expandRow(table, row, op) {
|
|
2054
|
+
const cols = columnsOf(table);
|
|
2055
|
+
const colNames = new Set(cols.map((col) => col.name));
|
|
2056
|
+
for (const key of Object.keys(row)) {
|
|
2057
|
+
if (!colNames.has(key)) {
|
|
2058
|
+
const name = typeof table === "string" ? table : table.name;
|
|
2059
|
+
throw new Error(`db row: "${key}" is not a column of table "${name}".`);
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
const systemIgnore = SYSTEM_IGNORE[op];
|
|
2063
|
+
return cols.map((col) => {
|
|
2064
|
+
const cell = row[col.name];
|
|
2065
|
+
const supplied = cell !== void 0;
|
|
2066
|
+
const ignore = systemIgnore.has(col.name) || op === "edit" && !supplied;
|
|
2067
|
+
if (supplied && isNestedCell(cell)) {
|
|
2068
|
+
return { name: col.name, value: c.text(""), ignore, children: nestedFields(cell) };
|
|
2069
|
+
}
|
|
2070
|
+
const isCell = typeof cell === "object" ? cell !== null : typeof cell === "function";
|
|
2071
|
+
const value = !supplied ? defaultCell(col) : isCell ? cell : coerceCell(table, col, cell);
|
|
2072
|
+
return { name: col.name, value, ignore };
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
function isNestedCell(cell) {
|
|
2076
|
+
if (typeof cell !== "object" || cell === null || Array.isArray(cell)) return false;
|
|
2077
|
+
const v = cell;
|
|
2078
|
+
return !(typeof v.tag === "string" && typeof v.value === "string" && Array.isArray(v.filters));
|
|
2079
|
+
}
|
|
2080
|
+
function nestedFields(cell) {
|
|
2081
|
+
return Object.entries(cell).map(([name, value]) => {
|
|
2082
|
+
const child = value;
|
|
2083
|
+
return isNestedCell(child) ? { name, value: c.text(""), children: nestedFields(child) } : { name, value: child };
|
|
2084
|
+
});
|
|
2085
|
+
}
|
|
2086
|
+
function dbAdd(args) {
|
|
2087
|
+
const data = args.row !== void 0 ? expandRow(requireBoundTable(args.table, "row"), args.row, "add") : args.data ?? [];
|
|
2088
|
+
return annotate(dboStatement(
|
|
2089
|
+
"mvp:dbo_add",
|
|
2090
|
+
args.table,
|
|
2091
|
+
args.as,
|
|
2092
|
+
rowEntries(data),
|
|
2093
|
+
{ output: args.output, addon: args.addon },
|
|
2094
|
+
args.tableAlias,
|
|
2095
|
+
args.enforceHiddenFields
|
|
2096
|
+
), args);
|
|
2097
|
+
}
|
|
2098
|
+
function dbEdit(args) {
|
|
2099
|
+
const data = args.row !== void 0 ? expandRow(requireBoundTable(args.table, "row"), args.row, "edit") : args.data ?? [];
|
|
2100
|
+
return annotate(dboStatement(
|
|
2101
|
+
"mvp:dbo_editby",
|
|
2102
|
+
args.table,
|
|
2103
|
+
args.as,
|
|
2104
|
+
[
|
|
2105
|
+
entry("field_name", c.text(args.fieldName ?? "id")),
|
|
2106
|
+
entry("field_value", args.fieldValue),
|
|
2107
|
+
...rowEntries(data)
|
|
2108
|
+
],
|
|
2109
|
+
{ output: args.output, addon: args.addon },
|
|
2110
|
+
args.tableAlias,
|
|
2111
|
+
args.enforceHiddenFields
|
|
2112
|
+
), args);
|
|
2113
|
+
}
|
|
2114
|
+
function dbAddOrEdit(args) {
|
|
2115
|
+
const data = args.row !== void 0 ? expandRow(requireBoundTable(args.table, "row"), args.row, "edit") : args.data ?? [];
|
|
2116
|
+
const input2 = [
|
|
2117
|
+
leanInput("field_name", c.text(args.fieldName ?? "id")),
|
|
2118
|
+
leanInput("field_value", args.fieldValue),
|
|
2119
|
+
...data.map((f2) => ({ ignore: f2.ignore ?? false, ...leanInput(f2.name, f2.value) }))
|
|
2120
|
+
];
|
|
2121
|
+
return annotate({
|
|
2122
|
+
name: "mvp:dbo_addoreditby",
|
|
2123
|
+
context: {
|
|
2124
|
+
dbo: dboBinding(args.table, args.tableAlias),
|
|
2125
|
+
...args.enforceHiddenFields === true ? { enforce_hidden_fields: true } : {}
|
|
2126
|
+
},
|
|
2127
|
+
as: args.as ?? "",
|
|
2128
|
+
input: input2
|
|
2129
|
+
}, args);
|
|
2130
|
+
}
|
|
2131
|
+
function dbSchema(args) {
|
|
2132
|
+
return annotate(dboStatement(
|
|
2133
|
+
"mvp:dbo_get_schema",
|
|
2134
|
+
args.table,
|
|
2135
|
+
args.as,
|
|
2136
|
+
[entry("path", args.path)],
|
|
2137
|
+
{},
|
|
2138
|
+
args.tableAlias
|
|
2139
|
+
), args);
|
|
2140
|
+
}
|
|
2141
|
+
function dbDirectQuery(args) {
|
|
2142
|
+
return annotate({
|
|
2143
|
+
name: "mvp:dbo_direct_query",
|
|
2144
|
+
context: {
|
|
2145
|
+
code: args.sql,
|
|
2146
|
+
response_type: args.responseType ?? "list",
|
|
2147
|
+
...args.parser === void 0 ? {} : { parser: args.parser },
|
|
2148
|
+
arg: (args.args ?? []).map((v) => ({ value: v.value, tag: v.tag, filters: v.filters }))
|
|
2149
|
+
},
|
|
2150
|
+
as: args.as ?? "",
|
|
2151
|
+
input: [],
|
|
2152
|
+
...envelope()
|
|
2153
|
+
}, args);
|
|
2154
|
+
}
|
|
2155
|
+
function assertBulkAddIds(args) {
|
|
2156
|
+
if (args.allowIdField !== void 0) return;
|
|
2157
|
+
const items = args.items;
|
|
2158
|
+
if (items.tag !== "const:array" || items.filters.length > 0) return;
|
|
2159
|
+
let rows;
|
|
2160
|
+
try {
|
|
2161
|
+
rows = JSON.parse(items.value);
|
|
2162
|
+
} catch {
|
|
2163
|
+
return;
|
|
2164
|
+
}
|
|
2165
|
+
if (!Array.isArray(rows)) return;
|
|
2166
|
+
const withId = rows.findIndex(
|
|
2167
|
+
(r) => typeof r === "object" && r !== null && !Array.isArray(r) && "id" in r
|
|
2168
|
+
);
|
|
2169
|
+
if (withId === -1) return;
|
|
2170
|
+
throw new Error(
|
|
2171
|
+
`db.bulk.add: item ${withId} carries an \`id\`, but \`allowIdField\` is not set \u2014 the engine DROPS \`id\` from every row unless it is on, assigning the next sequence value instead, with no error. Rows land at ids nothing else expects and foreign keys written against them point at the wrong rows. Pass \`allowIdField: true\` to pin the ids you supplied, or \`allowIdField: false\` to state that engine-assigned ids are intended. (Unlike a table \`seed\`, where supplying \`id\` pins it.) (issue #259)`
|
|
2172
|
+
);
|
|
2173
|
+
}
|
|
2174
|
+
function bulkStatement(name, table, as, input2, tableAlias) {
|
|
2175
|
+
return { name, context: { dbo: dboBinding(table, tableAlias) }, as: as ?? "", input: input2 };
|
|
2176
|
+
}
|
|
2177
|
+
function dbBulkAdd(args) {
|
|
2178
|
+
assertBulkAddIds(args);
|
|
2179
|
+
return annotate(bulkStatement("mvp:dbo_bulkadd", args.table, args.as, [
|
|
2180
|
+
...args.allowIdField === void 0 ? [] : [leanInput("allow_id_field", c.bool(args.allowIdField))],
|
|
2181
|
+
leanInput("items", args.items)
|
|
2182
|
+
], args.tableAlias), args);
|
|
2183
|
+
}
|
|
2184
|
+
function searchConstrainsRows(search) {
|
|
2185
|
+
if (search === void 0 || search === null) return false;
|
|
2186
|
+
const expression = search.expression;
|
|
2187
|
+
if (!Array.isArray(expression)) return true;
|
|
2188
|
+
return expression.some((entry2) => {
|
|
2189
|
+
const e = entry2;
|
|
2190
|
+
if (e?.type === "group") return searchConstrainsRows(e.group);
|
|
2191
|
+
return true;
|
|
2192
|
+
});
|
|
2193
|
+
}
|
|
2194
|
+
function assertBulkDeleteScope(constrains, allRows) {
|
|
2195
|
+
if (constrains && allRows) {
|
|
2196
|
+
throw new Error(
|
|
2197
|
+
"db.bulk.delete: `where` and `allRows: true` contradict each other \u2014 `allRows` means every row in the table. Drop one: keep `where` for a filtered delete, keep `allRows` for a full wipe."
|
|
2198
|
+
);
|
|
2199
|
+
}
|
|
2200
|
+
if (constrains || allRows) return;
|
|
2201
|
+
throw new Error(
|
|
2202
|
+
'db.bulk.delete: this deletes EVERY row in the table \u2014 a filter that constrains nothing matches all rows, so this is a truncate with a row count. (An omitted `where`, an empty `where: []`, and an empty `and()`/`or()` group all encode to the same thing, which is how a dynamically built clause list reaches it.) Pass the filter you meant (`where: expr(col("status"), "=", c.text("expired"))`), or say the wipe is deliberate with `allRows: true`.'
|
|
2203
|
+
);
|
|
2204
|
+
}
|
|
2205
|
+
function dbBulkDelete(args) {
|
|
2206
|
+
const context = { dbo: dboBinding(args.table, args.tableAlias) };
|
|
2207
|
+
const search = encodeSearch(args.where);
|
|
2208
|
+
assertBulkDeleteScope(searchConstrainsRows(search), args.allRows);
|
|
2209
|
+
context.search = search ?? encodeSearch(and());
|
|
2210
|
+
return annotate({ name: "mvp:dbo_bulkdelete", context, as: args.as ?? "", input: [] }, args);
|
|
2211
|
+
}
|
|
2212
|
+
function dbBulkPatch(args) {
|
|
2213
|
+
return annotate(bulkStatement(
|
|
2214
|
+
"mvp:dbo_bulkpatch",
|
|
2215
|
+
args.table,
|
|
2216
|
+
args.as,
|
|
2217
|
+
[leanInput("items", args.items)],
|
|
2218
|
+
args.tableAlias
|
|
2219
|
+
), args);
|
|
2220
|
+
}
|
|
2221
|
+
function dbBulkUpdate(args) {
|
|
2222
|
+
return annotate(bulkStatement(
|
|
2223
|
+
"mvp:dbo_bulkupdate",
|
|
2224
|
+
args.table,
|
|
2225
|
+
args.as,
|
|
2226
|
+
[leanInput("items", args.items)],
|
|
2227
|
+
args.tableAlias
|
|
2228
|
+
), args);
|
|
2229
|
+
}
|
|
2230
|
+
function isPagingValue(x) {
|
|
2231
|
+
return typeof x === "object" && x !== null && "tag" in x && "value" in x && "filters" in x;
|
|
2232
|
+
}
|
|
2233
|
+
function hasPageField(paging) {
|
|
2234
|
+
return !!paging && (paging.page !== void 0 || paging.per_page !== void 0 || paging.offset !== void 0);
|
|
2235
|
+
}
|
|
2236
|
+
function pagingEnabled(paging, forceEnabled) {
|
|
2237
|
+
return paging?.enabled ?? (hasPageField(paging) || forceEnabled);
|
|
2238
|
+
}
|
|
2239
|
+
function encodeSimpleExternal(paging) {
|
|
2240
|
+
if (!paging) return void 0;
|
|
2241
|
+
const out = {};
|
|
2242
|
+
for (const k of ["page", "per_page", "offset", "search", "sort"]) {
|
|
2243
|
+
const v = paging[k];
|
|
2244
|
+
if (isPagingValue(v)) out[k] = { value: v.value, tag: v.tag, filters: v.filters };
|
|
2245
|
+
}
|
|
2246
|
+
return Object.keys(out).length ? out : void 0;
|
|
2247
|
+
}
|
|
2248
|
+
function encodeExternal(ext) {
|
|
2249
|
+
const p = ext.permissions ?? {};
|
|
2250
|
+
return {
|
|
2251
|
+
value: ext.value.value,
|
|
2252
|
+
tag: ext.value.tag,
|
|
2253
|
+
filters: ext.value.filters,
|
|
2254
|
+
permissions: {
|
|
2255
|
+
search: p.search ?? true,
|
|
2256
|
+
sort: p.sort ?? true,
|
|
2257
|
+
page: p.page ?? true,
|
|
2258
|
+
per_page: p.per_page ?? false
|
|
2259
|
+
}
|
|
2260
|
+
};
|
|
2261
|
+
}
|
|
2262
|
+
function encodeBind(binds) {
|
|
2263
|
+
if (!binds?.length) return void 0;
|
|
2264
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2265
|
+
return binds.map((b) => {
|
|
2266
|
+
if (b.table === null && b.as === void 0) {
|
|
2267
|
+
throw new Error(
|
|
2268
|
+
"db.query bind: a join with `table: null` must name its `as` alias \u2014 an unbound join has no table name to derive one from. (`table: null` represents a join whose table was deleted; fix the pulled workspace rather than authoring it.)"
|
|
2269
|
+
);
|
|
2270
|
+
}
|
|
2271
|
+
const as = b.as ?? (typeof b.table === "string" ? b.table : b.table.name);
|
|
2272
|
+
if (seen.has(as)) {
|
|
2273
|
+
throw new Error(
|
|
2274
|
+
`db.query bind: duplicate join alias "${as}" \u2014 two joins to the same table need distinct \`as\` values so their dotted-path columns don't collide.`
|
|
2275
|
+
);
|
|
2276
|
+
}
|
|
2277
|
+
seen.add(as);
|
|
2278
|
+
const entry2 = {
|
|
2279
|
+
// `null` writes the engine's own empty binding, exactly as `dboBinding`
|
|
2280
|
+
// does for the query's own table — `resolveRef` rejects a target with
|
|
2281
|
+
// neither a name nor a guid.
|
|
2282
|
+
dbo: { as, id: b.table === null ? "" : resolveRef("dbo", b.table) },
|
|
2283
|
+
join: b.join ?? "inner"
|
|
2284
|
+
};
|
|
2285
|
+
const search = encodeSearch(b.where);
|
|
2286
|
+
if (search !== void 0) entry2.search = search;
|
|
2287
|
+
return entry2;
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
function collectColOperands(search, out) {
|
|
2291
|
+
if (search === null || typeof search !== "object") return;
|
|
2292
|
+
if (Array.isArray(search)) {
|
|
2293
|
+
for (const item of search) collectColOperands(item, out);
|
|
2294
|
+
return;
|
|
2295
|
+
}
|
|
2296
|
+
const node = search;
|
|
2297
|
+
if (node.tag === "col" && typeof node.operand === "string") out.push(node.operand);
|
|
2298
|
+
for (const value of Object.values(node)) collectColOperands(value, out);
|
|
2299
|
+
}
|
|
2300
|
+
function assertResolvableColumnPaths(table, tableAlias, bindAliases, paths) {
|
|
2301
|
+
if (table === null || typeof table === "string" || !("schema" in table)) return;
|
|
2302
|
+
const def = table;
|
|
2303
|
+
const columns = new Set(tableColumns(def).map((col) => col.name));
|
|
2304
|
+
const known = new Set(bindAliases);
|
|
2305
|
+
if (tableAlias !== void 0) known.add(tableAlias);
|
|
2306
|
+
for (const { path, surface } of paths) {
|
|
2307
|
+
const dot = path.indexOf(".");
|
|
2308
|
+
if (dot <= 0) continue;
|
|
2309
|
+
const prefix = path.slice(0, dot);
|
|
2310
|
+
if (known.has(prefix) || columns.has(prefix)) continue;
|
|
2311
|
+
if (prefix === def.name) {
|
|
2312
|
+
throw new Error(
|
|
2313
|
+
`db.query ${surface}: "${path}" \u2014 a column of "${def.name}" qualified by the table's own name only resolves when the query declares an alias for that table. Either drop the qualifier (\`${path.slice(dot + 1)}\`) or add \`tableAlias: "${def.name}"\` to the db.query. (A JOINED column is different: it keeps its bind alias, e.g. \`col("${bindAliases[0] ?? "<join alias>"}.id")\`.)`
|
|
2314
|
+
);
|
|
2315
|
+
}
|
|
2316
|
+
throw new Error(
|
|
2317
|
+
`db.query ${surface}: "${path}" \u2014 "${prefix}" is not a resolvable alias. A dotted path must start with a join's \`as\` alias${bindAliases.length ? ` (${bindAliases.map((a) => `"${a}"`).join(", ")})` : " (this query has no joins)"}, the query's own \`tableAlias\`, or an object column of "${def.name}". Bare column names address "${def.name}" directly.`
|
|
2318
|
+
);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
function assertNoEvalShadow(table, evals) {
|
|
2322
|
+
if (!evals?.length) return;
|
|
2323
|
+
if (typeof table === "string" || !("schema" in table)) return;
|
|
2324
|
+
const cols = new Set(tableColumns(table).map((col) => col.name));
|
|
2325
|
+
for (const e of evals) {
|
|
2326
|
+
if (cols.has(e.as)) {
|
|
2327
|
+
throw new Error(
|
|
2328
|
+
`db.query eval: alias "${e.as}" shadows an existing "${table.name}" column \u2014 the computed value would overwrite it. Rename the eval alias (e.g. "${e.as}_calc").`
|
|
2329
|
+
);
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
function encodeAggregate(agg, primaryAlias) {
|
|
2334
|
+
const block = {
|
|
2335
|
+
sort: encodeSort(agg?.sort),
|
|
2336
|
+
eval: encodeEval(qualifyAggregateEvals(agg?.eval, primaryAlias, "eval")) ?? [],
|
|
2337
|
+
group: encodeEval(qualifyAggregateEvals(agg?.group, primaryAlias, "group")) ?? []
|
|
2338
|
+
};
|
|
2339
|
+
if (agg?.paging) {
|
|
2340
|
+
block.paging = {
|
|
2341
|
+
page: agg.paging.page ?? 1,
|
|
2342
|
+
per_page: agg.paging.per_page ?? 25,
|
|
2343
|
+
metadata: agg.paging.metadata ?? true,
|
|
2344
|
+
enabled: agg.paging.enabled ?? true
|
|
2345
|
+
};
|
|
2346
|
+
}
|
|
2347
|
+
return { type: "aggregate", aggregate: block };
|
|
2348
|
+
}
|
|
2349
|
+
var DB_RETURN_TYPES = [
|
|
2350
|
+
"list",
|
|
2351
|
+
"single",
|
|
2352
|
+
"count",
|
|
2353
|
+
"exists",
|
|
2354
|
+
"stream",
|
|
2355
|
+
"aggregate"
|
|
2356
|
+
];
|
|
2357
|
+
function normalizeReturnType(raw) {
|
|
2358
|
+
if (raw === void 0) return "list";
|
|
2359
|
+
const unwrapped = isTaggedValue(raw) && raw.filters.length === 0 && raw.tag.startsWith("const") ? raw.value : raw;
|
|
2360
|
+
if (typeof unwrapped === "string" && DB_RETURN_TYPES.includes(unwrapped)) {
|
|
2361
|
+
return unwrapped;
|
|
2362
|
+
}
|
|
2363
|
+
const shown = isTaggedValue(raw) ? `${raw.tag}:${JSON.stringify(raw.value)}` : JSON.stringify(raw);
|
|
2364
|
+
throw new Error(
|
|
2365
|
+
`db.query: \`returnType\` is ${shown}, which is not one of ${DB_RETURN_TYPES.map((t) => JSON.stringify(t)).join(", ")}. It used to fall through to "list", so the query ran and returned a different shape than the one asked for, with no error anywhere (issue #62). \`returnType\` is read at encode time to pick the \`context.return\` block, so it cannot be a dynamic value \u2014 a filtered or non-constant tagged value cannot be resolved here.`
|
|
2366
|
+
);
|
|
2367
|
+
}
|
|
2368
|
+
function encodeReturn(returnType, sort, paging, forceEnabled = false, distinct = "auto", aggregate, primaryAlias = "") {
|
|
2369
|
+
const sortEls = encodeSort(sort);
|
|
2370
|
+
if (returnType === "aggregate") return encodeAggregate(aggregate, primaryAlias);
|
|
2371
|
+
if (returnType === "count" || returnType === "exists") return { type: returnType };
|
|
2372
|
+
if (returnType === "single") return { type: "single", single: { sort: sortEls } };
|
|
2373
|
+
const enabled = pagingEnabled(paging, forceEnabled);
|
|
2374
|
+
const staticInt = (v, def) => typeof v === "number" ? v : def;
|
|
2375
|
+
if (returnType === "stream") {
|
|
2376
|
+
const stream = { sort: sortEls, distinct };
|
|
2377
|
+
if (enabled) {
|
|
2378
|
+
stream.paging = {
|
|
2379
|
+
page: staticInt(paging?.page, 1),
|
|
2380
|
+
per_page: staticInt(paging?.per_page, 25),
|
|
2381
|
+
enabled: true
|
|
2382
|
+
};
|
|
2383
|
+
}
|
|
2384
|
+
return { type: "stream", stream };
|
|
2385
|
+
}
|
|
2386
|
+
const pagingObj = {
|
|
2387
|
+
enabled,
|
|
2388
|
+
page: staticInt(paging?.page, 1),
|
|
2389
|
+
offset: staticInt(paging?.offset, 0),
|
|
2390
|
+
per_page: staticInt(paging?.per_page, 25),
|
|
2391
|
+
metadata: paging?.metadata ?? true,
|
|
2392
|
+
totals: paging?.totals ?? false
|
|
2393
|
+
};
|
|
2394
|
+
const configured = enabled || paging !== void 0 || sortEls.length > 0 || distinct !== "auto";
|
|
2395
|
+
if (!configured) return { type: "list" };
|
|
2396
|
+
return { type: "list", list: { distinct, sort: sortEls, paging: pagingObj } };
|
|
2397
|
+
}
|
|
2398
|
+
function dbQuery(args) {
|
|
2399
|
+
if (args.table !== null) {
|
|
2400
|
+
assertNoAddonShadow(args.table, args.addon);
|
|
2401
|
+
assertNoEvalShadow(args.table, args.eval);
|
|
2402
|
+
}
|
|
2403
|
+
const returnType = normalizeReturnType(args.returnType);
|
|
2404
|
+
const tableName = args.table === null ? "" : typeof args.table === "string" ? args.table : args.table.name;
|
|
2405
|
+
const primaryAlias = args.tableAlias ?? tableName;
|
|
2406
|
+
const aggregateAddsQualifier = returnType === "aggregate" && tableName !== "" && [...args.aggregate?.group ?? [], ...args.aggregate?.eval ?? []].some(
|
|
2407
|
+
(e) => !e.name.includes(".")
|
|
2408
|
+
);
|
|
2409
|
+
const evalAddsQualifier = tableName !== "" && (args.eval ?? []).some((e) => !e.name.includes("."));
|
|
2410
|
+
const emittedAlias = args.tableAlias ?? (aggregateAddsQualifier || evalAddsQualifier ? tableName : void 0);
|
|
2411
|
+
const evals = primaryAlias === "" ? args.eval : qualifyAggregateEvals(args.eval, primaryAlias, "query eval");
|
|
2412
|
+
const context = { dbo: dboBinding(args.table, emittedAlias) };
|
|
2413
|
+
const search = encodeSearch(args.where, args.additionalWhere);
|
|
2414
|
+
if (search !== void 0) context.search = search;
|
|
2415
|
+
const binds = encodeBind(args.bind);
|
|
2416
|
+
if (binds) context.bind = binds;
|
|
2417
|
+
{
|
|
2418
|
+
const bindAliases = (binds ?? []).map(
|
|
2419
|
+
(b) => b.dbo.as
|
|
2420
|
+
);
|
|
2421
|
+
const paths = [];
|
|
2422
|
+
const push = (surface, values) => {
|
|
2423
|
+
for (const path of values) paths.push({ path, surface });
|
|
2424
|
+
};
|
|
2425
|
+
const searchPaths = [];
|
|
2426
|
+
collectColOperands(search, searchPaths);
|
|
2427
|
+
push("where", searchPaths);
|
|
2428
|
+
for (const b of binds ?? []) {
|
|
2429
|
+
const bindPaths = [];
|
|
2430
|
+
collectColOperands(b.search, bindPaths);
|
|
2431
|
+
push(`bind "${b.dbo.as}" where`, bindPaths);
|
|
2432
|
+
}
|
|
2433
|
+
push("sort", (args.sort ?? []).map((sort) => sort.sortBy));
|
|
2434
|
+
push("eval", (evals ?? []).map((e) => e.name));
|
|
2435
|
+
assertResolvableColumnPaths(args.table, emittedAlias, bindAliases, paths);
|
|
2436
|
+
}
|
|
2437
|
+
const encodedEvals = encodeEval(evals);
|
|
2438
|
+
if (encodedEvals) context.eval = encodedEvals;
|
|
2439
|
+
if (args.lock !== void 0) context.lock = c.bool(args.lock);
|
|
2440
|
+
const simpleExternal = encodeSimpleExternal(args.paging);
|
|
2441
|
+
if (args.external !== void 0) {
|
|
2442
|
+
context.return = encodeReturn(returnType, args.sort, args.paging, true, args.distinct, args.aggregate, primaryAlias);
|
|
2443
|
+
context.external = encodeExternal(args.external);
|
|
2444
|
+
if (simpleExternal) context.simpleExternal = simpleExternal;
|
|
2445
|
+
} else {
|
|
2446
|
+
context.return = encodeReturn(returnType, args.sort, args.paging, false, args.distinct, args.aggregate, primaryAlias);
|
|
2447
|
+
if (simpleExternal) context.simpleExternal = simpleExternal;
|
|
2448
|
+
}
|
|
2449
|
+
const usesPagingEnvelope = returnType === "list" && pagingEnabled(args.paging, args.external !== void 0) && (args.paging?.metadata ?? true);
|
|
2450
|
+
return annotate({
|
|
2451
|
+
name: "mvp:dbo_view",
|
|
2452
|
+
context,
|
|
2453
|
+
as: args.as ?? "",
|
|
2454
|
+
input: [],
|
|
2455
|
+
...envelope({
|
|
2456
|
+
output: args.output,
|
|
2457
|
+
addon: args.addon,
|
|
2458
|
+
addonOffset: usesPagingEnvelope ? "items[]" : void 0
|
|
2459
|
+
})
|
|
2460
|
+
}, args);
|
|
2461
|
+
}
|
|
2462
|
+
function dbTransaction(args) {
|
|
2463
|
+
const stmt = {
|
|
2464
|
+
name: "mvp:db_transaction",
|
|
2465
|
+
context: { run: args.body.map(encodeStatement) },
|
|
2466
|
+
input: []
|
|
2467
|
+
};
|
|
2468
|
+
if (args.as !== void 0) stmt.as = args.as;
|
|
2469
|
+
return annotate(stmt, args);
|
|
2470
|
+
}
|
|
2471
|
+
var EXTERNAL_SQL_NAME = {
|
|
2472
|
+
mssql: "mvp:dbo_external_mssql_query",
|
|
2473
|
+
mysql: "mvp:dbo_external_mysql_query",
|
|
2474
|
+
oracle: "mvp:dbo_external_oracle_query",
|
|
2475
|
+
postgres: "mvp:dbo_external_postgres_query",
|
|
2476
|
+
snowflake: "mvp:dbo_external_snowflake_query"
|
|
2477
|
+
};
|
|
2478
|
+
function dbExternalQuery(args) {
|
|
2479
|
+
const connection = args.connectionString;
|
|
2480
|
+
const connectionContext = typeof connection === "string" ? { connection_string: connection } : {
|
|
2481
|
+
connection_string_flex: {
|
|
2482
|
+
value: connection.value,
|
|
2483
|
+
tag: connection.tag,
|
|
2484
|
+
filters: connection.filters
|
|
2485
|
+
}
|
|
2486
|
+
};
|
|
2487
|
+
return annotate({
|
|
2488
|
+
name: EXTERNAL_SQL_NAME[args.engine],
|
|
2489
|
+
context: {
|
|
2490
|
+
code: args.sql,
|
|
2491
|
+
response_type: args.responseType ?? "list",
|
|
2492
|
+
...args.parser === void 0 ? {} : { parser: args.parser },
|
|
2493
|
+
...connectionContext,
|
|
2494
|
+
arg: (args.args ?? []).map((v) => ({ value: v.value, tag: v.tag, filters: v.filters }))
|
|
2495
|
+
},
|
|
2496
|
+
as: args.as ?? "",
|
|
2497
|
+
input: [],
|
|
2498
|
+
...envelope()
|
|
2499
|
+
}, args);
|
|
2500
|
+
}
|
|
2501
|
+
registerStatement("mvp:dbo_add", dbAdd);
|
|
2502
|
+
registerStatement("mvp:dbo_editby", dbEdit);
|
|
2503
|
+
registerStatement("mvp:dbo_addoreditby", dbAddOrEdit);
|
|
2504
|
+
registerStatement("mvp:dbo_bulkadd", dbBulkAdd);
|
|
2505
|
+
registerStatement("mvp:dbo_bulkdelete", dbBulkDelete);
|
|
2506
|
+
registerStatement("mvp:dbo_bulkpatch", dbBulkPatch);
|
|
2507
|
+
registerStatement("mvp:dbo_bulkupdate", dbBulkUpdate);
|
|
2508
|
+
registerStatement("mvp:dbo_view", dbQuery);
|
|
2509
|
+
registerStatement("mvp:db_transaction", dbTransaction);
|
|
2510
|
+
registerStatement("mvp:dbo_external_mssql_query", (a) => dbExternalQuery({ ...a, engine: "mssql" }));
|
|
2511
|
+
registerStatement("mvp:dbo_external_mysql_query", (a) => dbExternalQuery({ ...a, engine: "mysql" }));
|
|
2512
|
+
registerStatement("mvp:dbo_external_oracle_query", (a) => dbExternalQuery({ ...a, engine: "oracle" }));
|
|
2513
|
+
registerStatement("mvp:dbo_external_postgres_query", (a) => dbExternalQuery({ ...a, engine: "postgres" }));
|
|
2514
|
+
registerStatement("mvp:dbo_external_snowflake_query", (a) => dbExternalQuery({ ...a, engine: "snowflake" }));
|
|
2515
|
+
registerStatement("mvp:dbo_getby", dbGet);
|
|
2516
|
+
registerStatement("mvp:dbo_get", dbGetById);
|
|
2517
|
+
registerStatement("mvp:dbo_delby", dbDel);
|
|
2518
|
+
registerStatement("mvp:dbo_hasby", dbHas);
|
|
2519
|
+
registerStatement("mvp:dbo_patch", dbPatch);
|
|
2520
|
+
registerStatement("mvp:dbo_truncate", dbTruncate);
|
|
2521
|
+
registerStatement("mvp:dbo_get_schema", dbSchema);
|
|
2522
|
+
registerStatement("mvp:dbo_direct_query", dbDirectQuery);
|
|
2523
|
+
|
|
2524
|
+
// src/statements/generated/catalog.ts
|
|
2525
|
+
for (const spec2 of GENERATED_SPECS) {
|
|
2526
|
+
if (!isRegisteredStatement(spec2.name)) registerSpec(spec2);
|
|
2527
|
+
}
|
|
2528
|
+
var specByName = new Map(GENERATED_SPECS.map((s2) => [s2.name, s2]));
|
|
2529
|
+
function spec(name) {
|
|
2530
|
+
const s2 = specByName.get(name);
|
|
2531
|
+
if (!s2) throw new Error(`Generated catalog is missing expected statement "${name}".`);
|
|
2532
|
+
return s2;
|
|
2533
|
+
}
|
|
2534
|
+
function mutation(name) {
|
|
2535
|
+
const s2 = spec(name);
|
|
2536
|
+
return (varName, value) => encodeFromSpec(s2, { name: varName, value });
|
|
2537
|
+
}
|
|
2538
|
+
function objectOp(name) {
|
|
2539
|
+
const s2 = spec(name);
|
|
2540
|
+
return (as, value) => encodeFromSpec(s2, { as, value });
|
|
2541
|
+
}
|
|
2542
|
+
var mathAdd = mutation("mvp:math_add");
|
|
2543
|
+
var mathSub = mutation("mvp:math_sub");
|
|
2544
|
+
var mathMul = mutation("mvp:math_mul");
|
|
2545
|
+
var mathDiv = mutation("mvp:math_div");
|
|
2546
|
+
var bitwiseAnd = mutation("mvp:bitwise_and");
|
|
2547
|
+
var bitwiseOr = mutation("mvp:bitwise_or");
|
|
2548
|
+
var bitwiseXor = mutation("mvp:bitwise_xor");
|
|
2549
|
+
var textAppend = mutation("mvp:text_append");
|
|
2550
|
+
var textPrepend = mutation("mvp:text_prepend");
|
|
2551
|
+
var objectKeys = objectOp("mvp:object_keys");
|
|
2552
|
+
var objectValues = objectOp("mvp:object_values");
|
|
2553
|
+
var objectEntries = objectOp("mvp:object_entries");
|
|
2554
|
+
var GENERATED_STATEMENT_NAMES = GENERATED_SPECS.map((s2) => s2.name);
|
|
2555
|
+
|
|
2556
|
+
// src/kinds/microservice.ts
|
|
2557
|
+
function declaredServicePorts(def) {
|
|
2558
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2559
|
+
for (const container of def.deployment?.containers ?? []) {
|
|
2560
|
+
for (const port of container.ports ?? []) {
|
|
2561
|
+
if (port.servicePort) seen.add(port.servicePort);
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
return [...seen];
|
|
2565
|
+
}
|
|
2566
|
+
function argvEntries(argv) {
|
|
2567
|
+
return (argv ?? []).map((name) => ({ name }));
|
|
2568
|
+
}
|
|
2569
|
+
function encodeContainer(c2) {
|
|
2570
|
+
if (!c2.name) throw new Error("microservice: every container needs a `name`.");
|
|
2571
|
+
return {
|
|
2572
|
+
name: c2.name,
|
|
2573
|
+
type: c2.type ?? "standard",
|
|
2574
|
+
image: c2.image ?? "",
|
|
2575
|
+
// `containerPort` defaults to `servicePort`, which is what the engine's own
|
|
2576
|
+
// scaffold does when a port omits it.
|
|
2577
|
+
ports: (c2.ports ?? []).map((p) => ({
|
|
2578
|
+
servicePort: p.servicePort,
|
|
2579
|
+
containerPort: p.containerPort ?? p.servicePort
|
|
2580
|
+
})),
|
|
2581
|
+
resources: { cpu: c2.resources?.cpu ?? "", ram: c2.resources?.ram ?? "" },
|
|
2582
|
+
command: argvEntries(c2.command),
|
|
2583
|
+
args: argvEntries(c2.args),
|
|
2584
|
+
envs: (c2.env ?? []).map((e) => ({ name: e.name, value: e.value ?? "" })),
|
|
2585
|
+
volumes: (c2.volumes ?? []).map((v) => ({ ...v })),
|
|
2586
|
+
...c2.pullSecret !== void 0 ? { pull_secret: c2.pullSecret } : {}
|
|
2587
|
+
};
|
|
2588
|
+
}
|
|
2589
|
+
function encodeMicroservice(def) {
|
|
2590
|
+
if (!def.name) throw new Error("microservice: `name` is required.");
|
|
2591
|
+
const kind = def.kind ?? "builtin";
|
|
2592
|
+
if (kind === "helm" && (def.deployment || def.ingresses?.length || def.configs?.length || def.volumes?.length)) {
|
|
2593
|
+
throw new Error(
|
|
2594
|
+
'microservice: `kind: "helm"` takes a `chart` and no deployment blocks \u2014 `deployment`/`ingresses`/`configs`/`volumes` belong to `kind: "builtin"`.'
|
|
2595
|
+
);
|
|
2596
|
+
}
|
|
2597
|
+
if (kind !== "helm" && def.chart) {
|
|
2598
|
+
throw new Error(
|
|
2599
|
+
'microservice: `chart` belongs to `kind: "helm"`. A builtin microservice declares containers instead.'
|
|
2600
|
+
);
|
|
2601
|
+
}
|
|
2602
|
+
const deployment = def.deployment ?? {};
|
|
2603
|
+
return {
|
|
2604
|
+
name: def.name,
|
|
2605
|
+
description: def.description ?? "",
|
|
2606
|
+
kind,
|
|
2607
|
+
tenant_deploy: def.tenantDeploy ?? "auto",
|
|
2608
|
+
configs: (def.configs ?? []).map((c2) => ({
|
|
2609
|
+
name: c2.name,
|
|
2610
|
+
type: c2.type ?? "",
|
|
2611
|
+
value: c2.value ?? ""
|
|
2612
|
+
})),
|
|
2613
|
+
volumes: (def.volumes ?? []).map((v) => ({
|
|
2614
|
+
name: v.name,
|
|
2615
|
+
size: v.size ?? "",
|
|
2616
|
+
class: v.class ?? ""
|
|
2617
|
+
})),
|
|
2618
|
+
ingresses: (def.ingresses ?? []).map((i) => ({
|
|
2619
|
+
name: i.name,
|
|
2620
|
+
domain: i.domain ?? "",
|
|
2621
|
+
paths: (i.paths ?? []).map((p) => ({ service: p.service ?? "", path: p.path ?? "" }))
|
|
2622
|
+
})),
|
|
2623
|
+
deployment: {
|
|
2624
|
+
docker: deployment.docker ?? "",
|
|
2625
|
+
replicas: deployment.replicas ?? 1,
|
|
2626
|
+
strategy: deployment.strategy ?? "Recreate",
|
|
2627
|
+
containers: (deployment.containers ?? []).map(encodeContainer)
|
|
2628
|
+
},
|
|
2629
|
+
chart: {
|
|
2630
|
+
ref: def.chart?.ref ?? "",
|
|
2631
|
+
values: def.chart?.values ?? "",
|
|
2632
|
+
version: def.chart?.version ?? ""
|
|
2633
|
+
},
|
|
2634
|
+
registry_auth: {
|
|
2635
|
+
type: def.registryAuth?.type ?? "",
|
|
2636
|
+
server: def.registryAuth?.server ?? "",
|
|
2637
|
+
dockerconfigjson: def.registryAuth?.dockerconfigjson ?? ""
|
|
2638
|
+
}
|
|
2639
|
+
};
|
|
2640
|
+
}
|
|
2641
|
+
function microservice(def) {
|
|
2642
|
+
encodeMicroservice(def);
|
|
2643
|
+
return def;
|
|
2644
|
+
}
|
|
2645
|
+
var microserviceKind = {
|
|
2646
|
+
name: "microservice",
|
|
2647
|
+
payloadKey: "microservice",
|
|
2648
|
+
encode: encodeMicroservice
|
|
2649
|
+
};
|
|
2650
|
+
registerKind(microserviceKind);
|
|
2651
|
+
|
|
2652
|
+
// src/statements/special/api-request.ts
|
|
2653
|
+
function apiRequest(a = {}) {
|
|
2654
|
+
assertSslConsistency("api.request", a);
|
|
2655
|
+
return generated.api.request({
|
|
2656
|
+
as: a.as,
|
|
2657
|
+
url: coerceText(a.url),
|
|
2658
|
+
...coerceHttpFields(a),
|
|
2659
|
+
disabled: a.disabled,
|
|
2660
|
+
description: a.description,
|
|
2661
|
+
output: a.output
|
|
2662
|
+
});
|
|
2663
|
+
}
|
|
2664
|
+
function streamFromRequest(a = {}) {
|
|
2665
|
+
assertSslConsistency("stream.from_request", a);
|
|
2666
|
+
return annotate(generated.stream.from_request({
|
|
2667
|
+
as: a.as,
|
|
2668
|
+
url: coerceText(a.url),
|
|
2669
|
+
...coerceHttpFields(a)
|
|
2670
|
+
}), a);
|
|
2671
|
+
}
|
|
2672
|
+
function webflowRequest(a = {}) {
|
|
2673
|
+
assertSslConsistency("webflow.request", a);
|
|
2674
|
+
return generated.webflow.request({
|
|
2675
|
+
as: a.as,
|
|
2676
|
+
path: coerceText(a.path),
|
|
2677
|
+
...coerceHttpFields(a),
|
|
2678
|
+
disabled: a.disabled,
|
|
2679
|
+
description: a.description
|
|
2680
|
+
});
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
// src/statements/special/microservice.ts
|
|
2684
|
+
function resolveMicroserviceHost(host, port) {
|
|
2685
|
+
if (isValue2(host)) {
|
|
2686
|
+
if (port !== void 0) {
|
|
2687
|
+
throw new Error(
|
|
2688
|
+
'microservice.request: `port` cannot be joined onto a dynamic `host` at build time. Build the joined `"name:port"` string in the value itself instead.'
|
|
2689
|
+
);
|
|
2690
|
+
}
|
|
2691
|
+
return host;
|
|
2692
|
+
}
|
|
2693
|
+
if (typeof host === "string") {
|
|
2694
|
+
if (port !== void 0 && host.includes(":")) {
|
|
2695
|
+
throw new Error(
|
|
2696
|
+
`microservice.request: \`host\` already carries a port ("${host}"), so \`port: ${String(port)}\` is ambiguous. Pass the port once \u2014 either joined into \`host\` or as \`port\`.`
|
|
2697
|
+
);
|
|
2698
|
+
}
|
|
2699
|
+
return port === void 0 ? host : `${host}:${port}`;
|
|
2700
|
+
}
|
|
2701
|
+
const declared = declaredServicePorts(host);
|
|
2702
|
+
if (port !== void 0) {
|
|
2703
|
+
if (declared.length > 0 && !declared.includes(String(port))) {
|
|
2704
|
+
throw new Error(
|
|
2705
|
+
`microservice.request: microservice "${host.name}" does not expose port ${String(port)}. It declares: ${declared.join(", ")}.`
|
|
2706
|
+
);
|
|
2707
|
+
}
|
|
2708
|
+
return `${host.name}:${port}`;
|
|
2709
|
+
}
|
|
2710
|
+
if (declared.length === 1) return `${host.name}:${declared[0]}`;
|
|
2711
|
+
if (declared.length === 0) return host.name;
|
|
2712
|
+
throw new Error(
|
|
2713
|
+
`microservice.request: microservice "${host.name}" declares ${declared.length} ports (${declared.join(", ")}), so \`port\` is required to pick one.`
|
|
2714
|
+
);
|
|
2715
|
+
}
|
|
2716
|
+
var MICROSERVICE_DEFAULTS = {
|
|
2717
|
+
method: "GET",
|
|
2718
|
+
params: {},
|
|
2719
|
+
headers: [],
|
|
2720
|
+
timeout: 10,
|
|
2721
|
+
follow_location: true
|
|
2722
|
+
};
|
|
2723
|
+
function microserviceRequest(a) {
|
|
2724
|
+
return generated.microservice.request({
|
|
2725
|
+
as: a.as,
|
|
2726
|
+
host: coerceText(resolveMicroserviceHost(a.host, a.port)),
|
|
2727
|
+
path: coerceText(a.path),
|
|
2728
|
+
// `??` (not `||`) so an explicit `false`/`0`/`""` is honored, not defaulted.
|
|
2729
|
+
method: coerceText(a.method ?? MICROSERVICE_DEFAULTS.method),
|
|
2730
|
+
params: coerceObj(a.params ?? MICROSERVICE_DEFAULTS.params),
|
|
2731
|
+
headers: coerceHeaders(a.headers ?? MICROSERVICE_DEFAULTS.headers),
|
|
2732
|
+
timeout: coerceInt(a.timeout ?? MICROSERVICE_DEFAULTS.timeout),
|
|
2733
|
+
follow_location: coerceBool(a.follow_location ?? MICROSERVICE_DEFAULTS.follow_location),
|
|
2734
|
+
disabled: a.disabled,
|
|
2735
|
+
description: a.description
|
|
2736
|
+
});
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
// src/statements/special/precondition.ts
|
|
2740
|
+
var PRECONDITION_ERROR_TYPES = [
|
|
2741
|
+
"standard",
|
|
2742
|
+
"notfound",
|
|
2743
|
+
"toomanyrequests",
|
|
2744
|
+
"accessdenied",
|
|
2745
|
+
"unauthorized",
|
|
2746
|
+
"badrequest",
|
|
2747
|
+
"inputerror"
|
|
2748
|
+
];
|
|
2749
|
+
var PRECONDITION_ERROR_STATUS = {
|
|
2750
|
+
standard: 500,
|
|
2751
|
+
badrequest: 400,
|
|
2752
|
+
inputerror: 400,
|
|
2753
|
+
unauthorized: 401,
|
|
2754
|
+
accessdenied: 403,
|
|
2755
|
+
notfound: 404,
|
|
2756
|
+
toomanyrequests: 429
|
|
2757
|
+
};
|
|
2758
|
+
function precondition(a = {}) {
|
|
2759
|
+
return generated.precondition(a);
|
|
2760
|
+
}
|
|
2761
|
+
function throwError(a) {
|
|
2762
|
+
return generated.throw(a);
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
// src/statements/special/closed-sets.ts
|
|
2766
|
+
var STORAGE_ACCESS = ["public", "private"];
|
|
2767
|
+
var HEADER_DUPLICATES = ["replace", "append"];
|
|
2768
|
+
function createAttachment(a) {
|
|
2769
|
+
return generated.storage.create_attachment(a);
|
|
2770
|
+
}
|
|
2771
|
+
function createAudio(a) {
|
|
2772
|
+
return generated.storage.create_audio(a);
|
|
2773
|
+
}
|
|
2774
|
+
function createImage(a) {
|
|
2775
|
+
return generated.storage.create_image(a);
|
|
2776
|
+
}
|
|
2777
|
+
function createVideo(a) {
|
|
2778
|
+
return generated.storage.create_video(a);
|
|
2779
|
+
}
|
|
2780
|
+
function setHeader(a) {
|
|
2781
|
+
return generated.util.set_header(a);
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
// src/statements/special/lambda-args.ts
|
|
2785
|
+
function lambda(a = {}) {
|
|
2786
|
+
return generated.lambda(a);
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
// src/statements/s.ts
|
|
2790
|
+
var externalQuery = (engine) => ({
|
|
2791
|
+
direct_query: (a) => dbExternalQuery({ ...a, engine })
|
|
2792
|
+
});
|
|
2793
|
+
var cloudJobNs = Object.assign(cloudJob, { await: cloudJobAwait, status: cloudJobStatus });
|
|
2794
|
+
var s = {
|
|
2795
|
+
...generated,
|
|
2796
|
+
// Typed overrides of generated factories: `precondition` narrows `error_type`
|
|
2797
|
+
// to the status-bearing enum, and `throw` documents that it returns HTTP 200
|
|
2798
|
+
// (use `precondition` for a status-observable rejection). See issue #21.
|
|
2799
|
+
precondition,
|
|
2800
|
+
throw: throwError,
|
|
2801
|
+
// Typed refusal of `capture`, which belongs to `lam.fn` — the bare TS2353 the
|
|
2802
|
+
// generated factory produced implied dropping the field rather than moving
|
|
2803
|
+
// the body. Same bytes (#73).
|
|
2804
|
+
lambda,
|
|
2805
|
+
// Hand-authored specials (not in the codegen'd catalog).
|
|
2806
|
+
set_var: setVar,
|
|
2807
|
+
update_var: updateVar,
|
|
2808
|
+
conditional,
|
|
2809
|
+
comment,
|
|
2810
|
+
for: forLoop,
|
|
2811
|
+
foreach: foreachLoop,
|
|
2812
|
+
while: whileLoop,
|
|
2813
|
+
group,
|
|
2814
|
+
switch: switchStatement,
|
|
2815
|
+
try_catch: tryCatch,
|
|
2816
|
+
return: returnValue,
|
|
2817
|
+
foreach_break: foreachBreak,
|
|
2818
|
+
foreach_continue: foreachContinue,
|
|
2819
|
+
foreach_remove: foreachRemove,
|
|
2820
|
+
// Call family — invoke another workspace object. `api.call`/`api.realtime_event`
|
|
2821
|
+
// merge into the generated `api` namespace; the rest are new namespaces.
|
|
2822
|
+
// `api.request` (and `stream.from_request`/`webflow.request`/`microservice.request`
|
|
2823
|
+
// below) are typed hand-authored overrides of their generated factories.
|
|
2824
|
+
function: { run: functionRun, call: functionCall },
|
|
2825
|
+
action: { call: actionCall, package: { call: actionPackageCall } },
|
|
2826
|
+
workflow_test: { call: workflowTestCall },
|
|
2827
|
+
api: { ...generated.api, call: apiCall, realtime_event: realtimeEvent, request: apiRequest },
|
|
2828
|
+
// Microservices are a top-level feature: the `microservice()` def and the
|
|
2829
|
+
// statement that calls one live side by side. The override is load-bearing —
|
|
2830
|
+
// `...generated` above already exposes the RAW generated factory here, and it
|
|
2831
|
+
// has none of the defaulting that lets a call name only `host` and `path`.
|
|
2832
|
+
microservice: { ...generated.microservice, request: microserviceRequest },
|
|
2833
|
+
// `realtime.publish` is the CURRENT-layer send statement (`api.realtime_event` is the
|
|
2834
|
+
// superseded one); `get_session` beside it is generated.
|
|
2835
|
+
realtime: { ...generated.realtime, publish: realtimePublish },
|
|
2836
|
+
stream: { ...generated.stream, from_request: streamFromRequest },
|
|
2837
|
+
webflow: { ...generated.webflow, request: webflowRequest },
|
|
2838
|
+
task: { call: taskCall },
|
|
2839
|
+
tool: { call: toolCall },
|
|
2840
|
+
trigger: { call: triggerCall },
|
|
2841
|
+
middleware: { call: middlewareCall },
|
|
2842
|
+
addon: { call: addonCall },
|
|
2843
|
+
// Database family — merges into the generated `db` namespace.
|
|
2844
|
+
db: {
|
|
2845
|
+
...generated.db,
|
|
2846
|
+
add: dbAdd,
|
|
2847
|
+
edit: dbEdit,
|
|
2848
|
+
add_or_edit: dbAddOrEdit,
|
|
2849
|
+
get: dbGet,
|
|
2850
|
+
get_by_id: dbGetById,
|
|
2851
|
+
del: dbDel,
|
|
2852
|
+
has: dbHas,
|
|
2853
|
+
patch: dbPatch,
|
|
2854
|
+
truncate: dbTruncate,
|
|
2855
|
+
schema: dbSchema,
|
|
2856
|
+
direct_query: dbDirectQuery,
|
|
2857
|
+
query: dbQuery,
|
|
2858
|
+
transaction: dbTransaction,
|
|
2859
|
+
bulk: { add: dbBulkAdd, delete: dbBulkDelete, patch: dbBulkPatch, update: dbBulkUpdate },
|
|
2860
|
+
external: {
|
|
2861
|
+
mssql: externalQuery("mssql"),
|
|
2862
|
+
mysql: externalQuery("mysql"),
|
|
2863
|
+
oracle: externalQuery("oracle"),
|
|
2864
|
+
postgres: externalQuery("postgres"),
|
|
2865
|
+
snowflake: externalQuery("snowflake")
|
|
2866
|
+
}
|
|
2867
|
+
},
|
|
2868
|
+
// AI agent + cloud jobs.
|
|
2869
|
+
ai: { ...generated.ai, agent: { run: aiAgentRun } },
|
|
2870
|
+
cloud: { ...generated.cloud, job: cloudJobNs },
|
|
2871
|
+
// Array map/union, expect.to_throw, auth-token, raw-input/post-process merge
|
|
2872
|
+
// into their generated namespaces.
|
|
2873
|
+
array: { ...generated.array, map: arrayMap, union: arrayUnion },
|
|
2874
|
+
expect: { ...generated.expect, to_throw: expectToThrow, to_match: expectToMatch },
|
|
2875
|
+
security: { ...generated.security, create_auth_token: createAuthToken, create_guid: createGuid },
|
|
2876
|
+
util: {
|
|
2877
|
+
...generated.util,
|
|
2878
|
+
get_raw_input: getRawInput,
|
|
2879
|
+
get_input: getRawInput,
|
|
2880
|
+
post_process: postProcess,
|
|
2881
|
+
// Typed override of the generated factory: same bytes, plus the nested
|
|
2882
|
+
// result shape a `ref` into the bound var has no other way to learn (#226).
|
|
2883
|
+
ip_lookup: ipLookup,
|
|
2884
|
+
// `duplicates` is a closed set the codegen ships as a bare `string`.
|
|
2885
|
+
set_header: setHeader
|
|
2886
|
+
},
|
|
2887
|
+
// `access` is a closed set the codegen ships as a bare `string`, and it
|
|
2888
|
+
// defaults to `public` — a misspelled `"private"` used to serve the file to
|
|
2889
|
+
// the world with no compile-time signal.
|
|
2890
|
+
storage: {
|
|
2891
|
+
...generated.storage,
|
|
2892
|
+
create_attachment: createAttachment,
|
|
2893
|
+
create_audio: createAudio,
|
|
2894
|
+
create_image: createImage,
|
|
2895
|
+
create_video: createVideo
|
|
2896
|
+
}
|
|
2897
|
+
};
|
|
2898
|
+
|
|
2899
|
+
// src/kinds/realtime-channel.ts
|
|
2900
|
+
function realtimeServerRefName(context, server) {
|
|
2901
|
+
const name = typeof server === "string" ? server : server?.name;
|
|
2902
|
+
if (!name) {
|
|
2903
|
+
throw new Error(`${context}: \`server\` is required \u2014 a channel path is unique only within its realtime server.`);
|
|
2904
|
+
}
|
|
2905
|
+
return name;
|
|
2906
|
+
}
|
|
2907
|
+
function resolveRealtimeServerRef(context, server) {
|
|
2908
|
+
if (typeof server !== "string" && server?.guid) return server.guid;
|
|
2909
|
+
return deriveGuid("realtime_server", realtimeServerRefName(context, server));
|
|
2910
|
+
}
|
|
2911
|
+
function encodeRealtimeChannel(def) {
|
|
2912
|
+
if (!def.name) throw new Error("realtimeChannel: `name` is required (the channel path).");
|
|
2913
|
+
const context = `realtimeChannel "${def.name}"`;
|
|
2914
|
+
assertChannelPathParams(def);
|
|
2915
|
+
return {
|
|
2916
|
+
name: def.name,
|
|
2917
|
+
description: def.description ?? "",
|
|
2918
|
+
active: def.active ?? true,
|
|
2919
|
+
server: { id: resolveRealtimeServerRef(context, def.server) },
|
|
2920
|
+
input: Object.entries(def.input ?? {}).map(([name, d]) => encodeInput(name, d)),
|
|
2921
|
+
anonymous_clients: def.anonymousClients ?? false,
|
|
2922
|
+
presence: def.presence ?? false,
|
|
2923
|
+
publish: {
|
|
2924
|
+
who: def.publish?.who ?? "nobody",
|
|
2925
|
+
direct: def.publish?.direct ?? false
|
|
2926
|
+
},
|
|
2927
|
+
conversation: {
|
|
2928
|
+
enabled: def.conversation?.enabled ?? false,
|
|
2929
|
+
limit: def.conversation?.limit ?? 0,
|
|
2930
|
+
ttl: def.conversation?.ttl ?? 0
|
|
2931
|
+
},
|
|
2932
|
+
delivery: {
|
|
2933
|
+
guarantee: def.delivery?.guarantee ?? "at_most_once",
|
|
2934
|
+
per_recipient: def.delivery?.perRecipient ?? false
|
|
2935
|
+
},
|
|
2936
|
+
rate_limit: { messages_per_minute: def.rateLimit?.messagesPerMinute ?? 0 },
|
|
2937
|
+
history: encodeContainerHistory("message", def.history),
|
|
2938
|
+
tag: encodeTags(def.tags)
|
|
2939
|
+
};
|
|
2940
|
+
}
|
|
2941
|
+
var realtimeChannelKind = {
|
|
2942
|
+
name: "channel",
|
|
2943
|
+
payloadKey: "channel",
|
|
2944
|
+
encode: encodeRealtimeChannel,
|
|
2945
|
+
guidOf: (def) => realtimeChannelGuid(def)
|
|
2946
|
+
};
|
|
2947
|
+
registerKind(realtimeChannelKind);
|
|
2948
|
+
function channelPathParams(path) {
|
|
2949
|
+
return parsePathParams(`realtimeChannel "${path}"`, path);
|
|
2950
|
+
}
|
|
2951
|
+
function assertChannelPathParams(def) {
|
|
2952
|
+
const context = `realtimeChannel "${def.name}"`;
|
|
2953
|
+
assertStoredName(context, def.name, "route");
|
|
2954
|
+
const params = parsePathParams(context, def.name);
|
|
2955
|
+
assertPathParamInputs(context, params, def.input);
|
|
2956
|
+
return params;
|
|
2957
|
+
}
|
|
2958
|
+
function realtimeChannel(def) {
|
|
2959
|
+
assertChannelPathParams(def);
|
|
2960
|
+
const context = `realtimeChannel "${def.name}"`;
|
|
2961
|
+
const getChannel = (params) => fillPathParams(context, "getChannel()", def.name, params);
|
|
2962
|
+
return { ...def, getChannel };
|
|
2963
|
+
}
|
|
2964
|
+
function realtimeChannelGuid(def) {
|
|
2965
|
+
if (def.guid) return def.guid;
|
|
2966
|
+
const context = `realtimeChannel "${def.name}"`;
|
|
2967
|
+
return deriveGuid(
|
|
2968
|
+
"channel",
|
|
2969
|
+
realtimeChannelSeedName(realtimeServerRefName(context, def.server), def.name)
|
|
2970
|
+
);
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
// src/kinds/trigger-inputs.ts
|
|
2974
|
+
var ERROR_EVENT_DESCRIPTION = `Which event fired the trigger. "new" fires on first capture and on every snapshot re-capture for non-ignored signatures (rate-limited by the ~5min snapshot dedup window). "regression" fires when a previously-fixed signature re-occurs (the fix didn't hold, or the same bug regressed back). "fixed" fires when a user marks a signature as fixed.`;
|
|
2975
|
+
function realtimeClientInput() {
|
|
2976
|
+
return input.object(
|
|
2977
|
+
{
|
|
2978
|
+
extras: f.json(),
|
|
2979
|
+
permissions: f.object({ dbo_id: f.int(), row_id: f.text() }, { required: true })
|
|
2980
|
+
},
|
|
2981
|
+
{ required: true }
|
|
2982
|
+
);
|
|
2983
|
+
}
|
|
2984
|
+
function encodeAll(map) {
|
|
2985
|
+
return Object.entries(map).map(([name, d]) => encodeInput(name, d));
|
|
2986
|
+
}
|
|
2987
|
+
var CATALOG = {
|
|
2988
|
+
// Database trigger — new/old rows, action op, datasource label.
|
|
2989
|
+
database: () => ({
|
|
2990
|
+
new: input.json(),
|
|
2991
|
+
old: input.json(),
|
|
2992
|
+
action: input.enum(["insert", "update", "delete", "truncate"], { required: true }),
|
|
2993
|
+
// NOTE (Xano quirk, mirror don't fix): `updateDefaults` stores `datasource`
|
|
2994
|
+
// as `text` but copy-pastes the `action` enum into its `values`. We mirror
|
|
2995
|
+
// the stored shape exactly rather than "correcting" it.
|
|
2996
|
+
datasource: input.text({ required: true, values: ["insert", "update", "delete", "truncate"] })
|
|
2997
|
+
}),
|
|
2998
|
+
// Toolset trigger (MCP server / agent) — the connected toolset + its tools.
|
|
2999
|
+
toolset: () => ({
|
|
3000
|
+
toolset: input.object(
|
|
3001
|
+
{
|
|
3002
|
+
id: f.int({ description: "The toolset ID" }),
|
|
3003
|
+
name: f.text({ description: "The toolset name", methods: ["trim"] }),
|
|
3004
|
+
instructions: f.text({ description: "The toolset instructions", methods: ["trim"] })
|
|
3005
|
+
},
|
|
3006
|
+
{ description: "The toolset being connected to" }
|
|
3007
|
+
),
|
|
3008
|
+
tools: input.list(
|
|
3009
|
+
input.object({
|
|
3010
|
+
id: f.int({ description: "The tool ID" }),
|
|
3011
|
+
name: f.text({ description: "The tool name", methods: ["trim"] }),
|
|
3012
|
+
instructions: f.text({ description: "The tool instructions", methods: ["trim"] })
|
|
3013
|
+
}),
|
|
3014
|
+
{ description: "The list of tools on the MCP Server" }
|
|
3015
|
+
)
|
|
3016
|
+
}),
|
|
3017
|
+
// Workspace lifecycle trigger — branch action + the branches involved.
|
|
3018
|
+
workspace: () => ({
|
|
3019
|
+
to_branch: input.object({ id: f.int(), label: f.text({ methods: ["trim"] }) }),
|
|
3020
|
+
from_branch: input.object({ id: f.int(), label: f.text({ methods: ["trim"] }) }),
|
|
3021
|
+
action: input.enum(["branch_live", "branch_merge", "branch_new"], { required: true })
|
|
3022
|
+
}),
|
|
3023
|
+
// Realtime channel trigger — message/join action + channel/client/options/payload.
|
|
3024
|
+
workspace_realtime_channel: () => ({
|
|
3025
|
+
action: input.enum(["message", "join"], { required: true, default: "message" }),
|
|
3026
|
+
channel: input.text({ required: true }),
|
|
3027
|
+
client: input.object(
|
|
3028
|
+
{
|
|
3029
|
+
extras: f.json(),
|
|
3030
|
+
permissions: f.object(
|
|
3031
|
+
{ dbo_id: f.int(), row_id: f.text() },
|
|
3032
|
+
{ required: true }
|
|
3033
|
+
)
|
|
3034
|
+
},
|
|
3035
|
+
{ required: true }
|
|
3036
|
+
),
|
|
3037
|
+
options: input.object({ authenticated: f.bool(), channel: f.text() }),
|
|
3038
|
+
payload: input.json({ required: true, nullable: true })
|
|
3039
|
+
}),
|
|
3040
|
+
// Realtime SERVER lifecycle trigger — connect/disconnect on a realtime server.
|
|
3041
|
+
// Mirrors the engine's stored input array exactly: the action enum carries NO
|
|
3042
|
+
// default (unlike the legacy channel trigger's `"message"`), and `client` is
|
|
3043
|
+
// the same connecting-client object both realtime lifecycle types use.
|
|
3044
|
+
realtime_server: () => ({
|
|
3045
|
+
action: input.enum(["connect", "disconnect"], { required: true }),
|
|
3046
|
+
realtime_server: input.text({ required: true }),
|
|
3047
|
+
client: realtimeClientInput()
|
|
3048
|
+
}),
|
|
3049
|
+
// Realtime CHANNEL lifecycle trigger — join/leave/deliver on a channel. Same
|
|
3050
|
+
// shape as the server type with the addressed channel path in place of the
|
|
3051
|
+
// server name.
|
|
3052
|
+
//
|
|
3053
|
+
// The action enum carries all THREE actions the engine declares for this type,
|
|
3054
|
+
// regardless of which ones a given trigger enables: the enum describes what
|
|
3055
|
+
// `action` can hold at runtime, and the per-trigger selection lives in `meta`.
|
|
3056
|
+
//
|
|
3057
|
+
// `payload` IS declared, and it is what distinguishes this type from the server
|
|
3058
|
+
// one above. It sits between `channel` and `client`, and it is the message body
|
|
3059
|
+
// — optional (a join/leave carries none) and nullable, unlike the LEGACY
|
|
3060
|
+
// channel trigger's required `payload`.
|
|
3061
|
+
//
|
|
3062
|
+
// This entry was previously absent, on the strength of a live capture read as
|
|
3063
|
+
// showing a `deliver`-only trigger storing three inputs. A sweep of a current
|
|
3064
|
+
// instance says otherwise, without exception: all 30 channel triggers store
|
|
3065
|
+
// four entries in this order, and all 11 realtime_server triggers store three.
|
|
3066
|
+
// A pulled channel trigger was regenerating an input short, so `inp("payload")`
|
|
3067
|
+
// did not resolve and re-deploying dropped an entry the engine supplies.
|
|
3068
|
+
channel: () => ({
|
|
3069
|
+
action: input.enum(["join", "leave", "deliver"], { required: true }),
|
|
3070
|
+
channel: input.text({ required: true }),
|
|
3071
|
+
payload: input.json({ nullable: true }),
|
|
3072
|
+
client: realtimeClientInput()
|
|
3073
|
+
}),
|
|
3074
|
+
// Error trigger — the error signature schema (verbatim from buildErrorTriggerInputSchema).
|
|
3075
|
+
error: () => ({
|
|
3076
|
+
event: input.enum(["new", "regression", "fixed"], { description: ERROR_EVENT_DESCRIPTION }),
|
|
3077
|
+
id: input.int({
|
|
3078
|
+
description: "The error signature row id. Use to build deep links into the error-logs UI."
|
|
3079
|
+
}),
|
|
3080
|
+
signature: input.text({ description: "Stable hash that identifies this error signature." }),
|
|
3081
|
+
error: input.object(
|
|
3082
|
+
{
|
|
3083
|
+
code: f.text({ description: "Machine-readable error code." }),
|
|
3084
|
+
message: f.text({ description: "Human-readable error message." })
|
|
3085
|
+
},
|
|
3086
|
+
{ description: "Error code and message captured from the failing run." }
|
|
3087
|
+
),
|
|
3088
|
+
caller: input.object(
|
|
3089
|
+
{
|
|
3090
|
+
type: f.text({
|
|
3091
|
+
description: "Caller kind (api, function, task, middleware, trigger, unknown)."
|
|
3092
|
+
}),
|
|
3093
|
+
id: f.int({ description: "Caller object id." }),
|
|
3094
|
+
name: f.text({ description: "Caller object name.", nullable: true })
|
|
3095
|
+
},
|
|
3096
|
+
{ description: "Where the error originated. Null on 'fixed' events.", nullable: true }
|
|
3097
|
+
),
|
|
3098
|
+
statement: input.object(
|
|
3099
|
+
{
|
|
3100
|
+
name: f.text({ description: "Statement name." }),
|
|
3101
|
+
xsid: f.text({ description: "Statement xsid within the function stack." })
|
|
3102
|
+
},
|
|
3103
|
+
{ description: "Failing statement. Null on 'fixed' events.", nullable: true }
|
|
3104
|
+
),
|
|
3105
|
+
actor: input.object(
|
|
3106
|
+
{
|
|
3107
|
+
id: f.int({ description: "User id." }),
|
|
3108
|
+
name: f.text({ description: "User name.", nullable: true })
|
|
3109
|
+
},
|
|
3110
|
+
{
|
|
3111
|
+
description: "User who marked the error as fixed. Populated only for 'fixed' events.",
|
|
3112
|
+
nullable: true
|
|
3113
|
+
}
|
|
3114
|
+
),
|
|
3115
|
+
count: input.object(
|
|
3116
|
+
{
|
|
3117
|
+
total: f.int({ description: "Total occurrences since first seen." }),
|
|
3118
|
+
last_hour: f.int({ description: "Occurrences in the last hour." })
|
|
3119
|
+
},
|
|
3120
|
+
{ description: "Occurrence counts for this signature." }
|
|
3121
|
+
),
|
|
3122
|
+
first_seen: input.text({ description: "ISO-8601 UTC timestamp of the first occurrence." }),
|
|
3123
|
+
last_seen: input.text({ description: "ISO-8601 UTC timestamp of the most recent occurrence." }),
|
|
3124
|
+
fixed_at: input.text({
|
|
3125
|
+
description: "ISO-8601 UTC timestamp the error was marked fixed. Null otherwise.",
|
|
3126
|
+
nullable: true
|
|
3127
|
+
})
|
|
3128
|
+
})
|
|
3129
|
+
};
|
|
3130
|
+
function impliedInputs(objType) {
|
|
3131
|
+
return encodeAll(CATALOG[objType]());
|
|
3132
|
+
}
|
|
3133
|
+
|
|
3134
|
+
// src/kinds/trigger-handle.ts
|
|
3135
|
+
function accessor(base) {
|
|
3136
|
+
const fn = (path) => inp(`${base}.${path}`);
|
|
3137
|
+
return Object.assign(fn, inp(base));
|
|
3138
|
+
}
|
|
3139
|
+
function buildTriggerHandle(objType) {
|
|
3140
|
+
const handle = {};
|
|
3141
|
+
for (const { name } of impliedInputs(objType)) {
|
|
3142
|
+
handle[name] = accessor(name);
|
|
3143
|
+
}
|
|
3144
|
+
return handle;
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
// src/kinds/trigger.ts
|
|
3148
|
+
function baseMeta() {
|
|
3149
|
+
return {
|
|
3150
|
+
database: {
|
|
3151
|
+
datasource: [],
|
|
3152
|
+
search: { expression: [] },
|
|
3153
|
+
action: { delete: false, insert: false, truncate: false, update: false }
|
|
3154
|
+
},
|
|
3155
|
+
toolset: { action: { connection: false } },
|
|
3156
|
+
workspace: { action: { branch_live: false, branch_merge: false, branch_new: false } },
|
|
3157
|
+
workspace_realtime_channel: { action: { message: false, join: false } },
|
|
3158
|
+
// The two realtime lifecycle groups. Every trigger type carries the WHOLE
|
|
3159
|
+
// skeleton with only its own group's flags set — verified against a live
|
|
3160
|
+
// engine capture, which emits all six groups for a table trigger, a workspace
|
|
3161
|
+
// trigger, and both realtime lifecycle triggers alike.
|
|
3162
|
+
realtime_server: { action: { connect: false, disconnect: false } },
|
|
3163
|
+
channel: { action: { join: false, leave: false, deliver: false } }
|
|
3164
|
+
};
|
|
3165
|
+
}
|
|
3166
|
+
function assertSearchMatchesActions(name, expression, action) {
|
|
3167
|
+
if (action.truncate) {
|
|
3168
|
+
throw new Error(
|
|
3169
|
+
`tableTrigger "${name}": \`search\` is not supported with the \`truncate\` action \u2014 a truncate fires once for the whole table, with no row to test.`
|
|
3170
|
+
);
|
|
3171
|
+
}
|
|
3172
|
+
const operands = collectOperands(expression);
|
|
3173
|
+
for (const [enabled, forbidden] of [
|
|
3174
|
+
[action.insert, "OLD"],
|
|
3175
|
+
[action.delete, "NEW"]
|
|
3176
|
+
]) {
|
|
3177
|
+
if (!enabled) continue;
|
|
3178
|
+
const hit = operands.find((o) => o.startsWith(`${forbidden}.`));
|
|
3179
|
+
if (hit !== void 0) {
|
|
3180
|
+
const act = forbidden === "OLD" ? "insert" : "delete";
|
|
3181
|
+
throw new Error(
|
|
3182
|
+
`tableTrigger "${name}": \`search\` reads \`${hit}\`, which does not exist for the \`${act}\` action this trigger is enabled for. Use ${forbidden === "OLD" ? "`NEW.*`" : "`OLD.*`"}, or split the actions into separate triggers.`
|
|
3183
|
+
);
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
function collectOperands(node) {
|
|
3188
|
+
if (Array.isArray(node)) return node.flatMap(collectOperands);
|
|
3189
|
+
if (node === null || typeof node !== "object") return [];
|
|
3190
|
+
const out = [];
|
|
3191
|
+
for (const [key, value] of Object.entries(node)) {
|
|
3192
|
+
if (key === "operand" && typeof value === "string") out.push(value);
|
|
3193
|
+
else out.push(...collectOperands(value));
|
|
3194
|
+
}
|
|
3195
|
+
return out;
|
|
3196
|
+
}
|
|
3197
|
+
function encodeTrigger(def) {
|
|
3198
|
+
if (!def.name) throw new Error("trigger: `name` is required.");
|
|
3199
|
+
const xdo = {
|
|
3200
|
+
name: def.name,
|
|
3201
|
+
active: def.active ?? true,
|
|
3202
|
+
description: def.description ?? "",
|
|
3203
|
+
obj_id: def.objId ?? 0,
|
|
3204
|
+
obj_type: def.objType,
|
|
3205
|
+
history: encodeHistory("trigger", def.history),
|
|
3206
|
+
output: [],
|
|
3207
|
+
meta: def.meta,
|
|
3208
|
+
tag: encodeTags(def.tags),
|
|
3209
|
+
// Inputs are implied by type (fixed by Xano, not user-editable) — always
|
|
3210
|
+
// inject the canonical per-type array, never a user-supplied map.
|
|
3211
|
+
input: impliedInputs(def.objType),
|
|
3212
|
+
run: (def.stack ?? []).map(encodeStatement)
|
|
3213
|
+
};
|
|
3214
|
+
if (def.hasResult) {
|
|
3215
|
+
xdo.result = encodeResponse(def.response);
|
|
3216
|
+
} else {
|
|
3217
|
+
xdo.result = [];
|
|
3218
|
+
}
|
|
3219
|
+
return xdo;
|
|
3220
|
+
}
|
|
3221
|
+
function tableTrigger(args) {
|
|
3222
|
+
const meta = baseMeta();
|
|
3223
|
+
meta.database.datasource = (args.datasources ?? []).map((tag) => ({ tag }));
|
|
3224
|
+
meta.database.action = {
|
|
3225
|
+
delete: args.actions?.delete ?? false,
|
|
3226
|
+
insert: args.actions?.insert ?? false,
|
|
3227
|
+
truncate: args.actions?.truncate ?? false,
|
|
3228
|
+
update: args.actions?.update ?? false
|
|
3229
|
+
};
|
|
3230
|
+
if (args.search !== void 0) {
|
|
3231
|
+
const encoded = encodeExpression(args.search);
|
|
3232
|
+
assertSearchMatchesActions(args.name, encoded.expression, meta.database.action);
|
|
3233
|
+
meta.database.search = encoded;
|
|
3234
|
+
}
|
|
3235
|
+
const objId = args.table !== void 0 ? resolveRef("dbo", args.table) : args.objId;
|
|
3236
|
+
const t = buildTriggerHandle("database");
|
|
3237
|
+
return {
|
|
3238
|
+
name: args.name,
|
|
3239
|
+
guid: args.guid,
|
|
3240
|
+
description: args.description,
|
|
3241
|
+
active: args.active,
|
|
3242
|
+
tags: args.tags,
|
|
3243
|
+
objId,
|
|
3244
|
+
objType: "database",
|
|
3245
|
+
hasResult: false,
|
|
3246
|
+
meta,
|
|
3247
|
+
stack: args.stack?.(t) ?? []
|
|
3248
|
+
};
|
|
3249
|
+
}
|
|
3250
|
+
function realtimeTrigger(args) {
|
|
3251
|
+
const meta = baseMeta();
|
|
3252
|
+
meta.workspace_realtime_channel.action = {
|
|
3253
|
+
message: args.actions?.message ?? false,
|
|
3254
|
+
join: args.actions?.join ?? false
|
|
3255
|
+
};
|
|
3256
|
+
const t = buildTriggerHandle("workspace_realtime_channel");
|
|
3257
|
+
return {
|
|
3258
|
+
name: args.name,
|
|
3259
|
+
guid: args.guid,
|
|
3260
|
+
description: args.description,
|
|
3261
|
+
active: args.active,
|
|
3262
|
+
tags: args.tags,
|
|
3263
|
+
objId: args.objId,
|
|
3264
|
+
objType: "workspace_realtime_channel",
|
|
3265
|
+
hasResult: true,
|
|
3266
|
+
meta,
|
|
3267
|
+
// The `?? []` fallback matches `S`'s own `readonly []` default (which is what
|
|
3268
|
+
// `S` resolves to when the callback is omitted); the cast covers the branch
|
|
3269
|
+
// TypeScript cannot tie back to that default.
|
|
3270
|
+
stack: args.stack?.(t) ?? [],
|
|
3271
|
+
// Xano default (updateResult): echo the `payload` input back. It is a plain
|
|
3272
|
+
// `Value` with no trace, so an omitted callback derives `unknown`.
|
|
3273
|
+
response: args.response ? args.response(t) : inp("payload")
|
|
3274
|
+
};
|
|
3275
|
+
}
|
|
3276
|
+
function realtimeServerTrigger(args) {
|
|
3277
|
+
const t = buildTriggerHandle("realtime_server");
|
|
3278
|
+
const serverMeta = baseMeta();
|
|
3279
|
+
serverMeta.realtime_server.action = {
|
|
3280
|
+
connect: args.actions?.connect ?? false,
|
|
3281
|
+
disconnect: args.actions?.disconnect ?? false
|
|
3282
|
+
};
|
|
3283
|
+
return {
|
|
3284
|
+
name: args.name,
|
|
3285
|
+
guid: args.guid,
|
|
3286
|
+
description: args.description,
|
|
3287
|
+
active: args.active,
|
|
3288
|
+
tags: args.tags,
|
|
3289
|
+
objId: args.realtimeServer !== void 0 ? resolveRef("realtime_server", args.realtimeServer) : args.objId,
|
|
3290
|
+
objType: "realtime_server",
|
|
3291
|
+
hasResult: true,
|
|
3292
|
+
meta: serverMeta,
|
|
3293
|
+
// See the `realtimeTrigger` note: the fallback matches `S`'s own default.
|
|
3294
|
+
stack: args.stack?.(t) ?? [],
|
|
3295
|
+
response: args.response?.(t)
|
|
3296
|
+
};
|
|
3297
|
+
}
|
|
3298
|
+
function realtimeChannelTrigger(args) {
|
|
3299
|
+
const t = buildTriggerHandle("channel");
|
|
3300
|
+
const channelMeta = baseMeta();
|
|
3301
|
+
channelMeta.channel.action = {
|
|
3302
|
+
join: args.actions?.join ?? false,
|
|
3303
|
+
leave: args.actions?.leave ?? false,
|
|
3304
|
+
deliver: args.actions?.deliver ?? false
|
|
3305
|
+
};
|
|
3306
|
+
return {
|
|
3307
|
+
name: args.name,
|
|
3308
|
+
guid: args.guid,
|
|
3309
|
+
description: args.description,
|
|
3310
|
+
active: args.active,
|
|
3311
|
+
tags: args.tags,
|
|
3312
|
+
objId: args.channel !== void 0 ? realtimeChannelGuid(args.channel) : args.objId,
|
|
3313
|
+
objType: "channel",
|
|
3314
|
+
hasResult: true,
|
|
3315
|
+
meta: channelMeta,
|
|
3316
|
+
// See the `realtimeTrigger` note: the fallback matches `S`'s own default.
|
|
3317
|
+
stack: args.stack?.(t) ?? [],
|
|
3318
|
+
response: args.response?.(t)
|
|
3319
|
+
};
|
|
3320
|
+
}
|
|
3321
|
+
function mcpServerTrigger(args) {
|
|
3322
|
+
return toolsetTrigger(args, args.mcpServer);
|
|
3323
|
+
}
|
|
3324
|
+
function agentTrigger(args) {
|
|
3325
|
+
return toolsetTrigger(args, args.agent);
|
|
3326
|
+
}
|
|
3327
|
+
function workspaceTrigger(args) {
|
|
3328
|
+
const meta = baseMeta();
|
|
3329
|
+
meta.workspace.action = {
|
|
3330
|
+
branch_live: args.actions?.branch_live ?? false,
|
|
3331
|
+
branch_merge: args.actions?.branch_merge ?? false,
|
|
3332
|
+
branch_new: args.actions?.branch_new ?? false
|
|
3333
|
+
};
|
|
3334
|
+
const t = buildTriggerHandle("workspace");
|
|
3335
|
+
return {
|
|
3336
|
+
name: args.name,
|
|
3337
|
+
guid: args.guid,
|
|
3338
|
+
description: args.description,
|
|
3339
|
+
active: args.active,
|
|
3340
|
+
tags: args.tags,
|
|
3341
|
+
objId: args.objId,
|
|
3342
|
+
objType: "workspace",
|
|
3343
|
+
hasResult: false,
|
|
3344
|
+
meta,
|
|
3345
|
+
stack: args.stack?.(t) ?? []
|
|
3346
|
+
};
|
|
3347
|
+
}
|
|
3348
|
+
function errorTrigger(args) {
|
|
3349
|
+
const t = buildTriggerHandle("error");
|
|
3350
|
+
return {
|
|
3351
|
+
name: args.name,
|
|
3352
|
+
guid: args.guid,
|
|
3353
|
+
description: args.description,
|
|
3354
|
+
active: args.active,
|
|
3355
|
+
tags: args.tags,
|
|
3356
|
+
objId: args.objId,
|
|
3357
|
+
objType: "error",
|
|
3358
|
+
hasResult: false,
|
|
3359
|
+
meta: baseMeta(),
|
|
3360
|
+
stack: args.stack?.(t) ?? []
|
|
3361
|
+
};
|
|
3362
|
+
}
|
|
3363
|
+
function toolsetTrigger(args, target) {
|
|
3364
|
+
const meta = baseMeta();
|
|
3365
|
+
meta.toolset.action.connection = true;
|
|
3366
|
+
const t = buildTriggerHandle("toolset");
|
|
3367
|
+
return {
|
|
3368
|
+
name: args.name,
|
|
3369
|
+
guid: args.guid,
|
|
3370
|
+
description: args.description,
|
|
3371
|
+
active: args.active,
|
|
3372
|
+
tags: args.tags,
|
|
3373
|
+
objId: target !== void 0 ? resolveRef("toolset", target) : args.objId,
|
|
3374
|
+
objType: "toolset",
|
|
3375
|
+
hasResult: true,
|
|
3376
|
+
meta,
|
|
3377
|
+
// Xano default (updateRun): copy the toolset/tools inputs into stack vars.
|
|
3378
|
+
// See the `realtimeTrigger` note on the cast; the default stack's `set_var`
|
|
3379
|
+
// bindings are untraceable anyway, so an omitted callback derives `unknown`.
|
|
3380
|
+
stack: args.stack ? args.stack(t) : [setVar("toolset", inp("toolset")), setVar("tools", inp("tools"))],
|
|
3381
|
+
// Xano default (updateResult): return the toolset/tools vars.
|
|
3382
|
+
response: args.response ? args.response(t) : { toolset: ref("toolset"), tools: ref("tools") }
|
|
3383
|
+
};
|
|
3384
|
+
}
|
|
3385
|
+
var triggerKind = {
|
|
3386
|
+
name: "trigger",
|
|
3387
|
+
payloadKey: "trigger",
|
|
3388
|
+
encode: encodeTrigger
|
|
3389
|
+
};
|
|
3390
|
+
registerKind(triggerKind);
|
|
3391
|
+
|
|
3392
|
+
// src/kinds/workspace-config.ts
|
|
3393
|
+
var LEGACY_REALTIME = {
|
|
3394
|
+
hash: "",
|
|
3395
|
+
mode: "",
|
|
3396
|
+
enabled: false,
|
|
3397
|
+
channels: []
|
|
3398
|
+
};
|
|
3399
|
+
var DEFAULT_DOCUMENTATION = {
|
|
3400
|
+
token: "",
|
|
3401
|
+
whitelist: {},
|
|
3402
|
+
require_token: false
|
|
3403
|
+
};
|
|
3404
|
+
var DEFAULT_PREFERENCES = {
|
|
3405
|
+
allow_push: false,
|
|
3406
|
+
track_performance: true,
|
|
3407
|
+
use_internal_docs: false
|
|
3408
|
+
};
|
|
3409
|
+
var DEFAULT_SETTINGS = {
|
|
3410
|
+
ai_enabled: false,
|
|
3411
|
+
ai_settings: {
|
|
3412
|
+
providers: {
|
|
3413
|
+
google: { model: "", api_key: "" },
|
|
3414
|
+
openai: { model: "", api_key: "" },
|
|
3415
|
+
anthropic: { model: "", api_key: "" },
|
|
3416
|
+
"azure-openai": { model: "", api_key: "", base_url: "", api_version: "" }
|
|
3417
|
+
},
|
|
3418
|
+
default_provider: "free"
|
|
3419
|
+
},
|
|
3420
|
+
hide_xano_agent: false
|
|
3421
|
+
};
|
|
3422
|
+
function mergeOverDefaults(defaults, authored) {
|
|
3423
|
+
return mergeOver(
|
|
3424
|
+
defaults,
|
|
3425
|
+
authored ?? {}
|
|
3426
|
+
);
|
|
3427
|
+
}
|
|
3428
|
+
function mergeOver(base, over) {
|
|
3429
|
+
const out = { ...base };
|
|
3430
|
+
for (const [key, value] of Object.entries(over)) {
|
|
3431
|
+
const under = out[key];
|
|
3432
|
+
out[key] = isPlainRecord(under) && isPlainRecord(value) ? mergeOver(under, value) : structuredClone(value);
|
|
3433
|
+
}
|
|
3434
|
+
return out;
|
|
3435
|
+
}
|
|
3436
|
+
function isPlainRecord(value) {
|
|
3437
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3438
|
+
}
|
|
3439
|
+
function encodeWorkspaceEnv(env) {
|
|
3440
|
+
return Object.entries(env).map(([name, value]) => ({ name, value, market_item: [] }));
|
|
3441
|
+
}
|
|
3442
|
+
function encodeWorkspaceMiddleware(m) {
|
|
3443
|
+
return {
|
|
3444
|
+
function_pre: encodeMiddlewareList(m.function?.pre),
|
|
3445
|
+
function_post: encodeMiddlewareList(m.function?.post),
|
|
3446
|
+
query_pre: encodeMiddlewareList(m.query?.pre),
|
|
3447
|
+
query_post: encodeMiddlewareList(m.query?.post),
|
|
3448
|
+
task_pre: encodeMiddlewareList(m.task?.pre),
|
|
3449
|
+
task_post: encodeMiddlewareList(m.task?.post),
|
|
3450
|
+
tool_pre: encodeMiddlewareList(m.tool?.pre),
|
|
3451
|
+
tool_post: encodeMiddlewareList(m.tool?.post)
|
|
3452
|
+
};
|
|
3453
|
+
}
|
|
3454
|
+
function encodeWorkspaceConfig(def) {
|
|
3455
|
+
if (def.name === void 0 || def.name === null) {
|
|
3456
|
+
throw new Error(
|
|
3457
|
+
'workspace: no name. `workspaceConfig({ name })` is optional because the config inherits the name from `workspace("\u2026")` \u2014 so either start from `workspace("my-app")` or give this config an explicit `name`.'
|
|
3458
|
+
);
|
|
3459
|
+
}
|
|
3460
|
+
assertCanonical(`workspace "${def.name}"`, def.canonical);
|
|
3461
|
+
return {
|
|
3462
|
+
name: def.name,
|
|
3463
|
+
description: def.description ?? "",
|
|
3464
|
+
canonical: def.canonical ?? "",
|
|
3465
|
+
use_xdo: def.use_xdo ?? false,
|
|
3466
|
+
preferences: mergeOverDefaults(DEFAULT_PREFERENCES, def.preferences),
|
|
3467
|
+
realtime: def.realtime ?? { ...LEGACY_REALTIME },
|
|
3468
|
+
documentation: def.documentation ?? { ...DEFAULT_DOCUMENTATION },
|
|
3469
|
+
swagger: def.swagger ?? false,
|
|
3470
|
+
...def.middleware !== void 0 ? { middleware: encodeWorkspaceMiddleware(def.middleware) } : {},
|
|
3471
|
+
...def.history !== void 0 ? { history: buildWorkspaceHistory(def.history) } : {},
|
|
3472
|
+
env: def.env ? encodeWorkspaceEnv(def.env) : [],
|
|
3473
|
+
settings: mergeOverDefaults(DEFAULT_SETTINGS, def.settings),
|
|
3474
|
+
// Presence-preserving: each key is written only when the author set it, and
|
|
3475
|
+
// each nested optional likewise, so a pulled workspace re-exports to its own
|
|
3476
|
+
// bytes whether or not the engine happened to store the `?=` default.
|
|
3477
|
+
...def.use_custom_names !== void 0 ? { use_custom_names: def.use_custom_names } : {},
|
|
3478
|
+
...def.defaults !== void 0 ? { defaults: { ...def.defaults } } : {},
|
|
3479
|
+
...def.datasources !== void 0 ? { datasources: def.datasources.map((d) => ({ ...d })) } : {},
|
|
3480
|
+
...def.datasource_live !== void 0 ? { datasource_live: { ...def.datasource_live } } : {}
|
|
3481
|
+
};
|
|
3482
|
+
}
|
|
3483
|
+
var workspaceKind = {
|
|
3484
|
+
name: "workspace",
|
|
3485
|
+
payloadKey: "workspace",
|
|
3486
|
+
encode: encodeWorkspaceConfig
|
|
3487
|
+
};
|
|
3488
|
+
registerKind(workspaceKind);
|
|
3489
|
+
function workspaceConfig(def) {
|
|
3490
|
+
return def;
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3493
|
+
export {
|
|
3494
|
+
setVar,
|
|
3495
|
+
updateVar,
|
|
3496
|
+
encodeSearch,
|
|
3497
|
+
encodeSort,
|
|
3498
|
+
encodeEval,
|
|
3499
|
+
qualifyAggregateEvals,
|
|
3500
|
+
returnValue,
|
|
3501
|
+
die,
|
|
3502
|
+
debugLog,
|
|
3503
|
+
foreachBreak,
|
|
3504
|
+
foreachContinue,
|
|
3505
|
+
foreachRemove,
|
|
3506
|
+
forLoop,
|
|
3507
|
+
foreachLoop,
|
|
3508
|
+
whileLoop,
|
|
3509
|
+
group,
|
|
3510
|
+
switchCase,
|
|
3511
|
+
switchStatement,
|
|
3512
|
+
tryCatch,
|
|
3513
|
+
functionRun,
|
|
3514
|
+
functionCall,
|
|
3515
|
+
apiCall,
|
|
3516
|
+
taskCall,
|
|
3517
|
+
toolCall,
|
|
3518
|
+
triggerCall,
|
|
3519
|
+
middlewareCall,
|
|
3520
|
+
addonCall,
|
|
3521
|
+
actionCall,
|
|
3522
|
+
actionPackageCall,
|
|
3523
|
+
workflowTestCall,
|
|
3524
|
+
aiAgentRun,
|
|
3525
|
+
cloudJob,
|
|
3526
|
+
cloudJobAwait,
|
|
3527
|
+
cloudJobStatus,
|
|
3528
|
+
ignored,
|
|
3529
|
+
encodeFromSpec,
|
|
3530
|
+
registerSpec,
|
|
3531
|
+
GENERATED_SPECS,
|
|
3532
|
+
generated,
|
|
3533
|
+
arrayMap,
|
|
3534
|
+
arrayUnion,
|
|
3535
|
+
comment,
|
|
3536
|
+
getRawInput,
|
|
3537
|
+
postProcess,
|
|
3538
|
+
realtimeEvent,
|
|
3539
|
+
createAuthToken,
|
|
3540
|
+
expectToThrow,
|
|
3541
|
+
ipLookup,
|
|
3542
|
+
outputPaths,
|
|
3543
|
+
dbGet,
|
|
3544
|
+
dbDel,
|
|
3545
|
+
dbHas,
|
|
3546
|
+
dbPatch,
|
|
3547
|
+
dbTruncate,
|
|
3548
|
+
dbAdd,
|
|
3549
|
+
dbEdit,
|
|
3550
|
+
dbAddOrEdit,
|
|
3551
|
+
dbSchema,
|
|
3552
|
+
dbDirectQuery,
|
|
3553
|
+
dbBulkAdd,
|
|
3554
|
+
searchConstrainsRows,
|
|
3555
|
+
dbBulkDelete,
|
|
3556
|
+
dbBulkPatch,
|
|
3557
|
+
dbBulkUpdate,
|
|
3558
|
+
dbQuery,
|
|
3559
|
+
dbTransaction,
|
|
3560
|
+
dbExternalQuery,
|
|
3561
|
+
mathAdd,
|
|
3562
|
+
mathSub,
|
|
3563
|
+
mathMul,
|
|
3564
|
+
mathDiv,
|
|
3565
|
+
bitwiseAnd,
|
|
3566
|
+
bitwiseOr,
|
|
3567
|
+
bitwiseXor,
|
|
3568
|
+
textAppend,
|
|
3569
|
+
textPrepend,
|
|
3570
|
+
objectKeys,
|
|
3571
|
+
objectValues,
|
|
3572
|
+
objectEntries,
|
|
3573
|
+
GENERATED_STATEMENT_NAMES,
|
|
3574
|
+
declaredServicePorts,
|
|
3575
|
+
encodeMicroservice,
|
|
3576
|
+
microservice,
|
|
3577
|
+
microserviceKind,
|
|
3578
|
+
PRECONDITION_ERROR_TYPES,
|
|
3579
|
+
PRECONDITION_ERROR_STATUS,
|
|
3580
|
+
STORAGE_ACCESS,
|
|
3581
|
+
HEADER_DUPLICATES,
|
|
3582
|
+
s,
|
|
3583
|
+
impliedInputs,
|
|
3584
|
+
realtimeServerRefName,
|
|
3585
|
+
resolveRealtimeServerRef,
|
|
3586
|
+
encodeRealtimeChannel,
|
|
3587
|
+
realtimeChannelKind,
|
|
3588
|
+
channelPathParams,
|
|
3589
|
+
realtimeChannel,
|
|
3590
|
+
realtimeChannelGuid,
|
|
3591
|
+
encodeTrigger,
|
|
3592
|
+
tableTrigger,
|
|
3593
|
+
realtimeTrigger,
|
|
3594
|
+
realtimeServerTrigger,
|
|
3595
|
+
realtimeChannelTrigger,
|
|
3596
|
+
mcpServerTrigger,
|
|
3597
|
+
agentTrigger,
|
|
3598
|
+
workspaceTrigger,
|
|
3599
|
+
errorTrigger,
|
|
3600
|
+
triggerKind,
|
|
3601
|
+
DEFAULT_PREFERENCES,
|
|
3602
|
+
DEFAULT_SETTINGS,
|
|
3603
|
+
encodeWorkspaceConfig,
|
|
3604
|
+
workspaceKind,
|
|
3605
|
+
workspaceConfig
|
|
3606
|
+
};
|
|
3607
|
+
//# sourceMappingURL=chunk-FJ6ZS5KB.js.map
|