@luvio/environments 0.141.0 → 0.142.0

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.
@@ -261,7 +261,7 @@ class DurableTTLStore {
261
261
  }
262
262
  }
263
263
 
264
- function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
264
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, additionalDurableStoreOperations = []) {
265
265
  const durableRecords = create(null);
266
266
  const evictedRecords = create(null);
267
267
  const { records, metadata: storeMetadata, visitedIds, refreshedIds, } = store.fallbackStringKeyInMemoryStore;
@@ -288,7 +288,7 @@ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStor
288
288
  };
289
289
  }
290
290
  }
291
- const durableStoreOperations = [];
291
+ const durableStoreOperations = additionalDurableStoreOperations;
292
292
  // publishes
293
293
  const recordKeys = keys(durableRecords);
294
294
  if (recordKeys.length > 0) {
@@ -534,12 +534,12 @@ function makeDurable(environment, { durableStore, instrumentation }) {
534
534
  // call the base storeBroadcast
535
535
  return publishChangesToDurableStore();
536
536
  };
537
- const publishChangesToDurableStore = function () {
537
+ const publishChangesToDurableStore = function (additionalDurableStoreOperations) {
538
538
  validateNotDisposed();
539
539
  if (ingestStagingStore === null) {
540
540
  return Promise.resolve();
541
541
  }
542
- const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
542
+ const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler, additionalDurableStoreOperations);
543
543
  ingestStagingStore = null;
544
544
  return promise;
545
545
  };
@@ -1,4 +1,4 @@
1
1
  import type { InMemoryStore } from '@luvio/engine';
2
- import type { DurableStore } from '../DurableStore';
2
+ import type { DurableStore, DurableStoreOperation } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
- export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
4
+ export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler, additionalDurableStoreOperations?: DurableStoreOperation<unknown>[]): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import type { Environment, RecordSource, InMemoryStore } from '@luvio/engine';
2
- import type { DurableStore } from './DurableStore';
2
+ import type { DurableStore, DurableStoreOperation } from './DurableStore';
3
3
  import type { InstrumentationFunction } from './makeDurable/error';
4
4
  import type { TTLOverridesMap } from './DurableTTLStore';
5
5
  export interface DurableEnvironment extends Environment {
@@ -8,9 +8,12 @@ export interface DurableEnvironment extends Environment {
8
8
  */
9
9
  dispose(): Promise<void>;
10
10
  /**
11
- * publishes the pending changes to the durable store
11
+ * Publishes the pending changes in the ingestStagingStore to the durable store.
12
+ *
13
+ * Optionally takes in additional DurableStore operations to allow for an
14
+ * "atomic" transaction to the DurableStore.
12
15
  */
13
- publishChangesToDurableStore(): Promise<void>;
16
+ publishChangesToDurableStore(additionalDurableStoreOperations?: DurableStoreOperation<unknown>[]): Promise<void>;
14
17
  /**
15
18
  * gets all the stored ttl overrides stored in the durable store
16
19
  */
@@ -265,7 +265,7 @@
265
265
  }
266
266
  }
267
267
 
268
- function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
268
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, additionalDurableStoreOperations = []) {
269
269
  const durableRecords = create(null);
270
270
  const evictedRecords = create(null);
271
271
  const { records, metadata: storeMetadata, visitedIds, refreshedIds, } = store.fallbackStringKeyInMemoryStore;
@@ -292,7 +292,7 @@
292
292
  };
293
293
  }
294
294
  }
295
- const durableStoreOperations = [];
295
+ const durableStoreOperations = additionalDurableStoreOperations;
296
296
  // publishes
297
297
  const recordKeys = keys(durableRecords);
298
298
  if (recordKeys.length > 0) {
@@ -538,12 +538,12 @@
538
538
  // call the base storeBroadcast
539
539
  return publishChangesToDurableStore();
540
540
  };
541
- const publishChangesToDurableStore = function () {
541
+ const publishChangesToDurableStore = function (additionalDurableStoreOperations) {
542
542
  validateNotDisposed();
543
543
  if (ingestStagingStore === null) {
544
544
  return Promise.resolve();
545
545
  }
546
- const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
546
+ const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler, additionalDurableStoreOperations);
547
547
  ingestStagingStore = null;
548
548
  return promise;
549
549
  };
@@ -1,4 +1,4 @@
1
1
  import type { InMemoryStore } from '@luvio/engine';
2
- import type { DurableStore } from '../DurableStore';
2
+ import type { DurableStore, DurableStoreOperation } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
- export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
4
+ export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler, additionalDurableStoreOperations?: DurableStoreOperation<unknown>[]): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import type { Environment, RecordSource, InMemoryStore } from '@luvio/engine';
2
- import type { DurableStore } from './DurableStore';
2
+ import type { DurableStore, DurableStoreOperation } from './DurableStore';
3
3
  import type { InstrumentationFunction } from './makeDurable/error';
4
4
  import type { TTLOverridesMap } from './DurableTTLStore';
5
5
  export interface DurableEnvironment extends Environment {
@@ -8,9 +8,12 @@ export interface DurableEnvironment extends Environment {
8
8
  */
9
9
  dispose(): Promise<void>;
10
10
  /**
11
- * publishes the pending changes to the durable store
11
+ * Publishes the pending changes in the ingestStagingStore to the durable store.
12
+ *
13
+ * Optionally takes in additional DurableStore operations to allow for an
14
+ * "atomic" transaction to the DurableStore.
12
15
  */
13
- publishChangesToDurableStore(): Promise<void>;
16
+ publishChangesToDurableStore(additionalDurableStoreOperations?: DurableStoreOperation<unknown>[]): Promise<void>;
14
17
  /**
15
18
  * gets all the stored ttl overrides stored in the durable store
16
19
  */
@@ -336,7 +336,8 @@
336
336
  return DurableTTLStore;
337
337
  }());
338
338
 
339
- function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
339
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler, additionalDurableStoreOperations) {
340
+ if (additionalDurableStoreOperations === void 0) { additionalDurableStoreOperations = []; }
340
341
  var durableRecords = create(null);
341
342
  var evictedRecords = create(null);
342
343
  var _a = store.fallbackStringKeyInMemoryStore, records = _a.records, storeMetadata = _a.metadata, visitedIds = _a.visitedIds, refreshedIds = _a.refreshedIds;
@@ -360,7 +361,7 @@
360
361
  durableRecords[key].metadata = __assign(__assign({}, metadata), { metadataVersion: DURABLE_METADATA_VERSION });
361
362
  }
362
363
  }
363
- var durableStoreOperations = [];
364
+ var durableStoreOperations = additionalDurableStoreOperations;
364
365
  // publishes
365
366
  var recordKeys = keys(durableRecords);
366
367
  if (recordKeys.length > 0) {
@@ -645,12 +646,12 @@
645
646
  // call the base storeBroadcast
646
647
  return publishChangesToDurableStore();
647
648
  };
648
- var publishChangesToDurableStore = function () {
649
+ var publishChangesToDurableStore = function (additionalDurableStoreOperations) {
649
650
  validateNotDisposed();
650
651
  if (ingestStagingStore === null) {
651
652
  return Promise.resolve();
652
653
  }
653
- var promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
654
+ var promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler, additionalDurableStoreOperations);
654
655
  ingestStagingStore = null;
655
656
  return promise;
656
657
  };
@@ -1,4 +1,4 @@
1
1
  import type { InMemoryStore } from '@luvio/engine';
2
- import type { DurableStore } from '../DurableStore';
2
+ import type { DurableStore, DurableStoreOperation } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
- export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
4
+ export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler, additionalDurableStoreOperations?: DurableStoreOperation<unknown>[]): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import type { Environment, RecordSource, InMemoryStore } from '@luvio/engine';
2
- import type { DurableStore } from './DurableStore';
2
+ import type { DurableStore, DurableStoreOperation } from './DurableStore';
3
3
  import type { InstrumentationFunction } from './makeDurable/error';
4
4
  import type { TTLOverridesMap } from './DurableTTLStore';
5
5
  export interface DurableEnvironment extends Environment {
@@ -8,9 +8,12 @@ export interface DurableEnvironment extends Environment {
8
8
  */
9
9
  dispose(): Promise<void>;
10
10
  /**
11
- * publishes the pending changes to the durable store
11
+ * Publishes the pending changes in the ingestStagingStore to the durable store.
12
+ *
13
+ * Optionally takes in additional DurableStore operations to allow for an
14
+ * "atomic" transaction to the DurableStore.
12
15
  */
13
- publishChangesToDurableStore(): Promise<void>;
16
+ publishChangesToDurableStore(additionalDurableStoreOperations?: DurableStoreOperation<unknown>[]): Promise<void>;
14
17
  /**
15
18
  * gets all the stored ttl overrides stored in the durable store
16
19
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/environments",
3
- "version": "0.141.0",
3
+ "version": "0.142.0",
4
4
  "description": "Luvio Environments",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,7 @@
23
23
  "watch": "yarn build --watch"
24
24
  },
25
25
  "dependencies": {
26
- "@luvio/engine": "^0.141.0"
26
+ "@luvio/engine": "^0.142.0"
27
27
  },
28
28
  "volta": {
29
29
  "extends": "../../../package.json"