dyno-table 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/utils.cjs CHANGED
@@ -1,14 +1,32 @@
1
1
  'use strict';
2
2
 
3
- var chunkPB7BBCZO_cjs = require('./chunk-PB7BBCZO.cjs');
3
+ // src/utils/partition-key-template.ts
4
+ function partitionKey(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) {
10
+ result += params[key] + (strings[i + 1] ?? "");
11
+ }
12
+ }
13
+ return result;
14
+ };
15
+ }
4
16
 
17
+ // src/utils/sort-key-template.ts
18
+ function sortKey(strings, ...keys) {
19
+ return (params) => {
20
+ let result = strings[0] ?? "";
21
+ for (let i = 0; i < keys.length; i++) {
22
+ const key = keys[i];
23
+ if (key && params && key in params) {
24
+ result += params[key] + (strings[i + 1] ?? "");
25
+ }
26
+ }
27
+ return result;
28
+ };
29
+ }
5
30
 
6
-
7
- Object.defineProperty(exports, "partitionKey", {
8
- enumerable: true,
9
- get: function () { return chunkPB7BBCZO_cjs.partitionKey; }
10
- });
11
- Object.defineProperty(exports, "sortKey", {
12
- enumerable: true,
13
- get: function () { return chunkPB7BBCZO_cjs.sortKey; }
14
- });
31
+ exports.partitionKey = partitionKey;
32
+ exports.sortKey = sortKey;
package/dist/utils.js CHANGED
@@ -1 +1,29 @@
1
- export { partitionKey, sortKey } from './chunk-QVRMYGC4.js';
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
+ // src/utils/sort-key-template.ts
16
+ function sortKey(strings, ...keys) {
17
+ return (params) => {
18
+ let result = strings[0] ?? "";
19
+ for (let i = 0; i < keys.length; i++) {
20
+ const key = keys[i];
21
+ if (key && params && key in params) {
22
+ result += params[key] + (strings[i + 1] ?? "");
23
+ }
24
+ }
25
+ return result;
26
+ };
27
+ }
28
+
29
+ export { partitionKey, sortKey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dyno-table",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "description": "A TypeScript library to simplify working with DynamoDB",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -8,84 +8,69 @@
8
8
  "type": "module",
9
9
  "exports": {
10
10
  ".": {
11
- "import": {
12
- "types": "./dist/index.d.ts",
13
- "default": "./dist/index.js"
14
- },
15
- "require": {
16
- "types": "./dist/index.d.ts",
17
- "default": "./dist/index.cjs"
18
- }
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
19
14
  },
20
15
  "./table": {
21
- "import": {
22
- "types": "./dist/table.d.ts",
23
- "default": "./dist/table.js"
24
- },
25
- "require": {
26
- "types": "./dist/table.d.ts",
27
- "default": "./dist/table.cjs"
28
- }
16
+ "types": "./dist/table.d.ts",
17
+ "import": "./dist/table.js",
18
+ "require": "./dist/table.cjs"
29
19
  },
30
20
  "./entity": {
31
- "import": {
32
- "types": "./dist/entity.d.ts",
33
- "default": "./dist/entity.js"
34
- },
35
- "require": {
36
- "types": "./dist/entity.d.ts",
37
- "default": "./dist/entity.cjs"
38
- }
21
+ "types": "./dist/entity.d.ts",
22
+ "import": "./dist/entity.js",
23
+ "require": "./dist/entity.cjs"
39
24
  },
40
25
  "./conditions": {
41
- "import": {
42
- "types": "./dist/conditions.d.ts",
43
- "default": "./dist/conditions.js"
44
- },
45
- "require": {
46
- "types": "./dist/conditions.d.ts",
47
- "default": "./dist/conditions.cjs"
48
- }
26
+ "types": "./dist/conditions.d.ts",
27
+ "import": "./dist/conditions.js",
28
+ "require": "./dist/conditions.cjs"
49
29
  },
50
30
  "./types": {
51
- "import": {
52
- "types": "./dist/types.d.ts",
53
- "default": "./dist/types.js"
54
- },
55
- "require": {
56
- "types": "./dist/types.d.ts",
57
- "default": "./dist/types.cjs"
58
- }
31
+ "types": "./dist/types.d.ts",
32
+ "import": "./dist/types.js",
33
+ "require": "./dist/types.cjs"
59
34
  },
60
35
  "./standard-schema": {
61
- "import": {
62
- "types": "./dist/standard-schema.d.ts",
63
- "default": "./dist/standard-schema.js"
64
- },
65
- "require": {
66
- "types": "./dist/standard-schema.d.ts",
67
- "default": "./dist/standard-schema.cjs"
68
- }
36
+ "types": "./dist/standard-schema.d.ts",
37
+ "import": "./dist/standard-schema.js",
38
+ "require": "./dist/standard-schema.cjs"
69
39
  },
70
40
  "./utils": {
71
- "import": {
72
- "types": "./dist/utils.d.ts",
73
- "default": "./dist/utils.js"
74
- },
75
- "require": {
76
- "types": "./dist/utils.d.ts",
77
- "default": "./dist/utils.cjs"
78
- }
41
+ "types": "./dist/utils.d.ts",
42
+ "import": "./dist/utils.js",
43
+ "require": "./dist/utils.cjs"
79
44
  },
80
45
  "./builders": {
81
- "import": {
82
- "types": "./dist/builders.d.ts",
83
- "default": "./dist/builders.js"
84
- },
85
- "require": {
86
- "types": "./dist/builders.d.ts",
87
- "default": "./dist/builders.cjs"
88
- }
46
+ "types": "./dist/builders.d.ts",
47
+ "import": "./dist/builders.js",
48
+ "require": "./dist/builders.cjs"
49
+ }
50
+ },
51
+ "typesVersions": {
52
+ "*": {
53
+ "table": [
54
+ "dist/table.d.ts"
55
+ ],
56
+ "entity": [
57
+ "dist/entity.d.ts"
58
+ ],
59
+ "conditions": [
60
+ "dist/conditions.d.ts"
61
+ ],
62
+ "types": [
63
+ "dist/types.d.ts"
64
+ ],
65
+ "standard-schema": [
66
+ "dist/standard-schema.d.ts"
67
+ ],
68
+ "utils": [
69
+ "dist/utils.d.ts"
70
+ ],
71
+ "builders": [
72
+ "dist/builders.d.ts"
73
+ ]
89
74
  }
90
75
  },
91
76
  "scripts": {
@@ -1,46 +0,0 @@
1
- // src/conditions.ts
2
- var createComparisonCondition = (type) => (attr, value) => ({
3
- type,
4
- attr,
5
- value
6
- });
7
- var eq = createComparisonCondition("eq");
8
- var ne = createComparisonCondition("ne");
9
- var lt = createComparisonCondition("lt");
10
- var lte = createComparisonCondition("lte");
11
- var gt = createComparisonCondition("gt");
12
- var gte = createComparisonCondition("gte");
13
- var between = (attr, lower, upper) => ({
14
- type: "between",
15
- attr,
16
- value: [lower, upper]
17
- });
18
- var inArray = (attr, values) => ({
19
- type: "in",
20
- attr,
21
- value: values
22
- });
23
- var beginsWith = createComparisonCondition("beginsWith");
24
- var contains = createComparisonCondition("contains");
25
- var attributeExists = (attr) => ({
26
- type: "attributeExists",
27
- attr
28
- });
29
- var attributeNotExists = (attr) => ({
30
- type: "attributeNotExists",
31
- attr
32
- });
33
- var and = (...conditions) => ({
34
- type: "and",
35
- conditions
36
- });
37
- var or = (...conditions) => ({
38
- type: "or",
39
- conditions
40
- });
41
- var not = (condition) => ({
42
- type: "not",
43
- condition
44
- });
45
-
46
- export { and, attributeExists, attributeNotExists, beginsWith, between, contains, createComparisonCondition, eq, gt, gte, inArray, lt, lte, ne, not, or };