dyno-table 1.3.1 → 1.5.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.
- package/dist/builders/condition-check-builder.cjs +22 -0
- package/dist/builders/condition-check-builder.cjs.map +1 -1
- package/dist/builders/condition-check-builder.d.cts +1 -1
- package/dist/builders/condition-check-builder.d.ts +1 -1
- package/dist/builders/condition-check-builder.js +22 -0
- package/dist/builders/condition-check-builder.js.map +1 -1
- package/dist/builders/delete-builder.cjs +22 -0
- package/dist/builders/delete-builder.cjs.map +1 -1
- package/dist/builders/delete-builder.d.cts +1 -1
- package/dist/builders/delete-builder.d.ts +1 -1
- package/dist/builders/delete-builder.js +22 -0
- package/dist/builders/delete-builder.js.map +1 -1
- package/dist/builders/put-builder.cjs +22 -0
- package/dist/builders/put-builder.cjs.map +1 -1
- package/dist/builders/put-builder.d.cts +1 -1
- package/dist/builders/put-builder.d.ts +1 -1
- package/dist/builders/put-builder.js +22 -0
- package/dist/builders/put-builder.js.map +1 -1
- package/dist/builders/query-builder.cjs +6 -0
- package/dist/builders/query-builder.cjs.map +1 -1
- package/dist/builders/query-builder.d.cts +2 -2
- package/dist/builders/query-builder.d.ts +2 -2
- package/dist/builders/query-builder.js +6 -0
- package/dist/builders/query-builder.js.map +1 -1
- package/dist/builders/transaction-builder.cjs +16 -0
- package/dist/builders/transaction-builder.cjs.map +1 -1
- package/dist/builders/transaction-builder.d.cts +1 -1
- package/dist/builders/transaction-builder.d.ts +1 -1
- package/dist/builders/transaction-builder.js +16 -0
- package/dist/builders/transaction-builder.js.map +1 -1
- package/dist/builders/update-builder.cjs +22 -0
- package/dist/builders/update-builder.cjs.map +1 -1
- package/dist/builders/update-builder.d.cts +1 -1
- package/dist/builders/update-builder.d.ts +1 -1
- package/dist/builders/update-builder.js +22 -0
- package/dist/builders/update-builder.js.map +1 -1
- package/dist/conditions-3ae5znV_.d.cts +729 -0
- package/dist/conditions-BtynAviC.d.ts +729 -0
- package/dist/conditions.cjs +6 -0
- package/dist/conditions.cjs.map +1 -1
- package/dist/conditions.d.cts +1 -1
- package/dist/conditions.d.ts +1 -1
- package/dist/conditions.js +6 -1
- package/dist/conditions.js.map +1 -1
- package/dist/entity.cjs.map +1 -1
- package/dist/entity.d.cts +3 -3
- package/dist/entity.d.ts +3 -3
- package/dist/entity.js.map +1 -1
- package/dist/index.cjs +3657 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +3630 -0
- package/dist/index.js.map +1 -0
- package/dist/{query-builder-BehSUVpp.d.ts → query-builder-BhrR31oO.d.ts} +2 -2
- package/dist/{query-builder-DLY2lgjI.d.cts → query-builder-CbHvimBk.d.cts} +2 -2
- package/dist/{table-BAfnBHoH.d.cts → table-CY9byPEg.d.cts} +2 -2
- package/dist/{table-BcnNHdOb.d.ts → table-Des8C2od.d.ts} +2 -2
- package/dist/table.cjs +26 -0
- package/dist/table.cjs.map +1 -1
- package/dist/table.d.cts +3 -3
- package/dist/table.d.ts +3 -3
- package/dist/table.js +26 -0
- package/dist/table.js.map +1 -1
- package/dist/utils.cjs +34 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/{utils/sort-key-template.d.cts → utils.d.cts} +32 -1
- package/dist/{utils/sort-key-template.d.ts → utils.d.ts} +32 -1
- package/dist/utils.js +31 -0
- package/dist/utils.js.map +1 -0
- package/package.json +114 -49
- package/dist/conditions--ld9a78i.d.ts +0 -331
- package/dist/conditions-ChhQWd6z.d.cts +0 -331
- package/dist/utils/partition-key-template.cjs +0 -19
- package/dist/utils/partition-key-template.cjs.map +0 -1
- package/dist/utils/partition-key-template.d.cts +0 -32
- package/dist/utils/partition-key-template.d.ts +0 -32
- package/dist/utils/partition-key-template.js +0 -17
- package/dist/utils/partition-key-template.js.map +0 -1
- package/dist/utils/sort-key-template.cjs +0 -19
- package/dist/utils/sort-key-template.cjs.map +0 -1
- package/dist/utils/sort-key-template.js +0 -17
- package/dist/utils/sort-key-template.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/partition-key-template.ts"],"names":[],"mappings":";;;AA8BO,SAAS,YAAA,CACd,YACG,IACwC,EAAA;AAC3C,EAAA,OAAO,CAAC,MAAW,KAAA;AACjB,IAAI,IAAA,MAAA,GAAS,OAAQ,CAAA,CAAC,CAAK,IAAA,EAAA;AAE3B,IAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,IAAA,CAAK,QAAQ,CAAK,EAAA,EAAA;AACpC,MAAM,MAAA,GAAA,GAAM,KAAK,CAAC,CAAA;AAClB,MAAA,IAAI,GAAK,EAAA;AACP,QAAA,MAAA,IAAU,OAAO,GAAgB,CAAA,IAAK,OAAQ,CAAA,CAAA,GAAI,CAAC,CAAK,IAAA,EAAA,CAAA;AAAA;AAC1D;AAGF,IAAO,OAAA,MAAA;AAAA,GACT;AACF","file":"partition-key-template.cjs","sourcesContent":["export type StrictGenerateType<T extends readonly string[]> = {\n [K in T[number]]: string;\n};\n\n/**\n * Creates a template function for generating DynamoDB partition keys with dynamic values.\n * Use this function when you need to:\n * - Create consistent partition key patterns with variable parts\n * - Generate partition keys that follow a specific format\n * - Ensure type safety for partition key parameters\n * - Require all parameters to be provided\n *\n * @example\n * ```ts\n * // Define a partition key template\n * const pk = partitionKey`country#${\"country\"}#enclosure#${\"enclosure\"}`;\n *\n * // Generate a partition key (all parameters required)\n * const key = pk({ country: \"NZ\", enclosure: \"A1\" });\n * // Result: \"country#NZ#enclosure#A1\"\n *\n * // Type checking ensures all parameters are provided\n * const invalidKey = pk({ country: \"NZ\" }); // TypeScript error\n * ```\n *\n * @param strings - The static parts of the template string\n * @param keys - The dynamic parts of the template string that will be replaced with values\n *\n * @returns A function that accepts an object with the dynamic values and returns the formatted partition key\n */\nexport function partitionKey<T extends readonly string[]>(\n strings: TemplateStringsArray,\n ...keys: T\n): (params: StrictGenerateType<T>) => string {\n return (params) => {\n let result = strings[0] ?? \"\";\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (key) {\n result += params[key as T[number]] + (strings[i + 1] ?? \"\");\n }\n }\n\n return result;\n };\n}\n"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
type StrictGenerateType<T extends readonly string[]> = {
|
|
2
|
-
[K in T[number]]: string;
|
|
3
|
-
};
|
|
4
|
-
/**
|
|
5
|
-
* Creates a template function for generating DynamoDB partition keys with dynamic values.
|
|
6
|
-
* Use this function when you need to:
|
|
7
|
-
* - Create consistent partition key patterns with variable parts
|
|
8
|
-
* - Generate partition keys that follow a specific format
|
|
9
|
-
* - Ensure type safety for partition key parameters
|
|
10
|
-
* - Require all parameters to be provided
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* // Define a partition key template
|
|
15
|
-
* const pk = partitionKey`country#${"country"}#enclosure#${"enclosure"}`;
|
|
16
|
-
*
|
|
17
|
-
* // Generate a partition key (all parameters required)
|
|
18
|
-
* const key = pk({ country: "NZ", enclosure: "A1" });
|
|
19
|
-
* // Result: "country#NZ#enclosure#A1"
|
|
20
|
-
*
|
|
21
|
-
* // Type checking ensures all parameters are provided
|
|
22
|
-
* const invalidKey = pk({ country: "NZ" }); // TypeScript error
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @param strings - The static parts of the template string
|
|
26
|
-
* @param keys - The dynamic parts of the template string that will be replaced with values
|
|
27
|
-
*
|
|
28
|
-
* @returns A function that accepts an object with the dynamic values and returns the formatted partition key
|
|
29
|
-
*/
|
|
30
|
-
declare function partitionKey<T extends readonly string[]>(strings: TemplateStringsArray, ...keys: T): (params: StrictGenerateType<T>) => string;
|
|
31
|
-
|
|
32
|
-
export { type StrictGenerateType, partitionKey };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
type StrictGenerateType<T extends readonly string[]> = {
|
|
2
|
-
[K in T[number]]: string;
|
|
3
|
-
};
|
|
4
|
-
/**
|
|
5
|
-
* Creates a template function for generating DynamoDB partition keys with dynamic values.
|
|
6
|
-
* Use this function when you need to:
|
|
7
|
-
* - Create consistent partition key patterns with variable parts
|
|
8
|
-
* - Generate partition keys that follow a specific format
|
|
9
|
-
* - Ensure type safety for partition key parameters
|
|
10
|
-
* - Require all parameters to be provided
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* // Define a partition key template
|
|
15
|
-
* const pk = partitionKey`country#${"country"}#enclosure#${"enclosure"}`;
|
|
16
|
-
*
|
|
17
|
-
* // Generate a partition key (all parameters required)
|
|
18
|
-
* const key = pk({ country: "NZ", enclosure: "A1" });
|
|
19
|
-
* // Result: "country#NZ#enclosure#A1"
|
|
20
|
-
*
|
|
21
|
-
* // Type checking ensures all parameters are provided
|
|
22
|
-
* const invalidKey = pk({ country: "NZ" }); // TypeScript error
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @param strings - The static parts of the template string
|
|
26
|
-
* @param keys - The dynamic parts of the template string that will be replaced with values
|
|
27
|
-
*
|
|
28
|
-
* @returns A function that accepts an object with the dynamic values and returns the formatted partition key
|
|
29
|
-
*/
|
|
30
|
-
declare function partitionKey<T extends readonly string[]>(strings: TemplateStringsArray, ...keys: T): (params: StrictGenerateType<T>) => string;
|
|
31
|
-
|
|
32
|
-
export { type StrictGenerateType, partitionKey };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// src/utils/partition-key-template.ts
|
|
2
|
-
function partitionKey(strings, ...keys) {
|
|
3
|
-
return (params) => {
|
|
4
|
-
let result = strings[0] ?? "";
|
|
5
|
-
for (let i = 0; i < keys.length; i++) {
|
|
6
|
-
const key = keys[i];
|
|
7
|
-
if (key) {
|
|
8
|
-
result += params[key] + (strings[i + 1] ?? "");
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return result;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { partitionKey };
|
|
16
|
-
//# sourceMappingURL=partition-key-template.js.map
|
|
17
|
-
//# sourceMappingURL=partition-key-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/partition-key-template.ts"],"names":[],"mappings":";AA8BO,SAAS,YAAA,CACd,YACG,IACwC,EAAA;AAC3C,EAAA,OAAO,CAAC,MAAW,KAAA;AACjB,IAAI,IAAA,MAAA,GAAS,OAAQ,CAAA,CAAC,CAAK,IAAA,EAAA;AAE3B,IAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,IAAA,CAAK,QAAQ,CAAK,EAAA,EAAA;AACpC,MAAM,MAAA,GAAA,GAAM,KAAK,CAAC,CAAA;AAClB,MAAA,IAAI,GAAK,EAAA;AACP,QAAA,MAAA,IAAU,OAAO,GAAgB,CAAA,IAAK,OAAQ,CAAA,CAAA,GAAI,CAAC,CAAK,IAAA,EAAA,CAAA;AAAA;AAC1D;AAGF,IAAO,OAAA,MAAA;AAAA,GACT;AACF","file":"partition-key-template.js","sourcesContent":["export type StrictGenerateType<T extends readonly string[]> = {\n [K in T[number]]: string;\n};\n\n/**\n * Creates a template function for generating DynamoDB partition keys with dynamic values.\n * Use this function when you need to:\n * - Create consistent partition key patterns with variable parts\n * - Generate partition keys that follow a specific format\n * - Ensure type safety for partition key parameters\n * - Require all parameters to be provided\n *\n * @example\n * ```ts\n * // Define a partition key template\n * const pk = partitionKey`country#${\"country\"}#enclosure#${\"enclosure\"}`;\n *\n * // Generate a partition key (all parameters required)\n * const key = pk({ country: \"NZ\", enclosure: \"A1\" });\n * // Result: \"country#NZ#enclosure#A1\"\n *\n * // Type checking ensures all parameters are provided\n * const invalidKey = pk({ country: \"NZ\" }); // TypeScript error\n * ```\n *\n * @param strings - The static parts of the template string\n * @param keys - The dynamic parts of the template string that will be replaced with values\n *\n * @returns A function that accepts an object with the dynamic values and returns the formatted partition key\n */\nexport function partitionKey<T extends readonly string[]>(\n strings: TemplateStringsArray,\n ...keys: T\n): (params: StrictGenerateType<T>) => string {\n return (params) => {\n let result = strings[0] ?? \"\";\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n if (key) {\n result += params[key as T[number]] + (strings[i + 1] ?? \"\");\n }\n }\n\n return result;\n };\n}\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/utils/sort-key-template.ts
|
|
4
|
-
function sortKey(strings, ...keys) {
|
|
5
|
-
return (params) => {
|
|
6
|
-
let result = strings[0] ?? "";
|
|
7
|
-
for (let i = 0; i < keys.length; i++) {
|
|
8
|
-
const key = keys[i];
|
|
9
|
-
if (key && params && key in params) {
|
|
10
|
-
result += params[key] + (strings[i + 1] ?? "");
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return result;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.sortKey = sortKey;
|
|
18
|
-
//# sourceMappingURL=sort-key-template.cjs.map
|
|
19
|
-
//# sourceMappingURL=sort-key-template.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/sort-key-template.ts"],"names":[],"mappings":";;;AAqCO,SAAS,OAAA,CACd,YACG,IACkC,EAAA;AACrC,EAAA,OAAO,CAAC,MAAW,KAAA;AACjB,IAAI,IAAA,MAAA,GAAS,OAAQ,CAAA,CAAC,CAAK,IAAA,EAAA;AAE3B,IAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,IAAA,CAAK,QAAQ,CAAK,EAAA,EAAA;AACpC,MAAM,MAAA,GAAA,GAAM,KAAK,CAAC,CAAA;AAElB,MAAI,IAAA,GAAA,IAAO,MAAU,IAAA,GAAA,IAAO,MAAQ,EAAA;AAClC,QAAA,MAAA,IAAU,OAAO,GAAG,CAAA,IAAK,OAAQ,CAAA,CAAA,GAAI,CAAC,CAAK,IAAA,EAAA,CAAA;AAAA;AAC7C;AAGF,IAAO,OAAA,MAAA;AAAA,GACT;AACF","file":"sort-key-template.cjs","sourcesContent":["export type GenerateType<T extends readonly string[], U extends string = never> = T extends [infer F, ...infer R]\n ? F extends string\n ? R extends string[]\n ? ({ [K in F | U]: string | number } & Partial<Record<Exclude<T[number], F | U>, never>>) | GenerateType<R, F | U>\n : never\n : never\n : never;\n\n/**\n * Creates a template function for generating DynamoDB sort keys with dynamic values.\n * Use this function when you need to:\n * - Create consistent sort key patterns with variable parts\n * - Generate sort keys that follow a specific format\n * - Ensure type safety for sort key parameters\n *\n * @example\n * ```ts\n * // Define a sort key template\n * const sk = sortKey`country#${\"country\"}#enclosure#${\"enclosure\"}#diet#${\"diet\"}`;\n *\n * // Generate a sort key with partial parameters\n * const templatedString = sk({ country: \"NZ\", enclosure: \"A1\" });\n * // Result: \"country#NZ#enclosure#A1#diet#\"\n *\n * // Generate a complete sort key\n * const fullKey = sk({ country: \"NZ\", enclosure: \"A1\", diet: \"carnivore\" });\n * // Result: \"country#NZ#enclosure#A1#diet#carnivore\"\n *\n * // Type checking ensures only valid parameters are used\n * const invalidKey = sk({ country: \"NZ\", invalid: \"value\" }); // TypeScript error\n * ```\n *\n * @param strings - The static parts of the template string\n * @param keys - The dynamic parts of the template string that will be replaced with values\n *\n * @returns A function that accepts an object with the dynamic values and returns the formatted sort key\n */\nexport function sortKey<T extends readonly string[]>(\n strings: TemplateStringsArray,\n ...keys: T\n): (params: GenerateType<T>) => string {\n return (params) => {\n let result = strings[0] ?? \"\";\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (key && params && key in params) {\n result += params[key] + (strings[i + 1] ?? \"\");\n }\n }\n\n return result;\n };\n}\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// src/utils/sort-key-template.ts
|
|
2
|
-
function sortKey(strings, ...keys) {
|
|
3
|
-
return (params) => {
|
|
4
|
-
let result = strings[0] ?? "";
|
|
5
|
-
for (let i = 0; i < keys.length; i++) {
|
|
6
|
-
const key = keys[i];
|
|
7
|
-
if (key && params && key in params) {
|
|
8
|
-
result += params[key] + (strings[i + 1] ?? "");
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return result;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { sortKey };
|
|
16
|
-
//# sourceMappingURL=sort-key-template.js.map
|
|
17
|
-
//# sourceMappingURL=sort-key-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/sort-key-template.ts"],"names":[],"mappings":";AAqCO,SAAS,OAAA,CACd,YACG,IACkC,EAAA;AACrC,EAAA,OAAO,CAAC,MAAW,KAAA;AACjB,IAAI,IAAA,MAAA,GAAS,OAAQ,CAAA,CAAC,CAAK,IAAA,EAAA;AAE3B,IAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,IAAA,CAAK,QAAQ,CAAK,EAAA,EAAA;AACpC,MAAM,MAAA,GAAA,GAAM,KAAK,CAAC,CAAA;AAElB,MAAI,IAAA,GAAA,IAAO,MAAU,IAAA,GAAA,IAAO,MAAQ,EAAA;AAClC,QAAA,MAAA,IAAU,OAAO,GAAG,CAAA,IAAK,OAAQ,CAAA,CAAA,GAAI,CAAC,CAAK,IAAA,EAAA,CAAA;AAAA;AAC7C;AAGF,IAAO,OAAA,MAAA;AAAA,GACT;AACF","file":"sort-key-template.js","sourcesContent":["export type GenerateType<T extends readonly string[], U extends string = never> = T extends [infer F, ...infer R]\n ? F extends string\n ? R extends string[]\n ? ({ [K in F | U]: string | number } & Partial<Record<Exclude<T[number], F | U>, never>>) | GenerateType<R, F | U>\n : never\n : never\n : never;\n\n/**\n * Creates a template function for generating DynamoDB sort keys with dynamic values.\n * Use this function when you need to:\n * - Create consistent sort key patterns with variable parts\n * - Generate sort keys that follow a specific format\n * - Ensure type safety for sort key parameters\n *\n * @example\n * ```ts\n * // Define a sort key template\n * const sk = sortKey`country#${\"country\"}#enclosure#${\"enclosure\"}#diet#${\"diet\"}`;\n *\n * // Generate a sort key with partial parameters\n * const templatedString = sk({ country: \"NZ\", enclosure: \"A1\" });\n * // Result: \"country#NZ#enclosure#A1#diet#\"\n *\n * // Generate a complete sort key\n * const fullKey = sk({ country: \"NZ\", enclosure: \"A1\", diet: \"carnivore\" });\n * // Result: \"country#NZ#enclosure#A1#diet#carnivore\"\n *\n * // Type checking ensures only valid parameters are used\n * const invalidKey = sk({ country: \"NZ\", invalid: \"value\" }); // TypeScript error\n * ```\n *\n * @param strings - The static parts of the template string\n * @param keys - The dynamic parts of the template string that will be replaced with values\n *\n * @returns A function that accepts an object with the dynamic values and returns the formatted sort key\n */\nexport function sortKey<T extends readonly string[]>(\n strings: TemplateStringsArray,\n ...keys: T\n): (params: GenerateType<T>) => string {\n return (params) => {\n let result = strings[0] ?? \"\";\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n\n if (key && params && key in params) {\n result += params[key] + (strings[i + 1] ?? \"\");\n }\n }\n\n return result;\n };\n}\n"]}
|