@luckystack/core 0.7.6 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/CLAUDE.md +7 -5
- package/dist/{chunk-DVGSWLLS.js → chunk-6HGH6S36.js} +2 -2
- package/dist/{chunk-DVGSWLLS.js.map → chunk-6HGH6S36.js.map} +1 -1
- package/dist/{chunk-AFG7KKMS.js → chunk-6K7MAXMT.js} +48 -33
- package/dist/{chunk-AFG7KKMS.js.map → chunk-6K7MAXMT.js.map} +1 -1
- package/dist/{chunk-J3UOWYT4.js → chunk-I4R7DMIX.js} +2 -2
- package/dist/{chunk-LTCDQU5Z.js → chunk-RH65K3US.js} +4 -1
- package/dist/{chunk-LTCDQU5Z.js.map → chunk-RH65K3US.js.map} +1 -1
- package/dist/client.d.ts +25 -4
- package/dist/client.js +223 -15
- package/dist/client.js.map +1 -1
- package/dist/{config-Dl2CBINY.d.ts → config-DV8DGNt6.d.ts} +7 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.js +2 -2
- package/dist/index.d.ts +11 -6
- package/dist/index.js +31 -8
- package/dist/index.js.map +1 -1
- package/dist/{pageRouteValidation-CWkPqPW3.d.ts → pageRouteValidation-bz2LFVQq.d.ts} +7 -7
- package/dist/{projectConfig-DBLSQ3NY.js → projectConfig-PB5VK5AD.js} +2 -2
- package/dist/{sentrySetup-MF6JSVWA.js → sentrySetup-G7NGISBY.js} +3 -3
- package/dist/{sessionTypes-Dzen_rPK.d.ts → sessionTypes-iyUMf_pf.d.ts} +12 -1
- package/docs/app-bootstrap.md +3 -2
- package/docs/session-types.md +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-J3UOWYT4.js.map → chunk-I4R7DMIX.js.map} +0 -0
- /package/dist/{projectConfig-DBLSQ3NY.js.map → projectConfig-PB5VK5AD.js.map} +0 -0
- /package/dist/{sentrySetup-MF6JSVWA.js.map → sentrySetup-G7NGISBY.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
tryCatchSync,
|
|
50
50
|
validatePagePath,
|
|
51
51
|
waitForSocket
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-6K7MAXMT.js";
|
|
53
53
|
import {
|
|
54
54
|
getDeployConfig,
|
|
55
55
|
getServicesConfig,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
registerDeployConfig,
|
|
60
60
|
registerSecretsResolvedListener,
|
|
61
61
|
registerServicesConfig
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-6HGH6S36.js";
|
|
63
63
|
import {
|
|
64
64
|
DEFAULT_REDACTED_LOG_KEYS,
|
|
65
65
|
DEPTH_TRUNCATED_PLACEHOLDER,
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
startSpan,
|
|
94
94
|
startSpanAcrossTrackers,
|
|
95
95
|
startSpanHandle
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-I4R7DMIX.js";
|
|
97
97
|
import {
|
|
98
98
|
DEFAULT_PROJECT_CONFIG,
|
|
99
99
|
createRegistry,
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
isPlainObject,
|
|
104
104
|
isProjectConfigRegistered,
|
|
105
105
|
registerProjectConfig
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-RH65K3US.js";
|
|
107
107
|
|
|
108
108
|
// src/escapeHtml.ts
|
|
109
109
|
var HTML_ESCAPE_MAP = {
|
|
@@ -491,6 +491,12 @@ var bootstrapEnv = () => {
|
|
|
491
491
|
var env = bootstrapEnv();
|
|
492
492
|
var isProduction = env.NODE_ENV === "production";
|
|
493
493
|
var getEnv = () => bootstrapEnv();
|
|
494
|
+
var resolveRuntimeMode = () => {
|
|
495
|
+
const mode = process.env.NODE_ENV;
|
|
496
|
+
return mode === "production" || mode === "test" || mode === "development" ? mode : getEnv().NODE_ENV;
|
|
497
|
+
};
|
|
498
|
+
var isProductionRuntime = () => resolveRuntimeMode() === "production";
|
|
499
|
+
var isTestRuntime = () => resolveRuntimeMode() === "test";
|
|
494
500
|
|
|
495
501
|
// src/db.ts
|
|
496
502
|
import { createRequire as createRequire2 } from "module";
|
|
@@ -1236,7 +1242,7 @@ var getBindAddress = () => {
|
|
|
1236
1242
|
};
|
|
1237
1243
|
var defaultPortForProtocol = (protocol) => protocol === "https:" ? "443" : "80";
|
|
1238
1244
|
var resolveDevCallbackUrl = (callbackUrl) => {
|
|
1239
|
-
if (
|
|
1245
|
+
if (isProductionRuntime()) return callbackUrl;
|
|
1240
1246
|
let url;
|
|
1241
1247
|
try {
|
|
1242
1248
|
url = new URL(callbackUrl);
|
|
@@ -1676,7 +1682,7 @@ var getRateLimitStatus = async (key, limit) => {
|
|
|
1676
1682
|
};
|
|
1677
1683
|
var clearRateLimit = async (key) => strategyRegistry.get().clear(key);
|
|
1678
1684
|
var clearAllRateLimits = async () => {
|
|
1679
|
-
if (
|
|
1685
|
+
if (isProductionRuntime()) {
|
|
1680
1686
|
throw new Error("[RateLimiter] clearAllRateLimits() is not allowed in production. Use clearRateLimit(key) for scoped resets.");
|
|
1681
1687
|
}
|
|
1682
1688
|
return strategyRegistry.get().clearAll();
|
|
@@ -1865,6 +1871,16 @@ var isPrimitiveMatch = (type, value) => {
|
|
|
1865
1871
|
if (type === "Date") return value instanceof Date || typeof value === "string" && !Number.isNaN(Date.parse(value));
|
|
1866
1872
|
return false;
|
|
1867
1873
|
};
|
|
1874
|
+
var parseFiniteNumericLiteral = (type) => {
|
|
1875
|
+
const normalized = type.replaceAll("_", "");
|
|
1876
|
+
const decimal = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
1877
|
+
const nonDecimal = /^-?0(?:x[\da-f]+|b[01]+|o[0-7]+)$/i;
|
|
1878
|
+
if (!decimal.test(normalized) && !nonDecimal.test(normalized)) return null;
|
|
1879
|
+
const negative = normalized.startsWith("-");
|
|
1880
|
+
const unsigned = negative ? normalized.slice(1) : normalized;
|
|
1881
|
+
const parsed = Number(unsigned) * (negative ? -1 : 1);
|
|
1882
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
1883
|
+
};
|
|
1868
1884
|
var isPrimitiveType = (type) => {
|
|
1869
1885
|
return ["string", "number", "boolean", "true", "false", "null", "undefined", "Date"].includes(type);
|
|
1870
1886
|
};
|
|
@@ -1943,6 +1959,10 @@ var validateType = (typeText, value, path4, depth = 0) => {
|
|
|
1943
1959
|
const literal = type.slice(1, -1);
|
|
1944
1960
|
return value === literal ? { status: "success" } : { status: "error", message: `${path4} should equal ${literal}` };
|
|
1945
1961
|
}
|
|
1962
|
+
const numericLiteral = parseFiniteNumericLiteral(type);
|
|
1963
|
+
if (numericLiteral !== null) {
|
|
1964
|
+
return typeof value === "number" && value === numericLiteral ? { status: "success" } : { status: "error", message: `${path4} should equal ${type}` };
|
|
1965
|
+
}
|
|
1946
1966
|
if (isPrimitiveMatch(type, value)) {
|
|
1947
1967
|
return { status: "success" };
|
|
1948
1968
|
}
|
|
@@ -2042,8 +2062,8 @@ var validateInputByType = async ({
|
|
|
2042
2062
|
if (!typeText || typeText.trim() === "" || typeText.trim() === "any") {
|
|
2043
2063
|
return { status: "success" };
|
|
2044
2064
|
}
|
|
2045
|
-
if (
|
|
2046
|
-
const { getProjectConfig: getProjectConfig2 } = await import("./projectConfig-
|
|
2065
|
+
if (isProductionRuntime()) {
|
|
2066
|
+
const { getProjectConfig: getProjectConfig2 } = await import("./projectConfig-PB5VK5AD.js");
|
|
2047
2067
|
if (getProjectConfig2().validation.runtimeMode === "off") {
|
|
2048
2068
|
return { status: "success" };
|
|
2049
2069
|
}
|
|
@@ -2363,12 +2383,14 @@ export {
|
|
|
2363
2383
|
isPrismaClientRegistered,
|
|
2364
2384
|
isPrismaClientResolvable,
|
|
2365
2385
|
isProduction,
|
|
2386
|
+
isProductionRuntime,
|
|
2366
2387
|
isProjectConfigRegistered,
|
|
2367
2388
|
isRedactedLogKey,
|
|
2368
2389
|
isRedisClientRegistered,
|
|
2369
2390
|
isRuntimeMapsProviderRegistered,
|
|
2370
2391
|
isServicesConfigRegistered,
|
|
2371
2392
|
isSessionProviderRegistered,
|
|
2393
|
+
isTestRuntime,
|
|
2372
2394
|
issueOneTimeToken,
|
|
2373
2395
|
listEmailSenderNames,
|
|
2374
2396
|
loadEnvFiles,
|
|
@@ -2445,6 +2467,7 @@ export {
|
|
|
2445
2467
|
resolveFromRoot,
|
|
2446
2468
|
resolveHealthHashConfig,
|
|
2447
2469
|
resolveHealthHashConfigFromDescriptor,
|
|
2470
|
+
resolveRuntimeMode,
|
|
2448
2471
|
runWithErrorTrackerIdentity,
|
|
2449
2472
|
runWithErrorTrackerIdentityScope,
|
|
2450
2473
|
sanitizeErrorString,
|