polystore 0.11.0 → 0.11.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/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "polystore",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "A small compatibility layer for many popular KV stores like localStorage, Redis, FileSystem, etc.",
5
5
  "homepage": "https://polystore.dev/",
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": "src/index.js",
11
10
  "type": "module",
11
+ "main": "src/index.js",
12
12
  "types": "src/index.d.ts",
13
+ "files": [
14
+ "src/"
15
+ ],
13
16
  "scripts": {
14
17
  "size": "echo $(gzip -c src/index.js | wc -c) bytes",
15
18
  "start": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch --coverage --detectOpenHandles",
@@ -1 +0,0 @@
1
- custom: https://www.paypal.me/franciscopresencia/19
@@ -1,24 +0,0 @@
1
- name: tests
2
-
3
- on: [push]
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-latest
8
-
9
- strategy:
10
- matrix:
11
- node-version: [18.x, 20.x]
12
-
13
- steps:
14
- - uses: actions/checkout@v4
15
- - name: Use Node.js ${{ matrix.node-version }}
16
- uses: actions/setup-node@v4
17
- with:
18
- node-version: ${{ matrix.node-version }}
19
- - name: install dependencies
20
- run: npm install
21
- - name: npm test
22
- run: npm test
23
- env:
24
- CI: true
Binary file
Binary file
Binary file
package/assets/home.html DELETED
@@ -1,378 +0,0 @@
1
- <br />
2
-
3
- <section class="hero flex center nowrap">
4
- <div>
5
- <h1>Polystore</h1>
6
- <p style="max-width: 620px">
7
- A library to unify KV-stores. Allows you to write code that works on any
8
- KV store, both on the front-end and backend. Supports substores and
9
- intuitive expiration times. Get started:
10
- </p>
11
- <pre class="small">npm install polystore</pre>
12
- <div class="buttons">
13
- <a class="button" href="/documentation">Documentation</a>
14
- <a
15
- class="pseudo button"
16
- href="https://superpeer.com/francisco/-/javascript-and-react-help"
17
- >Get JS help</a
18
- >
19
- </div>
20
- </div>
21
- <div style="width: 570px; max-width: 100%">
22
- <pre><code class="language-js">import kv from &quot;polystore&quot;;
23
- import { createClient } from "redis";
24
-
25
- const REDIS = process.env.REDIS_URL;
26
- const store = kv(createClient(REDIS));
27
-
28
- await store.set(key, data, { expires: "1h" });
29
- console.log(await store.get(key));
30
- // { hello: &quot;world&quot; }</code></pre>
31
- </div>
32
- </section>
33
-
34
- <div class="separator">
35
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 20">
36
- <circle cx="10" cy="10" r="3" />
37
- <line x1="20" y1="10" x2="260" y2="10" />
38
- <circle cx="270" cy="10" r="3" />
39
- <circle class="empty" cx="283" cy="10" r="3" />
40
- <circle class="empty" cx="300" cy="10" r="5" />
41
- <circle class="empty" cx="317" cy="10" r="3" />
42
- <circle cx="330" cy="10" r="3" />
43
- <line x1="340" y1="10" x2="580" y2="10" />
44
- <circle cx="590" cy="10" r="3" />
45
- </svg>
46
- </div>
47
-
48
- <section class="features flex one two-500 three-900">
49
- <div>
50
- <div class="feature">
51
- <header>
52
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
53
- <path
54
- d="M18 8h1a4 4 0 010 8h-1M2 8h16v9a4 4 0 01-4 4H6a4 4 0 01-4-4V8zM6 1v3M10 1v3M14 1v3"
55
- />
56
- </svg>
57
- <h3>Easy peasy</h3>
58
- </header>
59
- <p>
60
- It's a KV store. It has <code>add()</code>, <code>set()</code>,
61
- <code>get()</code>, <code>has()</code>, <code>del()</code>
62
- <a href="/documentation#api" target="_blank">and more</a>.
63
- </p>
64
- </div>
65
- </div>
66
-
67
- <div>
68
- <div class="feature">
69
- <header>
70
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
71
- <path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z" />
72
- <path d="M14 2v6h6M16 13H8M16 17H8M10 9H8" />
73
- </svg>
74
- <h3>Documented</h3>
75
- </header>
76
- <p>
77
- <a href="/documentation#getting-started">Getting started</a>,
78
- <a href="/documentation#api">API</a>,
79
- <a href="/documentation#clients">Clients</a> and
80
- <a href="/documentation#creating-a-store">custom stores</a> for your
81
- convenience.
82
- </p>
83
- </div>
84
- </div>
85
- <div>
86
- <div class="feature">
87
- <header>
88
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
89
- <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
90
- <polyline points="22 4 12 14.01 9 11.01"></polyline>
91
- </svg>
92
- <h3>Tested and Typed</h3>
93
- </header>
94
- <p>
95
- <a
96
- href="https://github.com/franciscop/polystore/actions"
97
- target="_blank"
98
- >600+ tests</a
99
- >, TS definitions and JSDocs for the best experience using the library.
100
- </p>
101
- </div>
102
- </div>
103
- <div>
104
- <div class="feature">
105
- <header>
106
- <svg
107
- xmlns="http://www.w3.org/2000/svg"
108
- width="24"
109
- height="24"
110
- viewBox="0 0 24 24"
111
- fill="none"
112
- stroke="currentColor"
113
- stroke-width="2"
114
- stroke-linecap="round"
115
- stroke-linejoin="round"
116
- class="feather feather-globe"
117
- >
118
- <circle cx="12" cy="12" r="10"></circle>
119
- <line x1="2" y1="12" x2="22" y2="12"></line>
120
- <path
121
- d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"
122
- ></path>
123
- </svg>
124
- <h3>Universal Javascript</h3>
125
- </header>
126
- <p>
127
- Use it with React, Angular, Plain JS, Node.js, Bun, Tauri, Electron,
128
- etc.
129
- </p>
130
- </div>
131
- </div>
132
-
133
- <div>
134
- <div class="feature">
135
- <header>
136
- <svg
137
- xmlns="http://www.w3.org/2000/svg"
138
- width="24"
139
- height="24"
140
- viewBox="0 0 24 24"
141
- fill="none"
142
- stroke="currentColor"
143
- stroke-width="2"
144
- stroke-linecap="round"
145
- stroke-linejoin="round"
146
- >
147
- <path
148
- d="M20.24 12.24a6 6 0 00-8.49-8.49L5 10.5V19h8.5zM16 8L2 22M17.5 15H9"
149
- />
150
- </svg>
151
- <h3>Tiny Footprint</h3>
152
- </header>
153
- <p>
154
- At
155
- <a href="https://bundlephobia.com/package/polystore" target="_blank"
156
- >just <strong>3kb</strong></a
157
- >
158
- (min+gzip), the impact on your app loading time is minimal.
159
- </p>
160
- </div>
161
- </div>
162
-
163
- <div>
164
- <div class="feature">
165
- <header>
166
- <svg
167
- xmlns="http://www.w3.org/2000/svg"
168
- width="24"
169
- height="24"
170
- viewBox="0 0 24 24"
171
- fill="none"
172
- stroke="currentColor"
173
- stroke-width="2"
174
- stroke-linecap="round"
175
- stroke-linejoin="round"
176
- class="feather feather-clock"
177
- >
178
- <circle cx="12" cy="12" r="10"></circle>
179
- <polyline points="12 6 12 12 16 14"></polyline>
180
- </svg>
181
- <h3>Intuitive expirations</h3>
182
- </header>
183
- <p>
184
- Write the expiration as <code>100s</code>, <code>1week</code>, etc. and
185
- forget time-related bugs.
186
- </p>
187
- </div>
188
- </div>
189
- </section>
190
-
191
- <div class="separator">
192
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 20">
193
- <circle cx="10" cy="10" r="3" />
194
- <line x1="20" y1="10" x2="260" y2="10" />
195
- <circle cx="270" cy="10" r="3" />
196
- <circle class="empty" cx="283" cy="10" r="3" />
197
- <circle class="empty" cx="300" cy="10" r="5" />
198
- <circle class="empty" cx="317" cy="10" r="3" />
199
- <circle cx="330" cy="10" r="3" />
200
- <line x1="340" y1="10" x2="580" y2="10" />
201
- <circle cx="590" cy="10" r="3" />
202
- </svg>
203
- </div>
204
-
205
- <section class="hero flex one two-900 center">
206
- <div>
207
- <div class="content">
208
- <h2>🧩 Support for many clients</h2>
209
- <p>
210
- We support 10+ clients with documentation for each of them. Adding your
211
- own client is also easy, you only need to define 3 methods:
212
- <code>.get()</code>, <code>.set()</code> and <code>.entries()</code>.
213
- </p>
214
- <p>
215
- <a class="pseudo button" href="/documentation#clients">
216
- Clients Docs
217
- </a>
218
- </p>
219
- </div>
220
- </div>
221
- <div>
222
- <pre><code class="language-js">import kv from &quot;polystore&quot;;
223
-
224
- const store1 = kv(new Map());
225
- const store2 = kv(localStorage);
226
- const store3 = kv(redisClient);
227
- const store4 = kv(&quot;cookie&quot;);
228
- const store5 = kv(&quot;file:///users/me/kv.json&quot;);
229
- const store6 = kv(yourOwnStore);</code></pre>
230
- </div>
231
- </section>
232
-
233
- <br />
234
-
235
- <section class="hero flex one two-900 center">
236
- <div>
237
- <div class="content">
238
- <h2>🏖️ Clean and intuitive API</h2>
239
- <p>
240
- A set of high-performance item operations with <code>.add()</code>,
241
- <code>.set()</code>, <code>.get()</code>, <code>.has()</code> or
242
- <code>.del()</code>. We also provide group operations to manage your
243
- data easily.
244
- </p>
245
- <p>
246
- <a class="pseudo button" href="/documentation#api">API Docs</a>
247
- </p>
248
- </div>
249
- </div>
250
- <div>
251
- <pre><code class="language-js">import kv from "polystore";
252
- const store = kv(new Map());
253
-
254
- const key1 = await store.add(&quot;value1&quot;);
255
- const key2 = await store.set(&quot;key2&quot;, &quot;value2&quot;);
256
- const val1 = await store.get(&quot;key1&quot;);
257
- const isthere = await store.has(&quot;key1&quot;);
258
- await store.del(key1);</code></pre>
259
- </div>
260
- </section>
261
-
262
- <section class="hero flex one two-900 center">
263
- <div>
264
- <div class="content">
265
- <h2>🛗 Create substores</h2>
266
- <p>
267
- Create a new substore with <code>.prefix()</code>, then you can ignore
268
- anything related to the prefix and treat it as if it was a brand new
269
- store.
270
- </p>
271
- <p>
272
- <a class="pseudo button" href="/documentation#substores"
273
- >Substore Docs
274
- </a>
275
- </p>
276
- </div>
277
- </div>
278
- <div>
279
- <pre><code class="language-js">const session = store.prefix("session:");
280
- session.set("key1", "value1");
281
-
282
- console.log(await session.all());
283
- // { "key1": "value1" }
284
-
285
- console.log(await store.all());
286
- // { "session:key1": "value1" }</code></pre>
287
- </div>
288
- </section>
289
-
290
- <br />
291
-
292
- <section class="hero flex one two-900 center">
293
- <div>
294
- <div class="content">
295
- <h2>⏰ Easy expiration time</h2>
296
- <p>
297
- Simply write <code>{ expires: "1day" }</code> with ANY client and forget
298
- about calculating TTL, Unix time, seconds vs milliseconds bugs, etc.
299
- </p>
300
- <p>
301
- <a class="pseudo button" href="/documentation#expiration-explained">
302
- Documentation
303
- </a>
304
- </p>
305
- </div>
306
- </div>
307
- <div>
308
- <pre><code class="language-js">await store.get("key"); // null
309
-
310
- await store.set("key", "value", { expires: "1s" });
311
- await store.get("key"); // "value"
312
-
313
- await sleep(2000);
314
-
315
- await store.get("key"); // null</code></pre>
316
- </div>
317
- </section>
318
-
319
- <br />
320
-
321
- <section class="hero flex one two-900 center">
322
- <div>
323
- <div class="content">
324
- <h2>✨ Magic Autocomplete</h2>
325
- <p>
326
- Added jsdocs so the expected parameters and return value will be clearly
327
- defined in your IDE/Code Editor.
328
- </p>
329
- <p>
330
- We added the <em>description</em>, a representative <em>example</em> and
331
- even a <em>link</em> for more information for
332
- <strong>every one</strong> of the methods available! We want you to have
333
- the best development experience possible with Polystore!
334
- </p>
335
- </div>
336
- </div>
337
- <div>
338
- <div class="splash">
339
- <img
340
- width="535"
341
- src="https://raw.githubusercontent.com/franciscop/polystore/master/assets/autocomplete.webp"
342
- />
343
- </div>
344
- </div>
345
- </section>
346
-
347
- <div class="separator">
348
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 20">
349
- <circle cx="10" cy="10" r="3" />
350
- <line x1="20" y1="10" x2="260" y2="10" />
351
- <circle cx="270" cy="10" r="3" />
352
- <circle class="empty" cx="283" cy="10" r="3" />
353
- <circle class="empty" cx="300" cy="10" r="5" />
354
- <circle class="empty" cx="317" cy="10" r="3" />
355
- <circle cx="330" cy="10" r="3" />
356
- <line x1="340" y1="10" x2="580" y2="10" />
357
- <circle cx="590" cy="10" r="3" />
358
- </svg>
359
- </div>
360
-
361
- <div style="text-align: center">
362
- <p>
363
- Created by <a href="https://francisco.io/" target="_blank">Francisco</a> and
364
- <a
365
- href="https://github.com/franciscop/polystore/graphs/contributors"
366
- target="_blank"
367
- >other contributors</a
368
- >.
369
- </p>
370
- <p>
371
- Need help?
372
- <a
373
- href="https://superpeer.com/francisco/-/javascript-and-react-help"
374
- target="_blank"
375
- >Book a call</a
376
- >.
377
- </p>
378
- </div>
package/assets/splash.png DELETED
Binary file
@@ -1,11 +0,0 @@
1
- {
2
- "title": "🏬 Polystore - A universal library for standardizing any KV-store",
3
- "home": "assets/home.html",
4
- "homepage": "https://polystore.dev/",
5
- "menu": {
6
- "Documentation": "/documentation",
7
- "Issues": "https://github.com/franciscop/polystore/issues",
8
- "Get help": "https://superpeer.com/francisco/-/javascript-and-react-help",
9
- "Github": "https://github.com/franciscop/polystore"
10
- }
11
- }