dyno-table 1.5.0 → 1.7.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 (72) hide show
  1. package/README.md +368 -186
  2. package/dist/batch-builder-DNsz6zvh.d.cts +398 -0
  3. package/dist/batch-builder-Dz1yPGrJ.d.ts +398 -0
  4. package/dist/builders/condition-check-builder.cjs +0 -13
  5. package/dist/builders/condition-check-builder.cjs.map +1 -1
  6. package/dist/builders/condition-check-builder.d.cts +0 -13
  7. package/dist/builders/condition-check-builder.d.ts +0 -13
  8. package/dist/builders/condition-check-builder.js +0 -13
  9. package/dist/builders/condition-check-builder.js.map +1 -1
  10. package/dist/builders/delete-builder.cjs +38 -0
  11. package/dist/builders/delete-builder.cjs.map +1 -1
  12. package/dist/builders/delete-builder.d.cts +36 -0
  13. package/dist/builders/delete-builder.d.ts +36 -0
  14. package/dist/builders/delete-builder.js +38 -0
  15. package/dist/builders/delete-builder.js.map +1 -1
  16. package/dist/builders/paginator.cjs +0 -24
  17. package/dist/builders/paginator.cjs.map +1 -1
  18. package/dist/builders/paginator.d.cts +0 -24
  19. package/dist/builders/paginator.d.ts +0 -24
  20. package/dist/builders/paginator.js +0 -24
  21. package/dist/builders/paginator.js.map +1 -1
  22. package/dist/builders/put-builder.cjs +39 -8
  23. package/dist/builders/put-builder.cjs.map +1 -1
  24. package/dist/builders/put-builder.d.cts +37 -8
  25. package/dist/builders/put-builder.d.ts +37 -8
  26. package/dist/builders/put-builder.js +39 -8
  27. package/dist/builders/put-builder.js.map +1 -1
  28. package/dist/builders/query-builder.cjs +0 -53
  29. package/dist/builders/query-builder.cjs.map +1 -1
  30. package/dist/builders/query-builder.d.cts +1 -1
  31. package/dist/builders/query-builder.d.ts +1 -1
  32. package/dist/builders/query-builder.js +0 -53
  33. package/dist/builders/query-builder.js.map +1 -1
  34. package/dist/builders/transaction-builder.cjs +0 -47
  35. package/dist/builders/transaction-builder.cjs.map +1 -1
  36. package/dist/builders/transaction-builder.d.cts +0 -47
  37. package/dist/builders/transaction-builder.d.ts +0 -47
  38. package/dist/builders/transaction-builder.js +0 -47
  39. package/dist/builders/transaction-builder.js.map +1 -1
  40. package/dist/builders/update-builder.cjs +2 -2
  41. package/dist/builders/update-builder.cjs.map +1 -1
  42. package/dist/builders/update-builder.d.cts +2 -2
  43. package/dist/builders/update-builder.d.ts +2 -2
  44. package/dist/builders/update-builder.js +2 -2
  45. package/dist/builders/update-builder.js.map +1 -1
  46. package/dist/conditions.cjs.map +1 -1
  47. package/dist/conditions.js.map +1 -1
  48. package/dist/entity.cjs +162 -86
  49. package/dist/entity.cjs.map +1 -1
  50. package/dist/entity.d.cts +39 -15
  51. package/dist/entity.d.ts +39 -15
  52. package/dist/entity.js +162 -86
  53. package/dist/entity.js.map +1 -1
  54. package/dist/index.cjs +623 -231
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.cts +3 -2
  57. package/dist/index.d.ts +3 -2
  58. package/dist/index.js +622 -232
  59. package/dist/index.js.map +1 -1
  60. package/dist/{query-builder-CbHvimBk.d.cts → query-builder-BDuHHrb-.d.cts} +0 -34
  61. package/dist/{query-builder-BhrR31oO.d.ts → query-builder-C6XjVEFH.d.ts} +0 -34
  62. package/dist/{table-Des8C2od.d.ts → table-BWa4tx63.d.ts} +39 -151
  63. package/dist/{table-CY9byPEg.d.cts → table-DAKlzQsK.d.cts} +39 -151
  64. package/dist/table.cjs +459 -145
  65. package/dist/table.cjs.map +1 -1
  66. package/dist/table.d.cts +3 -2
  67. package/dist/table.d.ts +3 -2
  68. package/dist/table.js +459 -145
  69. package/dist/table.js.map +1 -1
  70. package/dist/utils.cjs.map +1 -1
  71. package/dist/utils.js.map +1 -1
  72. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/conditions.ts","../../src/expression.ts","../../src/utils/debug-expression.ts","../../src/builders/delete-builder.ts"],"names":[],"mappings":";AAiGO,IAAM,yBACX,GAAA,CAAC,IACD,KAA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AAEpF,IAAO,OAAA;AAAA,MACL,WAAW,IAAK,CAAA,SAAA;AAAA,MAChB,KAAK,IAAK,CAAA,GAAA;AAAA,MACV,mBAAqB,EAAA,UAAA;AAAA,MACrB,wBAA0B,EAAA,KAAA;AAAA,MAC1B,yBAA2B,EAAA,MAAA;AAAA,MAC3B,YAAA,EAAc,KAAK,OAAQ,CAAA;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,EAyBO,gBAAgB,WAAiC,EAAA;AACtD,IAAM,MAAA,OAAA,GAAU,KAAK,eAAgB,EAAA;AAErC,IAAA,WAAA,CAAY,kBAAkB,OAAO,CAAA;AAAA;AACvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBA,MAAa,OAA0C,GAAA;AACrD,IAAM,MAAA,MAAA,GAAS,KAAK,eAAgB,EAAA;AACpC,IAAO,OAAA,IAAA,CAAK,SAAS,MAAM,CAAA;AAAA;AAC7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBA,KAAoB,GAAA;AAClB,IAAM,MAAA,OAAA,GAAU,KAAK,eAAgB,EAAA;AACrC,IAAA,OAAO,aAAa,OAAO,CAAA;AAAA;AAE/B","file":"delete-builder.js","sourcesContent":["import type { Path, PathType } from \"./builders/types\";\nimport type { DynamoItem } from \"./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 * - in: Checks if attribute value is in a list of values\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 | \"in\"\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: DynamoItem;\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 an in condition that checks if a value is in a list of values\n * @example\n * inArray(\"status\", [\"ACTIVE\", \"PENDING\", \"PROCESSING\"]) // status IN (\"ACTIVE\", \"PENDING\", \"PROCESSING\")\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - IN}\n */\nexport const inArray = (attr: string, values: unknown[]): Condition => ({\n type: \"in\",\n attr,\n value: values,\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 DynamoItem> = {\n /**\n * Creates an equals (=) condition for type-safe attribute comparison.\n * Tests if the specified attribute equals the provided value.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr equals value\n *\n * @example\n * ```typescript\n * interface User { status: string; age: number; }\n *\n * // String comparison\n * op.eq(\"status\", \"ACTIVE\") // status = \"ACTIVE\"\n *\n * // Numeric comparison\n * op.eq(\"age\", 25) // age = 25\n *\n * // Nested attribute\n * op.eq(\"profile.role\", \"admin\") // profile.role = \"admin\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n eq: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a not equals (≠ / <>) condition for type-safe attribute comparison.\n * Tests if the specified attribute does not equal the provided value.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr does not equal value\n *\n * @example\n * ```typescript\n * interface User { status: string; priority: number; }\n *\n * // String comparison\n * op.ne(\"status\", \"DELETED\") // status <> \"DELETED\"\n *\n * // Numeric comparison\n * op.ne(\"priority\", 0) // priority <> 0\n *\n * // Useful for filtering out specific values\n * op.ne(\"category\", \"ARCHIVED\") // category <> \"ARCHIVED\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n ne: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a less than (<) condition for type-safe attribute comparison.\n * Tests if the specified attribute is less than the provided value.\n * Works with numbers, strings (lexicographic), and dates.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr is less than value\n *\n * @example\n * ```typescript\n * interface Product { price: number; name: string; createdAt: string; }\n *\n * // Numeric comparison\n * op.lt(\"price\", 100) // price < 100\n *\n * // String comparison (lexicographic)\n * op.lt(\"name\", \"M\") // name < \"M\" (names starting with A-L)\n *\n * // Date comparison (ISO strings)\n * op.lt(\"createdAt\", \"2024-01-01\") // createdAt < \"2024-01-01\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n lt: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a less than or equal to (≤) condition for type-safe attribute comparison.\n * Tests if the specified attribute is less than or equal to the provided value.\n * Works with numbers, strings (lexicographic), and dates.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr is less than or equal to value\n *\n * @example\n * ```typescript\n * interface Order { total: number; priority: number; dueDate: string; }\n *\n * // Numeric comparison\n * op.lte(\"total\", 1000) // total <= 1000\n *\n * // Priority levels\n * op.lte(\"priority\", 3) // priority <= 3 (low to medium priority)\n *\n * // Date deadlines\n * op.lte(\"dueDate\", \"2024-12-31\") // dueDate <= \"2024-12-31\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n lte: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a greater than (>) condition for type-safe attribute comparison.\n * Tests if the specified attribute is greater than the provided value.\n * Works with numbers, strings (lexicographic), and dates.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr is greater than value\n *\n * @example\n * ```typescript\n * interface User { age: number; score: number; lastLogin: string; }\n *\n * // Age restrictions\n * op.gt(\"age\", 18) // age > 18 (adults only)\n *\n * // Performance thresholds\n * op.gt(\"score\", 85) // score > 85 (high performers)\n *\n * // Recent activity\n * op.gt(\"lastLogin\", \"2024-01-01\") // lastLogin > \"2024-01-01\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n gt: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a greater than or equal to (≥) condition for type-safe attribute comparison.\n * Tests if the specified attribute is greater than or equal to the provided value.\n * Works with numbers, strings (lexicographic), and dates.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr is greater than or equal to value\n *\n * @example\n * ```typescript\n * interface Product { rating: number; version: string; releaseDate: string; }\n *\n * // Minimum ratings\n * op.gte(\"rating\", 4.0) // rating >= 4.0 (highly rated)\n *\n * // Version requirements\n * op.gte(\"version\", \"2.0.0\") // version >= \"2.0.0\"\n *\n * // Release date filters\n * op.gte(\"releaseDate\", \"2024-01-01\") // releaseDate >= \"2024-01-01\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n gte: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a between condition for type-safe range comparison.\n * Tests if the specified attribute value falls within the inclusive range [lower, upper].\n * Works with numbers, strings (lexicographic), and dates.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param lower - The lower bound of the range (inclusive, must match attribute type)\n * @param upper - The upper bound of the range (inclusive, must match attribute type)\n * @returns A condition that evaluates to true when lower ≤ attr ≤ upper\n *\n * @example\n * ```typescript\n * interface Event { price: number; date: string; priority: number; }\n *\n * // Price range\n * op.between(\"price\", 50, 200) // price BETWEEN 50 AND 200\n *\n * // Date range\n * op.between(\"date\", \"2024-01-01\", \"2024-12-31\") // date BETWEEN \"2024-01-01\" AND \"2024-12-31\"\n *\n * // Priority levels\n * op.between(\"priority\", 1, 5) // priority BETWEEN 1 AND 5\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - BETWEEN}\n */\n between: <K extends Path<T>>(attr: K, lower: PathType<T, K>, upper: PathType<T, K>) => Condition;\n\n /**\n * Creates an IN condition for type-safe list membership testing.\n * Tests if the specified attribute value matches any value in the provided list.\n * Supports up to 100 values in the list as per DynamoDB limitations.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param values - Array of values to test against (must match attribute type, max 100 items)\n * @returns A condition that evaluates to true when attr matches any value in the list\n *\n * @example\n * ```typescript\n * interface User { status: string; role: string; priority: number; }\n *\n * // Status filtering\n * op.inArray(\"status\", [\"ACTIVE\", \"PENDING\", \"PROCESSING\"]) // status IN (\"ACTIVE\", \"PENDING\", \"PROCESSING\")\n *\n * // Role-based access\n * op.inArray(\"role\", [\"admin\", \"moderator\", \"editor\"]) // role IN (\"admin\", \"moderator\", \"editor\")\n *\n * // Priority levels\n * op.inArray(\"priority\", [1, 2, 3]) // priority IN (1, 2, 3)\n * ```\n *\n * @throws {Error} When values array is empty or contains more than 100 items\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - IN}\n */\n inArray: <K extends Path<T>>(attr: K, values: PathType<T, K>[]) => Condition;\n\n /**\n * Creates a begins_with condition for type-safe string prefix testing.\n * Tests if the specified string attribute starts with the provided substring.\n * Only works with string attributes - will fail on other data types.\n *\n * @param attr - The string attribute path to test (with full type safety)\n * @param value - The prefix string to test for (must match attribute type)\n * @returns A condition that evaluates to true when attr starts with value\n *\n * @example\n * ```typescript\n * interface User { email: string; name: string; id: string; }\n *\n * // Email domain filtering\n * op.beginsWith(\"email\", \"admin@\") // begins_with(email, \"admin@\")\n *\n * // Name prefix search\n * op.beginsWith(\"name\", \"John\") // begins_with(name, \"John\")\n *\n * // ID pattern matching\n * op.beginsWith(\"id\", \"USER#\") // begins_with(id, \"USER#\")\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - begins_with}\n */\n beginsWith: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a contains condition for type-safe substring or set membership testing.\n * For strings: tests if the attribute contains the specified substring.\n * For sets: tests if the set contains the specified element.\n *\n * @param attr - The attribute path to test (with full type safety)\n * @param value - The substring or element to search for (must match attribute type)\n * @returns A condition that evaluates to true when attr contains value\n *\n * @example\n * ```typescript\n * interface Post { content: string; tags: Set<string>; categories: string[]; }\n *\n * // Substring search in content\n * op.contains(\"content\", \"important\") // contains(content, \"important\")\n *\n * // Tag membership (for DynamoDB String Sets)\n * op.contains(\"tags\", \"featured\") // contains(tags, \"featured\")\n *\n * // Category search (for string arrays stored as lists)\n * op.contains(\"categories\", \"technology\") // contains(categories, \"technology\")\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - contains}\n */\n contains: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates an attribute_exists condition for type-safe attribute presence testing.\n * Tests if the specified attribute exists in the item, regardless of its value.\n * Useful for filtering items that have optional attributes populated.\n *\n * @param attr - The attribute path to test for existence (with full type safety)\n * @returns A condition that evaluates to true when the attribute exists\n *\n * @example\n * ```typescript\n * interface User { email: string; phone?: string; profile?: { avatar?: string; }; }\n *\n * // Check for optional fields\n * op.attributeExists(\"phone\") // attribute_exists(phone)\n *\n * // Check for nested optional attributes\n * op.attributeExists(\"profile.avatar\") // attribute_exists(profile.avatar)\n *\n * // Useful in combination with other conditions\n * op.and(\n * op.eq(\"status\", \"ACTIVE\"),\n * op.attributeExists(\"email\") // Only active users with email\n * )\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - attribute_exists}\n */\n attributeExists: <K extends Path<T>>(attr: K) => Condition;\n\n /**\n * Creates an attribute_not_exists condition for type-safe attribute absence testing.\n * Tests if the specified attribute does not exist in the item.\n * Useful for conditional writes to prevent overwriting existing data.\n *\n * @param attr - The attribute path to test for absence (with full type safety)\n * @returns A condition that evaluates to true when the attribute does not exist\n *\n * @example\n * ```typescript\n * interface User { id: string; email: string; deletedAt?: string; }\n *\n * // Ensure item hasn't been soft-deleted\n * op.attributeNotExists(\"deletedAt\") // attribute_not_exists(deletedAt)\n *\n * // Prevent duplicate creation\n * op.attributeNotExists(\"id\") // attribute_not_exists(id)\n *\n * // Conditional updates\n * op.and(\n * op.eq(\"status\", \"PENDING\"),\n * op.attributeNotExists(\"processedAt\") // Only unprocessed items\n * )\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - attribute_not_exists}\n */\n attributeNotExists: <K extends Path<T>>(attr: K) => Condition;\n\n /**\n * Combines multiple conditions with logical AND operator.\n * All provided conditions must evaluate to true for the AND condition to be true.\n * Supports any number of conditions as arguments.\n *\n * @param conditions - Variable number of conditions to combine with AND\n * @returns A condition that evaluates to true when all input conditions are true\n *\n * @example\n * ```typescript\n * interface User { status: string; age: number; role: string; verified: boolean; }\n *\n * // Multiple criteria\n * op.and(\n * op.eq(\"status\", \"ACTIVE\"),\n * op.gt(\"age\", 18),\n * op.eq(\"verified\", true)\n * ) // status = \"ACTIVE\" AND age > 18 AND verified = true\n *\n * // Complex business logic\n * op.and(\n * op.inArray(\"role\", [\"admin\", \"moderator\"]),\n * op.attributeExists(\"permissions\"),\n * op.ne(\"status\", \"SUSPENDED\")\n * )\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Logical AWS DynamoDB - AND}\n */\n and: (...conditions: Condition[]) => Condition;\n\n /**\n * Combines multiple conditions with logical OR operator.\n * At least one of the provided conditions must evaluate to true for the OR condition to be true.\n * Supports any number of conditions as arguments.\n *\n * @param conditions - Variable number of conditions to combine with OR\n * @returns A condition that evaluates to true when any input condition is true\n *\n * @example\n * ```typescript\n * interface Order { status: string; priority: string; urgent: boolean; }\n *\n * // Alternative statuses\n * op.or(\n * op.eq(\"status\", \"PENDING\"),\n * op.eq(\"status\", \"PROCESSING\"),\n * op.eq(\"status\", \"SHIPPED\")\n * ) // status = \"PENDING\" OR status = \"PROCESSING\" OR status = \"SHIPPED\"\n *\n * // High priority items\n * op.or(\n * op.eq(\"priority\", \"HIGH\"),\n * op.eq(\"urgent\", true)\n * )\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Logical AWS DynamoDB - OR}\n */\n or: (...conditions: Condition[]) => Condition;\n\n /**\n * Negates a condition with logical NOT operator.\n * Inverts the boolean result of the provided condition.\n *\n * @param condition - The condition to negate\n * @returns A condition that evaluates to true when the input condition is false\n *\n * @example\n * ```typescript\n * interface User { status: string; role: string; banned: boolean; }\n *\n * // Exclude specific status\n * op.not(op.eq(\"status\", \"DELETED\")) // NOT status = \"DELETED\"\n *\n * // Complex negation\n * op.not(\n * op.and(\n * op.eq(\"role\", \"guest\"),\n * op.eq(\"banned\", true)\n * )\n * ) // NOT (role = \"guest\" AND banned = true)\n *\n * // Exclude multiple values\n * op.not(op.inArray(\"status\", [\"DELETED\", \"ARCHIVED\"]))\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Logical AWS DynamoDB - NOT}\n */\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 buildInExpression = (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 === 0) {\n throw new Error(\"In condition requires a non-empty array of values\");\n }\n\n if (condition.value.length > 100) {\n throw new Error(\"In condition supports a maximum of 100 values\");\n }\n\n const attrName = generateAttributeName(params, condition.attr);\n const valueNames = condition.value.map((value) => generateValueName(params, value));\n\n return `${attrName} IN (${valueNames.join(\", \")})`;\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 in: () => buildInExpression(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 inArray,\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 { debugCommand } from \"../utils/debug-expression\";\nimport type { DeleteCommandParams } from \"./builder-types\";\nimport type { DynamoItem } from \"../types\";\n\nexport interface DeleteOptions {\n condition?: Condition;\n returnValues?: \"ALL_OLD\";\n}\n\ntype DeleteExecutor = (params: DeleteCommandParams) => Promise<{ item?: DynamoItem }>;\n\n/**\n * Builder for creating DynamoDB delete operations.\n *\n * @example\n * ```typescript\n * // Simple delete\n * const result = await new DeleteBuilder(executor, 'dinosaurs', { id: 'TREX-001' })\n * .execute();\n *\n * // Conditional delete with old value retrieval\n * const result = await new DeleteBuilder(executor, 'habitats', { id: 'PADDOCK-A' })\n * .condition(op =>\n * op.and([\n * op.eq('status', 'DECOMMISSIONED'),\n * op.eq('occupants', 0),\n * op.lt('securityIncidents', 1)\n * ])\n * )\n * .returnValues('ALL_OLD')\n * .execute();\n * ```\n */\nexport class DeleteBuilder {\n private options: DeleteOptions = {\n returnValues: \"ALL_OLD\",\n };\n private readonly executor: DeleteExecutor;\n private readonly tableName: string;\n private readonly key: PrimaryKeyWithoutExpression;\n\n constructor(executor: DeleteExecutor, tableName: string, key: PrimaryKeyWithoutExpression) {\n this.executor = executor;\n this.tableName = tableName;\n this.key = key;\n }\n\n /**\n * Adds a condition that must be satisfied for the delete operation to succeed.\n *\n * @example\n * ```typescript\n * // Ensure dinosaur can be safely removed\n * builder.condition(op =>\n * op.and([\n * op.eq('status', 'SEDATED'),\n * op.eq('location', 'MEDICAL_BAY'),\n * op.attributeExists('lastCheckup')\n * ])\n * );\n *\n * // Verify habitat is empty\n * builder.condition(op =>\n * op.and([\n * op.eq('occupants', 0),\n * op.eq('maintenanceStatus', 'COMPLETE'),\n * op.not(op.attributeExists('activeAlerts'))\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 public condition<T extends DynamoItem>(\n condition: Condition | ((op: ConditionOperator<T>) => Condition),\n ): DeleteBuilder {\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 inArray,\n beginsWith,\n contains,\n attributeExists,\n attributeNotExists,\n and,\n or,\n not,\n };\n this.options.condition = condition(conditionOperator);\n } else {\n this.options.condition = condition;\n }\n return this;\n }\n\n /**\n * Sets whether to return the item's attribute values before deletion.\n *\n * @example\n * ```ts\n * // Archive dinosaur data before removal\n * const result = await builder\n * .returnValues('ALL_OLD')\n * .execute();\n *\n * if (result.item) {\n * console.log('Removed dinosaur data:', {\n * species: result.item.species,\n * age: result.item.age,\n * lastLocation: result.item.location\n * });\n * }\n * ```\n *\n * @param returnValues - Use 'ALL_OLD' to return all attributes of the deleted item\n * @returns The builder instance for method chaining\n */\n public returnValues(returnValues: \"ALL_OLD\"): DeleteBuilder {\n this.options.returnValues = returnValues;\n return this;\n }\n\n /**\n * Generate the DynamoDB command parameters\n */\n private toDynamoCommand(): DeleteCommandParams {\n const { expression, names, values } = prepareExpressionParams(this.options.condition);\n\n return {\n tableName: this.tableName,\n key: this.key,\n conditionExpression: expression,\n expressionAttributeNames: names,\n expressionAttributeValues: values,\n returnValues: this.options.returnValues,\n };\n }\n\n /**\n * Adds this delete operation to a transaction.\n *\n * @example\n * ```ts\n * const transaction = new TransactionBuilder();\n *\n * // Remove dinosaur from old habitat\n * new DeleteBuilder(executor, 'dinosaurs', { id: 'RAPTOR-001' })\n * .condition(op => op.eq('status', 'SEDATED'))\n * .withTransaction(transaction);\n *\n * // Update old habitat occupancy\n * new UpdateBuilder(executor, 'habitats', { id: 'PADDOCK-A' })\n * .add('occupants', -1)\n * .withTransaction(transaction);\n *\n * // Execute transfer atomically\n * await transaction.execute();\n * ```\n *\n * @param transaction - The transaction builder to add this operation to\n */\n public withTransaction(transaction: TransactionBuilder) {\n const command = this.toDynamoCommand();\n\n transaction.deleteWithCommand(command);\n }\n\n /**\n * Executes the delete operation against DynamoDB.\n *\n * @example\n * ```ts\n * // Delete with condition and retrieve old values\n * const result = await new DeleteBuilder(executor, 'myTable', { id: '123' })\n * .condition(op => op.eq('status', 'INACTIVE'))\n * .returnValues('ALL_OLD')\n * .execute();\n *\n * if (result.item) {\n * console.log('Deleted item:', result.item);\n * }\n * ```\n *\n * @returns A promise that resolves to an object containing the deleted item's attributes (if returnValues is 'ALL_OLD')\n */\n public async execute(): Promise<{ item?: DynamoItem }> {\n const params = this.toDynamoCommand();\n return this.executor(params);\n }\n\n /**\n * Gets a human-readable representation of the delete command\n * with all expression placeholders replaced by their actual values.\n *\n * @example\n * ```ts\n * const debugInfo = new DeleteBuilder(executor, 'dinosaurs', { id: 'TREX-001' })\n * .condition(op => op.and([\n * op.eq('status', 'SEDATED'),\n * op.eq('location', 'MEDICAL_BAY'),\n * op.gt('sedationLevel', 8)\n * op.eq('version', 1),\n * op.attributeExists('status')\n * ]))\n * .debug();\n *\n * console.log('Delete command:', debugInfo);\n * ```\n *\n * @returns A readable representation of the delete command with resolved expressions\n */\n debug(): DynamoItem {\n const command = this.toDynamoCommand();\n return debugCommand(command);\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/conditions.ts","../../src/expression.ts","../../src/utils/debug-expression.ts","../../src/builders/delete-builder.ts"],"names":[],"mappings":";AAiGO,IAAM,yBAAA,GACX,CAAC,IAAA,KACD,CAAC,MAAc,KAAA,MAA+B;AAAA,EAC5C,IAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAA,CAAA;AAQK,IAAM,EAAA,GAAK,0BAA0B,IAAI,CAAA;AAQzC,IAAM,EAAA,GAAK,0BAA0B,IAAI,CAAA;AAQzC,IAAM,EAAA,GAAK,0BAA0B,IAAI,CAAA;AAQzC,IAAM,GAAA,GAAM,0BAA0B,KAAK,CAAA;AAQ3C,IAAM,EAAA,GAAK,0BAA0B,IAAI,CAAA;AAQzC,IAAM,GAAA,GAAM,0BAA0B,KAAK,CAAA;AAQ3C,IAAM,OAAA,GAAU,CAAC,IAAA,EAAc,KAAA,EAAgB,KAAA,MAA+B;AAAA,EACnF,IAAA,EAAM,SAAA;AAAA,EACN,IAAA;AAAA,EACA,KAAA,EAAO,CAAC,KAAA,EAAO,KAAK;AACtB,CAAA,CAAA;AAQO,IAAM,OAAA,GAAU,CAAC,IAAA,EAAc,MAAA,MAAkC;AAAA,EACtE,IAAA,EAAM,IAAA;AAAA,EACN,IAAA;AAAA,EACA,KAAA,EAAO;AACT,CAAA,CAAA;AAQO,IAAM,UAAA,GAAa,0BAA0B,YAAY,CAAA;AAQzD,IAAM,QAAA,GAAW,0BAA0B,UAAU,CAAA;AAQrD,IAAM,eAAA,GAAkB,CAAC,IAAA,MAA6B;AAAA,EAC3D,IAAA,EAAM,iBAAA;AAAA,EACN;AACF,CAAA,CAAA;AAQO,IAAM,kBAAA,GAAqB,CAAC,IAAA,MAA6B;AAAA,EAC9D,IAAA,EAAM,oBAAA;AAAA,EACN;AACF,CAAA,CAAA;AAaO,IAAM,GAAA,GAAM,IAAI,UAAA,MAAw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AACrC,IAAA,KAAA,CAAM,iBAAA,CAAkB,SAAS,UAAU,CAAA;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBA,MAAa,OAAA,GAA0C;AACrD,IAAA,MAAM,MAAA,GAAS,KAAK,eAAA,EAAgB;AACpC,IAAA,OAAO,IAAA,CAAK,SAAS,MAAM,CAAA;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBA,KAAA,GAAoB;AAClB,IAAA,MAAM,OAAA,GAAU,KAAK,eAAA,EAAgB;AACrC,IAAA,OAAO,aAAa,OAAO,CAAA;AAAA,EAC7B;AACF","file":"delete-builder.js","sourcesContent":["import type { Path, PathType } from \"./builders/types\";\nimport type { DynamoItem } from \"./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 * - in: Checks if attribute value is in a list of values\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 | \"in\"\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: DynamoItem;\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 an in condition that checks if a value is in a list of values\n * @example\n * inArray(\"status\", [\"ACTIVE\", \"PENDING\", \"PROCESSING\"]) // status IN (\"ACTIVE\", \"PENDING\", \"PROCESSING\")\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - IN}\n */\nexport const inArray = (attr: string, values: unknown[]): Condition => ({\n type: \"in\",\n attr,\n value: values,\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 DynamoItem> = {\n /**\n * Creates an equals (=) condition for type-safe attribute comparison.\n * Tests if the specified attribute equals the provided value.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr equals value\n *\n * @example\n * ```typescript\n * interface User { status: string; age: number; }\n *\n * // String comparison\n * op.eq(\"status\", \"ACTIVE\") // status = \"ACTIVE\"\n *\n * // Numeric comparison\n * op.eq(\"age\", 25) // age = 25\n *\n * // Nested attribute\n * op.eq(\"profile.role\", \"admin\") // profile.role = \"admin\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n eq: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a not equals (≠ / <>) condition for type-safe attribute comparison.\n * Tests if the specified attribute does not equal the provided value.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr does not equal value\n *\n * @example\n * ```typescript\n * interface User { status: string; priority: number; }\n *\n * // String comparison\n * op.ne(\"status\", \"DELETED\") // status <> \"DELETED\"\n *\n * // Numeric comparison\n * op.ne(\"priority\", 0) // priority <> 0\n *\n * // Useful for filtering out specific values\n * op.ne(\"category\", \"ARCHIVED\") // category <> \"ARCHIVED\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n ne: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a less than (<) condition for type-safe attribute comparison.\n * Tests if the specified attribute is less than the provided value.\n * Works with numbers, strings (lexicographic), and dates.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr is less than value\n *\n * @example\n * ```typescript\n * interface Product { price: number; name: string; createdAt: string; }\n *\n * // Numeric comparison\n * op.lt(\"price\", 100) // price < 100\n *\n * // String comparison (lexicographic)\n * op.lt(\"name\", \"M\") // name < \"M\" (names starting with A-L)\n *\n * // Date comparison (ISO strings)\n * op.lt(\"createdAt\", \"2024-01-01\") // createdAt < \"2024-01-01\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n lt: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a less than or equal to (≤) condition for type-safe attribute comparison.\n * Tests if the specified attribute is less than or equal to the provided value.\n * Works with numbers, strings (lexicographic), and dates.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr is less than or equal to value\n *\n * @example\n * ```typescript\n * interface Order { total: number; priority: number; dueDate: string; }\n *\n * // Numeric comparison\n * op.lte(\"total\", 1000) // total <= 1000\n *\n * // Priority levels\n * op.lte(\"priority\", 3) // priority <= 3 (low to medium priority)\n *\n * // Date deadlines\n * op.lte(\"dueDate\", \"2024-12-31\") // dueDate <= \"2024-12-31\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n lte: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a greater than (>) condition for type-safe attribute comparison.\n * Tests if the specified attribute is greater than the provided value.\n * Works with numbers, strings (lexicographic), and dates.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr is greater than value\n *\n * @example\n * ```typescript\n * interface User { age: number; score: number; lastLogin: string; }\n *\n * // Age restrictions\n * op.gt(\"age\", 18) // age > 18 (adults only)\n *\n * // Performance thresholds\n * op.gt(\"score\", 85) // score > 85 (high performers)\n *\n * // Recent activity\n * op.gt(\"lastLogin\", \"2024-01-01\") // lastLogin > \"2024-01-01\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n gt: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a greater than or equal to (≥) condition for type-safe attribute comparison.\n * Tests if the specified attribute is greater than or equal to the provided value.\n * Works with numbers, strings (lexicographic), and dates.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param value - The value to compare against (must match attribute type)\n * @returns A condition that evaluates to true when attr is greater than or equal to value\n *\n * @example\n * ```typescript\n * interface Product { rating: number; version: string; releaseDate: string; }\n *\n * // Minimum ratings\n * op.gte(\"rating\", 4.0) // rating >= 4.0 (highly rated)\n *\n * // Version requirements\n * op.gte(\"version\", \"2.0.0\") // version >= \"2.0.0\"\n *\n * // Release date filters\n * op.gte(\"releaseDate\", \"2024-01-01\") // releaseDate >= \"2024-01-01\"\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - Comparison Operators}\n */\n gte: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a between condition for type-safe range comparison.\n * Tests if the specified attribute value falls within the inclusive range [lower, upper].\n * Works with numbers, strings (lexicographic), and dates.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param lower - The lower bound of the range (inclusive, must match attribute type)\n * @param upper - The upper bound of the range (inclusive, must match attribute type)\n * @returns A condition that evaluates to true when lower ≤ attr ≤ upper\n *\n * @example\n * ```typescript\n * interface Event { price: number; date: string; priority: number; }\n *\n * // Price range\n * op.between(\"price\", 50, 200) // price BETWEEN 50 AND 200\n *\n * // Date range\n * op.between(\"date\", \"2024-01-01\", \"2024-12-31\") // date BETWEEN \"2024-01-01\" AND \"2024-12-31\"\n *\n * // Priority levels\n * op.between(\"priority\", 1, 5) // priority BETWEEN 1 AND 5\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - BETWEEN}\n */\n between: <K extends Path<T>>(attr: K, lower: PathType<T, K>, upper: PathType<T, K>) => Condition;\n\n /**\n * Creates an IN condition for type-safe list membership testing.\n * Tests if the specified attribute value matches any value in the provided list.\n * Supports up to 100 values in the list as per DynamoDB limitations.\n *\n * @param attr - The attribute path to compare (with full type safety)\n * @param values - Array of values to test against (must match attribute type, max 100 items)\n * @returns A condition that evaluates to true when attr matches any value in the list\n *\n * @example\n * ```typescript\n * interface User { status: string; role: string; priority: number; }\n *\n * // Status filtering\n * op.inArray(\"status\", [\"ACTIVE\", \"PENDING\", \"PROCESSING\"]) // status IN (\"ACTIVE\", \"PENDING\", \"PROCESSING\")\n *\n * // Role-based access\n * op.inArray(\"role\", [\"admin\", \"moderator\", \"editor\"]) // role IN (\"admin\", \"moderator\", \"editor\")\n *\n * // Priority levels\n * op.inArray(\"priority\", [1, 2, 3]) // priority IN (1, 2, 3)\n * ```\n *\n * @throws {Error} When values array is empty or contains more than 100 items\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Comparators AWS DynamoDB - IN}\n */\n inArray: <K extends Path<T>>(attr: K, values: PathType<T, K>[]) => Condition;\n\n /**\n * Creates a begins_with condition for type-safe string prefix testing.\n * Tests if the specified string attribute starts with the provided substring.\n * Only works with string attributes - will fail on other data types.\n *\n * @param attr - The string attribute path to test (with full type safety)\n * @param value - The prefix string to test for (must match attribute type)\n * @returns A condition that evaluates to true when attr starts with value\n *\n * @example\n * ```typescript\n * interface User { email: string; name: string; id: string; }\n *\n * // Email domain filtering\n * op.beginsWith(\"email\", \"admin@\") // begins_with(email, \"admin@\")\n *\n * // Name prefix search\n * op.beginsWith(\"name\", \"John\") // begins_with(name, \"John\")\n *\n * // ID pattern matching\n * op.beginsWith(\"id\", \"USER#\") // begins_with(id, \"USER#\")\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - begins_with}\n */\n beginsWith: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates a contains condition for type-safe substring or set membership testing.\n * For strings: tests if the attribute contains the specified substring.\n * For sets: tests if the set contains the specified element.\n *\n * @param attr - The attribute path to test (with full type safety)\n * @param value - The substring or element to search for (must match attribute type)\n * @returns A condition that evaluates to true when attr contains value\n *\n * @example\n * ```typescript\n * interface Post { content: string; tags: Set<string>; categories: string[]; }\n *\n * // Substring search in content\n * op.contains(\"content\", \"important\") // contains(content, \"important\")\n *\n * // Tag membership (for DynamoDB String Sets)\n * op.contains(\"tags\", \"featured\") // contains(tags, \"featured\")\n *\n * // Category search (for string arrays stored as lists)\n * op.contains(\"categories\", \"technology\") // contains(categories, \"technology\")\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - contains}\n */\n contains: <K extends Path<T>>(attr: K, value: PathType<T, K>) => Condition;\n\n /**\n * Creates an attribute_exists condition for type-safe attribute presence testing.\n * Tests if the specified attribute exists in the item, regardless of its value.\n * Useful for filtering items that have optional attributes populated.\n *\n * @param attr - The attribute path to test for existence (with full type safety)\n * @returns A condition that evaluates to true when the attribute exists\n *\n * @example\n * ```typescript\n * interface User { email: string; phone?: string; profile?: { avatar?: string; }; }\n *\n * // Check for optional fields\n * op.attributeExists(\"phone\") // attribute_exists(phone)\n *\n * // Check for nested optional attributes\n * op.attributeExists(\"profile.avatar\") // attribute_exists(profile.avatar)\n *\n * // Useful in combination with other conditions\n * op.and(\n * op.eq(\"status\", \"ACTIVE\"),\n * op.attributeExists(\"email\") // Only active users with email\n * )\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - attribute_exists}\n */\n attributeExists: <K extends Path<T>>(attr: K) => Condition;\n\n /**\n * Creates an attribute_not_exists condition for type-safe attribute absence testing.\n * Tests if the specified attribute does not exist in the item.\n * Useful for conditional writes to prevent overwriting existing data.\n *\n * @param attr - The attribute path to test for absence (with full type safety)\n * @returns A condition that evaluates to true when the attribute does not exist\n *\n * @example\n * ```typescript\n * interface User { id: string; email: string; deletedAt?: string; }\n *\n * // Ensure item hasn't been soft-deleted\n * op.attributeNotExists(\"deletedAt\") // attribute_not_exists(deletedAt)\n *\n * // Prevent duplicate creation\n * op.attributeNotExists(\"id\") // attribute_not_exists(id)\n *\n * // Conditional updates\n * op.and(\n * op.eq(\"status\", \"PENDING\"),\n * op.attributeNotExists(\"processedAt\") // Only unprocessed items\n * )\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Functions AWS DynamoDB - attribute_not_exists}\n */\n attributeNotExists: <K extends Path<T>>(attr: K) => Condition;\n\n /**\n * Combines multiple conditions with logical AND operator.\n * All provided conditions must evaluate to true for the AND condition to be true.\n * Supports any number of conditions as arguments.\n *\n * @param conditions - Variable number of conditions to combine with AND\n * @returns A condition that evaluates to true when all input conditions are true\n *\n * @example\n * ```typescript\n * interface User { status: string; age: number; role: string; verified: boolean; }\n *\n * // Multiple criteria\n * op.and(\n * op.eq(\"status\", \"ACTIVE\"),\n * op.gt(\"age\", 18),\n * op.eq(\"verified\", true)\n * ) // status = \"ACTIVE\" AND age > 18 AND verified = true\n *\n * // Complex business logic\n * op.and(\n * op.inArray(\"role\", [\"admin\", \"moderator\"]),\n * op.attributeExists(\"permissions\"),\n * op.ne(\"status\", \"SUSPENDED\")\n * )\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Logical AWS DynamoDB - AND}\n */\n and: (...conditions: Condition[]) => Condition;\n\n /**\n * Combines multiple conditions with logical OR operator.\n * At least one of the provided conditions must evaluate to true for the OR condition to be true.\n * Supports any number of conditions as arguments.\n *\n * @param conditions - Variable number of conditions to combine with OR\n * @returns A condition that evaluates to true when any input condition is true\n *\n * @example\n * ```typescript\n * interface Order { status: string; priority: string; urgent: boolean; }\n *\n * // Alternative statuses\n * op.or(\n * op.eq(\"status\", \"PENDING\"),\n * op.eq(\"status\", \"PROCESSING\"),\n * op.eq(\"status\", \"SHIPPED\")\n * ) // status = \"PENDING\" OR status = \"PROCESSING\" OR status = \"SHIPPED\"\n *\n * // High priority items\n * op.or(\n * op.eq(\"priority\", \"HIGH\"),\n * op.eq(\"urgent\", true)\n * )\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Logical AWS DynamoDB - OR}\n */\n or: (...conditions: Condition[]) => Condition;\n\n /**\n * Negates a condition with logical NOT operator.\n * Inverts the boolean result of the provided condition.\n *\n * @param condition - The condition to negate\n * @returns A condition that evaluates to true when the input condition is false\n *\n * @example\n * ```typescript\n * interface User { status: string; role: string; banned: boolean; }\n *\n * // Exclude specific status\n * op.not(op.eq(\"status\", \"DELETED\")) // NOT status = \"DELETED\"\n *\n * // Complex negation\n * op.not(\n * op.and(\n * op.eq(\"role\", \"guest\"),\n * op.eq(\"banned\", true)\n * )\n * ) // NOT (role = \"guest\" AND banned = true)\n *\n * // Exclude multiple values\n * op.not(op.inArray(\"status\", [\"DELETED\", \"ARCHIVED\"]))\n * ```\n *\n * @see {@link https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html#Expressions.OperatorsAndFunctions.Logical AWS DynamoDB - NOT}\n */\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 buildInExpression = (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 === 0) {\n throw new Error(\"In condition requires a non-empty array of values\");\n }\n\n if (condition.value.length > 100) {\n throw new Error(\"In condition supports a maximum of 100 values\");\n }\n\n const attrName = generateAttributeName(params, condition.attr);\n const valueNames = condition.value.map((value) => generateValueName(params, value));\n\n return `${attrName} IN (${valueNames.join(\", \")})`;\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 in: () => buildInExpression(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 inArray,\n beginsWith,\n contains,\n attributeExists,\n attributeNotExists,\n and,\n or,\n not,\n} from \"../conditions\";\nimport type { TransactionBuilder } from \"./transaction-builder\";\nimport type { BatchBuilder } from \"./batch-builder\";\nimport { prepareExpressionParams } from \"../expression\";\nimport { debugCommand } from \"../utils/debug-expression\";\nimport type { DeleteCommandParams } from \"./builder-types\";\nimport type { DynamoItem } from \"../types\";\n\nexport interface DeleteOptions {\n condition?: Condition;\n returnValues?: \"ALL_OLD\";\n}\n\ntype DeleteExecutor = (params: DeleteCommandParams) => Promise<{ item?: DynamoItem }>;\n\n/**\n * Builder for creating DynamoDB delete operations.\n *\n * @example\n * ```typescript\n * // Simple delete\n * const result = await new DeleteBuilder(executor, 'dinosaurs', { id: 'TREX-001' })\n * .execute();\n *\n * // Conditional delete with old value retrieval\n * const result = await new DeleteBuilder(executor, 'habitats', { id: 'PADDOCK-A' })\n * .condition(op =>\n * op.and([\n * op.eq('status', 'DECOMMISSIONED'),\n * op.eq('occupants', 0),\n * op.lt('securityIncidents', 1)\n * ])\n * )\n * .returnValues('ALL_OLD')\n * .execute();\n * ```\n */\nexport class DeleteBuilder {\n private options: DeleteOptions = {\n returnValues: \"ALL_OLD\",\n };\n private readonly executor: DeleteExecutor;\n private readonly tableName: string;\n private readonly key: PrimaryKeyWithoutExpression;\n\n constructor(executor: DeleteExecutor, tableName: string, key: PrimaryKeyWithoutExpression) {\n this.executor = executor;\n this.tableName = tableName;\n this.key = key;\n }\n\n /**\n * Adds a condition that must be satisfied for the delete operation to succeed.\n *\n * @example\n * ```typescript\n * // Ensure dinosaur can be safely removed\n * builder.condition(op =>\n * op.and([\n * op.eq('status', 'SEDATED'),\n * op.eq('location', 'MEDICAL_BAY'),\n * op.attributeExists('lastCheckup')\n * ])\n * );\n *\n * // Verify habitat is empty\n * builder.condition(op =>\n * op.and([\n * op.eq('occupants', 0),\n * op.eq('maintenanceStatus', 'COMPLETE'),\n * op.not(op.attributeExists('activeAlerts'))\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 public condition<T extends DynamoItem>(\n condition: Condition | ((op: ConditionOperator<T>) => Condition),\n ): DeleteBuilder {\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 inArray,\n beginsWith,\n contains,\n attributeExists,\n attributeNotExists,\n and,\n or,\n not,\n };\n this.options.condition = condition(conditionOperator);\n } else {\n this.options.condition = condition;\n }\n return this;\n }\n\n /**\n * Sets whether to return the item's attribute values before deletion.\n *\n * @example\n * ```ts\n * // Archive dinosaur data before removal\n * const result = await builder\n * .returnValues('ALL_OLD')\n * .execute();\n *\n * if (result.item) {\n * console.log('Removed dinosaur data:', {\n * species: result.item.species,\n * age: result.item.age,\n * lastLocation: result.item.location\n * });\n * }\n * ```\n *\n * @param returnValues - Use 'ALL_OLD' to return all attributes of the deleted item\n * @returns The builder instance for method chaining\n */\n public returnValues(returnValues: \"ALL_OLD\"): DeleteBuilder {\n this.options.returnValues = returnValues;\n return this;\n }\n\n /**\n * Generate the DynamoDB command parameters\n */\n private toDynamoCommand(): DeleteCommandParams {\n const { expression, names, values } = prepareExpressionParams(this.options.condition);\n\n return {\n tableName: this.tableName,\n key: this.key,\n conditionExpression: expression,\n expressionAttributeNames: names,\n expressionAttributeValues: values,\n returnValues: this.options.returnValues,\n };\n }\n\n /**\n * Adds this delete operation to a transaction.\n *\n * @example\n * ```ts\n * const transaction = new TransactionBuilder();\n *\n * // Remove dinosaur from old habitat\n * new DeleteBuilder(executor, 'dinosaurs', { id: 'RAPTOR-001' })\n * .condition(op => op.eq('status', 'SEDATED'))\n * .withTransaction(transaction);\n *\n * // Update old habitat occupancy\n * new UpdateBuilder(executor, 'habitats', { id: 'PADDOCK-A' })\n * .add('occupants', -1)\n * .withTransaction(transaction);\n *\n * // Execute transfer atomically\n * await transaction.execute();\n * ```\n *\n * @param transaction - The transaction builder to add this operation to\n */\n public withTransaction(transaction: TransactionBuilder) {\n const command = this.toDynamoCommand();\n\n transaction.deleteWithCommand(command);\n }\n\n /**\n * Adds this delete operation to a batch with optional entity type information.\n *\n * @example Basic Usage\n * ```ts\n * const batch = table.batchBuilder();\n *\n * // Remove multiple dinosaurs in batch\n * dinosaurRepo.delete({ id: 'old-dino-1' }).withBatch(batch);\n * dinosaurRepo.delete({ id: 'old-dino-2' }).withBatch(batch);\n * dinosaurRepo.delete({ id: 'old-dino-3' }).withBatch(batch);\n *\n * // Execute all deletions efficiently\n * await batch.execute();\n * ```\n *\n * @example Typed Usage\n * ```ts\n * const batch = table.batchBuilder<{\n * User: UserEntity;\n * Order: OrderEntity;\n * }>();\n *\n * // Add operations with type information\n * userRepo.delete({ id: 'user-1' }).withBatch(batch, 'User');\n * orderRepo.delete({ id: 'order-1' }).withBatch(batch, 'Order');\n *\n * // Execute batch operations\n * await batch.execute();\n * ```\n *\n * @param batch - The batch builder to add this operation to\n * @param entityType - Optional entity type key for type tracking\n */\n public withBatch<\n TEntities extends Record<string, DynamoItem> = Record<string, DynamoItem>,\n K extends keyof TEntities = keyof TEntities,\n >(batch: BatchBuilder<TEntities>, entityType?: K) {\n const command = this.toDynamoCommand();\n batch.deleteWithCommand(command, entityType);\n }\n\n /**\n * Executes the delete operation against DynamoDB.\n *\n * @example\n * ```ts\n * // Delete with condition and retrieve old values\n * const result = await new DeleteBuilder(executor, 'myTable', { id: '123' })\n * .condition(op => op.eq('status', 'INACTIVE'))\n * .returnValues('ALL_OLD')\n * .execute();\n *\n * if (result.item) {\n * console.log('Deleted item:', result.item);\n * }\n * ```\n *\n * @returns A promise that resolves to an object containing the deleted item's attributes (if returnValues is 'ALL_OLD')\n */\n public async execute(): Promise<{ item?: DynamoItem }> {\n const params = this.toDynamoCommand();\n return this.executor(params);\n }\n\n /**\n * Gets a human-readable representation of the delete command\n * with all expression placeholders replaced by their actual values.\n *\n * @example\n * ```ts\n * const debugInfo = new DeleteBuilder(executor, 'dinosaurs', { id: 'TREX-001' })\n * .condition(op => op.and([\n * op.eq('status', 'SEDATED'),\n * op.eq('location', 'MEDICAL_BAY'),\n * op.gt('sedationLevel', 8)\n * op.eq('version', 1),\n * op.attributeExists('status')\n * ]))\n * .debug();\n *\n * console.log('Delete command:', debugInfo);\n * ```\n *\n * @returns A readable representation of the delete command with resolved expressions\n */\n debug(): DynamoItem {\n const command = this.toDynamoCommand();\n return debugCommand(command);\n }\n}\n"]}
@@ -16,10 +16,6 @@ var Paginator = class {
16
16
  }
17
17
  /**
18
18
  * Gets the current page number (1-indexed).
19
- * Use this method when you need to:
20
- * - Track progress through dinosaur lists
21
- * - Display habitat inspection status
22
- * - Monitor security sweep progress
23
19
  *
24
20
  * @example
25
21
  * ```ts
@@ -37,11 +33,6 @@ var Paginator = class {
37
33
  }
38
34
  /**
39
35
  * Checks if there are more pages of dinosaurs or habitats to process.
40
- * Use this method when you need to:
41
- * - Check for more dinosaurs to review
42
- * - Continue habitat inspections
43
- * - Process security incidents
44
- * - Complete feeding schedules
45
36
  *
46
37
  * This method takes into account both:
47
38
  * - DynamoDB's lastEvaluatedKey mechanism
@@ -73,11 +64,6 @@ var Paginator = class {
73
64
  }
74
65
  /**
75
66
  * Retrieves the next page of dinosaurs or habitats from DynamoDB.
76
- * Use this method when you need to:
77
- * - Process dinosaur groups systematically
78
- * - Review habitat inspections in batches
79
- * - Monitor security incidents in sequence
80
- * - Schedule feeding rotations
81
67
  *
82
68
  * This method handles:
83
69
  * - Automatic continuation between groups
@@ -149,16 +135,6 @@ var Paginator = class {
149
135
  }
150
136
  /**
151
137
  * Gets all remaining dinosaurs or habitats and combines them into a single array.
152
- * Use this method when you need to:
153
- * - Generate complete park inventory
154
- * - Perform full security audit
155
- * - Create comprehensive feeding schedule
156
- * - Run park-wide health checks
157
- *
158
- * Note: Use with caution! This method:
159
- * - Could overwhelm systems with large dinosaur populations
160
- * - Makes multiple database requests
161
- * - May cause system strain during peak hours
162
138
  *
163
139
  * @example
164
140
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/builders/paginator.ts"],"names":[],"mappings":";;;AAqCO,IAAM,YAAN,MAAiF;AAAA,EAC9E,YAAA;AAAA,EACS,QAAA;AAAA,EACT,WAAc,GAAA,CAAA;AAAA,EACd,gBAAA;AAAA,EACA,YAAe,GAAA,IAAA;AAAA,EACf,mBAAsB,GAAA,CAAA;AAAA,EACb,YAAA;AAAA,EAEjB,WAAA,CAAY,cAAiD,QAAkB,EAAA;AAC7E,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA;AACpB,IAAA,IAAA,CAAK,QAAW,GAAA,QAAA;AAEhB,IAAK,IAAA,CAAA,YAAA,GAAe,aAAa,QAAS,EAAA;AAAA;AAC5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBO,cAAyB,GAAA;AAC9B,IAAA,OAAO,IAAK,CAAA,WAAA;AAAA;AACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgCO,WAAuB,GAAA;AAE5B,IAAA,IAAI,KAAK,YAAiB,KAAA,MAAA,IAAa,IAAK,CAAA,mBAAA,IAAuB,KAAK,YAAc,EAAA;AACpF,MAAO,OAAA,KAAA;AAAA;AAET,IAAA,OAAO,IAAK,CAAA,YAAA;AAAA;AACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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,GAAsB,IAAK,CAAA,YAAA,CAAA;AAEnG,IAAO,OAAA;AAAA,MACL,OAAO,MAAO,CAAA,KAAA;AAAA,MACd,kBAAkB,MAAO,CAAA,gBAAA;AAAA,MACzB,WAAA,EAAa,KAAK,WAAY,EAAA;AAAA,MAC9B,MAAM,IAAK,CAAA;AAAA,KACb;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuCA,MAAa,WAA4B,GAAA;AACvC,IAAA,MAAM,WAAgB,EAAC;AAEvB,IAAO,OAAA,IAAA,CAAK,aAAe,EAAA;AACzB,MAAM,MAAA,MAAA,GAAS,MAAM,IAAA,CAAK,WAAY,EAAA;AACtC,MAAS,QAAA,CAAA,IAAA,CAAK,GAAG,MAAA,CAAO,KAAK,CAAA;AAAA;AAG/B,IAAO,OAAA,QAAA;AAAA;AAEX","file":"paginator.cjs","sourcesContent":["import type { DynamoItem, TableConfig } from \"../types\";\nimport type { PaginationResult, QueryBuilderInterface } from \"./builder-types\";\n\n/**\n * A utility class for handling DynamoDB pagination.\n * Use this class when you need to:\n * - Browse large collections of dinosaurs\n * - Review extensive security logs\n * - Analyze habitat inspection history\n * - Process feeding schedules\n *\n * The paginator maintains internal state and automatically handles:\n * - Page boundaries\n * - Result set limits\n * - Continuation tokens\n *\n * @example\n * ```typescript\n * // List all velociraptors with pagination\n * const paginator = new QueryBuilder(executor, eq('species', 'Velociraptor'))\n * .filter(op => op.eq('status', 'ACTIVE'))\n * .paginate(10);\n *\n * // Process each page of dinosaurs\n * while (paginator.hasNextPage()) {\n * const page = await paginator.getNextPage();\n * console.log(`Processing page ${page.page} of velociraptors`);\n *\n * for (const raptor of page.items) {\n * console.log(`- ${raptor.id}: Health=${raptor.stats.health}`);\n * }\n * }\n * ```\n *\n * @typeParam T - The type of items being paginated\n * @typeParam TConfig - The table configuration type\n */\nexport class Paginator<T extends DynamoItem, TConfig extends TableConfig = TableConfig> {\n private queryBuilder: QueryBuilderInterface<T, TConfig>;\n private readonly pageSize: number;\n private currentPage = 0;\n private lastEvaluatedKey?: DynamoItem;\n private hasMorePages = true;\n private totalItemsRetrieved = 0;\n private readonly overallLimit?: number;\n\n constructor(queryBuilder: QueryBuilderInterface<T, TConfig>, pageSize: number) {\n this.queryBuilder = queryBuilder;\n this.pageSize = pageSize;\n // Store the overall limit from the query builder if it exists\n this.overallLimit = queryBuilder.getLimit();\n }\n\n /**\n * Gets the current page number (1-indexed).\n * Use this method when you need to:\n * - Track progress through dinosaur lists\n * - Display habitat inspection status\n * - Monitor security sweep progress\n *\n * @example\n * ```ts\n * const paginator = new QueryBuilder(executor, eq('species', 'Tyrannosaurus'))\n * .paginate(5);\n *\n * await paginator.getNextPage();\n * console.log(`Reviewing T-Rex group ${paginator.getCurrentPage()}`);\n * ```\n *\n * @returns The current page number, starting from 1\n */\n public getCurrentPage(): number {\n return this.currentPage;\n }\n\n /**\n * Checks if there are more pages of dinosaurs or habitats to process.\n * Use this method when you need to:\n * - Check for more dinosaurs to review\n * - Continue habitat inspections\n * - Process security incidents\n * - Complete feeding schedules\n *\n * This method takes into account both:\n * - DynamoDB's lastEvaluatedKey mechanism\n * - Any overall limit set on the query\n *\n * @example\n * ```ts\n * // Process all security incidents\n * const paginator = new QueryBuilder(executor, eq('type', 'SECURITY_BREACH'))\n * .sortDescending()\n * .paginate(10);\n *\n * while (paginator.hasNextPage()) {\n * const page = await paginator.getNextPage();\n * for (const incident of page.items) {\n * await processSecurityBreach(incident);\n * }\n * console.log(`Processed incidents page ${page.page}`);\n * }\n * ```\n *\n * @returns true if there are more pages available, false otherwise\n */\n public hasNextPage(): boolean {\n // If we have an overall limit and we've already retrieved that many items, there are no more pages\n if (this.overallLimit !== undefined && this.totalItemsRetrieved >= this.overallLimit) {\n return false;\n }\n return this.hasMorePages;\n }\n\n /**\n * Retrieves the next page of dinosaurs or habitats from DynamoDB.\n * Use this method when you need to:\n * - Process dinosaur groups systematically\n * - Review habitat inspections in batches\n * - Monitor security incidents in sequence\n * - Schedule feeding rotations\n *\n * This method handles:\n * - Automatic continuation between groups\n * - Respect for park capacity limits\n * - Group size adjustments for safety\n *\n * @example\n * ```ts\n * const paginator = new QueryBuilder(executor, eq('species', 'Velociraptor'))\n * .filter(op => op.eq('status', 'ACTIVE'))\n * .paginate(5);\n *\n * // Check first raptor group\n * const page1 = await paginator.getNextPage();\n * console.log(`Found ${page1.items.length} active raptors`);\n *\n * // Continue inspection if more groups exist\n * if (page1.hasNextPage) {\n * const page2 = await paginator.getNextPage();\n * console.log(`Inspecting raptor group ${page2.page}`);\n *\n * for (const raptor of page2.items) {\n * await performHealthCheck(raptor);\n * }\n * }\n * ```\n *\n * @returns A promise that resolves to a PaginationResult containing:\n * - items: The dinosaurs/habitats for this page\n * - hasNextPage: Whether more groups exist\n * - page: The current group number\n * - lastEvaluatedKey: DynamoDB's continuation token\n */\n public async getNextPage(): Promise<PaginationResult<T>> {\n if (!this.hasNextPage()) {\n return {\n items: [],\n hasNextPage: false,\n page: this.currentPage,\n };\n }\n\n // Calculate how many items to fetch for this page\n let effectivePageSize = this.pageSize;\n\n // If we have an overall limit, make sure we don't fetch more than what's left\n if (this.overallLimit !== undefined) {\n const remainingItems = this.overallLimit - this.totalItemsRetrieved;\n if (remainingItems <= 0) {\n return {\n items: [],\n hasNextPage: false,\n page: this.currentPage,\n };\n }\n effectivePageSize = Math.min(effectivePageSize, remainingItems);\n }\n\n // Clone the query builder to avoid modifying the original\n const query = this.queryBuilder.clone().limit(effectivePageSize);\n\n // Apply the last evaluated key if we have one\n if (this.lastEvaluatedKey) {\n query.startFrom(this.lastEvaluatedKey);\n }\n\n // Execute the query\n const result = await query.execute();\n\n // Update pagination state\n this.currentPage += 1;\n this.lastEvaluatedKey = result.lastEvaluatedKey;\n this.totalItemsRetrieved += result.items.length;\n\n // Determine if there are more pages\n // We have more pages if:\n // 1. DynamoDB returned a lastEvaluatedKey AND\n // 2. We haven't hit our overall limit (if one exists)\n this.hasMorePages =\n !!result.lastEvaluatedKey && (this.overallLimit === undefined || this.totalItemsRetrieved < this.overallLimit);\n\n return {\n items: result.items,\n lastEvaluatedKey: result.lastEvaluatedKey,\n hasNextPage: this.hasNextPage(),\n page: this.currentPage,\n };\n }\n\n /**\n * Gets all remaining dinosaurs or habitats and combines them into a single array.\n * Use this method when you need to:\n * - Generate complete park inventory\n * - Perform full security audit\n * - Create comprehensive feeding schedule\n * - Run park-wide health checks\n *\n * Note: Use with caution! This method:\n * - Could overwhelm systems with large dinosaur populations\n * - Makes multiple database requests\n * - May cause system strain during peak hours\n *\n * @example\n * ```ts\n * // Get complete carnivore inventory\n * const paginator = new QueryBuilder(executor, eq('diet', 'CARNIVORE'))\n * .filter(op => op.eq('status', 'ACTIVE'))\n * .paginate(10);\n *\n * try {\n * const allCarnivores = await paginator.getAllPages();\n * console.log(`Park contains ${allCarnivores.length} active carnivores`);\n *\n * // Calculate total threat level\n * const totalThreat = allCarnivores.reduce(\n * (sum, dino) => sum + dino.stats.threatLevel,\n * 0\n * );\n * console.log(`Total threat level: ${totalThreat}`);\n * } catch (error) {\n * console.error('Failed to complete carnivore census:', error);\n * }\n * ```\n *\n * @returns A promise that resolves to an array containing all remaining items\n */\n public async getAllPages(): Promise<T[]> {\n const allItems: T[] = [];\n\n while (this.hasNextPage()) {\n const result = await this.getNextPage();\n allItems.push(...result.items);\n }\n\n return allItems;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/builders/paginator.ts"],"names":[],"mappings":";;;AAqCO,IAAM,YAAN,MAAiF;AAAA,EAC9E,YAAA;AAAA,EACS,QAAA;AAAA,EACT,WAAA,GAAc,CAAA;AAAA,EACd,gBAAA;AAAA,EACA,YAAA,GAAe,IAAA;AAAA,EACf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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6BA,MAAa,WAAA,GAA4B;AACvC,IAAA,MAAM,WAAgB,EAAC;AAEvB,IAAA,OAAO,IAAA,CAAK,aAAY,EAAG;AACzB,MAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,WAAA,EAAY;AACtC,MAAA,QAAA,CAAS,IAAA,CAAK,GAAG,MAAA,CAAO,KAAK,CAAA;AAAA,IAC/B;AAEA,IAAA,OAAO,QAAA;AAAA,EACT;AACF","file":"paginator.cjs","sourcesContent":["import type { DynamoItem, TableConfig } from \"../types\";\nimport type { PaginationResult, QueryBuilderInterface } from \"./builder-types\";\n\n/**\n * A utility class for handling DynamoDB pagination.\n * Use this class when you need to:\n * - Browse large collections of dinosaurs\n * - Review extensive security logs\n * - Analyze habitat inspection history\n * - Process feeding schedules\n *\n * The paginator maintains internal state and automatically handles:\n * - Page boundaries\n * - Result set limits\n * - Continuation tokens\n *\n * @example\n * ```typescript\n * // List all velociraptors with pagination\n * const paginator = new QueryBuilder(executor, eq('species', 'Velociraptor'))\n * .filter(op => op.eq('status', 'ACTIVE'))\n * .paginate(10);\n *\n * // Process each page of dinosaurs\n * while (paginator.hasNextPage()) {\n * const page = await paginator.getNextPage();\n * console.log(`Processing page ${page.page} of velociraptors`);\n *\n * for (const raptor of page.items) {\n * console.log(`- ${raptor.id}: Health=${raptor.stats.health}`);\n * }\n * }\n * ```\n *\n * @typeParam T - The type of items being paginated\n * @typeParam TConfig - The table configuration type\n */\nexport class Paginator<T extends DynamoItem, TConfig extends TableConfig = TableConfig> {\n private queryBuilder: QueryBuilderInterface<T, TConfig>;\n private readonly pageSize: number;\n private currentPage = 0;\n private lastEvaluatedKey?: DynamoItem;\n private hasMorePages = true;\n private totalItemsRetrieved = 0;\n private readonly overallLimit?: number;\n\n constructor(queryBuilder: QueryBuilderInterface<T, TConfig>, pageSize: number) {\n this.queryBuilder = queryBuilder;\n this.pageSize = pageSize;\n // Store the overall limit from the query builder if it exists\n this.overallLimit = queryBuilder.getLimit();\n }\n\n /**\n * Gets the current page number (1-indexed).\n *\n * @example\n * ```ts\n * const paginator = new QueryBuilder(executor, eq('species', 'Tyrannosaurus'))\n * .paginate(5);\n *\n * await paginator.getNextPage();\n * console.log(`Reviewing T-Rex group ${paginator.getCurrentPage()}`);\n * ```\n *\n * @returns The current page number, starting from 1\n */\n public getCurrentPage(): number {\n return this.currentPage;\n }\n\n /**\n * Checks if there are more pages of dinosaurs or habitats to process.\n *\n * This method takes into account both:\n * - DynamoDB's lastEvaluatedKey mechanism\n * - Any overall limit set on the query\n *\n * @example\n * ```ts\n * // Process all security incidents\n * const paginator = new QueryBuilder(executor, eq('type', 'SECURITY_BREACH'))\n * .sortDescending()\n * .paginate(10);\n *\n * while (paginator.hasNextPage()) {\n * const page = await paginator.getNextPage();\n * for (const incident of page.items) {\n * await processSecurityBreach(incident);\n * }\n * console.log(`Processed incidents page ${page.page}`);\n * }\n * ```\n *\n * @returns true if there are more pages available, false otherwise\n */\n public hasNextPage(): boolean {\n // If we have an overall limit and we've already retrieved that many items, there are no more pages\n if (this.overallLimit !== undefined && this.totalItemsRetrieved >= this.overallLimit) {\n return false;\n }\n return this.hasMorePages;\n }\n\n /**\n * Retrieves the next page of dinosaurs or habitats from DynamoDB.\n *\n * This method handles:\n * - Automatic continuation between groups\n * - Respect for park capacity limits\n * - Group size adjustments for safety\n *\n * @example\n * ```ts\n * const paginator = new QueryBuilder(executor, eq('species', 'Velociraptor'))\n * .filter(op => op.eq('status', 'ACTIVE'))\n * .paginate(5);\n *\n * // Check first raptor group\n * const page1 = await paginator.getNextPage();\n * console.log(`Found ${page1.items.length} active raptors`);\n *\n * // Continue inspection if more groups exist\n * if (page1.hasNextPage) {\n * const page2 = await paginator.getNextPage();\n * console.log(`Inspecting raptor group ${page2.page}`);\n *\n * for (const raptor of page2.items) {\n * await performHealthCheck(raptor);\n * }\n * }\n * ```\n *\n * @returns A promise that resolves to a PaginationResult containing:\n * - items: The dinosaurs/habitats for this page\n * - hasNextPage: Whether more groups exist\n * - page: The current group number\n * - lastEvaluatedKey: DynamoDB's continuation token\n */\n public async getNextPage(): Promise<PaginationResult<T>> {\n if (!this.hasNextPage()) {\n return {\n items: [],\n hasNextPage: false,\n page: this.currentPage,\n };\n }\n\n // Calculate how many items to fetch for this page\n let effectivePageSize = this.pageSize;\n\n // If we have an overall limit, make sure we don't fetch more than what's left\n if (this.overallLimit !== undefined) {\n const remainingItems = this.overallLimit - this.totalItemsRetrieved;\n if (remainingItems <= 0) {\n return {\n items: [],\n hasNextPage: false,\n page: this.currentPage,\n };\n }\n effectivePageSize = Math.min(effectivePageSize, remainingItems);\n }\n\n // Clone the query builder to avoid modifying the original\n const query = this.queryBuilder.clone().limit(effectivePageSize);\n\n // Apply the last evaluated key if we have one\n if (this.lastEvaluatedKey) {\n query.startFrom(this.lastEvaluatedKey);\n }\n\n // Execute the query\n const result = await query.execute();\n\n // Update pagination state\n this.currentPage += 1;\n this.lastEvaluatedKey = result.lastEvaluatedKey;\n this.totalItemsRetrieved += result.items.length;\n\n // Determine if there are more pages\n // We have more pages if:\n // 1. DynamoDB returned a lastEvaluatedKey AND\n // 2. We haven't hit our overall limit (if one exists)\n this.hasMorePages =\n !!result.lastEvaluatedKey && (this.overallLimit === undefined || this.totalItemsRetrieved < this.overallLimit);\n\n return {\n items: result.items,\n lastEvaluatedKey: result.lastEvaluatedKey,\n hasNextPage: this.hasNextPage(),\n page: this.currentPage,\n };\n }\n\n /**\n * Gets all remaining dinosaurs or habitats and combines them into a single array.\n *\n * @example\n * ```ts\n * // Get complete carnivore inventory\n * const paginator = new QueryBuilder(executor, eq('diet', 'CARNIVORE'))\n * .filter(op => op.eq('status', 'ACTIVE'))\n * .paginate(10);\n *\n * try {\n * const allCarnivores = await paginator.getAllPages();\n * console.log(`Park contains ${allCarnivores.length} active carnivores`);\n *\n * // Calculate total threat level\n * const totalThreat = allCarnivores.reduce(\n * (sum, dino) => sum + dino.stats.threatLevel,\n * 0\n * );\n * console.log(`Total threat level: ${totalThreat}`);\n * } catch (error) {\n * console.error('Failed to complete carnivore census:', error);\n * }\n * ```\n *\n * @returns A promise that resolves to an array containing all remaining items\n */\n public async getAllPages(): Promise<T[]> {\n const allItems: T[] = [];\n\n while (this.hasNextPage()) {\n const result = await this.getNextPage();\n allItems.push(...result.items);\n }\n\n return allItems;\n }\n}\n"]}
@@ -47,10 +47,6 @@ declare class Paginator<T extends DynamoItem, TConfig extends TableConfig = Tabl
47
47
  constructor(queryBuilder: QueryBuilderInterface<T, TConfig>, pageSize: number);
48
48
  /**
49
49
  * Gets the current page number (1-indexed).
50
- * Use this method when you need to:
51
- * - Track progress through dinosaur lists
52
- * - Display habitat inspection status
53
- * - Monitor security sweep progress
54
50
  *
55
51
  * @example
56
52
  * ```ts
@@ -66,11 +62,6 @@ declare class Paginator<T extends DynamoItem, TConfig extends TableConfig = Tabl
66
62
  getCurrentPage(): number;
67
63
  /**
68
64
  * Checks if there are more pages of dinosaurs or habitats to process.
69
- * Use this method when you need to:
70
- * - Check for more dinosaurs to review
71
- * - Continue habitat inspections
72
- * - Process security incidents
73
- * - Complete feeding schedules
74
65
  *
75
66
  * This method takes into account both:
76
67
  * - DynamoDB's lastEvaluatedKey mechanism
@@ -97,11 +88,6 @@ declare class Paginator<T extends DynamoItem, TConfig extends TableConfig = Tabl
97
88
  hasNextPage(): boolean;
98
89
  /**
99
90
  * Retrieves the next page of dinosaurs or habitats from DynamoDB.
100
- * Use this method when you need to:
101
- * - Process dinosaur groups systematically
102
- * - Review habitat inspections in batches
103
- * - Monitor security incidents in sequence
104
- * - Schedule feeding rotations
105
91
  *
106
92
  * This method handles:
107
93
  * - Automatic continuation between groups
@@ -138,16 +124,6 @@ declare class Paginator<T extends DynamoItem, TConfig extends TableConfig = Tabl
138
124
  getNextPage(): Promise<PaginationResult<T>>;
139
125
  /**
140
126
  * Gets all remaining dinosaurs or habitats and combines them into a single array.
141
- * Use this method when you need to:
142
- * - Generate complete park inventory
143
- * - Perform full security audit
144
- * - Create comprehensive feeding schedule
145
- * - Run park-wide health checks
146
- *
147
- * Note: Use with caution! This method:
148
- * - Could overwhelm systems with large dinosaur populations
149
- * - Makes multiple database requests
150
- * - May cause system strain during peak hours
151
127
  *
152
128
  * @example
153
129
  * ```ts
@@ -47,10 +47,6 @@ declare class Paginator<T extends DynamoItem, TConfig extends TableConfig = Tabl
47
47
  constructor(queryBuilder: QueryBuilderInterface<T, TConfig>, pageSize: number);
48
48
  /**
49
49
  * Gets the current page number (1-indexed).
50
- * Use this method when you need to:
51
- * - Track progress through dinosaur lists
52
- * - Display habitat inspection status
53
- * - Monitor security sweep progress
54
50
  *
55
51
  * @example
56
52
  * ```ts
@@ -66,11 +62,6 @@ declare class Paginator<T extends DynamoItem, TConfig extends TableConfig = Tabl
66
62
  getCurrentPage(): number;
67
63
  /**
68
64
  * Checks if there are more pages of dinosaurs or habitats to process.
69
- * Use this method when you need to:
70
- * - Check for more dinosaurs to review
71
- * - Continue habitat inspections
72
- * - Process security incidents
73
- * - Complete feeding schedules
74
65
  *
75
66
  * This method takes into account both:
76
67
  * - DynamoDB's lastEvaluatedKey mechanism
@@ -97,11 +88,6 @@ declare class Paginator<T extends DynamoItem, TConfig extends TableConfig = Tabl
97
88
  hasNextPage(): boolean;
98
89
  /**
99
90
  * Retrieves the next page of dinosaurs or habitats from DynamoDB.
100
- * Use this method when you need to:
101
- * - Process dinosaur groups systematically
102
- * - Review habitat inspections in batches
103
- * - Monitor security incidents in sequence
104
- * - Schedule feeding rotations
105
91
  *
106
92
  * This method handles:
107
93
  * - Automatic continuation between groups
@@ -138,16 +124,6 @@ declare class Paginator<T extends DynamoItem, TConfig extends TableConfig = Tabl
138
124
  getNextPage(): Promise<PaginationResult<T>>;
139
125
  /**
140
126
  * Gets all remaining dinosaurs or habitats and combines them into a single array.
141
- * Use this method when you need to:
142
- * - Generate complete park inventory
143
- * - Perform full security audit
144
- * - Create comprehensive feeding schedule
145
- * - Run park-wide health checks
146
- *
147
- * Note: Use with caution! This method:
148
- * - Could overwhelm systems with large dinosaur populations
149
- * - Makes multiple database requests
150
- * - May cause system strain during peak hours
151
127
  *
152
128
  * @example
153
129
  * ```ts
@@ -14,10 +14,6 @@ var Paginator = class {
14
14
  }
15
15
  /**
16
16
  * Gets the current page number (1-indexed).
17
- * Use this method when you need to:
18
- * - Track progress through dinosaur lists
19
- * - Display habitat inspection status
20
- * - Monitor security sweep progress
21
17
  *
22
18
  * @example
23
19
  * ```ts
@@ -35,11 +31,6 @@ var Paginator = class {
35
31
  }
36
32
  /**
37
33
  * Checks if there are more pages of dinosaurs or habitats to process.
38
- * Use this method when you need to:
39
- * - Check for more dinosaurs to review
40
- * - Continue habitat inspections
41
- * - Process security incidents
42
- * - Complete feeding schedules
43
34
  *
44
35
  * This method takes into account both:
45
36
  * - DynamoDB's lastEvaluatedKey mechanism
@@ -71,11 +62,6 @@ var Paginator = class {
71
62
  }
72
63
  /**
73
64
  * Retrieves the next page of dinosaurs or habitats from DynamoDB.
74
- * Use this method when you need to:
75
- * - Process dinosaur groups systematically
76
- * - Review habitat inspections in batches
77
- * - Monitor security incidents in sequence
78
- * - Schedule feeding rotations
79
65
  *
80
66
  * This method handles:
81
67
  * - Automatic continuation between groups
@@ -147,16 +133,6 @@ var Paginator = class {
147
133
  }
148
134
  /**
149
135
  * Gets all remaining dinosaurs or habitats and combines them into a single array.
150
- * Use this method when you need to:
151
- * - Generate complete park inventory
152
- * - Perform full security audit
153
- * - Create comprehensive feeding schedule
154
- * - Run park-wide health checks
155
- *
156
- * Note: Use with caution! This method:
157
- * - Could overwhelm systems with large dinosaur populations
158
- * - Makes multiple database requests
159
- * - May cause system strain during peak hours
160
136
  *
161
137
  * @example
162
138
  * ```ts