@powersync/web 0.0.0-dev-20250416123851 → 0.0.0-dev-20250417081726
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/index.umd.js +32 -320
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +106 -129
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +363 -78
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/lib/package.json +1 -2
- package/lib/src/db/adapters/AbstractWebSQLOpenFactory.d.ts +1 -2
- package/lib/src/db/adapters/AbstractWebSQLOpenFactory.js +2 -2
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.d.ts +1 -2
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.js +2 -3
- package/lib/src/db/adapters/web-sql-flags.d.ts +1 -2
- package/lib/src/db/sync/WebRemote.d.ts +1 -2
- package/lib/src/worker/sync/BroadcastLogger.d.ts +1 -1
- package/lib/src/worker/sync/BroadcastLogger.js +9 -9
- package/lib/src/worker/sync/SharedSyncImplementation.d.ts +1 -2
- package/lib/src/worker/sync/SharedSyncImplementation.js +2 -3
- package/lib/src/worker/sync/SharedSyncImplementation.worker.js +3 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
package/dist/index.umd.js
CHANGED
|
@@ -27048,288 +27048,6 @@ if (typeof Object.create === 'function') {
|
|
|
27048
27048
|
}
|
|
27049
27049
|
|
|
27050
27050
|
|
|
27051
|
-
/***/ }),
|
|
27052
|
-
|
|
27053
|
-
/***/ "../../node_modules/js-logger/src/logger.js":
|
|
27054
|
-
/*!**************************************************!*\
|
|
27055
|
-
!*** ../../node_modules/js-logger/src/logger.js ***!
|
|
27056
|
-
\**************************************************/
|
|
27057
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
27058
|
-
|
|
27059
|
-
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
27060
|
-
* js-logger - http://github.com/jonnyreeves/js-logger
|
|
27061
|
-
* Jonny Reeves, http://jonnyreeves.co.uk/
|
|
27062
|
-
* js-logger may be freely distributed under the MIT license.
|
|
27063
|
-
*/
|
|
27064
|
-
(function (global) {
|
|
27065
|
-
"use strict";
|
|
27066
|
-
|
|
27067
|
-
// Top level module for the global, static logger instance.
|
|
27068
|
-
var Logger = { };
|
|
27069
|
-
|
|
27070
|
-
// For those that are at home that are keeping score.
|
|
27071
|
-
Logger.VERSION = "1.6.1";
|
|
27072
|
-
|
|
27073
|
-
// Function which handles all incoming log messages.
|
|
27074
|
-
var logHandler;
|
|
27075
|
-
|
|
27076
|
-
// Map of ContextualLogger instances by name; used by Logger.get() to return the same named instance.
|
|
27077
|
-
var contextualLoggersByNameMap = {};
|
|
27078
|
-
|
|
27079
|
-
// Polyfill for ES5's Function.bind.
|
|
27080
|
-
var bind = function(scope, func) {
|
|
27081
|
-
return function() {
|
|
27082
|
-
return func.apply(scope, arguments);
|
|
27083
|
-
};
|
|
27084
|
-
};
|
|
27085
|
-
|
|
27086
|
-
// Super exciting object merger-matron 9000 adding another 100 bytes to your download.
|
|
27087
|
-
var merge = function () {
|
|
27088
|
-
var args = arguments, target = args[0], key, i;
|
|
27089
|
-
for (i = 1; i < args.length; i++) {
|
|
27090
|
-
for (key in args[i]) {
|
|
27091
|
-
if (!(key in target) && args[i].hasOwnProperty(key)) {
|
|
27092
|
-
target[key] = args[i][key];
|
|
27093
|
-
}
|
|
27094
|
-
}
|
|
27095
|
-
}
|
|
27096
|
-
return target;
|
|
27097
|
-
};
|
|
27098
|
-
|
|
27099
|
-
// Helper to define a logging level object; helps with optimisation.
|
|
27100
|
-
var defineLogLevel = function(value, name) {
|
|
27101
|
-
return { value: value, name: name };
|
|
27102
|
-
};
|
|
27103
|
-
|
|
27104
|
-
// Predefined logging levels.
|
|
27105
|
-
Logger.TRACE = defineLogLevel(1, 'TRACE');
|
|
27106
|
-
Logger.DEBUG = defineLogLevel(2, 'DEBUG');
|
|
27107
|
-
Logger.INFO = defineLogLevel(3, 'INFO');
|
|
27108
|
-
Logger.TIME = defineLogLevel(4, 'TIME');
|
|
27109
|
-
Logger.WARN = defineLogLevel(5, 'WARN');
|
|
27110
|
-
Logger.ERROR = defineLogLevel(8, 'ERROR');
|
|
27111
|
-
Logger.OFF = defineLogLevel(99, 'OFF');
|
|
27112
|
-
|
|
27113
|
-
// Inner class which performs the bulk of the work; ContextualLogger instances can be configured independently
|
|
27114
|
-
// of each other.
|
|
27115
|
-
var ContextualLogger = function(defaultContext) {
|
|
27116
|
-
this.context = defaultContext;
|
|
27117
|
-
this.setLevel(defaultContext.filterLevel);
|
|
27118
|
-
this.log = this.info; // Convenience alias.
|
|
27119
|
-
};
|
|
27120
|
-
|
|
27121
|
-
ContextualLogger.prototype = {
|
|
27122
|
-
// Changes the current logging level for the logging instance.
|
|
27123
|
-
setLevel: function (newLevel) {
|
|
27124
|
-
// Ensure the supplied Level object looks valid.
|
|
27125
|
-
if (newLevel && "value" in newLevel) {
|
|
27126
|
-
this.context.filterLevel = newLevel;
|
|
27127
|
-
}
|
|
27128
|
-
},
|
|
27129
|
-
|
|
27130
|
-
// Gets the current logging level for the logging instance
|
|
27131
|
-
getLevel: function () {
|
|
27132
|
-
return this.context.filterLevel;
|
|
27133
|
-
},
|
|
27134
|
-
|
|
27135
|
-
// Is the logger configured to output messages at the supplied level?
|
|
27136
|
-
enabledFor: function (lvl) {
|
|
27137
|
-
var filterLevel = this.context.filterLevel;
|
|
27138
|
-
return lvl.value >= filterLevel.value;
|
|
27139
|
-
},
|
|
27140
|
-
|
|
27141
|
-
trace: function () {
|
|
27142
|
-
this.invoke(Logger.TRACE, arguments);
|
|
27143
|
-
},
|
|
27144
|
-
|
|
27145
|
-
debug: function () {
|
|
27146
|
-
this.invoke(Logger.DEBUG, arguments);
|
|
27147
|
-
},
|
|
27148
|
-
|
|
27149
|
-
info: function () {
|
|
27150
|
-
this.invoke(Logger.INFO, arguments);
|
|
27151
|
-
},
|
|
27152
|
-
|
|
27153
|
-
warn: function () {
|
|
27154
|
-
this.invoke(Logger.WARN, arguments);
|
|
27155
|
-
},
|
|
27156
|
-
|
|
27157
|
-
error: function () {
|
|
27158
|
-
this.invoke(Logger.ERROR, arguments);
|
|
27159
|
-
},
|
|
27160
|
-
|
|
27161
|
-
time: function (label) {
|
|
27162
|
-
if (typeof label === 'string' && label.length > 0) {
|
|
27163
|
-
this.invoke(Logger.TIME, [ label, 'start' ]);
|
|
27164
|
-
}
|
|
27165
|
-
},
|
|
27166
|
-
|
|
27167
|
-
timeEnd: function (label) {
|
|
27168
|
-
if (typeof label === 'string' && label.length > 0) {
|
|
27169
|
-
this.invoke(Logger.TIME, [ label, 'end' ]);
|
|
27170
|
-
}
|
|
27171
|
-
},
|
|
27172
|
-
|
|
27173
|
-
// Invokes the logger callback if it's not being filtered.
|
|
27174
|
-
invoke: function (level, msgArgs) {
|
|
27175
|
-
if (logHandler && this.enabledFor(level)) {
|
|
27176
|
-
logHandler(msgArgs, merge({ level: level }, this.context));
|
|
27177
|
-
}
|
|
27178
|
-
}
|
|
27179
|
-
};
|
|
27180
|
-
|
|
27181
|
-
// Protected instance which all calls to the to level `Logger` module will be routed through.
|
|
27182
|
-
var globalLogger = new ContextualLogger({ filterLevel: Logger.OFF });
|
|
27183
|
-
|
|
27184
|
-
// Configure the global Logger instance.
|
|
27185
|
-
(function() {
|
|
27186
|
-
// Shortcut for optimisers.
|
|
27187
|
-
var L = Logger;
|
|
27188
|
-
|
|
27189
|
-
L.enabledFor = bind(globalLogger, globalLogger.enabledFor);
|
|
27190
|
-
L.trace = bind(globalLogger, globalLogger.trace);
|
|
27191
|
-
L.debug = bind(globalLogger, globalLogger.debug);
|
|
27192
|
-
L.time = bind(globalLogger, globalLogger.time);
|
|
27193
|
-
L.timeEnd = bind(globalLogger, globalLogger.timeEnd);
|
|
27194
|
-
L.info = bind(globalLogger, globalLogger.info);
|
|
27195
|
-
L.warn = bind(globalLogger, globalLogger.warn);
|
|
27196
|
-
L.error = bind(globalLogger, globalLogger.error);
|
|
27197
|
-
|
|
27198
|
-
// Don't forget the convenience alias!
|
|
27199
|
-
L.log = L.info;
|
|
27200
|
-
}());
|
|
27201
|
-
|
|
27202
|
-
// Set the global logging handler. The supplied function should expect two arguments, the first being an arguments
|
|
27203
|
-
// object with the supplied log messages and the second being a context object which contains a hash of stateful
|
|
27204
|
-
// parameters which the logging function can consume.
|
|
27205
|
-
Logger.setHandler = function (func) {
|
|
27206
|
-
logHandler = func;
|
|
27207
|
-
};
|
|
27208
|
-
|
|
27209
|
-
// Sets the global logging filter level which applies to *all* previously registered, and future Logger instances.
|
|
27210
|
-
// (note that named loggers (retrieved via `Logger.get`) can be configured independently if required).
|
|
27211
|
-
Logger.setLevel = function(level) {
|
|
27212
|
-
// Set the globalLogger's level.
|
|
27213
|
-
globalLogger.setLevel(level);
|
|
27214
|
-
|
|
27215
|
-
// Apply this level to all registered contextual loggers.
|
|
27216
|
-
for (var key in contextualLoggersByNameMap) {
|
|
27217
|
-
if (contextualLoggersByNameMap.hasOwnProperty(key)) {
|
|
27218
|
-
contextualLoggersByNameMap[key].setLevel(level);
|
|
27219
|
-
}
|
|
27220
|
-
}
|
|
27221
|
-
};
|
|
27222
|
-
|
|
27223
|
-
// Gets the global logging filter level
|
|
27224
|
-
Logger.getLevel = function() {
|
|
27225
|
-
return globalLogger.getLevel();
|
|
27226
|
-
};
|
|
27227
|
-
|
|
27228
|
-
// Retrieve a ContextualLogger instance. Note that named loggers automatically inherit the global logger's level,
|
|
27229
|
-
// default context and log handler.
|
|
27230
|
-
Logger.get = function (name) {
|
|
27231
|
-
// All logger instances are cached so they can be configured ahead of use.
|
|
27232
|
-
return contextualLoggersByNameMap[name] ||
|
|
27233
|
-
(contextualLoggersByNameMap[name] = new ContextualLogger(merge({ name: name }, globalLogger.context)));
|
|
27234
|
-
};
|
|
27235
|
-
|
|
27236
|
-
// CreateDefaultHandler returns a handler function which can be passed to `Logger.setHandler()` which will
|
|
27237
|
-
// write to the window's console object (if present); the optional options object can be used to customise the
|
|
27238
|
-
// formatter used to format each log message.
|
|
27239
|
-
Logger.createDefaultHandler = function (options) {
|
|
27240
|
-
options = options || {};
|
|
27241
|
-
|
|
27242
|
-
options.formatter = options.formatter || function defaultMessageFormatter(messages, context) {
|
|
27243
|
-
// Prepend the logger's name to the log message for easy identification.
|
|
27244
|
-
if (context.name) {
|
|
27245
|
-
messages.unshift("[" + context.name + "]");
|
|
27246
|
-
}
|
|
27247
|
-
};
|
|
27248
|
-
|
|
27249
|
-
// Map of timestamps by timer labels used to track `#time` and `#timeEnd()` invocations in environments
|
|
27250
|
-
// that don't offer a native console method.
|
|
27251
|
-
var timerStartTimeByLabelMap = {};
|
|
27252
|
-
|
|
27253
|
-
// Support for IE8+ (and other, slightly more sane environments)
|
|
27254
|
-
var invokeConsoleMethod = function (hdlr, messages) {
|
|
27255
|
-
Function.prototype.apply.call(hdlr, console, messages);
|
|
27256
|
-
};
|
|
27257
|
-
|
|
27258
|
-
// Check for the presence of a logger.
|
|
27259
|
-
if (typeof console === "undefined") {
|
|
27260
|
-
return function () { /* no console */ };
|
|
27261
|
-
}
|
|
27262
|
-
|
|
27263
|
-
return function(messages, context) {
|
|
27264
|
-
// Convert arguments object to Array.
|
|
27265
|
-
messages = Array.prototype.slice.call(messages);
|
|
27266
|
-
|
|
27267
|
-
var hdlr = console.log;
|
|
27268
|
-
var timerLabel;
|
|
27269
|
-
|
|
27270
|
-
if (context.level === Logger.TIME) {
|
|
27271
|
-
timerLabel = (context.name ? '[' + context.name + '] ' : '') + messages[0];
|
|
27272
|
-
|
|
27273
|
-
if (messages[1] === 'start') {
|
|
27274
|
-
if (console.time) {
|
|
27275
|
-
console.time(timerLabel);
|
|
27276
|
-
}
|
|
27277
|
-
else {
|
|
27278
|
-
timerStartTimeByLabelMap[timerLabel] = new Date().getTime();
|
|
27279
|
-
}
|
|
27280
|
-
}
|
|
27281
|
-
else {
|
|
27282
|
-
if (console.timeEnd) {
|
|
27283
|
-
console.timeEnd(timerLabel);
|
|
27284
|
-
}
|
|
27285
|
-
else {
|
|
27286
|
-
invokeConsoleMethod(hdlr, [ timerLabel + ': ' +
|
|
27287
|
-
(new Date().getTime() - timerStartTimeByLabelMap[timerLabel]) + 'ms' ]);
|
|
27288
|
-
}
|
|
27289
|
-
}
|
|
27290
|
-
}
|
|
27291
|
-
else {
|
|
27292
|
-
// Delegate through to custom warn/error loggers if present on the console.
|
|
27293
|
-
if (context.level === Logger.WARN && console.warn) {
|
|
27294
|
-
hdlr = console.warn;
|
|
27295
|
-
} else if (context.level === Logger.ERROR && console.error) {
|
|
27296
|
-
hdlr = console.error;
|
|
27297
|
-
} else if (context.level === Logger.INFO && console.info) {
|
|
27298
|
-
hdlr = console.info;
|
|
27299
|
-
} else if (context.level === Logger.DEBUG && console.debug) {
|
|
27300
|
-
hdlr = console.debug;
|
|
27301
|
-
} else if (context.level === Logger.TRACE && console.trace) {
|
|
27302
|
-
hdlr = console.trace;
|
|
27303
|
-
}
|
|
27304
|
-
|
|
27305
|
-
options.formatter(messages, context);
|
|
27306
|
-
invokeConsoleMethod(hdlr, messages);
|
|
27307
|
-
}
|
|
27308
|
-
};
|
|
27309
|
-
};
|
|
27310
|
-
|
|
27311
|
-
// Configure and example a Default implementation which writes to the `window.console` (if present). The
|
|
27312
|
-
// `options` hash can be used to configure the default logLevel and provide a custom message formatter.
|
|
27313
|
-
Logger.useDefaults = function(options) {
|
|
27314
|
-
Logger.setLevel(options && options.defaultLevel || Logger.DEBUG);
|
|
27315
|
-
Logger.setHandler(Logger.createDefaultHandler(options));
|
|
27316
|
-
};
|
|
27317
|
-
|
|
27318
|
-
// Createa an alias to useDefaults to avoid reaking a react-hooks rule.
|
|
27319
|
-
Logger.setDefaults = Logger.useDefaults;
|
|
27320
|
-
|
|
27321
|
-
// Export to popular environments boilerplate.
|
|
27322
|
-
if (true) {
|
|
27323
|
-
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (Logger),
|
|
27324
|
-
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
27325
|
-
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
|
27326
|
-
__WEBPACK_AMD_DEFINE_FACTORY__),
|
|
27327
|
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
27328
|
-
}
|
|
27329
|
-
else {}
|
|
27330
|
-
}(this));
|
|
27331
|
-
|
|
27332
|
-
|
|
27333
27051
|
/***/ }),
|
|
27334
27052
|
|
|
27335
27053
|
/***/ "../../node_modules/md5.js/index.js":
|
|
@@ -33962,8 +33680,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
33962
33680
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
33963
33681
|
/* harmony export */ AbstractWebSQLOpenFactory: () => (/* binding */ AbstractWebSQLOpenFactory)
|
|
33964
33682
|
/* harmony export */ });
|
|
33965
|
-
/* harmony import */ var
|
|
33966
|
-
/* harmony import */ var
|
|
33683
|
+
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @powersync/common */ "@powersync/common");
|
|
33684
|
+
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_powersync_common__WEBPACK_IMPORTED_MODULE_0__);
|
|
33967
33685
|
/* harmony import */ var _SSRDBAdapter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SSRDBAdapter */ "./lib/src/db/adapters/SSRDBAdapter.js");
|
|
33968
33686
|
/* harmony import */ var _web_sql_flags__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./web-sql-flags */ "./lib/src/db/adapters/web-sql-flags.js");
|
|
33969
33687
|
|
|
@@ -33976,7 +33694,7 @@ class AbstractWebSQLOpenFactory {
|
|
|
33976
33694
|
constructor(options) {
|
|
33977
33695
|
this.options = options;
|
|
33978
33696
|
this.resolvedFlags = (0,_web_sql_flags__WEBPACK_IMPORTED_MODULE_2__.resolveWebSQLFlags)(options.flags);
|
|
33979
|
-
this.logger = options.logger ??
|
|
33697
|
+
this.logger = options.logger ?? (0,_powersync_common__WEBPACK_IMPORTED_MODULE_0__.createLogger)(`AbstractWebSQLOpenFactory - ${this.options.dbFilename}`);
|
|
33980
33698
|
}
|
|
33981
33699
|
/**
|
|
33982
33700
|
* Opens a {@link DBAdapter} using resolved flags.
|
|
@@ -34016,11 +33734,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
34016
33734
|
/* harmony export */ });
|
|
34017
33735
|
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @powersync/common */ "@powersync/common");
|
|
34018
33736
|
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_powersync_common__WEBPACK_IMPORTED_MODULE_0__);
|
|
34019
|
-
/* harmony import */ var
|
|
34020
|
-
/* harmony import */ var
|
|
34021
|
-
/* harmony import */ var _shared_navigator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../..//shared/navigator */ "./lib/src/shared/navigator.js");
|
|
34022
|
-
/* harmony import */ var _WorkerWrappedAsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./WorkerWrappedAsyncDatabaseConnection */ "./lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js");
|
|
34023
|
-
|
|
33737
|
+
/* harmony import */ var _shared_navigator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../..//shared/navigator */ "./lib/src/shared/navigator.js");
|
|
33738
|
+
/* harmony import */ var _WorkerWrappedAsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./WorkerWrappedAsyncDatabaseConnection */ "./lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js");
|
|
34024
33739
|
|
|
34025
33740
|
|
|
34026
33741
|
|
|
@@ -34043,7 +33758,7 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
34043
33758
|
super();
|
|
34044
33759
|
this.options = options;
|
|
34045
33760
|
this._dbIdentifier = options.name;
|
|
34046
|
-
this.logger = options.logger ??
|
|
33761
|
+
this.logger = options.logger ?? (0,_powersync_common__WEBPACK_IMPORTED_MODULE_0__.createLogger)(`LockedAsyncDatabaseAdapter - ${this._dbIdentifier}`);
|
|
34047
33762
|
// Set the name if provided. We can query for the name if not available yet
|
|
34048
33763
|
this.debugMode = options.debugMode ?? false;
|
|
34049
33764
|
if (this.debugMode) {
|
|
@@ -34100,7 +33815,7 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
34100
33815
|
await this.initPromise;
|
|
34101
33816
|
}
|
|
34102
33817
|
async shareConnection() {
|
|
34103
|
-
if (false == this._db instanceof
|
|
33818
|
+
if (false == this._db instanceof _WorkerWrappedAsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_2__.WorkerWrappedAsyncDatabaseConnection) {
|
|
34104
33819
|
throw new Error(`Only worker connections can be shared`);
|
|
34105
33820
|
}
|
|
34106
33821
|
return this._db.shareConnection();
|
|
@@ -34157,7 +33872,7 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
34157
33872
|
return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })));
|
|
34158
33873
|
}
|
|
34159
33874
|
acquireLock(callback) {
|
|
34160
|
-
return (0,
|
|
33875
|
+
return (0,_shared_navigator__WEBPACK_IMPORTED_MODULE_1__.getNavigatorLocks)().request(`db-lock-${this._dbIdentifier}`, callback);
|
|
34161
33876
|
}
|
|
34162
33877
|
async readTransaction(fn, options) {
|
|
34163
33878
|
return this.readLock(this.wrapTransaction(fn));
|
|
@@ -35722,8 +35437,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35722
35437
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
35723
35438
|
/* harmony export */ BroadcastLogger: () => (/* binding */ BroadcastLogger)
|
|
35724
35439
|
/* harmony export */ });
|
|
35725
|
-
/* harmony import */ var
|
|
35726
|
-
/* harmony import */ var
|
|
35440
|
+
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @powersync/common */ "@powersync/common");
|
|
35441
|
+
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_powersync_common__WEBPACK_IMPORTED_MODULE_0__);
|
|
35727
35442
|
|
|
35728
35443
|
/**
|
|
35729
35444
|
* Broadcasts logs to all clients
|
|
@@ -35739,13 +35454,13 @@ class BroadcastLogger {
|
|
|
35739
35454
|
OFF;
|
|
35740
35455
|
constructor(clients) {
|
|
35741
35456
|
this.clients = clients;
|
|
35742
|
-
this.TRACE =
|
|
35743
|
-
this.DEBUG =
|
|
35744
|
-
this.INFO =
|
|
35745
|
-
this.TIME =
|
|
35746
|
-
this.WARN =
|
|
35747
|
-
this.ERROR =
|
|
35748
|
-
this.OFF =
|
|
35457
|
+
this.TRACE = _powersync_common__WEBPACK_IMPORTED_MODULE_0__.LogLevel.TRACE;
|
|
35458
|
+
this.DEBUG = _powersync_common__WEBPACK_IMPORTED_MODULE_0__.LogLevel.DEBUG;
|
|
35459
|
+
this.INFO = _powersync_common__WEBPACK_IMPORTED_MODULE_0__.LogLevel.INFO;
|
|
35460
|
+
this.TIME = _powersync_common__WEBPACK_IMPORTED_MODULE_0__.LogLevel.TIME;
|
|
35461
|
+
this.WARN = _powersync_common__WEBPACK_IMPORTED_MODULE_0__.LogLevel.WARN;
|
|
35462
|
+
this.ERROR = _powersync_common__WEBPACK_IMPORTED_MODULE_0__.LogLevel.ERROR;
|
|
35463
|
+
this.OFF = _powersync_common__WEBPACK_IMPORTED_MODULE_0__.LogLevel.OFF;
|
|
35749
35464
|
}
|
|
35750
35465
|
trace(...x) {
|
|
35751
35466
|
console.trace(...x);
|
|
@@ -35790,7 +35505,7 @@ class BroadcastLogger {
|
|
|
35790
35505
|
}
|
|
35791
35506
|
getLevel() {
|
|
35792
35507
|
// Levels are not adjustable on this level.
|
|
35793
|
-
return
|
|
35508
|
+
return _powersync_common__WEBPACK_IMPORTED_MODULE_0__.LogLevel.INFO;
|
|
35794
35509
|
}
|
|
35795
35510
|
enabledFor(level) {
|
|
35796
35511
|
// Levels are not adjustable on this level.
|
|
@@ -35850,15 +35565,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35850
35565
|
/* harmony import */ var async_mutex__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(async_mutex__WEBPACK_IMPORTED_MODULE_1__);
|
|
35851
35566
|
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! comlink */ "comlink");
|
|
35852
35567
|
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(comlink__WEBPACK_IMPORTED_MODULE_2__);
|
|
35853
|
-
/* harmony import */ var
|
|
35854
|
-
/* harmony import */ var
|
|
35855
|
-
/* harmony import */ var
|
|
35856
|
-
/* harmony import */ var
|
|
35857
|
-
/* harmony import */ var
|
|
35858
|
-
/* harmony import */ var
|
|
35859
|
-
/* harmony import */ var _shared_navigator__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../shared/navigator */ "./lib/src/shared/navigator.js");
|
|
35860
|
-
/* harmony import */ var _BroadcastLogger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./BroadcastLogger */ "./lib/src/worker/sync/BroadcastLogger.js");
|
|
35861
|
-
|
|
35568
|
+
/* harmony import */ var _db_sync_WebRemote__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../db/sync/WebRemote */ "./lib/src/db/sync/WebRemote.js");
|
|
35569
|
+
/* harmony import */ var _db_sync_WebStreamingSyncImplementation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../db/sync/WebStreamingSyncImplementation */ "./lib/src/db/sync/WebStreamingSyncImplementation.js");
|
|
35570
|
+
/* harmony import */ var _db_adapters_LockedAsyncDatabaseAdapter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../db/adapters/LockedAsyncDatabaseAdapter */ "./lib/src/db/adapters/LockedAsyncDatabaseAdapter.js");
|
|
35571
|
+
/* harmony import */ var _db_adapters_WorkerWrappedAsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../db/adapters/WorkerWrappedAsyncDatabaseConnection */ "./lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js");
|
|
35572
|
+
/* harmony import */ var _shared_navigator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../shared/navigator */ "./lib/src/shared/navigator.js");
|
|
35573
|
+
/* harmony import */ var _BroadcastLogger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./BroadcastLogger */ "./lib/src/worker/sync/BroadcastLogger.js");
|
|
35862
35574
|
|
|
35863
35575
|
|
|
35864
35576
|
|
|
@@ -35902,7 +35614,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
35902
35614
|
this.dbAdapter = null;
|
|
35903
35615
|
this.syncParams = null;
|
|
35904
35616
|
this.syncStreamClient = null;
|
|
35905
|
-
this.logger =
|
|
35617
|
+
this.logger = (0,_powersync_common__WEBPACK_IMPORTED_MODULE_0__.createLogger)('shared-sync');
|
|
35906
35618
|
this.lastConnectOptions = undefined;
|
|
35907
35619
|
this.isInitialized = new Promise((resolve) => {
|
|
35908
35620
|
const callback = this.registerListener({
|
|
@@ -35913,7 +35625,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
35913
35625
|
});
|
|
35914
35626
|
});
|
|
35915
35627
|
this.syncStatus = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SyncStatus({});
|
|
35916
|
-
this.broadCastLogger = new
|
|
35628
|
+
this.broadCastLogger = new _BroadcastLogger__WEBPACK_IMPORTED_MODULE_8__.BroadcastLogger(this.ports);
|
|
35917
35629
|
}
|
|
35918
35630
|
async waitForStatus(status) {
|
|
35919
35631
|
await this.waitForReady();
|
|
@@ -35965,7 +35677,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
35965
35677
|
async connect(options) {
|
|
35966
35678
|
await this.waitForReady();
|
|
35967
35679
|
// This effectively queues connect and disconnect calls. Ensuring multiple tabs' requests are synchronized
|
|
35968
|
-
return (0,
|
|
35680
|
+
return (0,_shared_navigator__WEBPACK_IMPORTED_MODULE_7__.getNavigatorLocks)().request('shared-sync-connect', async () => {
|
|
35969
35681
|
if (!this.dbAdapter) {
|
|
35970
35682
|
await this.openInternalDB();
|
|
35971
35683
|
}
|
|
@@ -35982,7 +35694,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
35982
35694
|
async disconnect() {
|
|
35983
35695
|
await this.waitForReady();
|
|
35984
35696
|
// This effectively queues connect and disconnect calls. Ensuring multiple tabs' requests are synchronized
|
|
35985
|
-
return (0,
|
|
35697
|
+
return (0,_shared_navigator__WEBPACK_IMPORTED_MODULE_7__.getNavigatorLocks)().request('shared-sync-connect', async () => {
|
|
35986
35698
|
await this.syncStreamClient?.disconnect();
|
|
35987
35699
|
await this.syncStreamClient?.dispose();
|
|
35988
35700
|
this.syncStreamClient = null;
|
|
@@ -36061,9 +35773,9 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
36061
35773
|
// This should only be called after initialization has completed
|
|
36062
35774
|
const syncParams = this.syncParams;
|
|
36063
35775
|
// Create a new StreamingSyncImplementation for each connect call. This is usually done is all SDKs.
|
|
36064
|
-
return new
|
|
35776
|
+
return new _db_sync_WebStreamingSyncImplementation__WEBPACK_IMPORTED_MODULE_4__.WebStreamingSyncImplementation({
|
|
36065
35777
|
adapter: new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SqliteBucketStorage(this.dbAdapter, new async_mutex__WEBPACK_IMPORTED_MODULE_1__.Mutex(), this.logger),
|
|
36066
|
-
remote: new
|
|
35778
|
+
remote: new _db_sync_WebRemote__WEBPACK_IMPORTED_MODULE_3__.WebRemote({
|
|
36067
35779
|
fetchCredentials: async () => {
|
|
36068
35780
|
const lastPort = this.ports[this.ports.length - 1];
|
|
36069
35781
|
return new Promise(async (resolve, reject) => {
|
|
@@ -36122,10 +35834,10 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
36122
35834
|
const remote = comlink__WEBPACK_IMPORTED_MODULE_2__.wrap(workerPort);
|
|
36123
35835
|
const identifier = this.syncParams.dbParams.dbFilename;
|
|
36124
35836
|
const db = await remote(this.syncParams.dbParams);
|
|
36125
|
-
const locked = new
|
|
35837
|
+
const locked = new _db_adapters_LockedAsyncDatabaseAdapter__WEBPACK_IMPORTED_MODULE_5__.LockedAsyncDatabaseAdapter({
|
|
36126
35838
|
name: identifier,
|
|
36127
35839
|
openConnection: async () => {
|
|
36128
|
-
return new
|
|
35840
|
+
return new _db_adapters_WorkerWrappedAsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_6__.WorkerWrappedAsyncDatabaseConnection({
|
|
36129
35841
|
remote,
|
|
36130
35842
|
baseConnection: db,
|
|
36131
35843
|
identifier
|