@event-driven-io/emmett-sqlite 0.38.0-alpha.4 → 0.38.0-alpha.5

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.cjs CHANGED
@@ -99,7 +99,7 @@ var rollbackTransaction = (db) => new Promise((resolve, reject) => {
99
99
  });
100
100
  });
101
101
 
102
- // ../emmett/dist/chunk-BQYVGGNE.js
102
+ // ../emmett/dist/chunk-SJ7ERGWB.js
103
103
  var isNumber = (val) => typeof val === "number" && val === val;
104
104
  var isString = (val) => typeof val === "string";
105
105
  var EmmettError = class _EmmettError extends Error {
@@ -126,12 +126,12 @@ var ConcurrencyError = class _ConcurrencyError extends EmmettError {
126
126
 
127
127
  // ../emmett/dist/index.js
128
128
  var _uuid = require('uuid');
129
- var _webstreamspolyfill = require('web-streams-polyfill');
130
129
 
130
+ var _asyncretry = require('async-retry'); var _asyncretry2 = _interopRequireDefault(_asyncretry);
131
131
 
132
+ var _webstreamspolyfill = require('web-streams-polyfill');
132
133
 
133
134
 
134
- var _asyncretry = require('async-retry'); var _asyncretry2 = _interopRequireDefault(_asyncretry);
135
135
 
136
136
 
137
137
 
@@ -166,44 +166,6 @@ var ExpectedVersionConflictError = class _ExpectedVersionConflictError extends C
166
166
  Object.setPrototypeOf(this, _ExpectedVersionConflictError.prototype);
167
167
  }
168
168
  };
169
- var notifyAboutNoActiveReadersStream = (onNoActiveReaderCallback, options = {}) => new NotifyAboutNoActiveReadersStream(onNoActiveReaderCallback, options);
170
- var NotifyAboutNoActiveReadersStream = (_class = class extends _webstreamspolyfill.TransformStream {
171
- constructor(onNoActiveReaderCallback, options = {}) {
172
- super({
173
- cancel: (reason) => {
174
- console.log("Stream was canceled. Reason:", reason);
175
- this.stopChecking();
176
- }
177
- });_class.prototype.__init.call(this);_class.prototype.__init2.call(this);;
178
- this.onNoActiveReaderCallback = onNoActiveReaderCallback;
179
- this.streamId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _8 => _8.streamId]), () => ( _uuid.v4.call(void 0, )));
180
- this.onNoActiveReaderCallback = onNoActiveReaderCallback;
181
- this.startChecking(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _9 => _9.intervalCheckInMs]), () => ( 20)));
182
- }
183
- __init() {this.checkInterval = null}
184
-
185
- __init2() {this._isStopped = false}
186
- get hasActiveSubscribers() {
187
- return !this._isStopped;
188
- }
189
- startChecking(interval) {
190
- this.checkInterval = setInterval(() => {
191
- this.checkNoActiveReader();
192
- }, interval);
193
- }
194
- stopChecking() {
195
- if (!this.checkInterval) return;
196
- clearInterval(this.checkInterval);
197
- this.checkInterval = null;
198
- this._isStopped = true;
199
- this.onNoActiveReaderCallback(this);
200
- }
201
- checkNoActiveReader() {
202
- if (!this.readable.locked && !this._isStopped) {
203
- this.stopChecking();
204
- }
205
- }
206
- }, _class);
207
169
  var ParseError = class extends Error {
208
170
  constructor(text) {
209
171
  super(`Cannot parse! ${text}`);
@@ -212,17 +174,17 @@ var ParseError = class extends Error {
212
174
  var JSONParser = {
213
175
  stringify: (value, options) => {
214
176
  return JSON.stringify(
215
- _optionalChain([options, 'optionalAccess', _10 => _10.map]) ? options.map(value) : value,
177
+ _optionalChain([options, 'optionalAccess', _8 => _8.map]) ? options.map(value) : value,
216
178
  //TODO: Consider adding support to DateTime and adding specific format to mark that's a bigint
217
179
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
218
180
  (_, v) => typeof v === "bigint" ? v.toString() : v
219
181
  );
220
182
  },
221
183
  parse: (text, options) => {
222
- const parsed = JSON.parse(text, _optionalChain([options, 'optionalAccess', _11 => _11.reviver]));
223
- if (_optionalChain([options, 'optionalAccess', _12 => _12.typeCheck]) && !_optionalChain([options, 'optionalAccess', _13 => _13.typeCheck, 'call', _14 => _14(parsed)]))
184
+ const parsed = JSON.parse(text, _optionalChain([options, 'optionalAccess', _9 => _9.reviver]));
185
+ if (_optionalChain([options, 'optionalAccess', _10 => _10.typeCheck]) && !_optionalChain([options, 'optionalAccess', _11 => _11.typeCheck, 'call', _12 => _12(parsed)]))
224
186
  throw new ParseError(text);
225
- return _optionalChain([options, 'optionalAccess', _15 => _15.map]) ? options.map(parsed) : parsed;
187
+ return _optionalChain([options, 'optionalAccess', _13 => _13.map]) ? options.map(parsed) : parsed;
226
188
  }
227
189
  };
228
190
  var asyncRetry = async (fn, opts) => {
@@ -231,14 +193,14 @@ var asyncRetry = async (fn, opts) => {
231
193
  async (bail) => {
232
194
  try {
233
195
  const result = await fn();
234
- if (_optionalChain([opts, 'optionalAccess', _16 => _16.shouldRetryResult]) && opts.shouldRetryResult(result)) {
196
+ if (_optionalChain([opts, 'optionalAccess', _14 => _14.shouldRetryResult]) && opts.shouldRetryResult(result)) {
235
197
  throw new EmmettError(
236
198
  `Retrying because of result: ${JSONParser.stringify(result)}`
237
199
  );
238
200
  }
239
201
  return result;
240
202
  } catch (error2) {
241
- if (_optionalChain([opts, 'optionalAccess', _17 => _17.shouldRetryError]) && !opts.shouldRetryError(error2)) {
203
+ if (_optionalChain([opts, 'optionalAccess', _15 => _15.shouldRetryError]) && !opts.shouldRetryError(error2)) {
242
204
  bail(error2);
243
205
  }
244
206
  throw error2;
@@ -247,6 +209,44 @@ var asyncRetry = async (fn, opts) => {
247
209
  _nullishCoalesce(opts, () => ( { retries: 0 }))
248
210
  );
249
211
  };
212
+ var notifyAboutNoActiveReadersStream = (onNoActiveReaderCallback, options = {}) => new NotifyAboutNoActiveReadersStream(onNoActiveReaderCallback, options);
213
+ var NotifyAboutNoActiveReadersStream = (_class = class extends _webstreamspolyfill.TransformStream {
214
+ constructor(onNoActiveReaderCallback, options = {}) {
215
+ super({
216
+ cancel: (reason) => {
217
+ console.log("Stream was canceled. Reason:", reason);
218
+ this.stopChecking();
219
+ }
220
+ });_class.prototype.__init.call(this);_class.prototype.__init2.call(this);;
221
+ this.onNoActiveReaderCallback = onNoActiveReaderCallback;
222
+ this.streamId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _16 => _16.streamId]), () => ( _uuid.v4.call(void 0, )));
223
+ this.onNoActiveReaderCallback = onNoActiveReaderCallback;
224
+ this.startChecking(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _17 => _17.intervalCheckInMs]), () => ( 20)));
225
+ }
226
+ __init() {this.checkInterval = null}
227
+
228
+ __init2() {this._isStopped = false}
229
+ get hasActiveSubscribers() {
230
+ return !this._isStopped;
231
+ }
232
+ startChecking(interval) {
233
+ this.checkInterval = setInterval(() => {
234
+ this.checkNoActiveReader();
235
+ }, interval);
236
+ }
237
+ stopChecking() {
238
+ if (!this.checkInterval) return;
239
+ clearInterval(this.checkInterval);
240
+ this.checkInterval = null;
241
+ this._isStopped = true;
242
+ this.onNoActiveReaderCallback(this);
243
+ }
244
+ checkNoActiveReader() {
245
+ if (!this.readable.locked && !this._isStopped) {
246
+ this.stopChecking();
247
+ }
248
+ }
249
+ }, _class);
250
250
  var filter = (filter2) => new (0, _webstreamspolyfill.TransformStream)({
251
251
  transform(chunk, controller) {
252
252
  if (filter2(chunk)) {