s3db.js 7.2.1 → 7.3.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/dist/s3db.cjs.js +149 -1489
- package/dist/s3db.cjs.min.js +1 -1
- package/dist/s3db.es.js +150 -1490
- package/dist/s3db.es.min.js +1 -1
- package/dist/s3db.iife.js +149 -1489
- package/dist/s3db.iife.min.js +1 -1
- package/package.json +15 -8
- package/src/behaviors/body-only.js +2 -2
- package/src/behaviors/truncate-data.js +2 -2
- package/src/client.class.js +1 -1
- package/src/database.class.js +1 -1
- package/src/errors.js +1 -1
- package/src/plugins/audit.plugin.js +5 -5
- package/src/plugins/cache/filesystem-cache.class.js +661 -0
- package/src/plugins/cache/index.js +4 -0
- package/src/plugins/cache/partition-aware-filesystem-cache.class.js +480 -0
- package/src/plugins/cache.plugin.js +159 -9
- package/src/plugins/consumers/index.js +3 -3
- package/src/plugins/consumers/sqs-consumer.js +2 -2
- package/src/plugins/fulltext.plugin.js +5 -5
- package/src/plugins/metrics.plugin.js +2 -2
- package/src/plugins/queue-consumer.plugin.js +3 -3
- package/src/plugins/replicator.plugin.js +259 -362
- package/src/plugins/replicators/s3db-replicator.class.js +35 -19
- package/src/plugins/replicators/sqs-replicator.class.js +17 -5
- package/src/resource.class.js +14 -14
- package/src/schema.class.js +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import tryFn from "../../concerns/try-fn.js";
|
|
2
|
-
//
|
|
2
|
+
// Remove static SDK import
|
|
3
3
|
// import { SQSClient, ReceiveMessageCommand, DeleteMessageCommand } from '@aws-sdk/client-sqs';
|
|
4
4
|
|
|
5
5
|
export class SqsConsumer {
|
|
@@ -13,7 +13,7 @@ export class SqsConsumer {
|
|
|
13
13
|
this.region = region;
|
|
14
14
|
this.credentials = credentials;
|
|
15
15
|
this.endpoint = endpoint;
|
|
16
|
-
this.sqs = null; //
|
|
16
|
+
this.sqs = null; // will be initialized dynamically
|
|
17
17
|
this._stopped = false;
|
|
18
18
|
this._timer = null;
|
|
19
19
|
this._pollPromise = null;
|
|
@@ -132,23 +132,23 @@ export class FullTextPlugin extends Plugin {
|
|
|
132
132
|
this.wrapResourceMethod(resource, 'insert', async (result, args, methodName) => {
|
|
133
133
|
const [data] = args;
|
|
134
134
|
// Index the new record
|
|
135
|
-
this.indexRecord(resource.name, result.id, data).catch(
|
|
135
|
+
this.indexRecord(resource.name, result.id, data).catch(() => {});
|
|
136
136
|
return result;
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
this.wrapResourceMethod(resource, 'update', async (result, args, methodName) => {
|
|
140
140
|
const [id, data] = args;
|
|
141
141
|
// Remove old index entries
|
|
142
|
-
this.removeRecordFromIndex(resource.name, id).catch(
|
|
142
|
+
this.removeRecordFromIndex(resource.name, id).catch(() => {});
|
|
143
143
|
// Index the updated record
|
|
144
|
-
this.indexRecord(resource.name, id, result).catch(
|
|
144
|
+
this.indexRecord(resource.name, id, result).catch(() => {});
|
|
145
145
|
return result;
|
|
146
146
|
});
|
|
147
147
|
|
|
148
148
|
this.wrapResourceMethod(resource, 'delete', async (result, args, methodName) => {
|
|
149
149
|
const [id] = args;
|
|
150
150
|
// Remove from index
|
|
151
|
-
this.removeRecordFromIndex(resource.name, id).catch(
|
|
151
|
+
this.removeRecordFromIndex(resource.name, id).catch(() => {});
|
|
152
152
|
return result;
|
|
153
153
|
});
|
|
154
154
|
|
|
@@ -156,7 +156,7 @@ export class FullTextPlugin extends Plugin {
|
|
|
156
156
|
const [ids] = args;
|
|
157
157
|
// Remove from index
|
|
158
158
|
for (const id of ids) {
|
|
159
|
-
this.removeRecordFromIndex(resource.name, id).catch(
|
|
159
|
+
this.removeRecordFromIndex(resource.name, id).catch(() => {});
|
|
160
160
|
}
|
|
161
161
|
return result;
|
|
162
162
|
});
|
|
@@ -319,7 +319,7 @@ export class MetricsPlugin extends Plugin {
|
|
|
319
319
|
// Only start timer if flushInterval is greater than 0
|
|
320
320
|
if (this.config.flushInterval > 0) {
|
|
321
321
|
this.flushTimer = setInterval(() => {
|
|
322
|
-
this.flushMetrics().catch(
|
|
322
|
+
this.flushMetrics().catch(() => {});
|
|
323
323
|
}, this.config.flushInterval);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
@@ -405,7 +405,7 @@ export class MetricsPlugin extends Plugin {
|
|
|
405
405
|
this.resetMetrics();
|
|
406
406
|
});
|
|
407
407
|
if (!ok) {
|
|
408
|
-
|
|
408
|
+
// Silent error handling
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createConsumer } from './consumers/index.js';
|
|
2
2
|
import tryFn from "../concerns/try-fn.js";
|
|
3
3
|
|
|
4
|
-
//
|
|
4
|
+
// Example configuration for SQS:
|
|
5
5
|
// const plugin = new QueueConsumerPlugin({
|
|
6
6
|
// driver: 'sqs',
|
|
7
7
|
// queues: { users: 'https://sqs.us-east-1.amazonaws.com/123456789012/my-queue' },
|
|
@@ -11,7 +11,7 @@ import tryFn from "../concerns/try-fn.js";
|
|
|
11
11
|
// maxMessages: 10,
|
|
12
12
|
// });
|
|
13
13
|
//
|
|
14
|
-
//
|
|
14
|
+
// Example configuration for RabbitMQ:
|
|
15
15
|
// const plugin = new QueueConsumerPlugin({
|
|
16
16
|
// driver: 'rabbitmq',
|
|
17
17
|
// queues: { users: 'users-queue' },
|
|
@@ -23,7 +23,7 @@ import tryFn from "../concerns/try-fn.js";
|
|
|
23
23
|
export default class QueueConsumerPlugin {
|
|
24
24
|
constructor(options = {}) {
|
|
25
25
|
this.options = options;
|
|
26
|
-
//
|
|
26
|
+
// New pattern: consumers = [{ driver, config, consumers: [{ queueUrl, resources, ... }] }]
|
|
27
27
|
this.driversConfig = Array.isArray(options.consumers) ? options.consumers : [];
|
|
28
28
|
this.consumers = [];
|
|
29
29
|
}
|