dyno-table 1.0.0 → 1.2.0

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.
Files changed (38) hide show
  1. package/README.md +2 -1
  2. package/dist/builders/condition-check-builder.cjs.map +1 -1
  3. package/dist/builders/condition-check-builder.js.map +1 -1
  4. package/dist/builders/delete-builder.cjs.map +1 -1
  5. package/dist/builders/delete-builder.d.cts +1 -1
  6. package/dist/builders/delete-builder.d.ts +1 -1
  7. package/dist/builders/delete-builder.js.map +1 -1
  8. package/dist/builders/paginator.cjs.map +1 -1
  9. package/dist/builders/paginator.js.map +1 -1
  10. package/dist/builders/put-builder.cjs.map +1 -1
  11. package/dist/builders/put-builder.d.cts +1 -1
  12. package/dist/builders/put-builder.d.ts +1 -1
  13. package/dist/builders/put-builder.js.map +1 -1
  14. package/dist/builders/query-builder.cjs.map +1 -1
  15. package/dist/builders/query-builder.js.map +1 -1
  16. package/dist/builders/transaction-builder.cjs +33 -9
  17. package/dist/builders/transaction-builder.cjs.map +1 -1
  18. package/dist/builders/transaction-builder.js +33 -9
  19. package/dist/builders/transaction-builder.js.map +1 -1
  20. package/dist/builders/update-builder.cjs.map +1 -1
  21. package/dist/builders/update-builder.d.cts +1 -1
  22. package/dist/builders/update-builder.d.ts +1 -1
  23. package/dist/builders/update-builder.js.map +1 -1
  24. package/dist/entity.cjs +152 -84
  25. package/dist/entity.cjs.map +1 -1
  26. package/dist/entity.d.cts +1 -1
  27. package/dist/entity.d.ts +1 -1
  28. package/dist/entity.js +152 -84
  29. package/dist/entity.js.map +1 -1
  30. package/dist/{table-BW3cmUqr.d.ts → table-BelHPTvr.d.ts} +1 -1
  31. package/dist/{table-BEhBPy2G.d.cts → table-DIfupG_s.d.cts} +1 -1
  32. package/dist/table.cjs +34 -13
  33. package/dist/table.cjs.map +1 -1
  34. package/dist/table.d.cts +1 -1
  35. package/dist/table.d.ts +1 -1
  36. package/dist/table.js +34 -13
  37. package/dist/table.js.map +1 -1
  38. package/package.json +2 -2
package/dist/table.d.cts CHANGED
@@ -5,7 +5,7 @@ import './builders/put-builder.cjs';
5
5
  import './builders/delete-builder.cjs';
6
6
  import './builders/update-builder.cjs';
7
7
  import './builders/transaction-builder.cjs';
8
- export { T as Table } from './table-BEhBPy2G.cjs';
8
+ export { T as Table } from './table-DIfupG_s.cjs';
9
9
  import './builders/condition-check-builder.cjs';
10
10
  import '@aws-sdk/lib-dynamodb';
11
11
  import './builders/paginator.cjs';
package/dist/table.d.ts CHANGED
@@ -5,7 +5,7 @@ import './builders/put-builder.js';
5
5
  import './builders/delete-builder.js';
6
6
  import './builders/update-builder.js';
7
7
  import './builders/transaction-builder.js';
8
- export { T as Table } from './table-BW3cmUqr.js';
8
+ export { T as Table } from './table-BelHPTvr.js';
9
9
  import './builders/condition-check-builder.js';
10
10
  import '@aws-sdk/lib-dynamodb';
11
11
  import './builders/paginator.js';
package/dist/table.js CHANGED
@@ -1978,13 +1978,21 @@ var TransactionBuilder = class {
1978
1978
  * @see DeleteBuilder for creating delete commands
1979
1979
  */
1980
1980
  deleteWithCommand(command) {
1981
- const keyCondition = this.createKeyForPrimaryIndex(command.key);
1982
- this.checkForDuplicateItem(command.tableName, keyCondition);
1981
+ let keyForDuplicateCheck;
1982
+ let keyForTransaction;
1983
+ if (typeof command.key === "object" && command.key !== null && "pk" in command.key) {
1984
+ keyForTransaction = this.createKeyForPrimaryIndex(command.key);
1985
+ keyForDuplicateCheck = keyForTransaction;
1986
+ } else {
1987
+ keyForTransaction = command.key;
1988
+ keyForDuplicateCheck = command.key;
1989
+ }
1990
+ this.checkForDuplicateItem(command.tableName, keyForDuplicateCheck);
1983
1991
  const transactionItem = {
1984
1992
  type: "Delete",
1985
1993
  params: {
1986
1994
  ...command,
1987
- key: keyCondition
1995
+ key: keyForTransaction
1988
1996
  }
1989
1997
  };
1990
1998
  this.items.push(transactionItem);
@@ -2105,13 +2113,21 @@ var TransactionBuilder = class {
2105
2113
  * @see UpdateBuilder for creating update commands
2106
2114
  */
2107
2115
  updateWithCommand(command) {
2108
- const keyCondition = this.createKeyForPrimaryIndex(command.key);
2109
- this.checkForDuplicateItem(command.tableName, keyCondition);
2116
+ let keyForDuplicateCheck;
2117
+ let keyForTransaction;
2118
+ if (typeof command.key === "object" && command.key !== null && "pk" in command.key) {
2119
+ keyForTransaction = this.createKeyForPrimaryIndex(command.key);
2120
+ keyForDuplicateCheck = keyForTransaction;
2121
+ } else {
2122
+ keyForTransaction = command.key;
2123
+ keyForDuplicateCheck = command.key;
2124
+ }
2125
+ this.checkForDuplicateItem(command.tableName, keyForDuplicateCheck);
2110
2126
  const transactionItem = {
2111
2127
  type: "Update",
2112
2128
  params: {
2113
2129
  ...command,
2114
- key: keyCondition
2130
+ key: keyForTransaction
2115
2131
  }
2116
2132
  };
2117
2133
  this.items.push(transactionItem);
@@ -2219,13 +2235,21 @@ var TransactionBuilder = class {
2219
2235
  * @see ConditionCheckBuilder for creating condition check commands
2220
2236
  */
2221
2237
  conditionCheckWithCommand(command) {
2222
- const keyCondition = this.createKeyForPrimaryIndex(command.key);
2223
- this.checkForDuplicateItem(command.tableName, keyCondition);
2238
+ let keyForDuplicateCheck;
2239
+ let keyForTransaction;
2240
+ if (typeof command.key === "object" && command.key !== null && "pk" in command.key) {
2241
+ keyForTransaction = this.createKeyForPrimaryIndex(command.key);
2242
+ keyForDuplicateCheck = keyForTransaction;
2243
+ } else {
2244
+ keyForTransaction = command.key;
2245
+ keyForDuplicateCheck = command.key;
2246
+ }
2247
+ this.checkForDuplicateItem(command.tableName, keyForDuplicateCheck);
2224
2248
  const transactionItem = {
2225
2249
  type: "ConditionCheck",
2226
2250
  params: {
2227
2251
  ...command,
2228
- key: keyCondition
2252
+ key: keyForTransaction
2229
2253
  }
2230
2254
  };
2231
2255
  this.items.push(transactionItem);
@@ -2686,10 +2710,7 @@ var GetBuilder = class {
2686
2710
  */
2687
2711
  async execute() {
2688
2712
  const expressionParams = {
2689
- expressionAttributeNames: {},
2690
- expressionAttributeValues: {},
2691
- valueCounter: { count: 0 }
2692
- };
2713
+ expressionAttributeNames: {}};
2693
2714
  const projectionExpression = Array.from(this.selectedFields).map((p) => generateAttributeName(expressionParams, p)).join(", ");
2694
2715
  const { expressionAttributeNames } = expressionParams;
2695
2716
  return this.executor({