@luckystack/core 0.7.1 → 0.7.3
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 +41 -0
- package/CLAUDE.md +2 -0
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/{pageRouteValidation-sJJCX-YV.d.ts → pageRouteValidation-CWkPqPW3.d.ts} +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.3] - 2026-07-20
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`resolveDevCallbackUrl(callbackUrl)`** — rewrites the port of a `localhost` /
|
|
15
|
+
`127.0.0.1` OAuth callback URL to the port the server ACTUALLY bound
|
|
16
|
+
(`getBindAddress()`), so OAuth targets the live dev server after an
|
|
17
|
+
auto-increment hop. No-op in production and for non-localhost bases. Consumed by
|
|
18
|
+
`@luckystack/server` (authorize) + `@luckystack/login` (token exchange), which
|
|
19
|
+
both call it so the two `redirect_uri` values stay byte-identical.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **`registerBindAddress` is now registered twice** — once with the intended port
|
|
24
|
+
before `listen`, once with the actually-bound port inside the listen callback
|
|
25
|
+
(done by `@luckystack/server`). This makes `getBindAddress()` truthful after a
|
|
26
|
+
dev auto-increment hop, which `checkOrigin`'s same-origin CORS entry (and now
|
|
27
|
+
`resolveDevCallbackUrl`) depend on.
|
|
28
|
+
|
|
29
|
+
## [0.7.2] - 2026-07-18
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- **`tryCatchSync` is now exported from `@luckystack/core/client`.** It was
|
|
34
|
+
already being shipped to the browser (`offlineQueue`'s drop handler and
|
|
35
|
+
`apiRequest` both call it) and is safe there — the module has zero imports and,
|
|
36
|
+
unlike the async `tryCatch`, deliberately does not auto-capture to the error
|
|
37
|
+
tracker. Only the export line was missing, so client code could see it in the
|
|
38
|
+
bundle but not import it. Consumers can drop a local `shared/tryCatchSync.ts`
|
|
39
|
+
shim and `import { tryCatchSync } from '@luckystack/core/client'`.
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- **Barrel-parity guard (`barrelParity.test.ts`).** Fails when a helper that is
|
|
44
|
+
already reachable from the `/client` import graph is exported by the server
|
|
45
|
+
barrel but not by the client barrel — the bug class above. Scoped to modules
|
|
46
|
+
that genuinely ship to the browser (a blanket "must be in both" rule would flag
|
|
47
|
+
60+ deliberately server-only APIs), and matched on the exported NAME so the
|
|
48
|
+
intentional `tryCatch` → `tryCatchClient` split still passes. Deliberate
|
|
49
|
+
omissions live in a documented `DELIBERATELY_SERVER_ONLY` list.
|
|
50
|
+
|
|
10
51
|
## [0.7.0] - 2026-07-16
|
|
11
52
|
|
|
12
53
|
### Added
|
package/CLAUDE.md
CHANGED
|
@@ -192,6 +192,8 @@ Foundation package for LuckyStack. Owns the socket-first transport contracts (`a
|
|
|
192
192
|
|
|
193
193
|
Imported from `@luckystack/core/client` (the server barrel intentionally does NOT export these): `apiRequest`, `syncRequest` + sync-callback helpers, the offline-queue API, `registerClientHook` (returns an unsubscribe) + `ClientHookPayloadMap` (`preLogin`/`postLogin`/`postLogout`/`queueItemDropped`), `useTheme`, the `TranslationProvider` + i18n registry, `SessionProvider`/session context, `registerMiddlewareHandler`/`registerPageMiddleware`, and the CSRF-aware `httpFetch`.
|
|
194
194
|
|
|
195
|
+
Shared helpers available from BOTH barrels: `sleep`, `tryCatch`, `tryCatchSync`. Note `tryCatch` resolves to a different implementation per barrel — the client gets `tryCatchClient`, which lazy-imports the capture seam so `node:async_hooks` never enters a Vite bundle. `tryCatchSync` needs no such split (it has zero imports and deliberately does not auto-capture). `barrelParity.test.ts` fails the build if another browser-shipped helper is exported server-side but forgotten on `/client`.
|
|
196
|
+
|
|
195
197
|
### `./eslint` subpath
|
|
196
198
|
|
|
197
199
|
`@luckystack/core/eslint` exposes the shared ESLint rule set (the CLAUDE.md-invariant rules). Requires the optional `eslint@^9.0.0` peer.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StreamPayload, ApiTypeMap } from './apiTypeStubs.js';
|
|
2
2
|
export { SyncTypeMap } from './apiTypeStubs.js';
|
|
3
|
-
export { A as ApiMethodMap, D as DEFAULT_PAGE_ROUTE_RULES, H as HttpMethodLiteral, L as Logger, a as LoggerContext, N as Notifier, b as NotifyInput, c as NotifyParam, P as PagePathValidationResult, d as PageRouteRules, S as SOCKETSTATUS, e as buildApiResponseEventName, f as buildApiStreamEventName, g as buildGetJoinedRoomsResponseEventName, h as buildJoinRoomResponseEventName, i as buildLeaveRoomResponseEventName, j as buildSyncProgressEventName, k as buildSyncResponseEventName, l as clearCsrfToken, m as enqueueApiRequest, n as enqueueSyncRequest, o as flushApiQueue, p as flushSyncQueue, q as getApiQueueSize, r as getCsrfToken, s as getLogger, t as getNotifier, u as getRegisteredApiMethod, v as getSyncQueueSize, w as httpFetch, x as incrementResponseIndex, y as isApiMethodMapRegistered, z as isOnline, B as normalizeErrorResponseCore, C as notify, E as parseServiceRouteName, F as registerApiMethodMap, G as registerLogger, I as registerNotifier, J as removeApiQueueItem, K as removeApiQueueItemsByKey, M as removeSyncQueueItem, O as setSocket, Q as sleep, R as socket, T as socketEventNames, U as statusContent, V as
|
|
3
|
+
export { A as ApiMethodMap, D as DEFAULT_PAGE_ROUTE_RULES, H as HttpMethodLiteral, L as Logger, a as LoggerContext, N as Notifier, b as NotifyInput, c as NotifyParam, P as PagePathValidationResult, d as PageRouteRules, S as SOCKETSTATUS, e as buildApiResponseEventName, f as buildApiStreamEventName, g as buildGetJoinedRoomsResponseEventName, h as buildJoinRoomResponseEventName, i as buildLeaveRoomResponseEventName, j as buildSyncProgressEventName, k as buildSyncResponseEventName, l as clearCsrfToken, m as enqueueApiRequest, n as enqueueSyncRequest, o as flushApiQueue, p as flushSyncQueue, q as getApiQueueSize, r as getCsrfToken, s as getLogger, t as getNotifier, u as getRegisteredApiMethod, v as getSyncQueueSize, w as httpFetch, x as incrementResponseIndex, y as isApiMethodMapRegistered, z as isOnline, B as normalizeErrorResponseCore, C as notify, E as parseServiceRouteName, F as registerApiMethodMap, G as registerLogger, I as registerNotifier, J as removeApiQueueItem, K as removeApiQueueItemsByKey, M as removeSyncQueueItem, O as setSocket, Q as sleep, R as socket, T as socketEventNames, U as statusContent, V as tryCatchSync, W as validatePagePath, X as waitForSocket } from './pageRouteValidation-CWkPqPW3.js';
|
|
4
4
|
import { B as BaseSessionLayout } from './sessionTypes-Dzen_rPK.js';
|
|
5
5
|
export { A as AppConfig, a as AuthProps, L as LoggingConfig, P as ProjectConfig, R as RateLimitingConfig, S as SessionConfig, b as SessionLocation, g as getProjectConfig, i as isProjectConfigRegistered, r as registerProjectConfig } from './sessionTypes-Dzen_rPK.js';
|
|
6
6
|
import * as react from 'react';
|
package/dist/client.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ApiMethodMap, D as DEFAULT_PAGE_ROUTE_RULES, H as HttpMethodLiteral,
|
|
1
|
+
import { Y as ErrorParam, Z as ErrorResponseInput, _ as NormalizedErrorResponse } from './pageRouteValidation-CWkPqPW3.js';
|
|
2
|
+
export { A as ApiMethodMap, D as DEFAULT_PAGE_ROUTE_RULES, H as HttpMethodLiteral, $ as INVALID_ERROR_RESPONSE_CODE, L as Logger, a as LoggerContext, N as Notifier, b as NotifyInput, c as NotifyParam, P as PagePathValidationResult, d as PageRouteRules, a0 as QueueDropReason, S as SOCKETSTATUS, a1 as ServiceRouteParseError, a2 as ServiceRouteParseResult, a3 as ServiceRouteParseSuccess, a4 as TransportRouteParseError, a5 as TransportRouteParseResult, a6 as TransportRouteParseSuccess, e as buildApiResponseEventName, f as buildApiStreamEventName, g as buildGetJoinedRoomsResponseEventName, h as buildJoinRoomResponseEventName, i as buildLeaveRoomResponseEventName, j as buildSyncProgressEventName, k as buildSyncResponseEventName, l as clearCsrfToken, a7 as createDevLogger, a8 as defaultHttpStatusForResponse, m as enqueueApiRequest, n as enqueueSyncRequest, o as flushApiQueue, p as flushSyncQueue, q as getApiQueueSize, r as getCsrfToken, s as getLogger, t as getNotifier, u as getRegisteredApiMethod, v as getSyncQueueSize, w as httpFetch, x as incrementResponseIndex, y as isApiMethodMapRegistered, a9 as isErrorParamArray, aa as isLoggerRegistered, z as isOnline, B as normalizeErrorResponseCore, C as notify, E as parseServiceRouteName, ab as parseTransportRouteName, F as registerApiMethodMap, G as registerLogger, I as registerNotifier, J as removeApiQueueItem, K as removeApiQueueItemsByKey, M as removeSyncQueueItem, ac as resetLoggerForTests, O as setSocket, Q as sleep, R as socket, T as socketEventNames, U as statusContent, V as tryCatchSync, W as validatePagePath, X as waitForSocket } from './pageRouteValidation-CWkPqPW3.js';
|
|
3
3
|
import { H as HealthHashConfig, D as DeepPartial, B as BaseSessionLayout, a as AuthProps } from './sessionTypes-Dzen_rPK.js';
|
|
4
4
|
export { c as ApiConfig, A as AppConfig, d as AuthConfig, e as AuthRateLimitConfig, C as CorsConfig, f as DEFAULT_PROJECT_CONFIG, h as DevConfig, j as HttpConfig, k as HttpStreamConfig, J as Jsonify, L as LoggingConfig, O as OfflineQueueConfig, l as PasswordPolicyConfig, m as PathsConfig, P as ProjectConfig, n as ProjectConfigInput, o as RateLimitIdentity, p as RateLimitIdentityParams, R as RateLimitingConfig, q as SecurityHeadersConfig, S as SessionConfig, b as SessionLocation, s as SocketConfig, t as SyncConfig, u as SyncFlushPressureConfig, v as SyncStreamThrottleConfig, V as ValidationConfig, w as deepMerge, g as getProjectConfig, x as getProjectName, y as isPlainObject, i as isProjectConfigRegistered, r as registerProjectConfig } from './sessionTypes-Dzen_rPK.js';
|
|
5
5
|
export { ApiTypeMap, StreamPayload, SyncTypeMap } from './apiTypeStubs.js';
|
|
@@ -16,8 +16,6 @@ import 'socket.io-client';
|
|
|
16
16
|
|
|
17
17
|
declare function tryCatch<T, P = void>(func: (values: P) => Promise<T> | T, params?: P, context?: Record<string, unknown>): Promise<[Error | null, T | null]>;
|
|
18
18
|
|
|
19
|
-
declare function tryCatchSync<T, P = void>(func: (values: P) => T, params?: P): [Error | null, T | null];
|
|
20
|
-
|
|
21
19
|
type RequireTransform<TInput, TStored> = [TInput] extends [TStored] ? {
|
|
22
20
|
transform?: (input: TInput, current: TStored) => TStored;
|
|
23
21
|
} : {
|
|
@@ -952,6 +950,7 @@ declare const getBindAddress: () => {
|
|
|
952
950
|
ip: string;
|
|
953
951
|
port: string;
|
|
954
952
|
};
|
|
953
|
+
declare const resolveDevCallbackUrl: (callbackUrl: string) => string;
|
|
955
954
|
|
|
956
955
|
interface AvatarConfig {
|
|
957
956
|
/**
|
|
@@ -1767,4 +1766,4 @@ declare const clearAllHooks: () => void;
|
|
|
1767
1766
|
declare const registerSyncHook: <TName extends SyncHookName>(name: TName, handler: SyncHookHandler<SyncHookPayloads[TName]>) => (() => void);
|
|
1768
1767
|
declare const dispatchSyncHook: <TName extends SyncHookName>(name: TName, payload: SyncHookPayloads[TName]) => void;
|
|
1769
1768
|
|
|
1770
|
-
export { type ApiAuthRejectedPayload, type ApiErrorPayload, type ApiResponseEnvelope, AuthProps, type AvatarConfig, type AvatarConfigInput, BOOT_KEY_PREFIX, BaseSessionLayout, type CheckRateLimitParams, type CookiePrefixConstraints, type CorsRejectedPayload, type CreateLocalizedNormalizerInput, type CsrfConfig, type CsrfCookieOptions, type CsrfMismatchPayload, DEFAULT_AVATAR_CONFIG, DEFAULT_CLIENT_KEY, DEFAULT_CSRF_CONFIG, DEFAULT_ENV_FILES, DEFAULT_REDACTED_LOG_KEYS, DEPTH_TRUNCATED_PLACEHOLDER, type DbHealthCheck, type DbHealthResult, DeepPartial, type DispatchResult, type EmailAttachment, type EmailMessage, type EmailResult, type EmailSender, type EmailSenderRegistry, type ErrorFormatter, type ErrorFormatterContext, ErrorParam, ErrorResponseInput, type ErrorTracker, type ErrorTrackerContext, type ErrorTrackerEvent, type ErrorTrackerUser, type FormatterEnvelope, GENERATED_API_DOCS_PATH, GENERATED_API_SCHEMAS_PATH, GENERATED_SOCKET_TYPES_PATH, HealthHashConfig, type HealthHashDescriptor, type HookHandler, type HookName, type HookPayloads, type HookResult, type HookSessionShape, type HookStopSignal, type HttpMethod, type LanguageCode, type LocaleReloader, type LocalizedNormalizer, type NormalizeErrorResponseInput, NormalizedErrorResponse, type OnUploadCompletePayload, type OnUploadStartPayload, type OneTimeTokenHandle, PUBLIC_DIR, type PeerRequire, type PostApiExecutePayload, type PostApiRespondPayload, type PostApiValidatePayload, type PostAvatarServePayload, type PostErrorNormalizePayload, type PostHttpRequestPayload, type PostSessionRefreshPayload, type PostSyncAuthorizePayload, type PostSyncExecutePayload, type PostSyncFanoutPayload, type PostSyncValidatePayload, type PreApiExecutePayload, type PreApiRespondPayload, type PreApiValidatePayload, type PreAvatarServePayload, type PreCaptureFilter, type PreErrorNormalizePayload, type PreHttpRequestPayload, type PreServerStopPayload, type PreSessionRefreshPayload, type PreSocketMessagePayload, type PreSyncAuthorizePayload, type PreSyncExecutePayload, type PreSyncFanoutPayload, type PreSyncRecipientPayload, type PreSyncValidatePayload, type ProcessUploadInput, type ProcessUploadResult, REDACTED_PLACEHOLDER, ROOT_DIR, type RateLimitExceededPayload, type RateLimitResult, type RateLimitStrategy, type RedisConnectionOptions, type RedisKeyFormatter, type Registry, type RegistryOptions, type ResolveClientIpParams, type RoomNameFormatter, type RoomNameFormatterContext, type RuntimeApiMapsResult, type RuntimeEnv, type RuntimeMapsProvider, type RuntimeSyncMapsResult, SERVER_DIR, SERVER_FUNCTIONS_DIR, SHARED_DIR, SRC_DIR, type SessionCreatedPayload, type SessionLogoutInput, type SessionProvider, type SessionRevokedPayload, type SessionSaveResult, type SocketMiddleware, type SpanHandle, type SpanResult, type SyncErrorPayload, type SyncHookHandler, type SyncHookName, type SyncHookPayloads, TSCONFIG_ALIAS_FILES, type TranslateFunction, type TranslateInput, UNKNOWN_CLIENT_IP, UPLOADS_DIR, type ValidationResult$1 as ValidationResult, abortAllForSocket, abortApiByResponseIndex, abortSyncByCb, acquireLease, allowedOrigin, type apiMessage, appendErrorTracker, applyCookiePrefixConstraints, applyErrorFormatter, applySocketMiddlewares, applyStrayKeyPrefix, attachSocketRedisAdapter, bootstrapEnv, captureException, captureExceptionAcrossTrackers, captureMessage, captureMessageAcrossTrackers, checkRateLimit, clearAllHooks, clearAllRateLimits, clearRateLimit, clearSocketMiddlewares, collectSynchronizedEnvKeys, computeSynchronizedEnvHashes, consumeOneTimeToken, consumeOneTimeTokenJson, createLocalizedNormalizer, createRegistry, defaultRateLimitStrategy, defaultRedisKeyFormatter, defaultRoomNameFormatter, deriveTokenBucketId, describeHealthHashConfig, dispatchHook, dispatchSyncHook, ensurePeerDepInstalled, env, escapeHtml, extractLanguageFromHeader, extractTokenFromRequest, extractTokenFromSocket, flushErrorTrackers, formatKey, formatRoomName, getActiveErrorTrackers, getAvatarConfig, getBindAddress, getCookieValue, getCsrfConfig, getCurrentErrorTrackerIdentity, getDbHealthCheck, getEffectiveHttpMethod, getEmailSender, getEmailSenderByName, getEnv, getEnvFiles, getErrorFormatter, getGeneratedApiDocsPath, getGeneratedApiSchemasPath, getGeneratedSocketTypesPath, getIoInstance, getLocaleReloader, getLocalizedNormalizer, getParams, getPrismaClient, getPrismaClientFor, getPrismaClientKeys, getPublicDir, getRateLimitStatus, getRateLimitStrategy, getRedactedLogKeys, getRedisClient, getRedisClientFor, getRedisClientKeys, getRedisConnectionOptions, getRedisKeyFormatter, getRegisteredSessionProvider, getRoomNameFormatter, getRuntimeApiMaps, getRuntimeSyncMaps, getServerDir, getServerFunctionDirs, getServerFunctionsDir, getSharedDir, getSocketMiddlewares, getSrcDir, getUploadsDir, hasCookie, hashSynchronizedValue, hashSynchronizedValueWith, inferHttpMethod, initConsolelog, initSharedSentry, isDbHealthCheckRegistered, isEmailSenderRegistered, isFalsy, isGetMethodName, isLocalizedNormalizerRegistered, isLoopbackIp, isMethodAllowed, isPrismaClientRegistered, isPrismaClientResolvable, isProduction, isRedactedLogKey, isRedisClientRegistered, isRuntimeMapsProviderRegistered, isSessionProviderRegistered, issueOneTimeToken, listEmailSenderNames, loadEnvFiles, loadPeer, normalizeErrorResponse, normalizeOrigin, oneTimeTokenKey, performLogout, prisma, processUpload, readBootUuid, readSession, rebuildDefaultRedisClient, recordMetricAcrossTrackers, redis, registerApiAbortController, registerAvatarConfig, registerBindAddress, registerCsrfConfig, registerDbHealthCheck, registerEmailSender, registerEmailSenders, registerErrorFormatter, registerErrorTracker, registerErrorTrackers, registerHook, registerLocaleReloader, registerLocalizedNormalizer, registerPreCaptureFilter, registerPrismaClient, registerRateLimitStrategy, registerRedactedLogKeys, registerRedisClient, registerRedisKeyFormatter, registerRoomNameFormatter, registerRuntimeMapsProvider, registerSessionProvider, registerSocketMiddleware, registerStrayPrefixCommand, registerSyncAbortController, registerSyncHook, releaseLease, removeSession, renewLease, resetClientsForTests, resetCsrfConfigForTests, resetDbHealthCheckForTests, resetDefaultRedisClient, resetRedactedLogKeysForTests, resetRedisKeyFormatterForTests, resetSessionProviderForTests, resolveClientIp, resolveEnvKey, resolveErrorMessage, resolveFromRoot, resolveHealthHashConfig, resolveHealthHashConfigFromDescriptor, runWithErrorTrackerIdentity, runWithErrorTrackerIdentityScope, sanitizeErrorString, sanitizeErrorStrings, sanitizeForLog, serveAvatar, setCurrentErrorTrackerIdentity, setErrorTrackerUser, setIoInstance, setSentryUser, startSpan, startSpanAcrossTrackers, startSpanHandle, type syncMessage, tryCatch,
|
|
1769
|
+
export { type ApiAuthRejectedPayload, type ApiErrorPayload, type ApiResponseEnvelope, AuthProps, type AvatarConfig, type AvatarConfigInput, BOOT_KEY_PREFIX, BaseSessionLayout, type CheckRateLimitParams, type CookiePrefixConstraints, type CorsRejectedPayload, type CreateLocalizedNormalizerInput, type CsrfConfig, type CsrfCookieOptions, type CsrfMismatchPayload, DEFAULT_AVATAR_CONFIG, DEFAULT_CLIENT_KEY, DEFAULT_CSRF_CONFIG, DEFAULT_ENV_FILES, DEFAULT_REDACTED_LOG_KEYS, DEPTH_TRUNCATED_PLACEHOLDER, type DbHealthCheck, type DbHealthResult, DeepPartial, type DispatchResult, type EmailAttachment, type EmailMessage, type EmailResult, type EmailSender, type EmailSenderRegistry, type ErrorFormatter, type ErrorFormatterContext, ErrorParam, ErrorResponseInput, type ErrorTracker, type ErrorTrackerContext, type ErrorTrackerEvent, type ErrorTrackerUser, type FormatterEnvelope, GENERATED_API_DOCS_PATH, GENERATED_API_SCHEMAS_PATH, GENERATED_SOCKET_TYPES_PATH, HealthHashConfig, type HealthHashDescriptor, type HookHandler, type HookName, type HookPayloads, type HookResult, type HookSessionShape, type HookStopSignal, type HttpMethod, type LanguageCode, type LocaleReloader, type LocalizedNormalizer, type NormalizeErrorResponseInput, NormalizedErrorResponse, type OnUploadCompletePayload, type OnUploadStartPayload, type OneTimeTokenHandle, PUBLIC_DIR, type PeerRequire, type PostApiExecutePayload, type PostApiRespondPayload, type PostApiValidatePayload, type PostAvatarServePayload, type PostErrorNormalizePayload, type PostHttpRequestPayload, type PostSessionRefreshPayload, type PostSyncAuthorizePayload, type PostSyncExecutePayload, type PostSyncFanoutPayload, type PostSyncValidatePayload, type PreApiExecutePayload, type PreApiRespondPayload, type PreApiValidatePayload, type PreAvatarServePayload, type PreCaptureFilter, type PreErrorNormalizePayload, type PreHttpRequestPayload, type PreServerStopPayload, type PreSessionRefreshPayload, type PreSocketMessagePayload, type PreSyncAuthorizePayload, type PreSyncExecutePayload, type PreSyncFanoutPayload, type PreSyncRecipientPayload, type PreSyncValidatePayload, type ProcessUploadInput, type ProcessUploadResult, REDACTED_PLACEHOLDER, ROOT_DIR, type RateLimitExceededPayload, type RateLimitResult, type RateLimitStrategy, type RedisConnectionOptions, type RedisKeyFormatter, type Registry, type RegistryOptions, type ResolveClientIpParams, type RoomNameFormatter, type RoomNameFormatterContext, type RuntimeApiMapsResult, type RuntimeEnv, type RuntimeMapsProvider, type RuntimeSyncMapsResult, SERVER_DIR, SERVER_FUNCTIONS_DIR, SHARED_DIR, SRC_DIR, type SessionCreatedPayload, type SessionLogoutInput, type SessionProvider, type SessionRevokedPayload, type SessionSaveResult, type SocketMiddleware, type SpanHandle, type SpanResult, type SyncErrorPayload, type SyncHookHandler, type SyncHookName, type SyncHookPayloads, TSCONFIG_ALIAS_FILES, type TranslateFunction, type TranslateInput, UNKNOWN_CLIENT_IP, UPLOADS_DIR, type ValidationResult$1 as ValidationResult, abortAllForSocket, abortApiByResponseIndex, abortSyncByCb, acquireLease, allowedOrigin, type apiMessage, appendErrorTracker, applyCookiePrefixConstraints, applyErrorFormatter, applySocketMiddlewares, applyStrayKeyPrefix, attachSocketRedisAdapter, bootstrapEnv, captureException, captureExceptionAcrossTrackers, captureMessage, captureMessageAcrossTrackers, checkRateLimit, clearAllHooks, clearAllRateLimits, clearRateLimit, clearSocketMiddlewares, collectSynchronizedEnvKeys, computeSynchronizedEnvHashes, consumeOneTimeToken, consumeOneTimeTokenJson, createLocalizedNormalizer, createRegistry, defaultRateLimitStrategy, defaultRedisKeyFormatter, defaultRoomNameFormatter, deriveTokenBucketId, describeHealthHashConfig, dispatchHook, dispatchSyncHook, ensurePeerDepInstalled, env, escapeHtml, extractLanguageFromHeader, extractTokenFromRequest, extractTokenFromSocket, flushErrorTrackers, formatKey, formatRoomName, getActiveErrorTrackers, getAvatarConfig, getBindAddress, getCookieValue, getCsrfConfig, getCurrentErrorTrackerIdentity, getDbHealthCheck, getEffectiveHttpMethod, getEmailSender, getEmailSenderByName, getEnv, getEnvFiles, getErrorFormatter, getGeneratedApiDocsPath, getGeneratedApiSchemasPath, getGeneratedSocketTypesPath, getIoInstance, getLocaleReloader, getLocalizedNormalizer, getParams, getPrismaClient, getPrismaClientFor, getPrismaClientKeys, getPublicDir, getRateLimitStatus, getRateLimitStrategy, getRedactedLogKeys, getRedisClient, getRedisClientFor, getRedisClientKeys, getRedisConnectionOptions, getRedisKeyFormatter, getRegisteredSessionProvider, getRoomNameFormatter, getRuntimeApiMaps, getRuntimeSyncMaps, getServerDir, getServerFunctionDirs, getServerFunctionsDir, getSharedDir, getSocketMiddlewares, getSrcDir, getUploadsDir, hasCookie, hashSynchronizedValue, hashSynchronizedValueWith, inferHttpMethod, initConsolelog, initSharedSentry, isDbHealthCheckRegistered, isEmailSenderRegistered, isFalsy, isGetMethodName, isLocalizedNormalizerRegistered, isLoopbackIp, isMethodAllowed, isPrismaClientRegistered, isPrismaClientResolvable, isProduction, isRedactedLogKey, isRedisClientRegistered, isRuntimeMapsProviderRegistered, isSessionProviderRegistered, issueOneTimeToken, listEmailSenderNames, loadEnvFiles, loadPeer, normalizeErrorResponse, normalizeOrigin, oneTimeTokenKey, performLogout, prisma, processUpload, readBootUuid, readSession, rebuildDefaultRedisClient, recordMetricAcrossTrackers, redis, registerApiAbortController, registerAvatarConfig, registerBindAddress, registerCsrfConfig, registerDbHealthCheck, registerEmailSender, registerEmailSenders, registerErrorFormatter, registerErrorTracker, registerErrorTrackers, registerHook, registerLocaleReloader, registerLocalizedNormalizer, registerPreCaptureFilter, registerPrismaClient, registerRateLimitStrategy, registerRedactedLogKeys, registerRedisClient, registerRedisKeyFormatter, registerRoomNameFormatter, registerRuntimeMapsProvider, registerSessionProvider, registerSocketMiddleware, registerStrayPrefixCommand, registerSyncAbortController, registerSyncHook, releaseLease, removeSession, renewLease, resetClientsForTests, resetCsrfConfigForTests, resetDbHealthCheckForTests, resetDefaultRedisClient, resetRedactedLogKeysForTests, resetRedisKeyFormatterForTests, resetSessionProviderForTests, resolveClientIp, resolveDevCallbackUrl, resolveEnvKey, resolveErrorMessage, resolveFromRoot, resolveHealthHashConfig, resolveHealthHashConfigFromDescriptor, runWithErrorTrackerIdentity, runWithErrorTrackerIdentityScope, sanitizeErrorString, sanitizeErrorStrings, sanitizeForLog, serveAvatar, setCurrentErrorTrackerIdentity, setErrorTrackerUser, setIoInstance, setSentryUser, startSpan, startSpanAcrossTrackers, startSpanHandle, type syncMessage, tryCatch, unregisterApiAbortController, unregisterSyncAbortController, validateInputByType, validateRequest, writeBootUuid, writeSession };
|
package/dist/index.js
CHANGED
|
@@ -1183,6 +1183,23 @@ var getBindAddress = () => {
|
|
|
1183
1183
|
port: process.env.SERVER_PORT ?? ""
|
|
1184
1184
|
};
|
|
1185
1185
|
};
|
|
1186
|
+
var defaultPortForProtocol = (protocol) => protocol === "https:" ? "443" : "80";
|
|
1187
|
+
var resolveDevCallbackUrl = (callbackUrl) => {
|
|
1188
|
+
if (resolveEnvKey() === "production") return callbackUrl;
|
|
1189
|
+
let url;
|
|
1190
|
+
try {
|
|
1191
|
+
url = new URL(callbackUrl);
|
|
1192
|
+
} catch {
|
|
1193
|
+
return callbackUrl;
|
|
1194
|
+
}
|
|
1195
|
+
if (url.hostname !== "localhost" && url.hostname !== "127.0.0.1") return callbackUrl;
|
|
1196
|
+
const boundPort = getBindAddress().port;
|
|
1197
|
+
if (!boundPort) return callbackUrl;
|
|
1198
|
+
const currentPort = url.port || defaultPortForProtocol(url.protocol);
|
|
1199
|
+
if (currentPort === boundPort) return callbackUrl;
|
|
1200
|
+
url.port = boundPort === defaultPortForProtocol(url.protocol) ? "" : boundPort;
|
|
1201
|
+
return url.toString();
|
|
1202
|
+
};
|
|
1186
1203
|
|
|
1187
1204
|
// src/getParams.ts
|
|
1188
1205
|
var writeJsonErrorAndResolve = (res, status, errorCode, resolve) => {
|
|
@@ -2368,6 +2385,7 @@ export {
|
|
|
2368
2385
|
resetRedisKeyFormatterForTests,
|
|
2369
2386
|
resetSessionProviderForTests,
|
|
2370
2387
|
resolveClientIp,
|
|
2388
|
+
resolveDevCallbackUrl,
|
|
2371
2389
|
resolveEnvKey,
|
|
2372
2390
|
resolveErrorMessage,
|
|
2373
2391
|
resolveFromRoot,
|