s3db.js 13.6.0 → 13.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/README.md +83 -28
- package/dist/s3db.cjs +32 -1
- package/dist/s3db.cjs.map +1 -1
- package/dist/s3db.es.js +32 -1
- package/dist/s3db.es.js.map +1 -1
- package/package.json +12 -2
- package/src/plugins/api/concerns/opengraph-helper.js +116 -0
- package/src/plugins/api/concerns/state-machine.js +288 -0
- package/src/plugins/api/index.js +12 -1
- package/src/plugins/api/utils/template-engine.js +77 -3
- package/src/plugins/tfstate/README.md +126 -126
package/README.md
CHANGED
|
@@ -106,6 +106,18 @@
|
|
|
106
106
|
|
|
107
107
|
---
|
|
108
108
|
|
|
109
|
+
## 📚 Documentation Quick Links
|
|
110
|
+
|
|
111
|
+
> **Core Concepts:** [Schema Validation](./docs/schema.md) • [Client API](./docs/client.md) • [Fastest Validator](./docs/fastest-validator.md)
|
|
112
|
+
|
|
113
|
+
> **Plugins:** [API Plugin](./docs/plugins/api.md) • [Identity Plugin](./docs/plugins/identity.md) • [All Plugins](#-plugins)
|
|
114
|
+
|
|
115
|
+
> **Integrations:** [MCP Server](./docs/mcp.md) • [Model Context Protocol](./docs/mcp.md)
|
|
116
|
+
|
|
117
|
+
> **Advanced:** [Performance Tuning](./docs/benchmarks/) • [Migration Guides](./docs/examples/) • [TypeScript Support](./docs/typescript/)
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
109
121
|
## 🚀 Quick Start
|
|
110
122
|
|
|
111
123
|
Get up and running in less than 5 minutes!
|
|
@@ -1271,34 +1283,77 @@ orders.useMiddleware('updated', async (ctx, next) => {
|
|
|
1271
1283
|
|
|
1272
1284
|
## 🔌 Plugins
|
|
1273
1285
|
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1286
|
+
> **Quick Jump:** [🌐 API](#-api) | [🔐 Identity](#-identity) | [⚡ Performance](#-performance) | [📊 Data](#-data) | [🔧 DevOps](#-devops) | [🤖 ML/AI](#-mlai)
|
|
1287
|
+
|
|
1288
|
+
Extend s3db.js with powerful plugins. All plugins are optional and can be installed independently.
|
|
1289
|
+
|
|
1290
|
+
### 🌐 API & Auth
|
|
1291
|
+
|
|
1292
|
+
[**APIPlugin**](./docs/plugins/api.md) • [**IdentityPlugin**](./docs/plugins/identity.md)
|
|
1293
|
+
|
|
1294
|
+
**APIPlugin** - Transform s3db.js into production-ready REST API with OpenAPI, multi-auth (JWT/OIDC/Basic/API Key), rate limiting, and template engines.
|
|
1295
|
+
|
|
1296
|
+
**IdentityPlugin** - Complete OAuth2/OIDC server with MFA, whitelabel UI, and enterprise SSO.
|
|
1297
|
+
|
|
1298
|
+
### ⚡ Performance
|
|
1299
|
+
|
|
1300
|
+
[**CachePlugin**](./docs/plugins/cache.md) • [**TTLPlugin**](./docs/plugins/ttl.md) • [**EventualConsistencyPlugin**](./docs/plugins/eventual-consistency.md) • [**MetricsPlugin**](./docs/plugins/metrics.md)
|
|
1301
|
+
|
|
1302
|
+
**CachePlugin** - Memory/S3/filesystem caching with compression and automatic invalidation.
|
|
1303
|
+
|
|
1304
|
+
**TTLPlugin** - Auto-cleanup expired records with O(1) partition-based deletion.
|
|
1305
|
+
|
|
1306
|
+
**EventualConsistencyPlugin** - Eventually consistent counters and high-performance analytics.
|
|
1307
|
+
|
|
1308
|
+
**MetricsPlugin** - Performance monitoring with Prometheus export.
|
|
1309
|
+
|
|
1310
|
+
### 📊 Data & Replication
|
|
1311
|
+
|
|
1312
|
+
[**ReplicatorPlugin**](./docs/plugins/replicator.md) • [**ImporterPlugin**](./docs/plugins/importer.md) • [**BackupPlugin**](./docs/plugins/backup.md) • [**AuditPlugin**](./docs/plugins/audit.md)
|
|
1313
|
+
|
|
1314
|
+
**ReplicatorPlugin** - Real-time replication to BigQuery, PostgreSQL, MySQL, Turso, PlanetScale, and SQS.
|
|
1315
|
+
|
|
1316
|
+
**ImporterPlugin** - Multi-format data import (JSON, CSV, bulk migrations).
|
|
1317
|
+
|
|
1318
|
+
**BackupPlugin** - Multi-destination backup system for disaster recovery.
|
|
1319
|
+
|
|
1320
|
+
**AuditPlugin** - Complete audit trail for compliance and security.
|
|
1321
|
+
|
|
1322
|
+
### 🔧 DevOps & Automation
|
|
1323
|
+
|
|
1324
|
+
[**QueueConsumerPlugin**](./docs/plugins/queue-consumer.md) • [**SchedulerPlugin**](./docs/plugins/scheduler.md) • [**TfstatePlugin**](./docs/plugins/tfstate.md) • [**CloudInventoryPlugin**](./docs/plugins/cloud-inventory.md) • [**CostsPlugin**](./docs/plugins/costs.md)
|
|
1325
|
+
|
|
1326
|
+
**QueueConsumerPlugin** - Process RabbitMQ/SQS messages for event-driven architectures.
|
|
1327
|
+
|
|
1328
|
+
**SchedulerPlugin** - Cron-based job scheduling for maintenance tasks.
|
|
1329
|
+
|
|
1330
|
+
**TfstatePlugin** - Track Terraform infrastructure changes and drift detection.
|
|
1331
|
+
|
|
1332
|
+
**CloudInventoryPlugin** - Multi-cloud inventory with versioning and diff tracking.
|
|
1333
|
+
|
|
1334
|
+
**CostsPlugin** - AWS cost tracking and optimization insights.
|
|
1335
|
+
|
|
1336
|
+
### 🤖 ML/AI & Advanced Features
|
|
1337
|
+
|
|
1338
|
+
[**MLPlugin**](./docs/plugins/ml-plugin.md) • [**VectorPlugin**](./docs/plugins/vector.md) • [**FullTextPlugin**](./docs/plugins/fulltext.md) • [**GeoPlugin**](./docs/plugins/geo.md)
|
|
1339
|
+
|
|
1340
|
+
**MLPlugin** - Machine learning model management and inference pipelines.
|
|
1341
|
+
|
|
1342
|
+
**VectorPlugin** - Vector similarity search (cosine, euclidean) for RAG and ML applications.
|
|
1343
|
+
|
|
1344
|
+
**FullTextPlugin** - Full-text search with tokenization and indexing.
|
|
1345
|
+
|
|
1346
|
+
**GeoPlugin** - Geospatial queries and distance calculations.
|
|
1347
|
+
|
|
1348
|
+
### 🔗 Other Plugins
|
|
1349
|
+
|
|
1350
|
+
[**RelationPlugin**](./docs/plugins/relation.md) • [**StateMachinePlugin**](./docs/plugins/state-machine.md) • [**S3QueuePlugin**](./docs/plugins/s3-queue.md)
|
|
1351
|
+
|
|
1352
|
+
**RelationPlugin** - ORM-like relationships with join optimization (10-100x faster queries).
|
|
1353
|
+
|
|
1354
|
+
**StateMachinePlugin** - Finite state machine workflows for business processes.
|
|
1355
|
+
|
|
1356
|
+
**S3QueuePlugin** - Distributed queue with zero race conditions using S3.
|
|
1302
1357
|
|
|
1303
1358
|
### Plugin Installation
|
|
1304
1359
|
|
package/dist/s3db.cjs
CHANGED
|
@@ -6742,6 +6742,16 @@ async function loadEJS() {
|
|
|
6742
6742
|
);
|
|
6743
6743
|
}
|
|
6744
6744
|
}
|
|
6745
|
+
async function loadPug() {
|
|
6746
|
+
try {
|
|
6747
|
+
const pug = await import('pug');
|
|
6748
|
+
return pug.default || pug;
|
|
6749
|
+
} catch (err) {
|
|
6750
|
+
throw new Error(
|
|
6751
|
+
"Pug template engine not installed. Install with: npm install pug\nPug is a peer dependency to keep the core package lightweight."
|
|
6752
|
+
);
|
|
6753
|
+
}
|
|
6754
|
+
}
|
|
6745
6755
|
function setupTemplateEngine(options = {}) {
|
|
6746
6756
|
const {
|
|
6747
6757
|
engine = "jsx",
|
|
@@ -6756,6 +6766,27 @@ function setupTemplateEngine(options = {}) {
|
|
|
6756
6766
|
if (typeof template === "object" && template !== null) {
|
|
6757
6767
|
return c.html(template);
|
|
6758
6768
|
}
|
|
6769
|
+
if (engine === "pug") {
|
|
6770
|
+
const pug = await loadPug();
|
|
6771
|
+
const templateFile = template.endsWith(".pug") ? template : `${template}.pug`;
|
|
6772
|
+
const templatePath = path.join(templatesPath, templateFile);
|
|
6773
|
+
if (!fs$1.existsSync(templatePath)) {
|
|
6774
|
+
throw new Error(`Template not found: ${templatePath}`);
|
|
6775
|
+
}
|
|
6776
|
+
const renderData = {
|
|
6777
|
+
...data,
|
|
6778
|
+
// Add helpers that Pug templates might expect
|
|
6779
|
+
_url: c.req.url,
|
|
6780
|
+
_path: c.req.path,
|
|
6781
|
+
_method: c.req.method
|
|
6782
|
+
};
|
|
6783
|
+
const html = pug.renderFile(templatePath, {
|
|
6784
|
+
...renderData,
|
|
6785
|
+
...engineOptions,
|
|
6786
|
+
...renderOptions
|
|
6787
|
+
});
|
|
6788
|
+
return c.html(html);
|
|
6789
|
+
}
|
|
6759
6790
|
if (engine === "ejs") {
|
|
6760
6791
|
const ejs = await loadEJS();
|
|
6761
6792
|
const templateFile = template.endsWith(".ejs") ? template : `${template}.ejs`;
|
|
@@ -34068,7 +34099,7 @@ class Database extends EventEmitter {
|
|
|
34068
34099
|
})();
|
|
34069
34100
|
this.version = "1";
|
|
34070
34101
|
this.s3dbVersion = (() => {
|
|
34071
|
-
const [ok, err, version] = tryFn(() => true ? "13.6.
|
|
34102
|
+
const [ok, err, version] = tryFn(() => true ? "13.6.1" : "latest");
|
|
34072
34103
|
return ok ? version : "latest";
|
|
34073
34104
|
})();
|
|
34074
34105
|
this._resourcesMap = {};
|