Skip to content

Commit cd61167

Browse files
Merge changes from v3.0.0-next.2 into main (#218)
2 parents 605602a + 0a85e44 commit cd61167

126 files changed

Lines changed: 4463 additions & 3861 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,22 @@
1717
// vscode-icons
1818
"vsicons.associations.files": [
1919
// https://github.com/vscode-icons/vscode-icons/blob/master/src/iconsManifest/supportedExtensions.ts
20+
{
21+
"icon": "tsconfig",
22+
"extensions": [],
23+
"filenamesGlob": ["tsconfig", "tsconfig.build-cjs", "tsconfig.build-esm"],
24+
"extensionsGlob": ["json"],
25+
"filename": true,
26+
"format": "svg"
27+
},
2028
{
2129
"icon": "vitest",
22-
/* The below configs get the vitest icon applied to the setup-file, but this does
23-
not conform to documented usage, and frankly I don't know why it works. */
24-
"extensions": ["vitest.setup.ts"],
25-
"filename": ["vitest.setup.ts"]
30+
"filenamesGlob": ["vitest.config", "vitest.setup"],
31+
"extensions": [],
32+
"extensionsGlob": ["ts"],
33+
"filename": true,
34+
"languages": ["vitestsnapshot"],
35+
"format": "svg"
2636
}
2737
]
2838
}

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,48 @@ All notable changes to this project will be documented in this file.
44

55
---
66

7+
# [3.0.0-next.2](https://github.com/Nerdware-LLC/ddb-single-table/compare/v3.0.0-next.1...v3.0.0-next.2) (2025-07-01)
8+
9+
# [3.0.0-next.1](https://github.com/Nerdware-LLC/ddb-single-table/compare/v2.13.0...v3.0.0-next.1) (2025-07-01)
10+
11+
12+
### Bug Fixes
13+
14+
* add `ReadonlyArray` type for ITFS compat ([84f70df](https://github.com/Nerdware-LLC/ddb-single-table/commit/84f70dfff8e3e671442b1820addc2437356070f7))
15+
* add checks for `Date` objects in `recurse` fn, update types ([7b24cd4](https://github.com/Nerdware-LLC/ddb-single-table/commit/7b24cd43c5488c51ebc5240520b87390ec9bec6b))
16+
* replace `NativeAttributeValue` w `SupportedAttributeValueType` for Dates ([4a0dd06](https://github.com/Nerdware-LLC/ddb-single-table/commit/4a0dd06243f40a9be85eb97e719736e4e7ca9b8d))
17+
* replace inline `string | number` w `AttrValue` generic for correct typing ([e9adeaa](https://github.com/Nerdware-LLC/ddb-single-table/commit/e9adeaa06c12490f3373dbd6edb7fe9028632f3d))
18+
* update named import for 'EnsureTableIsActiveParameters' ([bae628a](https://github.com/Nerdware-LLC/ddb-single-table/commit/bae628a09ea0512341126e29755a462399bca44c))
19+
20+
21+
### Code Refactoring
22+
23+
* mv Date-conversion from Model IO-Action to `DdbClientFieldParser` ([d2a574c](https://github.com/Nerdware-LLC/ddb-single-table/commit/d2a574cc76ba576b159927e6f8dfd8dfe100a7a6))
24+
* update Model methods to use new `DdbClientWrapper` return values ([e8a7bb5](https://github.com/Nerdware-LLC/ddb-single-table/commit/e8a7bb5064699be6571d5ea948f96d4914a17dd3))
25+
26+
27+
### Features
28+
29+
* add `getRecursiveValueConverter` ([38cc316](https://github.com/Nerdware-LLC/ddb-single-table/commit/38cc316487f82f7720fc2bcf41853c065c13cb5a))
30+
* add `isValidDatetimeString` ([33c97b3](https://github.com/Nerdware-LLC/ddb-single-table/commit/33c97b3abfddcaf301b333f51397fd9b6f67d2c0))
31+
* add `UnknownItem` type, update `BaseItem` to use `SupportedAttributeValueType` ([ffec182](https://github.com/Nerdware-LLC/ddb-single-table/commit/ffec1826576aefb5bb0faa1941d0ac9b5a678209))
32+
* add DdbClientArgParser for improved command argument handling and response parsing ([bdba380](https://github.com/Nerdware-LLC/ddb-single-table/commit/bdba380165321163295d6ae6d37b6e7f9a658dab))
33+
* add export of `Model/types/*` ([8e6b95f](https://github.com/Nerdware-LLC/ddb-single-table/commit/8e6b95f63067a4e121f73baff982c70567174637))
34+
* add FixPartialUndefined and OverrideSharedProperties types ([6a10d78](https://github.com/Nerdware-LLC/ddb-single-table/commit/6a10d78684cc9c189b0253a6b23dad2343b37042))
35+
* add type `AttributeFunctionDefault` ([77dd84e](https://github.com/Nerdware-LLC/ddb-single-table/commit/77dd84ea2a7dde3ad6fddd81e5f4eae34bfe1931))
36+
* rm export of NestDepth internal util types ([4fd364e](https://github.com/Nerdware-LLC/ddb-single-table/commit/4fd364e13d46f4d30784c6e4ad5dcc4994ece442))
37+
38+
39+
### Reverts
40+
41+
* switch `transformItem` and `validateItem` param types back to `any` ([00b2525](https://github.com/Nerdware-LLC/ddb-single-table/commit/00b25253150b24132e57f4b515b39f46e298ad21))
42+
43+
44+
### BREAKING CHANGES
45+
46+
* `schemaWithKeysOnly` has been rm'd, and batch methods filter unproc'd reqs.
47+
* Date-conversion has been moved from `Model` to `DdbClientFieldParser`.
48+
749
# [2.13.0](https://github.com/Nerdware-LLC/ddb-single-table/compare/v2.12.1...v2.13.0) (2025-06-15)
850

951

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,10 @@ Marshalling ✅ Validation ✅ Where-style query API ✅ and more. <br>
303303

304304
## 🧙‍♂️ Data IO Order of Operations
305305

306-
When any Model method is invoked, it begins a request-response cycle in which DDB-ST applies a series of transformations and validations to ensure that the data conforms to the schema defined for the Model. DDB-ST collectively refers to these transformations and validations as _"**IO-Actions**"_, and they are categorized into two groups: `toDB` and `fromDB`. The `toDB` actions are applied to Model-method arguments before they're passed off to the underlying AWS SDK, while the `fromDB` actions are applied to all values returned from the AWS SDK before they're returned to the caller.
306+
When any Model method is invoked, it begins a request-response cycle in which DDB-ST applies a series of transformations and validations to ensure that the data conforms to the schema defined for the Model. DDB-ST collectively refers to these transformations and validations as _"**IO-Actions**"_, and they are categorized into two groups — `toDB` and `fromDB`:
307+
308+
- `toDB` actions are applied to Model-method arguments before they're passed off to the underlying AWS SDK.
309+
- `fromDB` actions are applied to all values returned from the AWS SDK before they're returned to the caller.
307310

308311
The `toDB` and `fromDB` flows both have a specific order in which **IO-Actions** are applied.
309312

@@ -321,17 +324,15 @@ The `toDB` and `fromDB` flows both have a specific order in which **IO-Actions**
321324
| 5 | [**`Type Checking`**](#type) | Checks properties for conformance with their `"type"`. | |
322325
| 6 | [**`Attribute Validation`**](#validate) | Validates individual item properties. | |
323326
| 7 | [**`Item Validation`**](#validateitem) | Validates an item in its entirety. | `updateItem` |
324-
| 8 | [**`Convert JS Types`**](#type) | Converts JS types into DynamoDB types. | |
325-
| 9 | [**`"Required" Checks`**](#required) | Checks for `"required"` and `"nullable"` attributes. | `updateItem` |
327+
| 8 | [**`"Required" Checks`**](#required) | Checks for `"required"` and `"nullable"` attributes. | `updateItem` |
326328

327329
### `fromDB`
328330

329331
| Order | IO-Action | Description |
330332
| :---: | :-------------------------------------------------- | :------------------------------------------------- |
331-
| 1 | [**`Convert JS Types`**](#type) | Converts DynamoDB types into JS types. |
332-
| 2 | [**`Attribute fromDB Modifiers`**](#transformvalue) | Runs your `transformValue.fromDB` functions. |
333-
| 3 | [**`Item fromDB Modifier`**](#transformitem) | Runs your `transformItem.fromDB` function. |
334-
| 4 | [**`Alias Mapping`**](#alias) | Replaces attribute names with attribute _aliases_. |
333+
| 1 | [**`Attribute fromDB Modifiers`**](#transformvalue) | Runs your `transformValue.fromDB` functions. |
334+
| 2 | [**`Item fromDB Modifier`**](#transformitem) | Runs your `transformItem.fromDB` function. |
335+
| 3 | [**`Alias Mapping`**](#alias) | Replaces attribute names with attribute _aliases_. |
335336

336337
## 📖 Schema API
337338

@@ -580,12 +581,10 @@ Optional default value to apply. This can be configured as either a straight-for
580581
> With the exception of `updateItem` calls, an attribute's value is set to this `default` if the initial value provided to the Model method is `undefined` or `null`.
581582
582583
- ##### When using a primitive-value `default`
583-
584584
- The primitive's type must match the attribute's `type`, otherwise the Model's
585585
constructor will throw an error.
586586

587587
- ##### When using a function `default`
588-
589588
- The function is called with the entire item-object provided to the Model method _**with
590589
UNALIASED keys**_, and the attribute value is set to the function's returned value.
591590
- _This package does not validate functional `default`s._
@@ -808,7 +807,6 @@ DDB-ST models provide a high-level API for batching CRUD operations that handles
808807
1. First request: no delay
809808
2. Second request: delay `initialDelay` milliseconds (_default:_ 100)
810809
3. All subsequent request delays are equal to the previous delay multiplied by the `timeMultiplier` (_default:_ 2), until either:
811-
812810
- The `maxRetries` limit is reached (_default:_ 10), or
813811
- The `maxDelay` limit is reached (_default:_ 3500, or 3.5 seconds)
814812
@@ -833,6 +831,7 @@ DDB-ST models provide a high-level API for batching CRUD operations that handles
833831
**A:** DDB-ST provides a wrapper around the DynamoDB client:
834832
835833
- To simplify client usage, the wrapper handles all marshalling and unmarshalling of data to/from DynamoDB types.
834+
- The wrapper also handles conversion of JS `Date` objects to/from ISO-8601 datetime strings.
836835
- To ensure client resources like socket connections are cleaned up, a listener is attached to the process "exit" event which calls the client's `destroy()` method.
837836
838837
### Q: _What version of the AWS SDK does DDB-ST use?_<!-- omit in toc -->

eslint.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { dirname } from "node:path";
2+
import { fileURLToPath } from "node:url";
13
import eslintJS from "@eslint/js";
24
import stylisticPlugin from "@stylistic/eslint-plugin";
35
import vitestPlugin from "@vitest/eslint-plugin";
@@ -22,7 +24,9 @@ export default tsEslint.config(
2224
parser: tsEslint.parser,
2325
parserOptions: {
2426
projectService: true,
25-
tsconfigRootDir: import.meta.dirname,
27+
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
28+
/* Note: use `tsconfigRootDir: import.meta.dirname` once "engines.node"
29+
gets bumped to ">=22.0.0" (NodeJS v20 will reach EOL on April 30, 2026). */
2630
},
2731
},
2832
plugins: {

0 commit comments

Comments
 (0)