s3db.js 8.1.1 → 8.1.3
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/dist/s3db.cjs.js +12 -3
- package/dist/s3db.cjs.min.js +1 -1
- package/dist/s3db.es.js +12 -3
- package/dist/s3db.es.min.js +1 -1
- package/dist/s3db.iife.js +12 -3
- package/dist/s3db.iife.min.js +1 -1
- package/package.json +1 -1
- package/src/database.class.js +16 -4
package/dist/s3db.iife.js
CHANGED
|
@@ -13493,7 +13493,7 @@ ${errorDetails}`,
|
|
|
13493
13493
|
this.id = idGenerator(7);
|
|
13494
13494
|
this.version = "1";
|
|
13495
13495
|
this.s3dbVersion = (() => {
|
|
13496
|
-
const [ok, err, version] = try_fn_default(() => true ? "8.1.
|
|
13496
|
+
const [ok, err, version] = try_fn_default(() => true ? "8.1.3" : "latest");
|
|
13497
13497
|
return ok ? version : "latest";
|
|
13498
13498
|
})();
|
|
13499
13499
|
this.resources = {};
|
|
@@ -13501,7 +13501,7 @@ ${errorDetails}`,
|
|
|
13501
13501
|
this.options = options;
|
|
13502
13502
|
this.verbose = options.verbose || false;
|
|
13503
13503
|
this.parallelism = parseInt(options.parallelism + "") || 10;
|
|
13504
|
-
this.plugins =
|
|
13504
|
+
this.plugins = {};
|
|
13505
13505
|
this.pluginList = options.plugins || [];
|
|
13506
13506
|
this.cache = options.cache;
|
|
13507
13507
|
this.passphrase = options.passphrase || "secret";
|
|
@@ -13794,6 +13794,8 @@ ${errorDetails}`,
|
|
|
13794
13794
|
if (plugin.beforeSetup) await plugin.beforeSetup();
|
|
13795
13795
|
await plugin.setup(db);
|
|
13796
13796
|
if (plugin.afterSetup) await plugin.afterSetup();
|
|
13797
|
+
const pluginName = this._getPluginName(plugin);
|
|
13798
|
+
this.plugins[pluginName] = plugin;
|
|
13797
13799
|
});
|
|
13798
13800
|
await Promise.all(setupProms);
|
|
13799
13801
|
const startProms = plugins.map(async (plugin) => {
|
|
@@ -13809,8 +13811,15 @@ ${errorDetails}`,
|
|
|
13809
13811
|
* @param {Plugin} plugin - Plugin instance to register
|
|
13810
13812
|
* @param {string} [name] - Optional name for the plugin (defaults to plugin.constructor.name)
|
|
13811
13813
|
*/
|
|
13814
|
+
/**
|
|
13815
|
+
* Get the normalized plugin name
|
|
13816
|
+
* @private
|
|
13817
|
+
*/
|
|
13818
|
+
_getPluginName(plugin, customName = null) {
|
|
13819
|
+
return customName || plugin.constructor.name.replace("Plugin", "").toLowerCase();
|
|
13820
|
+
}
|
|
13812
13821
|
async usePlugin(plugin, name = null) {
|
|
13813
|
-
const pluginName =
|
|
13822
|
+
const pluginName = this._getPluginName(plugin, name);
|
|
13814
13823
|
this.plugins[pluginName] = plugin;
|
|
13815
13824
|
if (this.isConnected()) {
|
|
13816
13825
|
await plugin.setup(this);
|