@graffy/memory 0.15.8-alpha.1 → 0.15.8-alpha.5
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.cjs +1 -0
- package/index.mjs +1 -0
- package/package.json +8 -4
- package/cjs/index.js +0 -75
package/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("@graffy/common");module.exports=function(){return n=>{const r=[{key:"",end:"",version:0}],o=e.makeWatcher();n.on("read",[],(async n=>e.setVersion(e.slice(r,n).known,Date.now()))),n.on("watch",[],(()=>o.watch(void 0))),n.on("write",[],(async n=>(e.merge(r,n),o.write(n),n)))}};
|
package/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{makeWatcher as n,setVersion as o,slice as t,merge as e}from"@graffy/common";function r(){return r=>{const a=[{key:"",end:"",version:0}],c=n();r.on("read",[],(async n=>o(t(a,n).known,Date.now()))),r.on("watch",[],(()=>c.watch(void 0))),r.on("write",[],(async n=>(e(a,n),c.write(n),n)))}}export{r as default};
|
package/package.json
CHANGED
|
@@ -2,8 +2,13 @@
|
|
|
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.15.8-alpha.
|
|
6
|
-
"main": "./
|
|
5
|
+
"version": "0.15.8-alpha.5",
|
|
6
|
+
"main": "./index.cjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
"import": "./index.mjs",
|
|
9
|
+
"require": "./index.cjs"
|
|
10
|
+
},
|
|
11
|
+
"module": "./index.mjs",
|
|
7
12
|
"types": "./types/index.d.ts",
|
|
8
13
|
"repository": {
|
|
9
14
|
"type": "git",
|
|
@@ -11,7 +16,6 @@
|
|
|
11
16
|
},
|
|
12
17
|
"license": "Apache-2.0",
|
|
13
18
|
"dependencies": {
|
|
14
|
-
"@
|
|
15
|
-
"@graffy/common": "0.15.8-alpha.1"
|
|
19
|
+
"@graffy/common": "0.15.8-alpha.5"
|
|
16
20
|
}
|
|
17
21
|
}
|
package/cjs/index.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
exports.__esModule = true;
|
|
8
|
-
exports.default = _default;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _now = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/date/now"));
|
|
13
|
-
|
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
|
-
var _common = require("@graffy/common");
|
|
17
|
-
|
|
18
|
-
// import { debug } from '@graffy/testing';
|
|
19
|
-
function _default() {
|
|
20
|
-
return function (store) {
|
|
21
|
-
var state = [{
|
|
22
|
-
key: '',
|
|
23
|
-
end: "\uFFFF",
|
|
24
|
-
version: 0
|
|
25
|
-
}];
|
|
26
|
-
var watcher = (0, _common.makeWatcher)();
|
|
27
|
-
store.on('read', [], /*#__PURE__*/function () {
|
|
28
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query) {
|
|
29
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
30
|
-
while (1) {
|
|
31
|
-
switch (_context.prev = _context.next) {
|
|
32
|
-
case 0:
|
|
33
|
-
return _context.abrupt("return", (0, _common.setVersion)((0, _sliceInstanceProperty(_common))(state, query).known, (0, _now.default)()));
|
|
34
|
-
|
|
35
|
-
case 1:
|
|
36
|
-
case "end":
|
|
37
|
-
return _context.stop();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, _callee);
|
|
41
|
-
}));
|
|
42
|
-
|
|
43
|
-
return function (_x) {
|
|
44
|
-
return _ref.apply(this, arguments);
|
|
45
|
-
};
|
|
46
|
-
}());
|
|
47
|
-
store.on('watch', [], function () {
|
|
48
|
-
return watcher.watch(undefined);
|
|
49
|
-
});
|
|
50
|
-
store.on('write', [], /*#__PURE__*/function () {
|
|
51
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(change) {
|
|
52
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
53
|
-
while (1) {
|
|
54
|
-
switch (_context2.prev = _context2.next) {
|
|
55
|
-
case 0:
|
|
56
|
-
(0, _common.merge)(state, change);
|
|
57
|
-
watcher.write(change);
|
|
58
|
-
return _context2.abrupt("return", change);
|
|
59
|
-
|
|
60
|
-
case 3:
|
|
61
|
-
case "end":
|
|
62
|
-
return _context2.stop();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, _callee2);
|
|
66
|
-
}));
|
|
67
|
-
|
|
68
|
-
return function (_x2) {
|
|
69
|
-
return _ref2.apply(this, arguments);
|
|
70
|
-
};
|
|
71
|
-
}());
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
module.exports = exports.default;
|