@dataverse-to-code/test 1.0.1 → 1.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.built +1 -1
- package/dist/cli.js +5118 -1995
- package/dist/index.js +3938 -817
- package/dist/sim.js +12 -6
- package/package.json +1 -1
package/dist/sim.js
CHANGED
|
@@ -4153,7 +4153,7 @@ ${idKey(id)}`;
|
|
|
4153
4153
|
var SUPPORTED = /* @__PURE__ */ new Set(["$select", "$filter", "$orderby", "$top"]);
|
|
4154
4154
|
var OPS = /* @__PURE__ */ new Set(["eq", "ne", "gt", "ge", "lt", "le", "and", "or", "not"]);
|
|
4155
4155
|
function parseQuery(options) {
|
|
4156
|
-
const q = {};
|
|
4156
|
+
const q = { columns: [] };
|
|
4157
4157
|
const text = options.replace(/^\?/, "");
|
|
4158
4158
|
if (!text) return q;
|
|
4159
4159
|
for (const part of text.split("&")) {
|
|
@@ -4161,10 +4161,14 @@ ${idKey(id)}`;
|
|
|
4161
4161
|
const key2 = decodeURIComponent(eq < 0 ? part : part.slice(0, eq));
|
|
4162
4162
|
const value = decodeURIComponent(eq < 0 ? "" : part.slice(eq + 1));
|
|
4163
4163
|
if (!SUPPORTED.has(key2)) throw new NotSimulated(key2);
|
|
4164
|
-
if (key2 === "$select")
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
else q.
|
|
4164
|
+
if (key2 === "$select") {
|
|
4165
|
+
q.select = value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
4166
|
+
q.columns.push(...q.select);
|
|
4167
|
+
} else if (key2 === "$top") q.top = Number(value);
|
|
4168
|
+
else if (key2 === "$orderby") {
|
|
4169
|
+
q.orderBy = value.split(",").map((s) => s.trim().split(/\s+/)).map(([field2, dir]) => ({ field: field2, desc: dir === "desc" }));
|
|
4170
|
+
q.columns.push(...q.orderBy.map((o) => o.field));
|
|
4171
|
+
} else q.filter = parseFilter(value, q.columns);
|
|
4168
4172
|
}
|
|
4169
4173
|
return q;
|
|
4170
4174
|
}
|
|
@@ -4187,7 +4191,7 @@ ${idKey(id)}`;
|
|
|
4187
4191
|
}
|
|
4188
4192
|
return out;
|
|
4189
4193
|
}
|
|
4190
|
-
function parseFilter(s) {
|
|
4194
|
+
function parseFilter(s, columns) {
|
|
4191
4195
|
const toks = tokens(s);
|
|
4192
4196
|
let p = 0;
|
|
4193
4197
|
const fail = () => {
|
|
@@ -4228,6 +4232,7 @@ ${idKey(id)}`;
|
|
|
4228
4232
|
const fn = take().v;
|
|
4229
4233
|
take("(");
|
|
4230
4234
|
const field3 = take("id").v;
|
|
4235
|
+
columns.push(field3);
|
|
4231
4236
|
take(",");
|
|
4232
4237
|
const text = String(value()).toLowerCase();
|
|
4233
4238
|
take(")");
|
|
@@ -4237,6 +4242,7 @@ ${idKey(id)}`;
|
|
|
4237
4242
|
};
|
|
4238
4243
|
}
|
|
4239
4244
|
const field2 = take("id").v;
|
|
4245
|
+
columns.push(field2);
|
|
4240
4246
|
const op = take("op").v;
|
|
4241
4247
|
if (!["eq", "ne", "gt", "ge", "lt", "le"].includes(op)) fail();
|
|
4242
4248
|
const v = value();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataverse-to-code/test",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.51.0",
|
|
4
4
|
"description": "Run DataverseToCode project tests (.test.yaml) with Playwright: the offline form simulator in Chromium, a form fixture, and yamlTests(). Works with Microsoft Dataverse; not a Microsoft product.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Simon Allport",
|