@robinpath/cache 0.1.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/dist/cache.d.ts +141 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +345 -0
- package/dist/cache.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/package.json +31 -0
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { BuiltinHandler } from "@wiredwp/robinpath";
|
|
2
|
+
export declare const CacheFunctions: Record<string, BuiltinHandler>;
|
|
3
|
+
export declare const CacheFunctionMetadata: {
|
|
4
|
+
set: {
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: {
|
|
7
|
+
name: string;
|
|
8
|
+
dataType: string;
|
|
9
|
+
description: string;
|
|
10
|
+
formInputType: string;
|
|
11
|
+
required: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
returnType: string;
|
|
14
|
+
returnDescription: string;
|
|
15
|
+
example: string;
|
|
16
|
+
};
|
|
17
|
+
get: {
|
|
18
|
+
description: string;
|
|
19
|
+
parameters: {
|
|
20
|
+
name: string;
|
|
21
|
+
dataType: string;
|
|
22
|
+
description: string;
|
|
23
|
+
formInputType: string;
|
|
24
|
+
required: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
returnType: string;
|
|
27
|
+
returnDescription: string;
|
|
28
|
+
example: string;
|
|
29
|
+
};
|
|
30
|
+
has: {
|
|
31
|
+
description: string;
|
|
32
|
+
parameters: {
|
|
33
|
+
name: string;
|
|
34
|
+
dataType: string;
|
|
35
|
+
description: string;
|
|
36
|
+
formInputType: string;
|
|
37
|
+
required: boolean;
|
|
38
|
+
}[];
|
|
39
|
+
returnType: string;
|
|
40
|
+
returnDescription: string;
|
|
41
|
+
example: string;
|
|
42
|
+
};
|
|
43
|
+
delete: {
|
|
44
|
+
description: string;
|
|
45
|
+
parameters: {
|
|
46
|
+
name: string;
|
|
47
|
+
dataType: string;
|
|
48
|
+
description: string;
|
|
49
|
+
formInputType: string;
|
|
50
|
+
required: boolean;
|
|
51
|
+
}[];
|
|
52
|
+
returnType: string;
|
|
53
|
+
returnDescription: string;
|
|
54
|
+
example: string;
|
|
55
|
+
};
|
|
56
|
+
clear: {
|
|
57
|
+
description: string;
|
|
58
|
+
parameters: never[];
|
|
59
|
+
returnType: string;
|
|
60
|
+
returnDescription: string;
|
|
61
|
+
example: string;
|
|
62
|
+
};
|
|
63
|
+
keys: {
|
|
64
|
+
description: string;
|
|
65
|
+
parameters: never[];
|
|
66
|
+
returnType: string;
|
|
67
|
+
returnDescription: string;
|
|
68
|
+
example: string;
|
|
69
|
+
};
|
|
70
|
+
values: {
|
|
71
|
+
description: string;
|
|
72
|
+
parameters: never[];
|
|
73
|
+
returnType: string;
|
|
74
|
+
returnDescription: string;
|
|
75
|
+
example: string;
|
|
76
|
+
};
|
|
77
|
+
size: {
|
|
78
|
+
description: string;
|
|
79
|
+
parameters: never[];
|
|
80
|
+
returnType: string;
|
|
81
|
+
returnDescription: string;
|
|
82
|
+
example: string;
|
|
83
|
+
};
|
|
84
|
+
ttl: {
|
|
85
|
+
description: string;
|
|
86
|
+
parameters: {
|
|
87
|
+
name: string;
|
|
88
|
+
dataType: string;
|
|
89
|
+
description: string;
|
|
90
|
+
formInputType: string;
|
|
91
|
+
required: boolean;
|
|
92
|
+
}[];
|
|
93
|
+
returnType: string;
|
|
94
|
+
returnDescription: string;
|
|
95
|
+
example: string;
|
|
96
|
+
};
|
|
97
|
+
setMany: {
|
|
98
|
+
description: string;
|
|
99
|
+
parameters: {
|
|
100
|
+
name: string;
|
|
101
|
+
dataType: string;
|
|
102
|
+
description: string;
|
|
103
|
+
formInputType: string;
|
|
104
|
+
required: boolean;
|
|
105
|
+
}[];
|
|
106
|
+
returnType: string;
|
|
107
|
+
returnDescription: string;
|
|
108
|
+
example: string;
|
|
109
|
+
};
|
|
110
|
+
getMany: {
|
|
111
|
+
description: string;
|
|
112
|
+
parameters: {
|
|
113
|
+
name: string;
|
|
114
|
+
dataType: string;
|
|
115
|
+
description: string;
|
|
116
|
+
formInputType: string;
|
|
117
|
+
required: boolean;
|
|
118
|
+
}[];
|
|
119
|
+
returnType: string;
|
|
120
|
+
returnDescription: string;
|
|
121
|
+
example: string;
|
|
122
|
+
};
|
|
123
|
+
deleteMany: {
|
|
124
|
+
description: string;
|
|
125
|
+
parameters: {
|
|
126
|
+
name: string;
|
|
127
|
+
dataType: string;
|
|
128
|
+
description: string;
|
|
129
|
+
formInputType: string;
|
|
130
|
+
required: boolean;
|
|
131
|
+
}[];
|
|
132
|
+
returnType: string;
|
|
133
|
+
returnDescription: string;
|
|
134
|
+
example: string;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export declare const CacheModuleMetadata: {
|
|
138
|
+
description: string;
|
|
139
|
+
methods: string[];
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAoC,MAAM,oBAAoB,CAAC;AAwJ3F,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAazD,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiLjC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;CAgB/B,CAAC"}
|
package/dist/cache.js
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
const store = new Map();
|
|
2
|
+
// -- Helpers ----------------------------------------------------------------
|
|
3
|
+
function isExpired(entry) {
|
|
4
|
+
return entry.expiresAt !== null && Date.now() > entry.expiresAt;
|
|
5
|
+
}
|
|
6
|
+
function getNonExpiredKeys() {
|
|
7
|
+
const result = [];
|
|
8
|
+
for (const [key, entry] of store) {
|
|
9
|
+
if (isExpired(entry)) {
|
|
10
|
+
store.delete(key);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
result.push(key);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
// -- RobinPath Function Handlers --------------------------------------------
|
|
19
|
+
const set = (args) => {
|
|
20
|
+
const key = String(args[0] ?? "");
|
|
21
|
+
const value = args[1];
|
|
22
|
+
const ttl = args[2] != null ? Number(args[2]) : null;
|
|
23
|
+
const expiresAt = ttl != null && ttl > 0 ? Date.now() + ttl * 1000 : null;
|
|
24
|
+
store.set(key, { value, expiresAt });
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
const get = (args) => {
|
|
28
|
+
const key = String(args[0] ?? "");
|
|
29
|
+
const defaultValue = args[1] !== undefined ? args[1] : null;
|
|
30
|
+
const entry = store.get(key);
|
|
31
|
+
if (!entry)
|
|
32
|
+
return defaultValue;
|
|
33
|
+
if (isExpired(entry)) {
|
|
34
|
+
store.delete(key);
|
|
35
|
+
return defaultValue;
|
|
36
|
+
}
|
|
37
|
+
return entry.value;
|
|
38
|
+
};
|
|
39
|
+
const has = (args) => {
|
|
40
|
+
const key = String(args[0] ?? "");
|
|
41
|
+
const entry = store.get(key);
|
|
42
|
+
if (!entry)
|
|
43
|
+
return false;
|
|
44
|
+
if (isExpired(entry)) {
|
|
45
|
+
store.delete(key);
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
};
|
|
50
|
+
const del = (args) => {
|
|
51
|
+
const key = String(args[0] ?? "");
|
|
52
|
+
store.delete(key);
|
|
53
|
+
return true;
|
|
54
|
+
};
|
|
55
|
+
const clear = () => {
|
|
56
|
+
store.clear();
|
|
57
|
+
return true;
|
|
58
|
+
};
|
|
59
|
+
const keys = () => {
|
|
60
|
+
return getNonExpiredKeys();
|
|
61
|
+
};
|
|
62
|
+
const values = () => {
|
|
63
|
+
const result = [];
|
|
64
|
+
for (const [key, entry] of store) {
|
|
65
|
+
if (isExpired(entry)) {
|
|
66
|
+
store.delete(key);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
result.push(entry.value);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
};
|
|
74
|
+
const size = () => {
|
|
75
|
+
return getNonExpiredKeys().length;
|
|
76
|
+
};
|
|
77
|
+
const ttl = (args) => {
|
|
78
|
+
const key = String(args[0] ?? "");
|
|
79
|
+
const entry = store.get(key);
|
|
80
|
+
if (!entry)
|
|
81
|
+
return null;
|
|
82
|
+
if (isExpired(entry)) {
|
|
83
|
+
store.delete(key);
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if (entry.expiresAt === null)
|
|
87
|
+
return -1;
|
|
88
|
+
return Math.max(0, Math.round((entry.expiresAt - Date.now()) / 1000));
|
|
89
|
+
};
|
|
90
|
+
const setMany = (args) => {
|
|
91
|
+
const pairs = args[0];
|
|
92
|
+
const ttlSeconds = args[1] != null ? Number(args[1]) : null;
|
|
93
|
+
const expiresAt = ttlSeconds != null && ttlSeconds > 0 ? Date.now() + ttlSeconds * 1000 : null;
|
|
94
|
+
if (pairs == null || typeof pairs !== "object" || Array.isArray(pairs))
|
|
95
|
+
return 0;
|
|
96
|
+
let count = 0;
|
|
97
|
+
for (const [key, value] of Object.entries(pairs)) {
|
|
98
|
+
store.set(key, { value, expiresAt });
|
|
99
|
+
count++;
|
|
100
|
+
}
|
|
101
|
+
return count;
|
|
102
|
+
};
|
|
103
|
+
const getMany = (args) => {
|
|
104
|
+
const keysArr = args[0];
|
|
105
|
+
if (!Array.isArray(keysArr))
|
|
106
|
+
return {};
|
|
107
|
+
const result = {};
|
|
108
|
+
for (const k of keysArr) {
|
|
109
|
+
const key = String(k);
|
|
110
|
+
const entry = store.get(key);
|
|
111
|
+
if (!entry)
|
|
112
|
+
continue;
|
|
113
|
+
if (isExpired(entry)) {
|
|
114
|
+
store.delete(key);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
result[key] = entry.value;
|
|
118
|
+
}
|
|
119
|
+
return result;
|
|
120
|
+
};
|
|
121
|
+
const deleteMany = (args) => {
|
|
122
|
+
const keysArr = args[0];
|
|
123
|
+
if (!Array.isArray(keysArr))
|
|
124
|
+
return 0;
|
|
125
|
+
let count = 0;
|
|
126
|
+
for (const k of keysArr) {
|
|
127
|
+
const key = String(k);
|
|
128
|
+
if (store.has(key)) {
|
|
129
|
+
store.delete(key);
|
|
130
|
+
count++;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return count;
|
|
134
|
+
};
|
|
135
|
+
// -- Exports ----------------------------------------------------------------
|
|
136
|
+
export const CacheFunctions = {
|
|
137
|
+
set,
|
|
138
|
+
get,
|
|
139
|
+
has,
|
|
140
|
+
"delete": del,
|
|
141
|
+
clear,
|
|
142
|
+
keys,
|
|
143
|
+
values,
|
|
144
|
+
size,
|
|
145
|
+
ttl,
|
|
146
|
+
setMany,
|
|
147
|
+
getMany,
|
|
148
|
+
deleteMany,
|
|
149
|
+
};
|
|
150
|
+
export const CacheFunctionMetadata = {
|
|
151
|
+
set: {
|
|
152
|
+
description: "Store a value in the cache with an optional TTL",
|
|
153
|
+
parameters: [
|
|
154
|
+
{
|
|
155
|
+
name: "key",
|
|
156
|
+
dataType: "string",
|
|
157
|
+
description: "Cache key to store the value under",
|
|
158
|
+
formInputType: "text",
|
|
159
|
+
required: true,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "value",
|
|
163
|
+
dataType: "any",
|
|
164
|
+
description: "Value to store in the cache",
|
|
165
|
+
formInputType: "text",
|
|
166
|
+
required: true,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "ttl",
|
|
170
|
+
dataType: "number",
|
|
171
|
+
description: "Time-to-live in seconds (omit or null for no expiry)",
|
|
172
|
+
formInputType: "number",
|
|
173
|
+
required: false,
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
returnType: "boolean",
|
|
177
|
+
returnDescription: "True if the value was stored",
|
|
178
|
+
example: 'cache.set "user:1" "Alice" 60',
|
|
179
|
+
},
|
|
180
|
+
get: {
|
|
181
|
+
description: "Retrieve a value from the cache by key",
|
|
182
|
+
parameters: [
|
|
183
|
+
{
|
|
184
|
+
name: "key",
|
|
185
|
+
dataType: "string",
|
|
186
|
+
description: "Cache key to look up",
|
|
187
|
+
formInputType: "text",
|
|
188
|
+
required: true,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "defaultValue",
|
|
192
|
+
dataType: "any",
|
|
193
|
+
description: "Value to return if the key is not found or expired",
|
|
194
|
+
formInputType: "text",
|
|
195
|
+
required: false,
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
returnType: "any",
|
|
199
|
+
returnDescription: "The cached value, the default value, or null if not found",
|
|
200
|
+
example: 'cache.get "user:1" "unknown"',
|
|
201
|
+
},
|
|
202
|
+
has: {
|
|
203
|
+
description: "Check if a non-expired key exists in the cache",
|
|
204
|
+
parameters: [
|
|
205
|
+
{
|
|
206
|
+
name: "key",
|
|
207
|
+
dataType: "string",
|
|
208
|
+
description: "Cache key to check",
|
|
209
|
+
formInputType: "text",
|
|
210
|
+
required: true,
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
returnType: "boolean",
|
|
214
|
+
returnDescription: "True if the key exists and has not expired",
|
|
215
|
+
example: 'cache.has "user:1"',
|
|
216
|
+
},
|
|
217
|
+
delete: {
|
|
218
|
+
description: "Remove a key from the cache",
|
|
219
|
+
parameters: [
|
|
220
|
+
{
|
|
221
|
+
name: "key",
|
|
222
|
+
dataType: "string",
|
|
223
|
+
description: "Cache key to delete",
|
|
224
|
+
formInputType: "text",
|
|
225
|
+
required: true,
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
returnType: "boolean",
|
|
229
|
+
returnDescription: "True if the key was deleted",
|
|
230
|
+
example: 'cache.delete "user:1"',
|
|
231
|
+
},
|
|
232
|
+
clear: {
|
|
233
|
+
description: "Remove all entries from the cache",
|
|
234
|
+
parameters: [],
|
|
235
|
+
returnType: "boolean",
|
|
236
|
+
returnDescription: "True if the cache was cleared",
|
|
237
|
+
example: "cache.clear",
|
|
238
|
+
},
|
|
239
|
+
keys: {
|
|
240
|
+
description: "Get all non-expired keys in the cache",
|
|
241
|
+
parameters: [],
|
|
242
|
+
returnType: "array",
|
|
243
|
+
returnDescription: "Array of all non-expired cache keys",
|
|
244
|
+
example: "cache.keys",
|
|
245
|
+
},
|
|
246
|
+
values: {
|
|
247
|
+
description: "Get all non-expired values in the cache",
|
|
248
|
+
parameters: [],
|
|
249
|
+
returnType: "array",
|
|
250
|
+
returnDescription: "Array of all non-expired cache values",
|
|
251
|
+
example: "cache.values",
|
|
252
|
+
},
|
|
253
|
+
size: {
|
|
254
|
+
description: "Get the number of non-expired entries in the cache",
|
|
255
|
+
parameters: [],
|
|
256
|
+
returnType: "number",
|
|
257
|
+
returnDescription: "Count of non-expired cache entries",
|
|
258
|
+
example: "cache.size",
|
|
259
|
+
},
|
|
260
|
+
ttl: {
|
|
261
|
+
description: "Get the remaining time-to-live for a cache key",
|
|
262
|
+
parameters: [
|
|
263
|
+
{
|
|
264
|
+
name: "key",
|
|
265
|
+
dataType: "string",
|
|
266
|
+
description: "Cache key to check TTL for",
|
|
267
|
+
formInputType: "text",
|
|
268
|
+
required: true,
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
returnType: "number",
|
|
272
|
+
returnDescription: "Remaining TTL in seconds, -1 if no expiry, or null if key does not exist",
|
|
273
|
+
example: 'cache.ttl "user:1"',
|
|
274
|
+
},
|
|
275
|
+
setMany: {
|
|
276
|
+
description: "Store multiple key-value pairs in the cache at once",
|
|
277
|
+
parameters: [
|
|
278
|
+
{
|
|
279
|
+
name: "entries",
|
|
280
|
+
dataType: "object",
|
|
281
|
+
description: "Object of key-value pairs to store",
|
|
282
|
+
formInputType: "json",
|
|
283
|
+
required: true,
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: "ttl",
|
|
287
|
+
dataType: "number",
|
|
288
|
+
description: "Time-to-live in seconds for all entries (omit or null for no expiry)",
|
|
289
|
+
formInputType: "number",
|
|
290
|
+
required: false,
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
returnType: "number",
|
|
294
|
+
returnDescription: "Number of entries that were stored",
|
|
295
|
+
example: 'cache.setMany {"a": 1, "b": 2} 120',
|
|
296
|
+
},
|
|
297
|
+
getMany: {
|
|
298
|
+
description: "Retrieve multiple values from the cache by keys",
|
|
299
|
+
parameters: [
|
|
300
|
+
{
|
|
301
|
+
name: "keys",
|
|
302
|
+
dataType: "array",
|
|
303
|
+
description: "Array of cache keys to look up",
|
|
304
|
+
formInputType: "json",
|
|
305
|
+
required: true,
|
|
306
|
+
},
|
|
307
|
+
],
|
|
308
|
+
returnType: "object",
|
|
309
|
+
returnDescription: "Object of key-value pairs for found non-expired keys",
|
|
310
|
+
example: 'cache.getMany ["a", "b", "c"]',
|
|
311
|
+
},
|
|
312
|
+
deleteMany: {
|
|
313
|
+
description: "Remove multiple keys from the cache at once",
|
|
314
|
+
parameters: [
|
|
315
|
+
{
|
|
316
|
+
name: "keys",
|
|
317
|
+
dataType: "array",
|
|
318
|
+
description: "Array of cache keys to delete",
|
|
319
|
+
formInputType: "json",
|
|
320
|
+
required: true,
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
returnType: "number",
|
|
324
|
+
returnDescription: "Number of entries that were deleted",
|
|
325
|
+
example: 'cache.deleteMany ["a", "b"]',
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
export const CacheModuleMetadata = {
|
|
329
|
+
description: "In-memory key-value cache with optional TTL expiration for temporary data storage",
|
|
330
|
+
methods: [
|
|
331
|
+
"set",
|
|
332
|
+
"get",
|
|
333
|
+
"has",
|
|
334
|
+
"delete",
|
|
335
|
+
"clear",
|
|
336
|
+
"keys",
|
|
337
|
+
"values",
|
|
338
|
+
"size",
|
|
339
|
+
"ttl",
|
|
340
|
+
"setMany",
|
|
341
|
+
"getMany",
|
|
342
|
+
"deleteMany",
|
|
343
|
+
],
|
|
344
|
+
};
|
|
345
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AASA,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;AAE5C,8EAA8E;AAE9E,SAAS,SAAS,CAAC,KAAiB;IAClC,OAAO,KAAK,CAAC,SAAS,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;AAClE,CAAC;AAED,SAAS,iBAAiB;IACxB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC;QACjC,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACrB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,8EAA8E;AAE9E,MAAM,GAAG,GAAmB,CAAC,IAAI,EAAE,EAAE;IACnC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,I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pB,iBAAiB,EAAE,qCAAqC;QACxD,OAAO,EAAE,6BAA6B;KACvC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,WAAW,EAAE,mFAAmF;IAChG,OAAO,EAAE;QACP,KAAK;QACL,KAAK;QACL,KAAK;QACL,QAAQ;QACR,OAAO;QACP,MAAM;QACN,QAAQ;QACR,MAAM;QACN,KAAK;QACL,SAAS;QACT,SAAS;QACT,YAAY;KACb;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ModuleAdapter } from "@wiredwp/robinpath";
|
|
2
|
+
declare const CacheModule: ModuleAdapter;
|
|
3
|
+
export default CacheModule;
|
|
4
|
+
export { CacheModule };
|
|
5
|
+
export { CacheFunctions, CacheFunctionMetadata, CacheModuleMetadata } from "./cache.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,QAAA,MAAM,WAAW,EAAE,aAMlB,CAAC;AAEF,eAAe,WAAW,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CacheFunctions, CacheFunctionMetadata, CacheModuleMetadata } from "./cache.js";
|
|
2
|
+
const CacheModule = {
|
|
3
|
+
name: "cache",
|
|
4
|
+
functions: CacheFunctions,
|
|
5
|
+
functionMetadata: CacheFunctionMetadata,
|
|
6
|
+
moduleMetadata: CacheModuleMetadata,
|
|
7
|
+
global: false,
|
|
8
|
+
}; // as ModuleAdapter
|
|
9
|
+
export default CacheModule;
|
|
10
|
+
export { CacheModule };
|
|
11
|
+
export { CacheFunctions, CacheFunctionMetadata, CacheModuleMetadata } from "./cache.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAExF,MAAM,WAAW,GAAkB;IACjC,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,cAAc;IACzB,gBAAgB,EAAE,qBAA4B;IAC9C,cAAc,EAAE,mBAA0B;IAC1C,MAAM,EAAE,KAAK;CACd,CAAC,CAAC,mBAAmB;AAEtB,eAAe,WAAW,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@robinpath/cache",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"test": "node --import tsx --test tests/*.test.ts"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@wiredwp/robinpath": ">=0.20.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@wiredwp/robinpath": "^0.30.1",
|
|
28
|
+
"tsx": "^4.19.0",
|
|
29
|
+
"typescript": "^5.6.0"
|
|
30
|
+
}
|
|
31
|
+
}
|