@luckystack/core 0.3.1 → 0.4.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/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { StreamPayload, ApiTypeMap } from './apiTypeStubs.js';
2
2
  export { SyncTypeMap } from './apiTypeStubs.js';
3
- import { B as BaseSessionLayout } from './pageRouteValidation-BwSFuQL9.js';
4
- export { A as ApiMethodMap, a as AppConfig, b as AuthProps, D as DEFAULT_PAGE_ROUTE_RULES, H as HttpMethodLiteral, L as Logger, c as LoggerContext, d as LoggingConfig, N as Notifier, e as NotifyInput, f as NotifyParam, P as PagePathValidationResult, g as PageRouteRules, h as ProjectConfig, R as RateLimitingConfig, S as SOCKETSTATUS, i as SessionConfig, j as SessionLocation, k as buildApiResponseEventName, l as buildApiStreamEventName, m as buildGetJoinedRoomsResponseEventName, n as buildJoinRoomResponseEventName, o as buildLeaveRoomResponseEventName, p as buildSyncProgressEventName, q as buildSyncResponseEventName, r as clearCsrfToken, s as enqueueApiRequest, t as enqueueSyncRequest, u as flushApiQueue, v as flushSyncQueue, w as getApiQueueSize, x as getCsrfToken, y as getLogger, z as getNotifier, C as getProjectConfig, E as getRegisteredApiMethod, F as getSyncQueueSize, G as httpFetch, I as incrementResponseIndex, J as isApiMethodMapRegistered, K as isOnline, M as isProjectConfigRegistered, O as normalizeErrorResponseCore, Q as notify, T as parseServiceRouteName, U as registerApiMethodMap, V as registerLogger, W as registerNotifier, X as registerProjectConfig, Y as removeApiQueueItem, Z as removeApiQueueItemsByKey, _ as removeSyncQueueItem, $ as setSocket, a0 as sleep, a1 as socket, a2 as socketEventNames, a3 as statusContent, a4 as validatePagePath, a5 as waitForSocket } from './pageRouteValidation-BwSFuQL9.js';
3
+ import { B as BaseSessionLayout } from './pageRouteValidation-BzsRvO6x.js';
4
+ export { A as ApiMethodMap, a as AppConfig, b as AuthProps, D as DEFAULT_PAGE_ROUTE_RULES, H as HttpMethodLiteral, L as Logger, c as LoggerContext, d as LoggingConfig, N as Notifier, e as NotifyInput, f as NotifyParam, P as PagePathValidationResult, g as PageRouteRules, h as ProjectConfig, R as RateLimitingConfig, S as SOCKETSTATUS, i as SessionConfig, j as SessionLocation, k as buildApiResponseEventName, l as buildApiStreamEventName, m as buildGetJoinedRoomsResponseEventName, n as buildJoinRoomResponseEventName, o as buildLeaveRoomResponseEventName, p as buildSyncProgressEventName, q as buildSyncResponseEventName, r as clearCsrfToken, s as enqueueApiRequest, t as enqueueSyncRequest, u as flushApiQueue, v as flushSyncQueue, w as getApiQueueSize, x as getCsrfToken, y as getLogger, z as getNotifier, C as getProjectConfig, E as getRegisteredApiMethod, F as getSyncQueueSize, G as httpFetch, I as incrementResponseIndex, J as isApiMethodMapRegistered, K as isOnline, M as isProjectConfigRegistered, O as normalizeErrorResponseCore, Q as notify, T as parseServiceRouteName, U as registerApiMethodMap, V as registerLogger, W as registerNotifier, X as registerProjectConfig, Y as removeApiQueueItem, Z as removeApiQueueItemsByKey, _ as removeSyncQueueItem, $ as setSocket, a0 as sleep, a1 as socket, a2 as socketEventNames, a3 as statusContent, a4 as validatePagePath, a5 as waitForSocket } from './pageRouteValidation-BzsRvO6x.js';
5
5
  import * as react from 'react';
6
6
  import { ReactNode, Dispatch, SetStateAction } from 'react';
7
7
  import 'socket.io-client';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a6 as ErrorParam, a7 as ErrorResponseInput, a8 as NormalizedErrorResponse, a9 as HealthHashConfig, aa as DeepPartial, B as BaseSessionLayout, b as AuthProps } from './pageRouteValidation-BwSFuQL9.js';
2
- export { ab as ApiConfig, A as ApiMethodMap, a as AppConfig, ac as AuthConfig, ad as AuthRateLimitConfig, ae as CorsConfig, D as DEFAULT_PAGE_ROUTE_RULES, af as DEFAULT_PROJECT_CONFIG, ag as DevConfig, ah as HttpConfig, H as HttpMethodLiteral, ai as HttpStreamConfig, aj as INVALID_ERROR_RESPONSE_CODE, L as Logger, c as LoggerContext, d as LoggingConfig, N as Notifier, e as NotifyInput, f as NotifyParam, ak as OfflineQueueConfig, P as PagePathValidationResult, g as PageRouteRules, al as PasswordPolicyConfig, am as PathsConfig, h as ProjectConfig, an as ProjectConfigInput, ao as QueueDropReason, ap as RateLimitIdentity, aq as RateLimitIdentityParams, R as RateLimitingConfig, S as SOCKETSTATUS, ar as SecurityHeadersConfig, as as ServiceRouteParseError, at as ServiceRouteParseResult, au as ServiceRouteParseSuccess, i as SessionConfig, j as SessionLocation, av as SocketConfig, aw as SyncConfig, ax as SyncFlushPressureConfig, ay as SyncStreamThrottleConfig, az as TransportRouteParseError, aA as TransportRouteParseResult, aB as TransportRouteParseSuccess, aC as ValidationConfig, k as buildApiResponseEventName, l as buildApiStreamEventName, m as buildGetJoinedRoomsResponseEventName, n as buildJoinRoomResponseEventName, o as buildLeaveRoomResponseEventName, p as buildSyncProgressEventName, q as buildSyncResponseEventName, r as clearCsrfToken, aD as createDevLogger, aE as deepMerge, aF as defaultHttpStatusForResponse, s as enqueueApiRequest, t as enqueueSyncRequest, u as flushApiQueue, v as flushSyncQueue, w as getApiQueueSize, x as getCsrfToken, y as getLogger, z as getNotifier, C as getProjectConfig, aG as getProjectName, E as getRegisteredApiMethod, F as getSyncQueueSize, G as httpFetch, I as incrementResponseIndex, J as isApiMethodMapRegistered, aH as isErrorParamArray, aI as isLoggerRegistered, K as isOnline, aJ as isPlainObject, M as isProjectConfigRegistered, O as normalizeErrorResponseCore, Q as notify, T as parseServiceRouteName, aK as parseTransportRouteName, U as registerApiMethodMap, V as registerLogger, W as registerNotifier, X as registerProjectConfig, Y as removeApiQueueItem, Z as removeApiQueueItemsByKey, _ as removeSyncQueueItem, aL as resetLoggerForTests, $ as setSocket, a0 as sleep, a1 as socket, a2 as socketEventNames, a3 as statusContent, a4 as validatePagePath, a5 as waitForSocket } from './pageRouteValidation-BwSFuQL9.js';
1
+ import { a6 as ErrorParam, a7 as ErrorResponseInput, a8 as NormalizedErrorResponse, a9 as HealthHashConfig, aa as DeepPartial, B as BaseSessionLayout, b as AuthProps } from './pageRouteValidation-BzsRvO6x.js';
2
+ export { ab as ApiConfig, A as ApiMethodMap, a as AppConfig, ac as AuthConfig, ad as AuthRateLimitConfig, ae as CorsConfig, D as DEFAULT_PAGE_ROUTE_RULES, af as DEFAULT_PROJECT_CONFIG, ag as DevConfig, ah as HttpConfig, H as HttpMethodLiteral, ai as HttpStreamConfig, aj as INVALID_ERROR_RESPONSE_CODE, L as Logger, c as LoggerContext, d as LoggingConfig, N as Notifier, e as NotifyInput, f as NotifyParam, ak as OfflineQueueConfig, P as PagePathValidationResult, g as PageRouteRules, al as PasswordPolicyConfig, am as PathsConfig, h as ProjectConfig, an as ProjectConfigInput, ao as QueueDropReason, ap as RateLimitIdentity, aq as RateLimitIdentityParams, R as RateLimitingConfig, S as SOCKETSTATUS, ar as SecurityHeadersConfig, as as ServiceRouteParseError, at as ServiceRouteParseResult, au as ServiceRouteParseSuccess, i as SessionConfig, j as SessionLocation, av as SocketConfig, aw as SyncConfig, ax as SyncFlushPressureConfig, ay as SyncStreamThrottleConfig, az as TransportRouteParseError, aA as TransportRouteParseResult, aB as TransportRouteParseSuccess, aC as ValidationConfig, k as buildApiResponseEventName, l as buildApiStreamEventName, m as buildGetJoinedRoomsResponseEventName, n as buildJoinRoomResponseEventName, o as buildLeaveRoomResponseEventName, p as buildSyncProgressEventName, q as buildSyncResponseEventName, r as clearCsrfToken, aD as createDevLogger, aE as deepMerge, aF as defaultHttpStatusForResponse, s as enqueueApiRequest, t as enqueueSyncRequest, u as flushApiQueue, v as flushSyncQueue, w as getApiQueueSize, x as getCsrfToken, y as getLogger, z as getNotifier, C as getProjectConfig, aG as getProjectName, E as getRegisteredApiMethod, F as getSyncQueueSize, G as httpFetch, I as incrementResponseIndex, J as isApiMethodMapRegistered, aH as isErrorParamArray, aI as isLoggerRegistered, K as isOnline, aJ as isPlainObject, M as isProjectConfigRegistered, O as normalizeErrorResponseCore, Q as notify, T as parseServiceRouteName, aK as parseTransportRouteName, U as registerApiMethodMap, V as registerLogger, W as registerNotifier, X as registerProjectConfig, Y as removeApiQueueItem, Z as removeApiQueueItemsByKey, _ as removeSyncQueueItem, aL as resetLoggerForTests, $ as setSocket, a0 as sleep, a1 as socket, a2 as socketEventNames, a3 as statusContent, a4 as validatePagePath, a5 as waitForSocket } from './pageRouteValidation-BzsRvO6x.js';
3
3
  export { ApiTypeMap, StreamPayload, SyncTypeMap } from './apiTypeStubs.js';
4
4
  import { Server, Socket } from 'socket.io';
5
5
  import { z } from 'zod';
@@ -86,7 +86,19 @@ declare const ensurePeerDepInstalled: (packageName: string, hint: string, requir
86
86
  declare const loadPeer: <T>(packageName: string, hint: string, requireFn?: PeerRequire) => T;
87
87
 
88
88
  interface RoomNameFormatterContext {
89
- /** Why the room name is being formatted — so a formatter can branch if needed. */
89
+ /**
90
+ * Which room FAMILY the name is being formatted for — a formatter may branch on
91
+ * this to isolate genuinely-separate families, but MUST NOT use it to give the
92
+ * same raw room code different physical names across a single family's
93
+ * operations. A content room is joined, left, membership-checked, broadcast to,
94
+ * and streamed to under the SINGLE canonical `'broadcast'` purpose (M5); the
95
+ * framework never varies a content room's physical name by operation, because a
96
+ * socket physically IN `f(R,'join')` could never receive a fanout targeting
97
+ * `f(R,'broadcast')`. `'presence'` is the one genuinely-separate family (its own
98
+ * rooms). `'join'`/`'leave'` remain in the union for backward-compat but the
99
+ * framework no longer emits them for room-NAME formatting — treat them, if ever
100
+ * seen, identically to `'broadcast'`.
101
+ */
90
102
  purpose: 'join' | 'leave' | 'broadcast' | 'presence';
91
103
  /** Session user id when known (join/leave by an authenticated socket), else null. */
92
104
  userId?: string | null;
@@ -1440,7 +1452,7 @@ declare const oneTimeTokenKey: (namespace: string, token: string) => string;
1440
1452
  */
1441
1453
  interface HookSessionShape {
1442
1454
  id: string;
1443
- token: string;
1455
+ token?: string;
1444
1456
  email?: string | null;
1445
1457
  name?: string | null;
1446
1458
  avatar?: string | null;
package/dist/index.js CHANGED
@@ -1751,8 +1751,9 @@ var validateType = (typeText, value, path4, depth = 0) => {
1751
1751
  }
1752
1752
  return { status: "error", message: `${path4} does not match union type ${type}` };
1753
1753
  }
1754
- if (unionParts.length === 1) {
1755
- return validateType(unionParts[0] ?? type, value, path4, depth + 1);
1754
+ const singleMember = unionParts[0] ?? type;
1755
+ if (unionParts.length === 1 && singleMember !== type) {
1756
+ return validateType(singleMember, value, path4, depth + 1);
1756
1757
  }
1757
1758
  }
1758
1759
  if (type.includes("&")) {