@event-driven-io/emmett-sqlite 0.43.0-beta.3 → 0.43.0-beta.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/cloudflare.d.cts +1 -1
- package/dist/cloudflare.d.ts +1 -1
- package/dist/index.cjs +16 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -10
- package/dist/index.js.map +1 -1
- package/dist/sqlite3.d.cts +1 -1
- package/dist/sqlite3.d.ts +1 -1
- package/dist/{sqliteProjection-BJ6uAnzZ.d.cts → sqliteProjection-DBJa19a5.d.cts} +2 -2
- package/dist/{sqliteProjection-BJ6uAnzZ.d.ts → sqliteProjection-DBJa19a5.d.ts} +2 -2
- package/package.json +3 -3
package/dist/cloudflare.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { D1Database } from '@cloudflare/workers-types';
|
|
2
2
|
import { d1DumboDriver, D1PoolOptions } from '@event-driven-io/dumbo/cloudflare';
|
|
3
|
-
import { E as EventStoreDriver, S as SQLiteEventStoreOptions } from './sqliteProjection-
|
|
3
|
+
import { E as EventStoreDriver, S as SQLiteEventStoreOptions } from './sqliteProjection-DBJa19a5.cjs';
|
|
4
4
|
import '@event-driven-io/dumbo';
|
|
5
5
|
import '@event-driven-io/dumbo/sqlite';
|
|
6
6
|
import '@event-driven-io/emmett';
|
package/dist/cloudflare.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { D1Database } from '@cloudflare/workers-types';
|
|
2
2
|
import { d1DumboDriver, D1PoolOptions } from '@event-driven-io/dumbo/cloudflare';
|
|
3
|
-
import { E as EventStoreDriver, S as SQLiteEventStoreOptions } from './sqliteProjection-
|
|
3
|
+
import { E as EventStoreDriver, S as SQLiteEventStoreOptions } from './sqliteProjection-DBJa19a5.js';
|
|
4
4
|
import '@event-driven-io/dumbo';
|
|
5
5
|
import '@event-driven-io/dumbo/sqlite';
|
|
6
6
|
import '@event-driven-io/emmett';
|
package/dist/index.cjs
CHANGED
|
@@ -1540,6 +1540,8 @@ var readProcessorCheckpoint = async (execute, options) => {
|
|
|
1540
1540
|
// src/eventStore/SQLiteEventStore.ts
|
|
1541
1541
|
|
|
1542
1542
|
|
|
1543
|
+
|
|
1544
|
+
|
|
1543
1545
|
// src/eventStore/consumers/messageBatchProcessing/index.ts
|
|
1544
1546
|
var DefaultSQLiteEventStoreProcessorBatchSize = 100;
|
|
1545
1547
|
var DefaultSQLiteEventStoreProcessorPullingFrequencyInMs = 50;
|
|
@@ -1802,10 +1804,10 @@ var sqliteEventStoreConsumer = (options) => {
|
|
|
1802
1804
|
if (messagePuller) {
|
|
1803
1805
|
_optionalChain([abortController, 'optionalAccess', _94 => _94.abort, 'call', _95 => _95()]);
|
|
1804
1806
|
await messagePuller.stop();
|
|
1805
|
-
messagePuller = void 0;
|
|
1806
|
-
abortController = null;
|
|
1807
1807
|
}
|
|
1808
1808
|
await start;
|
|
1809
|
+
messagePuller = void 0;
|
|
1810
|
+
abortController = null;
|
|
1809
1811
|
await stopProcessors();
|
|
1810
1812
|
};
|
|
1811
1813
|
const init = async () => {
|
|
@@ -1925,10 +1927,10 @@ var getSQLiteEventStore = (options) => {
|
|
|
1925
1927
|
let migrateSchema = void 0;
|
|
1926
1928
|
const inlineProjections = (_nullishCoalesce(options.projections, () => ( []))).filter(({ type }) => type === "inline").map(({ projection: projection2 }) => projection2);
|
|
1927
1929
|
const onBeforeCommitHook = _optionalChain([options, 'access', _98 => _98.hooks, 'optionalAccess', _99 => _99.onBeforeCommit]);
|
|
1928
|
-
const withConnection =
|
|
1930
|
+
const withConnection = (handler, options2) => pool.withConnection(async (connection) => {
|
|
1929
1931
|
await ensureSchemaExists(connection);
|
|
1930
1932
|
return await handler(connection);
|
|
1931
|
-
});
|
|
1933
|
+
}, options2);
|
|
1932
1934
|
if (options) {
|
|
1933
1935
|
autoGenerateSchema = _optionalChain([options, 'access', _100 => _100.schema, 'optionalAccess', _101 => _101.autoMigration]) === void 0 || _optionalChain([options, 'access', _102 => _102.schema, 'optionalAccess', _103 => _103.autoMigration]) !== "None";
|
|
1934
1936
|
}
|
|
@@ -1972,7 +1974,8 @@ var getSQLiteEventStore = (options) => {
|
|
|
1972
1974
|
throw new Error("Stream name is not string");
|
|
1973
1975
|
}
|
|
1974
1976
|
const result = await withConnection(
|
|
1975
|
-
({ execute }) => readStream(execute, streamName, read)
|
|
1977
|
+
({ execute }) => readStream(execute, streamName, read),
|
|
1978
|
+
{ readonly: true }
|
|
1976
1979
|
);
|
|
1977
1980
|
const currentStreamVersion = result.currentStreamVersion;
|
|
1978
1981
|
assertExpectedVersionMatchesCurrent(
|
|
@@ -1991,7 +1994,8 @@ var getSQLiteEventStore = (options) => {
|
|
|
1991
1994
|
};
|
|
1992
1995
|
},
|
|
1993
1996
|
readStream: async (streamName, options2) => withConnection(
|
|
1994
|
-
({ execute }) => readStream(execute, streamName, options2)
|
|
1997
|
+
({ execute }) => readStream(execute, streamName, options2),
|
|
1998
|
+
{ readonly: true }
|
|
1995
1999
|
),
|
|
1996
2000
|
appendToStream: async (streamName, events, appendOptions) => {
|
|
1997
2001
|
const [firstPart, ...rest] = streamName.split("-");
|
|
@@ -2008,9 +2012,11 @@ var getSQLiteEventStore = (options) => {
|
|
|
2008
2012
|
connection: context.connection,
|
|
2009
2013
|
driverType: options.driver.driverType
|
|
2010
2014
|
});
|
|
2011
|
-
if (onBeforeCommitHook)
|
|
2015
|
+
if (onBeforeCommitHook)
|
|
2016
|
+
await onBeforeCommitHook(messages, context);
|
|
2012
2017
|
}
|
|
2013
|
-
})
|
|
2018
|
+
}),
|
|
2019
|
+
{ readonly: false }
|
|
2014
2020
|
);
|
|
2015
2021
|
if (!appendResult.success)
|
|
2016
2022
|
throw new ExpectedVersionConflictError(
|
|
@@ -2026,7 +2032,8 @@ var getSQLiteEventStore = (options) => {
|
|
|
2026
2032
|
},
|
|
2027
2033
|
streamExists(streamName, options2) {
|
|
2028
2034
|
return withConnection(
|
|
2029
|
-
({ execute }) => streamExists(execute, streamName, options2)
|
|
2035
|
+
({ execute }) => streamExists(execute, streamName, options2),
|
|
2036
|
+
{ readonly: true }
|
|
2030
2037
|
);
|
|
2031
2038
|
},
|
|
2032
2039
|
consumer: (consumerOptions) => sqliteEventStoreConsumer({
|