@luvio/durable-store-idb 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.
|
@@ -116,6 +116,40 @@ class IndexedDbDurableStore {
|
|
|
116
116
|
}
|
|
117
117
|
return returnEntries;
|
|
118
118
|
}
|
|
119
|
+
async getEntriesWithSpecificFields(entryIds, fields, segment) {
|
|
120
|
+
// Get all entries first
|
|
121
|
+
const allEntries = await this.getEntries(entryIds, segment);
|
|
122
|
+
if (allEntries === undefined) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
// Filter fields from each entry's data
|
|
126
|
+
const filteredEntries = {};
|
|
127
|
+
const entryKeys = Object.keys(allEntries);
|
|
128
|
+
for (let i = 0, len = entryKeys.length; i < len; i += 1) {
|
|
129
|
+
const entryId = entryKeys[i];
|
|
130
|
+
const entry = allEntries[entryId];
|
|
131
|
+
if (entry !== undefined && typeof entry.data === 'object' && entry.data !== null) {
|
|
132
|
+
const filteredData = {};
|
|
133
|
+
const data = entry.data;
|
|
134
|
+
const fieldKeys = Array.from(fields);
|
|
135
|
+
for (let j = 0, fLen = fieldKeys.length; j < fLen; j += 1) {
|
|
136
|
+
const field = fieldKeys[j];
|
|
137
|
+
if (field in data) {
|
|
138
|
+
filteredData[field] = data[field];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
filteredEntries[entryId] = {
|
|
142
|
+
...entry,
|
|
143
|
+
data: filteredData,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
// If data is not an object, just return the entry as-is
|
|
148
|
+
filteredEntries[entryId] = entry;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return filteredEntries;
|
|
152
|
+
}
|
|
119
153
|
async getMetadata(entryIds, segment) {
|
|
120
154
|
const entries = await this.getEntries(entryIds, segment);
|
|
121
155
|
if (entries === undefined) {
|
|
@@ -6,6 +6,7 @@ export declare class IndexedDbDurableStore implements DurableStore {
|
|
|
6
6
|
private buildDbName;
|
|
7
7
|
private getDb;
|
|
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/durable-store-idb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.159.0",
|
|
4
4
|
"description": "IndexedDB-based implementation of the Luvio DurableStore",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"watch": "yarn build --watch"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@luvio/environments": "^0.
|
|
26
|
+
"@luvio/environments": "^0.159.0",
|
|
27
27
|
"fake-indexeddb": "^4.0.2"
|
|
28
28
|
},
|
|
29
29
|
"volta": {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
{
|
|
37
37
|
"path": "./dist/durable-store-idb.js",
|
|
38
38
|
"maxSize": {
|
|
39
|
-
"none": "
|
|
40
|
-
"min": "
|
|
41
|
-
"compressed": "2 kB"
|
|
39
|
+
"none": "10 kB",
|
|
40
|
+
"min": "5 kB",
|
|
41
|
+
"compressed": "2.5 kB"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
],
|