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 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
- - [๐ŸŽ›๏ธ Advanced Behaviors](#๏ธ-advanced-behaviors)
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
- tableName: 's3db_replication',
600
- ssl: false
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
- ### ๐ŸŽ›๏ธ Advanced Behaviors
930
+ ### ๐ŸŽ›๏ธ Resource Behaviors
949
931
 
950
932
  Choose the right behavior strategy for your use case:
951
933