s3db.js 2.1.0 → 3.0.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/README.md +0 -111
- package/dist/s3db.cjs.js +13147 -0
- package/dist/s3db.cjs.min.js +21 -0
- package/dist/s3db.es.js +13115 -0
- package/dist/s3db.es.min.js +21 -0
- package/dist/s3db.iife.js +13144 -0
- package/dist/s3db.iife.min.js +21 -0
- package/docker-compose.yml +18 -0
- package/jest.config.js +22 -0
- package/package.json +33 -43
- package/rollup.config.js +77 -0
- package/scripts/prefix-files-istanbul-ignore.js +18 -0
- package/build/cache/avro.serializer.js +0 -16
- package/build/cache/json.serializer.js +0 -7
- package/build/cache/s3-cache.class.js +0 -159
- package/build/cache/s3-resource-cache.class.js +0 -75
- package/build/cache/serializers.type.js +0 -9
- package/build/errors.js +0 -64
- package/build/index.js +0 -26
- package/build/metadata.interface.js +0 -2
- package/build/plugins/costs.plugin.js +0 -65
- package/build/plugins/index.js +0 -8
- package/build/plugins/plugin.interface.js +0 -2
- package/build/s3-client.class.js +0 -305
- package/build/s3-database-config.interface.js +0 -2
- package/build/s3-database.class.js +0 -190
- package/build/s3-resource.class.js +0 -481
- package/build/s3-resource.interface.js +0 -2
- package/build/stream/index.js +0 -19
- package/build/stream/resource-ids-read-stream.class.js +0 -102
- package/build/stream/resource-ids-transformer.class.js +0 -42
- package/build/stream/resource-write-stream.class.js +0 -78
- package/build/validator.js +0 -37
- package/jest.config.ts +0 -10
- package/tsconfig.json +0 -111
package/README.md
CHANGED
|
@@ -33,7 +33,6 @@ Another way to create a cheap document-base database with an easy ORM to handle
|
|
|
33
33
|
1. <a href="#s3-client">S3 Client</a>
|
|
34
34
|
1. <a href="#events">Events</a>
|
|
35
35
|
1. <a href="#plugins">Plugins</a>
|
|
36
|
-
1. <a href="#examples">Examples</a>
|
|
37
36
|
1. <a href="#cost-simulation">Cost Simulation</a>
|
|
38
37
|
1. <a href="#big-example">Big Example</a>
|
|
39
38
|
1. <a href="#small-example">Small example</a>
|
|
@@ -799,116 +798,6 @@ We have an example of a _costs simulator plugin_ [here!](https://github.com/fora
|
|
|
799
798
|
|
|
800
799
|
---
|
|
801
800
|
|
|
802
|
-
## Examples
|
|
803
|
-
|
|
804
|
-
The processing power here was not the priority, just used my little nodebook Dell XPS. Check the `./examples` directory to get some ideas on how to use this package and the code of the examples below.
|
|
805
|
-
|
|
806
|
-
Examples' random data uses [`fakerator`](https://github.com/icebob/fakerator), git it a try!
|
|
807
|
-
|
|
808
|
-
#### [Bulk insert](https://github.com/forattini-dev/s3db.js/blob/main/examples/1-bulk-insert.js)
|
|
809
|
-
|
|
810
|
-
```bash
|
|
811
|
-
$ npm run example:1
|
|
812
|
-
|
|
813
|
-
> s3db.js@1.0.0 example:1
|
|
814
|
-
> cd examples; node 1-bulk-insert.js
|
|
815
|
-
|
|
816
|
-
creating 10000 leads.
|
|
817
|
-
parallelism of 250 requests.
|
|
818
|
-
|
|
819
|
-
bulk-writing 10000/10000 (100%) [==============================] 255/bps 0.0s (39.2s) [10001 requests]
|
|
820
|
-
bulk-writing: 40.404s
|
|
821
|
-
|
|
822
|
-
Total cost: 0.0500 USD
|
|
823
|
-
```
|
|
824
|
-
|
|
825
|
-
#### [Resource read stream](https://github.com/forattini-dev/s3db.js/blob/main/examples/2-read-stream.js)
|
|
826
|
-
|
|
827
|
-
```bash
|
|
828
|
-
$ npm run example:2
|
|
829
|
-
|
|
830
|
-
> s3db.js@1.0.0 example:2
|
|
831
|
-
> cd examples; node 2-read-stream.js
|
|
832
|
-
|
|
833
|
-
reading 10000 leads.
|
|
834
|
-
parallelism of 250 requests.
|
|
835
|
-
|
|
836
|
-
reading-pages 40/1 (100%) [==============================] 1/bps 0.0s (64.4s)
|
|
837
|
-
reading-ids 10000/10000 (100%) [==============================] 155/bps 0.0s (64.5s)
|
|
838
|
-
reading-data 10000/10000 (100%) [==============================] 153/bps 0.0s (65.3s)
|
|
839
|
-
reading: 1:07.246 (m:ss.mmm)
|
|
840
|
-
|
|
841
|
-
Total cost: 0.0041 USD
|
|
842
|
-
```
|
|
843
|
-
|
|
844
|
-
#### [Resource read stream writing into a csv](https://github.com/forattini-dev/s3db.js/blob/main/examples/3-read-stream-to-csv.js)
|
|
845
|
-
|
|
846
|
-
```bash
|
|
847
|
-
$ npm run example:3
|
|
848
|
-
|
|
849
|
-
> s3db.js@1.0.0 example:3
|
|
850
|
-
> cd examples; node 3-read-stream-to-csv.js
|
|
851
|
-
|
|
852
|
-
reading 10000 leads.
|
|
853
|
-
parallelism of 250 requests.
|
|
854
|
-
|
|
855
|
-
reading-data 10000/10000 (100%) [==============================] 123/bps 0.0s (81.3s)
|
|
856
|
-
reading-data: 1:23.852 (m:ss.mmm)
|
|
857
|
-
|
|
858
|
-
Total size: 1.31 Mb
|
|
859
|
-
```
|
|
860
|
-
|
|
861
|
-
#### [Resource read stream writing into a zipped csv](https://github.com/forattini-dev/s3db.js/blob/main/examples/4-read-stream-to-zip.js)
|
|
862
|
-
|
|
863
|
-
```bash
|
|
864
|
-
$ npm run example:4
|
|
865
|
-
|
|
866
|
-
> s3db.js@1.0.0 example:4
|
|
867
|
-
> cd examples; node 4-read-stream-to-zip.js
|
|
868
|
-
|
|
869
|
-
reading 10000 leads.
|
|
870
|
-
parallelism of 250 requests.
|
|
871
|
-
|
|
872
|
-
reading-data 10000/10000 (100%) [==============================] 141/bps 0.0s (71.0s)
|
|
873
|
-
reading-data: 1:13.078 (m:ss.mmm)
|
|
874
|
-
|
|
875
|
-
Total zip size: 0.68 Mb
|
|
876
|
-
```
|
|
877
|
-
|
|
878
|
-
#### [Write Stream](https://github.com/forattini-dev/s3db.js/blob/main/examples/5-write-stream.js)
|
|
879
|
-
|
|
880
|
-
```bash
|
|
881
|
-
$ npm run example:5
|
|
882
|
-
|
|
883
|
-
> s3db.js@1.0.0 example:6
|
|
884
|
-
> cd examples; node 5-write-stream.js
|
|
885
|
-
|
|
886
|
-
reading 10000 leads.
|
|
887
|
-
parallelism of 250 requests.
|
|
888
|
-
|
|
889
|
-
requests 20010/1 (100%) [==============================] 49/bps 0.0s (410.0s)
|
|
890
|
-
reading-pages 40/1 (100%) [==============================] 0/bps 0.0s (395.6s)
|
|
891
|
-
reading-ids 10000/10000 (100%) [==============================] 25/bps 0.0s (395.6s)
|
|
892
|
-
reading-data 10000/10000 (100%) [==============================] 25/bps 0.0s (401.5s)
|
|
893
|
-
writing-ids 10000/10000 (100%) [==============================] 25/bps 0.0s (395.7s)
|
|
894
|
-
writing-data 10000/10000 (100%) [==============================] 25/bps 0.0s (395.7s)
|
|
895
|
-
copying-data: 6:51.352 (m:ss.mmm)
|
|
896
|
-
|
|
897
|
-
Total cost: 0.0541 USD
|
|
898
|
-
```
|
|
899
|
-
|
|
900
|
-
#### [JWT Token validator](https://github.com/forattini-dev/s3db.js/blob/main/examples/6-jwt-tokens.js)
|
|
901
|
-
|
|
902
|
-
```bash
|
|
903
|
-
$ npm run example:6
|
|
904
|
-
|
|
905
|
-
> s3db.js@1.0.0 example:6
|
|
906
|
-
> cd examples; node jwt-tokens.js
|
|
907
|
-
|
|
908
|
-
Created tokens: .....
|
|
909
|
-
Validated tokens: .....
|
|
910
|
-
```
|
|
911
|
-
|
|
912
801
|
## Cost simulation
|
|
913
802
|
|
|
914
803
|
S3's pricing deep dive:
|