@graffy/memory 0.18.1-alpha.2 → 0.19.1-alpha.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/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export default function (): (store: any) => void;
package/index.js ADDED
@@ -0,0 +1,16 @@
1
+ import { MAX_KEY, MIN_KEY, makeWatcher, merge, setVersion, slice, } from '@graffy/common';
2
+ export default function () {
3
+ return (store) => {
4
+ const state = [{ key: MIN_KEY, end: MAX_KEY, version: 0 }];
5
+ const watcher = makeWatcher();
6
+ store.on('read', [], async (query) => {
7
+ return setVersion(slice(state, query).known, Date.now());
8
+ });
9
+ store.on('watch', [], () => watcher.watch(undefined));
10
+ store.on('write', [], async (change) => {
11
+ merge(state, change);
12
+ watcher.write(change);
13
+ return change;
14
+ });
15
+ };
16
+ }
package/package.json CHANGED
@@ -2,20 +2,25 @@
2
2
  "name": "@graffy/memory",
3
3
  "description": "Graffy module providing a simple in-memory store.",
4
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.18.1-alpha.2",
6
- "main": "./index.cjs",
5
+ "version": "0.19.1-alpha.1",
6
+ "main": "./cjs/index.js",
7
7
  "exports": {
8
- "import": "./index.mjs",
9
- "require": "./index.cjs"
8
+ ".": {
9
+ "import": "./index.js",
10
+ "types": "./index.d.ts"
11
+ },
12
+ "./*": {
13
+ "import": "./*.js",
14
+ "types": "./*.d.ts"
15
+ }
10
16
  },
11
- "module": "./index.mjs",
12
- "types": "./types/index.d.ts",
17
+ "types": "./index.d.ts",
13
18
  "repository": {
14
19
  "type": "git",
15
20
  "url": "git+https://github.com/usegraffy/graffy.git"
16
21
  },
17
22
  "license": "Apache-2.0",
18
23
  "dependencies": {
19
- "@graffy/common": "0.18.1-alpha.2"
24
+ "@graffy/common": "0.19.1-alpha.1"
20
25
  }
21
26
  }
package/index.cjs DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- const common = require("@graffy/common");
3
- function index() {
4
- return (store) => {
5
- const state = [{ key: common.MIN_KEY, end: common.MAX_KEY, version: 0 }];
6
- const watcher = common.makeWatcher();
7
- store.on("read", [], async (query) => {
8
- return common.setVersion(common.slice(state, query).known, Date.now());
9
- });
10
- store.on("watch", [], () => watcher.watch(void 0));
11
- store.on("write", [], async (change) => {
12
- common.merge(state, change);
13
- watcher.write(change);
14
- return change;
15
- });
16
- };
17
- }
18
- module.exports = index;
package/index.mjs DELETED
@@ -1,19 +0,0 @@
1
- import { makeWatcher, setVersion, slice, MAX_KEY, MIN_KEY, merge } from "@graffy/common";
2
- function index() {
3
- return (store) => {
4
- const state = [{ key: MIN_KEY, end: MAX_KEY, version: 0 }];
5
- const watcher = makeWatcher();
6
- store.on("read", [], async (query) => {
7
- return setVersion(slice(state, query).known, Date.now());
8
- });
9
- store.on("watch", [], () => watcher.watch(void 0));
10
- store.on("write", [], async (change) => {
11
- merge(state, change);
12
- watcher.write(change);
13
- return change;
14
- });
15
- };
16
- }
17
- export {
18
- index as default
19
- };
package/types/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export default function _default(): (store: any) => void;