@adriangalilea/utils 0.3.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/platform/unseen.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { xdg } from './xdg.js';
|
|
2
2
|
import { dir } from './dir.js';
|
|
3
3
|
import { file } from './file.js';
|
|
4
|
-
import { join } from 'node:path';
|
|
4
|
+
import { join, dirname } from 'node:path';
|
|
5
5
|
const STORE_DIR = xdg.state('unseen');
|
|
6
6
|
/**
|
|
7
7
|
* Persistent dedup filter — "what's new since last time?"
|
|
@@ -28,8 +28,8 @@ const STORE_DIR = xdg.state('unseen');
|
|
|
28
28
|
* @returns Only items whose key hasn't been seen before
|
|
29
29
|
*/
|
|
30
30
|
export async function unseen(namespace, items, key) {
|
|
31
|
-
dir.create(STORE_DIR);
|
|
32
31
|
const storePath = join(STORE_DIR, `${namespace}.json`);
|
|
32
|
+
dir.create(dirname(storePath));
|
|
33
33
|
const seen = new Set(file.exists(storePath) ? JSON.parse(file.readText(storePath)) : []);
|
|
34
34
|
const result = [];
|
|
35
35
|
for (const item of items) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unseen.js","sourceRoot":"","sources":["../../src/platform/unseen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"unseen.js","sourceRoot":"","sources":["../../src/platform/unseen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,M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