@eresearchqut/ddb-repository 1.4.1 → 1.5.3

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.
@@ -18,25 +18,15 @@ jobs:
18
18
  uses: actions/checkout@v4
19
19
  with:
20
20
  fetch-depth: 0
21
- persist-credentials: false
22
-
23
21
  - name: Setup Node.js
24
22
  uses: actions/setup-node@v4
25
23
  with:
26
24
  node-version: 'lts/*'
27
-
28
25
  - name: Install dependencies
29
- run: npm ci
30
-
31
- - name: Run tests
32
- run: npm test
33
-
34
- - name: Build
35
- run: npm run build
36
-
26
+ run: npm clean-install
27
+ - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
28
+ run: npm audit signatures
37
29
  - name: Release
38
30
  env:
39
31
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42
32
  run: npx semantic-release
package/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ ## [1.5.3](https://github.com/eresearchqut/ddb-repository/compare/v1.5.2...v1.5.3) (2025-12-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * adding repository to package.json ([94961d2](https://github.com/eresearchqut/ddb-repository/commit/94961d22bd371742b4ed4309cfe118e95ea09958))
7
+
8
+ ## [1.5.2](https://github.com/eresearchqut/ddb-repository/compare/v1.5.1...v1.5.2) (2025-12-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * release to npm ([274ef77](https://github.com/eresearchqut/ddb-repository/commit/274ef77b079d644571066e5c05a9edf3e4cf7396))
14
+
15
+ ## [1.5.1](https://github.com/eresearchqut/ddb-repository/compare/v1.5.0...v1.5.1) (2025-12-10)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Module type ([52a2a07](https://github.com/eresearchqut/ddb-repository/commit/52a2a07295bafcfa8b621fd59d085d7dfd567402))
21
+ * package updates ([79d5672](https://github.com/eresearchqut/ddb-repository/commit/79d56725628a6ea0216b86a5c2d8f158fc008de6))
22
+ * Updated installation instructions ([282e1fd](https://github.com/eresearchqut/ddb-repository/commit/282e1fd0d6ffe24a3caefa5e2c1e7067a348a3ce))
23
+
24
+ # [1.5.0](https://github.com/eresearchqut/ddb-repository/compare/v1.4.1...v1.5.0) (2025-11-21)
25
+
26
+
27
+ ### Features
28
+
29
+ * Initialise the repository using options ([e3a2f46](https://github.com/eresearchqut/ddb-repository/commit/e3a2f46d3a8fb0ca467409369eef505d0451b6b0))
30
+
1
31
  ## [1.4.1](https://github.com/eresearchqut/ddb-repository/compare/v1.4.0...v1.4.1) (2025-11-21)
2
32
 
3
33
 
package/README.md CHANGED
@@ -17,7 +17,7 @@ A TypeScript library providing a generic repository pattern implementation for A
17
17
 
18
18
  ## Installation
19
19
  ```sh
20
- npm install ddb-repository
20
+ npm install @eresearchqut/ddb-repository
21
21
  ```
22
22
  ## Prerequisites
23
23
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@eresearchqut/ddb-repository",
3
- "version": "1.4.1",
3
+ "version": "1.5.3",
4
4
  "description": "",
5
- "type": "module",
5
+ "type": "commonjs",
6
6
  "main": "dist/index.js",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -16,31 +16,35 @@
16
16
  "lint:fix": "eslint . --ext .ts --fix"
17
17
  },
18
18
  "devDependencies": {
19
- "@aws-sdk/client-dynamodb": "^3.700.0",
20
- "@aws-sdk/util-dynamodb": "^3.700.0",
19
+ "@aws-sdk/client-dynamodb": "^3.948.0",
20
+ "@aws-sdk/util-dynamodb": "^3.948.0",
21
21
  "@eslint/js": "^9.39.1",
22
22
  "@semantic-release/changelog": "^6.0.3",
23
23
  "@semantic-release/git": "^10.0.1",
24
24
  "@semantic-release/github": "^12.0.2",
25
25
  "@semantic-release/npm": "^13.1.2",
26
26
  "@smithy/types": "^4.9.0",
27
- "@testcontainers/localstack": "^10.15.0",
28
- "@types/jest": "^29.5.0",
29
- "@types/lodash": "^4.17.20",
30
- "@types/node": "^24.10.1",
27
+ "@testcontainers/localstack": "^11.10.0",
28
+ "@types/jest": "^30.0.0",
29
+ "@types/lodash": "^4.17.21",
30
+ "@types/node": "^25.0.0",
31
31
  "eslint": "^9.39.1",
32
- "eslint-plugin-jest": "^29.1.0",
33
- "jest": "^29.7.0",
32
+ "eslint-plugin-jest": "^29.2.1",
33
+ "jest": "^30.2.0",
34
34
  "semantic-release": "^25.0.2",
35
- "testcontainers": "^10.15.0",
36
- "ts-jest": "^29.2.0",
35
+ "testcontainers": "^11.10.0",
36
+ "ts-jest": "^29.4.6",
37
37
  "ts-node": "^10.9.2",
38
- "typescript": "^5.5.3",
39
- "typescript-eslint": "^8.47.0"
38
+ "typescript": "^5.9.3",
39
+ "typescript-eslint": "^8.49.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@aws-sdk/client-dynamodb": ">= 3.49.0",
43
43
  "@aws-sdk/util-dynamodb": ">= 3.49.0",
44
44
  "lodash": "^4.17.20"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/eresearchqut/ddb-repository.git"
45
49
  }
46
50
  }
@@ -118,16 +118,27 @@ const paginate = <T>(array: Array<T>, pageSize: number) => {
118
118
  }, [] as Array<Array<T>>);
119
119
  }
120
120
 
121
- export class DynamoDbRepository<K, T> {
121
+ export interface DynamoDbRepositoryOptions {
122
+ client: DynamoDBClient;
123
+ tableName: string;
124
+ hashKey: string;
125
+ rangeKey?: string;
126
+ returnConsumedCapacity?: ReturnConsumedCapacity;
127
+ }
122
128
 
123
- constructor(
124
- private readonly dynamoDBClient: DynamoDBClient,
125
- private readonly tableName: string,
126
- private readonly hashKey: string,
127
- private readonly rangKey?: string,
128
- private readonly returnConsumedCapacity: ReturnConsumedCapacity | undefined = ReturnConsumedCapacity.TOTAL,
129
- ) {
129
+ export class DynamoDbRepository<K, T> {
130
+ private readonly dynamoDBClient: DynamoDBClient;
131
+ private readonly tableName: string;
132
+ private readonly hashKey: string;
133
+ private readonly rangKey?: string;
134
+ private readonly returnConsumedCapacity: ReturnConsumedCapacity | undefined;
130
135
 
136
+ constructor(options: DynamoDbRepositoryOptions) {
137
+ this.dynamoDBClient = options.client;
138
+ this.tableName = options.tableName;
139
+ this.hashKey = options.hashKey;
140
+ this.rangKey = options.rangeKey;
141
+ this.returnConsumedCapacity = options.returnConsumedCapacity ?? ReturnConsumedCapacity.TOTAL;
131
142
  }
132
143
 
133
144
  getItem = async (key: K): Promise<T | undefined> => {
@@ -120,9 +120,23 @@ describe('DynamoDbRepository Integration Tests', () => {
120
120
  }
121
121
 
122
122
  // Initialize repositories
123
- repository = new DynamoDbRepository(dynamoDBClient, tableName, "id");
124
- compositeRepository = new DynamoDbRepository(dynamoDBClient, compositeTableName, "userId", "itemId");
125
- gsiRepository = new DynamoDbRepository(dynamoDBClient, gsiTableName, "userId", "itemId");
123
+ repository = new DynamoDbRepository({
124
+ client: dynamoDBClient,
125
+ tableName: tableName,
126
+ hashKey: "id"
127
+ });
128
+ compositeRepository = new DynamoDbRepository({
129
+ client: dynamoDBClient,
130
+ tableName: compositeTableName,
131
+ hashKey: "userId",
132
+ rangeKey: "itemId"
133
+ });
134
+ gsiRepository = new DynamoDbRepository({
135
+ client: dynamoDBClient,
136
+ tableName: gsiTableName,
137
+ hashKey: "userId",
138
+ rangeKey: "itemId"
139
+ });
126
140
  });
127
141
 
128
142
  beforeEach(async () => {
@@ -1,243 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
- var __asyncValues = (this && this.__asyncValues) || function (o) {
23
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
24
- var m = o[Symbol.asyncIterator], i;
25
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
26
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
27
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.DynamoDbRepository = exports.FilterOperator = void 0;
31
- const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
32
- const util_dynamodb_1 = require("@aws-sdk/util-dynamodb");
33
- const lodash_1 = require("lodash");
34
- var FilterOperator;
35
- (function (FilterOperator) {
36
- FilterOperator["EQUALS"] = "=";
37
- FilterOperator["NOT_EQUALS"] = "<>";
38
- FilterOperator["GREATER_THAN_OR_EQUALS"] = ">=";
39
- FilterOperator["GREATER_THAN"] = ">";
40
- FilterOperator["LESS_THAN"] = "<";
41
- FilterOperator["LESS_THAN_OR_EQUALS"] = "<=";
42
- FilterOperator["IN"] = "IN";
43
- FilterOperator["BETWEEN"] = "BETWEEN";
44
- })(FilterOperator || (exports.FilterOperator = FilterOperator = {}));
45
- const expressionAttributeKey = (key) => (0, lodash_1.replace)(key, /-/g, "_");
46
- const mapInKeys = (filterExpression) => Array.isArray(filterExpression.value)
47
- ? filterExpression.value.map((_, index) => `:${filterExpression.attribute}${index}`)
48
- : `:${filterExpression.attribute}`;
49
- const mapFilterExpression = (filterExpression) => {
50
- switch (filterExpression.operator) {
51
- case FilterOperator.IN:
52
- return (`#${expressionAttributeKey(filterExpression.attribute)} ${filterExpression.operator} ` +
53
- `(${mapInKeys(filterExpression)})`);
54
- case FilterOperator.BETWEEN:
55
- return (`#${expressionAttributeKey(filterExpression.attribute)} ${filterExpression.operator} ` +
56
- `:${expressionAttributeKey(filterExpression.attribute)}0 AND :${expressionAttributeKey(filterExpression.attribute)}1`);
57
- default:
58
- return (`#${expressionAttributeKey(filterExpression.attribute)} ${filterExpression.operator} ` +
59
- `:${expressionAttributeKey(filterExpression.attribute)}`);
60
- }
61
- };
62
- const mapFilterExpressions = (filterExpressions) => filterExpressions
63
- .map((filterExpression) => filterExpression.negate
64
- ? `NOT ${mapFilterExpression(filterExpression)}`
65
- : mapFilterExpression(filterExpression))
66
- .join(" AND ");
67
- const mapFilterExpressionValues = (filterExpression) => Array.isArray(filterExpression.value)
68
- ? filterExpression.value.reduce((reduction, value, index) => (Object.assign(Object.assign({}, reduction), { [`:${expressionAttributeKey(filterExpression.attribute)}${index}`]: value })), Object.assign({}))
69
- : {
70
- [`:${expressionAttributeKey(filterExpression.attribute)}`]: filterExpression.value,
71
- };
72
- const paginate = (array, pageSize) => {
73
- return array.reduce((acc, val, i) => {
74
- const idx = Math.floor(i / pageSize);
75
- const page = acc[idx] || (acc[idx] = []);
76
- page.push(val);
77
- return acc;
78
- }, []);
79
- };
80
- class DynamoDbRepository {
81
- constructor(dynamoDBClient, tableName, hashKey, rangKey, returnConsumedCapacity = client_dynamodb_1.ReturnConsumedCapacity.TOTAL) {
82
- this.dynamoDBClient = dynamoDBClient;
83
- this.tableName = tableName;
84
- this.hashKey = hashKey;
85
- this.rangKey = rangKey;
86
- this.returnConsumedCapacity = returnConsumedCapacity;
87
- this.getItem = (key) => __awaiter(this, void 0, void 0, function* () {
88
- return this.dynamoDBClient
89
- .send(new client_dynamodb_1.GetItemCommand({
90
- TableName: this.tableName,
91
- Key: (0, util_dynamodb_1.marshall)(key, { removeUndefinedValues: true }),
92
- ReturnConsumedCapacity: this.returnConsumedCapacity,
93
- }))
94
- .then((result) => result.Item ? (0, util_dynamodb_1.unmarshall)(result.Item) : undefined);
95
- });
96
- this.putItem = (key, record) => __awaiter(this, void 0, void 0, function* () {
97
- const Item = (0, util_dynamodb_1.marshall)(Object.assign(Object.assign({}, record), key), { removeUndefinedValues: true });
98
- return this.dynamoDBClient
99
- .send(new client_dynamodb_1.PutItemCommand({
100
- TableName: this.tableName,
101
- ReturnConsumedCapacity: this.returnConsumedCapacity,
102
- Item,
103
- }))
104
- .then(() => this.getItem(key));
105
- });
106
- this.deleteItem = (key) => __awaiter(this, void 0, void 0, function* () {
107
- return this.dynamoDBClient.send(new client_dynamodb_1.DeleteItemCommand({
108
- TableName: this.tableName,
109
- Key: (0, util_dynamodb_1.marshall)(key),
110
- })).then((result) => result.Attributes ?
111
- (0, util_dynamodb_1.unmarshall)(result.Attributes) : undefined);
112
- });
113
- this.updateItem = (key, updates, remove) => __awaiter(this, void 0, void 0, function* () {
114
- const hasUpdates = Object.keys(updates).length > 0;
115
- const setAttributesExpression = hasUpdates ? `SET ${Object.entries(updates)
116
- .filter(([, value]) => value !== undefined)
117
- .map(([key]) => `#${expressionAttributeKey(key)} = :${expressionAttributeKey(key)}`)
118
- .join(", ")}` : '';
119
- const removeAttributesExpression = remove
120
- ? ` REMOVE ${remove.map((key) => `#${expressionAttributeKey(key)}`).join(", ")}`
121
- : "";
122
- const removeAttributeNames = remove
123
- ? remove.map(expressionAttributeKey).reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [`#${expressionAttributeKey(key)}`]: key })), {})
124
- : {};
125
- const updateItemCommandInput = {
126
- TableName: this.tableName,
127
- Key: (0, util_dynamodb_1.marshall)(key),
128
- UpdateExpression: `${setAttributesExpression}${removeAttributesExpression}`,
129
- ExpressionAttributeNames: Object.entries(updates)
130
- .filter(([, value]) => value !== undefined)
131
- .reduce((acc, [key]) => (Object.assign(Object.assign({}, acc), { [`#${expressionAttributeKey(key)}`]: key })), Object.assign(removeAttributeNames)),
132
- ExpressionAttributeValues: hasUpdates ? (0, util_dynamodb_1.marshall)(Object.entries(updates).reduce((acc, [key, value]) => (Object.assign(Object.assign({}, acc), { [`:${expressionAttributeKey(key)}`]: value })), Object.assign({})), { removeUndefinedValues: true }) : undefined,
133
- ReturnConsumedCapacity: this.returnConsumedCapacity,
134
- };
135
- return this.dynamoDBClient
136
- .send(new client_dynamodb_1.UpdateItemCommand(updateItemCommandInput))
137
- .then(() => this.getItem(key));
138
- });
139
- this.getItems = (query) => __awaiter(this, void 0, void 0, function* () {
140
- var _a, e_1, _b, _c, _d, e_2, _e, _f;
141
- var _g;
142
- const { index, filterExpressions, projectedAttributes } = query, keys = __rest(query, ["index", "filterExpressions", "projectedAttributes"]);
143
- const KeyConditionExpression = Object.keys(keys)
144
- .map((key) => `#${expressionAttributeKey(key)} = :${expressionAttributeKey(key)}`).join(' AND ');
145
- const keyExpressionAttributeNames = Object.keys(keys)
146
- .reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [`#${expressionAttributeKey(key)}`]: key })), Object.assign({}));
147
- const keyExpressionAttributeValues = Object.entries(keys)
148
- .reduce((acc, [key, value]) => (Object.assign(Object.assign({}, acc), { [`:${expressionAttributeKey(key)}`]: value })), Object.assign({}));
149
- const ProjectionExpression = !index && projectedAttributes
150
- ? projectedAttributes.map((attribute) => `#${expressionAttributeKey(attribute)}`).join(',')
151
- : undefined;
152
- const projectionAttributeNames = !index && projectedAttributes ? projectedAttributes.reduce((reduction, attribute) => (Object.assign(Object.assign({}, reduction), { [`#${expressionAttributeKey(attribute)}`]: attribute })), Object.assign({})) : {};
153
- const hasFilterExpressions = Array.isArray(filterExpressions) && filterExpressions.length > 0;
154
- const FilterExpression = hasFilterExpressions
155
- ? mapFilterExpressions(filterExpressions)
156
- : undefined;
157
- const filterAttributeNames = hasFilterExpressions
158
- ? filterExpressions.reduce((reduction, filterExpression) => (Object.assign(Object.assign({}, reduction), { [`#${expressionAttributeKey(filterExpression.attribute)}`]: filterExpression.attribute })), Object.assign({}))
159
- : {};
160
- const filterAttributeValues = filterExpressions
161
- ? filterExpressions.reduce((reduction, filterExpression) => (Object.assign(Object.assign({}, reduction), mapFilterExpressionValues(filterExpression))), Object.assign({}))
162
- : {};
163
- const queryCommandInput = {
164
- TableName: this.tableName,
165
- ReturnConsumedCapacity: this.returnConsumedCapacity,
166
- IndexName: index,
167
- KeyConditionExpression,
168
- FilterExpression,
169
- ProjectionExpression,
170
- ExpressionAttributeNames: Object.assign(Object.assign(Object.assign({}, keyExpressionAttributeNames), filterAttributeNames), projectionAttributeNames),
171
- ExpressionAttributeValues: (0, util_dynamodb_1.marshall)(Object.assign(Object.assign({}, keyExpressionAttributeValues), filterAttributeValues), { removeUndefinedValues: true }),
172
- };
173
- const paginator = (0, client_dynamodb_1.paginateQuery)({ client: this.dynamoDBClient, pageSize: 100 }, queryCommandInput);
174
- if (index) {
175
- const keys = [];
176
- try {
177
- for (var _h = true, paginator_1 = __asyncValues(paginator), paginator_1_1; paginator_1_1 = yield paginator_1.next(), _a = paginator_1_1.done, !_a; _h = true) {
178
- _c = paginator_1_1.value;
179
- _h = false;
180
- const page = _c;
181
- if (page.Items) {
182
- keys.push(...(page.Items.map((item) => (0, util_dynamodb_1.unmarshall)(item))
183
- .map((item) => (0, lodash_1.pickBy)(item, (_, key) => (key === this.hashKey || key === this.rangKey)))));
184
- }
185
- }
186
- }
187
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
188
- finally {
189
- try {
190
- if (!_h && !_a && (_b = paginator_1.return)) yield _b.call(paginator_1);
191
- }
192
- finally { if (e_1) throw e_1.error; }
193
- }
194
- const items = yield this.batchGetItems(keys, query);
195
- return items;
196
- }
197
- const items = [];
198
- try {
199
- for (var _j = true, paginator_2 = __asyncValues(paginator), paginator_2_1; paginator_2_1 = yield paginator_2.next(), _d = paginator_2_1.done, !_d; _j = true) {
200
- _f = paginator_2_1.value;
201
- _j = false;
202
- const page = _f;
203
- if (page.Items) {
204
- items.push(...(((_g = page.Items) === null || _g === void 0 ? void 0 : _g.map((item) => (0, util_dynamodb_1.unmarshall)(item))) || []));
205
- }
206
- }
207
- }
208
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
209
- finally {
210
- try {
211
- if (!_j && !_d && (_e = paginator_2.return)) yield _e.call(paginator_2);
212
- }
213
- finally { if (e_2) throw e_2.error; }
214
- }
215
- return items;
216
- });
217
- this.batchGetItems = (keys, projectedQuery) => __awaiter(this, void 0, void 0, function* () {
218
- const uniqueKeys = (0, lodash_1.uniqWith)(keys, lodash_1.isEqual);
219
- const keyPages = paginate(uniqueKeys, 100);
220
- const { projectedAttributes } = projectedQuery || {};
221
- const ProjectionExpression = projectedAttributes
222
- ? projectedAttributes.map((attribute) => `#${expressionAttributeKey(attribute)}`).join(',')
223
- : undefined;
224
- const ExpressionAttributeNames = projectedAttributes ?
225
- projectedAttributes.reduce((reduction, attribute) => (Object.assign(Object.assign({}, reduction), { [`#${expressionAttributeKey(attribute)}`]: attribute })), Object.assign({})) : undefined;
226
- return Promise.all((keyPages.map((keyPage) => __awaiter(this, void 0, void 0, function* () {
227
- const batchRequest = {
228
- RequestItems: {
229
- [this.tableName]: {
230
- Keys: keyPage.map((key) => ((0, util_dynamodb_1.marshall)(key))),
231
- ProjectionExpression,
232
- ExpressionAttributeNames,
233
- }
234
- },
235
- ReturnConsumedCapacity: this.returnConsumedCapacity,
236
- };
237
- return this.dynamoDBClient.send(new client_dynamodb_1.BatchGetItemCommand(batchRequest)).then(result => { var _a; return (_a = result.Responses) === null || _a === void 0 ? void 0 : _a[this.tableName].map((item) => (0, util_dynamodb_1.unmarshall)(item)); });
238
- }))))
239
- .then((itemSets) => itemSets.flat());
240
- });
241
- }
242
- }
243
- exports.DynamoDbRepository = DynamoDbRepository;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.consumedCapacityMiddleware = void 0;
13
- const lodash_1 = require("lodash");
14
- /* eslint-disable @typescript-eslint/no-explicit-any */
15
- /* eslint-disable @typescript-eslint/no-unused-vars */
16
- const consumedCapacityMiddleware = (consumedCapacityMiddlewareConfig) => (next, context) => (args) => __awaiter(void 0, void 0, void 0, function* () {
17
- const { input } = args;
18
- const { ReturnConsumedCapacity } = input;
19
- const response = yield next(args);
20
- const { output } = response;
21
- const consumedCapacity = (0, lodash_1.get)(output, "ConsumedCapacity");
22
- yield consumedCapacityMiddlewareConfig.onConsumedCapacity({ ReturnConsumedCapacity, ConsumedCapacity: consumedCapacity });
23
- return response;
24
- });
25
- exports.consumedCapacityMiddleware = consumedCapacityMiddleware;
package/dist/index.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.consumedCapacityMiddleware = exports.DynamoDbRepository = exports.FilterOperator = void 0;
4
- var DynamoDbRepository_1 = require("./DynamoDbRepository");
5
- Object.defineProperty(exports, "FilterOperator", { enumerable: true, get: function () { return DynamoDbRepository_1.FilterOperator; } });
6
- Object.defineProperty(exports, "DynamoDbRepository", { enumerable: true, get: function () { return DynamoDbRepository_1.DynamoDbRepository; } });
7
- var consumed_capacity_middleware_1 = require("./consumed-capacity-middleware");
8
- Object.defineProperty(exports, "consumedCapacityMiddleware", { enumerable: true, get: function () { return consumed_capacity_middleware_1.consumedCapacityMiddleware; } });