dyno-table 0.1.8 → 1.0.0-alpha.1

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 (58) hide show
  1. package/README.md +35 -7
  2. package/package.json +13 -3
  3. package/dist/builders/condition-check-builder.cjs +0 -394
  4. package/dist/builders/condition-check-builder.cjs.map +0 -1
  5. package/dist/builders/condition-check-builder.js +0 -392
  6. package/dist/builders/condition-check-builder.js.map +0 -1
  7. package/dist/builders/delete-builder.cjs +0 -422
  8. package/dist/builders/delete-builder.cjs.map +0 -1
  9. package/dist/builders/delete-builder.js +0 -420
  10. package/dist/builders/delete-builder.js.map +0 -1
  11. package/dist/builders/paginator.cjs +0 -199
  12. package/dist/builders/paginator.cjs.map +0 -1
  13. package/dist/builders/paginator.js +0 -197
  14. package/dist/builders/paginator.js.map +0 -1
  15. package/dist/builders/put-builder.cjs +0 -468
  16. package/dist/builders/put-builder.cjs.map +0 -1
  17. package/dist/builders/put-builder.js +0 -466
  18. package/dist/builders/put-builder.js.map +0 -1
  19. package/dist/builders/query-builder.cjs +0 -674
  20. package/dist/builders/query-builder.cjs.map +0 -1
  21. package/dist/builders/query-builder.js +0 -672
  22. package/dist/builders/query-builder.js.map +0 -1
  23. package/dist/builders/transaction-builder.cjs +0 -876
  24. package/dist/builders/transaction-builder.cjs.map +0 -1
  25. package/dist/builders/transaction-builder.js +0 -874
  26. package/dist/builders/transaction-builder.js.map +0 -1
  27. package/dist/builders/update-builder.cjs +0 -662
  28. package/dist/builders/update-builder.cjs.map +0 -1
  29. package/dist/builders/update-builder.js +0 -660
  30. package/dist/builders/update-builder.js.map +0 -1
  31. package/dist/conditions.cjs +0 -59
  32. package/dist/conditions.cjs.map +0 -1
  33. package/dist/conditions.js +0 -43
  34. package/dist/conditions.js.map +0 -1
  35. package/dist/entity.cjs +0 -169
  36. package/dist/entity.cjs.map +0 -1
  37. package/dist/entity.js +0 -165
  38. package/dist/entity.js.map +0 -1
  39. package/dist/standard-schema.cjs +0 -4
  40. package/dist/standard-schema.cjs.map +0 -1
  41. package/dist/standard-schema.js +0 -3
  42. package/dist/standard-schema.js.map +0 -1
  43. package/dist/table.cjs +0 -3265
  44. package/dist/table.cjs.map +0 -1
  45. package/dist/table.js +0 -3263
  46. package/dist/table.js.map +0 -1
  47. package/dist/types.cjs +0 -4
  48. package/dist/types.cjs.map +0 -1
  49. package/dist/types.js +0 -3
  50. package/dist/types.js.map +0 -1
  51. package/dist/utils/key-template.cjs +0 -19
  52. package/dist/utils/key-template.cjs.map +0 -1
  53. package/dist/utils/key-template.js +0 -17
  54. package/dist/utils/key-template.js.map +0 -1
  55. package/dist/utils/sort-key-template.cjs +0 -19
  56. package/dist/utils/sort-key-template.cjs.map +0 -1
  57. package/dist/utils/sort-key-template.js +0 -17
  58. package/dist/utils/sort-key-template.js.map +0 -1
package/README.md CHANGED
@@ -850,6 +850,41 @@ pnpm test
850
850
  pnpm build
851
851
  ```
852
852
 
853
+ ## 📦 Release Process
854
+
855
+ This project uses [semantic-release](https://github.com/semantic-release/semantic-release) for automated versioning and package publishing. The configuration is maintained in the `.releaserc.json` file. Releases are automatically triggered by commits to specific branches:
856
+
857
+ - **Main Channel**: Stable releases from the `main` branch
858
+ - **Alpha Channel**: Pre-releases from the `alpha` branch
859
+
860
+ ### Commit Message Format
861
+
862
+ We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages, which determines the release type:
863
+
864
+ - `fix: ...` - Patch release (bug fixes)
865
+ - `feat: ...` - Minor release (new features)
866
+ - `feat!: ...` or `fix!: ...` or any commit with `BREAKING CHANGE:` in the footer - Major release
867
+
868
+ ### Release Workflow
869
+
870
+ 1. For regular features and fixes:
871
+ - Create a PR against the `main` branch
872
+ - Once merged, a new release will be automatically published
873
+
874
+ 2. For experimental features:
875
+ - Create a PR against the `alpha` branch
876
+ - Once merged, a new alpha release will be published with an alpha tag
877
+
878
+ ### Installing Specific Channels
879
+
880
+ ```bash
881
+ # Install the latest stable version
882
+ npm install dyno-table
883
+
884
+ # Install the latest alpha version
885
+ npm install dyno-table@alpha
886
+ ```
887
+
853
888
  ## 🦔 Running Examples
854
889
 
855
890
  There's a few pre-configured example scripts in the `examples` directory.
@@ -873,10 +908,3 @@ npx tsx examples/[EXAMPLE_NAME].ts
873
908
  ```
874
909
 
875
910
  To view the test table GUI in action: [DynamoDB Admin](http://localhost:8001/)
876
-
877
- <br />
878
- To teardown the test table when you're done, run the following command:
879
-
880
- ```bash
881
- pnpm run local:teardown
882
- ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dyno-table",
3
- "version": "0.1.8",
3
+ "version": "1.0.0-alpha.1",
4
4
  "description": "A TypeScript library to simplify working with DynamoDB",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -26,7 +26,12 @@
26
26
  "ddb:start": "docker compose up -d",
27
27
  "circular": "npx madge --circular --ts-config ./tsconfig.json --extensions ts,tsx src/"
28
28
  },
29
- "keywords": ["dynamodb", "aws", "typescript", "database"],
29
+ "keywords": [
30
+ "dynamodb",
31
+ "aws",
32
+ "typescript",
33
+ "database"
34
+ ],
30
35
  "author": "Maunder",
31
36
  "license": "ISC",
32
37
  "repository": {
@@ -36,8 +41,11 @@
36
41
  "devDependencies": {
37
42
  "@babel/preset-typescript": "^7.26.0",
38
43
  "@biomejs/biome": "1.9.4",
44
+ "@semantic-release/changelog": "^6.0.3",
45
+ "@semantic-release/git": "^10.0.1",
39
46
  "@types/node": "^20.0.0",
40
47
  "rimraf": "^5.0.0",
48
+ "semantic-release": "24.2.3",
41
49
  "tsup": "^8.0.0",
42
50
  "typescript": "^5.0.0",
43
51
  "vitest": "^2.1.8"
@@ -46,6 +54,8 @@
46
54
  "@aws-sdk/client-dynamodb": "^3.0.0",
47
55
  "@aws-sdk/lib-dynamodb": "^3.0.0"
48
56
  },
49
- "files": ["dist"],
57
+ "files": [
58
+ "dist"
59
+ ],
50
60
  "packageManager": "pnpm@10.5.2"
51
61
  }
@@ -1,394 +0,0 @@
1
- 'use strict';
2
-
3
- // src/conditions.ts
4
- var createComparisonCondition = (type) => (attr, value) => ({
5
- type,
6
- attr,
7
- value
8
- });
9
- var eq = createComparisonCondition("eq");
10
- var ne = createComparisonCondition("ne");
11
- var lt = createComparisonCondition("lt");
12
- var lte = createComparisonCondition("lte");
13
- var gt = createComparisonCondition("gt");
14
- var gte = createComparisonCondition("gte");
15
- var between = (attr, lower, upper) => ({
16
- type: "between",
17
- attr,
18
- value: [lower, upper]
19
- });
20
- var beginsWith = createComparisonCondition("beginsWith");
21
- var contains = createComparisonCondition("contains");
22
- var attributeExists = (attr) => ({
23
- type: "attributeExists",
24
- attr
25
- });
26
- var attributeNotExists = (attr) => ({
27
- type: "attributeNotExists",
28
- attr
29
- });
30
- var and = (...conditions) => ({
31
- type: "and",
32
- conditions
33
- });
34
- var or = (...conditions) => ({
35
- type: "or",
36
- conditions
37
- });
38
- var not = (condition) => ({
39
- type: "not",
40
- condition
41
- });
42
-
43
- // src/expression.ts
44
- var generateAttributeName = (params, attr) => {
45
- for (const [existingName, existingAttr] of Object.entries(params.expressionAttributeNames)) {
46
- if (existingAttr === attr) {
47
- return existingName;
48
- }
49
- }
50
- const attrName = `#${Object.keys(params.expressionAttributeNames).length}`;
51
- params.expressionAttributeNames[attrName] = attr;
52
- return attrName;
53
- };
54
- var generateValueName = (params, value) => {
55
- const valueName = `:${params.valueCounter.count++}`;
56
- params.expressionAttributeValues[valueName] = value;
57
- return valueName;
58
- };
59
- var validateCondition = (condition, requiresAttr = true, requiresValue = true) => {
60
- if (requiresAttr && !condition.attr) {
61
- throw new Error(`Attribute is required for ${condition.type} condition`);
62
- }
63
- if (requiresValue && condition.value === void 0) {
64
- throw new Error(`Value is required for ${condition.type} condition`);
65
- }
66
- };
67
- var buildComparisonExpression = (condition, operator, params) => {
68
- validateCondition(condition);
69
- if (!condition.attr) {
70
- throw new Error(`Attribute is required for ${condition.type} condition`);
71
- }
72
- const attrName = generateAttributeName(params, condition.attr);
73
- const valueName = generateValueName(params, condition.value);
74
- return `${attrName} ${operator} ${valueName}`;
75
- };
76
- var buildBetweenExpression = (condition, params) => {
77
- validateCondition(condition);
78
- if (!condition.attr) {
79
- throw new Error(`Attribute is required for ${condition.type} condition`);
80
- }
81
- if (!Array.isArray(condition.value) || condition.value.length !== 2) {
82
- throw new Error("Between condition requires an array of two values");
83
- }
84
- const attrName = generateAttributeName(params, condition.attr);
85
- const lowerName = generateValueName(params, condition.value[0]);
86
- const upperName = generateValueName(params, condition.value[1]);
87
- return `${attrName} BETWEEN ${lowerName} AND ${upperName}`;
88
- };
89
- var buildFunctionExpression = (functionName, condition, params) => {
90
- validateCondition(condition);
91
- if (!condition.attr) {
92
- throw new Error(`Attribute is required for ${condition.type} condition`);
93
- }
94
- const attrName = generateAttributeName(params, condition.attr);
95
- const valueName = generateValueName(params, condition.value);
96
- return `${functionName}(${attrName}, ${valueName})`;
97
- };
98
- var buildAttributeFunction = (functionName, condition, params) => {
99
- validateCondition(condition, true, false);
100
- if (!condition.attr) {
101
- throw new Error(`Attribute is required for ${condition.type} condition`);
102
- }
103
- const attrName = generateAttributeName(params, condition.attr);
104
- return `${functionName}(${attrName})`;
105
- };
106
- var buildLogicalExpression = (operator, conditions, params) => {
107
- if (!conditions || conditions.length === 0) {
108
- throw new Error(`At least one condition is required for ${operator} expression`);
109
- }
110
- const expressions = conditions.map((c) => buildExpression(c, params));
111
- return `(${expressions.join(` ${operator} `)})`;
112
- };
113
- var buildExpression = (condition, params) => {
114
- if (!condition) return "";
115
- try {
116
- const expressionBuilders = {
117
- eq: () => buildComparisonExpression(condition, "=", params),
118
- ne: () => buildComparisonExpression(condition, "<>", params),
119
- lt: () => buildComparisonExpression(condition, "<", params),
120
- lte: () => buildComparisonExpression(condition, "<=", params),
121
- gt: () => buildComparisonExpression(condition, ">", params),
122
- gte: () => buildComparisonExpression(condition, ">=", params),
123
- between: () => buildBetweenExpression(condition, params),
124
- beginsWith: () => buildFunctionExpression("begins_with", condition, params),
125
- contains: () => buildFunctionExpression("contains", condition, params),
126
- attributeExists: () => buildAttributeFunction("attribute_exists", condition, params),
127
- attributeNotExists: () => buildAttributeFunction("attribute_not_exists", condition, params),
128
- and: () => {
129
- if (!condition.conditions) {
130
- throw new Error("Conditions array is required for AND operator");
131
- }
132
- return buildLogicalExpression("AND", condition.conditions, params);
133
- },
134
- or: () => {
135
- if (!condition.conditions) {
136
- throw new Error("Conditions array is required for OR operator");
137
- }
138
- return buildLogicalExpression("OR", condition.conditions, params);
139
- },
140
- not: () => {
141
- if (!condition.condition) {
142
- throw new Error("Condition is required for NOT operator");
143
- }
144
- return `NOT (${buildExpression(condition.condition, params)})`;
145
- }
146
- };
147
- const builder = expressionBuilders[condition.type];
148
- if (!builder) {
149
- throw new Error(`Unknown condition type: ${condition.type}`);
150
- }
151
- return builder();
152
- } catch (error) {
153
- if (error instanceof Error) {
154
- console.error(`Error building expression for condition type ${condition.type}:`, error.message);
155
- } else {
156
- console.error(`Error building expression for condition type ${condition.type}:`, error);
157
- }
158
- throw error;
159
- }
160
- };
161
- var prepareExpressionParams = (condition) => {
162
- if (!condition) return {};
163
- const params = {
164
- expressionAttributeNames: {},
165
- expressionAttributeValues: {},
166
- valueCounter: { count: 0 }
167
- };
168
- const expression = buildExpression(condition, params);
169
- return {
170
- expression,
171
- names: Object.keys(params.expressionAttributeNames).length > 0 ? params.expressionAttributeNames : void 0,
172
- values: Object.keys(params.expressionAttributeValues).length > 0 ? params.expressionAttributeValues : void 0
173
- };
174
- };
175
-
176
- // src/utils/debug-expression.ts
177
- function debugCommand(command) {
178
- const result = {};
179
- function replaceAliases(expressionString) {
180
- if (!expressionString) {
181
- return expressionString;
182
- }
183
- let replacedString = expressionString;
184
- for (const alias in command.expressionAttributeNames) {
185
- const attributeName = command.expressionAttributeNames[alias];
186
- const regex = new RegExp(alias, "g");
187
- replacedString = replacedString.replace(regex, attributeName);
188
- }
189
- for (const alias in command.expressionAttributeValues) {
190
- let attributeValue = command.expressionAttributeValues[alias];
191
- if (attributeValue instanceof Set) {
192
- const array = Array.from(attributeValue);
193
- attributeValue = `Set(${array.length}){${array.map((v) => JSON.stringify(v)).join(", ")}}`;
194
- } else {
195
- attributeValue = JSON.stringify(attributeValue);
196
- }
197
- const regex = new RegExp(alias, "g");
198
- replacedString = replacedString.replace(regex, attributeValue);
199
- }
200
- return replacedString;
201
- }
202
- if (command.updateExpression) {
203
- result.updateExpression = replaceAliases(command.updateExpression);
204
- }
205
- if (command.conditionExpression) {
206
- result.conditionExpression = replaceAliases(command.conditionExpression);
207
- }
208
- if (command.filterExpression) {
209
- result.filterExpression = replaceAliases(command.filterExpression);
210
- }
211
- if (command.keyConditionExpression) {
212
- result.keyConditionExpression = replaceAliases(command.keyConditionExpression);
213
- }
214
- if (command.projectionExpression) {
215
- result.projectionExpression = replaceAliases(command.projectionExpression);
216
- }
217
- return {
218
- raw: command,
219
- readable: result
220
- };
221
- }
222
-
223
- // src/builders/condition-check-builder.ts
224
- var ConditionCheckBuilder = class {
225
- key;
226
- tableName;
227
- conditionExpression;
228
- constructor(tableName, key) {
229
- this.tableName = tableName;
230
- this.key = key;
231
- }
232
- /**
233
- * Adds a condition that must be satisfied for the check to succeed.
234
- * Use this method when you need to:
235
- * - Validate complex item states
236
- * - Check multiple attributes together
237
- * - Ensure safety conditions are met
238
- *
239
- * @example
240
- * ```typescript
241
- * // Check dinosaur health and behavior
242
- * builder.condition(op =>
243
- * op.and([
244
- * op.gt('stats.health', 50),
245
- * op.not(op.eq('status', 'SEDATED')),
246
- * op.lt('aggressionLevel', 8)
247
- * ])
248
- * );
249
- *
250
- * // Verify habitat conditions
251
- * builder.condition(op =>
252
- * op.and([
253
- * op.eq('powerStatus', 'ONLINE'),
254
- * op.between('temperature', 20, 30),
255
- * op.attributeExists('lastMaintenance')
256
- * ])
257
- * );
258
- *
259
- * // Check breeding conditions
260
- * builder.condition(op =>
261
- * op.and([
262
- * op.eq('species', 'VELOCIRAPTOR'),
263
- * op.gte('age', 3),
264
- * op.eq('geneticPurity', 100)
265
- * ])
266
- * );
267
- * ```
268
- *
269
- * @param condition - Either a Condition object or a callback function that builds the condition
270
- * @returns The builder instance for method chaining
271
- */
272
- condition(condition) {
273
- if (typeof condition === "function") {
274
- const conditionOperator = {
275
- eq,
276
- ne,
277
- lt,
278
- lte,
279
- gt,
280
- gte,
281
- between,
282
- beginsWith,
283
- contains,
284
- attributeExists,
285
- attributeNotExists,
286
- and,
287
- or,
288
- not
289
- };
290
- this.conditionExpression = condition(conditionOperator);
291
- } else {
292
- this.conditionExpression = condition;
293
- }
294
- return this;
295
- }
296
- /**
297
- * Generates the DynamoDB command parameters for direct execution.
298
- * Use this method when you want to:
299
- * - Execute the condition check as a standalone operation
300
- * - Get the raw DynamoDB command for custom execution
301
- * - Inspect the generated command parameters
302
- *
303
- * @example
304
- * ```ts
305
- * const command = new ConditionCheckBuilder('myTable', { id: '123' })
306
- * .condition(op => op.attributeExists('status'))
307
- * .toDynamoCommand();
308
- * // Use command with DynamoDB client
309
- * ```
310
- *
311
- * @throws {Error} If no condition has been set
312
- * @returns The DynamoDB command parameters
313
- */
314
- toDynamoCommand() {
315
- if (!this.conditionExpression) {
316
- throw new Error("Condition is required for condition check operations");
317
- }
318
- const { expression, names, values } = prepareExpressionParams(this.conditionExpression);
319
- if (!expression) {
320
- throw new Error("Failed to generate condition expression");
321
- }
322
- return {
323
- tableName: this.tableName,
324
- key: this.key,
325
- conditionExpression: expression,
326
- expressionAttributeNames: names,
327
- expressionAttributeValues: values
328
- };
329
- }
330
- /**
331
- * Adds this condition check operation to a transaction.
332
- * Use this method when you need to:
333
- * - Verify habitat safety before transfers
334
- * - Ensure proper feeding conditions
335
- * - Validate security protocols
336
- *
337
- * @example
338
- * ```ts
339
- * const transaction = new TransactionBuilder();
340
- * new ConditionCheckBuilder('habitats', { id: 'PADDOCK-B' })
341
- * .condition(op => op.and([
342
- * op.eq('securityStatus', 'ACTIVE'),
343
- * op.lt('currentOccupants', 3),
344
- * op.eq('habitatType', 'CARNIVORE')
345
- * ]))
346
- * .withTransaction(transaction);
347
- * // Add dinosaur transfer operations
348
- * ```
349
- *
350
- * @param transaction - The transaction builder to add this operation to
351
- * @throws {Error} If no condition has been set
352
- * @returns The builder instance for method chaining
353
- */
354
- withTransaction(transaction) {
355
- if (!this.conditionExpression) {
356
- throw new Error("Condition is required for condition check operations");
357
- }
358
- const command = this.toDynamoCommand();
359
- transaction.conditionCheckWithCommand(command);
360
- return this;
361
- }
362
- /**
363
- * Gets a human-readable representation of the condition check command
364
- * with all expression placeholders replaced by their actual values.
365
- * Use this method when you need to:
366
- * - Debug complex condition expressions
367
- * - Verify condition parameters
368
- * - Log safety checks
369
- * - Troubleshoot condition failures
370
- *
371
- * @example
372
- * ```ts
373
- * const debugInfo = new ConditionCheckBuilder('dinosaurs', { id: 'TREX-001' })
374
- * .condition(op => op.and([
375
- * op.between('stats.health', 50, 100),
376
- * op.not(op.eq('status', 'SEDATED')),
377
- * op.attributeExists('lastFeedingTime')
378
- * op.eq('version', 1)
379
- * ]))
380
- * .debug();
381
- * console.log(debugInfo);
382
- * ```
383
- *
384
- * @returns A readable representation of the condition check command with resolved expressions
385
- */
386
- debug() {
387
- const command = this.toDynamoCommand();
388
- return debugCommand(command);
389
- }
390
- };
391
-
392
- exports.ConditionCheckBuilder = ConditionCheckBuilder;
393
- //# sourceMappingURL=condition-check-builder.cjs.map
394
- //# sourceMappingURL=condition-check-builder.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/conditions.ts","../../src/expression.ts","../../src/utils/debug-expression.ts","../../src/builders/condition-check-builder.ts"],"names":[],"mappings":";;;AA8FO,IAAM,yBACX,GAAA,CAAC,IACD,KAAA,CAAC,MAAc,KAA+B,MAAA;AAAA,EAC5C,IAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAA,CAAA;AAQK,IAAM,EAAA,GAAK,0BAA0B,IAAI,CAAA;AAQzC,IAAM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AAW,IAAK,CAAA,SAAA;AAAA,MAChB,KAAK,IAAK,CAAA,GAAA;AAAA,MACV,mBAAqB,EAAA,UAAA;AAAA,MACrB,wBAA0B,EAAA,KAAA;AAAA,MAC1B,yBAA2B,EAAA;AAAA,KAC7B;AAAA;AACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BA,gBAAgB,WAAwD,EAAA;AACtE,IAAI,IAAA,CAAC,KAAK,mBAAqB,EAAA;AAC7B,MAAM,MAAA,IAAI,MAAM,sDAAsD,CAAA;AAAA;AAGxE,IAAM,MAAA,OAAA,GAAU,KAAK,eAAgB,EAAA;AACrC,IAAA,WAAA,CAAY,0BAA0B,OAAO,CAAA;AAE7C,IAAO,OAAA,IAAA;AAAA;AACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0BA,KAAiC,GAAA;AAC/B,IAAM,MAAA,OAAA,GAAU,KAAK,eAAgB,EAAA;AACrC,IAAA,OAAO,aAAa,OAAO,CAAA;AAAA;AAE/B","file":"condition-check-builder.cjs","sourcesContent":["import type { Path, PathType } from \"./builders/types\";\n\n/**\n * Supported comparison operators for DynamoDB conditions.\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html AWS DynamoDB - Comparison Operator Reference}\n *\n * - eq: Equals (=)\n * - ne: Not equals (≠ / <>)\n * - lt: Less than (<)\n * - lte: Less than or equal to (≤)\n * - gt: Greater than (>)\n * - gte: Greater than or equal to (≥)\n * - between: Between two values (inclusive)\n * - beginsWith: Checks if string attribute begins with specified substring\n * - contains: Checks if string/set attribute contains specified value\n * - attributeExists: Checks if attribute exists\n * - attributeNotExists: Checks if attribute does not exist\n */\nexport type ComparisonOperator =\n | \"eq\"\n | \"ne\"\n | \"lt\"\n | \"lte\"\n | \"gt\"\n | \"gte\"\n | \"between\"\n | \"beginsWith\"\n | \"contains\"\n | \"attributeExists\"\n | \"attributeNotExists\";\n\n/**\n * Logical operators for combining multiple conditions.\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Logical AWS DynamoDB - Logical Operator Reference}\n *\n * - and: Evaluates to true if all conditions are true\n * - or: Evaluates to true if any condition is true\n * - not: Negate the result of a condition\n */\nexport type LogicalOperator = \"and\" | \"or\" | \"not\";\n\n/**\n * Represents a DynamoDB condition expression.\n * Can be either a comparison condition or a logical combination of conditions.\n *\n * @example\n * // Simple comparison condition\n * const condition: Condition = {\n * type: \"eq\",\n * attr: \"status\",\n * value: \"ACTIVE\"\n * };\n *\n * @example\n * // Logical combination of conditions\n * const condition: Condition = {\n * type: \"and\",\n * conditions: [\n * { type: \"eq\", attr: \"status\", value: \"ACTIVE\" },\n * { type: \"gt\", attr: \"age\", value: 5 }\n * ]\n * };\n */\nexport interface Condition {\n /** The type of condition (comparison or logical operator) */\n type: ComparisonOperator | LogicalOperator;\n /** The attribute name for comparison conditions */\n attr?: string;\n /** The value to compare against for comparison conditions */\n value?: unknown;\n /** Array of conditions for logical operators (and/or) */\n conditions?: Condition[];\n /** Single condition for the 'not' operator */\n condition?: Condition;\n}\n\n/**\n * Parameters used to build DynamoDB expression strings.\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ExpressionAttributeNames.html Expression Attribute Names}\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ExpressionAttributeValues.html Expression Attribute Values}\n */\nexport interface ExpressionParams {\n /** Map of attribute name placeholders to actual attribute names */\n expressionAttributeNames: Record<string, string>;\n /** Map of value placeholders to actual values */\n expressionAttributeValues: Record<string, unknown>;\n /** Counter for generating unique value placeholders */\n valueCounter: { count: number };\n}\n\n/**\n * Creates a comparison condition builder function for the specified operator.\n * @internal\n */\nexport const createComparisonCondition =\n (type: ComparisonOperator) =>\n (attr: string, value: unknown): Condition => ({\n type,\n attr,\n value,\n });\n\n/**\n * Creates an equals (=) condition\n * @example\n * eq(\"status\", \"ACTIVE\") // status = \"ACTIVE\"\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html}\n */\nexport const eq = createComparisonCondition(\"eq\");\n\n/**\n * Creates a not equals (≠) condition\n * @example\n * ne(\"status\", \"DELETED\") // status <> \"DELETED\"\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html}\n */\nexport const ne = createComparisonCondition(\"ne\");\n\n/**\n * Creates a less than (<) condition\n * @example\n * lt(\"age\", 18) // age < 18\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html}\n */\nexport const lt = createComparisonCondition(\"lt\");\n\n/**\n * Creates a less than or equal to (≤) condition\n * @example\n * lte(\"age\", 18) // age <= 18\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html}\n */\nexport const lte = createComparisonCondition(\"lte\");\n\n/**\n * Creates a greater than (>) condition\n * @example\n * gt(\"price\", 100) // price > 100\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html}\n */\nexport const gt = createComparisonCondition(\"gt\");\n\n/**\n * Creates a greater than or equal to (≥) condition\n * @example\n * gte(\"price\", 100) // price >= 100\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html}\n */\nexport const gte = createComparisonCondition(\"gte\");\n\n/**\n * Creates a between condition that checks if a value is within a range (inclusive)\n * @example\n * between(\"age\", 18, 65) // age BETWEEN 18 AND 65\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - BETWEEN}\n */\nexport const between = (attr: string, lower: unknown, upper: unknown): Condition => ({\n type: \"between\",\n attr,\n value: [lower, upper],\n});\n\n/**\n * Creates a begins_with condition that checks if a string attribute starts with a substring\n * @example\n * beginsWith(\"email\", \"@example.com\") // begins_with(email, \"@example.com\")\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - begins_with}\n */\nexport const beginsWith = createComparisonCondition(\"beginsWith\");\n\n/**\n * Creates a contains condition that checks if a string contains a substring or if a set contains an element\n * @example\n * contains(\"tags\", \"important\") // contains(tags, \"important\")\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - contains}\n */\nexport const contains = createComparisonCondition(\"contains\");\n\n/**\n * Creates a condition that checks if an attribute exists\n * @example\n * attributeExists(\"email\") // attribute_exists(email)\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - attribute_exists}\n */\nexport const attributeExists = (attr: string): Condition => ({\n type: \"attributeExists\",\n attr,\n});\n\n/**\n * Creates a condition that checks if an attribute does not exist\n * @example\n * attributeNotExists(\"deletedAt\") // attribute_not_exists(deletedAt)\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - attribute_not_exists}\n */\nexport const attributeNotExists = (attr: string): Condition => ({\n type: \"attributeNotExists\",\n attr,\n});\n\n// --- Logical Operators ---\n\n/**\n * Combines multiple conditions with AND operator\n * @example\n * and(\n * eq(\"status\", \"ACTIVE\"),\n * gt(\"age\", 18)\n * ) // status = \"ACTIVE\" AND age > 18\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Logical AWS DynamoDB - AND}\n */\nexport const and = (...conditions: Condition[]): Condition => ({\n type: \"and\",\n conditions,\n});\n\n/**\n * Combines multiple conditions with OR operator\n * @example\n * or(\n * eq(\"status\", \"PENDING\"),\n * eq(\"status\", \"PROCESSING\")\n * ) // status = \"PENDING\" OR status = \"PROCESSING\"\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Logical AWS DynamoDB - OR}\n */\nexport const or = (...conditions: Condition[]): Condition => ({\n type: \"or\",\n conditions,\n});\n\n/**\n * Negates a condition\n * @example\n * not(eq(\"status\", \"DELETED\")) // NOT status = \"DELETED\"\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Logical AWS DynamoDB - NOT}\n */\nexport const not = (condition: Condition): Condition => ({\n type: \"not\",\n condition,\n});\n\n/**\n * Type-safe operators for building key conditions in DynamoDB queries.\n * Only includes operators that are valid for key conditions.\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html#Query.KeyConditionExpressions AWS DynamoDB - Key Condition Expressions}\n *\n * @example\n * // Using with sort key conditions\n * table.query({\n * pk: \"USER#123\",\n * sk: op => op.beginsWith(\"ORDER#\")\n * })\n */\nexport type KeyConditionOperator = {\n /** Equals comparison for key attributes */\n eq: (value: unknown) => Condition;\n /** Less than comparison for key attributes */\n lt: (value: unknown) => Condition;\n /** Less than or equal comparison for key attributes */\n lte: (value: unknown) => Condition;\n /** Greater than comparison for key attributes */\n gt: (value: unknown) => Condition;\n /** Greater than or equal comparison for key attributes */\n gte: (value: unknown) => Condition;\n /** Between range comparison for key attributes */\n between: (lower: unknown, upper: unknown) => Condition;\n /** Begins with comparison for key attributes */\n beginsWith: (value: unknown) => Condition;\n /** Combines multiple key conditions with AND */\n and: (...conditions: Condition[]) => Condition;\n};\n\n/**\n * Type-safe operators for building conditions in DynamoDB operations.\n * Includes all available condition operators with proper type inference.\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html AWS DynamoDB - Condition Expressions}\n *\n * @example\n * // Using with type-safe conditions\n * interface User {\n * status: string;\n * age: number;\n * email?: string;\n * }\n *\n * table.scan<User>()\n * .where(op => op.and(\n * op.eq(\"status\", \"ACTIVE\"),\n * op.gt(\"age\", 18),\n * op.attributeExists(\"email\")\n * ))\n *\n * @template T The type of the item being operated on\n */\nexport type ConditionOperator<T extends Record<string, unknown>> = {\n eq: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n ne: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n lt: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n lte: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n gt: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n gte: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n between: <K extends Path<T>>(attr: K, lower: PathType<T, K>, upper: PathType<T, K>) => Condition;\n beginsWith: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n contains: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n attributeExists: <K extends Path<T>>(attr: K) => Condition;\n attributeNotExists: <K extends Path<T>>(attr: K) => Condition;\n and: (...conditions: Condition[]) => Condition;\n or: (...conditions: Condition[]) => Condition;\n not: (condition: Condition) => Condition;\n};\n\n/**\n * Primary key type for QUERY operations.\n * Allows building complex key conditions for the sort key.\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html AWS DynamoDB - Query Operations}\n *\n * @example\n * // Query items with a specific partition key and sort key prefix\n * table.query({\n * pk: \"USER#123\",\n * sk: op => op.beginsWith(\"ORDER#2023\")\n * })\n *\n * @example\n * // Query items within a specific sort key range\n * table.query({\n * pk: \"USER#123\",\n * sk: op => op.between(\"ORDER#2023-01\", \"ORDER#2023-12\")\n * })\n */\nexport type PrimaryKey = {\n /** Partition key value */\n pk: string;\n /** Optional sort key condition builder */\n sk?: (op: KeyConditionOperator) => Condition;\n};\n\n/**\n * Primary key type for GET and DELETE operations.\n * Used when you need to specify exact key values without conditions.\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html AWS DynamoDB - Working with Items}\n *\n * @example\n * // Get a specific item by its complete primary key\n * table.get({\n * pk: \"USER#123\",\n * sk: \"PROFILE#123\"\n * })\n *\n * @example\n * // Delete a specific item by its complete primary key\n * table.delete({\n * pk: \"USER#123\",\n * sk: \"ORDER#456\"\n * })\n */\nexport type PrimaryKeyWithoutExpression = {\n /** Partition key value */\n pk: string;\n /** Optional sort key value */\n sk?: string;\n};\n","import type { ComparisonOperator, Condition, ExpressionParams, LogicalOperator } from \"./conditions\";\n\nexport const generateAttributeName = (params: ExpressionParams, attr: string): string => {\n // Check if the attribute already exists in the expressionAttributeNames\n for (const [existingName, existingAttr] of Object.entries(params.expressionAttributeNames)) {\n if (existingAttr === attr) {\n return existingName;\n }\n }\n\n // If not found, create a new attribute name\n const attrName = `#${Object.keys(params.expressionAttributeNames).length}`;\n params.expressionAttributeNames[attrName] = attr;\n return attrName;\n};\n\nexport const generateValueName = (params: ExpressionParams, value: unknown): string => {\n const valueName = `:${params.valueCounter.count++}`;\n params.expressionAttributeValues[valueName] = value;\n return valueName;\n};\n\nconst validateCondition = (condition: Condition, requiresAttr = true, requiresValue = true): void => {\n if (requiresAttr && !condition.attr) {\n throw new Error(`Attribute is required for ${condition.type} condition`);\n }\n\n if (requiresValue && condition.value === undefined) {\n throw new Error(`Value is required for ${condition.type} condition`);\n }\n};\n\nconst buildComparisonExpression = (condition: Condition, operator: string, params: ExpressionParams): string => {\n validateCondition(condition);\n\n if (!condition.attr) {\n throw new Error(`Attribute is required for ${condition.type} condition`);\n }\n\n const attrName = generateAttributeName(params, condition.attr);\n const valueName = generateValueName(params, condition.value);\n\n return `${attrName} ${operator} ${valueName}`;\n};\n\nconst buildBetweenExpression = (condition: Condition, params: ExpressionParams): string => {\n validateCondition(condition);\n\n if (!condition.attr) {\n throw new Error(`Attribute is required for ${condition.type} condition`);\n }\n\n if (!Array.isArray(condition.value) || condition.value.length !== 2) {\n throw new Error(\"Between condition requires an array of two values\");\n }\n\n const attrName = generateAttributeName(params, condition.attr);\n const lowerName = generateValueName(params, condition.value[0]);\n const upperName = generateValueName(params, condition.value[1]);\n\n return `${attrName} BETWEEN ${lowerName} AND ${upperName}`;\n};\n\nconst buildFunctionExpression = (functionName: string, condition: Condition, params: ExpressionParams): string => {\n validateCondition(condition);\n\n if (!condition.attr) {\n throw new Error(`Attribute is required for ${condition.type} condition`);\n }\n\n const attrName = generateAttributeName(params, condition.attr);\n const valueName = generateValueName(params, condition.value);\n\n return `${functionName}(${attrName}, ${valueName})`;\n};\n\nconst buildAttributeFunction = (functionName: string, condition: Condition, params: ExpressionParams): string => {\n validateCondition(condition, true, false);\n\n if (!condition.attr) {\n throw new Error(`Attribute is required for ${condition.type} condition`);\n }\n\n const attrName = generateAttributeName(params, condition.attr);\n return `${functionName}(${attrName})`;\n};\n\nconst buildLogicalExpression = (operator: string, conditions: Condition[], params: ExpressionParams): string => {\n if (!conditions || conditions.length === 0) {\n throw new Error(`At least one condition is required for ${operator} expression`);\n }\n\n const expressions = conditions.map((c) => buildExpression(c, params));\n return `(${expressions.join(` ${operator} `)})`;\n};\n\nexport const buildExpression = (condition: Condition, params: ExpressionParams): string => {\n if (!condition) return \"\";\n\n try {\n // Map of condition types to their expression builders\n const expressionBuilders: Record<ComparisonOperator | LogicalOperator, () => string> = {\n eq: () => buildComparisonExpression(condition, \"=\", params),\n ne: () => buildComparisonExpression(condition, \"<>\", params),\n lt: () => buildComparisonExpression(condition, \"<\", params),\n lte: () => buildComparisonExpression(condition, \"<=\", params),\n gt: () => buildComparisonExpression(condition, \">\", params),\n gte: () => buildComparisonExpression(condition, \">=\", params),\n between: () => buildBetweenExpression(condition, params),\n beginsWith: () => buildFunctionExpression(\"begins_with\", condition, params),\n contains: () => buildFunctionExpression(\"contains\", condition, params),\n attributeExists: () => buildAttributeFunction(\"attribute_exists\", condition, params),\n attributeNotExists: () => buildAttributeFunction(\"attribute_not_exists\", condition, params),\n and: () => {\n if (!condition.conditions) {\n throw new Error(\"Conditions array is required for AND operator\");\n }\n return buildLogicalExpression(\"AND\", condition.conditions, params);\n },\n or: () => {\n if (!condition.conditions) {\n throw new Error(\"Conditions array is required for OR operator\");\n }\n return buildLogicalExpression(\"OR\", condition.conditions, params);\n },\n not: () => {\n if (!condition.condition) {\n throw new Error(\"Condition is required for NOT operator\");\n }\n return `NOT (${buildExpression(condition.condition, params)})`;\n },\n };\n\n const builder = expressionBuilders[condition.type];\n if (!builder) {\n throw new Error(`Unknown condition type: ${condition.type}`);\n }\n\n return builder();\n } catch (error: unknown) {\n if (error instanceof Error) {\n console.error(`Error building expression for condition type ${condition.type}:`, error.message);\n } else {\n console.error(`Error building expression for condition type ${condition.type}:`, error);\n }\n throw error;\n }\n};\n\nexport const prepareExpressionParams = (\n condition?: Condition,\n): {\n expression?: string;\n names?: Record<string, string>;\n values?: Record<string, unknown>;\n} => {\n if (!condition) return {};\n\n const params: ExpressionParams = {\n expressionAttributeNames: {},\n expressionAttributeValues: {},\n valueCounter: { count: 0 },\n };\n\n const expression = buildExpression(condition, params);\n\n return {\n expression,\n names: Object.keys(params.expressionAttributeNames).length > 0 ? params.expressionAttributeNames : undefined,\n values: Object.keys(params.expressionAttributeValues).length > 0 ? params.expressionAttributeValues : undefined,\n };\n};\n","/**\n * Interface for DynamoDB command objects that can contain expressions\n */\nexport interface DynamoCommandWithExpressions {\n conditionExpression?: string;\n updateExpression?: string;\n filterExpression?: string;\n keyConditionExpression?: string;\n projectionExpression?: string;\n expressionAttributeNames?: Record<string, string>;\n expressionAttributeValues?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\ntype ReadableDynamoCommand = {\n conditionExpression?: string;\n updateExpression?: string;\n filterExpression?: string;\n keyConditionExpression?: string;\n projectionExpression?: string;\n};\n\n/**\n * Utility function to debug a DynamoDB command by replacing all placeholders\n * in expressions with their actual values.\n *\n * @param command Any DynamoDB command with expressions and attribute maps\n * @returns An object with the same structure but with readable expressions\n */\nexport function debugCommand<T extends DynamoCommandWithExpressions>(\n command: T,\n): {\n raw: T;\n readable: ReadableDynamoCommand;\n} {\n // Create a copy of the command\n const result: ReadableDynamoCommand = {};\n\n function replaceAliases(expressionString: string) {\n if (!expressionString) {\n return expressionString;\n }\n\n let replacedString = expressionString;\n for (const alias in command.expressionAttributeNames) {\n const attributeName = command.expressionAttributeNames[alias];\n const regex = new RegExp(alias, \"g\");\n\n replacedString = replacedString.replace(regex, attributeName as string);\n }\n\n for (const alias in command.expressionAttributeValues) {\n let attributeValue = command.expressionAttributeValues[alias];\n\n // Handle Set objects for better readability\n if (attributeValue instanceof Set) {\n const array = Array.from(attributeValue);\n attributeValue = `Set(${array.length}){${array.map((v) => JSON.stringify(v)).join(\", \")}}`;\n } else {\n // Stringify other values for display\n attributeValue = JSON.stringify(attributeValue);\n }\n\n const regex = new RegExp(alias, \"g\");\n replacedString = replacedString.replace(regex, attributeValue as string);\n }\n\n return replacedString;\n }\n\n if (command.updateExpression) {\n result.updateExpression = replaceAliases(command.updateExpression);\n }\n if (command.conditionExpression) {\n result.conditionExpression = replaceAliases(command.conditionExpression);\n }\n if (command.filterExpression) {\n result.filterExpression = replaceAliases(command.filterExpression);\n }\n if (command.keyConditionExpression) {\n result.keyConditionExpression = replaceAliases(command.keyConditionExpression);\n }\n if (command.projectionExpression) {\n result.projectionExpression = replaceAliases(command.projectionExpression);\n }\n\n return {\n raw: command,\n readable: result,\n };\n}\n","import type { Condition, ConditionOperator, PrimaryKeyWithoutExpression } from \"../conditions\";\nimport {\n eq,\n ne,\n lt,\n lte,\n gt,\n gte,\n between,\n beginsWith,\n contains,\n attributeExists,\n attributeNotExists,\n and,\n or,\n not,\n} from \"../conditions\";\nimport type { TransactionBuilder } from \"./transaction-builder\";\nimport { prepareExpressionParams } from \"../expression\";\nimport type { DynamoCommandWithExpressions } from \"../utils/debug-expression\";\nimport { debugCommand } from \"../utils/debug-expression\";\nimport type { ConditionCheckCommandParams } from \"./builder-types\";\n\n/**\n * Builder for creating DynamoDB condition check operations.\n * Use this builder when you need to:\n * - Verify item state without modifying it\n * - Ensure preconditions in transactions\n * - Implement optimistic locking patterns\n * - Validate business rules\n *\n * @example\n * ```typescript\n * // Check if dinosaur is ready for feeding\n * const check = new ConditionCheckBuilder('dinosaurs', { id: 'TREX-001' })\n * .condition(op =>\n * op.and([\n * op.eq('status', 'HUNTING'),\n * op.gt('stats.hunger', 80),\n * op.lt('stats.health', 100)\n * ])\n * )\n * .toDynamoCommand();\n *\n * // Check habitat security status\n * const securityCheck = new ConditionCheckBuilder('habitats', { id: 'PADDOCK-A' })\n * .condition(op =>\n * op.and([\n * op.eq('securityStatus', 'ACTIVE'),\n * op.attributeExists('lastInspection'),\n * op.lt('threatLevel', 5)\n * ])\n * )\n * .toDynamoCommand();\n * ```\n */\nexport class ConditionCheckBuilder {\n private readonly key: PrimaryKeyWithoutExpression;\n private readonly tableName: string;\n private conditionExpression?: Condition;\n\n constructor(tableName: string, key: PrimaryKeyWithoutExpression) {\n this.tableName = tableName;\n this.key = key;\n }\n\n /**\n * Adds a condition that must be satisfied for the check to succeed.\n * Use this method when you need to:\n * - Validate complex item states\n * - Check multiple attributes together\n * - Ensure safety conditions are met\n *\n * @example\n * ```typescript\n * // Check dinosaur health and behavior\n * builder.condition(op =>\n * op.and([\n * op.gt('stats.health', 50),\n * op.not(op.eq('status', 'SEDATED')),\n * op.lt('aggressionLevel', 8)\n * ])\n * );\n *\n * // Verify habitat conditions\n * builder.condition(op =>\n * op.and([\n * op.eq('powerStatus', 'ONLINE'),\n * op.between('temperature', 20, 30),\n * op.attributeExists('lastMaintenance')\n * ])\n * );\n *\n * // Check breeding conditions\n * builder.condition(op =>\n * op.and([\n * op.eq('species', 'VELOCIRAPTOR'),\n * op.gte('age', 3),\n * op.eq('geneticPurity', 100)\n * ])\n * );\n * ```\n *\n * @param condition - Either a Condition object or a callback function that builds the condition\n * @returns The builder instance for method chaining\n */\n condition<T extends Record<string, unknown>>(\n condition: Condition | ((op: ConditionOperator<T>) => Condition),\n ): ConditionCheckBuilder {\n if (typeof condition === \"function\") {\n const conditionOperator: ConditionOperator<T> = {\n eq,\n ne,\n lt,\n lte,\n gt,\n gte,\n between,\n beginsWith,\n contains,\n attributeExists,\n attributeNotExists,\n and,\n or,\n not,\n };\n this.conditionExpression = condition(conditionOperator);\n } else {\n this.conditionExpression = condition;\n }\n return this;\n }\n\n /**\n * Generates the DynamoDB command parameters for direct execution.\n * Use this method when you want to:\n * - Execute the condition check as a standalone operation\n * - Get the raw DynamoDB command for custom execution\n * - Inspect the generated command parameters\n *\n * @example\n * ```ts\n * const command = new ConditionCheckBuilder('myTable', { id: '123' })\n * .condition(op => op.attributeExists('status'))\n * .toDynamoCommand();\n * // Use command with DynamoDB client\n * ```\n *\n * @throws {Error} If no condition has been set\n * @returns The DynamoDB command parameters\n */\n private toDynamoCommand(): ConditionCheckCommandParams {\n if (!this.conditionExpression) {\n throw new Error(\"Condition is required for condition check operations\");\n }\n\n const { expression, names, values } = prepareExpressionParams(this.conditionExpression);\n\n if (!expression) {\n throw new Error(\"Failed to generate condition expression\");\n }\n\n return {\n tableName: this.tableName,\n key: this.key,\n conditionExpression: expression,\n expressionAttributeNames: names,\n expressionAttributeValues: values,\n };\n }\n\n /**\n * Adds this condition check operation to a transaction.\n * Use this method when you need to:\n * - Verify habitat safety before transfers\n * - Ensure proper feeding conditions\n * - Validate security protocols\n *\n * @example\n * ```ts\n * const transaction = new TransactionBuilder();\n * new ConditionCheckBuilder('habitats', { id: 'PADDOCK-B' })\n * .condition(op => op.and([\n * op.eq('securityStatus', 'ACTIVE'),\n * op.lt('currentOccupants', 3),\n * op.eq('habitatType', 'CARNIVORE')\n * ]))\n * .withTransaction(transaction);\n * // Add dinosaur transfer operations\n * ```\n *\n * @param transaction - The transaction builder to add this operation to\n * @throws {Error} If no condition has been set\n * @returns The builder instance for method chaining\n */\n withTransaction(transaction: TransactionBuilder): ConditionCheckBuilder {\n if (!this.conditionExpression) {\n throw new Error(\"Condition is required for condition check operations\");\n }\n\n const command = this.toDynamoCommand();\n transaction.conditionCheckWithCommand(command);\n\n return this;\n }\n\n /**\n * Gets a human-readable representation of the condition check command\n * with all expression placeholders replaced by their actual values.\n * Use this method when you need to:\n * - Debug complex condition expressions\n * - Verify condition parameters\n * - Log safety checks\n * - Troubleshoot condition failures\n *\n * @example\n * ```ts\n * const debugInfo = new ConditionCheckBuilder('dinosaurs', { id: 'TREX-001' })\n * .condition(op => op.and([\n * op.between('stats.health', 50, 100),\n * op.not(op.eq('status', 'SEDATED')),\n * op.attributeExists('lastFeedingTime')\n * op.eq('version', 1)\n * ]))\n * .debug();\n * console.log(debugInfo);\n * ```\n *\n * @returns A readable representation of the condition check command with resolved expressions\n */\n debug(): Record<string, unknown> {\n const command = this.toDynamoCommand();\n return debugCommand(command);\n }\n}\n"]}