s3db.js 10.0.1 → 10.0.4
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 +709 -2
- package/dist/s3db.cjs.js.map +1 -1
- package/dist/s3db.d.ts +70 -3
- package/dist/s3db.es.js +709 -3
- package/dist/s3db.es.js.map +1 -1
- package/package.json +1 -1
- package/src/plugins/audit.plugin.js +4 -2
- package/src/plugins/backup.plugin.js +3 -1
- package/src/plugins/eventual-consistency.plugin.js +574 -2
- package/src/plugins/queue-consumer.plugin.js +4 -2
- package/src/s3db.d.ts +70 -3
package/src/s3db.d.ts
CHANGED
|
@@ -335,7 +335,14 @@ declare module 's3db.js' {
|
|
|
335
335
|
|
|
336
336
|
/** Replicator Plugin config */
|
|
337
337
|
export interface ReplicatorPluginConfig extends PluginConfig {
|
|
338
|
-
replicators
|
|
338
|
+
replicators: ReplicatorConfig[];
|
|
339
|
+
persistReplicatorLog?: boolean;
|
|
340
|
+
replicatorLogResource?: string;
|
|
341
|
+
logErrors?: boolean;
|
|
342
|
+
batchSize?: number;
|
|
343
|
+
maxRetries?: number;
|
|
344
|
+
timeout?: number;
|
|
345
|
+
verbose?: boolean;
|
|
339
346
|
}
|
|
340
347
|
|
|
341
348
|
// ============================================================================
|
|
@@ -1027,16 +1034,76 @@ declare module 's3db.js' {
|
|
|
1027
1034
|
getConsumerLogs(filters?: any): Promise<any[]>;
|
|
1028
1035
|
}
|
|
1029
1036
|
|
|
1037
|
+
/** Replicator stats information */
|
|
1038
|
+
export interface ReplicatorStats {
|
|
1039
|
+
replicators: Array<{
|
|
1040
|
+
id: string;
|
|
1041
|
+
driver: string;
|
|
1042
|
+
config: any;
|
|
1043
|
+
status: any;
|
|
1044
|
+
}>;
|
|
1045
|
+
stats: {
|
|
1046
|
+
totalReplications: number;
|
|
1047
|
+
totalErrors: number;
|
|
1048
|
+
lastSync: string | null;
|
|
1049
|
+
};
|
|
1050
|
+
lastSync: string | null;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1030
1053
|
/** Replicator Plugin */
|
|
1031
1054
|
export class ReplicatorPlugin extends Plugin {
|
|
1032
1055
|
constructor(config?: ReplicatorPluginConfig);
|
|
1033
1056
|
replicate(operation: string, resourceName: string, data: any, oldData?: any): Promise<void>;
|
|
1034
|
-
getReplicatorStats():
|
|
1057
|
+
getReplicatorStats(): Promise<ReplicatorStats>;
|
|
1035
1058
|
getReplicatorLogs(filters?: any): Promise<any[]>;
|
|
1036
|
-
|
|
1059
|
+
retryFailedReplicators(): Promise<{ retried: number }>;
|
|
1037
1060
|
syncAllData(targetName: string): Promise<void>;
|
|
1038
1061
|
}
|
|
1039
1062
|
|
|
1063
|
+
/** Backup Plugin */
|
|
1064
|
+
export class BackupPlugin extends Plugin {
|
|
1065
|
+
constructor(config?: any);
|
|
1066
|
+
backup(options?: any): Promise<any>;
|
|
1067
|
+
restore(options?: any): Promise<any>;
|
|
1068
|
+
listBackups(): Promise<any[]>;
|
|
1069
|
+
deleteBackup(backupId: string): Promise<void>;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/** Eventual Consistency Plugin */
|
|
1073
|
+
export class EventualConsistencyPlugin extends Plugin {
|
|
1074
|
+
constructor(config?: any);
|
|
1075
|
+
setup(database: Database): Promise<void>;
|
|
1076
|
+
createTransaction(resourceName: string): any;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/** Scheduler Plugin */
|
|
1080
|
+
export class SchedulerPlugin extends Plugin {
|
|
1081
|
+
constructor(config?: any);
|
|
1082
|
+
schedule(name: string, schedule: string, handler: Function): void;
|
|
1083
|
+
unschedule(name: string): void;
|
|
1084
|
+
listSchedules(): any[];
|
|
1085
|
+
getScheduleStatus(name: string): any;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
/** State Machine Plugin */
|
|
1089
|
+
export class StateMachinePlugin extends Plugin {
|
|
1090
|
+
constructor(config?: any);
|
|
1091
|
+
defineMachine(config: any): void;
|
|
1092
|
+
transition(options: { machineId: string; entityId: string; event: string; context?: any }): Promise<any>;
|
|
1093
|
+
getCurrentState(machineId: string, entityId: string): Promise<any>;
|
|
1094
|
+
getTransitionHistory(machineId: string, entityId: string, options?: any): Promise<any[]>;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
/** S3 Queue Plugin */
|
|
1098
|
+
export class S3QueuePlugin extends Plugin {
|
|
1099
|
+
constructor(config?: any);
|
|
1100
|
+
enqueue(queueName: string, item: any): Promise<void>;
|
|
1101
|
+
dequeue(queueName: string): Promise<any>;
|
|
1102
|
+
peek(queueName: string): Promise<any>;
|
|
1103
|
+
getQueueLength(queueName: string): Promise<number>;
|
|
1104
|
+
clearQueue(queueName: string): Promise<void>;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1040
1107
|
// ============================================================================
|
|
1041
1108
|
// REPLICATOR CLASSES
|
|
1042
1109
|
// ============================================================================
|