@zeltjs/redis 0.7.0 → 0.8.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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as RedisConfig } from "./redis.config-r7UIae2S.js";
1
+ import { t as RedisConfig } from "./redis.config-Dy-ocJI9.js";
2
2
  import { Lifecycle, LifecycleManager } from "@zeltjs/core";
3
3
  import Redis from "ioredis";
4
4
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as RedisConfig } from "./redis.config-DvXFWRzU.js";
1
+ import { t as RedisConfig } from "./redis.config-5BJDzkfm.js";
2
2
  import { Injectable, LifecycleManager, inject } from "@zeltjs/core";
3
3
  import Redis from "ioredis";
4
4
  //#region src/redis.service.ts
@@ -1,4 +1,4 @@
1
- import { Config, EnvService, inject } from "@zeltjs/core";
1
+ import { Config, Env, inject } from "@zeltjs/core";
2
2
  //#region src/redis.config.ts
3
3
  function _ts_decorate(decorators, target, key, desc) {
4
4
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -16,7 +16,7 @@ var RedisConfig = class {
16
16
  get options() {
17
17
  return {};
18
18
  }
19
- constructor(env = inject(EnvService)) {
19
+ constructor(env = inject(Env)) {
20
20
  this.env = env;
21
21
  }
22
22
  };
@@ -28,4 +28,4 @@ RedisConfig = _ts_decorate([
28
28
  //#endregion
29
29
  export { RedisConfig as t };
30
30
 
31
- //# sourceMappingURL=redis.config-DvXFWRzU.js.map
31
+ //# sourceMappingURL=redis.config-5BJDzkfm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis.config-5BJDzkfm.js","names":["Config","Env","inject","RedisConfig","url","env","getString","options"],"sources":["../src/redis.config.ts"],"sourcesContent":["import { Config, Env, inject } from '@zeltjs/core';\nimport type { RedisOptions } from 'ioredis';\n\n@Config\nexport class RedisConfig {\n constructor(protected readonly env = inject(Env)) {}\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,MAAyBL,OAAOD,IAAI,EAAE;OAAnBI,MAAAA"}
@@ -1,13 +1,13 @@
1
- import { EnvService } from "@zeltjs/core";
1
+ import { Env } from "@zeltjs/core";
2
2
  import { RedisOptions } from "ioredis";
3
3
 
4
4
  //#region src/redis.config.d.ts
5
5
  declare class RedisConfig {
6
- private env;
7
- constructor(env?: EnvService);
6
+ protected readonly env: Env;
7
+ constructor(env?: Env);
8
8
  get url(): string;
9
9
  get options(): RedisOptions;
10
10
  }
11
11
  //#endregion
12
12
  export { RedisConfig as t };
13
- //# sourceMappingURL=redis.config-r7UIae2S.d.ts.map
13
+ //# sourceMappingURL=redis.config-Dy-ocJI9.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis.config-Dy-ocJI9.d.ts","names":[],"sources":["../src/redis.config.ts"],"mappings":";;;;cAIa,WAAA;EAAA,mBACoB,GAAA,EAAG,GAAA;cAAH,GAAA,GAAG,GAAA;EAAA,IAE9B,GAAA,CAAA;EAAA,IAIA,OAAA,CAAA,GAAW,YAAA;AAAA"}
@@ -1,10 +1,9 @@
1
- import { t as RedisConfig } from "../redis.config-r7UIae2S.js";
1
+ import { t as RedisConfig } from "../redis.config-Dy-ocJI9.js";
2
2
  import { Lifecycle, LifecycleManager } from "@zeltjs/core";
3
3
 
4
4
  //#region src/testing/redis-test-container.config.d.ts
5
5
  declare class RedisTestContainerConfig extends RedisConfig implements Lifecycle {
6
- private container;
7
- private connectionUrl;
6
+ private readonly state;
8
7
  constructor(lifecycle?: LifecycleManager);
9
8
  protected get image(): string;
10
9
  startup(): Promise<void>;
@@ -1 +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"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/testing/redis-test-container.config.ts"],"mappings":";;;;cAca,wBAAA,SAAiC,WAAA,YAAuB,SAAA;EAAA,iBAClD,KAAA;cAEL,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"}
@@ -1,4 +1,4 @@
1
- import { t as RedisConfig } from "../redis.config-DvXFWRzU.js";
1
+ import { t as RedisConfig } from "../redis.config-5BJDzkfm.js";
2
2
  import { Config, LifecycleManager, inject } from "@zeltjs/core";
3
3
  import { GenericContainer } from "testcontainers";
4
4
  //#region src/testing/redis-test-container.config.ts
@@ -16,22 +16,25 @@ var RedisTestContainerConfig = class extends RedisConfig {
16
16
  return "redis:7-alpine";
17
17
  }
18
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}`;
19
+ this.state.container = await new GenericContainer(this.image).withExposedPorts(6379).start();
20
+ const host = this.state.container.getHost();
21
+ const port = this.state.container.getMappedPort(6379);
22
+ this.state.connectionUrl = `redis://${host}:${port}`;
23
23
  }
24
24
  async shutdown() {
25
- await this.container?.stop();
25
+ await this.state.container?.stop();
26
26
  }
27
27
  get url() {
28
- return this.connectionUrl;
28
+ return this.state.connectionUrl;
29
29
  }
30
30
  get options() {
31
31
  return {};
32
32
  }
33
33
  constructor(lifecycle = inject(LifecycleManager)) {
34
- super(), this.connectionUrl = "";
34
+ super(), this.state = {
35
+ container: void 0,
36
+ connectionUrl: ""
37
+ };
35
38
  lifecycle.register(this);
36
39
  }
37
40
  };
@@ -1 +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"}
1
+ {"version":3,"file":"index.js","names":["Config","inject","LifecycleManager","GenericContainer","RedisConfig","RedisTestContainerConfig","image","startup","state","container","withExposedPorts","start","host","getHost","port","getMappedPort","connectionUrl","shutdown","stop","url","options","lifecycle","undefined","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// 敗北\ninterface RedisTestContainerState {\n container: StartedTestContainer | undefined;\n connectionUrl: string;\n}\n\n@Config\nexport class RedisTestContainerConfig extends RedisConfig implements Lifecycle {\n private readonly state: RedisTestContainerState = { container: undefined, 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.state.container = await new GenericContainer(this.image).withExposedPorts(6379).start();\n const host = this.state.container.getHost();\n const port = this.state.container.getMappedPort(6379);\n this.state.connectionUrl = `redis://${host}:${port}`;\n }\n\n async shutdown(): Promise<void> {\n await this.state.container?.stop();\n }\n\n override get url(): string {\n return this.state.connectionUrl;\n }\n\n override get options(): RedisConfig['options'] {\n return {};\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,IAAaK,2BAAb,cAA8CD,YAAAA;CAQ5C,IAAcE,QAAgB;AAC5B,SAAO;;CAGT,MAAMC,UAAyB;AAC7B,OAAKC,MAAMC,YAAY,MAAM,IAAIN,iBAAiB,KAAKG,MAAK,CAAEI,iBAAiB,KAAA,CAAMC,OAAK;EAC1F,MAAMC,OAAO,KAAKJ,MAAMC,UAAUI,SAAO;EACzC,MAAMC,OAAO,KAAKN,MAAMC,UAAUM,cAAc,KAAA;AAChD,OAAKP,MAAMQ,gBAAgB,WAAWJ,KAAK,GAAGE;;CAGhD,MAAMG,WAA0B;AAC9B,QAAM,KAAKT,MAAMC,WAAWS,MAAAA;;CAG9B,IAAaC,MAAc;AACzB,SAAO,KAAKX,MAAMQ;;CAGpB,IAAaI,UAAkC;AAC7C,SAAO,EAAC;;CAzBV,YAAYC,YAAYpB,OAAOC,iBAAiB,EAAE;AAChD,SAAK,EAAA,KAHUM,QAAiC;GAAEC,WAAWa,KAAAA;GAAWN,eAAe;GAAG;AAI1FK,YAAUE,SAAS,KAAI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeltjs/redis",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,8 +26,8 @@
26
26
  ],
27
27
  "peerDependencies": {
28
28
  "testcontainers": ">=10 <12",
29
- "@zeltjs/core": "0.7.0",
30
- "@zeltjs/testing": "0.7.0"
29
+ "@zeltjs/core": "0.8.1",
30
+ "@zeltjs/testing": "0.8.1"
31
31
  },
32
32
  "peerDependenciesMeta": {
33
33
  "@zeltjs/testing": {
@@ -43,8 +43,8 @@
43
43
  "devDependencies": {
44
44
  "@types/node": "22.19.17",
45
45
  "testcontainers": "10.25.0",
46
- "@zeltjs/core": "0.7.0",
47
- "@zeltjs/testing": "0.7.0"
46
+ "@zeltjs/core": "0.8.1",
47
+ "@zeltjs/testing": "0.8.1"
48
48
  },
49
49
  "volta": {
50
50
  "extends": "../../package.json"
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}