electrodb 2.9.3 → 2.10.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.
@@ -0,0 +1,112 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ lerna-debug.log*
8
+ .DS_Store
9
+ .idea
10
+
11
+ # Diagnostic reports (https://nodejs.org/api/report.html)
12
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
13
+
14
+ # Runtime data
15
+ pids
16
+ *.pid
17
+ *.seed
18
+ *.pid.lock
19
+
20
+ # Directory for instrumented libs generated by jscoverage/JSCover
21
+ lib-cov
22
+
23
+ # Coverage directory used by tools like istanbul
24
+ coverage
25
+ *.lcov
26
+
27
+ # nyc test coverage
28
+ .nyc_output
29
+
30
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
31
+ .grunt
32
+
33
+ # Bower dependency directory (https://bower.io/)
34
+ bower_components
35
+
36
+ # node-waf configuration
37
+ .lock-wscript
38
+
39
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
40
+ build/Release
41
+
42
+ # Dependency directories
43
+ node_modules/
44
+ jspm_packages/
45
+
46
+ # TypeScript v1 declaration files
47
+ typings/
48
+
49
+ # TypeScript cache
50
+ *.tsbuildinfo
51
+
52
+ # Optional npm cache directory
53
+ .npm
54
+
55
+ # Optional eslint cache
56
+ .eslintcache
57
+
58
+ # Microbundle cache
59
+ .rpt2_cache/
60
+ .rts2_cache_cjs/
61
+ .rts2_cache_es/
62
+ .rts2_cache_umd/
63
+
64
+ # Optional REPL history
65
+ .node_repl_history
66
+
67
+ # Output of 'npm pack'
68
+ *.tgz
69
+
70
+ # Yarn Integrity file
71
+ .yarn-integrity
72
+
73
+ # dotenv environment variables file
74
+ .env
75
+ .env.test
76
+
77
+ # parcel-bundler cache (https://parceljs.org/)
78
+ .cache
79
+
80
+ # Next.js build output
81
+ .next
82
+
83
+ # Nuxt.js build / generate output
84
+ .nuxt
85
+ dist
86
+
87
+ # Gatsby files
88
+ .cache/
89
+ # Comment in the public line in if your project uses Gatsby and *not* Next.js
90
+ # https://nextjs.org/blog/next-9-1#public-directory-support
91
+ # public
92
+
93
+ # vscode
94
+ .vscode
95
+
96
+ # vuepress build output
97
+ .vuepress/dist
98
+
99
+ # Serverless directories
100
+ .serverless/
101
+
102
+ # FuseBox cache
103
+ .fusebox/
104
+
105
+ # DynamoDB Local files
106
+ .dynamodb/
107
+
108
+ # TernJS port file
109
+ .tern-port
110
+
111
+ playground/bundle.js
112
+ test/debug.ts
package/.prettierrc ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "plugins": ["prettier-plugin-astro"],
3
+ "overrides": [
4
+ {
5
+ "files": "*.astro",
6
+ "options": {
7
+ "parser": "astro"
8
+ }
9
+ }
10
+ ]
11
+ }
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # ElectroDB
2
+
2
3
  [![Download Count](https://img.shields.io/npm/dt/electrodb.svg)](https://www.npmjs.com/package/electrodb)
3
4
  [![Coverage Status](https://coveralls.io/repos/github/tywalch/electrodb/badge.svg?branch=master)](https://coveralls.io/github/tywalch/electrodb?branch=master&kill_cache=please)
4
5
  ![NPM Bundle Size](https://img.shields.io/bundlephobia/min/electrodb)
@@ -11,17 +12,17 @@
11
12
  ![Logo](./assets/electrodb-drk-compressed.png#gh-dark-mode-only)
12
13
  ![Logo](./assets/electrodb.png#gh-light-mode-only)
13
14
 
14
- ***ElectroDB*** is a DynamoDB library to ease the use of having multiple entities and complex hierarchical relationships in a single DynamoDB table.
15
+ **_ElectroDB_** is a DynamoDB library to ease the use of having multiple entities and complex hierarchical relationships in a single DynamoDB table.
15
16
 
16
- *Please submit issues/feedback or reach out on Twitter [@tinkertamper](https://twitter.com/tinkertamper).*
17
+ _Please submit issues/feedback or reach out on Twitter [@tinkertamper](https://twitter.com/tinkertamper)._
17
18
 
18
- ------------
19
+ ---
19
20
 
20
21
  <a href="https://electrodb.dev"><h1 align="center">New: Documentation now found at ElectroDB.dev</h1></a>
21
22
 
22
23
  <p align="center">ElectroDB's new website for Documentation is now live at <a href="https://electrodb.dev">www.ElectroDB.dev</a>.</p>
23
24
 
24
- ------------
25
+ ---
25
26
 
26
27
  <a href="https://electrodb.fun"><h1 align="center">Introducing: The NEW ElectroDB Playground</h1></a>
27
28
 
@@ -31,75 +32,82 @@
31
32
 
32
33
  <p align="center">Try out and share ElectroDB Models, Services, and Single Table Design at <a href="https://electrodb.fun">electrodb.fun</a></p>
33
34
 
34
- ------------
35
+ ---
35
36
 
36
37
  ## Features
38
+
37
39
  - [**Single-Table Entity Isolation**](https://electrodb.dev/en/modeling/entities/) - Entities created with **ElectroDB** will not conflict with other entities when using a single DynamoDB table.
38
40
  - [**Attribute Schema Enforcement**](https://electrodb.dev/en/modeling/attributes/) - Define a schema for your entities with enforced attribute validation, defaults, types, aliases, and more.
39
41
  - [**Easily Compose Hierarchical Access Patterns**](https://electrodb.dev/en/modeling/indexes/) - Plan and design hierarchical keys for your indexes to multiply your possible access patterns.
40
42
  - [**Simplified Sort Key Condition Querying**](https://electrodb.dev/en/queries/query/) - Write efficient sort key queries by easily building compose keys.
41
43
  - [**Simplified Filter Composition**](https://electrodb.dev/en/queries/filters/) - Easily create complex readable filters for DynamoDB queries without worrying about the implementation of `ExpressionAttributeNames`, `ExpressionAttributeValues`, and `FilterExpressions`.
42
44
  - [**Simplified Condition Composition**](https://electrodb.dev/en/mutations/conditions/) - Use the same interface to casily create complex readable mutation conditions for DynamoDB queries without worrying about the implementation of `ExpressionAttributeNames`, `ExpressionAttributeValues`, and `ConditionExpressions`.
43
- - [**Simplified Update Expression Composition**](https://electrodb.dev/en/mutations/update/) - Easily compose type safe update operations without having to format tedious `ExpressionAttributeNames`, `ExpressionAttributeValues`, and `UpdateExpressions`.
45
+ - [**Simplified Update Expression Composition**](https://electrodb.dev/en/mutations/update/) - Easily compose type safe update operations without having to format tedious `ExpressionAttributeNames`, `ExpressionAttributeValues`, and `UpdateExpressions`.
44
46
  - [**Easily Query Across Entities**](https://electrodb.dev/en/core-concepts/single-table-relationships) - Define "collections" to create powerful/idiomatic queries that return multiple entities in a single request.
45
47
  - [**Automatic Index Selection**](https://electrodb.dev/en/queries/find/) - Use `.find()` or `.match()` methods to dynamically and efficiently query based on defined sort key structures.
46
48
  - [**Simplified Pagination API**](https://electrodb.dev/en/queries/pagination/) - ElectroDB generates url safe cursors for pagination, allows for fine grain automated pagination, and supports async iteration.
47
49
  - [**TypeScript Support**](https://electrodb.dev/en/reference/typscript/) - Strong **TypeScript** support for both Entities and Services now in Beta.
48
- - [**Query Directly via the Terminal**](https://github.com/tywalch/electrocli#query-taskapp) - Execute queries against your `Entities`, `Services`, `Models` directly from the command line.
50
+ - [**Query Directly via the Terminal**](https://github.com/tywalch/electrocli#query-taskapp) - Execute queries against your `Entities`, `Services`, `Models` directly from the command line.
49
51
  - [**Stand Up Rest Server for Entities**](https://github.com/tywalch/electrocli#query-taskapp) - Stand up a REST Server to interact with your `Entities`, `Services`, `Models` for easier prototyping.
50
- - [**Use with your existing tables**](https://electrodb.dev/en/core-concepts/use-electrodb-with-existing-table/) - ElectroDB simplifies building DocumentClient parameters, so you can use it with existing tables/data.
52
+ - [**Use with your existing tables**](https://electrodb.dev/en/core-concepts/use-electrodb-with-existing-table/) - ElectroDB simplifies building DocumentClient parameters, so you can use it with existing tables/data.
51
53
 
52
- ------------
54
+ ---
53
55
 
54
56
  **Turn this**
57
+
55
58
  ```typescript
56
59
  tasks
57
- .patch({
60
+ .patch({
58
61
  team: "core",
59
- task: "45-662",
60
- project: "backend"
62
+ task: "45-662",
63
+ project: "backend",
61
64
  })
62
65
  .set({ status: "open" })
63
66
  .add({ points: 5 })
64
- .append({
65
- comments: [{
66
- user: "janet",
67
- body: "This seems half-baked."
68
- }]
67
+ .append({
68
+ comments: [
69
+ {
70
+ user: "janet",
71
+ body: "This seems half-baked.",
72
+ },
73
+ ],
69
74
  })
70
- .where(( {status}, {eq} ) => eq(status, "in-progress"))
75
+ .where(({ status }, { eq }) => eq(status, "in-progress"))
71
76
  .go();
72
77
  ```
78
+
73
79
  **Into This**
80
+
74
81
  ```json
75
82
  {
76
- "UpdateExpression": "SET #status = :status_u0, #points = #points + :points_u0, #comments = list_append(#comments, :comments_u0), #updatedAt = :updatedAt_u0, #gsi1sk = :gsi1sk_u0",
77
- "ExpressionAttributeNames": {
78
- "#status": "status",
79
- "#points": "points",
80
- "#comments": "comments",
81
- "#updatedAt": "updatedAt",
82
- "#gsi1sk": "gsi1sk"
83
- },
84
- "ExpressionAttributeValues": {
85
- ":status0": "in-progress",
86
- ":status_u0": "open",
87
- ":points_u0": 5,
88
- ":comments_u0": [
89
- {
90
- "user": "janet",
91
- "body": "This seems half-baked."
92
- }
93
- ],
94
- ":updatedAt_u0": 1630977029015,
95
- ":gsi1sk_u0": "$assignments#tasks_1#status_open"
96
- },
97
- "TableName": "your_table_name",
98
- "Key": {
99
- "pk": "$taskapp#team_core",
100
- "sk": "$tasks_1#project_backend#task_45-662"
101
- },
102
- "ConditionExpression": "attribute_exists(pk) AND attribute_exists(sk) AND #status = :status0"
83
+ "UpdateExpression": "SET #status = :status_u0, #points = #points + :points_u0, #comments = list_append(#comments, :comments_u0), #updatedAt = :updatedAt_u0, #gsi1sk = :gsi1sk_u0",
84
+ "ExpressionAttributeNames": {
85
+ "#status": "status",
86
+ "#points": "points",
87
+ "#comments": "comments",
88
+ "#updatedAt": "updatedAt",
89
+ "#gsi1sk": "gsi1sk"
90
+ },
91
+ "ExpressionAttributeValues": {
92
+ ":status0": "in-progress",
93
+ ":status_u0": "open",
94
+ ":points_u0": 5,
95
+ ":comments_u0": [
96
+ {
97
+ "user": "janet",
98
+ "body": "This seems half-baked."
99
+ }
100
+ ],
101
+ ":updatedAt_u0": 1630977029015,
102
+ ":gsi1sk_u0": "$assignments#tasks_1#status_open"
103
+ },
104
+ "TableName": "your_table_name",
105
+ "Key": {
106
+ "pk": "$taskapp#team_core",
107
+ "sk": "$tasks_1#project_backend#task_45-662"
108
+ },
109
+ "ConditionExpression": "attribute_exists(pk) AND attribute_exists(sk) AND #status = :status0"
103
110
  }
104
- ```
105
- [![Try it out!](https://img.shields.io/badge/electrodb-try_out_this_example_›-%23f9bd00?style=for-the-badge&logo=amazondynamodb&labelColor=1a212a)](https://electrodb.fun/?#code/PQKgBAsg9gJgpgGzARwK5wE4Es4GcA0YuccYGeqCALgUQBYCG5YA7llXWAGbZwB2MXGBDAAUKKwBbAA5QMVMAG8wAUT5V2AT0IBlTADcsAY1IBfbhiiSwAIkRwjVSzABGNgNzijUPrgVUGFwRSAF5bTShUDAB9AKC4aL4GSTgPcVAwABUGXABrITUNKk1hMW9ffxz8sDC+OBZVdS0AClEwJTb2sElYRAAuDq6u-iLNAZsAvNwbfE6h-UxcLB9xgEYZua7iDEMTccnchmlpG03TWaGGKicsF1QqPAHFTfaH5KeXruLpOHG-bD4AHMNkMhuQ0FhyDABk50J9zp8Dh9QV9ND8-jcgSCUWQ4BCoTCMHCUQiUdJLAArBxUZE476-Wz-LBYi448GoSFwaFgWFweGsoaoba0lH0jEA4EC0Hsznc3n8xHsYIi0FixmYyWfdoygk8olwKXtUmg+C4IzYaQaFaDOlohk2JlYhUovxXIUqoZqgDaNigPz4M1szIAtOSoIDyLhpoRfXxg3QoAgYIGbEYEFBiMmALpgHJgcp+Q1deBcBiUGm2P38U4kouyZk0D2o9G2PioSQuTDYobGz0MQG4JuvO1-OBUbug9hwSSD9USmug3tdbySFLqWfPHE8ke2BBYPwToZTmdD5v2yRHQ+gsM-eQ4Dda0FCzCn0U7h0ahdbo1FlEuWBjDa35nuKzLAo+PYQWApiPjBtafOacBXFyACCFabraLY2G2HZdr+YAlmW1ADM0ACUNQAHxgAAIshAB0fBQCwZH4eQDAwAA8nwCCAfK8Eoqg0gwMhMBoaearYe2nYYFe7QsFcRh0OMICyUQY4keRIRUbRDwMUxLGPmxnHcbx+rwmcUrMvAAAejxAV0YZUo4D5btIuSvtwOBJuMbmqe0K6yEsDwDD6bySDYWawfheQeVwXncg6uR+WAwDAPmbEPPmViBVOYC5HAmhCFwchgNITAaAwSC4HICj5SUaCYPeUEBRmU4hTYjnUimBwRbBzqgjkSyAnU3IYSiqVZQgwSOMsvi5lNTHcCVDW8EIDDmhmQiSOWWDSMEYAjOwTVbt4U3UrN4yDVgw1rjQqlWXA1njAOWCrG5wYvaseTBg91mqW5HkTRe0g8lAYARFEYAAOI6AAkmAAASOR0MAAAK5VHT4eUFVBcWIAln2+fh-nZa1wVgD6z4yZFW5LkMMX2eNaXA6D4ORBg0Nw2AABKDBAnAwA6DV2OaLj8XPUsX1JcTWUyGTDI+q6VBCr1tPmZBP6dMocT7TBpGeKIE0AAZlVQilG2A+5gHu+VgEbgnCQ8FuPSYlqWwoz5CDYVw3HcDyJFAVDRI9+53aIBy4J0dGm4pzTKJsYXjN45ATkitgACwAKzBgAbDnABMgabJ1jjjC4635QIC6mKRUfEFQcdEAEyuzr6-o2NBtftHR7EwI39brgMmed1HRz+n38dDCut2zl6Y1dFT4wUnzY5Xv+MCATYmR0FbxDTkIjAIFwwbl-lMB0V+0E5p0NdRywdCYHAzTNEoStCucSh4uYmlUXizRv7QGwIYwwRjwNMUiXcwB0UBFAMi7ggA)
111
+ ```
112
+
113
+ [![Try it out!](https://img.shields.io/badge/electrodb-try_out_this_example_›-%23f9bd00?style=for-the-badge&logo=amazondynamodb&labelColor=1a212a)](https://electrodb.fun/?#code/PQKgBAsg9gJgpgGzARwK5wE4Es4GcA0YuccYGeqCALgUQBYCG5YA7llXWAGbZwB2MXGBDAAUKKwBbAA5QMVMAG8wAUT5V2AT0IBlTADcsAY1IBfbhiiSwAIkRwjVSzABGNgNzijUPrgVUGFwRSAF5bTShUDAB9AKC4aL4GSTgPcVAwABUGXABrITUNKk1hMW9ffxz8sDC+OBZVdS0AClEwJTb2sElYRAAuDq6u-iLNAZsAvNwbfE6h-UxcLB9xgEYZua7iDEMTccn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