polystore 0.4.5 → 0.5.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.
- package/package.json +13 -7
- package/readme.md +45 -18
- package/{index.d.ts → src/index.d.ts} +5 -3
- package/src/index.js +24 -17
- package/src/index.test.js +15 -15
- package/src/index.types.ts +3 -3
- package/index.min.js +0 -2
- package/index.min.js.map +0 -7
- package/tsconfig.json +0 -1
package/package.json
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polystore",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A small compatibility layer for many popular KV stores like localStorage, Redis, FileSystem, etc.",
|
|
5
5
|
"homepage": "https://github.com/franciscop/polystore",
|
|
6
6
|
"repository": "https://github.com/franciscop/polystore.git",
|
|
7
7
|
"bugs": "https://github.com/franciscop/polystore/issues",
|
|
8
8
|
"funding": "https://www.paypal.me/franciscopresencia/19",
|
|
9
9
|
"author": "Francisco Presencia <public@francisco.io> (https://francisco.io/)",
|
|
10
|
-
"main": "index.
|
|
11
|
-
"types": "index.d.ts",
|
|
10
|
+
"main": "src/index.js",
|
|
11
|
+
"types": "src/index.d.ts",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"scripts": {
|
|
14
|
-
"
|
|
15
|
-
"size": "echo $(gzip -c index.min.js | wc -c) bytes",
|
|
14
|
+
"size": "echo $(gzip -c src/index.js | wc -c) bytes",
|
|
16
15
|
"start": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch --coverage --detectOpenHandles",
|
|
17
|
-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --detectOpenHandles && check-dts"
|
|
16
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --detectOpenHandles && check-dts src/index.types.ts"
|
|
18
17
|
},
|
|
19
|
-
"keywords": [
|
|
18
|
+
"keywords": [
|
|
19
|
+
"kv",
|
|
20
|
+
"store",
|
|
21
|
+
"polystore",
|
|
22
|
+
"key-value",
|
|
23
|
+
"key",
|
|
24
|
+
"value"
|
|
25
|
+
],
|
|
20
26
|
"license": "MIT",
|
|
21
27
|
"devDependencies": {
|
|
22
28
|
"check-dts": "^0.7.2",
|
package/readme.md
CHANGED
|
@@ -27,12 +27,12 @@ Available stores:
|
|
|
27
27
|
- **Session Storage** `sessionStorage` (fe): persist the data in the browser's sessionStorage
|
|
28
28
|
- **Cookies** `"cookie"` (fe): persist the data using cookies
|
|
29
29
|
- **LocalForage** `localForage` (fe): persist the data on IndexedDB
|
|
30
|
-
- **Redis Client** `redisClient` (be): persist the data in the Redis instance that you connect to
|
|
31
30
|
- **FS File** `new URL('file:///...')` (be): store the data in a single JSON file
|
|
32
|
-
-
|
|
31
|
+
- **Redis Client** `redisClient` (be): use the Redis instance that you connect to
|
|
32
|
+
- **Cloudflare KV** `env.KV_NAMESPACE` (be): use Cloudflare's KV store
|
|
33
33
|
- (WIP) **Consul KV** `new Consul()` (fe+be): use Hashicorp's Consul KV store (https://www.npmjs.com/package/consul#kv)
|
|
34
34
|
|
|
35
|
-
I
|
|
35
|
+
I made this library to be used as a "building block" of other libraries, so that _your library_ can accept many cache stores effortlessly! It's isomorphic (Node.js and the Browser) and tiny (~2KB). For example, let's say you create an API library, then you can accept the stores from your client:
|
|
36
36
|
|
|
37
37
|
```js
|
|
38
38
|
import MyApi from "my-api";
|
|
@@ -94,22 +94,22 @@ If the value is returned, it can be a simple type like `boolean`, `string` or `n
|
|
|
94
94
|
Create or update a value in the store. Will return a promise that resolves when the value has been saved. The value needs to be serializable:
|
|
95
95
|
|
|
96
96
|
```js
|
|
97
|
-
await store.set(key: string, value: any, options?: {
|
|
97
|
+
await store.set(key: string, value: any, options?: { expires: number|string });
|
|
98
98
|
|
|
99
99
|
await store.set("key1", "Hello World");
|
|
100
|
-
await store.set("key2", ["my", "grocery", "list"], {
|
|
101
|
-
await store.set("key3", { name: "Francisco" }, {
|
|
100
|
+
await store.set("key2", ["my", "grocery", "list"], { expires: "1h" });
|
|
101
|
+
await store.set("key3", { name: "Francisco" }, { expires: 60 * 60 * 1000 });
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
The value can be a simple type like `boolean`, `string` or `number`, or it can be a plain Object or Array, or a combination of those. It **cannot** be a more complex or non-serializable values like a `Date()`, `Infinity`, `undefined` (casted to `null`), a `Symbol`, etc.
|
|
105
105
|
|
|
106
106
|
- By default the keys _don't expire_.
|
|
107
|
-
- Setting the `value` to `null`, or the `
|
|
108
|
-
- Conversely, setting `
|
|
107
|
+
- Setting the `value` to `null`, or the `expires` to `0` is the equivalent of deleting the key+value.
|
|
108
|
+
- Conversely, setting `expires` to `null` or `undefined` will make the value never to expire.
|
|
109
109
|
|
|
110
|
-
####
|
|
110
|
+
#### Expires
|
|
111
111
|
|
|
112
|
-
When the `
|
|
112
|
+
When the `expires` option is set, it can be a number (ms) or a string representing some time:
|
|
113
113
|
|
|
114
114
|
```js
|
|
115
115
|
// Valid "expire" values:
|
|
@@ -165,8 +165,6 @@ Create a sub-store where all the operations use the given prefix:
|
|
|
165
165
|
```js
|
|
166
166
|
const store = kv(new Map());
|
|
167
167
|
const sub = store.prefix("session:");
|
|
168
|
-
|
|
169
|
-
const sub = kv(new Map(), { prefix: "session:" });
|
|
170
168
|
```
|
|
171
169
|
|
|
172
170
|
Then all of the operations will be converted internally to add the prefix when reading, writing, etc:
|
|
@@ -192,7 +190,7 @@ The main reason this is not stable is because [_some_ store engines don't allow
|
|
|
192
190
|
|
|
193
191
|
## Stores
|
|
194
192
|
|
|
195
|
-
Accepts directly the store, or a promise that resolves into a store. All of the stores, including those that natively _don't_ support it, are enhanced with `Promises` and `
|
|
193
|
+
Accepts directly the store, or a promise that resolves into a store. All of the stores, including those that natively _don't_ support it, are enhanced with `Promises` and `expires` times, so they all work the same way.
|
|
196
194
|
|
|
197
195
|
### Memory
|
|
198
196
|
|
|
@@ -253,18 +251,18 @@ console.log(await store.get("key1"));
|
|
|
253
251
|
|
|
254
252
|
It is fairly limited for how powerful cookies are, but in exchange it has the same API as any other method or KV store. It works with browser-side Cookies (no http-only).
|
|
255
253
|
|
|
256
|
-
> Note: the cookie expire resolution is in the seconds. While it still expects you to pass the number of ms as with the other methods (or [a string like `1h`](#
|
|
254
|
+
> Note: the cookie expire resolution is in the seconds. While it still expects you to pass the number of ms as with the other methods (or [a string like `1h`](#expires)), times shorter than 1 second like `expires: 200` (ms) don't make sense for this storage method and won't properly save them.
|
|
257
255
|
|
|
258
256
|
### Local Forage
|
|
259
257
|
|
|
260
|
-
Supports localForage (with any driver it uses) so that you have a unified API. It also _adds_ the `
|
|
258
|
+
Supports localForage (with any driver it uses) so that you have a unified API. It also _adds_ the `expires` option to the setters!
|
|
261
259
|
|
|
262
260
|
```js
|
|
263
261
|
import kv from "polystore";
|
|
264
262
|
import localForage from "localforage";
|
|
265
263
|
|
|
266
264
|
const store = kv(localForage);
|
|
267
|
-
await store.set("key1", "Hello world", {
|
|
265
|
+
await store.set("key1", "Hello world", { expires: "1h" });
|
|
268
266
|
console.log(await store.get("key1"));
|
|
269
267
|
```
|
|
270
268
|
|
|
@@ -282,7 +280,7 @@ await store.set("key1", "Hello world");
|
|
|
282
280
|
console.log(await store.get("key1"));
|
|
283
281
|
```
|
|
284
282
|
|
|
285
|
-
> Note: the Redis client expire resolution is in the seconds. While it still expects you to pass the number of ms as with the other methods (or [a string like `1h`](#
|
|
283
|
+
> Note: the Redis client expire resolution is in the seconds. While it still expects you to pass the number of ms as with the other methods (or [a string like `1h`](#expires)), times shorter than 1 second like `expires: 200` (ms) don't make sense for this storage method and won't properly save them.
|
|
286
284
|
|
|
287
285
|
### FS File
|
|
288
286
|
|
|
@@ -299,7 +297,36 @@ const store = kv(new URL(`file://${process.cwd()}/cache.json`));
|
|
|
299
297
|
|
|
300
298
|
### Cloudflare KV
|
|
301
299
|
|
|
300
|
+
Supports the official Cloudflare's KV stores. Follow [the official guide](https://developers.cloudflare.com/kv/get-started/), then load it like this:
|
|
301
|
+
|
|
302
302
|
```js
|
|
303
303
|
import kv from "polystore";
|
|
304
|
-
|
|
304
|
+
|
|
305
|
+
export default {
|
|
306
|
+
async fetch(request, env, ctx) {
|
|
307
|
+
const store = kv(env.YOUR_KV_NAMESPACE);
|
|
308
|
+
|
|
309
|
+
await store.set("KEY", "VALUE");
|
|
310
|
+
const value = await store.get("KEY");
|
|
311
|
+
|
|
312
|
+
if (!value) {
|
|
313
|
+
return new Response("Value not found", { status: 404 });
|
|
314
|
+
}
|
|
315
|
+
return new Response(value);
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
The Cloudflare native KV store only accepts strings and has you manually calculating timeouts, but as usual with `polystore` you can set/get any serializable value and set the timeout in a familiar format:
|
|
321
|
+
|
|
322
|
+
```js
|
|
323
|
+
// GOOD - with polystore
|
|
324
|
+
await store.set("user", { name: "Francisco" }, { expires: "2days" });
|
|
325
|
+
|
|
326
|
+
// COMPLEX - With native Cloudflare KV
|
|
327
|
+
const serialValue = JSON.stringify({ name: "Francisco" });
|
|
328
|
+
const twoDaysInSeconds = 2 * 24 * 3600;
|
|
329
|
+
await env.YOUR_KV_NAMESPACE.put("user", serialValue, {
|
|
330
|
+
expirationTtl: twoDaysInSeconds,
|
|
331
|
+
});
|
|
305
332
|
```
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
type Expire = number | string | null;
|
|
2
|
-
|
|
3
1
|
type Store = {
|
|
4
2
|
get: (key: string) => Promise<any>;
|
|
5
|
-
set: (
|
|
3
|
+
set: (
|
|
4
|
+
key: string,
|
|
5
|
+
value: any,
|
|
6
|
+
opts?: { expires?: number | string | null }
|
|
7
|
+
) => Promise<null>;
|
|
6
8
|
has: (key: string) => Promise<boolean>;
|
|
7
9
|
del: (key: string) => Promise<null>;
|
|
8
10
|
|
package/src/index.js
CHANGED
|
@@ -25,20 +25,26 @@ function parse(str) {
|
|
|
25
25
|
return Math.abs(Math.round(result));
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
// Adds an expiration layer to those stores that don't have it;
|
|
29
|
+
// it's not perfect since it's not deleted until it's read, but
|
|
30
|
+
// hey it's better than nothing
|
|
28
31
|
layers.expire = (store) => {
|
|
29
32
|
// Item methods
|
|
30
33
|
const get = async (key) => {
|
|
31
34
|
if (!(await store.has(key))) return null;
|
|
32
|
-
const {
|
|
33
|
-
|
|
35
|
+
const { value, expire } = await store.get(key);
|
|
36
|
+
// It never expires
|
|
37
|
+
if (expire === null) return value;
|
|
34
38
|
const diff = expire - new Date().getTime();
|
|
35
39
|
if (diff <= 0) return null;
|
|
36
|
-
return
|
|
40
|
+
return value;
|
|
37
41
|
};
|
|
38
|
-
const set = async (key,
|
|
39
|
-
const time = parse(expire);
|
|
42
|
+
const set = async (key, value, { expire, expires } = {}) => {
|
|
43
|
+
const time = parse(expire || expires);
|
|
44
|
+
// Already expired, or do _not_ save it, then delete it
|
|
45
|
+
if (value === null || time === 0) return del(key);
|
|
40
46
|
const expDiff = time !== null ? new Date().getTime() + time : null;
|
|
41
|
-
return store.set(key, { expire: expDiff,
|
|
47
|
+
return store.set(key, { expire: expDiff, value });
|
|
42
48
|
};
|
|
43
49
|
const has = async (key) => (await store.get(key)) !== null;
|
|
44
50
|
const del = store.del;
|
|
@@ -52,7 +58,7 @@ layers.expire = (store) => {
|
|
|
52
58
|
|
|
53
59
|
layers.memory = (store) => {
|
|
54
60
|
// Item methods
|
|
55
|
-
const get = async (key) => store.get(key)
|
|
61
|
+
const get = async (key) => store.get(key) ?? null;
|
|
56
62
|
const set = async (key, data) => store.set(key, data);
|
|
57
63
|
const has = async (key) => store.has(key);
|
|
58
64
|
const del = async (key) => store.delete(key);
|
|
@@ -91,9 +97,10 @@ layers.cookie = () => {
|
|
|
91
97
|
return JSON.parse(decodeURIComponent(value));
|
|
92
98
|
};
|
|
93
99
|
|
|
94
|
-
const set = async (key, data, { expire
|
|
95
|
-
const time = parse(expire);
|
|
100
|
+
const set = async (key, data, { expire, expires } = {}) => {
|
|
101
|
+
const time = parse(expire || expires);
|
|
96
102
|
const now = new Date().getTime();
|
|
103
|
+
// NOTE: 0 is already considered here!
|
|
97
104
|
const expireStr =
|
|
98
105
|
time !== null ? `; expires=${new Date(now + time).toUTCString()}` : "";
|
|
99
106
|
const value = encodeURIComponent(JSON.stringify(data));
|
|
@@ -123,11 +130,11 @@ layers.redis = (store) => {
|
|
|
123
130
|
if (!value) return null;
|
|
124
131
|
return JSON.parse(value);
|
|
125
132
|
};
|
|
126
|
-
const set = async (key, value, { expire
|
|
127
|
-
|
|
133
|
+
const set = async (key, value, { expire, expires } = {}) => {
|
|
134
|
+
const time = parse(expire || expires);
|
|
135
|
+
if (value === null || time === 0) return del(key);
|
|
128
136
|
const client = await store;
|
|
129
|
-
const
|
|
130
|
-
const EX = exp ? Math.round(exp / 1000) : undefined;
|
|
137
|
+
const EX = time ? Math.round(time / 1000) : undefined;
|
|
131
138
|
return client.set(key, JSON.stringify(value), { EX });
|
|
132
139
|
};
|
|
133
140
|
const has = async (key) => Boolean(await (await store).exists(key));
|
|
@@ -159,11 +166,11 @@ layers.cloudflare = (store) => {
|
|
|
159
166
|
if (!data) return null;
|
|
160
167
|
return JSON.parse(data);
|
|
161
168
|
};
|
|
162
|
-
const set = async (key, value, { expire }) => {
|
|
163
|
-
|
|
169
|
+
const set = async (key, value, { expire, expires } = {}) => {
|
|
170
|
+
const time = parse(expire || expires);
|
|
171
|
+
if (value === null || time === 0) return del(key);
|
|
164
172
|
const client = await store;
|
|
165
|
-
const
|
|
166
|
-
const expirationTtl = exp ? Math.round(exp / 1000) : undefined;
|
|
173
|
+
const expirationTtl = time ? Math.round(time / 1000) : undefined;
|
|
167
174
|
return client.put(key, JSON.stringify(value), { expirationTtl });
|
|
168
175
|
};
|
|
169
176
|
const has = async (key) => Boolean(await store.get(key));
|
package/src/index.test.js
CHANGED
|
@@ -113,33 +113,33 @@ for (let [name, store] of stores) {
|
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
describe("expires", () => {
|
|
116
|
-
it("
|
|
117
|
-
await store.set("a", "b", {
|
|
116
|
+
it("expires = 0 means immediately", async () => {
|
|
117
|
+
await store.set("a", "b", { expires: 0 });
|
|
118
118
|
expect(await store.get("a")).toBe(null);
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
it("
|
|
122
|
-
await store.set("a", "b", {
|
|
121
|
+
it("expires = potato means undefined = forever", async () => {
|
|
122
|
+
await store.set("a", "b", { expires: "potato" });
|
|
123
123
|
expect(await store.get("a")).toBe("b");
|
|
124
124
|
await delay(100);
|
|
125
125
|
expect(await store.get("a")).toBe("b");
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
-
it("
|
|
129
|
-
await store.set("a", "b", {
|
|
128
|
+
it("expires = 5potato means undefined = forever", async () => {
|
|
129
|
+
await store.set("a", "b", { expires: "5potato" });
|
|
130
130
|
expect(await store.get("a")).toBe("b");
|
|
131
131
|
await delay(100);
|
|
132
132
|
expect(await store.get("a")).toBe("b");
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
-
it("
|
|
136
|
-
await store.set("a", "b", {
|
|
135
|
+
it("expires = null means never to expire it", async () => {
|
|
136
|
+
await store.set("a", "b", { expires: null });
|
|
137
137
|
expect(await store.get("a")).toBe("b");
|
|
138
138
|
await delay(100);
|
|
139
139
|
expect(await store.get("a")).toBe("b");
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
-
it("
|
|
142
|
+
it("expires = undefined means never to expire it", async () => {
|
|
143
143
|
await store.set("a", "b");
|
|
144
144
|
expect(await store.get("a")).toBe("b");
|
|
145
145
|
await delay(100);
|
|
@@ -148,41 +148,41 @@ for (let [name, store] of stores) {
|
|
|
148
148
|
|
|
149
149
|
if (name !== "kv('cookie')" && name !== "kv(redis)") {
|
|
150
150
|
it("can use 10 expire", async () => {
|
|
151
|
-
await store.set("a", "b", {
|
|
151
|
+
await store.set("a", "b", { expires: 10 });
|
|
152
152
|
expect(await store.get("a")).toBe("b");
|
|
153
153
|
await delay(100);
|
|
154
154
|
expect(await store.get("a")).toBe(null);
|
|
155
155
|
});
|
|
156
156
|
|
|
157
157
|
it("can use 0.01s expire", async () => {
|
|
158
|
-
await store.set("a", "b", {
|
|
158
|
+
await store.set("a", "b", { expires: "0.01s" });
|
|
159
159
|
expect(await store.get("a")).toBe("b");
|
|
160
160
|
await delay(100);
|
|
161
161
|
expect(await store.get("a")).toBe(null);
|
|
162
162
|
});
|
|
163
163
|
|
|
164
164
|
it("can use 0.01seconds expire", async () => {
|
|
165
|
-
await store.set("a", "b", {
|
|
165
|
+
await store.set("a", "b", { expires: "0.01seconds" });
|
|
166
166
|
expect(await store.get("a")).toBe("b");
|
|
167
167
|
await delay(100);
|
|
168
168
|
expect(await store.get("a")).toBe(null);
|
|
169
169
|
});
|
|
170
170
|
|
|
171
171
|
it("can use 10ms expire", async () => {
|
|
172
|
-
await store.set("a", "b", {
|
|
172
|
+
await store.set("a", "b", { expires: "10ms" });
|
|
173
173
|
expect(await store.get("a")).toBe("b");
|
|
174
174
|
await delay(100);
|
|
175
175
|
expect(await store.get("a")).toBe(null);
|
|
176
176
|
});
|
|
177
177
|
} else {
|
|
178
178
|
it("can use 1000 expire", async () => {
|
|
179
|
-
await store.set("a", "b", {
|
|
179
|
+
await store.set("a", "b", { expires: 1000 });
|
|
180
180
|
expect(await store.get("a")).toBe("b");
|
|
181
181
|
await delay(2000);
|
|
182
182
|
expect(await store.get("a")).toBe(null);
|
|
183
183
|
});
|
|
184
184
|
it("can use 1s expire", async () => {
|
|
185
|
-
await store.set("a", "b", {
|
|
185
|
+
await store.set("a", "b", { expires: "1s" });
|
|
186
186
|
expect(await store.get("a")).toBe("b");
|
|
187
187
|
await delay(2000);
|
|
188
188
|
expect(await store.get("a")).toBe(null);
|
package/src/index.types.ts
CHANGED
|
@@ -3,11 +3,11 @@ import kv from "..";
|
|
|
3
3
|
const store = kv();
|
|
4
4
|
|
|
5
5
|
(async () => {
|
|
6
|
-
|
|
6
|
+
await store.get("key");
|
|
7
7
|
await store.set("key", "value");
|
|
8
8
|
await store.set("key", "value", {});
|
|
9
|
-
await store.set("key", "value", {
|
|
10
|
-
await store.set("key", "value", {
|
|
9
|
+
await store.set("key", "value", { expires: 100 });
|
|
10
|
+
await store.set("key", "value", { expires: "100s" });
|
|
11
11
|
if (await store.has("key")) {
|
|
12
12
|
}
|
|
13
13
|
})();
|
package/index.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var o={},m=/(-?(?:\d+\.?\d*|\d*\.?\d+)(?:e[-+]?\d+)?)\s*([\p{L}]*)/iu;a.millisecond=a.ms=1;a.second=a.sec=a.s=a[""]=a.ms*1e3;a.minute=a.min=a.m=a.s*60;a.hour=a.hr=a.h=a.m*60;a.day=a.d=a.h*24;a.week=a.wk=a.w=a.d*7;a.year=a.yr=a.y=a.d*365.25;a.month=a.b=a.y/12;function a(t){if(t==null)return null;if(typeof t=="number")return t;t=t.toLowerCase().replace(/[,_]/g,"");let[u,l,r]=m.exec(t)||[];if(!r)return null;let c=a[r]||a[r.replace(/s$/,"")];if(!c)return null;let p=c*parseFloat(l,10);return Math.abs(Math.round(p))}o.expire=t=>{let u=async n=>{if(!await t.has(n))return null;let{data:e,expire:d}=await t.get(n);return d===null?e:d-new Date().getTime()<=0?null:e},l=async(n,e,{expire:d=null}={})=>{let s=a(d),i=s!==null?new Date().getTime()+s:null;return t.set(n,{expire:i,data:e})},r=async n=>await t.get(n)!==null,c=t.del,p=t.keys,y=t.clear;return{get:u,set:l,has:r,del:c,keys:p,clear:y}};o.memory=t=>({get:async n=>t.get(n)||null,set:async(n,e)=>t.set(n,e),has:async n=>t.has(n),del:async n=>t.delete(n),keys:async(n="")=>[...await t.keys()].filter(e=>e.startsWith(n)),clear:()=>t.clear()});o.storage=t=>({get:async n=>t[n]?JSON.parse(t[n]):null,set:async(n,e)=>t.setItem(n,JSON.stringify(e)),has:async n=>n in t,del:async n=>t.removeItem(n),keys:async(n="")=>Object.keys(t).filter(e=>e.startsWith(n)),clear:()=>t.clear()});o.cookie=()=>{let t=async y=>{let n=document.cookie.split("; ").filter(Boolean).find(e=>e.startsWith(y+"="))?.split("=")[1]||null;return JSON.parse(decodeURIComponent(n))},u=async(y,n,{expire:e=null}={})=>{let d=a(e),s=new Date().getTime(),i=d!==null?`; expires=${new Date(s+d).toUTCString()}`:"",f=encodeURIComponent(JSON.stringify(n));document.cookie=y+"="+f+i},l=async y=>(await c()).includes(y),r=async y=>u(y,"",{expire:-100}),c=async(y="")=>document.cookie.split(";").map(n=>n.split("=")[0].trim()).filter(Boolean).filter(n=>n.startsWith(y));return{get:t,set:u,has:l,del:r,keys:c,clear:async()=>{await Promise.all((await c()).map(r))}}};o.redis=t=>{let u=async e=>{let s=await(await t).get(e);return s?JSON.parse(s):null},l=async(e,d,{expire:s=null}={})=>{if(d===null||s===0)return c(e);let i=await t,f=a(s),w=f?Math.round(f/1e3):void 0;return i.set(e,JSON.stringify(d),{EX:w})},r=async e=>!!await(await t).exists(e),c=async e=>(await t).del(e);return{get:u,set:l,has:r,del:c,keys:async(e="")=>(await t).keys(e+"*"),clear:async()=>(await t).flushAll(),close:async()=>(await t).quit()}};o.localForage=t=>{let u=n=>t.getItem(n);return{get:u,set:(n,e)=>t.setItem(n,e),has:async n=>await u(n)!==null,del:n=>t.removeItem(n),keys:async(n="")=>(await t.keys()).filter(e=>e.startsWith(n)),clear:()=>t.clear()}};o.cloudflare=t=>{let u=async n=>{let e=await t.get(n);return e?JSON.parse(e):null},l=async(n,e,{expire:d})=>{if(e===null||d===0)return c(n);let s=await t,i=a(d),f=i?Math.round(i/1e3):void 0;return s.put(n,JSON.stringify(e),{expirationTtl:f})},r=async n=>!!await t.get(n),c=n=>t.delete(n);return{get:u,set:l,has:r,del:c,keys:n=>t.list({prefix:n}),clear:()=>{}}};o.file=t=>{let u=(async()=>{let i=await import(["node:fs","promises"].join("/"));return await i.writeFile(t.pathname,"{}",{flag:"wx"}).catch(f=>{if(f.code!=="EEXIST")throw f}),i})(),l=async()=>{let i=await(await u).readFile(t.pathname,"utf8");return i?JSON.parse(i):{}},r=async s=>{await(await u).writeFile(t.pathname,JSON.stringify(s,null,2))},c=async s=>(await l())[s]??null;return{get:c,set:async(s,i)=>{let f=await l();f[s]=i,await r(f)},has:async s=>await c(s)!==null,del:async s=>{let i=await l();delete i[s],await r(i)},keys:async(s="")=>{let i=await l();return Object.keys(i).filter(f=>f.startsWith(s))},clear:async()=>{await r({})}}};var g=async t=>t instanceof Map?o.expire(o.memory(t)):typeof localStorage<"u"&&t===localStorage||typeof sessionStorage<"u"&&t===sessionStorage?o.expire(o.storage(t)):t==="cookie"?o.cookie():t.defineDriver&&t.dropInstance&&t.INDEXEDDB?o.expire(o.localForage(t)):t.protocol&&t.protocol==="file:"?o.expire(o.file(t)):t.pSubscribe&&t.sSubscribe?o.redis(t):t?.constructor?.name==="KvNamespace"?o.cloudflare(t):null;function h(t=new Map){return new Proxy({},{get:(u,l)=>async(...r)=>{let c=await g(await t);if(!c)throw new Error("Store is not valid");return!c[l]&&l==="close"?null:c[l](...r)}})}export{h as default};
|
|
2
|
-
//# sourceMappingURL=index.min.js.map
|
package/index.min.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["src/index.js"],
|
|
4
|
-
"sourcesContent": ["const layers = {};\n\nconst times = /(-?(?:\\d+\\.?\\d*|\\d*\\.?\\d+)(?:e[-+]?\\d+)?)\\s*([\\p{L}]*)/iu;\n\nparse.millisecond = parse.ms = 1;\nparse.second = parse.sec = parse.s = parse[\"\"] = parse.ms * 1000;\nparse.minute = parse.min = parse.m = parse.s * 60;\nparse.hour = parse.hr = parse.h = parse.m * 60;\nparse.day = parse.d = parse.h * 24;\nparse.week = parse.wk = parse.w = parse.d * 7;\nparse.year = parse.yr = parse.y = parse.d * 365.25;\nparse.month = parse.b = parse.y / 12;\n\n// Returns the time in milliseconds\nfunction parse(str) {\n if (str === null || str === undefined) return null;\n if (typeof str === \"number\") return str;\n // ignore commas/placeholders\n str = str.toLowerCase().replace(/[,_]/g, \"\");\n let [_, value, units] = times.exec(str) || [];\n if (!units) return null;\n const unitValue = parse[units] || parse[units.replace(/s$/, \"\")];\n if (!unitValue) return null;\n const result = unitValue * parseFloat(value, 10);\n return Math.abs(Math.round(result));\n}\n\nlayers.expire = (store) => {\n // Item methods\n const get = async (key) => {\n if (!(await store.has(key))) return null;\n const { data, expire } = await store.get(key);\n if (expire === null) return data;\n const diff = expire - new Date().getTime();\n if (diff <= 0) return null;\n return data;\n };\n const set = async (key, data, { expire = null } = {}) => {\n const time = parse(expire);\n const expDiff = time !== null ? new Date().getTime() + time : null;\n return store.set(key, { expire: expDiff, data });\n };\n const has = async (key) => (await store.get(key)) !== null;\n const del = store.del;\n\n // Group methods\n const keys = store.keys;\n const clear = store.clear;\n\n return { get, set, has, del, keys, clear };\n};\n\nlayers.memory = (store) => {\n // Item methods\n const get = async (key) => store.get(key) || null;\n const set = async (key, data) => store.set(key, data);\n const has = async (key) => store.has(key);\n const del = async (key) => store.delete(key);\n\n // Group methods\n const keys = async (prefix = \"\") =>\n [...(await store.keys())].filter((k) => k.startsWith(prefix));\n const clear = () => store.clear();\n\n return { get, set, has, del, keys, clear };\n};\n\nlayers.storage = (store) => {\n // Item methods\n const get = async (key) => (store[key] ? JSON.parse(store[key]) : null);\n const set = async (key, data) => store.setItem(key, JSON.stringify(data));\n const has = async (key) => key in store;\n const del = async (key) => store.removeItem(key);\n\n // Group methods\n const keys = async (prefix = \"\") =>\n Object.keys(store).filter((k) => k.startsWith(prefix));\n const clear = () => store.clear();\n\n return { get, set, has, del, keys, clear };\n};\n\nlayers.cookie = () => {\n const get = async (key) => {\n const value =\n document.cookie\n .split(\"; \")\n .filter(Boolean)\n .find((row) => row.startsWith(key + \"=\"))\n ?.split(\"=\")[1] || null;\n return JSON.parse(decodeURIComponent(value));\n };\n\n const set = async (key, data, { expire = null } = {}) => {\n const time = parse(expire);\n const now = new Date().getTime();\n const expireStr =\n time !== null ? `; expires=${new Date(now + time).toUTCString()}` : \"\";\n const value = encodeURIComponent(JSON.stringify(data));\n document.cookie = key + \"=\" + value + expireStr;\n };\n const has = async (key) => (await keys()).includes(key);\n const del = async (key) => set(key, \"\", { expire: -100 });\n\n // Group methods\n const keys = async (prefix = \"\") =>\n document.cookie\n .split(\";\")\n .map((l) => l.split(\"=\")[0].trim())\n .filter(Boolean)\n .filter((k) => k.startsWith(prefix));\n const clear = async () => {\n await Promise.all((await keys()).map(del));\n };\n\n return { get, set, has, del, keys, clear };\n};\n\nlayers.redis = (store) => {\n const get = async (key) => {\n const client = await store;\n const value = await client.get(key);\n if (!value) return null;\n return JSON.parse(value);\n };\n const set = async (key, value, { expire = null } = {}) => {\n if (value === null || expire === 0) return del(key);\n const client = await store;\n const exp = parse(expire);\n const EX = exp ? Math.round(exp / 1000) : undefined;\n return client.set(key, JSON.stringify(value), { EX });\n };\n const has = async (key) => Boolean(await (await store).exists(key));\n const del = async (key) => (await store).del(key);\n\n const keys = async (prefix = \"\") => (await store).keys(prefix + \"*\");\n const clear = async () => (await store).flushAll();\n const close = async () => (await store).quit();\n\n return { get, set, has, del, keys, clear, close };\n};\n\nlayers.localForage = (store) => {\n const get = (key) => store.getItem(key);\n const set = (key, value) => store.setItem(key, value);\n const has = async (key) => (await get(key)) !== null;\n const del = (key) => store.removeItem(key);\n\n const keys = async (prefix = \"\") =>\n (await store.keys()).filter((k) => k.startsWith(prefix));\n const clear = () => store.clear();\n\n return { get, set, has, del, keys, clear };\n};\n\nlayers.cloudflare = (store) => {\n const get = async (key) => {\n const data = await store.get(key);\n if (!data) return null;\n return JSON.parse(data);\n };\n const set = async (key, value, { expire }) => {\n if (value === null || expire === 0) return del(key);\n const client = await store;\n const exp = parse(expire);\n const expirationTtl = exp ? Math.round(exp / 1000) : undefined;\n return client.put(key, JSON.stringify(value), { expirationTtl });\n };\n const has = async (key) => Boolean(await store.get(key));\n const del = (key) => store.delete(key);\n const keys = (prefix) => store.list({ prefix });\n const clear = () => {};\n return { get, set, has, del, keys, clear };\n};\n\nlayers.file = (file) => {\n const fsProm = (async () => {\n // For the bundler, it doesn't like it otherwise\n const lib = [\"node:fs\", \"promises\"].join(\"/\");\n const fsp = await import(lib);\n // We want to make sure the file already exists, so attempt to\n // create it (but not OVERWRITE it, that's why the x flag) and\n // it fails if it already exists\n await fsp.writeFile(file.pathname, \"{}\", { flag: \"wx\" }).catch((err) => {\n if (err.code !== \"EEXIST\") throw err;\n });\n return fsp;\n })();\n const getContent = async () => {\n const fsp = await fsProm;\n const text = await fsp.readFile(file.pathname, \"utf8\");\n if (!text) return {};\n return JSON.parse(text);\n };\n const setContent = async (data) => {\n const fsp = await fsProm;\n await fsp.writeFile(file.pathname, JSON.stringify(data, null, 2));\n };\n const get = async (key) => {\n const data = await getContent();\n return data[key] ?? null;\n };\n const set = async (key, value) => {\n const data = await getContent();\n data[key] = value;\n await setContent(data);\n };\n const has = async (key) => (await get(key)) !== null;\n const del = async (key) => {\n const data = await getContent();\n delete data[key];\n await setContent(data);\n };\n const keys = async (prefix = \"\") => {\n const data = await getContent();\n return Object.keys(data).filter((k) => k.startsWith(prefix));\n };\n const clear = async () => {\n await setContent({});\n };\n return { get, set, has, del, keys, clear };\n};\n\nconst getStore = async (store) => {\n // Convert it to the normalized kv, then add the expiry layer on top\n if (store instanceof Map) {\n return layers.expire(layers.memory(store));\n }\n\n if (typeof localStorage !== \"undefined\" && store === localStorage) {\n return layers.expire(layers.storage(store));\n }\n\n if (typeof sessionStorage !== \"undefined\" && store === sessionStorage) {\n return layers.expire(layers.storage(store));\n }\n\n if (store === \"cookie\") {\n return layers.cookie();\n }\n\n if (store.defineDriver && store.dropInstance && store.INDEXEDDB) {\n return layers.expire(layers.localForage(store));\n }\n\n if (store.protocol && store.protocol === \"file:\") {\n return layers.expire(layers.file(store));\n }\n\n if (store.pSubscribe && store.sSubscribe) {\n return layers.redis(store);\n }\n\n if (store?.constructor?.name === \"KvNamespace\") {\n return layers.cloudflare(store);\n }\n\n // \u00AF\\_(\u30C4)_/\u00AF\n return null;\n};\n\nexport default function compat(storeClient = new Map()) {\n return new Proxy(\n {},\n {\n get: (_, key) => {\n return async (...args) => {\n const store = await getStore(await storeClient);\n // Throw at the first chance when the store failed to init:\n if (!store) {\n throw new Error(\"Store is not valid\");\n }\n // The store.close() is the only one allowed to be called even\n // if it doesn't exist, since it's optional in some stores\n if (!store[key] && key === \"close\") return null;\n return store[key](...args);\n };\n },\n }\n );\n}\n"],
|
|
5
|
-
"mappings": "AAAA,IAAMA,EAAS,CAAC,EAEVC,EAAQ,2DAEdC,EAAM,YAAcA,EAAM,GAAK,EAC/BA,EAAM,OAASA,EAAM,IAAMA,EAAM,EAAIA,EAAM,EAAE,EAAIA,EAAM,GAAK,IAC5DA,EAAM,OAASA,EAAM,IAAMA,EAAM,EAAIA,EAAM,EAAI,GAC/CA,EAAM,KAAOA,EAAM,GAAKA,EAAM,EAAIA,EAAM,EAAI,GAC5CA,EAAM,IAAMA,EAAM,EAAIA,EAAM,EAAI,GAChCA,EAAM,KAAOA,EAAM,GAAKA,EAAM,EAAIA,EAAM,EAAI,EAC5CA,EAAM,KAAOA,EAAM,GAAKA,EAAM,EAAIA,EAAM,EAAI,OAC5CA,EAAM,MAAQA,EAAM,EAAIA,EAAM,EAAI,GAGlC,SAASA,EAAMC,EAAK,CAClB,GAAIA,GAAQ,KAA2B,OAAO,KAC9C,GAAI,OAAOA,GAAQ,SAAU,OAAOA,EAEpCA,EAAMA,EAAI,YAAY,EAAE,QAAQ,QAAS,EAAE,EAC3C,GAAI,CAACC,EAAGC,EAAOC,CAAK,EAAIL,EAAM,KAAKE,CAAG,GAAK,CAAC,EAC5C,GAAI,CAACG,EAAO,OAAO,KACnB,IAAMC,EAAYL,EAAMI,CAAK,GAAKJ,EAAMI,EAAM,QAAQ,KAAM,EAAE,CAAC,EAC/D,GAAI,CAACC,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BA,EAAM,UAC7CT,EAAO,OAAOA,EAAO,YAAYS,CAAK,CAAC,EAG5CA,EAAM,UAAYA,EAAM,WAAa,QAChCT,EAAO,OAAOA,EAAO,KAAKS,CAAK,CAAC,EAGrCA,EAAM,YAAcA,EAAM,WACrBT,EAAO,MAAMS,CAAK,EAGvBA,GAAO,aAAa,OAAS,cACxBT,EAAO,WAAWS,CAAK,EAIzB,KAGM,SAAR8B,EAAwBC,EAAc,IAAI,IAAO,CACtD,OAAO,IAAI,MACT,CAAC,EACD,CACE,IAAK,CAACpC,EAAGO,IACA,SAAU8B,IAAS,CACxB,IAAMhC,EAAQ,MAAM6B,EAAS,MAAME,CAAW,EAE9C,GAAI,CAAC/B,EACH,MAAM,IAAI,MAAM,oBAAoB,EAItC,MAAI,CAACA,EAAME,CAAG,GAAKA,IAAQ,QAAgB,KACpCF,EAAME,CAAG,EAAE,GAAG8B,CAAI,CAC3B,CAEJ,CACF,CACF",
|
|
6
|
-
"names": ["layers", "times", "parse", "str", "_", "value", "units", "unitValue", "result", "store", "get", "key", "data", "expire", "set", "time", "expDiff", "has", "del", "keys", "clear", "prefix", "k", "row", "now", "expireStr", "l", "client", "exp", "EX", "expirationTtl", "file", "fsProm", "fsp", "err", "getContent", "text", "setContent", "getStore", "compat", "storeClient", "args"]
|
|
7
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{ "exclude": ["node_modules"] }
|