electrodb 1.10.2 → 1.12.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/README.md +97 -35
- package/index.d.ts +351 -100
- package/index.js +2 -1
- package/notes +45 -0
- package/output +106 -0
- package/package.json +8 -10
- package/src/clauses.js +20 -4
- package/src/client.js +2 -2
- package/src/entity.js +159 -9
- package/src/operations.js +7 -1
- package/src/schema.js +53 -14
- package/src/types.js +9 -0
- package/src/util.js +8 -0
- package/taskdata.json +1 -0
- package/typez.ts +1736 -0
- package/src/parse.js +0 -45
package/src/parse.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
function getPartDetail(part = "") {
|
|
2
|
-
let detail = {
|
|
3
|
-
expression: "",
|
|
4
|
-
name: "",
|
|
5
|
-
value: "",
|
|
6
|
-
};
|
|
7
|
-
if (part.includes("[")) {
|
|
8
|
-
if (!part.match(/\[\d\]/gi)) {
|
|
9
|
-
throw new Error(`Invalid path part "${part}" has bracket containing non-numeric characters.`);
|
|
10
|
-
}
|
|
11
|
-
let [name] = part.match(/.*(?=\[)/gi);
|
|
12
|
-
detail.name = `#${name}`;
|
|
13
|
-
detail.value = name;
|
|
14
|
-
} else {
|
|
15
|
-
detail.name = `#${part}`;
|
|
16
|
-
detail.value = part;
|
|
17
|
-
}
|
|
18
|
-
detail.expression = `#${part}`;
|
|
19
|
-
return detail;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function parse(path = "") {
|
|
23
|
-
if (typeof path !== "string" || !path.length) {
|
|
24
|
-
throw new Error("Path must be a string with a non-zero length");
|
|
25
|
-
}
|
|
26
|
-
let parts = path.split(/\./gi);
|
|
27
|
-
let attr = getPartDetail(parts[0]).value;
|
|
28
|
-
let target = getPartDetail(parts[parts.length-1]);
|
|
29
|
-
if (target.expression.includes("[")) {
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
let names = {};
|
|
33
|
-
let expressions = [];
|
|
34
|
-
for (let part of parts) {
|
|
35
|
-
let detail = getPartDetail(part);
|
|
36
|
-
names[detail.name] = detail.value;
|
|
37
|
-
expressions.push(detail.expression);
|
|
38
|
-
}
|
|
39
|
-
return {attr, path, names, target: target.value, expression: expressions.join(".")};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
module.exports = {
|
|
43
|
-
parse,
|
|
44
|
-
getPartDetail
|
|
45
|
-
};
|