hexlabsio/dynamo-ts

Access to partition and sort keys

obazoud opened this issue · 2 comments

In the single design table, backfill my object with the value of partition and sort keys computed by dynamo-ts after a put or a batchPut.

Could you provide an example of what you would like to see please?

Hello,
Thanks for this commit to access partition and sort values.
However, since this commit, the tests are failed.

FAIL  test/table-builder/single-table-builder.spec.ts
  Single Table Design
    ✕ should return generated keys for single table put (1 ms)
    ✕ should query child joined to child
    ✕ should query child joined to child two levels
    ✕ should query children for parent

  ● Single Table Design › should return generated keys for single table put

    ValidationException: One of the required keys was not given a value

       95 |       console.log(`GetItemInput: ${JSON.stringify(this.input, null, 2)}`);
       96 |     }
    >  97 |     let result = await this.client.batchWrite(this.input);
          |                  ^
       98 |     let retry = 0;
       99 |     let returnType = {
      100 |       unprocessedItems: result.UnprocessedItems,

      at throwDefaultError (node_modules/.pnpm/@smithy+smithy-client@2.5.1/node_modules/@smithy/smithy-client/dist-cjs/index.js:838:20)
      at node_modules/.pnpm/@smithy+smithy-client@2.5.1/node_modules/@smithy/smithy-client/dist-cjs/index.js:847:5
      at de_CommandError (node_modules/.pnpm/@aws-sdk+client-dynamodb@3.556.0/node_modules/@aws-sdk/client-dynamodb/dist-cjs/index.js:2231:14)
      at node_modules/.pnpm/@smithy+middleware-serde@2.3.0/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
      at node_modules/@aws-sdk/lib-dynamodb/dist-cjs/baseCommand/DynamoDBDocumentClientCommand.js:26:34
      at node_modules/.pnpm/@smithy+core@1.4.2/node_modules/@smithy/core/dist-cjs/index.js:165:18
      at node_modules/.pnpm/@smithy+middleware-retry@2.3.1/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
      at node_modules/.pnpm/@aws-sdk+middleware-logger@3.535.0/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
      at BatchWriteClient.execute (src/dynamo-batch-writer.ts:97:18)
      at Object.<anonymous> (test/table-builder/single-table-builder.spec.ts:62:5)

If in test code, I change "p2" to "partition", and "s2" to "sort" in

  • test/table-builder/single-table-builder.spec.ts
  • test/tables.ts

the tests back to OK.