@tillstack/cache-node 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.
@@ -0,0 +1,10 @@
1
+ import { TillCacheClientOptions, TillCache } from '@tillstack/cache-core';
2
+ export * from '@tillstack/cache-core';
3
+
4
+ /**
5
+ * Create a TillCache client from options, a connection string, or the
6
+ * environment (`TILLCACHE_URL`, a full `tillcache://token@host` string).
7
+ */
8
+ declare function createClient(input?: string | TillCacheClientOptions): TillCache;
9
+
10
+ export { createClient, createClient as default };
@@ -0,0 +1,10 @@
1
+ import { TillCacheClientOptions, TillCache } from '@tillstack/cache-core';
2
+ export * from '@tillstack/cache-core';
3
+
4
+ /**
5
+ * Create a TillCache client from options, a connection string, or the
6
+ * environment (`TILLCACHE_URL`, a full `tillcache://token@host` string).
7
+ */
8
+ declare function createClient(input?: string | TillCacheClientOptions): TillCache;
9
+
10
+ export { createClient, createClient as default };
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var cacheCore = require('@tillstack/cache-core');
6
+
7
+ // src/index.ts
8
+ function createClient(input) {
9
+ const source = input ?? process.env.TILLCACHE_URL;
10
+ if (!source) {
11
+ throw new Error("TillCache: no connection provided \u2014 pass one or set TILLCACHE_URL");
12
+ }
13
+ return new cacheCore.TillCache(cacheCore.parseConnectionString(source));
14
+ }
15
+ var src_default = createClient;
16
+
17
+ exports.createClient = createClient;
18
+ exports.default = src_default;
19
+ Object.keys(cacheCore).forEach(function (k) {
20
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
21
+ enumerable: true,
22
+ get: function () { return cacheCore[k]; }
23
+ });
24
+ });
25
+ //# sourceMappingURL=index.js.map
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["TillCache","parseConnectionString"],"mappings":";;;;;;;AAmBO,SAAS,aAAa,KAAA,EAAoD;AAC/E,EAAA,MAAM,MAAA,GAAS,KAAA,IAAS,OAAA,CAAQ,GAAA,CAAI,aAAA;AACpC,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,MAAM,wEAAmE,CAAA;AAAA,EACrF;AACA,EAAA,OAAO,IAAIA,mBAAA,CAAUC,+BAAA,CAAsB,MAAM,CAAC,CAAA;AACpD;AAGA,IAAO,WAAA,GAAQ","file":"index.js","sourcesContent":["// @tillstack/cache-node — TillCache client for Node.js.\n//\n// Node 18+ ships a global fetch, so this is a thin factory over the core:\n// it adds connection-string + env-var convenience and re-exports everything.\n//\n// import { createClient } from '@tillstack/cache-node'\n// const cache = createClient() // reads TILLCACHE_URL from env\n// await cache.set('session:42', token, { ex: 3600 })\n// const q = cache.queue('emails')\n// await q.push({ to: 'a@b.com' })\n\nimport { TillCache, parseConnectionString, type TillCacheClientOptions } from '@tillstack/cache-core'\n\nexport * from '@tillstack/cache-core'\n\n/**\n * Create a TillCache client from options, a connection string, or the\n * environment (`TILLCACHE_URL`, a full `tillcache://token@host` string).\n */\nexport function createClient(input?: string | TillCacheClientOptions): TillCache {\n const source = input ?? process.env.TILLCACHE_URL\n if (!source) {\n throw new Error('TillCache: no connection provided — pass one or set TILLCACHE_URL')\n }\n return new TillCache(parseConnectionString(source))\n}\n\n/** Alias matching the `ioredis` default-export ergonomics. */\nexport default createClient\n"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,16 @@
1
+ import { TillCache, parseConnectionString } from '@tillstack/cache-core';
2
+ export * from '@tillstack/cache-core';
3
+
4
+ // src/index.ts
5
+ function createClient(input) {
6
+ const source = input ?? process.env.TILLCACHE_URL;
7
+ if (!source) {
8
+ throw new Error("TillCache: no connection provided \u2014 pass one or set TILLCACHE_URL");
9
+ }
10
+ return new TillCache(parseConnectionString(source));
11
+ }
12
+ var src_default = createClient;
13
+
14
+ export { createClient, src_default as default };
15
+ //# sourceMappingURL=index.mjs.map
16
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;AAmBO,SAAS,aAAa,KAAA,EAAoD;AAC/E,EAAA,MAAM,MAAA,GAAS,KAAA,IAAS,OAAA,CAAQ,GAAA,CAAI,aAAA;AACpC,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,MAAM,wEAAmE,CAAA;AAAA,EACrF;AACA,EAAA,OAAO,IAAI,SAAA,CAAU,qBAAA,CAAsB,MAAM,CAAC,CAAA;AACpD;AAGA,IAAO,WAAA,GAAQ","file":"index.mjs","sourcesContent":["// @tillstack/cache-node — TillCache client for Node.js.\n//\n// Node 18+ ships a global fetch, so this is a thin factory over the core:\n// it adds connection-string + env-var convenience and re-exports everything.\n//\n// import { createClient } from '@tillstack/cache-node'\n// const cache = createClient() // reads TILLCACHE_URL from env\n// await cache.set('session:42', token, { ex: 3600 })\n// const q = cache.queue('emails')\n// await q.push({ to: 'a@b.com' })\n\nimport { TillCache, parseConnectionString, type TillCacheClientOptions } from '@tillstack/cache-core'\n\nexport * from '@tillstack/cache-core'\n\n/**\n * Create a TillCache client from options, a connection string, or the\n * environment (`TILLCACHE_URL`, a full `tillcache://token@host` string).\n */\nexport function createClient(input?: string | TillCacheClientOptions): TillCache {\n const source = input ?? process.env.TILLCACHE_URL\n if (!source) {\n throw new Error('TillCache: no connection provided — pass one or set TILLCACHE_URL')\n }\n return new TillCache(parseConnectionString(source))\n}\n\n/** Alias matching the `ioredis` default-export ergonomics. */\nexport default createClient\n"]}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@tillstack/cache-node",
3
+ "version": "0.1.0",
4
+ "description": "TillCache client for Node.js — managed KV, durable queues and pub/sub over one HTTPS endpoint, with a drop-in ioredis-compatible surface.",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": {
12
+ "types": "./dist/index.d.mts",
13
+ "default": "./dist/index.mjs"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
20
+ "./package.json": "./package.json"
21
+ },
22
+ "sideEffects": false,
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "dependencies": {
27
+ "@tillstack/cache-core": "^0.1.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^22.0.0",
31
+ "tsup": "^8.5.1",
32
+ "typescript": "^5.7.3"
33
+ },
34
+ "license": "UNLICENSED",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/tillafrica/tilldev.git",
38
+ "directory": "packages/cache-node"
39
+ },
40
+ "homepage": "https://tilldev.dev",
41
+ "bugs": {
42
+ "url": "https://github.com/tillafrica/tilldev/issues"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "keywords": [
48
+ "tilldev",
49
+ "tillcache",
50
+ "cache",
51
+ "kv",
52
+ "redis",
53
+ "ioredis",
54
+ "queue",
55
+ "pubsub",
56
+ "node"
57
+ ],
58
+ "scripts": {
59
+ "build": "tsup",
60
+ "dev": "tsup --watch",
61
+ "typecheck": "tsc --noEmit",
62
+ "clean": "rm -rf dist"
63
+ }
64
+ }