electrodb 1.9.0 → 1.10.2
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/index.d.ts +906 -776
- package/package.json +8 -8
- package/src/entity.js +9 -7
- package/src/util.js +6 -2
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electrodb",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "mocha ./test/offline**.spec.js",
|
|
8
8
|
"test-ts": "mocha -r ts-node/register ./test/**.spec.ts",
|
|
9
9
|
"test-all": "mocha ./test/**.spec.js",
|
|
10
|
-
"test-all-local": "LOCAL_DYNAMO_ENDPOINT=http://localhost:8000 node ./test/init.js && LOCAL_DYNAMO_ENDPOINT=http://localhost:8000 mocha ./test/**.spec.js && npm run test-
|
|
11
|
-
"test-types": "
|
|
10
|
+
"test-all-local": "LOCAL_DYNAMO_ENDPOINT=http://localhost:8000 node ./test/init.js && LOCAL_DYNAMO_ENDPOINT=http://localhost:8000 mocha ./test/**.spec.js && LOCAL_DYNAMO_ENDPOINT=http://localhost:8000 npm run test-ts && npm run test-types",
|
|
11
|
+
"test-types": "tsd",
|
|
12
12
|
"coverage": "nyc npm run test-all && nyc report --reporter=text-lcov | coveralls",
|
|
13
13
|
"coverage-coveralls-local": "nyc npm run test-all-local && nyc report --reporter=text-lcov | coveralls",
|
|
14
14
|
"coverage-html-local": "nyc npm run test-all-local && nyc report --reporter=html",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"moment": "2.24.0",
|
|
44
44
|
"nyc": "^15.1.0",
|
|
45
45
|
"source-map-support": "^0.5.19",
|
|
46
|
-
"ts-node": "^
|
|
47
|
-
"tsd": "^0.
|
|
48
|
-
"typescript": "^4.
|
|
46
|
+
"ts-node": "^10.8.1",
|
|
47
|
+
"tsd": "^0.21.0",
|
|
48
|
+
"typescript": "^4.7.4",
|
|
49
49
|
"uuid": "7.0.1"
|
|
50
50
|
},
|
|
51
51
|
"keywords": [
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"directory": "test"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"
|
|
65
|
-
"
|
|
64
|
+
"@aws-sdk/lib-dynamodb": "^3.54.1",
|
|
65
|
+
"jsonschema": "1.2.7"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/entity.js
CHANGED
|
@@ -702,14 +702,16 @@ class Entity {
|
|
|
702
702
|
let pattern = `^${this._regexpEscape(prefix)}`;
|
|
703
703
|
let labels = this.model.facets.labels[index][keyType] || [];
|
|
704
704
|
for (let {name, label} of labels) {
|
|
705
|
-
let
|
|
706
|
-
if (
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
705
|
+
let attr = this.model.schema.attributes[name];
|
|
706
|
+
if (attr) {
|
|
707
|
+
if (isCustom) {
|
|
708
|
+
pattern += `${this._regexpEscape(label === undefined ? "" : label)}(.+)`;
|
|
709
|
+
} else {
|
|
710
|
+
pattern += `#${this._regexpEscape(label === undefined ? name : label)}_(.+)`;
|
|
711
|
+
}
|
|
712
|
+
names.push(name);
|
|
713
|
+
types.push(attr.type);
|
|
710
714
|
}
|
|
711
|
-
names.push(name);
|
|
712
|
-
types.push(type);
|
|
713
715
|
}
|
|
714
716
|
pattern += "$";
|
|
715
717
|
let regex = RegExp(pattern);
|
package/src/util.js
CHANGED
|
@@ -133,14 +133,18 @@ class BatchGetOrderMaintainer {
|
|
|
133
133
|
|
|
134
134
|
getOrder(item) {
|
|
135
135
|
const key = this.keyFormatter(item);
|
|
136
|
-
|
|
136
|
+
const value = this.batchIndexMap.get(key);
|
|
137
|
+
if (value === undefined) {
|
|
138
|
+
return -1;
|
|
139
|
+
}
|
|
140
|
+
return value;
|
|
137
141
|
}
|
|
138
142
|
|
|
139
143
|
defineOrder(parameters = []) {
|
|
140
144
|
if (this.enabled) {
|
|
141
145
|
for (let i = 0; i < parameters.length; i++) {
|
|
142
146
|
const batchParams = parameters[i];
|
|
143
|
-
const recordKeys = batchParams
|
|
147
|
+
const recordKeys = (batchParams && batchParams.RequestItems && batchParams.RequestItems[this.table] && batchParams.RequestItems[this.table].Keys) || [];
|
|
144
148
|
for (const recordKey of recordKeys) {
|
|
145
149
|
const indexMapKey = this.keyFormatter(recordKey);
|
|
146
150
|
this.batchIndexMap.set(indexMapKey, this.currentSlot++);
|