@daiso-tech/core 0.31.0 → 0.31.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/async/utilities/lazy-promise/lazy-promise.d.ts +14 -10
- package/dist/async/utilities/lazy-promise/lazy-promise.js +14 -10
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/cache/contracts/cache.contract.d.ts +2 -2
- package/dist/cache/implementations/derivables/cache/cache.d.ts +7 -151
- package/dist/cache/implementations/derivables/cache/cache.js +7 -151
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +8 -10
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +8 -10
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.d.ts +5 -5
- package/dist/cache/implementations/test-utilities/cache-adapter.test-suite.js +5 -5
- package/dist/collection/implementations/_shared.d.ts +2 -0
- package/dist/collection/implementations/_shared.js +2 -0
- package/dist/collection/implementations/_shared.js.map +1 -1
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.d.ts +5 -5
- package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js +5 -5
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +5 -5
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +5 -5
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +6 -6
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +6 -6
- package/dist/lock/contracts/lock.contract.d.ts +4 -4
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.d.ts +1 -2
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js +1 -2
- package/dist/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +33 -16
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +33 -16
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +0 -204
- package/dist/lock/implementations/derivables/lock-provider/lock.js +0 -204
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +8 -12
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +8 -12
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.d.ts +1 -2
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js +1 -2
- package/dist/lock/implementations/test-utilities/database-lock-adapter.test-suite.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.d.ts +0 -1
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js +0 -1
- package/dist/lock/implementations/test-utilities/lock-adapter.test-suite.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.d.ts +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +1 -1
- package/dist/serde/contracts/flexible-serde.contract.d.ts +1 -1
- package/dist/serde/implementations/derivables/serde.d.ts +7 -7
- package/dist/serde/implementations/derivables/serde.js +7 -7
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.d.ts +0 -1
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js +0 -1
- package/dist/serde/implementations/test-utilities/flexible-serde.test-suite.js.map +1 -1
- package/package.json +2 -2
|
@@ -32,16 +32,16 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
32
32
|
* @example
|
|
33
33
|
* ```ts
|
|
34
34
|
* import { CacheFactory } from "@daiso-tech/core/cache";
|
|
35
|
-
* import type {
|
|
35
|
+
* import type { IDatabaseCacheAdapter } from "@daiso-tech/core/cache/contracts";
|
|
36
36
|
* import { MemoryCacheAdapter, RedisCacheAdapter, SqliteCacheAdapter } from "@daiso-tech/core/cache/adapters";
|
|
37
37
|
* import { Serde } from "@daiso-tech/core/serde";
|
|
38
38
|
* import type { ISerde } from "@daiso-tech/core/serde/contracts";
|
|
39
39
|
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
|
|
40
|
-
* import { KeyPrefixer,
|
|
40
|
+
* import { KeyPrefixer, type ISqliteDatabase, type AsyncFactoryFn } from "@daiso-tech/core/utilities";
|
|
41
41
|
* import Redis from "ioredis"
|
|
42
42
|
* import Sqlite from "better-sqlite3";
|
|
43
43
|
*
|
|
44
|
-
* function cahceAdapterFactory(database: ISqliteDatabase, serde: ISerde<string>):
|
|
44
|
+
* function cahceAdapterFactory(database: ISqliteDatabase, serde: ISerde<string>): AsyncFactoryFn<string, IDatabaseCacheAdapter> {
|
|
45
45
|
* return async (prefix) => {
|
|
46
46
|
* const cacheAdapter = new SqliteCacheAdapter({
|
|
47
47
|
* database,
|
|
@@ -56,13 +56,12 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
56
56
|
* const database = new Sqlite("local.db");
|
|
57
57
|
* const serde = new Serde(new SuperJsonSerdeAdapter());
|
|
58
58
|
* const cacheFactory = new CacheFactory({
|
|
59
|
-
* serde,
|
|
60
59
|
* keyPrefixer: new KeyPrefixer("cache"),
|
|
61
60
|
* adapters: {
|
|
62
61
|
* sqlite: cahceAdapterFactory(database, serde),
|
|
63
62
|
* memory: new MemoryCacheAdapter(),
|
|
64
63
|
* redis: new RedisCacheAdapter({
|
|
65
|
-
*
|
|
64
|
+
* database: new Redis("YOUR_REDIS_CONNECTION"),
|
|
66
65
|
* serde,
|
|
67
66
|
* }),
|
|
68
67
|
* },
|
|
@@ -82,16 +81,16 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
82
81
|
* @example
|
|
83
82
|
* ```ts
|
|
84
83
|
* import { CacheFactory } from "@daiso-tech/core/cache";
|
|
85
|
-
* import type {
|
|
84
|
+
* import type { IDatabaseCacheAdapter } from "@daiso-tech/core/cache/contracts";
|
|
86
85
|
* import { MemoryCacheAdapter, RedisCacheAdapter, SqliteCacheAdapter } from "@daiso-tech/core/cache/adapters";
|
|
87
86
|
* import { Serde } from "@daiso-tech/core/serde";
|
|
88
87
|
* import type { ISerde } from "@daiso-tech/core/serde/contracts";
|
|
89
88
|
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
|
|
90
|
-
* import { KeyPrefixer, TimeSpan, type ISqliteDatabase, type
|
|
89
|
+
* import { KeyPrefixer, TimeSpan, type ISqliteDatabase, type AsyncFactoryFn } from "@daiso-tech/core/utilities";
|
|
91
90
|
* import Redis from "ioredis"
|
|
92
91
|
* import Sqlite from "better-sqlite3";
|
|
93
92
|
*
|
|
94
|
-
* function cahceAdapterFactory(database: ISqliteDatabase, serde: ISerde<string>):
|
|
93
|
+
* function cahceAdapterFactory(database: ISqliteDatabase, serde: ISerde<string>): AsyncFactoryFn<string, IDatabaseCacheAdapter> {
|
|
95
94
|
* return async (prefix) => {
|
|
96
95
|
* const cacheAdapter = new SqliteCacheAdapter({
|
|
97
96
|
* database,
|
|
@@ -106,13 +105,12 @@ export declare class CacheFactory<TAdapters extends string = string> implements
|
|
|
106
105
|
* const database = new Sqlite("local.db");
|
|
107
106
|
* const serde = new Serde(new SuperJsonSerdeAdapter());
|
|
108
107
|
* const cacheFactory = new CacheFactory({
|
|
109
|
-
* serde,
|
|
110
108
|
* keyPrefixer: new KeyPrefixer("cache"),
|
|
111
109
|
* adapters: {
|
|
112
110
|
* sqlite: cahceAdapterFactory(database, serde),
|
|
113
111
|
* memory: new MemoryCacheAdapter(),
|
|
114
112
|
* redis: new RedisCacheAdapter({
|
|
115
|
-
*
|
|
113
|
+
* database: new Redis("YOUR_REDIS_CONNECTION"),
|
|
116
114
|
* serde,
|
|
117
115
|
* }),
|
|
118
116
|
* },
|
|
@@ -15,16 +15,16 @@ export class CacheFactory {
|
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
17
|
* import { CacheFactory } from "@daiso-tech/core/cache";
|
|
18
|
-
* import type {
|
|
18
|
+
* import type { IDatabaseCacheAdapter } from "@daiso-tech/core/cache/contracts";
|
|
19
19
|
* import { MemoryCacheAdapter, RedisCacheAdapter, SqliteCacheAdapter } from "@daiso-tech/core/cache/adapters";
|
|
20
20
|
* import { Serde } from "@daiso-tech/core/serde";
|
|
21
21
|
* import type { ISerde } from "@daiso-tech/core/serde/contracts";
|
|
22
22
|
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
|
|
23
|
-
* import { KeyPrefixer,
|
|
23
|
+
* import { KeyPrefixer, type ISqliteDatabase, type AsyncFactoryFn } from "@daiso-tech/core/utilities";
|
|
24
24
|
* import Redis from "ioredis"
|
|
25
25
|
* import Sqlite from "better-sqlite3";
|
|
26
26
|
*
|
|
27
|
-
* function cahceAdapterFactory(database: ISqliteDatabase, serde: ISerde<string>):
|
|
27
|
+
* function cahceAdapterFactory(database: ISqliteDatabase, serde: ISerde<string>): AsyncFactoryFn<string, IDatabaseCacheAdapter> {
|
|
28
28
|
* return async (prefix) => {
|
|
29
29
|
* const cacheAdapter = new SqliteCacheAdapter({
|
|
30
30
|
* database,
|
|
@@ -39,13 +39,12 @@ export class CacheFactory {
|
|
|
39
39
|
* const database = new Sqlite("local.db");
|
|
40
40
|
* const serde = new Serde(new SuperJsonSerdeAdapter());
|
|
41
41
|
* const cacheFactory = new CacheFactory({
|
|
42
|
-
* serde,
|
|
43
42
|
* keyPrefixer: new KeyPrefixer("cache"),
|
|
44
43
|
* adapters: {
|
|
45
44
|
* sqlite: cahceAdapterFactory(database, serde),
|
|
46
45
|
* memory: new MemoryCacheAdapter(),
|
|
47
46
|
* redis: new RedisCacheAdapter({
|
|
48
|
-
*
|
|
47
|
+
* database: new Redis("YOUR_REDIS_CONNECTION"),
|
|
49
48
|
* serde,
|
|
50
49
|
* }),
|
|
51
50
|
* },
|
|
@@ -107,16 +106,16 @@ export class CacheFactory {
|
|
|
107
106
|
* @example
|
|
108
107
|
* ```ts
|
|
109
108
|
* import { CacheFactory } from "@daiso-tech/core/cache";
|
|
110
|
-
* import type {
|
|
109
|
+
* import type { IDatabaseCacheAdapter } from "@daiso-tech/core/cache/contracts";
|
|
111
110
|
* import { MemoryCacheAdapter, RedisCacheAdapter, SqliteCacheAdapter } from "@daiso-tech/core/cache/adapters";
|
|
112
111
|
* import { Serde } from "@daiso-tech/core/serde";
|
|
113
112
|
* import type { ISerde } from "@daiso-tech/core/serde/contracts";
|
|
114
113
|
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
|
|
115
|
-
* import { KeyPrefixer, TimeSpan, type ISqliteDatabase, type
|
|
114
|
+
* import { KeyPrefixer, TimeSpan, type ISqliteDatabase, type AsyncFactoryFn } from "@daiso-tech/core/utilities";
|
|
116
115
|
* import Redis from "ioredis"
|
|
117
116
|
* import Sqlite from "better-sqlite3";
|
|
118
117
|
*
|
|
119
|
-
* function cahceAdapterFactory(database: ISqliteDatabase, serde: ISerde<string>):
|
|
118
|
+
* function cahceAdapterFactory(database: ISqliteDatabase, serde: ISerde<string>): AsyncFactoryFn<string, IDatabaseCacheAdapter> {
|
|
120
119
|
* return async (prefix) => {
|
|
121
120
|
* const cacheAdapter = new SqliteCacheAdapter({
|
|
122
121
|
* database,
|
|
@@ -131,13 +130,12 @@ export class CacheFactory {
|
|
|
131
130
|
* const database = new Sqlite("local.db");
|
|
132
131
|
* const serde = new Serde(new SuperJsonSerdeAdapter());
|
|
133
132
|
* const cacheFactory = new CacheFactory({
|
|
134
|
-
* serde,
|
|
135
133
|
* keyPrefixer: new KeyPrefixer("cache"),
|
|
136
134
|
* adapters: {
|
|
137
135
|
* sqlite: cahceAdapterFactory(database, serde),
|
|
138
136
|
* memory: new MemoryCacheAdapter(),
|
|
139
137
|
* redis: new RedisCacheAdapter({
|
|
140
|
-
*
|
|
138
|
+
* database: new Redis("YOUR_REDIS_CONNECTION"),
|
|
141
139
|
* serde,
|
|
142
140
|
* }),
|
|
143
141
|
* },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-factory.js","sourceRoot":"","sources":["../../../../../src/cache/implementations/derivables/cache-factory/cache-factory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,6BAA6B,EAC7B,gBAAgB,EAChB,wBAAwB,GAC3B,MAAM,gCAAgC,CAAC;AAMxC,OAAO,EACH,KAAK,GAGR,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAiB,MAAM,gCAAgC,CAAC;AAwB5E;;;;GAIG;AACH,MAAM,OAAO,YAAY;
|
|
1
|
+
{"version":3,"file":"cache-factory.js","sourceRoot":"","sources":["../../../../../src/cache/implementations/derivables/cache-factory/cache-factory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,6BAA6B,EAC7B,gBAAgB,EAChB,wBAAwB,GAC3B,MAAM,gCAAgC,CAAC;AAMxC,OAAO,EACH,KAAK,GAGR,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAiB,MAAM,gCAAgC,CAAC;AAwB5E;;;;GAIG;AACH,MAAM,OAAO,YAAY;IA2CQ;IAxC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,YAA6B,QAAyC;QAAzC,aAAQ,GAAR,QAAQ,CAAiC;IAAG,CAAC;IAE1E,cAAc,CAAC,WAAwB;QACnC,OAAO,IAAI,YAAY,CAAC;YACpB,GAAG,IAAI,CAAC,QAAQ;YAChB,WAAW;SACd,CAAC,CAAC;IACP,CAAC;IAED,aAAa,CAAC,GAAa;QACvB,OAAO,IAAI,YAAY,CAAC;YACpB,GAAG,IAAI,CAAC,QAAQ;Y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;QACpD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,wBAAwB,CAAC,WAAW,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC;QACtC,OAAO,IAAI,KAAK,CAAC;YACb,GAAG,IAAI,CAAC,QAAQ;YAChB,OAAO;YACP,WAAW,EAAE,IAAI,WAAW,CAAC;gBACzB,GAAG,gBAAgB,CAAC,WAAW,CAAC,kBAAkB,CAAC;gBACnD,WAAW;aACd,CAAC;SACL,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -29,11 +29,11 @@ export type CacheAdapterTestSuiteSettings = {
|
|
|
29
29
|
* RedisContainer,
|
|
30
30
|
* type StartedRedisContainer,
|
|
31
31
|
* } from "@testcontainers/redis";
|
|
32
|
-
* import { cacheAdapterTestSuite } from "@daiso-tech/cache/
|
|
33
|
-
* import { RedisCacheAdapter } from "@daiso-tech/cache/
|
|
34
|
-
* import { TimeSpan } from "@daiso-tech/
|
|
35
|
-
* import { SuperJsonSerdeAdapter } from "@daiso-tech/
|
|
36
|
-
* import { Serde } from "@daiso-tech/
|
|
32
|
+
* import { cacheAdapterTestSuite } from "@daiso-tech/core/cache/test-utilities";
|
|
33
|
+
* import { RedisCacheAdapter } from "@daiso-tech/core/cache/adapters";
|
|
34
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
35
|
+
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
|
|
36
|
+
* import { Serde } from "@daiso-tech/core/serde";
|
|
37
37
|
*
|
|
38
38
|
* const timeout = TimeSpan.fromMinutes(2);
|
|
39
39
|
* describe("class: RedisCacheAdapter", () => {
|
|
@@ -19,11 +19,11 @@ import { LazyPromise } from "../../../async/_module-exports.js";
|
|
|
19
19
|
* RedisContainer,
|
|
20
20
|
* type StartedRedisContainer,
|
|
21
21
|
* } from "@testcontainers/redis";
|
|
22
|
-
* import { cacheAdapterTestSuite } from "@daiso-tech/cache/
|
|
23
|
-
* import { RedisCacheAdapter } from "@daiso-tech/cache/
|
|
24
|
-
* import { TimeSpan } from "@daiso-tech/
|
|
25
|
-
* import { SuperJsonSerdeAdapter } from "@daiso-tech/
|
|
26
|
-
* import { Serde } from "@daiso-tech/
|
|
22
|
+
* import { cacheAdapterTestSuite } from "@daiso-tech/core/cache/test-utilities";
|
|
23
|
+
* import { RedisCacheAdapter } from "@daiso-tech/core/cache/adapters";
|
|
24
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
25
|
+
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters";
|
|
26
|
+
* import { Serde } from "@daiso-tech/core/serde";
|
|
27
27
|
*
|
|
28
28
|
* const timeout = TimeSpan.fromMinutes(2);
|
|
29
29
|
* describe("class: RedisCacheAdapter", () => {
|
|
@@ -7,6 +7,8 @@ import { type OneOrMore } from "../../utilities/_module-exports.js";
|
|
|
7
7
|
* The <i>range</i> function return a <i>{@link Iterable}</i> of numbers, starting from <i>from</i>,increments by 1 and stops at <i>to</i>.
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts
|
|
10
|
+
* import { ListCollection, range } from "@daiso-tech/core/collection";
|
|
11
|
+
*
|
|
10
12
|
* const collection = new ListCollection(range(1, 10))
|
|
11
13
|
* collection.toArray();
|
|
12
14
|
* // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
@@ -23,6 +23,8 @@ class RangeIterable {
|
|
|
23
23
|
* The <i>range</i> function return a <i>{@link Iterable}</i> of numbers, starting from <i>from</i>,increments by 1 and stops at <i>to</i>.
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
26
|
+
* import { ListCollection, range } from "@daiso-tech/core/collection";
|
|
27
|
+
*
|
|
26
28
|
* const collection = new ListCollection(range(1, 10))
|
|
27
29
|
* collection.toArray();
|
|
28
30
|
* // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../src/collection/implementations/_shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACH,IAAI,EACJ,gBAAgB,GAEnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACH,kBAAkB,EAClB,cAAc,GACjB,MAAM,iDAAiD,CAAC;AAEzD;;GAEG;AACH,MAAM,aAAa;IAEH;IACA;IAFZ,YACY,IAAY,EACZ,EAAU;QADV,SAAI,GAAJ,IAAI,CAAQ;QACZ,OAAE,GAAF,EAAE,CAAQ;IACnB,CAAC;IAEJ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QACd,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;CACJ;AACD
|
|
1
|
+
{"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../src/collection/implementations/_shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACH,IAAI,EACJ,gBAAgB,GAEnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACH,kBAAkB,EAClB,cAAc,GACjB,MAAM,iDAAiD,CAAC;AAEzD;;GAEG;AACH,MAAM,aAAa;IAEH;IACA;IAFZ,YACY,IAAY,EACZ,EAAU;QADV,SAAI,GAAJ,IAAI,CAAQ;QACZ,OAAE,GAAF,EAAE,CAAQ;IACnB,CAAC;IAEJ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QACd,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;CACJ;AACD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY,EAAE,EAAU;IAC1C,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU;AACtB,iHAAiH;AACjH,KAAU;IAEV,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,sEAAsE;QACtE,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,CAC/C,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe;AAC3B,iHAAiH;AACjH,KAAU;IAEV,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,sEAAsE;QACtE,OAAO,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,UAAU,CACpD,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACtC,KAAgC;IAEhC,KAAK,MAAM,MAAM,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3C,MAAM;aACD,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC;aACnC,aAAa,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;AACL,CAAC"}
|
|
@@ -14,18 +14,18 @@ export declare class MemoryEventBusAdapter implements IEventBusAdapter {
|
|
|
14
14
|
/**
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
|
-
* import {
|
|
17
|
+
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
18
18
|
*
|
|
19
|
-
* const eventBusAdapter = new
|
|
19
|
+
* const eventBusAdapter = new MemoryEventBusAdapter();
|
|
20
20
|
* ```
|
|
21
21
|
* You can also provide an <i>{@link EventEmitter}</i> that will be used for storing the data.
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
|
24
|
-
* import {
|
|
24
|
+
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
25
25
|
* import { EventEmitter } from "node:events";
|
|
26
26
|
*
|
|
27
|
-
* const eventEmitter = new EventEmitter<any
|
|
28
|
-
* const eventBusAdapter = new
|
|
27
|
+
* const eventEmitter = new EventEmitter<any>();
|
|
28
|
+
* const eventBusAdapter = new MemoryEventBusAdapter(eventEmitter);
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
constructor(eventEmitter?: EventEmitter);
|
package/dist/event-bus/implementations/adapters/memory-event-bus-adapter/memory-event-bus-adapter.js
CHANGED
|
@@ -13,18 +13,18 @@ export class MemoryEventBusAdapter {
|
|
|
13
13
|
/**
|
|
14
14
|
* @example
|
|
15
15
|
* ```ts
|
|
16
|
-
* import {
|
|
16
|
+
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
17
17
|
*
|
|
18
|
-
* const eventBusAdapter = new
|
|
18
|
+
* const eventBusAdapter = new MemoryEventBusAdapter();
|
|
19
19
|
* ```
|
|
20
20
|
* You can also provide an <i>{@link EventEmitter}</i> that will be used for storing the data.
|
|
21
21
|
* @example
|
|
22
22
|
* ```ts
|
|
23
|
-
* import {
|
|
23
|
+
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
24
24
|
* import { EventEmitter } from "node:events";
|
|
25
25
|
*
|
|
26
|
-
* const eventEmitter = new EventEmitter<any
|
|
27
|
-
* const eventBusAdapter = new
|
|
26
|
+
* const eventEmitter = new EventEmitter<any>();
|
|
27
|
+
* const eventBusAdapter = new MemoryEventBusAdapter(eventEmitter);
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
constructor(eventEmitter = new EventEmitter()) {
|
|
@@ -49,7 +49,7 @@ export declare class EventBus<TEvents extends BaseEvent = BaseEvent> implements
|
|
|
49
49
|
* ```ts
|
|
50
50
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
51
51
|
* import { EventBus } from "@daiso-tech/core/event-bus";
|
|
52
|
-
* import { KeyPrefixer } from "@daiso-tech/utilities";
|
|
52
|
+
* import { KeyPrefixer } from "@daiso-tech/core/utilities";
|
|
53
53
|
*
|
|
54
54
|
* const eventBus = new EventBus({
|
|
55
55
|
* keyPrefixer: new KeyPrefixer("event-bus"),
|
|
@@ -63,11 +63,11 @@ export declare class EventBus<TEvents extends BaseEvent = BaseEvent> implements
|
|
|
63
63
|
* import type { IEventBusAdapter } from "@daiso-tech/core/event-bus/contracts";
|
|
64
64
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
65
65
|
* import { EventBus } from "@daiso-tech/core/event-bus";
|
|
66
|
-
* import { KeyPrefixer, type FactoryFn } from "@daiso-tech/utilities";
|
|
66
|
+
* import { KeyPrefixer, type FactoryFn } from "@daiso-tech/core/utilities";
|
|
67
67
|
*
|
|
68
|
-
* type Store = Partial<Record<string, IEventBusAdapter
|
|
68
|
+
* type Store = Partial<Record<string, IEventBusAdapter>>;
|
|
69
69
|
*
|
|
70
|
-
*
|
|
70
|
+
* function cahceAdapterFactory(store: Store): FactoryFn<string, IEventBusAdapter> {
|
|
71
71
|
* return (prefix) => {
|
|
72
72
|
* let adapter = store[prefix];
|
|
73
73
|
* if (adapter === undefined) {
|
|
@@ -91,7 +91,7 @@ export declare class EventBus<TEvents extends BaseEvent = BaseEvent> implements
|
|
|
91
91
|
* import type { IEventBusAdapter } from "@daiso-tech/core/event-bus/contracts";
|
|
92
92
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
93
93
|
* import { EventBus } from "@daiso-tech/core/event-bus";
|
|
94
|
-
* import { KeyPrefixer, type IFactoryObject, type Promiseable } from "@daiso-tech/utilities";
|
|
94
|
+
* import { KeyPrefixer, type IFactoryObject, type Promiseable } from "@daiso-tech/core/utilities";
|
|
95
95
|
*
|
|
96
96
|
* type Store = Partial<Record<string, IEventBusAdapter>>;
|
|
97
97
|
*
|
|
@@ -26,7 +26,7 @@ export class EventBus {
|
|
|
26
26
|
* ```ts
|
|
27
27
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
28
28
|
* import { EventBus } from "@daiso-tech/core/event-bus";
|
|
29
|
-
* import { KeyPrefixer } from "@daiso-tech/utilities";
|
|
29
|
+
* import { KeyPrefixer } from "@daiso-tech/core/utilities";
|
|
30
30
|
*
|
|
31
31
|
* const eventBus = new EventBus({
|
|
32
32
|
* keyPrefixer: new KeyPrefixer("event-bus"),
|
|
@@ -40,11 +40,11 @@ export class EventBus {
|
|
|
40
40
|
* import type { IEventBusAdapter } from "@daiso-tech/core/event-bus/contracts";
|
|
41
41
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
42
42
|
* import { EventBus } from "@daiso-tech/core/event-bus";
|
|
43
|
-
* import { KeyPrefixer, type FactoryFn } from "@daiso-tech/utilities";
|
|
43
|
+
* import { KeyPrefixer, type FactoryFn } from "@daiso-tech/core/utilities";
|
|
44
44
|
*
|
|
45
|
-
* type Store = Partial<Record<string, IEventBusAdapter
|
|
45
|
+
* type Store = Partial<Record<string, IEventBusAdapter>>;
|
|
46
46
|
*
|
|
47
|
-
*
|
|
47
|
+
* function cahceAdapterFactory(store: Store): FactoryFn<string, IEventBusAdapter> {
|
|
48
48
|
* return (prefix) => {
|
|
49
49
|
* let adapter = store[prefix];
|
|
50
50
|
* if (adapter === undefined) {
|
|
@@ -68,7 +68,7 @@ export class EventBus {
|
|
|
68
68
|
* import type { IEventBusAdapter } from "@daiso-tech/core/event-bus/contracts";
|
|
69
69
|
* import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
70
70
|
* import { EventBus } from "@daiso-tech/core/event-bus";
|
|
71
|
-
* import { KeyPrefixer, type IFactoryObject, type Promiseable } from "@daiso-tech/utilities";
|
|
71
|
+
* import { KeyPrefixer, type IFactoryObject, type Promiseable } from "@daiso-tech/core/utilities";
|
|
72
72
|
*
|
|
73
73
|
* type Store = Partial<Record<string, IEventBusAdapter>>;
|
|
74
74
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/derivables/event-bus/event-bus.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAQzD,OAAO,EAKH,6BAA6B,EAC7B,mCAAmC,EACnC,gCAAgC,GACnC,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../../../src/event-bus/implementations/derivables/event-bus/event-bus.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAQzD,OAAO,EAKH,6BAA6B,EAC7B,mCAAmC,EACnC,gCAAgC,GACnC,MAAM,0CAA0C,CAAC;AAWlD,OAAO,EACH,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,oEAAoE,CAAC;AA8BnG;;;;;GAKG;AACH,MAAM,OAAO,QAAQ;IAGA,kBAAkB,CAA6B;IAC/C,aAAa,CAAgB;IAC7B,aAAa,CAAuB;IACpC,WAAW,CAAqB;IAChC,YAAY,CAAkB;IAC9B,YAAY,CAAkB;IAC9B,KAAK,GAAG,IAAI,aAAa,EAAE,CAAC;IAC5B,cAAc,CAAgC;IACvD,WAAW,CAAe;IAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsEG;IACH,YAAY,QAA0B;QAClC,MAAM,EACF,WAAW,EACX,OAAO,EACP,aAAa,GAAG,IAAI,EACpB,aAAa,GAAG,IAAI,EACpB,WAAW,GAAG,IAAI,EAClB,YAAY,GAAG,IAAI,EACnB,YAAY,GAAG,IAAI,GACtB,GAAG,QAAQ,CAAC;QACb,IAAI,CAAC,YAAY,GAAG,YAA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extends string = string> implemen
|
|
|
33
33
|
* import { type IEventBusAdapter, BaseEvent } from "@daiso-tech/core/event-bus/contracts";
|
|
34
34
|
* import { EventBusFactory } from "@daiso-tech/core/event-bus";
|
|
35
35
|
* import { MemoryEventBusAdapter, RedisPubSubEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
36
|
-
* import { KeyPrefixer, type
|
|
36
|
+
* import { KeyPrefixer, type FactoryFn } from "@daiso-tech/core/utilities";
|
|
37
37
|
* import { Serde } from "@daiso-tech/core/serde";
|
|
38
38
|
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters"
|
|
39
39
|
* import Redis from "ioredis";
|
|
40
40
|
*
|
|
41
|
-
* type Store = Partial<Record<string, IEventBusAdapter
|
|
41
|
+
* type Store = Partial<Record<string, IEventBusAdapter>>;
|
|
42
42
|
*
|
|
43
|
-
*
|
|
43
|
+
* function cahceAdapterFactory(store: Store): FactoryFn<string, IEventBusAdapter> {
|
|
44
44
|
* return (prefix) => {
|
|
45
45
|
* let adapter = store[prefix];
|
|
46
46
|
* if (adapter === undefined) {
|
|
@@ -81,14 +81,14 @@ export declare class EventBusFactory<TAdapters extends string = string> implemen
|
|
|
81
81
|
* import { type IEventBusAdapter, BaseEvent } from "@daiso-tech/core/event-bus/contracts";
|
|
82
82
|
* import { EventBusFactory } from "@daiso-tech/core/event-bus";
|
|
83
83
|
* import { MemoryEventBusAdapter, RedisPubSubEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
84
|
-
* import { KeyPrefixer, type
|
|
84
|
+
* import { KeyPrefixer, type FactoryFn } from "@daiso-tech/core/utilities";
|
|
85
85
|
* import { Serde } from "@daiso-tech/core/serde";
|
|
86
86
|
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters"
|
|
87
87
|
* import Redis from "ioredis";
|
|
88
88
|
*
|
|
89
|
-
* type Store = Partial<Record<string, IEventBusAdapter
|
|
89
|
+
* type Store = Partial<Record<string, IEventBusAdapter>>;
|
|
90
90
|
*
|
|
91
|
-
*
|
|
91
|
+
* function cahceAdapterFactory(store: Store): FactoryFn<string, IEventBusAdapter> {
|
|
92
92
|
* return (prefix) => {
|
|
93
93
|
* let adapter = store[prefix];
|
|
94
94
|
* if (adapter === undefined) {
|
|
@@ -17,14 +17,14 @@ export class EventBusFactory {
|
|
|
17
17
|
* import { type IEventBusAdapter, BaseEvent } from "@daiso-tech/core/event-bus/contracts";
|
|
18
18
|
* import { EventBusFactory } from "@daiso-tech/core/event-bus";
|
|
19
19
|
* import { MemoryEventBusAdapter, RedisPubSubEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
20
|
-
* import { KeyPrefixer, type
|
|
20
|
+
* import { KeyPrefixer, type FactoryFn } from "@daiso-tech/core/utilities";
|
|
21
21
|
* import { Serde } from "@daiso-tech/core/serde";
|
|
22
22
|
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters"
|
|
23
23
|
* import Redis from "ioredis";
|
|
24
24
|
*
|
|
25
|
-
* type Store = Partial<Record<string, IEventBusAdapter
|
|
25
|
+
* type Store = Partial<Record<string, IEventBusAdapter>>;
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* function cahceAdapterFactory(store: Store): FactoryFn<string, IEventBusAdapter> {
|
|
28
28
|
* return (prefix) => {
|
|
29
29
|
* let adapter = store[prefix];
|
|
30
30
|
* if (adapter === undefined) {
|
|
@@ -97,14 +97,14 @@ export class EventBusFactory {
|
|
|
97
97
|
* import { type IEventBusAdapter, BaseEvent } from "@daiso-tech/core/event-bus/contracts";
|
|
98
98
|
* import { EventBusFactory } from "@daiso-tech/core/event-bus";
|
|
99
99
|
* import { MemoryEventBusAdapter, RedisPubSubEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";
|
|
100
|
-
* import { KeyPrefixer, type
|
|
100
|
+
* import { KeyPrefixer, type FactoryFn } from "@daiso-tech/core/utilities";
|
|
101
101
|
* import { Serde } from "@daiso-tech/core/serde";
|
|
102
102
|
* import { SuperJsonSerdeAdapter } from "@daiso-tech/core/serde/adapters"
|
|
103
103
|
* import Redis from "ioredis";
|
|
104
104
|
*
|
|
105
|
-
* type Store = Partial<Record<string, IEventBusAdapter
|
|
105
|
+
* type Store = Partial<Record<string, IEventBusAdapter>>;
|
|
106
106
|
*
|
|
107
|
-
*
|
|
107
|
+
* function cahceAdapterFactory(store: Store): FactoryFn<string, IEventBusAdapter> {
|
|
108
108
|
* return (prefix) => {
|
|
109
109
|
* let adapter = store[prefix];
|
|
110
110
|
* if (adapter === undefined) {
|
|
@@ -29,26 +29,26 @@ export type AquireBlockingSettings = {
|
|
|
29
29
|
*/
|
|
30
30
|
export type ILock = ILockListenable & {
|
|
31
31
|
/**
|
|
32
|
-
* The <i>run</i> method wraps an
|
|
32
|
+
* The <i>run</i> method wraps an <i>{@link Invokable}</i> or <i>{@link LazyPromise}</i> with the <i>acquire</i> and <i>release</i> method.
|
|
33
33
|
* @throws {UnableToAquireLockError} {@link UnableToAquireLockError}
|
|
34
34
|
* @throws {UnableToReleaseLockError} {@link UnableToReleaseLockError}
|
|
35
35
|
*/
|
|
36
36
|
run<TValue = void>(asyncFn: AsyncLazy<TValue>): LazyPromise<Result<TValue, KeyAlreadyAcquiredLockError>>;
|
|
37
37
|
/**
|
|
38
|
-
* The <i>runOrFail</i> method wraps an
|
|
38
|
+
* The <i>runOrFail</i> method wraps an <i>{@link Invokable}</i> or <i>{@link LazyPromise}</i> with the <i>acquireOrFail</i> and <i>release</i> method.
|
|
39
39
|
* @throws {UnableToAquireLockError} {@link UnableToAquireLockError}
|
|
40
40
|
* @throws {UnableToReleaseLockError} {@link UnableToReleaseLockError}
|
|
41
41
|
* @throws {KeyAlreadyAcquiredLockError} {@link KeyAlreadyAcquiredLockError}
|
|
42
42
|
*/
|
|
43
43
|
runOrFail<TValue = void>(asyncFn: AsyncLazy<TValue>): LazyPromise<TValue>;
|
|
44
44
|
/**
|
|
45
|
-
* The <i>runBlocking</i> method wraps an
|
|
45
|
+
* The <i>runBlocking</i> method wraps an <i>{@link Invokable}</i> or <i>{@link LazyPromise}</i> with the <i>acquireBlocking</i> and <i>release</i> method.
|
|
46
46
|
* @throws {UnableToAquireLockError} {@link UnableToAquireLockError}
|
|
47
47
|
* @throws {UnableToReleaseLockError} {@link UnableToReleaseLockError}
|
|
48
48
|
*/
|
|
49
49
|
runBlocking<TValue = void>(asyncFn: AsyncLazy<TValue>, settings?: AquireBlockingSettings): LazyPromise<Result<TValue, KeyAlreadyAcquiredLockError>>;
|
|
50
50
|
/**
|
|
51
|
-
* The <i>runBlockingOrFail</i> method wraps an
|
|
51
|
+
* The <i>runBlockingOrFail</i> method wraps an <i>{@link Invokable}</i> or <i>{@link LazyPromise}</i> with the <i>acquireBlockingOrFail</i> and <i>release</i> method.
|
|
52
52
|
* @throws {UnableToAquireLockError} {@link UnableToAquireLockError}
|
|
53
53
|
* @throws {UnableToReleaseLockError} {@link UnableToReleaseLockError}
|
|
54
54
|
* @throws {KeyAlreadyAcquiredLockError} {@link KeyAlreadyAcquiredLockError}
|
|
@@ -25,11 +25,10 @@ export declare class RedisLockAdapter implements ILockAdapter {
|
|
|
25
25
|
/**
|
|
26
26
|
* @example
|
|
27
27
|
* ```ts
|
|
28
|
-
* import { RedisLockAdapter
|
|
28
|
+
* import { RedisLockAdapter } from "@daiso-tech/core/lock/adapters";
|
|
29
29
|
* import Redis from "ioredis";
|
|
30
30
|
*
|
|
31
31
|
* const database = new Redis("YOUR_REDIS_CONNECTION_STRING");
|
|
32
|
-
* const serde = new SuperJsonSerde();
|
|
33
32
|
* const lockAdapter = new RedisLockAdapter(database);
|
|
34
33
|
* ```
|
|
35
34
|
*/
|
|
@@ -14,11 +14,10 @@ export class RedisLockAdapter {
|
|
|
14
14
|
/**
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
|
-
* import { RedisLockAdapter
|
|
17
|
+
* import { RedisLockAdapter } from "@daiso-tech/core/lock/adapters";
|
|
18
18
|
* import Redis from "ioredis";
|
|
19
19
|
*
|
|
20
20
|
* const database = new Redis("YOUR_REDIS_CONNECTION_STRING");
|
|
21
|
-
* const serde = new SuperJsonSerde();
|
|
22
21
|
* const lockAdapter = new RedisLockAdapter(database);
|
|
23
22
|
* ```
|
|
24
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAuBH;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;
|
|
1
|
+
{"version":3,"file":"redis-lock-adapter.js","sourceRoot":"","sources":["../../../../../src/lock/implementations/adapters/redis-lock-adapter/redis-lock-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAuBH;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IAWI;IAV7B;;;;;;;;;OASG;IACH,YAA6B,QAAe;QAAf,aAAQ,GAAR,QAAQ,CAAO;QACxC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAEO,iBAAiB;QACrB,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,kBAAkB,KAAK,UAAU,EAAE,CAAC;YACzD,OAAO;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,oBAAoB,EAAE;YAC9C,YAAY,EAAE,CAAC;YACf,GAAG,EAAE;;;;;;;;;;;;;;;;;iBAiBA;SACR,CAAC,CAAC;IACP,CAAC;IAEO,kBAAkB;QACtB,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,kBAAkB,KAAK,UAAU,EAAE,CAAC;YACzD,OAAO;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,oBAAoB,EAAE;YAC9C,YAAY,EAAE,CAAC;YACf,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