@zeltjs/redis 0.0.1 → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 9wick / Kohei Kido
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,45 +1,36 @@
1
1
  # @zeltjs/redis
2
2
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
3
+ [![Documentation](https://img.shields.io/badge/docs-zeltjs.com-blue)](https://zeltjs.com)
4
4
 
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
5
+ Redis integration for Zelt applications.
6
6
 
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
7
+ **[Read the Documentation](https://zeltjs.com)**
8
8
 
9
- ## Purpose
9
+ ## Installation
10
10
 
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@zeltjs/redis`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
11
+ ```bash
12
+ npm install @zeltjs/redis @zeltjs/core
13
+ ```
15
14
 
16
- ## What is OIDC Trusted Publishing?
15
+ ## Usage
17
16
 
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
17
+ ```typescript
18
+ import { createApp, Controller, Get, inject } from '@zeltjs/core';
19
+ import { RedisConfig, RedisService } from '@zeltjs/redis';
19
20
 
20
- ## Setup Instructions
21
+ @Controller('/cache')
22
+ class CacheController {
23
+ constructor(private redis = inject(RedisService)) {}
21
24
 
22
- To properly configure OIDC trusted publishing for this package:
25
+ @Get('/:key')
26
+ async get(key: string) {
27
+ const value = await this.redis.get(key);
28
+ return { value };
29
+ }
30
+ }
23
31
 
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**
32
+ const app = createApp({
33
+ http: { controllers: [CacheController] },
34
+ configs: [RedisConfig],
35
+ });
36
+ ```
@@ -0,0 +1,15 @@
1
+ import { t as RedisConfig } from "./redis.config-r7UIae2S.js";
2
+ import { Lifecycle, LifecycleManager } from "@zeltjs/core";
3
+ import Redis from "ioredis";
4
+
5
+ //#region src/redis.service.d.ts
6
+ declare class RedisService implements Lifecycle {
7
+ private readonly _client;
8
+ constructor(config?: RedisConfig, lifecycle?: LifecycleManager);
9
+ get client(): Redis;
10
+ startup(): Promise<void>;
11
+ shutdown(): Promise<void>;
12
+ }
13
+ //#endregion
14
+ export { RedisConfig, RedisService };
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/redis.service.ts"],"mappings":";;;;;cAOa,YAAA,YAAwB,SAAA;EAAA,iBAClB,OAAA;cAEL,MAAA,GAAM,WAAA,EAAwB,SAAA,GAAS,gBAAA;EAAA,IAK/C,MAAA,CAAA,GAAU,KAAA;EAIR,OAAA,CAAA,GAAW,OAAA;EAEX,QAAA,CAAA,GAAY,OAAA;AAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ import { t as RedisConfig } from "./redis.config-DvXFWRzU.js";
2
+ import { Injectable, LifecycleManager, inject } from "@zeltjs/core";
3
+ import Redis from "ioredis";
4
+ //#region src/redis.service.ts
5
+ function _ts_decorate(decorators, target, key, desc) {
6
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ }
11
+ function _ts_metadata(k, v) {
12
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
13
+ }
14
+ var RedisService = class {
15
+ get client() {
16
+ return this._client;
17
+ }
18
+ async startup() {}
19
+ async shutdown() {
20
+ this._client.disconnect();
21
+ }
22
+ constructor(config = inject(RedisConfig), lifecycle = inject(LifecycleManager)) {
23
+ this._client = new Redis(config.url, config.options);
24
+ lifecycle.register(this);
25
+ }
26
+ };
27
+ RedisService = _ts_decorate([
28
+ Injectable(),
29
+ _ts_metadata("design:type", Function),
30
+ _ts_metadata("design:paramtypes", [void 0, void 0])
31
+ ], RedisService);
32
+ //#endregion
33
+ export { RedisConfig, RedisService };
34
+
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Injectable","inject","LifecycleManager","Redis","RedisConfig","RedisService","client","_client","startup","shutdown","disconnect","config","lifecycle","url","options","register"],"sources":["../src/redis.service.ts"],"sourcesContent":["import type { Lifecycle } from '@zeltjs/core';\nimport { Injectable, inject, LifecycleManager } from '@zeltjs/core';\nimport Redis from 'ioredis';\n\nimport { RedisConfig } from './redis.config';\n\n@Injectable()\nexport class RedisService implements Lifecycle {\n private readonly _client: Redis;\n\n constructor(config = inject(RedisConfig), lifecycle = inject(LifecycleManager)) {\n this._client = new Redis(config.url, config.options);\n lifecycle.register(this);\n }\n\n get client(): Redis {\n return this._client;\n }\n\n async startup(): Promise<void> {}\n\n async shutdown(): Promise<void> {\n this._client.disconnect();\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,IAAaK,eAAb,MAAaA;CAQX,IAAIC,SAAgB;AAClB,SAAO,KAAKC;;CAGd,MAAMC,UAAyB;CAE/B,MAAMC,WAA0B;AAC9B,OAAKF,QAAQG,YAAU;;CAZzB,YAAYC,SAASV,OAAOG,YAAY,EAAEQ,YAAYX,OAAOC,iBAAiB,EAAE;AAC9E,OAAKK,UAAU,IAAIJ,MAAMQ,OAAOE,KAAKF,OAAOG,QAAO;AACnDF,YAAUG,SAAS,KAAI"}
@@ -0,0 +1,31 @@
1
+ import { Config, EnvService, inject } from "@zeltjs/core";
2
+ //#region src/redis.config.ts
3
+ function _ts_decorate(decorators, target, key, desc) {
4
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
8
+ }
9
+ function _ts_metadata(k, v) {
10
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
11
+ }
12
+ var RedisConfig = class {
13
+ get url() {
14
+ return this.env.getString("REDIS_URL", "redis://localhost:6379");
15
+ }
16
+ get options() {
17
+ return {};
18
+ }
19
+ constructor(env = inject(EnvService)) {
20
+ this.env = env;
21
+ }
22
+ };
23
+ RedisConfig = _ts_decorate([
24
+ Config,
25
+ _ts_metadata("design:type", Function),
26
+ _ts_metadata("design:paramtypes", [void 0])
27
+ ], RedisConfig);
28
+ //#endregion
29
+ export { RedisConfig as t };
30
+
31
+ //# sourceMappingURL=redis.config-DvXFWRzU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis.config-DvXFWRzU.js","names":["Config","EnvService","inject","RedisConfig","url","env","getString","options"],"sources":["../src/redis.config.ts"],"sourcesContent":["import { Config, EnvService, inject } from '@zeltjs/core';\nimport type { RedisOptions } from 'ioredis';\n\n@Config\nexport class RedisConfig {\n constructor(private env = inject(EnvService)) {}\n\n get url(): string {\n return this.env.getString('REDIS_URL', 'redis://localhost:6379');\n }\n\n get options(): RedisOptions {\n return {};\n }\n}\n"],"mappings":";;;;;;;;;;;AAIA,IAAaG,cAAb,MAAaA;CAGX,IAAIC,MAAc;AAChB,SAAO,KAAKC,IAAIC,UAAU,aAAa,yBAAA;;CAGzC,IAAIC,UAAwB;AAC1B,SAAO,EAAC;;CAPV,YAAY,MAAcL,OAAOD,WAAW,EAAE;OAA1BI,MAAAA"}
@@ -0,0 +1,13 @@
1
+ import { EnvService } from "@zeltjs/core";
2
+ import { RedisOptions } from "ioredis";
3
+
4
+ //#region src/redis.config.d.ts
5
+ declare class RedisConfig {
6
+ private env;
7
+ constructor(env?: EnvService);
8
+ get url(): string;
9
+ get options(): RedisOptions;
10
+ }
11
+ //#endregion
12
+ export { RedisConfig as t };
13
+ //# sourceMappingURL=redis.config-r7UIae2S.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis.config-r7UIae2S.d.ts","names":[],"sources":["../src/redis.config.ts"],"mappings":";;;;cAIa,WAAA;EAAA,QACS,GAAA;cAAA,GAAA,GAAG,UAAA;EAAA,IAEnB,GAAA,CAAA;EAAA,IAIA,OAAA,CAAA,GAAW,YAAA;AAAA"}
@@ -0,0 +1,17 @@
1
+ import { t as RedisConfig } from "../redis.config-r7UIae2S.js";
2
+ import { Lifecycle, LifecycleManager } from "@zeltjs/core";
3
+
4
+ //#region src/testing/redis-test-container.config.d.ts
5
+ declare class RedisTestContainerConfig extends RedisConfig implements Lifecycle {
6
+ private container;
7
+ private connectionUrl;
8
+ constructor(lifecycle?: LifecycleManager);
9
+ protected get image(): string;
10
+ startup(): Promise<void>;
11
+ shutdown(): Promise<void>;
12
+ get url(): string;
13
+ get options(): RedisConfig['options'];
14
+ }
15
+ //#endregion
16
+ export { RedisTestContainerConfig };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/testing/redis-test-container.config.ts"],"mappings":";;;;cAQa,wBAAA,SAAiC,WAAA,YAAuB,SAAA;EAAA,QAC3D,SAAA;EAAA,QACA,aAAA;cAEI,SAAA,GAAS,gBAAA;EAAA,cAKP,KAAA,CAAA;EAIR,OAAA,CAAA,GAAW,OAAA;EAOX,QAAA,CAAA,GAAY,OAAA;EAAA,IAIL,GAAA,CAAA;EAAA,IAIA,OAAA,CAAA,GAAW,WAAA;AAAA"}
@@ -0,0 +1,46 @@
1
+ import { t as RedisConfig } from "../redis.config-DvXFWRzU.js";
2
+ import { Config, LifecycleManager, inject } from "@zeltjs/core";
3
+ import { GenericContainer } from "testcontainers";
4
+ //#region src/testing/redis-test-container.config.ts
5
+ function _ts_decorate(decorators, target, key, desc) {
6
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ }
11
+ function _ts_metadata(k, v) {
12
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
13
+ }
14
+ var RedisTestContainerConfig = class extends RedisConfig {
15
+ get image() {
16
+ return "redis:7-alpine";
17
+ }
18
+ async startup() {
19
+ this.container = await new GenericContainer(this.image).withExposedPorts(6379).start();
20
+ const host = this.container.getHost();
21
+ const port = this.container.getMappedPort(6379);
22
+ this.connectionUrl = `redis://${host}:${port}`;
23
+ }
24
+ async shutdown() {
25
+ await this.container?.stop();
26
+ }
27
+ get url() {
28
+ return this.connectionUrl;
29
+ }
30
+ get options() {
31
+ return {};
32
+ }
33
+ constructor(lifecycle = inject(LifecycleManager)) {
34
+ super(), this.connectionUrl = "";
35
+ lifecycle.register(this);
36
+ }
37
+ };
38
+ RedisTestContainerConfig = _ts_decorate([
39
+ Config,
40
+ _ts_metadata("design:type", Function),
41
+ _ts_metadata("design:paramtypes", [void 0])
42
+ ], RedisTestContainerConfig);
43
+ //#endregion
44
+ export { RedisTestContainerConfig };
45
+
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Config","inject","LifecycleManager","GenericContainer","RedisConfig","RedisTestContainerConfig","image","startup","container","withExposedPorts","start","host","getHost","port","getMappedPort","connectionUrl","shutdown","stop","url","options","lifecycle","register"],"sources":["../../src/testing/redis-test-container.config.ts"],"sourcesContent":["import type { Lifecycle } from '@zeltjs/core';\nimport { Config, inject, LifecycleManager } from '@zeltjs/core';\nimport type { StartedTestContainer } from 'testcontainers';\nimport { GenericContainer } from 'testcontainers';\n\nimport { RedisConfig } from '../redis.config';\n\n@Config\nexport class RedisTestContainerConfig extends RedisConfig implements Lifecycle {\n private container: StartedTestContainer | undefined;\n private connectionUrl = '';\n\n constructor(lifecycle = inject(LifecycleManager)) {\n super();\n lifecycle.register(this);\n }\n\n protected get image(): string {\n return 'redis:7-alpine';\n }\n\n async startup(): Promise<void> {\n this.container = await new GenericContainer(this.image).withExposedPorts(6379).start();\n const host = this.container.getHost();\n const port = this.container.getMappedPort(6379);\n this.connectionUrl = `redis://${host}:${port}`;\n }\n\n async shutdown(): Promise<void> {\n await this.container?.stop();\n }\n\n override get url(): string {\n return this.connectionUrl;\n }\n\n override get options(): RedisConfig['options'] {\n return {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,IAAaK,2BAAb,cAA8CD,YAAAA;CAS5C,IAAcE,QAAgB;AAC5B,SAAO;;CAGT,MAAMC,UAAyB;AAC7B,OAAKC,YAAY,MAAM,IAAIL,iBAAiB,KAAKG,MAAK,CAAEG,iBAAiB,KAAA,CAAMC,OAAK;EACpF,MAAMC,OAAO,KAAKH,UAAUI,SAAO;EACnC,MAAMC,OAAO,KAAKL,UAAUM,cAAc,KAAA;AAC1C,OAAKC,gBAAgB,WAAWJ,KAAK,GAAGE;;CAG1C,MAAMG,WAA0B;AAC9B,QAAM,KAAKR,WAAWS,MAAAA;;CAGxB,IAAaC,MAAc;AACzB,SAAO,KAAKH;;CAGd,IAAaI,UAAkC;AAC7C,SAAO,EAAC;;CAzBV,YAAYC,YAAYnB,OAAOC,iBAAiB,EAAE;AAChD,SAAK,EAAA,KAHCa,gBAAgB;AAItBK,YAAUC,SAAS,KAAI"}
package/package.json CHANGED
@@ -1,10 +1,57 @@
1
1
  {
2
2
  "name": "@zeltjs/redis",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @zeltjs/redis",
5
- "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
10
- }
3
+ "version": "0.5.0",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/zeltjs/zelt.git",
9
+ "directory": "packages/redis"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ },
19
+ "./testing": {
20
+ "types": "./dist/testing/index.d.ts",
21
+ "import": "./dist/testing/index.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "peerDependencies": {
28
+ "testcontainers": ">=10 <12",
29
+ "@zeltjs/core": "0.5.0",
30
+ "@zeltjs/testing": "0.5.0"
31
+ },
32
+ "peerDependenciesMeta": {
33
+ "@zeltjs/testing": {
34
+ "optional": true
35
+ },
36
+ "testcontainers": {
37
+ "optional": true
38
+ }
39
+ },
40
+ "dependencies": {
41
+ "ioredis": "5.10.1"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "22.19.17",
45
+ "testcontainers": "10.25.0",
46
+ "@zeltjs/testing": "0.5.0",
47
+ "@zeltjs/core": "0.5.0"
48
+ },
49
+ "volta": {
50
+ "extends": "../../package.json"
51
+ },
52
+ "scripts": {
53
+ "build": "tsdown",
54
+ "test": "vitest run",
55
+ "typecheck": "tsc -b"
56
+ }
57
+ }