s3db.js 8.0.0 → 8.0.2
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/PLUGINS.md +114 -39
- package/README.md +227 -0
- package/dist/s3db.cjs.js +77 -31
- package/dist/s3db.cjs.min.js +1 -1
- package/dist/s3db.d.ts +5 -0
- package/dist/s3db.es.js +77 -31
- package/dist/s3db.es.min.js +1 -1
- package/dist/s3db.iife.js +77 -31
- package/dist/s3db.iife.min.js +1 -1
- package/mcp/server.js +0 -0
- package/package.json +25 -25
- package/src/client.class.js +5 -4
- package/src/plugins/cache/memory-cache.class.js +2 -2
- package/src/plugins/cache.plugin.js +75 -21
- package/src/s3db.d.ts +5 -0
- package/mcp/README.md +0 -1062
package/dist/s3db.iife.js
CHANGED
|
@@ -6613,8 +6613,8 @@ ${JSON.stringify(validation, null, 2)}`,
|
|
|
6613
6613
|
super(config);
|
|
6614
6614
|
this.cache = {};
|
|
6615
6615
|
this.meta = {};
|
|
6616
|
-
this.maxSize = config.maxSize
|
|
6617
|
-
this.ttl = config.ttl
|
|
6616
|
+
this.maxSize = config.maxSize !== void 0 ? config.maxSize : 1e3;
|
|
6617
|
+
this.ttl = config.ttl !== void 0 ? config.ttl : 3e5;
|
|
6618
6618
|
}
|
|
6619
6619
|
async _set(key, data) {
|
|
6620
6620
|
if (this.maxSize > 0 && Object.keys(this.cache).length >= this.maxSize) {
|
|
@@ -7472,37 +7472,81 @@ ${JSON.stringify(validation, null, 2)}`,
|
|
|
7472
7472
|
class CachePlugin extends plugin_class_default {
|
|
7473
7473
|
constructor(options = {}) {
|
|
7474
7474
|
super(options);
|
|
7475
|
-
this.
|
|
7476
|
-
this.
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7475
|
+
this.driverName = options.driver || "s3";
|
|
7476
|
+
this.ttl = options.ttl;
|
|
7477
|
+
this.maxSize = options.maxSize;
|
|
7478
|
+
this.config = options.config || {};
|
|
7479
|
+
this.includePartitions = options.includePartitions !== false;
|
|
7480
|
+
this.partitionStrategy = options.partitionStrategy || "hierarchical";
|
|
7481
|
+
this.partitionAware = options.partitionAware !== false;
|
|
7482
|
+
this.trackUsage = options.trackUsage !== false;
|
|
7483
|
+
this.preloadRelated = options.preloadRelated !== false;
|
|
7484
|
+
this.legacyConfig = {
|
|
7485
|
+
memoryOptions: options.memoryOptions,
|
|
7486
|
+
filesystemOptions: options.filesystemOptions,
|
|
7487
|
+
s3Options: options.s3Options,
|
|
7488
|
+
driver: options.driver
|
|
7483
7489
|
};
|
|
7484
7490
|
}
|
|
7485
7491
|
async setup(database) {
|
|
7486
7492
|
await super.setup(database);
|
|
7487
7493
|
}
|
|
7488
7494
|
async onSetup() {
|
|
7489
|
-
if (this.
|
|
7490
|
-
this.driver = this.
|
|
7491
|
-
} else if (this.
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
+
if (this.driverName && typeof this.driverName === "object") {
|
|
7496
|
+
this.driver = this.driverName;
|
|
7497
|
+
} else if (this.driverName === "memory") {
|
|
7498
|
+
const driverConfig = {
|
|
7499
|
+
...this.legacyConfig.memoryOptions,
|
|
7500
|
+
// Legacy support (lowest priority)
|
|
7501
|
+
...this.config
|
|
7502
|
+
// New config format (medium priority)
|
|
7503
|
+
};
|
|
7504
|
+
if (this.ttl !== void 0) {
|
|
7505
|
+
driverConfig.ttl = this.ttl;
|
|
7506
|
+
}
|
|
7507
|
+
if (this.maxSize !== void 0) {
|
|
7508
|
+
driverConfig.maxSize = this.maxSize;
|
|
7509
|
+
}
|
|
7510
|
+
this.driver = new memory_cache_class_default(driverConfig);
|
|
7511
|
+
} else if (this.driverName === "filesystem") {
|
|
7512
|
+
const driverConfig = {
|
|
7513
|
+
...this.legacyConfig.filesystemOptions,
|
|
7514
|
+
// Legacy support (lowest priority)
|
|
7515
|
+
...this.config
|
|
7516
|
+
// New config format (medium priority)
|
|
7517
|
+
};
|
|
7518
|
+
if (this.ttl !== void 0) {
|
|
7519
|
+
driverConfig.ttl = this.ttl;
|
|
7520
|
+
}
|
|
7521
|
+
if (this.maxSize !== void 0) {
|
|
7522
|
+
driverConfig.maxSize = this.maxSize;
|
|
7523
|
+
}
|
|
7524
|
+
if (this.partitionAware) {
|
|
7495
7525
|
this.driver = new PartitionAwareFilesystemCache({
|
|
7496
|
-
partitionStrategy: this.
|
|
7497
|
-
trackUsage: this.
|
|
7498
|
-
preloadRelated: this.
|
|
7499
|
-
...
|
|
7526
|
+
partitionStrategy: this.partitionStrategy,
|
|
7527
|
+
trackUsage: this.trackUsage,
|
|
7528
|
+
preloadRelated: this.preloadRelated,
|
|
7529
|
+
...driverConfig
|
|
7500
7530
|
});
|
|
7501
7531
|
} else {
|
|
7502
|
-
this.driver = new FilesystemCache(
|
|
7532
|
+
this.driver = new FilesystemCache(driverConfig);
|
|
7503
7533
|
}
|
|
7504
7534
|
} else {
|
|
7505
|
-
|
|
7535
|
+
const driverConfig = {
|
|
7536
|
+
client: this.database.client,
|
|
7537
|
+
// Required for S3Cache
|
|
7538
|
+
...this.legacyConfig.s3Options,
|
|
7539
|
+
// Legacy support (lowest priority)
|
|
7540
|
+
...this.config
|
|
7541
|
+
// New config format (medium priority)
|
|
7542
|
+
};
|
|
7543
|
+
if (this.ttl !== void 0) {
|
|
7544
|
+
driverConfig.ttl = this.ttl;
|
|
7545
|
+
}
|
|
7546
|
+
if (this.maxSize !== void 0) {
|
|
7547
|
+
driverConfig.maxSize = this.maxSize;
|
|
7548
|
+
}
|
|
7549
|
+
this.driver = new s3_cache_class_default(driverConfig);
|
|
7506
7550
|
}
|
|
7507
7551
|
this.installDatabaseHooks();
|
|
7508
7552
|
this.installResourceHooks();
|
|
@@ -9611,14 +9655,16 @@ ${JSON.stringify(validation, null, 2)}`,
|
|
|
9611
9655
|
this.parallelism = parallelism;
|
|
9612
9656
|
this.config = new ConnectionString(connectionString);
|
|
9613
9657
|
this.httpClientOptions = {
|
|
9614
|
-
keepAlive:
|
|
9615
|
-
//
|
|
9616
|
-
|
|
9617
|
-
//
|
|
9618
|
-
|
|
9619
|
-
//
|
|
9620
|
-
|
|
9621
|
-
//
|
|
9658
|
+
keepAlive: true,
|
|
9659
|
+
// Enabled for better performance
|
|
9660
|
+
keepAliveMsecs: 1e3,
|
|
9661
|
+
// 1 second keep-alive
|
|
9662
|
+
maxSockets: 50,
|
|
9663
|
+
// Balanced for most applications
|
|
9664
|
+
maxFreeSockets: 10,
|
|
9665
|
+
// Good connection reuse
|
|
9666
|
+
timeout: 6e4,
|
|
9667
|
+
// 60 second timeout
|
|
9622
9668
|
...httpClientOptions
|
|
9623
9669
|
};
|
|
9624
9670
|
this.client = AwsS3Client || this.createClient();
|
|
@@ -13368,7 +13414,7 @@ ${JSON.stringify(validation, null, 2)}`,
|
|
|
13368
13414
|
super();
|
|
13369
13415
|
this.version = "1";
|
|
13370
13416
|
this.s3dbVersion = (() => {
|
|
13371
|
-
const [ok, err, version] = try_fn_default(() => true ? "
|
|
13417
|
+
const [ok, err, version] = try_fn_default(() => true ? "8.0.2" : "latest");
|
|
13372
13418
|
return ok ? version : "latest";
|
|
13373
13419
|
})();
|
|
13374
13420
|
this.resources = {};
|