@luvio/adapter-test-library 0.158.7 → 0.159.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.
@@ -449,6 +449,36 @@ class MockDurableStore {
449
449
  }
450
450
  return returnSource;
451
451
  }
452
+ async getEntriesWithSpecificFields(entryIds, fields, segment) {
453
+ // Get all entries first
454
+ const allEntries = await this.getEntries(entryIds, segment);
455
+ if (allEntries === undefined) {
456
+ return undefined;
457
+ }
458
+ // Filter fields from each entry's data
459
+ const filteredEntries = Object.create(null);
460
+ for (const entryId of Object.keys(allEntries)) {
461
+ const entry = allEntries[entryId];
462
+ if (entry !== undefined && typeof entry.data === 'object' && entry.data !== null) {
463
+ const filteredData = Object.create(null);
464
+ const data = entry.data;
465
+ for (const field of fields) {
466
+ if (field in data) {
467
+ filteredData[field] = data[field];
468
+ }
469
+ }
470
+ filteredEntries[entryId] = {
471
+ ...entry,
472
+ data: filteredData,
473
+ };
474
+ }
475
+ else {
476
+ // If data is not an object, just return the entry as-is
477
+ filteredEntries[entryId] = entry;
478
+ }
479
+ }
480
+ return filteredEntries;
481
+ }
452
482
  async getMetadata(entryIds, segment) {
453
483
  const entries = await this.getEntries(entryIds, segment);
454
484
  if (entries === undefined) {
@@ -6,6 +6,7 @@ export declare class MockDurableStore implements DurableStore {
6
6
  persistence: DurableStorePersistence;
7
7
  constructor(persistence?: DurableStorePersistence);
8
8
  getEntries<T>(entryIds: string[], segment: string): Promise<DurableStoreEntries<T> | undefined>;
9
+ getEntriesWithSpecificFields<T>(entryIds: string[], fields: Set<string>, segment: string): Promise<DurableStoreEntries<T> | undefined>;
9
10
  getMetadata(entryIds: string[], segment: string): Promise<DurableStoreMetadataEntries | undefined>;
10
11
  getAllEntries<T>(segment: string): Promise<DurableStoreEntries<T> | undefined>;
11
12
  setEntries<T>(entries: DurableStoreEntries<T>, segment: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/adapter-test-library",
3
- "version": "0.158.7",
3
+ "version": "0.159.0",
4
4
  "description": "Test library for luvio adapters",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,8 +28,8 @@
28
28
  "sinon": "^14.0.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@luvio/engine": "^0.158.7",
32
- "@luvio/environments": "^0.158.7",
31
+ "@luvio/engine": "^0.159.0",
32
+ "@luvio/environments": "^0.159.0",
33
33
  "@types/sinon": "^7.5.2"
34
34
  },
35
35
  "volta": {