@factorearth/recordmiddleware-dataaccesslayer 0.0.1-y.8 → 0.0.1-y.9
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/getItem.d.ts +1 -1
- package/dist/getItem.js +4 -4
- package/lib/getItem.ts +4 -4
- package/package.json +2 -2
package/dist/getItem.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const getItem: (id: string, tableName: string) => Promise<Record<string, any> | null | undefined>;
|
|
2
|
-
export declare const getItemsByIndex: (indexName: string, tableName: string,
|
|
2
|
+
export declare const getItemsByIndex: (indexName: string, tableName: string, attributeValue: string, attribute: string) => Promise<Record<string, any>[]>;
|
package/dist/getItem.js
CHANGED
|
@@ -16,16 +16,16 @@ export const getItem = async (id, tableName) => {
|
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
export const getItemsByIndex = async (indexName, tableName,
|
|
19
|
+
export const getItemsByIndex = async (indexName, tableName, attributeValue, attribute) => {
|
|
20
20
|
const params = {
|
|
21
21
|
TableName: tableName,
|
|
22
22
|
IndexName: indexName,
|
|
23
|
-
KeyConditionExpression: `#fk =
|
|
23
|
+
KeyConditionExpression: `#fk = :fkval`,
|
|
24
24
|
ExpressionAttributeNames: {
|
|
25
|
-
"#fk": `${
|
|
25
|
+
"#fk": `${attribute}`
|
|
26
26
|
},
|
|
27
27
|
ExpressionAttributeValues: {
|
|
28
|
-
":fkval":
|
|
28
|
+
":fkval": attributeValue
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
try {
|
package/lib/getItem.ts
CHANGED
|
@@ -17,17 +17,17 @@ export const getItem = async (id: string, tableName: string) => {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export const getItemsByIndex = async (indexName: string, tableName: string,
|
|
20
|
+
export const getItemsByIndex = async (indexName: string, tableName: string, attributeValue:string, attribute: string) => {
|
|
21
21
|
|
|
22
22
|
const params: QueryCommandInput = {
|
|
23
23
|
TableName: tableName,
|
|
24
24
|
IndexName: indexName,
|
|
25
|
-
KeyConditionExpression: `#fk =
|
|
25
|
+
KeyConditionExpression: `#fk = :fkval`,
|
|
26
26
|
ExpressionAttributeNames: {
|
|
27
|
-
"#fk" : `${
|
|
27
|
+
"#fk" : `${attribute}`
|
|
28
28
|
},
|
|
29
29
|
ExpressionAttributeValues: {
|
|
30
|
-
":fkval":
|
|
30
|
+
":fkval": attributeValue
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factorearth/recordmiddleware-dataaccesslayer",
|
|
3
|
-
"version": "0.0.1-y.
|
|
3
|
+
"version": "0.0.1-y.9",
|
|
4
4
|
"description": "A module for accessing dynamdb efficiently",
|
|
5
5
|
"author": "madtrx <marlin.makori@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/FactorEarth/RecordMiddleware#readme",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"access": "public",
|
|
30
30
|
"registry": "https://registry.npmjs.org/"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "5072833d64b021125ba46394928ca84ddae91093"
|
|
33
33
|
}
|