@relaybus/mongodb 0.2.0 → 0.3.1

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { EventStore, RelayBusLogger, IdentifierGenerator, AppendEntry, AppendResult, ClaimRequest, ClaimedDelivery, LeaseReference, ErrorInfo, DeliveryQuery, DeliveryRecord, PurgeRequest, PurgeResult, EventStoreStatistics } from '@relaybus/core';
1
+ import { EventStore, RelayBusLogger, IdentifierGenerator, EventStoreTransactionOptions, AppendEntry, AppendResult, ClaimRequest, ClaimedDelivery, LeaseReference, ErrorInfo, DeliveryQuery, DeliveryRecord, PurgeRequest, PurgeResult, EventStoreStatistics } from '@relaybus/core';
2
2
  import { ClientSession, MongoClient, TransactionOptions } from 'mongodb';
3
3
 
4
4
  interface MongoEventStoreOptions {
@@ -103,7 +103,7 @@ declare class MongoEventStore implements EventStore<ClientSession> {
103
103
  /**
104
104
  * Verifies the deployment supports transactions, creates the collections and
105
105
  * indexes and seeds the lane documents. Upgrades a 0.1.0 database in place
106
- * first (see {@link MongoEventStore.#upgradeFromVersion010}); the seeded lanes
106
+ * first (see `MongoSchema.#upgradeFromVersion010`); the seeded lanes
107
107
  * mark the upgrade as done, so later runs skip it. Safe to run repeatedly and
108
108
  * from several processes. Stop 0.1.0 workers before the first run.
109
109
  *
@@ -120,9 +120,12 @@ declare class MongoEventStore implements EventStore<ClientSession> {
120
120
  * not safe for side effects outside the session (HTTP calls, other databases),
121
121
  * so keep those out of `work`; relaybus handlers are already at-least-once.
122
122
  *
123
+ * With `options.timeoutMs` (from `bus.transaction`) the server bounds the commit with
124
+ * `maxCommitTimeMS`; the bus aborts a transaction that ran past the budget before its commit.
125
+ *
123
126
  * @throws ConfigurationError when the deployment does not support transactions.
124
127
  */
125
- transaction<T>(work: (transaction: ClientSession) => Promise<T>): Promise<T>;
128
+ transaction<T>(work: (transaction: ClientSession) => Promise<T>, options?: EventStoreTransactionOptions): Promise<T>;
126
129
  /**
127
130
  * Writes the entries in `session`. An existing event gets a delivery only for
128
131
  * handlers it does not list yet; the added handlers are appended to its list
@@ -138,7 +141,7 @@ declare class MongoEventStore implements EventStore<ClientSession> {
138
141
  * needs. It then records the batch with one write per lane and hands back the
139
142
  * lanes that yielded nothing and run nothing. No delivery document is
140
143
  * written, except for the attempt charged to deliveries of a lane taken over
141
- * and for parking (see {@link MongoEventStore.#parkDeliveries}).
144
+ * and for parking (see `MongoOrdering.#parkDeliveries`).
142
145
  *
143
146
  * Taking a lane is one conditional `findOneAndUpdate` that also moves the
144
147
  * previous owner's in-flight list to the lane's `lost` list; a lane another
@@ -166,7 +169,7 @@ declare class MongoEventStore implements EventStore<ClientSession> {
166
169
  /**
167
170
  * Completes many leases with a fixed number of round trips, whatever lanes
168
171
  * they belong to: three commands without a completion history, one
169
- * transaction with it (see {@link MongoEventStore.#deleteFenced}).
172
+ * transaction with it (see `MongoCompletion.#deleteFenced`).
170
173
  * Returns one flag per lease in input order; a lease listed twice completes
171
174
  * once, and a token this store cannot have issued is refused.
172
175
  */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { EventStore, RelayBusLogger, IdentifierGenerator, AppendEntry, AppendResult, ClaimRequest, ClaimedDelivery, LeaseReference, ErrorInfo, DeliveryQuery, DeliveryRecord, PurgeRequest, PurgeResult, EventStoreStatistics } from '@relaybus/core';
1
+ import { EventStore, RelayBusLogger, IdentifierGenerator, EventStoreTransactionOptions, AppendEntry, AppendResult, ClaimRequest, ClaimedDelivery, LeaseReference, ErrorInfo, DeliveryQuery, DeliveryRecord, PurgeRequest, PurgeResult, EventStoreStatistics } from '@relaybus/core';
2
2
  import { ClientSession, MongoClient, TransactionOptions } from 'mongodb';
3
3
 
4
4
  interface MongoEventStoreOptions {
@@ -103,7 +103,7 @@ declare class MongoEventStore implements EventStore<ClientSession> {
103
103
  /**
104
104
  * Verifies the deployment supports transactions, creates the collections and
105
105
  * indexes and seeds the lane documents. Upgrades a 0.1.0 database in place
106
- * first (see {@link MongoEventStore.#upgradeFromVersion010}); the seeded lanes
106
+ * first (see `MongoSchema.#upgradeFromVersion010`); the seeded lanes
107
107
  * mark the upgrade as done, so later runs skip it. Safe to run repeatedly and
108
108
  * from several processes. Stop 0.1.0 workers before the first run.
109
109
  *
@@ -120,9 +120,12 @@ declare class MongoEventStore implements EventStore<ClientSession> {
120
120
  * not safe for side effects outside the session (HTTP calls, other databases),
121
121
  * so keep those out of `work`; relaybus handlers are already at-least-once.
122
122
  *
123
+ * With `options.timeoutMs` (from `bus.transaction`) the server bounds the commit with
124
+ * `maxCommitTimeMS`; the bus aborts a transaction that ran past the budget before its commit.
125
+ *
123
126
  * @throws ConfigurationError when the deployment does not support transactions.
124
127
  */
125
- transaction<T>(work: (transaction: ClientSession) => Promise<T>): Promise<T>;
128
+ transaction<T>(work: (transaction: ClientSession) => Promise<T>, options?: EventStoreTransactionOptions): Promise<T>;
126
129
  /**
127
130
  * Writes the entries in `session`. An existing event gets a delivery only for
128
131
  * handlers it does not list yet; the added handlers are appended to its list
@@ -138,7 +141,7 @@ declare class MongoEventStore implements EventStore<ClientSession> {
138
141
  * needs. It then records the batch with one write per lane and hands back the
139
142
  * lanes that yielded nothing and run nothing. No delivery document is
140
143
  * written, except for the attempt charged to deliveries of a lane taken over
141
- * and for parking (see {@link MongoEventStore.#parkDeliveries}).
144
+ * and for parking (see `MongoOrdering.#parkDeliveries`).
142
145
  *
143
146
  * Taking a lane is one conditional `findOneAndUpdate` that also moves the
144
147
  * previous owner's in-flight list to the lane's `lost` list; a lane another
@@ -166,7 +169,7 @@ declare class MongoEventStore implements EventStore<ClientSession> {
166
169
  /**
167
170
  * Completes many leases with a fixed number of round trips, whatever lanes
168
171
  * they belong to: three commands without a completion history, one
169
- * transaction with it (see {@link MongoEventStore.#deleteFenced}).
172
+ * transaction with it (see `MongoCompletion.#deleteFenced`).
170
173
  * Returns one flag per lease in input order; a lease listed twice completes
171
174
  * once, and a token this store cannot have issued is refused.
172
175
  */