@voltro/env 0.84.0 → 0.85.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 +549 -0
- package/THIRD-PARTY-NOTICES.md +71 -525
- package/dist/index.d.ts +2 -2
- package/dist/index.js +72 -70
- package/dist/server.js +1 -1
- package/dist/snapshot-vq9tc5Zu.js +42 -0
- package/package.json +3 -3
- package/dist/snapshot-AmznYBVm.js +0 -38
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { Schema } from 'effect';
|
|
|
10
10
|
export declare interface AnyEnvFieldSpec {
|
|
11
11
|
readonly kind: EnvFieldKind;
|
|
12
12
|
readonly access: EnvAccess;
|
|
13
|
-
readonly schema: Schema.
|
|
13
|
+
readonly schema: Schema.Top;
|
|
14
14
|
readonly tsType: string;
|
|
15
15
|
readonly optional: boolean;
|
|
16
16
|
readonly default?: string | undefined;
|
|
@@ -135,7 +135,7 @@ export declare interface EnvFieldSpec<A = unknown, Optional extends boolean = bo
|
|
|
135
135
|
/** Browser boundary classification — mandatory, no default. */
|
|
136
136
|
readonly access: EnvAccess;
|
|
137
137
|
/** effect/Schema that decodes the RAW string env value → typed `A`. */
|
|
138
|
-
readonly schema: Schema.
|
|
138
|
+
readonly schema: Schema.Codec<A, string>;
|
|
139
139
|
/**
|
|
140
140
|
* TypeScript type literal for the codegen'd typed accessors — e.g.
|
|
141
141
|
* `"string"`, `"number"`, `"'dev' | 'prod'"`. Bounded to what the
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./snapshot-
|
|
2
|
-
import {
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./snapshot-vq9tc5Zu.js";
|
|
2
|
+
import { Effect as l, Result as u, Schema as d, SchemaGetter as f, SchemaIssue as p } from "effect";
|
|
3
3
|
//#region src/define.ts
|
|
4
|
-
var
|
|
4
|
+
var m = "VOLTRO_PUBLIC_", h = (e, t) => Object.freeze({
|
|
5
5
|
vars: Object.freeze({ ...e }),
|
|
6
6
|
publicPrefix: t?.publicPrefix ?? "VOLTRO_PUBLIC_"
|
|
7
|
-
}),
|
|
7
|
+
}), g = (e) => typeof e == "object" && !!e && "vars" in e && typeof e.vars == "object" && e.vars !== null, _ = (e, t, n, r) => ({
|
|
8
8
|
kind: e,
|
|
9
9
|
access: r.access,
|
|
10
10
|
schema: t,
|
|
@@ -13,39 +13,41 @@ var f = "VOLTRO_PUBLIC_", p = (e, t) => Object.freeze({
|
|
|
13
13
|
...r.default === void 0 ? {} : { default: r.default },
|
|
14
14
|
...r.description === void 0 ? {} : { description: r.description },
|
|
15
15
|
...r.example === void 0 ? {} : { example: r.example }
|
|
16
|
-
}),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
}), v = d.String.pipe(d.decodeTo(d.Boolean, {
|
|
17
|
+
decode: f.transformEffect((e) => {
|
|
18
|
+
let t = e.trim().toLowerCase();
|
|
19
|
+
return t === "true" || t === "1" || t === "yes" || t === "on" ? l.succeed(!0) : t === "false" || t === "0" || t === "no" || t === "off" || t === "" ? l.succeed(!1) : l.fail(new p.InvalidValue({ message: `expected a boolean (true/false/1/0/yes/no/on/off), got "${e}"` }, e));
|
|
20
|
+
}),
|
|
21
|
+
encode: f.transform((e) => e ? "true" : "false")
|
|
22
|
+
})), y = (e) => URL.canParse(e), b = {
|
|
23
|
+
string: (e) => _("string", d.String, "string", e),
|
|
24
|
+
number: (e) => _("number", d.NumberFromString.pipe(d.check(d.isFinite())), "number", e),
|
|
25
|
+
port: (e) => _("port", d.NumberFromString.pipe(d.check(d.isInt()), d.check(d.isBetween({
|
|
26
|
+
minimum: 1,
|
|
27
|
+
maximum: 65535
|
|
28
|
+
}))), "number", e),
|
|
29
|
+
boolean: (e) => _("boolean", v, "boolean", e),
|
|
28
30
|
secret: (e) => {
|
|
29
31
|
let t = e.minLength ?? 32;
|
|
30
32
|
return {
|
|
31
|
-
...
|
|
33
|
+
..._("secret", d.String.pipe(d.check(d.makeFilter((e) => e.trim().length >= t || `expected at least ${t} characters — this looks like a placeholder, not a secret. Generate one with \`voltro secret generate\``))), "string", {
|
|
32
34
|
...e,
|
|
33
35
|
access: "secret"
|
|
34
36
|
}),
|
|
35
37
|
...e.generate === void 0 ? {} : { generate: e.generate }
|
|
36
38
|
};
|
|
37
39
|
},
|
|
38
|
-
url: (e) =>
|
|
39
|
-
enum: (e, t) =>
|
|
40
|
-
},
|
|
41
|
-
let r = t.schema, i = d.
|
|
42
|
-
return
|
|
40
|
+
url: (e) => _("url", d.String.pipe(d.check(d.makeFilter((e) => y(e) || `expected a valid URL, got "${e}"`))), "string", e),
|
|
41
|
+
enum: (e, t) => _("enum", d.Literals(e), e.map((e) => `'${e}'`).join(" | "), t)
|
|
42
|
+
}, x = (e, t, n) => {
|
|
43
|
+
let r = t.schema, i = d.decodeUnknownResult(r)(n);
|
|
44
|
+
return u.mapError(i, (n) => ({
|
|
43
45
|
key: e,
|
|
44
46
|
access: t.access,
|
|
45
47
|
reason: "invalid",
|
|
46
48
|
message: n.message
|
|
47
49
|
}));
|
|
48
|
-
},
|
|
50
|
+
}, S = async (e) => {
|
|
49
51
|
let t = e.readEnv ?? ((e) => process.env[e]), n = e.resolveSecret ?? ((e) => Promise.resolve(t(e))), r = {}, i = {}, a = [], o = e.contract ? Object.entries(e.contract.vars) : [];
|
|
50
52
|
for (let [e, s] of o) {
|
|
51
53
|
let o = (s.access === "secret" ? await n(e) : t(e)) ?? s.default;
|
|
@@ -58,12 +60,12 @@ var f = "VOLTRO_PUBLIC_", p = (e, t) => Object.freeze({
|
|
|
58
60
|
});
|
|
59
61
|
continue;
|
|
60
62
|
}
|
|
61
|
-
let c =
|
|
62
|
-
if (
|
|
63
|
-
a.push(c.
|
|
63
|
+
let c = x(e, s, o);
|
|
64
|
+
if (u.isFailure(c)) {
|
|
65
|
+
a.push(c.failure);
|
|
64
66
|
continue;
|
|
65
67
|
}
|
|
66
|
-
r[e] = c.
|
|
68
|
+
r[e] = c.success, s.access === "public" && (i[e] = c.success);
|
|
67
69
|
}
|
|
68
70
|
return {
|
|
69
71
|
values: r,
|
|
@@ -71,7 +73,7 @@ var f = "VOLTRO_PUBLIC_", p = (e, t) => Object.freeze({
|
|
|
71
73
|
errors: a,
|
|
72
74
|
ok: a.length === 0
|
|
73
75
|
};
|
|
74
|
-
},
|
|
76
|
+
}, C = (e, t) => {
|
|
75
77
|
let n = e?.publicPrefix;
|
|
76
78
|
if (!e || typeof n != "string") return [];
|
|
77
79
|
let r = [];
|
|
@@ -87,10 +89,10 @@ var f = "VOLTRO_PUBLIC_", p = (e, t) => Object.freeze({
|
|
|
87
89
|
message: `public env var "${i}" on a web app ships to the browser and must be named "${n}…" (e.g. "${n}${i}"). Rename it, mark it access:'secret' to keep it server-only, or set publicPrefix:false in defineEnv to opt out.`
|
|
88
90
|
});
|
|
89
91
|
return r;
|
|
90
|
-
},
|
|
92
|
+
}, w = (e) => {
|
|
91
93
|
let t = e.map((e) => ` • ${e.key} (${e.access}, ${e.reason}): ${e.message}`);
|
|
92
94
|
return `environment validation failed (${e.length} ${e.length === 1 ? "error" : "errors"}):\n${t.join("\n")}`;
|
|
93
|
-
},
|
|
95
|
+
}, T = (e) => e ? Object.entries(e.vars).map(([e, t]) => ({
|
|
94
96
|
key: e,
|
|
95
97
|
owner: "app",
|
|
96
98
|
access: t.access,
|
|
@@ -99,14 +101,14 @@ var f = "VOLTRO_PUBLIC_", p = (e, t) => Object.freeze({
|
|
|
99
101
|
...t.example === void 0 ? {} : { example: t.example },
|
|
100
102
|
...t.default === void 0 ? {} : { default: t.default },
|
|
101
103
|
kind: t.kind
|
|
102
|
-
})) : [],
|
|
104
|
+
})) : [], E = (e, t) => t ? t.map((t) => ({
|
|
103
105
|
key: t.name,
|
|
104
106
|
owner: `plugin:${e}`,
|
|
105
107
|
access: t.secret ? "secret" : "public",
|
|
106
108
|
required: t.required,
|
|
107
109
|
...t.description === void 0 ? {} : { description: t.description },
|
|
108
110
|
...t.example === void 0 ? {} : { example: t.example }
|
|
109
|
-
})) : [],
|
|
111
|
+
})) : [], D = (e, t, n, r, i) => ({
|
|
110
112
|
key: e,
|
|
111
113
|
owner: "framework",
|
|
112
114
|
access: n,
|
|
@@ -114,38 +116,38 @@ var f = "VOLTRO_PUBLIC_", p = (e, t) => Object.freeze({
|
|
|
114
116
|
description: r,
|
|
115
117
|
group: t,
|
|
116
118
|
...i === void 0 ? {} : { example: i }
|
|
117
|
-
}),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
],
|
|
119
|
+
}), O = [
|
|
120
|
+
D("NODE_ENV", "runtime", "public", "Node environment (development | production).", "development"),
|
|
121
|
+
D("PORT", "runtime", "public", "Port the api/web server binds to. Overrides app.config `port`.", "4000"),
|
|
122
|
+
D("VOLTRO_REGION", "runtime", "public", "Region tag for replica locality (else AWS_REGION/FLY_REGION/…).", "us-east-1"),
|
|
123
|
+
D("VOLTRO_AUTO_MIGRATE", "runtime", "public", "Set 0 to skip boot auto-migrate (CI-applied migrations).", "1"),
|
|
124
|
+
D("DB_DIALECT", "database", "public", "postgres | mysql | mariadb | mssql | sqlite | memory.", "postgres"),
|
|
125
|
+
D("DB_URL", "database", "secret", "Connection URL (carries credentials). Preferred over discrete DB_* fields.", "postgres://user:pw@localhost:5432/app"),
|
|
126
|
+
D("DB_HOST", "database", "public", "Database host (discrete-field form; DB_URL preferred).", "localhost"),
|
|
127
|
+
D("DB_PORT", "database", "public", "Database port.", "5432"),
|
|
128
|
+
D("DB_USER", "database", "public", "Database user.", "postgres"),
|
|
129
|
+
D("DB_PASSWORD", "database", "secret", "Database password."),
|
|
130
|
+
D("DB_DATABASE", "database", "public", "Database name.", "app"),
|
|
131
|
+
D("DB_MAX_CONNECTIONS", "database", "public", "Per-process connection pool cap.", "10"),
|
|
132
|
+
D("DB_REPLICA_URLS", "database", "secret", "Comma-separated read-replica URLs (carry credentials)."),
|
|
133
|
+
D("DB_REPLICA_REGIONS", "database", "public", "Comma-separated region tags matching DB_REPLICA_URLS order."),
|
|
134
|
+
D("RYW_STORE", "database", "public", "Read-your-writes position store: memory | redis.", "memory"),
|
|
135
|
+
D("CACHE_BACKEND", "cache", "public", "@voltro/cache backend: memory | redis.", "memory"),
|
|
136
|
+
D("CACHE_REDIS_URL", "cache", "secret", "Redis/Valkey/KeyDB/Dragonfly/Upstash URL (may carry credentials).", "redis://localhost:6379"),
|
|
137
|
+
D("CACHE_REDIS_DRIVER", "cache", "public", "resp (ioredis TCP) | http (Upstash REST, edge).", "resp"),
|
|
138
|
+
D("CACHE_REDIS_TOKEN", "cache", "secret", "Upstash REST token (http driver)."),
|
|
139
|
+
D("CACHE_KEY_PREFIX", "cache", "public", "Cache key namespace.", "voltro:cache"),
|
|
140
|
+
D("REDIS_URL", "cache", "secret", "Generic Redis URL fallback (cache / ryw / ratelimit).", "redis://localhost:6379"),
|
|
141
|
+
D("VOLTRO_SESSION_SECRET", "security", "secret", "HMAC signing key for session cookies. REQUIRED in production."),
|
|
142
|
+
D("VOLTRO_INSPECT", "security", "public", "Set off to disable the /_voltro/inspect surface entirely.", "on"),
|
|
143
|
+
D("VOLTRO_INSPECT_TOKEN", "security", "secret", "Bearer token gating /_voltro/inspect/* on public deploys."),
|
|
144
|
+
D("VOLTRO_WEB_REPLICA_GROUP", "observability", "public", "Deployment-specific Web/SSR replica discovery group in PostgreSQL. Use a distinct value per app and environment."),
|
|
145
|
+
D("VOLTRO_TENANT_ISOLATION", "security", "public", "shared-schema (default) | namespace (physical per-tenant)."),
|
|
146
|
+
D("FRAMEWORK_TRACING", "observability", "public", "off | console | otlp. Auto-otlp when OTEL_* is set."),
|
|
147
|
+
D("OTEL_EXPORTER_OTLP_ENDPOINT", "observability", "public", "OTLP/HTTP collector endpoint (traces + metrics).", "http://localhost:4318"),
|
|
148
|
+
D("OTEL_SERVICE_NAME", "observability", "public", "OTel service name.", "voltro-api"),
|
|
149
|
+
D("SSR_CACHE", "web", "public", "ISR cache backend for `voltro start`: memory | postgres.", "memory")
|
|
150
|
+
], k = () => O.map((e) => e.key), A = (e) => {
|
|
149
151
|
let t = [];
|
|
150
152
|
e.description && t.push(`# ${e.description}`);
|
|
151
153
|
let n = [
|
|
@@ -156,17 +158,17 @@ var f = "VOLTRO_PUBLIC_", p = (e, t) => Object.freeze({
|
|
|
156
158
|
t.push(`# (${n})`);
|
|
157
159
|
let r = e.example ?? e.default ?? "";
|
|
158
160
|
return t.push(`${e.key}=${e.access === "secret" && !e.example ? "" : r}`), t.join("\n");
|
|
159
|
-
},
|
|
161
|
+
}, j = (e, t = {}) => {
|
|
160
162
|
let n = [], r = t.header ?? ["Environment for this app — generated from app.config.ts `env` + plugin declarations.", "Regenerate with `voltro env sync`. Copy to `.env` and fill in the blanks."];
|
|
161
163
|
n.push(...r.map((e) => `# ${e}`), "");
|
|
162
164
|
let i = e.filter((e) => e.owner === "app"), a = e.filter((e) => e.owner.startsWith("plugin:"));
|
|
163
|
-
if (i.length > 0 && (n.push("# ── App ──────────────────────────────────────────────", ""), n.push(...i.map(
|
|
164
|
-
let e = [...new Set(
|
|
165
|
+
if (i.length > 0 && (n.push("# ── App ──────────────────────────────────────────────", ""), n.push(...i.map(A).flatMap((e) => [e, ""]))), a.length > 0 && (n.push("# ── Plugins ──────────────────────────────────────────", ""), n.push(...a.map(A).flatMap((e) => [e, ""]))), t.includeFramework !== !1) {
|
|
166
|
+
let e = [...new Set(O.map((e) => e.group))];
|
|
165
167
|
n.push("# ── Framework ────────────────────────────────────────", "");
|
|
166
|
-
for (let t of e) n.push(`# [${t}]`), n.push(...
|
|
168
|
+
for (let t of e) n.push(`# [${t}]`), n.push(...O.filter((e) => e.group === t).map(A).flatMap((e) => [e, ""]));
|
|
167
169
|
}
|
|
168
170
|
return n.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n";
|
|
169
|
-
},
|
|
171
|
+
}, M = (e) => {
|
|
170
172
|
let t = new Set(e.map((e) => e.name));
|
|
171
173
|
return {
|
|
172
174
|
declared: e,
|
|
@@ -177,4 +179,4 @@ var f = "VOLTRO_PUBLIC_", p = (e, t) => Object.freeze({
|
|
|
177
179
|
};
|
|
178
180
|
};
|
|
179
181
|
//#endregion
|
|
180
|
-
export {
|
|
182
|
+
export { m as DEFAULT_PUBLIC_PREFIX, O as FRAMEWORK_ENV_CATALOG, T as appEnvEntries, C as checkEnvNaming, h as defineEnv, b as envVar, w as formatEnvErrors, k as frameworkEnvNames, c as hasEnvSnapshot, i as hasLiveOverlap, o as installEnvSnapshot, g as isEnvContract, M as pluginEnv, E as pluginEnvEntries, n as readEnvValue, e as readEnvValuePrevious, a as refreshEnvValue, j as renderDotEnvExample, s as requireEnvValue, t as resetEnvSnapshot, S as resolveEnv, r as setEnvClock };
|
package/dist/server.js
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/snapshot.ts
|
|
2
|
+
var e = Symbol.for("@voltro/env/state"), t = globalThis[e] ??= {
|
|
3
|
+
snapshot: null,
|
|
4
|
+
live: null,
|
|
5
|
+
clock: () => Date.now()
|
|
6
|
+
}, n = (e) => {
|
|
7
|
+
t.snapshot = Object.freeze({ ...e }), t.live = null;
|
|
8
|
+
}, r = () => t.snapshot !== null, i = (e) => {
|
|
9
|
+
let n = t.live?.get(e);
|
|
10
|
+
return n === void 0 ? t.snapshot === null ? void 0 : t.snapshot[e] : n.value;
|
|
11
|
+
}, a = (e) => {
|
|
12
|
+
let n = t.live?.get(e);
|
|
13
|
+
if (n !== void 0) return n.value;
|
|
14
|
+
if (t.snapshot === null) throw Error(`@voltro/env: read of "${e}" before the boot env gate ran. Env values are only available after the framework validates them at startup — read them inside a handler / loader / startup hook, not at module top-level.`);
|
|
15
|
+
return t.snapshot[e];
|
|
16
|
+
}, o = (e, n, r) => {
|
|
17
|
+
if (t.snapshot === null) throw Error(`@voltro/env: refreshEnvValue("${e}") before the boot env gate ran. A live secret rotation is a post-boot operation — it replaces a value the boot gate already resolved.`);
|
|
18
|
+
t.live === null && (t.live = /* @__PURE__ */ new Map());
|
|
19
|
+
let i = r?.previous !== void 0 && r.graceMs !== void 0 && r.graceMs > 0;
|
|
20
|
+
t.live.set(e, {
|
|
21
|
+
value: n,
|
|
22
|
+
...i ? {
|
|
23
|
+
previous: r.previous,
|
|
24
|
+
previousExpiresAt: t.clock() + r.graceMs
|
|
25
|
+
} : {}
|
|
26
|
+
});
|
|
27
|
+
}, s = (e) => {
|
|
28
|
+
let n = t.live?.get(e);
|
|
29
|
+
if (n !== void 0 && n.previousExpiresAt !== void 0) {
|
|
30
|
+
if (t.clock() >= n.previousExpiresAt) {
|
|
31
|
+
t.live.set(e, { value: n.value });
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
return n.previous;
|
|
35
|
+
}
|
|
36
|
+
}, c = (e) => s(e) !== void 0, l = (e) => {
|
|
37
|
+
t.clock = e;
|
|
38
|
+
}, u = () => {
|
|
39
|
+
t.snapshot = null, t.live = null, t.clock = () => Date.now();
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { s as a, u as c, i, l, c as n, o, n as r, a as s, r as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/env",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"description": "Typed, schema-validated environment variables with a structural public/secret boundary. Declare once in app.config.ts; read public vars in the browser, secrets only on the server.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"node": ">=24.0.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@voltro/runtime": "0.
|
|
46
|
+
"@voltro/runtime": "0.85.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"effect": "
|
|
49
|
+
"effect": "4.0.1"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
//#region src/snapshot.ts
|
|
2
|
-
var e = null, t = null, n = () => Date.now(), r = (n) => {
|
|
3
|
-
e = Object.freeze({ ...n }), t = null;
|
|
4
|
-
}, i = () => e !== null, a = (n) => {
|
|
5
|
-
let r = t?.get(n);
|
|
6
|
-
return r === void 0 ? e === null ? void 0 : e[n] : r.value;
|
|
7
|
-
}, o = (n) => {
|
|
8
|
-
let r = t?.get(n);
|
|
9
|
-
if (r !== void 0) return r.value;
|
|
10
|
-
if (e === null) throw Error(`@voltro/env: read of "${n}" before the boot env gate ran. Env values are only available after the framework validates them at startup — read them inside a handler / loader / startup hook, not at module top-level.`);
|
|
11
|
-
return e[n];
|
|
12
|
-
}, s = (r, i, a) => {
|
|
13
|
-
if (e === null) throw Error(`@voltro/env: refreshEnvValue("${r}") before the boot env gate ran. A live secret rotation is a post-boot operation — it replaces a value the boot gate already resolved.`);
|
|
14
|
-
t === null && (t = /* @__PURE__ */ new Map());
|
|
15
|
-
let o = a?.previous !== void 0 && a.graceMs !== void 0 && a.graceMs > 0;
|
|
16
|
-
t.set(r, {
|
|
17
|
-
value: i,
|
|
18
|
-
...o ? {
|
|
19
|
-
previous: a.previous,
|
|
20
|
-
previousExpiresAt: n() + a.graceMs
|
|
21
|
-
} : {}
|
|
22
|
-
});
|
|
23
|
-
}, c = (e) => {
|
|
24
|
-
let r = t?.get(e);
|
|
25
|
-
if (r !== void 0 && r.previousExpiresAt !== void 0) {
|
|
26
|
-
if (n() >= r.previousExpiresAt) {
|
|
27
|
-
t.set(e, { value: r.value });
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
return r.previous;
|
|
31
|
-
}
|
|
32
|
-
}, l = (e) => c(e) !== void 0, u = (e) => {
|
|
33
|
-
n = e;
|
|
34
|
-
}, d = () => {
|
|
35
|
-
e = null, t = null, n = () => Date.now();
|
|
36
|
-
};
|
|
37
|
-
//#endregion
|
|
38
|
-
export { c as a, d as c, a as i, u as l, l as n, s as o, r, o as s, i as t };
|