@event-driven-io/emmett-sqlite 0.38.1 → 0.38.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/index.cjs CHANGED
@@ -99,7 +99,7 @@ var rollbackTransaction = (db) => new Promise((resolve, reject) => {
99
99
  });
100
100
  });
101
101
 
102
- // ../emmett/dist/chunk-SJ7ERGWB.js
102
+ // ../emmett/dist/chunk-O2VMBOV4.js
103
103
  var isNumber = (val) => typeof val === "number" && val === val;
104
104
  var isBigint = (val) => typeof val === "bigint" && val === val;
105
105
  var isString = (val) => typeof val === "string";
@@ -112,6 +112,15 @@ var EmmettError = class _EmmettError extends Error {
112
112
  this.errorCode = errorCode;
113
113
  Object.setPrototypeOf(this, _EmmettError.prototype);
114
114
  }
115
+ static mapFrom(error) {
116
+ if (error instanceof _EmmettError) {
117
+ return error;
118
+ }
119
+ return new _EmmettError({
120
+ errorCode: "errorCode" in error && error.errorCode !== void 0 && error.errorCode !== null ? error.errorCode : 500,
121
+ message: _nullishCoalesce(error.message, () => ( "An unknown error occurred"))
122
+ });
123
+ }
115
124
  };
116
125
  var ConcurrencyError = class _ConcurrencyError extends EmmettError {
117
126
  constructor(current, expected, message) {
@@ -203,6 +212,7 @@ var asyncRetry = async (fn, opts) => {
203
212
  } catch (error2) {
204
213
  if (_optionalChain([opts, 'optionalAccess', _15 => _15.shouldRetryError]) && !opts.shouldRetryError(error2)) {
205
214
  bail(error2);
215
+ return void 0;
206
216
  }
207
217
  throw error2;
208
218
  }
@@ -248,10 +258,12 @@ var NotifyAboutNoActiveReadersStream = (_class = class extends _webstreamspolyfi
248
258
  }
249
259
  }
250
260
  }, _class);
251
- var contextualGetCheckpoint = (context) => "getCheckpoint" in context && context.getCheckpoint && typeof context.getCheckpoint === "function" ? context.getCheckpoint : void 0;
252
- var getCheckpoint = (message2, context) => {
253
- const getCheckpoint2 = contextualGetCheckpoint(context);
254
- return getCheckpoint2 ? getCheckpoint2(message2) : "globalPosition" in message2.metadata && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
261
+ var getCheckpoint = (message2) => {
262
+ return "checkpoint" in message2.metadata && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
263
+ isBigint(message2.metadata.checkpoint) ? (
264
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
265
+ message2.metadata.checkpoint
266
+ ) : "globalPosition" in message2.metadata && // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
255
267
  isBigint(message2.metadata.globalPosition) ? (
256
268
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
257
269
  message2.metadata.globalPosition
@@ -878,10 +890,7 @@ var genericSQLiteProcessor = (options) => {
878
890
  connection,
879
891
  fileName
880
892
  });
881
- const newPosition = getCheckpoint(
882
- typedMessage,
883
- context
884
- );
893
+ const newPosition = getCheckpoint(typedMessage);
885
894
  await storeProcessorCheckpoint(connection, {
886
895
  processorId: options.processorId,
887
896
  version: options.version,