dynoquery 0.1.13 → 0.1.15
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/index-query.d.ts +3 -0
- package/dist/index-query.js +3 -6
- package/dist/partition.d.ts +5 -2
- package/dist/partition.js +5 -7
- package/package.json +1 -1
package/dist/index-query.d.ts
CHANGED
|
@@ -23,6 +23,9 @@ export declare class IndexQuery {
|
|
|
23
23
|
scanIndexForward?: boolean;
|
|
24
24
|
exclusiveStartKey?: any;
|
|
25
25
|
skValue?: string;
|
|
26
|
+
filterExpression?: string;
|
|
27
|
+
expressionAttributeNames?: Record<string, string>;
|
|
28
|
+
expressionAttributeValues?: Record<string, any>;
|
|
26
29
|
}): Promise<T[]>;
|
|
27
30
|
get<T = any>(skValue?: string): Promise<T | null>;
|
|
28
31
|
getPkValue(): string;
|
package/dist/index-query.js
CHANGED
|
@@ -35,12 +35,8 @@ class IndexQuery {
|
|
|
35
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
36
|
const finalSkValue = (options === null || options === void 0 ? void 0 : options.skValue) || this.skValue;
|
|
37
37
|
let keyCondition = "#pk = :pk";
|
|
38
|
-
const expressionAttributeNames = {
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
const expressionAttributeValues = {
|
|
42
|
-
":pk": this.pkValue,
|
|
43
|
-
};
|
|
38
|
+
const expressionAttributeNames = Object.assign({ "#pk": this.pkName }, options === null || options === void 0 ? void 0 : options.expressionAttributeNames);
|
|
39
|
+
const expressionAttributeValues = Object.assign({ ":pk": this.pkValue }, options === null || options === void 0 ? void 0 : options.expressionAttributeValues);
|
|
44
40
|
if (finalSkValue) {
|
|
45
41
|
keyCondition += " AND begins_with(#sk, :sk)";
|
|
46
42
|
expressionAttributeNames["#sk"] = this.skName;
|
|
@@ -50,6 +46,7 @@ class IndexQuery {
|
|
|
50
46
|
TableName: this.tableName,
|
|
51
47
|
IndexName: this.indexName,
|
|
52
48
|
KeyConditionExpression: keyCondition,
|
|
49
|
+
FilterExpression: options === null || options === void 0 ? void 0 : options.filterExpression,
|
|
53
50
|
ExpressionAttributeNames: expressionAttributeNames,
|
|
54
51
|
ExpressionAttributeValues: expressionAttributeValues,
|
|
55
52
|
Limit: options === null || options === void 0 ? void 0 : options.limit,
|
package/dist/partition.d.ts
CHANGED
|
@@ -22,15 +22,18 @@ export declare class Partition {
|
|
|
22
22
|
getAll<T = any>(options?: {
|
|
23
23
|
limit?: number;
|
|
24
24
|
exclusiveStartKey?: any;
|
|
25
|
+
filterExpression?: string;
|
|
26
|
+
expressionAttributeNames?: Record<string, string>;
|
|
27
|
+
expressionAttributeValues?: Record<string, any>;
|
|
25
28
|
}): Promise<T[]>;
|
|
26
29
|
/**
|
|
27
30
|
* Create an item in this partition.
|
|
28
31
|
*/
|
|
29
|
-
create<T = any>(sk: string, data: T, indices?: IndexQuery[]): Promise<
|
|
32
|
+
create<T = any>(sk: string, data: T, indices?: IndexQuery[]): Promise<T>;
|
|
30
33
|
/**
|
|
31
34
|
* Update an existing item in this partition.
|
|
32
35
|
*/
|
|
33
|
-
update<T = any>(sk: string, data: Partial<T>): Promise<
|
|
36
|
+
update<T = any>(sk: string, data: Partial<T>): Promise<T>;
|
|
34
37
|
/**
|
|
35
38
|
* Delete an item by its SK within this partition.
|
|
36
39
|
*/
|
package/dist/partition.js
CHANGED
|
@@ -60,12 +60,9 @@ class Partition {
|
|
|
60
60
|
const response = yield this.db.query({
|
|
61
61
|
TableName: this.tableName,
|
|
62
62
|
KeyConditionExpression: "#pk = :pk",
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
ExpressionAttributeValues: {
|
|
67
|
-
":pk": this.pkValue,
|
|
68
|
-
},
|
|
63
|
+
FilterExpression: options === null || options === void 0 ? void 0 : options.filterExpression,
|
|
64
|
+
ExpressionAttributeNames: Object.assign({ "#pk": this.pkName }, options === null || options === void 0 ? void 0 : options.expressionAttributeNames),
|
|
65
|
+
ExpressionAttributeValues: Object.assign({ ":pk": this.pkValue }, options === null || options === void 0 ? void 0 : options.expressionAttributeValues),
|
|
69
66
|
Limit: options === null || options === void 0 ? void 0 : options.limit,
|
|
70
67
|
ExclusiveStartKey: options === null || options === void 0 ? void 0 : options.exclusiveStartKey,
|
|
71
68
|
});
|
|
@@ -101,6 +98,7 @@ class Partition {
|
|
|
101
98
|
Item: item,
|
|
102
99
|
});
|
|
103
100
|
this.cache[sk] = item;
|
|
101
|
+
return item;
|
|
104
102
|
});
|
|
105
103
|
}
|
|
106
104
|
/**
|
|
@@ -110,7 +108,7 @@ class Partition {
|
|
|
110
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
109
|
const current = (yield this.get(sk)) || {};
|
|
112
110
|
const updated = Object.assign(Object.assign({}, current), data);
|
|
113
|
-
yield this.create(sk, updated);
|
|
111
|
+
return yield this.create(sk, updated);
|
|
114
112
|
});
|
|
115
113
|
}
|
|
116
114
|
/**
|