@jzhuo3/dynamodb-lib 0.1.0 → 0.1.2
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/PUBLISHING.md +9 -1
- package/README.md +25 -0
- package/dist/cjs/index.d.ts +22 -0
- package/dist/cjs/index.js +128 -102
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +22 -0
- package/dist/esm/index.js +129 -103
- package/dist/esm/index.js.map +1 -1
- package/doc/service.md +36 -0
- package/package.json +4 -3
package/PUBLISHING.md
CHANGED
|
@@ -34,7 +34,15 @@ npm publish --access public
|
|
|
34
34
|
|
|
35
35
|
`prepublishOnly` runs the source, unit, build and package checks. Integration tests are explicit because they require an available database; CI runs them against DynamoDB Local. The AWS SDK dependency tree is deliberately bundled with the archive, alongside `npm-shrinkwrap.json`, to preserve the tested Node 18-compatible, patched dependencies. After updating dependencies, refresh the shrinkwrap and run the clean consumer installation check as well as the Node runtime matrix.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
## Automated publishing
|
|
38
|
+
|
|
39
|
+
Commit and push the workflows and both Release Please configuration files before creating the next release. `release-please.yml` uses the repository variable `RELEASE_APP_CLIENT_ID` and secret `RELEASE_APP_PRIVATE_KEY` to prepare release PRs and create GitHub releases after those PRs are merged.
|
|
40
|
+
|
|
41
|
+
When a non-prerelease GitHub release is published, `.github/workflows/publish.yml` checks that its tag is `vX.Y.Z` and matches `package.json`. It runs the reusable CI workflow against that exact commit, including unit, package, coverage, clean installation, and DynamoDB Local integration checks across Node 18, 20, 22, and 24. Only after verification passes does its `publish` job enter the `npm` environment and publish using Node 24 and npm 11. Draft releases and prereleases do not publish to npm.
|
|
42
|
+
|
|
43
|
+
Configure the npm package's GitHub Actions trusted publisher with owner `maczhuo`, repository `dynamodb-lib`, workflow filename `publish.yml`, environment `npm`, and permission for direct `npm publish`. The GitHub environment `npm` must allow release tags such as `v*`. No `NPM_TOKEN` is required. Any environment approval rules will pause the publish job until satisfied.
|
|
44
|
+
|
|
45
|
+
The workflow does not retroactively publish existing GitHub releases. If a run fails before publication, fix the external configuration and rerun the failed jobs from GitHub Actions. An already published npm version cannot be published again; code or workflow fixes require a new release containing those changes. Initial package creation may still require the manual bootstrap described above.
|
|
38
46
|
|
|
39
47
|
Official references (checked September 2026):
|
|
40
48
|
|
package/README.md
CHANGED
|
@@ -102,6 +102,31 @@ The constructor accepts independent configurations, rather than using one proces
|
|
|
102
102
|
|
|
103
103
|
**Update Expression builders** compose the changes passed to `update` as a command array: `Assign`, `AssignIfNotExists`, `Increment`, `Decrement`, `ListAppend`, `ListPrepend`, `Remove`, `SetAdd`, `SetDelete`.
|
|
104
104
|
|
|
105
|
+
### Inspecting expressions in unit tests
|
|
106
|
+
|
|
107
|
+
Call `expression.describe()` for a detached, JSON-serializable snapshot containing `expression`, `expressionAttributeNames`, `expressionAttributeValues`, and (for updates) `updateExpressionGroup`. Expressions without values return an empty values object.
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
const description = SetAdd('tags', new Set(['a', 'b'])).describe();
|
|
111
|
+
// description.expressionAttributeValues:
|
|
112
|
+
// { ':val0': { $type: 'Set', values: ['a', 'b'] } }
|
|
113
|
+
const json = JSON.stringify(description);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Strings, booleans, null, finite numbers, arrays and plain objects keep their JSON shape. Nested native values use these explicit representations:
|
|
117
|
+
|
|
118
|
+
| Native value | Description |
|
|
119
|
+
| --- | --- |
|
|
120
|
+
| `bigint` | `{ $type: 'BigInt', value: '9007199254740993' }` |
|
|
121
|
+
| SDK `NumberValue` | `{ $type: 'NumberValue', value: '123.456' }` |
|
|
122
|
+
| `Set` | `{ $type: 'Set', values: [...] }` |
|
|
123
|
+
| `Buffer`, `ArrayBuffer`, typed array or `DataView` | `{ $type: 'Binary', encoding: 'base64', value: 'AQI=' }` |
|
|
124
|
+
| `Map` | `{ $type: 'Map', entries: [[key, value], ...] }` |
|
|
125
|
+
| `undefined` | `{ $type: 'Undefined' }` |
|
|
126
|
+
| `NaN`, positive/negative infinity | `{ $type: 'Number', value: 'NaN' }` (or `'Infinity'` / `'-Infinity'`) |
|
|
127
|
+
|
|
128
|
+
Sets and Maps retain insertion order. Binary views serialize only their visible bytes. Circular references, functions, symbols, enumerable symbol keys, and unsupported class instances (including `Date` and `Blob`) throw `TypeError`. Serialization does not validate whether a value is accepted by DynamoDB. This format is for inspection and assertions, not deserialization or sending to DynamoDB; plain objects containing `$type` remain plain objects. The live expression and its values are unchanged.
|
|
129
|
+
|
|
105
130
|
## Detailed documentation
|
|
106
131
|
|
|
107
132
|
See the [documentation index](doc/README.md) for [every service method](doc/service.md), [configuration](doc/configuration.md), [Condition Expression and Update Expression builders](doc/expressions.md), [transaction methods](doc/transactions.md), and [examples](doc/examples.md).
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -135,6 +135,20 @@ export declare function ListPrepend(attribute: string, value: Array<any>, upsert
|
|
|
135
135
|
export declare function Remove(attribute: string): DynamoDBExpression;
|
|
136
136
|
export declare function SetAdd(attribute: string, value: Set<any>): DynamoDBExpression;
|
|
137
137
|
export declare function SetDelete(attribute: string, value: Set<any>): DynamoDBExpression;
|
|
138
|
+
/** JSON-compatible value used by expression descriptions. */
|
|
139
|
+
export type DynamoDBExpressionSerializedValue = null | boolean | number | string | DynamoDBExpressionSerializedValue[] | {
|
|
140
|
+
[key: string]: DynamoDBExpressionSerializedValue;
|
|
141
|
+
};
|
|
142
|
+
export type DynamoDBExpressionDescription = {
|
|
143
|
+
/** DynamoDB expression string, e.g. `#attr0 = :val0`. */
|
|
144
|
+
expression: string;
|
|
145
|
+
/** Placeholder -> attribute name (e.g. `#attr0` -> `VersionStamp`). */
|
|
146
|
+
expressionAttributeNames: Record<string, string>;
|
|
147
|
+
/** Placeholder -> JSON-compatible value; native non-JSON values use explicit `$type` tags. */
|
|
148
|
+
expressionAttributeValues: Record<string, DynamoDBExpressionSerializedValue>;
|
|
149
|
+
/** Which update clause the expression belongs to (SET/REMOVE/ADD/DELETE). */
|
|
150
|
+
updateExpressionGroup?: 'SET' | 'REMOVE' | 'ADD' | 'DELETE';
|
|
151
|
+
};
|
|
138
152
|
export declare class DynamoDBExpression {
|
|
139
153
|
expressionAttributeNameMap: Map<string, string>;
|
|
140
154
|
expressionAttributeValueMap: Map<string, any> | null;
|
|
@@ -143,6 +157,14 @@ export declare class DynamoDBExpression {
|
|
|
143
157
|
constructor(expressionAttributeNameMap?: Map<string, string>, // e.g. #attr0 -> attribute
|
|
144
158
|
expressionAttributeValueMap?: Map<string, any> | null, // e.g. :val0 -> value
|
|
145
159
|
expression?: string, updateExpressionGroup?: "SET" | "REMOVE" | "ADD" | "DELETE" | undefined);
|
|
160
|
+
/**
|
|
161
|
+
* Detached, JSON-serializable description of the expression. Intended for logging,
|
|
162
|
+
* debugging, and unit tests that need to assert on a built expression
|
|
163
|
+
* without reaching into the internal Maps.
|
|
164
|
+
* Sets, bigint, binary, Maps, NumberValue, undefined and non-finite numbers
|
|
165
|
+
* use explicit `$type` tags. Circular and unsupported values throw TypeError.
|
|
166
|
+
*/
|
|
167
|
+
describe(): DynamoDBExpressionDescription;
|
|
146
168
|
}
|
|
147
169
|
export declare enum DynamoDBTransactionMode {
|
|
148
170
|
READ = "READ",
|