s3db.js 6.1.0 โ 6.2.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 +29 -47
- package/dist/s3db.cjs.js +312 -117
- package/dist/s3db.cjs.min.js +1 -1
- package/dist/s3db.es.js +312 -117
- package/dist/s3db.es.min.js +1 -1
- package/dist/s3db.iife.js +312 -117
- package/dist/s3db.iife.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -93,6 +93,8 @@
|
|
|
93
93
|
|
|
94
94
|
## ๐ Table of Contents
|
|
95
95
|
|
|
96
|
+
- [๐ What is s3db.js?](#-what-is-s3dbjs)
|
|
97
|
+
- [โจ Key Features](#-key-features)
|
|
96
98
|
- [๐ Quick Start](#-quick-start)
|
|
97
99
|
- [๐พ Installation](#-installation)
|
|
98
100
|
- [๐ฏ Core Concepts](#-core-concepts)
|
|
@@ -100,22 +102,13 @@
|
|
|
100
102
|
- [๐ Resource Versioning System](#-resource-versioning-system)
|
|
101
103
|
- [๐ Custom ID Generation](#-custom-id-generation)
|
|
102
104
|
- [๐ Plugin System](#-plugin-system)
|
|
103
|
-
- [
|
|
105
|
+
- [๐ Replicator System](#-replicator-system)
|
|
106
|
+
- [๐๏ธ Resource Behaviors](#๏ธ-resource-behaviors)
|
|
104
107
|
- [๐ Advanced Streaming API](#-advanced-streaming-api)
|
|
105
108
|
- [๐ Binary Content Management](#-binary-content-management)
|
|
106
109
|
- [๐๏ธ Advanced Partitioning](#๏ธ-advanced-partitioning)
|
|
107
110
|
- [๐ฃ Advanced Hooks System](#-advanced-hooks-system)
|
|
108
111
|
- [๐ API Reference](#-api-reference)
|
|
109
|
-
- [๐จ Examples](#-examples)
|
|
110
|
-
- [๐ Security](#-security)
|
|
111
|
-
- [โ๏ธ Advanced Configuration Options](#๏ธ-advanced-configuration-options)
|
|
112
|
-
- [๐ก Events and Emitters](#-events-and-emitters)
|
|
113
|
-
- [๐ง Troubleshooting](#-troubleshooting)
|
|
114
|
-
- [๐ฐ Cost Analysis](#-cost-analysis)
|
|
115
|
-
- [๐จ Best Practices](#-best-practices)
|
|
116
|
-
- [๐งช Testing](#-testing)
|
|
117
|
-
- [๐ค Contributing](#-contributing)
|
|
118
|
-
- [๐ License](#-license)
|
|
119
112
|
|
|
120
113
|
---
|
|
121
114
|
|
|
@@ -545,7 +538,6 @@ The Replication Plugin now supports a flexible driver-based system for replicati
|
|
|
545
538
|
resources: ['users', 'products'], // <-- root level
|
|
546
539
|
config: {
|
|
547
540
|
connectionString: "s3://BACKUP_KEY:BACKUP_SECRET@BACKUP_BUCKET/backup",
|
|
548
|
-
region: 'us-west-2'
|
|
549
541
|
}
|
|
550
542
|
}
|
|
551
543
|
```
|
|
@@ -568,17 +560,26 @@ The Replication Plugin now supports a flexible driver-based system for replicati
|
|
|
568
560
|
```javascript
|
|
569
561
|
{
|
|
570
562
|
driver: 'bigquery',
|
|
571
|
-
resources: ['users', 'orders'],
|
|
572
563
|
config: {
|
|
573
564
|
projectId: 'my-project',
|
|
574
565
|
datasetId: 'analytics',
|
|
575
|
-
tableId: 's3db_replication',
|
|
576
566
|
location: 'US',
|
|
567
|
+
logTable: 's3db_replication_log',
|
|
577
568
|
credentials: {
|
|
578
569
|
// Your Google Cloud service account credentials
|
|
579
570
|
client_email: 'service-account@project.iam.gserviceaccount.com',
|
|
580
571
|
private_key: '-----BEGIN PRIVATE KEY-----\n...'
|
|
581
572
|
}
|
|
573
|
+
},
|
|
574
|
+
resources: {
|
|
575
|
+
users: [
|
|
576
|
+
{ actions: ['insert', 'update', 'delete'], table: 'users_table' },
|
|
577
|
+
],
|
|
578
|
+
orders: [
|
|
579
|
+
{ actions: ['insert'], table: 'orders_table' },
|
|
580
|
+
{ actions: ['insert'], table: 'orders_analytics' }, // Also replicate to analytics table
|
|
581
|
+
],
|
|
582
|
+
products: 'products_table' // Short form: equivalent to { actions: ['insert'], table: 'products_table' }
|
|
582
583
|
}
|
|
583
584
|
}
|
|
584
585
|
```
|
|
@@ -587,7 +588,6 @@ The Replication Plugin now supports a flexible driver-based system for replicati
|
|
|
587
588
|
```javascript
|
|
588
589
|
{
|
|
589
590
|
driver: 'postgres',
|
|
590
|
-
resources: ['users'],
|
|
591
591
|
config: {
|
|
592
592
|
connectionString: 'postgresql://user:pass@localhost:5432/analytics',
|
|
593
593
|
// OR individual parameters:
|
|
@@ -596,8 +596,18 @@ The Replication Plugin now supports a flexible driver-based system for replicati
|
|
|
596
596
|
// database: 'analytics',
|
|
597
597
|
// user: 'user',
|
|
598
598
|
// password: 'pass',
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
ssl: false,
|
|
600
|
+
logTable: 's3db_replication_log'
|
|
601
|
+
},
|
|
602
|
+
resources: {
|
|
603
|
+
users: [
|
|
604
|
+
{ actions: ['insert', 'update', 'delete'], table: 'users_table' },
|
|
605
|
+
],
|
|
606
|
+
orders: [
|
|
607
|
+
{ actions: ['insert'], table: 'orders_table' },
|
|
608
|
+
{ actions: ['insert'], table: 'orders_analytics' }, // Also replicate to analytics table
|
|
609
|
+
],
|
|
610
|
+
products: 'products_table' // Short form: equivalent to { actions: ['insert'], table: 'products_table' }
|
|
601
611
|
}
|
|
602
612
|
}
|
|
603
613
|
```
|
|
@@ -611,32 +621,6 @@ The Replication Plugin now supports a flexible driver-based system for replicati
|
|
|
611
621
|
- **Error Handling**: Comprehensive error handling and retry logic
|
|
612
622
|
- **Status Monitoring**: Get detailed status and statistics for each replicator
|
|
613
623
|
|
|
614
|
-
#### Dependencies
|
|
615
|
-
|
|
616
|
-
The replicators use optional peer dependencies. Install only what you need:
|
|
617
|
-
|
|
618
|
-
```bash
|
|
619
|
-
# For SQS replicator
|
|
620
|
-
npm install @aws-sdk/client-sqs
|
|
621
|
-
# or
|
|
622
|
-
yarn add @aws-sdk/client-sqs
|
|
623
|
-
# or
|
|
624
|
-
pnpm add @aws-sdk/client-sqs
|
|
625
|
-
|
|
626
|
-
# For BigQuery replicator
|
|
627
|
-
npm install @google-cloud/bigquery
|
|
628
|
-
# or
|
|
629
|
-
yarn add @google-cloud/bigquery
|
|
630
|
-
# or
|
|
631
|
-
pnpm add @google-cloud/bigquery
|
|
632
|
-
|
|
633
|
-
# For PostgreSQL replicator
|
|
634
|
-
npm install pg
|
|
635
|
-
# or
|
|
636
|
-
yarn add pg
|
|
637
|
-
# or
|
|
638
|
-
pnpm add pg
|
|
639
|
-
```
|
|
640
624
|
|
|
641
625
|
**โ ๏ธ Important:** These dependencies are marked as `peerDependencies` in the package.json, which means they are not automatically installed with s3db.js. You must install them manually if you plan to use the corresponding replicators. If you don't install the required dependency, the replicator will throw an error when trying to initialize.
|
|
642
626
|
|
|
@@ -658,8 +642,6 @@ See `examples/e34-replicators.js` for a complete example using all four replicat
|
|
|
658
642
|
npm install @aws-sdk/client-sqs @google-cloud/bigquery pg
|
|
659
643
|
```
|
|
660
644
|
|
|
661
|
-
#### ๐ Cache Plugin
|
|
662
|
-
|
|
663
645
|
#### ๐ Cache Plugin
|
|
664
646
|
Intelligent caching to reduce API calls and improve performance:
|
|
665
647
|
|
|
@@ -877,6 +859,7 @@ const s3db = new S3db({
|
|
|
877
859
|
|
|
878
860
|
// Data is automatically replicated to all configured targets
|
|
879
861
|
await users.insert({ name: "John" }); // Synced to all replicators
|
|
862
|
+
```
|
|
880
863
|
|
|
881
864
|
**SQS Message Structure:**
|
|
882
865
|
|
|
@@ -917,7 +900,6 @@ The SQS replicator sends standardized messages with the following structure:
|
|
|
917
900
|
- Unspecified resources use the default queue
|
|
918
901
|
- FIFO queues supported with deduplication
|
|
919
902
|
- Messages are automatically routed to the appropriate queue
|
|
920
|
-
```
|
|
921
903
|
|
|
922
904
|
#### ๐ Audit Plugin
|
|
923
905
|
Log all operations for compliance and traceability:
|
|
@@ -945,7 +927,7 @@ const logs = await s3db.plugins.audit.getAuditLogs({
|
|
|
945
927
|
console.log(logs); // Audit trail
|
|
946
928
|
```
|
|
947
929
|
|
|
948
|
-
### ๐๏ธ
|
|
930
|
+
### ๐๏ธ Resource Behaviors
|
|
949
931
|
|
|
950
932
|
Choose the right behavior strategy for your use case:
|
|
951
933
|
|