@voltro/kv 0.89.2 → 0.91.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/CHANGELOG.md +1943 -0
- package/README.md +0 -110
- package/dist/backendRedis.js +21 -21
- package/dist/cacheAtomicProtocol.js +185 -161
- package/dist/cacheAtomicScript.js +140 -95
- package/dist/cacheAtomicState.js +112 -96
- package/dist/connection.d.ts +60 -16
- package/dist/connection.js +91 -91
- package/dist/connectionMemory.js +54 -54
- package/dist/connectionNats.js +32 -32
- package/dist/connectionPool.js +364 -364
- package/dist/connectionSubscriber.js +10 -10
- package/dist/hot-contract.js +3 -3
- package/dist/hot-testing.d.ts +20 -0
- package/dist/hot-testing.js +3 -1
- package/dist/hot.d.ts +17 -1
- package/dist/hot.js +8 -7
- package/dist/hotMemory.js +14 -14
- package/dist/hotRedis.js +48 -48
- package/dist/hotRouting.js +27 -27
- package/dist/hotState.js +6 -6
- package/dist/hotStoreFixtures.js +23 -0
- package/dist/hotSystemManifest.js +11 -0
- package/dist/index.js +5 -5
- package/package.json +4 -4
package/dist/connectionPool.js
CHANGED
|
@@ -1,242 +1,242 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { sqlConfigProblem as e, sqlConnectionConfig as t, sqlConnectionName as n } from "./connectionSqlConfig.js";
|
|
2
|
+
import { RedisConnections as r, connect as i, connectionConfig as a } from "./connection.js";
|
|
3
|
+
import { connectionDefinitionsProblem as o, natsConnectionName as s, redisConnectionName as c } from "./connectionDefinitions.js";
|
|
4
|
+
import { KvError as l } from "./errors.js";
|
|
5
|
+
import { makeConnectionOwner as u } from "./connectionOwner.js";
|
|
6
|
+
import { withRespKeyPrefix as d } from "./connectionPrefix.js";
|
|
7
7
|
import { applyConnectionNamespace as f, connectionNamespace as p } from "./connectionNamespace.js";
|
|
8
|
-
import { connectRedisSubscriber as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { natsConnectionConfig as
|
|
12
|
-
import { StorageError as
|
|
13
|
-
import { storageConfigProblem as
|
|
14
|
-
import { makeStorageFacade as
|
|
15
|
-
import { CONNECTION_PUBLISH_SCRIPT as
|
|
16
|
-
import { AnalyticsCapabilityNotSupported as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
8
|
+
import { connectRedisSubscriber as ee } from "./connectionSubscriber.js";
|
|
9
|
+
import { connectNats as te } from "./connectionNats.js";
|
|
10
|
+
import { assertNatsSubject as m, withNatsSubjectPrefix as h } from "./connectionNatsSubjects.js";
|
|
11
|
+
import { natsConnectionConfig as ne } from "./connectionNatsConfig.js";
|
|
12
|
+
import { StorageError as g } from "./storage.js";
|
|
13
|
+
import { storageConfigProblem as re, storageConnectionConfig as ie, storageConnectionName as ae } from "./connectionStorageConfig.js";
|
|
14
|
+
import { makeStorageFacade as oe } from "./connectionStorageFacade.js";
|
|
15
|
+
import { CONNECTION_PUBLISH_SCRIPT as se } from "./connectionScripts.js";
|
|
16
|
+
import { AnalyticsCapabilityNotSupported as _, AnalyticsError as v } from "./analytics.js";
|
|
17
|
+
import { analyticsConfigProblem as ce, analyticsConnectionConfig as le, analyticsConnectionName as ue } from "./connectionAnalyticsConfig.js";
|
|
18
|
+
import { makeConnectionMetrics as de } from "./connectionMetrics.js";
|
|
19
|
+
import { withConnectionRegistryConfigProvider as fe } from "./connectionConfigProvider.js";
|
|
19
20
|
import { connectionConfigError as y } from "./connectionConfigError.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { CircuitBreaker as ge, CircuitOpen as _e } from "@voltro/shared";
|
|
21
|
+
import { Cause as pe, Clock as b, Config as x, ConfigProvider as S, Context as C, Deferred as me, Effect as w, Layer as T, Pull as he, Scope as ge, Stream as E, SynchronizedRef as D } from "effect";
|
|
22
|
+
import { CircuitBreaker as _e, CircuitOpen as ve } from "@voltro/shared";
|
|
23
23
|
// src/connectionPool.ts
|
|
24
|
-
var
|
|
25
|
-
let
|
|
26
|
-
if (
|
|
27
|
-
let
|
|
28
|
-
for (let e of
|
|
24
|
+
var O = class extends C.Service()("@voltro/ConnectionRegistry") {}, k = (r = {}) => w.gen(function* () {
|
|
25
|
+
let fe = 0, C = r.connections === void 0 ? {} : r.connections;
|
|
26
|
+
if (r.requirements !== void 0 && !Array.isArray(r.requirements)) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "Connection requirements must be an array" })));
|
|
27
|
+
let T = (r.requirements ?? []).map((e) => Object.freeze({ ...e }));
|
|
28
|
+
for (let e of T) if (e.onUnavailable !== void 0 && e.onUnavailable !== "degrade" && e.onUnavailable !== "fail" || typeof e.consumer != "string" || !e.consumer.trim() || typeof e.role != "string" || !/^[A-Za-z][A-Za-z0-9_-]*$/.test(e.role) || e.reference !== "" && (typeof e.reference != "string" || !/^(redis|nats|storage|analytics|sql):[A-Za-z][A-Za-z0-9_-]*$/.test(e.reference)) || [
|
|
29
29
|
"crossNode",
|
|
30
30
|
"pubsub",
|
|
31
31
|
"atomicMulti"
|
|
32
32
|
].some((t) => {
|
|
33
33
|
let n = e[t];
|
|
34
34
|
return n !== void 0 && typeof n != "boolean";
|
|
35
|
-
})) return yield*
|
|
36
|
-
|
|
37
|
-
try: () => p(
|
|
38
|
-
catch: () => new
|
|
35
|
+
})) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "Connection requirements need consumer, role, a typed reference, boolean capabilities and a degrade/fail unavailable policy" })));
|
|
36
|
+
r.namespaceIdentity !== void 0 && (yield* w.try({
|
|
37
|
+
try: () => p(r.namespaceIdentity),
|
|
38
|
+
catch: () => new x.ConfigError(new S.SourceError({ message: "Connection namespace requires a nonempty app name and environment" }))
|
|
39
39
|
}));
|
|
40
|
-
let
|
|
41
|
-
if (
|
|
42
|
-
let
|
|
40
|
+
let O = de(r.namespaceIdentity === void 0 ? "unscoped" : p(r.namespaceIdentity)), k = o(C);
|
|
41
|
+
if (k) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: k })));
|
|
42
|
+
let A = C.maxDynamicPools ?? 128, ye = C.rotationGraceMs ?? 3e4, be = r.failureThreshold ?? 5, xe = r.resetTimeoutMs ?? 3e4;
|
|
43
43
|
for (let [e, t, n] of [
|
|
44
44
|
[
|
|
45
45
|
"maxDynamicPools",
|
|
46
|
-
|
|
46
|
+
A,
|
|
47
47
|
!1
|
|
48
48
|
],
|
|
49
49
|
[
|
|
50
50
|
"rotationGraceMs",
|
|
51
|
-
|
|
51
|
+
ye,
|
|
52
52
|
!0
|
|
53
53
|
],
|
|
54
54
|
[
|
|
55
55
|
"failureThreshold",
|
|
56
|
-
|
|
56
|
+
be,
|
|
57
57
|
!1
|
|
58
58
|
],
|
|
59
59
|
[
|
|
60
60
|
"resetTimeoutMs",
|
|
61
|
-
|
|
61
|
+
xe,
|
|
62
62
|
!1
|
|
63
63
|
]
|
|
64
|
-
]) if (!Number.isSafeInteger(t) || t < +!n) return yield*
|
|
65
|
-
let
|
|
66
|
-
if (e.startsWith("sql:")) return `sql:${
|
|
67
|
-
if (e.startsWith("analytics:")) return `analytics:${
|
|
68
|
-
if (e.startsWith("storage:")) return `storage:${
|
|
69
|
-
if (e.startsWith("nats:")) return `nats:${
|
|
70
|
-
let t =
|
|
71
|
-
return
|
|
72
|
-
},
|
|
73
|
-
let t =
|
|
64
|
+
]) if (!Number.isSafeInteger(t) || t < +!n) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: `${e} must be a ${n ? "nonnegative" : "positive"} safe integer` })));
|
|
65
|
+
let j = yield* w.context(), Se = w.runPromiseWith(j), M = yield* D.make(/* @__PURE__ */ new Map()), N = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), z = (e) => {
|
|
66
|
+
if (e.startsWith("sql:")) return `sql:${n(e, C)}`;
|
|
67
|
+
if (e.startsWith("analytics:")) return `analytics:${ue(e, C)}`;
|
|
68
|
+
if (e.startsWith("storage:")) return `storage:${ae(e, C)}`;
|
|
69
|
+
if (e.startsWith("nats:")) return `nats:${s(e, C)}`;
|
|
70
|
+
let t = c(e, C);
|
|
71
|
+
return C.redis?.[t] === void 0 ? e.startsWith("redis:") ? t : e : `redis:${t}`;
|
|
72
|
+
}, B = (e, t) => JSON.stringify([z(e), V(e) ? t?.tenantId ?? null : null]), Ce = (e) => e.startsWith("sql:") ? C.sql?.[n(e, C)] : e.startsWith("analytics:") ? C.analytics?.[ue(e, C)] : e.startsWith("storage:") ? C.storage?.[ae(e, C)] : e.startsWith("nats:") ? C.nats?.[s(e, C)] : C.redis?.[c(e, C)], V = (e) => {
|
|
73
|
+
let t = Ce(e);
|
|
74
74
|
return t !== void 0 && "_tag" in t && (t._tag === "DynamicRedisConnection" || t._tag === "DynamicNatsConnection" || t._tag === "DynamicStorageConnection" || t._tag === "DynamicAnalyticsConnection" || t._tag === "DynamicSqlConnection");
|
|
75
|
-
},
|
|
76
|
-
if (e !== "" && !/^(redis|nats|storage|analytics|sql):[A-Za-z][A-Za-z0-9_-]*$/.test(e)) return
|
|
77
|
-
let t =
|
|
78
|
-
reference:
|
|
75
|
+
}, we = (e) => w.suspend(() => {
|
|
76
|
+
if (e !== "" && !/^(redis|nats|storage|analytics|sql):[A-Za-z][A-Za-z0-9_-]*$/.test(e)) return w.fail(new x.ConfigError(new S.SourceError({ message: "A connection reference must use redis:name, nats:name, storage:name, analytics:name or sql:name" })));
|
|
77
|
+
let t = V(e), n = {
|
|
78
|
+
reference: z(e),
|
|
79
79
|
tenantScoped: t
|
|
80
80
|
};
|
|
81
|
-
return t ?
|
|
82
|
-
}),
|
|
83
|
-
try: () => f(e,
|
|
84
|
-
catch: (e) => new
|
|
85
|
-
})),
|
|
86
|
-
let n =
|
|
87
|
-
for (let e of
|
|
88
|
-
if (t.driver === "memory" && e.crossNode) return
|
|
81
|
+
return t ? w.succeed(n) : Oe(e).pipe(w.as(n));
|
|
82
|
+
}), H = (e, t) => a(e, C, t).pipe(w.flatMap((e) => r.namespaceIdentity === void 0 ? w.succeed(e) : w.try({
|
|
83
|
+
try: () => f(e, r.namespaceIdentity),
|
|
84
|
+
catch: (e) => new x.ConfigError(new S.SourceError({ message: e instanceof Error ? e.message : "Connection namespace admission failed" }))
|
|
85
|
+
})), w.flatMap((t) => {
|
|
86
|
+
let n = z(e);
|
|
87
|
+
for (let e of T) if (z(e.reference) === n) {
|
|
88
|
+
if (t.driver === "memory" && e.crossNode) return w.fail(new x.ConfigError(new S.SourceError({ message: `Plugin ${e.consumer} role ${e.role} requires a network Redis connection; memory is local` })));
|
|
89
89
|
if (t.driver === "http" && (e.pubsub || e.atomicMulti)) {
|
|
90
90
|
let t = e.pubsub ? "Pub/Sub" : "atomic MULTI";
|
|
91
|
-
return
|
|
91
|
+
return w.fail(new x.ConfigError(new S.SourceError({ message: `Plugin ${e.consumer} role ${e.role} requires ${t}; its selected Redis connection requires the RESP driver` })));
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
return
|
|
95
|
-
}),
|
|
96
|
-
try: () => f(e,
|
|
97
|
-
catch: () => new
|
|
98
|
-
})),
|
|
99
|
-
if (
|
|
94
|
+
return w.succeed(t);
|
|
95
|
+
}), w.mapError((e) => y(e, "redis"))), U = (e, t) => ne(e, C, t).pipe(w.flatMap((e) => r.namespaceIdentity === void 0 ? w.succeed(e) : w.try({
|
|
96
|
+
try: () => f(e, r.namespaceIdentity),
|
|
97
|
+
catch: () => new x.ConfigError(new S.SourceError({ message: "Connection namespace admission failed" }))
|
|
98
|
+
})), w.mapError((e) => y(e, "nats"))), Te = (e, t) => ie(e, C, t).pipe(w.flatMap((t) => {
|
|
99
|
+
if (r.namespaceIdentity?.environment === "production" && (t = {
|
|
100
100
|
...t,
|
|
101
101
|
tls: "required"
|
|
102
|
-
}),
|
|
102
|
+
}), r.namespaceIdentity !== void 0 && t.keyPrefix === void 0 && (t = {
|
|
103
103
|
...t,
|
|
104
|
-
keyPrefix: `${p(
|
|
105
|
-
}),
|
|
106
|
-
for (let n of
|
|
107
|
-
if (n.pubsub || n.atomicMulti) return
|
|
104
|
+
keyPrefix: `${p(r.namespaceIdentity)}/`
|
|
105
|
+
}), r.namespaceIdentity?.environment === "production" && t.keyPrefix !== `${p(r.namespaceIdentity)}/` && !t.allowSharedNamespace) return w.fail(new x.ConfigError(new S.SourceError({ message: "A custom production storage namespace requires allowSharedNamespace" })));
|
|
106
|
+
for (let n of T) if (z(n.reference) === z(e)) {
|
|
107
|
+
if (n.pubsub || n.atomicMulti) return w.fail(new x.ConfigError(new S.SourceError({ message: "Storage cannot provide Pub/Sub or atomic MULTI" })));
|
|
108
108
|
if (n.crossNode && [
|
|
109
109
|
"memory",
|
|
110
110
|
"filesystem",
|
|
111
111
|
"database"
|
|
112
|
-
].includes(t.provider)) return
|
|
112
|
+
].includes(t.provider)) return w.fail(new x.ConfigError(new S.SourceError({ message: "Cross-node storage requires a declared object-storage service" })));
|
|
113
113
|
}
|
|
114
|
-
let n =
|
|
115
|
-
return n ?
|
|
116
|
-
}),
|
|
117
|
-
|
|
114
|
+
let n = re(t);
|
|
115
|
+
return n ? w.fail(new x.ConfigError(new S.SourceError({ message: n }))) : w.succeed(t);
|
|
116
|
+
}), w.mapError((e) => y(e, "storage"))), Ee = (e, t) => le(e, C, t).pipe(w.flatMap((t) => {
|
|
117
|
+
r.namespaceIdentity?.environment === "production" && (t = {
|
|
118
118
|
...t,
|
|
119
119
|
tls: "required"
|
|
120
120
|
});
|
|
121
|
-
let n =
|
|
122
|
-
if (n) return
|
|
123
|
-
for (let n of
|
|
124
|
-
if (n.pubsub || n.atomicMulti) return
|
|
125
|
-
if (n.crossNode && t.provider === "duckdb") return
|
|
121
|
+
let n = ce(t);
|
|
122
|
+
if (n) return w.fail(new x.ConfigError(new S.SourceError({ message: n })));
|
|
123
|
+
for (let n of T) if (z(n.reference) === z(e)) {
|
|
124
|
+
if (n.pubsub || n.atomicMulti) return w.fail(new x.ConfigError(new S.SourceError({ message: "Analytics cannot provide Redis Pub/Sub or atomic MULTI" })));
|
|
125
|
+
if (n.crossNode && t.provider === "duckdb") return w.fail(new x.ConfigError(new S.SourceError({ message: "Cross-node analytics requires a network provider; DuckDB is local" })));
|
|
126
126
|
}
|
|
127
|
-
return
|
|
128
|
-
}),
|
|
129
|
-
|
|
127
|
+
return w.succeed(t);
|
|
128
|
+
}), w.mapError((e) => y(e, "analytics"))), De = (n, i) => t(n, C, i).pipe(w.flatMap((t) => {
|
|
129
|
+
r.namespaceIdentity?.environment === "production" && !["sqlite", "turso"].includes(t.dialect) && (t = {
|
|
130
130
|
...t,
|
|
131
131
|
tls: "required"
|
|
132
132
|
});
|
|
133
|
-
let
|
|
134
|
-
if (
|
|
135
|
-
for (let
|
|
136
|
-
if (
|
|
137
|
-
if (
|
|
133
|
+
let i = e(t);
|
|
134
|
+
if (i) return w.fail(new x.ConfigError(new S.SourceError({ message: i })));
|
|
135
|
+
for (let e of T) if (z(e.reference) === z(n)) {
|
|
136
|
+
if (e.pubsub || e.atomicMulti) return w.fail(new x.ConfigError(new S.SourceError({ message: "SQL cannot provide Redis Pub/Sub or atomic MULTI" })));
|
|
137
|
+
if (e.crossNode && ["sqlite", "turso"].includes(t.dialect)) return w.fail(new x.ConfigError(new S.SourceError({ message: "Cross-node SQL requires a network SQL dialect" })));
|
|
138
138
|
}
|
|
139
|
-
return
|
|
140
|
-
}),
|
|
139
|
+
return w.succeed(t);
|
|
140
|
+
}), w.mapError((e) => y(e, "sql")));
|
|
141
141
|
function Oe(e, t) {
|
|
142
|
-
return e.startsWith("sql:") ? De(e, t) : e.startsWith("analytics:") ? Ee(e, t) : e.startsWith("storage:") ? Te(e, t) : e.startsWith("nats:") ?
|
|
142
|
+
return e.startsWith("sql:") ? De(e, t) : e.startsWith("analytics:") ? Ee(e, t) : e.startsWith("storage:") ? Te(e, t) : e.startsWith("nats:") ? U(e, t) : H(e, t);
|
|
143
143
|
}
|
|
144
|
-
for (let e of
|
|
145
|
-
let W = yield*
|
|
146
|
-
rotationGraceMs:
|
|
144
|
+
for (let e of T) if ((e.reference.startsWith("nats:") || e.reference.startsWith("storage:") || e.reference.startsWith("analytics:") || e.reference.startsWith("sql:")) && e.atomicMulti) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: `Plugin ${e.consumer} role ${e.role} requires atomic MULTI; NATS cannot provide Redis commands` })));
|
|
145
|
+
let W = yield* u({
|
|
146
|
+
rotationGraceMs: ye,
|
|
147
147
|
onStopping: () => {
|
|
148
|
-
|
|
148
|
+
N.clear();
|
|
149
149
|
},
|
|
150
150
|
onStopped: () => {
|
|
151
|
-
for (let e of
|
|
152
|
-
|
|
153
|
-
for (let e of
|
|
154
|
-
|
|
155
|
-
for (let e of
|
|
156
|
-
|
|
151
|
+
for (let e of P.values()) e.channels.clear(), e.listeners.clear();
|
|
152
|
+
P.clear();
|
|
153
|
+
for (let e of R.values()) e.dispose();
|
|
154
|
+
R.clear();
|
|
155
|
+
for (let e of F.values()) e.clear();
|
|
156
|
+
F.clear(), L.clear(), I.clear();
|
|
157
157
|
},
|
|
158
|
-
dispose: (e) =>
|
|
159
|
-
e.detachCommandReconnect?.(), e.binding?.current === e && delete e.binding.current, e.kind === "sql" || e.kind === "storage" || e.kind === "analytics" ? yield* e.transport.close : e.kind === "nats" ? yield*
|
|
160
|
-
}).pipe(
|
|
158
|
+
dispose: (e) => w.gen(function* () {
|
|
159
|
+
e.detachCommandReconnect?.(), e.binding?.current === e && delete e.binding.current, e.kind === "sql" || e.kind === "storage" || e.kind === "analytics" ? yield* e.transport.close : e.kind === "nats" ? yield* w.promise(() => e.transport.close().catch(() => void 0)) : (yield* w.promise(() => e.subscriber?.close().catch(() => void 0) ?? Promise.resolve()), yield* w.promise(() => e.client.close().catch(() => void 0)));
|
|
160
|
+
}).pipe(w.ensuring(w.sync(() => O.close(e))))
|
|
161
161
|
}), { close: G, trackOpen: ke } = W, K = (e) => {
|
|
162
|
-
W.register(e),
|
|
163
|
-
}, Ae = (e) =>
|
|
164
|
-
e.errors++,
|
|
165
|
-
}, Y = (e) => (t) =>
|
|
162
|
+
W.register(e), O.register(e, e.reference);
|
|
163
|
+
}, Ae = (e) => w.sync(() => O.retire(e)).pipe(w.andThen(W.retire(e))), q = (e) => w.sync(() => O.release(e)).pipe(w.andThen(W.release(e))), J = (e) => {
|
|
164
|
+
e.errors++, O.error(e.reference);
|
|
165
|
+
}, Y = (e) => (t) => pe.hasInterruptsOnly(t) ? w.void : w.sync(() => {
|
|
166
166
|
J(e);
|
|
167
|
-
}), X = (e, t) =>
|
|
168
|
-
e.latencyMs = Number(n - t) / 1e6,
|
|
167
|
+
}), X = (e, t) => b.currentTimeNanos.pipe(w.flatMap((n) => e.breaker.state.pipe(w.tap((r) => w.sync(() => {
|
|
168
|
+
e.latencyMs = Number(n - t) / 1e6, O.completed(e.reference, e.latencyMs), r === "open" && O.available(e, !1);
|
|
169
169
|
}))))), je = (e, t) => {
|
|
170
170
|
for (let n of e.listeners) try {
|
|
171
171
|
n(t);
|
|
172
172
|
} catch {}
|
|
173
|
-
}, Me = (
|
|
174
|
-
if (
|
|
173
|
+
}, Me = (e, t) => w.gen(function* () {
|
|
174
|
+
if (e.kind === "sql" || e.kind === "storage" || e.kind === "analytics") return yield* w.fail(new l({
|
|
175
175
|
operation: "subscribe",
|
|
176
176
|
key: "",
|
|
177
177
|
cause: "Selected connection has no Pub/Sub transport"
|
|
178
178
|
}));
|
|
179
|
-
if (
|
|
180
|
-
if (
|
|
179
|
+
if (e.subscriber !== void 0) return;
|
|
180
|
+
if (e.kind === "redis" && e.config.driver === "http") return yield* w.fail(new l({
|
|
181
181
|
operation: "subscribe",
|
|
182
182
|
key: "",
|
|
183
183
|
cause: "Redis Pub/Sub requires the RESP driver"
|
|
184
184
|
}));
|
|
185
|
-
let
|
|
185
|
+
let n = yield* (e.kind === "nats" ? w.succeed(h(e.transport, e.config.keyPrefix)) : e.memory === void 0 ? (r.connectSubscriber ?? ee)(e.config) : w.sync(() => e.memory.subscriber())).pipe(w.mapError(() => new l({
|
|
186
186
|
operation: "subscribe",
|
|
187
187
|
key: "",
|
|
188
188
|
cause: "Redis subscriber could not be opened"
|
|
189
189
|
})));
|
|
190
|
-
|
|
191
|
-
let r =
|
|
192
|
-
if (!(W.stopped || r?.current !==
|
|
193
|
-
|
|
190
|
+
e.subscriber = n, e.binding = t, n.onMessage((t, n) => {
|
|
191
|
+
let r = e.binding;
|
|
192
|
+
if (!(W.stopped || r?.current !== e || e.closed)) for (let e of r.channels.get(t) ?? []) try {
|
|
193
|
+
e(n);
|
|
194
194
|
} catch {}
|
|
195
|
-
}),
|
|
196
|
-
let n =
|
|
197
|
-
!W.stopped && n?.current ===
|
|
198
|
-
}), yield*
|
|
199
|
-
try: () =>
|
|
200
|
-
catch: () => new
|
|
195
|
+
}), n.onTransportEvent((t) => {
|
|
196
|
+
let n = e.binding;
|
|
197
|
+
!W.stopped && n?.current === e && !e.closed && je(n, t);
|
|
198
|
+
}), yield* w.forEach([...t.channels.keys()], (e) => w.tryPromise({
|
|
199
|
+
try: () => n.subscribe(e),
|
|
200
|
+
catch: () => new l({
|
|
201
201
|
operation: "subscribe",
|
|
202
202
|
key: "",
|
|
203
203
|
cause: "Redis subscription could not be registered"
|
|
204
204
|
})
|
|
205
205
|
}), { discard: !0 });
|
|
206
206
|
}), Ne = (e, t) => ke(Me(e, t)), Pe = (e) => {
|
|
207
|
-
|
|
207
|
+
O.activate(e), e.kind === "storage" && I.set(B(e.reference, e.context), e.config);
|
|
208
208
|
let t = e.binding;
|
|
209
209
|
if (t === void 0) return;
|
|
210
210
|
let n = t.current;
|
|
211
211
|
t.current = e, n !== void 0 && n !== e && t.channels.size > 0 && (je(t, { kind: "disconnected" }), je(t, { kind: "reconnected" }));
|
|
212
|
-
}, Fe = (
|
|
213
|
-
let s = yield* o((
|
|
212
|
+
}, Fe = (e, t, n, a) => w.uninterruptibleMask((o) => w.gen(function* () {
|
|
213
|
+
let s = yield* o((e.startsWith("sql:") ? De(e, t).pipe(w.map((e) => ({
|
|
214
214
|
kind: "sql",
|
|
215
215
|
config: e
|
|
216
|
-
}))) :
|
|
216
|
+
}))) : e.startsWith("analytics:") ? Ee(e, t).pipe(w.map((e) => ({
|
|
217
217
|
kind: "analytics",
|
|
218
218
|
config: e
|
|
219
|
-
}))) :
|
|
219
|
+
}))) : e.startsWith("storage:") ? Te(e, t).pipe(w.map((e) => ({
|
|
220
220
|
kind: "storage",
|
|
221
221
|
config: e
|
|
222
|
-
}))) :
|
|
222
|
+
}))) : e.startsWith("nats:") ? U(e, t).pipe(w.map((e) => ({
|
|
223
223
|
kind: "nats",
|
|
224
224
|
config: e
|
|
225
|
-
}))) :
|
|
225
|
+
}))) : H(e, t).pipe(w.map((e) => ({
|
|
226
226
|
kind: "redis",
|
|
227
227
|
config: e
|
|
228
|
-
})))).pipe(
|
|
229
|
-
name:
|
|
230
|
-
failureThreshold:
|
|
231
|
-
resetTimeout:
|
|
232
|
-
...s.kind === "sql" ? { isFailure: (
|
|
233
|
-
}),
|
|
234
|
-
reference:
|
|
235
|
-
context:
|
|
236
|
-
breaker:
|
|
237
|
-
dynamic:
|
|
238
|
-
closedSignal:
|
|
239
|
-
expiresAt:
|
|
228
|
+
})))).pipe(w.interruptible)), c = yield* b.currentTimeMillis, u = Ce(e), f = V(e), p = yield* _e.make({
|
|
229
|
+
name: e,
|
|
230
|
+
failureThreshold: be,
|
|
231
|
+
resetTimeout: xe,
|
|
232
|
+
...s.kind === "sql" ? { isFailure: (e) => e instanceof l || e instanceof v || typeof e == "object" && !!e && "_tag" in e && e._tag === "HotError" && "reason" in e && e.reason === "unavailable" } : {}
|
|
233
|
+
}), ee = yield* me.make(), m = {
|
|
234
|
+
reference: z(e),
|
|
235
|
+
context: t,
|
|
236
|
+
breaker: p,
|
|
237
|
+
dynamic: f,
|
|
238
|
+
closedSignal: ee,
|
|
239
|
+
expiresAt: u !== void 0 && "_tag" in u && "ttlMs" in u ? c + u.ttlMs : Infinity,
|
|
240
240
|
active: 0,
|
|
241
241
|
lastUsed: c,
|
|
242
242
|
commands: 0,
|
|
@@ -244,170 +244,170 @@ var k = class extends w.Service()("@voltro/ConnectionRegistry") {}, A = (v = {})
|
|
|
244
244
|
latencyMs: null,
|
|
245
245
|
retired: !1,
|
|
246
246
|
closed: !1
|
|
247
|
-
},
|
|
247
|
+
}, h;
|
|
248
248
|
if (s.kind === "sql") {
|
|
249
|
-
if (
|
|
250
|
-
if (a !== void 0 && (a.kind !== "sql" || a.config.dialect !== s.config.dialect)) return yield*
|
|
251
|
-
let
|
|
249
|
+
if (r.connectSql === void 0) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "SQL requires an app-owned SQL connector" })));
|
|
250
|
+
if (a !== void 0 && (a.kind !== "sql" || a.config.dialect !== s.config.dialect)) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "SQL rotation must preserve the dialect contract" })));
|
|
251
|
+
let e = yield* r.connectSql(s.config).pipe(w.mapError(() => new l({
|
|
252
252
|
operation: "connect",
|
|
253
253
|
key: "",
|
|
254
254
|
cause: "SQL transport could not be constructed"
|
|
255
255
|
})));
|
|
256
|
-
|
|
257
|
-
...
|
|
256
|
+
h = {
|
|
257
|
+
...m,
|
|
258
258
|
kind: "sql",
|
|
259
259
|
drainUntilReleased: !0,
|
|
260
|
-
transport:
|
|
260
|
+
transport: e,
|
|
261
261
|
config: s.config
|
|
262
|
-
}, K(
|
|
262
|
+
}, K(h), yield* o(e.probe.pipe(w.interruptible, w.timeout("5 seconds"), w.mapError(() => new l({
|
|
263
263
|
operation: "connect",
|
|
264
264
|
key: "",
|
|
265
265
|
cause: "SQL readiness failed"
|
|
266
|
-
})))).pipe(
|
|
266
|
+
})))).pipe(w.onError(() => G(h)));
|
|
267
267
|
} else if (s.kind === "analytics") {
|
|
268
|
-
if (
|
|
269
|
-
let
|
|
268
|
+
if (r.connectAnalytics === void 0) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "Analytics requires an app-owned analytics connector" })));
|
|
269
|
+
let e = yield* r.connectAnalytics(s.config).pipe(w.mapError(() => new l({
|
|
270
270
|
operation: "connect",
|
|
271
271
|
key: "",
|
|
272
272
|
cause: "Analytics transport could not be constructed"
|
|
273
273
|
})));
|
|
274
|
-
if (
|
|
275
|
-
...
|
|
274
|
+
if (h = {
|
|
275
|
+
...m,
|
|
276
276
|
kind: "analytics",
|
|
277
|
-
transport:
|
|
277
|
+
transport: e,
|
|
278
278
|
config: s.config
|
|
279
|
-
}, K(
|
|
280
|
-
if (a.kind !== "analytics" || a.config.provider !== s.config.provider) return yield* G(
|
|
281
|
-
let
|
|
282
|
-
if (JSON.stringify(
|
|
279
|
+
}, K(h), a !== void 0) {
|
|
280
|
+
if (a.kind !== "analytics" || a.config.provider !== s.config.provider) return yield* G(h), yield* w.fail(new x.ConfigError(new S.SourceError({ message: "Analytics rotation must preserve the provider contract" })));
|
|
281
|
+
let t = a.transport.sink, n = e.sink;
|
|
282
|
+
if (JSON.stringify(t.info.capabilities) !== JSON.stringify(n.info.capabilities) || JSON.stringify(t.mirror?.tables ?? []) !== JSON.stringify(n.mirror?.tables ?? []) || t.mirror?.primaryKey !== n.mirror?.primaryKey) return yield* G(h), yield* w.fail(new x.ConfigError(new S.SourceError({ message: "Analytics rotation must preserve capabilities and mirror schema" })));
|
|
283
283
|
}
|
|
284
|
-
yield* o(
|
|
284
|
+
yield* o(e.probe.pipe(w.interruptible, w.timeout("5 seconds"), w.mapError(() => new l({
|
|
285
285
|
operation: "connect",
|
|
286
286
|
key: "",
|
|
287
287
|
cause: a === void 0 ? "Analytics readiness failed" : "Replacement analytics readiness failed"
|
|
288
|
-
})))).pipe(
|
|
288
|
+
})))).pipe(w.onError(() => G(h)));
|
|
289
289
|
} else if (s.kind === "storage") {
|
|
290
|
-
if (
|
|
291
|
-
let
|
|
290
|
+
if (r.connectStorage === void 0) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "Storage requires an app-owned storage connector" })));
|
|
291
|
+
let n;
|
|
292
292
|
if (s.config.provider === "memory") {
|
|
293
|
-
let
|
|
294
|
-
|
|
293
|
+
let r = B(e, t);
|
|
294
|
+
n = F.get(r), n === void 0 && (n = /* @__PURE__ */ new Map(), F.set(r, n));
|
|
295
295
|
}
|
|
296
|
-
let i = yield*
|
|
296
|
+
let i = yield* r.connectStorage(s.config, n === void 0 ? {} : { memory: n }).pipe(w.mapError(() => new l({
|
|
297
297
|
operation: "connect",
|
|
298
298
|
key: "",
|
|
299
299
|
cause: "Storage transport could not be constructed"
|
|
300
300
|
})));
|
|
301
|
-
|
|
302
|
-
...
|
|
301
|
+
h = {
|
|
302
|
+
...m,
|
|
303
303
|
kind: "storage",
|
|
304
304
|
transport: i,
|
|
305
305
|
config: s.config
|
|
306
|
-
}, K(
|
|
307
|
-
let o =
|
|
308
|
-
o !== void 0 && i.provider.bindDataStore?.(o), a !== void 0 && (yield* i.probe.pipe(
|
|
306
|
+
}, K(h);
|
|
307
|
+
let o = L.get(B(e, t));
|
|
308
|
+
o !== void 0 && i.provider.bindDataStore?.(o), a !== void 0 && (yield* i.probe.pipe(w.timeout("5 seconds"), w.mapError(() => new l({
|
|
309
309
|
operation: "connect",
|
|
310
310
|
key: "",
|
|
311
311
|
cause: "Replacement storage readiness failed"
|
|
312
|
-
})),
|
|
312
|
+
})), w.onError(() => G(h))));
|
|
313
313
|
} else if (s.kind === "nats") {
|
|
314
|
-
let
|
|
314
|
+
let e = s.config, t = yield* (r.connectNats === void 0 ? te(e).pipe(w.timeout("5 seconds"), w.interruptible) : r.connectNats(e)).pipe(w.mapError(() => new l({
|
|
315
315
|
operation: "connect",
|
|
316
316
|
key: "",
|
|
317
317
|
cause: "NATS driver could not be opened"
|
|
318
318
|
})));
|
|
319
|
-
|
|
320
|
-
...
|
|
319
|
+
h = {
|
|
320
|
+
...m,
|
|
321
321
|
kind: "nats",
|
|
322
|
-
transport:
|
|
323
|
-
config:
|
|
324
|
-
}, K(
|
|
325
|
-
let
|
|
326
|
-
|
|
327
|
-
e.kind !== "reconnected" || W.stopped ||
|
|
322
|
+
transport: t,
|
|
323
|
+
config: e
|
|
324
|
+
}, K(h);
|
|
325
|
+
let n = h;
|
|
326
|
+
h.detachCommandReconnect = t.onTransportEvent((e) => {
|
|
327
|
+
e.kind !== "reconnected" || W.stopped || n.closed || n.retired || w.runSyncWith(j)(n.breaker.reset);
|
|
328
328
|
});
|
|
329
329
|
} else {
|
|
330
|
-
let
|
|
331
|
-
if (
|
|
332
|
-
let
|
|
333
|
-
if (c =
|
|
334
|
-
let { makeMemoryConnectionState:
|
|
335
|
-
c =
|
|
330
|
+
let n = s.config, { keyPrefix: a, ...o } = n, c;
|
|
331
|
+
if (n.driver === "memory") {
|
|
332
|
+
let r = B(e, t);
|
|
333
|
+
if (c = R.get(r), c === void 0) {
|
|
334
|
+
let { makeMemoryConnectionState: e } = yield* w.promise(() => import("./connectionMemory.js"));
|
|
335
|
+
c = e(n.memoryClock), R.set(r, c);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
let
|
|
338
|
+
let u = yield* (c === void 0 ? r.connect === void 0 ? i(o).pipe(w.interruptible) : r.connect(o) : w.sync(() => c.command())).pipe(w.map((e) => d(e, a)), w.mapError(() => new l({
|
|
339
339
|
operation: "connect",
|
|
340
340
|
key: "",
|
|
341
341
|
cause: "Connection driver could not be opened"
|
|
342
342
|
})));
|
|
343
|
-
|
|
344
|
-
...
|
|
343
|
+
h = {
|
|
344
|
+
...m,
|
|
345
345
|
kind: "redis",
|
|
346
|
-
client:
|
|
347
|
-
config:
|
|
346
|
+
client: u,
|
|
347
|
+
config: n,
|
|
348
348
|
...c === void 0 ? {} : { memory: c }
|
|
349
|
-
}, K(
|
|
350
|
-
let
|
|
351
|
-
W.stopped ||
|
|
349
|
+
}, K(h);
|
|
350
|
+
let f = h, p = u.onReconnect?.(() => {
|
|
351
|
+
W.stopped || f.closed || f.retired || w.runSyncWith(j)(f.breaker.reset);
|
|
352
352
|
});
|
|
353
|
-
|
|
353
|
+
p !== void 0 && (h.detachCommandReconnect = p);
|
|
354
354
|
}
|
|
355
|
-
return
|
|
356
|
-
})), Ie = (e, t, n, r) => ke(Fe(e, t, n, r)).pipe(
|
|
357
|
-
let t =
|
|
358
|
-
/^(redis|nats|storage|analytics|sql):[A-Za-z][A-Za-z0-9_-]*$/.test(t) &&
|
|
359
|
-
}))), Z = (
|
|
360
|
-
if (W.stopped) return yield*
|
|
355
|
+
return O.available(h, h.kind !== "storage" || a !== void 0), n?.(h), a?.binding !== void 0 && (h.binding = a.binding, a.binding.channels.size > 0 && (yield* Ne(h, a.binding).pipe(w.onError(() => G(h))))), n === void 0 && Pe(h), h;
|
|
356
|
+
})), Ie = (e, t, n, r) => ke(Fe(e, t, n, r)).pipe(w.tapCause((t) => pe.hasInterruptsOnly(t) ? w.void : w.sync(() => {
|
|
357
|
+
let t = z(e);
|
|
358
|
+
/^(redis|nats|storage|analytics|sql):[A-Za-z][A-Za-z0-9_-]*$/.test(t) && O.error(t);
|
|
359
|
+
}))), Z = (e, t) => D.modifyEffect(M, (n) => w.gen(function* () {
|
|
360
|
+
if (W.stopped) return yield* w.fail(new l({
|
|
361
361
|
operation: "connect",
|
|
362
362
|
key: "",
|
|
363
363
|
cause: "Connection registry is closed"
|
|
364
364
|
}));
|
|
365
|
-
let
|
|
366
|
-
if (
|
|
367
|
-
let
|
|
368
|
-
if (!
|
|
369
|
-
let
|
|
370
|
-
if (
|
|
371
|
-
let
|
|
372
|
-
if (!
|
|
365
|
+
let r = B(e, t), i = yield* b.currentTimeMillis, a = n.get(r);
|
|
366
|
+
if (a && a.expiresAt > i) return a.active++, O.acquire(a), a.lastUsed = i, [a, n];
|
|
367
|
+
let o = new Map(n);
|
|
368
|
+
if (!a && V(e)) {
|
|
369
|
+
let n = [...o.entries()].filter(([, e]) => e.dynamic);
|
|
370
|
+
if (n.length >= A) {
|
|
371
|
+
let i = n.filter(([, e]) => e.active === 0 && (e.binding?.channels.size ?? 0) === 0).sort((e, t) => e[1].lastUsed - t[1].lastUsed)[0];
|
|
372
|
+
if (!i) return yield* w.fail(new l({
|
|
373
373
|
operation: "connect",
|
|
374
374
|
key: "",
|
|
375
375
|
cause: "All dynamic connection pools are busy; maxDynamicPools reached"
|
|
376
376
|
}));
|
|
377
|
-
let
|
|
378
|
-
return
|
|
377
|
+
let s = yield* Ie(e, t, void 0, a);
|
|
378
|
+
return o.delete(i[0]), yield* Ae(i[1]), s.active++, O.acquire(s), o.set(r, s), [s, o];
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
let
|
|
382
|
-
return
|
|
383
|
-
})), Q = (t, n, r
|
|
384
|
-
let
|
|
385
|
-
return
|
|
386
|
-
operation:
|
|
381
|
+
let s = yield* Ie(e, t, void 0, a);
|
|
382
|
+
return a && (yield* Ae(a)), s.active++, O.acquire(s), o.set(r, s), [s, o];
|
|
383
|
+
})), Q = (e, t, n, r) => w.acquireUseRelease(Z(e, t), (e) => w.gen(function* () {
|
|
384
|
+
let t = yield* b.currentTimeNanos;
|
|
385
|
+
return e.commands++, O.command(e.reference), yield* e.breaker(r(e)).pipe(w.tap(() => w.sync(() => O.available(e, !0))), w.tapCause(Y(e)), w.mapError((e) => e instanceof ve ? new l({
|
|
386
|
+
operation: n,
|
|
387
387
|
key: "",
|
|
388
|
-
cause: `Connection circuit is open; retry after ${
|
|
389
|
-
}) :
|
|
390
|
-
}), q), Le = (t, n, r
|
|
391
|
-
try: () =>
|
|
392
|
-
catch: () => new
|
|
393
|
-
operation:
|
|
388
|
+
cause: `Connection circuit is open; retry after ${e.retryAfterMs} ms`
|
|
389
|
+
}) : e), w.ensuring(X(e, t)));
|
|
390
|
+
}), q), Le = (e, t, n, r) => Se(Q(e, t, n, (e) => w.tryPromise({
|
|
391
|
+
try: () => r(e),
|
|
392
|
+
catch: () => new l({
|
|
393
|
+
operation: n,
|
|
394
394
|
key: "",
|
|
395
395
|
cause: "Connection command failed"
|
|
396
396
|
})
|
|
397
|
-
}))), Re = (
|
|
397
|
+
}))), Re = (e, t) => Q(e, t, "probe", (e) => e.kind === "sql" ? e.transport.probe : e.kind === "analytics" ? e.transport.probe.pipe(w.mapError(() => new l({
|
|
398
398
|
operation: "probe",
|
|
399
399
|
key: "",
|
|
400
400
|
cause: "Analytics readiness probe failed"
|
|
401
|
-
}))) :
|
|
401
|
+
}))) : e.kind === "storage" ? e.transport.probe.pipe(w.mapError(() => new l({
|
|
402
402
|
operation: "probe",
|
|
403
403
|
key: "",
|
|
404
404
|
cause: "Storage readiness probe failed"
|
|
405
|
-
}))) :
|
|
405
|
+
}))) : w.tryPromise({
|
|
406
406
|
try: async () => {
|
|
407
|
-
if (
|
|
408
|
-
if (
|
|
407
|
+
if (e.kind === "nats") return e.transport.flush();
|
|
408
|
+
if (e.client.ping === void 0 || await e.client.ping() !== "PONG") throw Error("Redis readiness requires PONG");
|
|
409
409
|
},
|
|
410
|
-
catch: () => new
|
|
410
|
+
catch: () => new l({
|
|
411
411
|
operation: "probe",
|
|
412
412
|
key: "",
|
|
413
413
|
cause: "Connection readiness probe failed"
|
|
@@ -415,12 +415,12 @@ var k = class extends w.Service()("@voltro/ConnectionRegistry") {}, A = (v = {})
|
|
|
415
415
|
})), $ = (e, t, n, r) => Le(e, t, n, (e) => {
|
|
416
416
|
if (e.kind !== "redis") throw Error("Redis commands require a Redis connection");
|
|
417
417
|
return r(e.client);
|
|
418
|
-
}), ze = (e, t) =>
|
|
419
|
-
if (e.includes(":") && !e.startsWith("redis:")) return yield*
|
|
420
|
-
let n = t === void 0 ? void 0 : Object.freeze({ tenantId: t.tenantId }), r = yield*
|
|
418
|
+
}), ze = (e, t) => w.gen(function* () {
|
|
419
|
+
if (e.includes(":") && !e.startsWith("redis:")) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "Redis commands require a redis:name reference" })));
|
|
420
|
+
let n = t === void 0 ? void 0 : Object.freeze({ tenantId: t.tenantId }), r = yield* w.acquireUseRelease(Z(e, n), (e) => e.kind === "redis" ? w.succeed({
|
|
421
421
|
ping: e.client.ping !== void 0,
|
|
422
422
|
crossNode: e.client.crossNode
|
|
423
|
-
}) :
|
|
423
|
+
}) : w.fail(new x.ConfigError(new S.SourceError({ message: "Redis commands require a redis:name reference" }))), q), i = B(e, n), a = N.get(i);
|
|
424
424
|
if (a) return a;
|
|
425
425
|
let o = (t, r) => $(e, n, t, (e) => {
|
|
426
426
|
if (e.readOnly === void 0) throw Error("Connection has no read-only transport");
|
|
@@ -448,64 +448,64 @@ var k = class extends w.Service()("@voltro/ConnectionRegistry") {}, A = (v = {})
|
|
|
448
448
|
scan: (t, r, i) => $(e, n, "scan", (e) => e.scan(t, r, i)),
|
|
449
449
|
close: () => Promise.resolve()
|
|
450
450
|
};
|
|
451
|
-
return
|
|
451
|
+
return V(e) || N.set(i, s), s;
|
|
452
452
|
});
|
|
453
453
|
return {
|
|
454
454
|
client: ze,
|
|
455
455
|
config: Oe,
|
|
456
|
-
validate:
|
|
457
|
-
storage: (e, t) =>
|
|
458
|
-
if (!e.startsWith("storage:")) return yield*
|
|
459
|
-
let n = t === void 0 ? void 0 : Object.freeze({ tenantId: t.tenantId }), r = yield*
|
|
456
|
+
validate: we,
|
|
457
|
+
storage: (e, t) => w.gen(function* () {
|
|
458
|
+
if (!e.startsWith("storage:")) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "Storage requires a storage:name reference" })));
|
|
459
|
+
let n = t === void 0 ? void 0 : Object.freeze({ tenantId: t.tenantId }), r = yield* w.acquireUseRelease(Z(e, n), (e) => e.kind === "storage" ? w.succeed(e.config) : w.fail(new x.ConfigError(new S.SourceError({ message: "Storage requires a storage:name reference" }))), q), i = B(e, n), a = (e) => new g({
|
|
460
460
|
provider: r.provider,
|
|
461
461
|
message: "Storage connection operation failed",
|
|
462
|
-
transient: e instanceof
|
|
463
|
-
...e instanceof
|
|
464
|
-
...e instanceof
|
|
462
|
+
transient: e instanceof g ? e.transient : !0,
|
|
463
|
+
...e instanceof g && e.outcome !== void 0 ? { outcome: e.outcome } : {},
|
|
464
|
+
...e instanceof g && e.status !== void 0 ? { status: e.status } : {}
|
|
465
465
|
});
|
|
466
|
-
return
|
|
467
|
-
config: () =>
|
|
468
|
-
command: (t, r) =>
|
|
469
|
-
if (e.kind !== "storage") return yield*
|
|
470
|
-
let t = yield*
|
|
471
|
-
return e.commands++,
|
|
466
|
+
return oe({
|
|
467
|
+
config: () => I.get(i) ?? r,
|
|
468
|
+
command: (t, r) => w.acquireUseRelease(Z(e, n).pipe(w.mapError(a)), (e) => w.gen(function* () {
|
|
469
|
+
if (e.kind !== "storage") return yield* w.fail(a(void 0));
|
|
470
|
+
let t = yield* b.currentTimeNanos;
|
|
471
|
+
return e.commands++, O.command(e.reference), yield* e.breaker(r(e.transport.provider)).pipe(w.tap(() => w.sync(() => O.available(e, !0))), w.tapCause(Y(e)), w.mapError(a), w.ensuring(X(e, t)));
|
|
472
472
|
}), q),
|
|
473
|
-
stream: (t, r) =>
|
|
474
|
-
if (e.kind !== "storage") return yield*
|
|
475
|
-
let n = yield*
|
|
476
|
-
e.commands++,
|
|
477
|
-
let i = e.transport.provider, o = i.getStream === void 0 ? i.get(t).pipe(
|
|
473
|
+
stream: (t, r) => E.unwrap(w.acquireRelease(Z(e, n).pipe(w.mapError(a)), q).pipe(w.flatMap((e) => w.gen(function* () {
|
|
474
|
+
if (e.kind !== "storage") return yield* w.fail(a(void 0));
|
|
475
|
+
let n = yield* b.currentTimeNanos;
|
|
476
|
+
e.commands++, O.command(e.reference), yield* w.addFinalizer(() => X(e, n));
|
|
477
|
+
let i = e.transport.provider, o = i.getStream === void 0 ? i.get(t).pipe(w.flatMap((t) => t.bytes.byteLength !== r.size || t.contentType !== (r.contentType ?? "application/octet-stream") ? w.fail(new g({
|
|
478
478
|
provider: e.config.provider,
|
|
479
479
|
message: "Storage metadata changed before stream consumption",
|
|
480
480
|
transient: !0
|
|
481
|
-
})) :
|
|
481
|
+
})) : w.succeed(E.succeed(t.bytes)))) : w.acquireRelease(i.getStream(t), (e) => e.close ?? w.void).pipe(w.flatMap((t) => t.size !== void 0 && t.size !== r.size || t.contentType !== (r.contentType ?? "application/octet-stream") ? w.fail(new g({
|
|
482
482
|
provider: e.config.provider,
|
|
483
483
|
message: "Storage metadata changed before stream consumption",
|
|
484
484
|
transient: !0
|
|
485
|
-
})) :
|
|
486
|
-
return yield* e.breaker(o).pipe(
|
|
485
|
+
})) : w.succeed(t.stream)));
|
|
486
|
+
return yield* e.breaker(o).pipe(w.tap(() => w.sync(() => O.available(e, !0))), w.tapCause(Y(e)), w.mapError(a), w.map((t) => t.pipe(E.mapError(a), E.tapCause((t) => Y(e)(t)))));
|
|
487
487
|
})))),
|
|
488
488
|
bind: (e) => {
|
|
489
489
|
if (W.stopped) throw Error("Connection registry is closed");
|
|
490
|
-
|
|
491
|
-
for (let t of
|
|
490
|
+
L.set(i, e);
|
|
491
|
+
for (let t of w.runSyncWith(j)(D.get(M)).values()) t.kind === "storage" && B(t.reference, t.context) === i && t.transport.provider.bindDataStore?.(e);
|
|
492
492
|
}
|
|
493
493
|
});
|
|
494
494
|
}),
|
|
495
|
-
analytics: (e, t) =>
|
|
496
|
-
if (!e.startsWith("analytics:")) return yield*
|
|
497
|
-
let n = t === void 0 ? void 0 : Object.freeze({ tenantId: t.tenantId }), r = yield*
|
|
495
|
+
analytics: (e, t) => w.gen(function* () {
|
|
496
|
+
if (!e.startsWith("analytics:")) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "Analytics requires an analytics:name reference" })));
|
|
497
|
+
let n = t === void 0 ? void 0 : Object.freeze({ tenantId: t.tenantId }), r = yield* w.acquireUseRelease(Z(e, n), (e) => e.kind === "analytics" ? w.succeed(e.transport.sink) : w.fail(new x.ConfigError(new S.SourceError({ message: "Analytics requires an analytics:name reference" }))), q), i = Object.freeze({
|
|
498
498
|
provider: r.info.provider,
|
|
499
499
|
capabilities: Object.freeze({ ...r.info.capabilities })
|
|
500
|
-
}), a = (t, r) => Q(e, n, t, (e) => e.kind === "analytics" ?
|
|
500
|
+
}), a = (t, r) => Q(e, n, t, (e) => e.kind === "analytics" ? w.suspend(() => r(e.transport.sink)).pipe(w.mapError((e) => e instanceof _ ? e : new v({
|
|
501
501
|
provider: i.provider,
|
|
502
502
|
operation: t,
|
|
503
503
|
cause: "Analytics connection operation failed"
|
|
504
|
-
}))) :
|
|
504
|
+
}))) : w.fail(new v({
|
|
505
505
|
provider: i.provider,
|
|
506
506
|
operation: t,
|
|
507
507
|
cause: "Selected connection is not analytics"
|
|
508
|
-
}))).pipe(
|
|
508
|
+
}))).pipe(w.mapError((e) => e instanceof _ ? e : new v({
|
|
509
509
|
provider: i.provider,
|
|
510
510
|
operation: t,
|
|
511
511
|
cause: "Analytics connection operation failed"
|
|
@@ -519,196 +519,196 @@ var k = class extends w.Service()("@voltro/ConnectionRegistry") {}, A = (v = {})
|
|
|
519
519
|
...r.mirror === void 0 ? {} : { mirror: {
|
|
520
520
|
tables: Object.freeze([...r.mirror.tables]),
|
|
521
521
|
...r.mirror.primaryKey === void 0 ? {} : { primaryKey: r.mirror.primaryKey },
|
|
522
|
-
upsert: (e) => a("mirror.upsert", (t) => t.mirror === void 0 ?
|
|
522
|
+
upsert: (e) => a("mirror.upsert", (t) => t.mirror === void 0 ? w.fail(new _({
|
|
523
523
|
provider: i.provider,
|
|
524
524
|
capability: "mirror"
|
|
525
525
|
})) : t.mirror.upsert(e)),
|
|
526
|
-
remove: (e) => a("mirror.remove", (t) => t.mirror === void 0 ?
|
|
526
|
+
remove: (e) => a("mirror.remove", (t) => t.mirror === void 0 ? w.fail(new _({
|
|
527
527
|
provider: i.provider,
|
|
528
528
|
capability: "mirror"
|
|
529
529
|
})) : t.mirror.remove(e)),
|
|
530
|
-
maxVersion: (e) => a("mirror.maxVersion", (t) => t.mirror === void 0 ?
|
|
530
|
+
maxVersion: (e) => a("mirror.maxVersion", (t) => t.mirror === void 0 ? w.fail(new _({
|
|
531
531
|
provider: i.provider,
|
|
532
532
|
capability: "mirror"
|
|
533
533
|
})) : t.mirror.maxVersion(e))
|
|
534
534
|
} }
|
|
535
535
|
};
|
|
536
536
|
}),
|
|
537
|
-
sql: (
|
|
538
|
-
if (!/^sql:[A-Za-z][A-Za-z0-9_-]*$/.test(
|
|
539
|
-
let
|
|
537
|
+
sql: (e, t) => w.gen(function* () {
|
|
538
|
+
if (!/^sql:[A-Za-z][A-Za-z0-9_-]*$/.test(e)) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "SQL requires a sql:name reference" })));
|
|
539
|
+
let n = t === void 0 ? void 0 : Object.freeze({ tenantId: t.tenantId }), r = yield* w.acquireUseRelease(Z(e, n), (e) => e.kind === "sql" ? w.succeed(e.config.dialect) : w.fail(new x.ConfigError(new S.SourceError({ message: "SQL requires a sql:name reference" }))), q), i = () => new l({
|
|
540
540
|
operation: "sql",
|
|
541
541
|
key: "",
|
|
542
542
|
cause: "SQL connection operation failed"
|
|
543
|
-
}),
|
|
543
|
+
}), a = (e) => typeof e == "object" && e && "_tag" in e && e._tag === "SqlError" ? i() : e;
|
|
544
544
|
return {
|
|
545
|
-
dialect:
|
|
546
|
-
use: (
|
|
547
|
-
stream: (
|
|
548
|
-
let
|
|
549
|
-
if (
|
|
550
|
-
let
|
|
551
|
-
|
|
552
|
-
let
|
|
553
|
-
return
|
|
545
|
+
dialect: r,
|
|
546
|
+
use: (t) => Q(e, n, "sql", (e) => e.kind === "sql" ? w.suspend(() => t(e.transport.client)).pipe(w.mapError(a)) : w.fail(i())),
|
|
547
|
+
stream: (t) => E.unwrap(w.gen(function* () {
|
|
548
|
+
let r = yield* w.acquireRelease(Z(e, n), q);
|
|
549
|
+
if (r.kind !== "sql") return E.fail(i());
|
|
550
|
+
let o = yield* b.currentTimeNanos;
|
|
551
|
+
r.commands++, O.command(r.reference), yield* w.addFinalizer(() => X(r, o));
|
|
552
|
+
let s = yield* w.scope, c = yield* w.cached(E.toPull(E.suspend(() => t(r.transport.client))).pipe(w.provideService(ge.Scope, s))), u = w.flatMap(c, (e) => e);
|
|
553
|
+
return E.fromPull(w.succeed(r.breaker(u.pipe(w.mapError(a), he.catchDone(() => w.succeed(null)))).pipe(w.tap(() => w.sync(() => O.available(r, !0))), w.tapCause(Y(r)), w.mapError((e) => e instanceof ve ? new l({
|
|
554
554
|
operation: "sql",
|
|
555
555
|
key: "",
|
|
556
|
-
cause: `Connection circuit is open; retry after ${
|
|
557
|
-
}) :
|
|
556
|
+
cause: `Connection circuit is open; retry after ${e.retryAfterMs} ms`
|
|
557
|
+
}) : e), w.flatMap((e) => e === null ? pe.done() : w.succeed(e)))));
|
|
558
558
|
}))
|
|
559
559
|
};
|
|
560
560
|
}),
|
|
561
|
-
pubsub: (
|
|
562
|
-
if (
|
|
563
|
-
if (W.stopped) return yield*
|
|
561
|
+
pubsub: (e, t) => w.gen(function* () {
|
|
562
|
+
if (e.includes(":") && !/^(redis|nats):/.test(e)) return yield* w.fail(new x.ConfigError(new S.SourceError({ message: "Pub/Sub requires a Redis or NATS reference" })));
|
|
563
|
+
if (W.stopped) return yield* w.fail(new l({
|
|
564
564
|
operation: "subscribe",
|
|
565
565
|
key: "",
|
|
566
566
|
cause: "Connection registry is closed"
|
|
567
567
|
}));
|
|
568
|
-
let
|
|
569
|
-
if (W.stopped) return yield*
|
|
568
|
+
let n = t === void 0 ? void 0 : Object.freeze({ tenantId: t.tenantId }), r = yield* e.startsWith("nats:") ? U(e, n) : H(e, n);
|
|
569
|
+
if (W.stopped) return yield* w.fail(new l({
|
|
570
570
|
operation: "subscribe",
|
|
571
571
|
key: "",
|
|
572
572
|
cause: "Connection registry is closed"
|
|
573
573
|
}));
|
|
574
|
-
if ("driver" in
|
|
574
|
+
if ("driver" in r && r.driver === "http") return yield* w.fail(new l({
|
|
575
575
|
operation: "subscribe",
|
|
576
576
|
key: "",
|
|
577
577
|
cause: "Redis Pub/Sub requires the RESP driver"
|
|
578
578
|
}));
|
|
579
|
-
let
|
|
580
|
-
|
|
579
|
+
let i = B(e, n), a = P.get(i);
|
|
580
|
+
a === void 0 && (a = {
|
|
581
581
|
channels: /* @__PURE__ */ new Map(),
|
|
582
582
|
listeners: /* @__PURE__ */ new Set(),
|
|
583
583
|
consumers: 0
|
|
584
|
-
},
|
|
585
|
-
let
|
|
586
|
-
|
|
587
|
-
let
|
|
584
|
+
}, P.set(i, a));
|
|
585
|
+
let o = a;
|
|
586
|
+
o.consumers++;
|
|
587
|
+
let s = !1, c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), d = (e) => D.updateEffect(M, (t) => w.gen(function* () {
|
|
588
588
|
if (e.released) return t;
|
|
589
|
-
e.released = !0,
|
|
590
|
-
let n =
|
|
589
|
+
e.released = !0, c.delete(e);
|
|
590
|
+
let n = o.channels.get(e.channel);
|
|
591
591
|
if (n?.delete(e.handler), n?.size === 0) {
|
|
592
|
-
|
|
593
|
-
let t =
|
|
594
|
-
t?.subscriber !== void 0 && !t.closed && (yield*
|
|
592
|
+
o.channels.delete(e.channel);
|
|
593
|
+
let t = o.current;
|
|
594
|
+
t?.subscriber !== void 0 && !t.closed && (yield* w.promise(() => t.subscriber.unsubscribe(e.channel).catch(() => {
|
|
595
595
|
J(t);
|
|
596
596
|
})));
|
|
597
597
|
}
|
|
598
598
|
return t;
|
|
599
|
-
})).pipe(
|
|
600
|
-
|
|
601
|
-
for (let e of u)
|
|
602
|
-
u.clear(), yield*
|
|
603
|
-
}).pipe(
|
|
604
|
-
try: () =>
|
|
605
|
-
catch: () => new
|
|
599
|
+
})).pipe(w.uninterruptible), f = yield* w.cached(w.gen(function* () {
|
|
600
|
+
s = !0, yield* D.update(M, (e) => e);
|
|
601
|
+
for (let e of u) o.listeners.delete(e);
|
|
602
|
+
u.clear(), yield* w.forEach([...c], d, { discard: !0 }), o.consumers--, o.consumers === 0 && P.get(i) === o && P.delete(i);
|
|
603
|
+
}).pipe(w.uninterruptible)), p = (t) => e.startsWith("nats:") ? w.try({
|
|
604
|
+
try: () => m(`${r.keyPrefix ?? ""}${t}`),
|
|
605
|
+
catch: () => new l({
|
|
606
606
|
operation: "subscribe",
|
|
607
607
|
key: "",
|
|
608
608
|
cause: "NATS channels must be exact nonempty subjects"
|
|
609
609
|
})
|
|
610
|
-
}) :
|
|
610
|
+
}) : w.void;
|
|
611
611
|
return {
|
|
612
|
-
publish: (
|
|
612
|
+
publish: (t, r) => w.suspend(() => s || W.stopped ? w.fail(new l({
|
|
613
613
|
operation: "publish",
|
|
614
614
|
key: "",
|
|
615
615
|
cause: "Pub/Sub consumer is closed"
|
|
616
|
-
})) : p(
|
|
617
|
-
try: () => Le(
|
|
618
|
-
catch: () => new
|
|
616
|
+
})) : p(t).pipe(w.andThen(w.tryPromise({
|
|
617
|
+
try: () => Le(e, n, "publish", (e) => e.kind === "nats" ? e.transport.publish(`${e.config.keyPrefix ?? ""}${t}`, r) : e.kind === "redis" ? e.client.eval(se, 0, t, r) : Promise.reject(/* @__PURE__ */ Error("Storage has no Pub/Sub"))),
|
|
618
|
+
catch: () => new l({
|
|
619
619
|
operation: "publish",
|
|
620
620
|
key: "",
|
|
621
621
|
cause: "Pub/Sub publication failed"
|
|
622
622
|
})
|
|
623
|
-
}))).pipe(
|
|
624
|
-
subscribe: (
|
|
625
|
-
if (
|
|
623
|
+
}))).pipe(w.asVoid)),
|
|
624
|
+
subscribe: (t, r) => p(t).pipe(w.andThen(w.uninterruptibleMask(() => w.acquireUseRelease(Z(e, n), () => D.modifyEffect(M, (e) => w.gen(function* () {
|
|
625
|
+
if (s || W.stopped) return yield* w.fail(new l({
|
|
626
626
|
operation: "subscribe",
|
|
627
627
|
key: "",
|
|
628
628
|
cause: "Pub/Sub consumer is closed"
|
|
629
629
|
}));
|
|
630
|
-
let
|
|
631
|
-
if (
|
|
630
|
+
let n = e.get(i);
|
|
631
|
+
if (n === void 0) return yield* w.fail(new l({
|
|
632
632
|
operation: "subscribe",
|
|
633
633
|
key: "",
|
|
634
634
|
cause: "Connection generation is unavailable"
|
|
635
635
|
}));
|
|
636
|
-
let
|
|
637
|
-
channel:
|
|
636
|
+
let a = {
|
|
637
|
+
channel: t,
|
|
638
638
|
handler: (e) => {
|
|
639
|
-
|
|
639
|
+
s || r(e);
|
|
640
640
|
},
|
|
641
641
|
released: !1
|
|
642
|
-
}, u =
|
|
643
|
-
u.add(
|
|
644
|
-
let p =
|
|
645
|
-
return yield*
|
|
646
|
-
if (yield* Ne(
|
|
647
|
-
try: () =>
|
|
648
|
-
catch: () => new
|
|
642
|
+
}, u = o.channels.get(t) ?? /* @__PURE__ */ new Set(), f = u.size === 0;
|
|
643
|
+
u.add(a.handler), o.channels.set(t, u), n.binding = o, Pe(n);
|
|
644
|
+
let p = n.subscriber !== void 0;
|
|
645
|
+
return yield* w.gen(function* () {
|
|
646
|
+
if (yield* Ne(n, o), p && f && (yield* w.tryPromise({
|
|
647
|
+
try: () => n.subscriber.subscribe(t),
|
|
648
|
+
catch: () => new l({
|
|
649
649
|
operation: "subscribe",
|
|
650
650
|
key: "",
|
|
651
651
|
cause: "Redis subscription could not be registered"
|
|
652
652
|
})
|
|
653
|
-
})),
|
|
653
|
+
})), s || W.stopped) return yield* w.fail(new l({
|
|
654
654
|
operation: "subscribe",
|
|
655
655
|
key: "",
|
|
656
656
|
cause: "Pub/Sub consumer is closed"
|
|
657
657
|
}));
|
|
658
|
-
}).pipe(
|
|
659
|
-
if (J(
|
|
660
|
-
|
|
661
|
-
let e =
|
|
662
|
-
e !== void 0 && !
|
|
663
|
-
J(
|
|
658
|
+
}).pipe(w.onError(() => w.gen(function* () {
|
|
659
|
+
if (J(n), u.delete(a.handler), u.size === 0) {
|
|
660
|
+
o.channels.delete(t);
|
|
661
|
+
let e = n.subscriber;
|
|
662
|
+
e !== void 0 && !n.closed && (yield* w.promise(() => e.unsubscribe(t).catch(() => {
|
|
663
|
+
J(n);
|
|
664
664
|
})));
|
|
665
665
|
}
|
|
666
|
-
}))),
|
|
667
|
-
})), q)).pipe(ke,
|
|
666
|
+
}))), c.add(a), [yield* w.cached(d(a)), e];
|
|
667
|
+
})), q)).pipe(ke, w.mapError(() => new l({
|
|
668
668
|
operation: "subscribe",
|
|
669
669
|
key: "",
|
|
670
670
|
cause: "Pub/Sub subscription could not be registered"
|
|
671
671
|
}))))),
|
|
672
672
|
onTransportEvent: (e) => {
|
|
673
|
-
if (
|
|
673
|
+
if (s || W.stopped) throw Error("Pub/Sub consumer is closed");
|
|
674
674
|
let t = (t) => {
|
|
675
|
-
|
|
675
|
+
s || e(t);
|
|
676
676
|
};
|
|
677
|
-
return
|
|
678
|
-
|
|
677
|
+
return o.listeners.add(t), u.add(t), () => {
|
|
678
|
+
o.listeners.delete(t), u.delete(t);
|
|
679
679
|
};
|
|
680
680
|
},
|
|
681
681
|
close: f
|
|
682
682
|
};
|
|
683
683
|
}),
|
|
684
684
|
probe: Re,
|
|
685
|
-
reload:
|
|
686
|
-
if (W.stopped) return yield*
|
|
685
|
+
reload: w.uninterruptibleMask((e) => w.gen(function* () {
|
|
686
|
+
if (W.stopped) return yield* w.fail(new l({
|
|
687
687
|
operation: "reload",
|
|
688
688
|
key: "",
|
|
689
689
|
cause: "Connection registry is closed"
|
|
690
690
|
}));
|
|
691
|
-
let
|
|
692
|
-
let n = /* @__PURE__ */ new Map(), r = yield* t(
|
|
691
|
+
let t = yield* b.currentTimeMillis, n = yield* b.currentTimeNanos, i = yield* e(D.updateEffect(M, (e) => w.uninterruptibleMask((t) => w.gen(function* () {
|
|
692
|
+
let n = /* @__PURE__ */ new Map(), r = yield* t(w.forEach([...e], ([e, t]) => Ie(t.reference, t.context, (t) => {
|
|
693
693
|
n.set(e, t);
|
|
694
|
-
}, t))).pipe(
|
|
695
|
-
if (r._tag === "Failure") return yield*
|
|
694
|
+
}, t))).pipe(w.exit);
|
|
695
|
+
if (r._tag === "Failure") return yield* w.forEach([...n.values()], G, { discard: !0 }), yield* w.failCause(r.cause);
|
|
696
696
|
for (let e of n.values()) Pe(e);
|
|
697
|
-
return yield*
|
|
698
|
-
})))).pipe(
|
|
699
|
-
sequence: ++
|
|
700
|
-
startedAt:
|
|
701
|
-
durationMs: Number(a -
|
|
697
|
+
return yield* w.forEach([...e.values()], Ae, { discard: !0 }), n;
|
|
698
|
+
})))).pipe(w.exit), a = yield* b.currentTimeNanos, o = Object.freeze({
|
|
699
|
+
sequence: ++fe,
|
|
700
|
+
startedAt: t,
|
|
701
|
+
durationMs: Number(a - n) / 1e6,
|
|
702
702
|
outcome: i._tag === "Success" ? "succeeded" : "failed"
|
|
703
703
|
});
|
|
704
|
-
if (yield*
|
|
705
|
-
|
|
704
|
+
if (yield* w.sync(() => {
|
|
705
|
+
O.rotated(o.outcome, o.durationMs);
|
|
706
706
|
try {
|
|
707
|
-
|
|
707
|
+
r.onRotation?.(o);
|
|
708
708
|
} catch {}
|
|
709
|
-
}), i._tag === "Failure") return yield*
|
|
709
|
+
}), i._tag === "Failure") return yield* w.failCause(i.cause);
|
|
710
710
|
})),
|
|
711
|
-
inspect:
|
|
711
|
+
inspect: D.get(M).pipe(w.flatMap((e) => w.forEach([...e.values()], (e) => w.gen(function* () {
|
|
712
712
|
let t = e.config;
|
|
713
713
|
return {
|
|
714
714
|
reference: e.reference,
|
|
@@ -720,7 +720,7 @@ var k = class extends w.Service()("@voltro/ConnectionRegistry") {}, A = (v = {})
|
|
|
720
720
|
errors: e.errors,
|
|
721
721
|
latencyMs: e.latencyMs,
|
|
722
722
|
state: yield* e.breaker.state,
|
|
723
|
-
source: t.source ?? (
|
|
723
|
+
source: t.source ?? (C.redis && Object.keys(C.redis).length > 0 ? "config" : "environment"),
|
|
724
724
|
...t.label === void 0 ? {} : { label: t.label },
|
|
725
725
|
...t.region === void 0 ? {} : { region: t.region },
|
|
726
726
|
..."persistence" in t && t.persistence !== void 0 ? { persistence: t.persistence } : {}
|
|
@@ -728,11 +728,11 @@ var k = class extends w.Service()("@voltro/ConnectionRegistry") {}, A = (v = {})
|
|
|
728
728
|
})))),
|
|
729
729
|
redis: {
|
|
730
730
|
client: (e) => ze(e),
|
|
731
|
-
config: (e) =>
|
|
731
|
+
config: (e) => H(e)
|
|
732
732
|
}
|
|
733
733
|
};
|
|
734
|
-
}),
|
|
735
|
-
let t = yield*
|
|
736
|
-
return
|
|
734
|
+
}), A = (e = {}) => T.effectContext(w.gen(function* () {
|
|
735
|
+
let t = yield* S.ConfigProvider, n = fe(yield* k(e), t);
|
|
736
|
+
return C.make(O, n).pipe(C.add(r, n.redis));
|
|
737
737
|
}));
|
|
738
|
-
export {
|
|
738
|
+
export { O as ConnectionRegistry, A as layerConfiguredConnections, k as makeConnectionRegistry };
|