@luvio/environments 0.83.0 → 0.86.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.
package/README.md CHANGED
@@ -5,7 +5,7 @@ NOTE: This package is PRE-PRODUCTION and should not be consumed by applications
5
5
  Example of durable store environment being configured:
6
6
 
7
7
  ```ts
8
- const store = new Store();
8
+ const store = new InMemoryStore();
9
9
  const durableStore = new MyDurableStoreImplementation();
10
10
  const env = makeDurable(new Environment(store, network), { durableStore });
11
11
  const luvio = new Luvio(env);
@@ -1,3 +1,4 @@
1
+ import type { IntegrityInfo } from '@luvio/engine';
1
2
  /**
2
3
  * Contains store entry data along with any metadata for that entry that needs
3
4
  * to be persisted to durable storage
@@ -14,6 +15,7 @@ export interface DurableStoreEntry<T = unknown> {
14
15
  expirationTimestamp: number;
15
16
  namespace: string;
16
17
  representationName: string;
18
+ integrityInfo?: IntegrityInfo;
17
19
  };
18
20
  }
19
21
  export declare function isDeprecatedDurableStoreEntry(durableRecord: unknown): boolean;
@@ -14,7 +14,7 @@ export interface TTLOverridesMap {
14
14
  overrides: DurableTTLOverride[];
15
15
  }
16
16
  /**
17
- * Class to set and get the TTL override values in the Durable Store
17
+ * Class to set and get the TTL override values in the Durable InMemoryStore
18
18
  */
19
19
  export declare class DurableTTLStore {
20
20
  private durableStore;
@@ -1,4 +1,4 @@
1
- import { buildStaleWhileRevalidateImplementation, Store } from '@luvio/engine';
1
+ import { buildStaleWhileRevalidateImplementation, InMemoryStore } from '@luvio/engine';
2
2
 
3
3
  function isDeprecatedDurableStoreEntry(durableRecord) {
4
4
  if (durableRecord.expiration !== undefined) {
@@ -206,7 +206,7 @@ function isDefaultDurableTTLOverride(override) {
206
206
  return (override.namespace === TTL_DEFAULT_KEY && override.representationName === TTL_DEFAULT_KEY);
207
207
  }
208
208
  /**
209
- * Class to set and get the TTL override values in the Durable Store
209
+ * Class to set and get the TTL override values in the Durable InMemoryStore
210
210
  */
211
211
  class DurableTTLStore {
212
212
  constructor(durableStore) {
@@ -273,7 +273,7 @@ function copy(source) {
273
273
  }
274
274
  return { ...source };
275
275
  }
276
- function flushStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
276
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
277
277
  const durableRecords = create(null);
278
278
  const evictedRecords = create(null);
279
279
  const { records, metadata: storeMetadata, visitedIds, refreshedIds } = store;
@@ -445,7 +445,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
445
445
  const storePublish = function (key, data) {
446
446
  validateNotDisposed();
447
447
  if (ingestStagingStore === null) {
448
- ingestStagingStore = new Store();
448
+ ingestStagingStore = new InMemoryStore();
449
449
  }
450
450
  ingestStagingStore.publish(key, data);
451
451
  // remove record from main luvio L1 cache while we are on the synchronous path
@@ -457,7 +457,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
457
457
  const publishStoreMetadata = function (recordId, storeMetadata) {
458
458
  validateNotDisposed();
459
459
  if (ingestStagingStore === null) {
460
- ingestStagingStore = new Store();
460
+ ingestStagingStore = new InMemoryStore();
461
461
  }
462
462
  ingestStagingStore.publishMetadata(recordId, storeMetadata);
463
463
  };
@@ -466,14 +466,14 @@ function makeDurable(environment, { durableStore, instrumentation }) {
466
466
  // we don't ingest to the luvio L1 store from network directly, we ingest to
467
467
  // L2 and let DurableStore on change event revive keys into luvio L1 store
468
468
  if (ingestStagingStore === null) {
469
- ingestStagingStore = new Store();
469
+ ingestStagingStore = new InMemoryStore();
470
470
  }
471
471
  environment.storeIngest(key, ingest, response, luvio, ingestStagingStore);
472
472
  };
473
473
  const storeIngestError = function (key, errorSnapshot, storeMetadataParams, _storeOverride) {
474
474
  validateNotDisposed();
475
475
  if (ingestStagingStore === null) {
476
- ingestStagingStore = new Store();
476
+ ingestStagingStore = new InMemoryStore();
477
477
  }
478
478
  environment.storeIngestError(key, errorSnapshot, storeMetadataParams, ingestStagingStore);
479
479
  };
@@ -488,7 +488,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
488
488
  if (ingestStagingStore === null) {
489
489
  return Promise.resolve();
490
490
  }
491
- const promise = flushStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
491
+ const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
492
492
  ingestStagingStore = null;
493
493
  return promise;
494
494
  };
@@ -505,21 +505,21 @@ function makeDurable(environment, { durableStore, instrumentation }) {
505
505
  const storeEvict = function (key) {
506
506
  validateNotDisposed();
507
507
  if (ingestStagingStore === null) {
508
- ingestStagingStore = new Store();
508
+ ingestStagingStore = new InMemoryStore();
509
509
  }
510
510
  ingestStagingStore.evict(key);
511
511
  };
512
512
  const getNode = function (key) {
513
513
  validateNotDisposed();
514
514
  if (ingestStagingStore === null) {
515
- ingestStagingStore = new Store();
515
+ ingestStagingStore = new InMemoryStore();
516
516
  }
517
517
  return environment.getNode(key, ingestStagingStore);
518
518
  };
519
519
  const wrapNormalizedGraphNode = function (normalized) {
520
520
  validateNotDisposed();
521
521
  if (ingestStagingStore === null) {
522
- ingestStagingStore = new Store();
522
+ ingestStagingStore = new InMemoryStore();
523
523
  }
524
524
  return environment.wrapNormalizedGraphNode(normalized, ingestStagingStore);
525
525
  };
@@ -634,7 +634,7 @@ function makeDurable(environment, { durableStore, instrumentation }) {
634
634
  const toPrime = existingRecords !== undefined
635
635
  ? { ...revivedRecords, ...existingRecords }
636
636
  : revivedRecords;
637
- ingestStagingStore = new Store();
637
+ ingestStagingStore = new InMemoryStore();
638
638
  ingestStagingStore.records = toPrime;
639
639
  const snapshotFromMemoryIngest = ingestAndBroadcastFunc();
640
640
  return publishChangesToDurableStore().then(() => {
@@ -1,4 +1,4 @@
1
- import type { Store } from '@luvio/engine';
1
+ import type { InMemoryStore } from '@luvio/engine';
2
2
  import type { DurableStore } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
- export declare function flushStoreValuesToDurableStore(store: Store, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
4
+ export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import type { CacheKeySet, Environment, RecordSource, Snapshot } from '@luvio/engine';
2
- import { Store } from '@luvio/engine';
2
+ import { InMemoryStore } from '@luvio/engine';
3
3
  import type { DurableStore } from './DurableStore';
4
4
  import type { InstrumentationFunction } from './makeDurable/error';
5
5
  import type { TTLOverridesMap } from './DurableTTLStore';
@@ -25,7 +25,7 @@ export interface DurableEnvironment extends Environment {
25
25
  * Gets the ingest staging store metadata if called during the ingestion
26
26
  * flow, otherwise returns an empty object.
27
27
  */
28
- getIngestStagingStoreMetadata(): Store['metadata'];
28
+ getIngestStagingStoreMetadata(): InMemoryStore['metadata'];
29
29
  /**
30
30
  * Overload of Environment.handleSuccessResponse that takes in an optional
31
31
  * RecordSource to "prime" the ingest staging store with before calling
@@ -1,3 +1,4 @@
1
+ import type { IntegrityInfo } from '@luvio/engine';
1
2
  /**
2
3
  * Contains store entry data along with any metadata for that entry that needs
3
4
  * to be persisted to durable storage
@@ -14,6 +15,7 @@ export interface DurableStoreEntry<T = unknown> {
14
15
  expirationTimestamp: number;
15
16
  namespace: string;
16
17
  representationName: string;
18
+ integrityInfo?: IntegrityInfo;
17
19
  };
18
20
  }
19
21
  export declare function isDeprecatedDurableStoreEntry(durableRecord: unknown): boolean;
@@ -14,7 +14,7 @@ export interface TTLOverridesMap {
14
14
  overrides: DurableTTLOverride[];
15
15
  }
16
16
  /**
17
- * Class to set and get the TTL override values in the Durable Store
17
+ * Class to set and get the TTL override values in the Durable InMemoryStore
18
18
  */
19
19
  export declare class DurableTTLStore {
20
20
  private durableStore;
@@ -210,7 +210,7 @@
210
210
  return (override.namespace === TTL_DEFAULT_KEY && override.representationName === TTL_DEFAULT_KEY);
211
211
  }
212
212
  /**
213
- * Class to set and get the TTL override values in the Durable Store
213
+ * Class to set and get the TTL override values in the Durable InMemoryStore
214
214
  */
215
215
  class DurableTTLStore {
216
216
  constructor(durableStore) {
@@ -277,7 +277,7 @@
277
277
  }
278
278
  return { ...source };
279
279
  }
280
- function flushStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
280
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
281
281
  const durableRecords = create(null);
282
282
  const evictedRecords = create(null);
283
283
  const { records, metadata: storeMetadata, visitedIds, refreshedIds } = store;
@@ -449,7 +449,7 @@
449
449
  const storePublish = function (key, data) {
450
450
  validateNotDisposed();
451
451
  if (ingestStagingStore === null) {
452
- ingestStagingStore = new engine.Store();
452
+ ingestStagingStore = new engine.InMemoryStore();
453
453
  }
454
454
  ingestStagingStore.publish(key, data);
455
455
  // remove record from main luvio L1 cache while we are on the synchronous path
@@ -461,7 +461,7 @@
461
461
  const publishStoreMetadata = function (recordId, storeMetadata) {
462
462
  validateNotDisposed();
463
463
  if (ingestStagingStore === null) {
464
- ingestStagingStore = new engine.Store();
464
+ ingestStagingStore = new engine.InMemoryStore();
465
465
  }
466
466
  ingestStagingStore.publishMetadata(recordId, storeMetadata);
467
467
  };
@@ -470,14 +470,14 @@
470
470
  // we don't ingest to the luvio L1 store from network directly, we ingest to
471
471
  // L2 and let DurableStore on change event revive keys into luvio L1 store
472
472
  if (ingestStagingStore === null) {
473
- ingestStagingStore = new engine.Store();
473
+ ingestStagingStore = new engine.InMemoryStore();
474
474
  }
475
475
  environment.storeIngest(key, ingest, response, luvio, ingestStagingStore);
476
476
  };
477
477
  const storeIngestError = function (key, errorSnapshot, storeMetadataParams, _storeOverride) {
478
478
  validateNotDisposed();
479
479
  if (ingestStagingStore === null) {
480
- ingestStagingStore = new engine.Store();
480
+ ingestStagingStore = new engine.InMemoryStore();
481
481
  }
482
482
  environment.storeIngestError(key, errorSnapshot, storeMetadataParams, ingestStagingStore);
483
483
  };
@@ -492,7 +492,7 @@
492
492
  if (ingestStagingStore === null) {
493
493
  return Promise.resolve();
494
494
  }
495
- const promise = flushStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
495
+ const promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
496
496
  ingestStagingStore = null;
497
497
  return promise;
498
498
  };
@@ -509,21 +509,21 @@
509
509
  const storeEvict = function (key) {
510
510
  validateNotDisposed();
511
511
  if (ingestStagingStore === null) {
512
- ingestStagingStore = new engine.Store();
512
+ ingestStagingStore = new engine.InMemoryStore();
513
513
  }
514
514
  ingestStagingStore.evict(key);
515
515
  };
516
516
  const getNode = function (key) {
517
517
  validateNotDisposed();
518
518
  if (ingestStagingStore === null) {
519
- ingestStagingStore = new engine.Store();
519
+ ingestStagingStore = new engine.InMemoryStore();
520
520
  }
521
521
  return environment.getNode(key, ingestStagingStore);
522
522
  };
523
523
  const wrapNormalizedGraphNode = function (normalized) {
524
524
  validateNotDisposed();
525
525
  if (ingestStagingStore === null) {
526
- ingestStagingStore = new engine.Store();
526
+ ingestStagingStore = new engine.InMemoryStore();
527
527
  }
528
528
  return environment.wrapNormalizedGraphNode(normalized, ingestStagingStore);
529
529
  };
@@ -638,7 +638,7 @@
638
638
  const toPrime = existingRecords !== undefined
639
639
  ? { ...revivedRecords, ...existingRecords }
640
640
  : revivedRecords;
641
- ingestStagingStore = new engine.Store();
641
+ ingestStagingStore = new engine.InMemoryStore();
642
642
  ingestStagingStore.records = toPrime;
643
643
  const snapshotFromMemoryIngest = ingestAndBroadcastFunc();
644
644
  return publishChangesToDurableStore().then(() => {
@@ -1,4 +1,4 @@
1
- import type { Store } from '@luvio/engine';
1
+ import type { InMemoryStore } from '@luvio/engine';
2
2
  import type { DurableStore } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
- export declare function flushStoreValuesToDurableStore(store: Store, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
4
+ export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import type { CacheKeySet, Environment, RecordSource, Snapshot } from '@luvio/engine';
2
- import { Store } from '@luvio/engine';
2
+ import { InMemoryStore } from '@luvio/engine';
3
3
  import type { DurableStore } from './DurableStore';
4
4
  import type { InstrumentationFunction } from './makeDurable/error';
5
5
  import type { TTLOverridesMap } from './DurableTTLStore';
@@ -25,7 +25,7 @@ export interface DurableEnvironment extends Environment {
25
25
  * Gets the ingest staging store metadata if called during the ingestion
26
26
  * flow, otherwise returns an empty object.
27
27
  */
28
- getIngestStagingStoreMetadata(): Store['metadata'];
28
+ getIngestStagingStoreMetadata(): InMemoryStore['metadata'];
29
29
  /**
30
30
  * Overload of Environment.handleSuccessResponse that takes in an optional
31
31
  * RecordSource to "prime" the ingest staging store with before calling
@@ -1,3 +1,4 @@
1
+ import type { IntegrityInfo } from '@luvio/engine';
1
2
  /**
2
3
  * Contains store entry data along with any metadata for that entry that needs
3
4
  * to be persisted to durable storage
@@ -14,6 +15,7 @@ export interface DurableStoreEntry<T = unknown> {
14
15
  expirationTimestamp: number;
15
16
  namespace: string;
16
17
  representationName: string;
18
+ integrityInfo?: IntegrityInfo;
17
19
  };
18
20
  }
19
21
  export declare function isDeprecatedDurableStoreEntry(durableRecord: unknown): boolean;
@@ -14,7 +14,7 @@ export interface TTLOverridesMap {
14
14
  overrides: DurableTTLOverride[];
15
15
  }
16
16
  /**
17
- * Class to set and get the TTL override values in the Durable Store
17
+ * Class to set and get the TTL override values in the Durable InMemoryStore
18
18
  */
19
19
  export declare class DurableTTLStore {
20
20
  private durableStore;
@@ -249,7 +249,7 @@
249
249
  return (override.namespace === TTL_DEFAULT_KEY && override.representationName === TTL_DEFAULT_KEY);
250
250
  }
251
251
  /**
252
- * Class to set and get the TTL override values in the Durable Store
252
+ * Class to set and get the TTL override values in the Durable InMemoryStore
253
253
  */
254
254
  var DurableTTLStore = /** @class */ (function () {
255
255
  function DurableTTLStore(durableStore) {
@@ -319,7 +319,7 @@
319
319
  }
320
320
  return __assign({}, source);
321
321
  }
322
- function flushStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
322
+ function flushInMemoryStoreValuesToDurableStore(store, durableStore, durableStoreErrorHandler) {
323
323
  var durableRecords = create(null);
324
324
  var evictedRecords = create(null);
325
325
  var records = store.records, storeMetadata = store.metadata, visitedIds = store.visitedIds, refreshedIds = store.refreshedIds;
@@ -493,7 +493,7 @@
493
493
  var storePublish = function (key, data) {
494
494
  validateNotDisposed();
495
495
  if (ingestStagingStore === null) {
496
- ingestStagingStore = new engine.Store();
496
+ ingestStagingStore = new engine.InMemoryStore();
497
497
  }
498
498
  ingestStagingStore.publish(key, data);
499
499
  // remove record from main luvio L1 cache while we are on the synchronous path
@@ -505,7 +505,7 @@
505
505
  var publishStoreMetadata = function (recordId, storeMetadata) {
506
506
  validateNotDisposed();
507
507
  if (ingestStagingStore === null) {
508
- ingestStagingStore = new engine.Store();
508
+ ingestStagingStore = new engine.InMemoryStore();
509
509
  }
510
510
  ingestStagingStore.publishMetadata(recordId, storeMetadata);
511
511
  };
@@ -514,14 +514,14 @@
514
514
  // we don't ingest to the luvio L1 store from network directly, we ingest to
515
515
  // L2 and let DurableStore on change event revive keys into luvio L1 store
516
516
  if (ingestStagingStore === null) {
517
- ingestStagingStore = new engine.Store();
517
+ ingestStagingStore = new engine.InMemoryStore();
518
518
  }
519
519
  environment.storeIngest(key, ingest, response, luvio, ingestStagingStore);
520
520
  };
521
521
  var storeIngestError = function (key, errorSnapshot, storeMetadataParams, _storeOverride) {
522
522
  validateNotDisposed();
523
523
  if (ingestStagingStore === null) {
524
- ingestStagingStore = new engine.Store();
524
+ ingestStagingStore = new engine.InMemoryStore();
525
525
  }
526
526
  environment.storeIngestError(key, errorSnapshot, storeMetadataParams, ingestStagingStore);
527
527
  };
@@ -536,7 +536,7 @@
536
536
  if (ingestStagingStore === null) {
537
537
  return Promise.resolve();
538
538
  }
539
- var promise = flushStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
539
+ var promise = flushInMemoryStoreValuesToDurableStore(ingestStagingStore, durableStore, durableStoreErrorHandler);
540
540
  ingestStagingStore = null;
541
541
  return promise;
542
542
  };
@@ -553,21 +553,21 @@
553
553
  var storeEvict = function (key) {
554
554
  validateNotDisposed();
555
555
  if (ingestStagingStore === null) {
556
- ingestStagingStore = new engine.Store();
556
+ ingestStagingStore = new engine.InMemoryStore();
557
557
  }
558
558
  ingestStagingStore.evict(key);
559
559
  };
560
560
  var getNode = function (key) {
561
561
  validateNotDisposed();
562
562
  if (ingestStagingStore === null) {
563
- ingestStagingStore = new engine.Store();
563
+ ingestStagingStore = new engine.InMemoryStore();
564
564
  }
565
565
  return environment.getNode(key, ingestStagingStore);
566
566
  };
567
567
  var wrapNormalizedGraphNode = function (normalized) {
568
568
  validateNotDisposed();
569
569
  if (ingestStagingStore === null) {
570
- ingestStagingStore = new engine.Store();
570
+ ingestStagingStore = new engine.InMemoryStore();
571
571
  }
572
572
  return environment.wrapNormalizedGraphNode(normalized, ingestStagingStore);
573
573
  };
@@ -680,7 +680,7 @@
680
680
  var ingestAndPublish = function (revivedRecords) {
681
681
  var toPrime = existingRecords !== undefined
682
682
  ? __assign(__assign({}, revivedRecords), existingRecords) : revivedRecords;
683
- ingestStagingStore = new engine.Store();
683
+ ingestStagingStore = new engine.InMemoryStore();
684
684
  ingestStagingStore.records = toPrime;
685
685
  var snapshotFromMemoryIngest = ingestAndBroadcastFunc();
686
686
  return publishChangesToDurableStore().then(function () {
@@ -1,4 +1,4 @@
1
- import type { Store } from '@luvio/engine';
1
+ import type { InMemoryStore } from '@luvio/engine';
2
2
  import type { DurableStore } from '../DurableStore';
3
3
  import type { DurableStoreRejectionHandler } from './error';
4
- export declare function flushStoreValuesToDurableStore(store: Store, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
4
+ export declare function flushInMemoryStoreValuesToDurableStore(store: InMemoryStore, durableStore: DurableStore, durableStoreErrorHandler: DurableStoreRejectionHandler): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import type { CacheKeySet, Environment, RecordSource, Snapshot } from '@luvio/engine';
2
- import { Store } from '@luvio/engine';
2
+ import { InMemoryStore } from '@luvio/engine';
3
3
  import type { DurableStore } from './DurableStore';
4
4
  import type { InstrumentationFunction } from './makeDurable/error';
5
5
  import type { TTLOverridesMap } from './DurableTTLStore';
@@ -25,7 +25,7 @@ export interface DurableEnvironment extends Environment {
25
25
  * Gets the ingest staging store metadata if called during the ingestion
26
26
  * flow, otherwise returns an empty object.
27
27
  */
28
- getIngestStagingStoreMetadata(): Store['metadata'];
28
+ getIngestStagingStoreMetadata(): InMemoryStore['metadata'];
29
29
  /**
30
30
  * Overload of Environment.handleSuccessResponse that takes in an optional
31
31
  * RecordSource to "prime" the ingest staging store with before calling
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/environments",
3
- "version": "0.83.0",
3
+ "version": "0.86.0",
4
4
  "description": "Luvio Environments",
5
5
  "main": "dist/umd/es2018/environments.js",
6
6
  "module": "dist/es/es2018/environments.js",
@@ -27,7 +27,7 @@
27
27
  "dist/"
28
28
  ],
29
29
  "dependencies": {
30
- "@luvio/engine": "0.83.0"
30
+ "@luvio/engine": "0.86.0"
31
31
  },
32
32
  "bundlesize": [
33
33
  {