@rpgjs/client 5.0.0-beta.17 → 5.0.0-beta.18
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/Game/Map.js +3 -3
- package/dist/Gui/Gui.js +1 -1
- package/dist/RpgClientEngine.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.130.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorate.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.130.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorateMetadata.js +1 -1
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/animations/animation.ce.js +4 -2
- package/dist/components/animations/animation.ce.js.map +1 -1
- package/dist/components/animations/fx.ce.js +4 -2
- package/dist/components/animations/fx.ce.js.map +1 -1
- package/dist/components/animations/hit.ce.js +6 -4
- package/dist/components/animations/hit.ce.js.map +1 -1
- package/dist/components/character.ce.js +4 -2
- package/dist/components/character.ce.js.map +1 -1
- package/dist/components/dynamics/bar.ce.js +4 -2
- package/dist/components/dynamics/bar.ce.js.map +1 -1
- package/dist/components/dynamics/image.ce.js +4 -2
- package/dist/components/dynamics/image.ce.js.map +1 -1
- package/dist/components/dynamics/shape.ce.js +4 -2
- package/dist/components/dynamics/shape.ce.js.map +1 -1
- package/dist/components/dynamics/text.ce.js +4 -2
- package/dist/components/dynamics/text.ce.js.map +1 -1
- package/dist/components/gui/box.ce.js +4 -2
- package/dist/components/gui/box.ce.js.map +1 -1
- package/dist/components/gui/dialogbox/index.ce.js +2 -1
- package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
- package/dist/components/gui/gameover.ce.js +2 -1
- package/dist/components/gui/gameover.ce.js.map +1 -1
- package/dist/components/gui/hud/hud.ce.js +2 -1
- package/dist/components/gui/hud/hud.ce.js.map +1 -1
- package/dist/components/gui/menu/equip-menu.ce.js +2 -1
- package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/exit-menu.ce.js +2 -1
- package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/items-menu.ce.js +2 -1
- package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/main-menu.ce.js +2 -1
- package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/options-menu.ce.js +2 -1
- package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/skills-menu.ce.js +2 -1
- package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
- package/dist/components/gui/mobile/mobile.ce.js +2 -1
- package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
- package/dist/components/gui/notification/notification.ce.js +2 -1
- package/dist/components/gui/notification/notification.ce.js.map +1 -1
- package/dist/components/gui/save-load.ce.js +2 -1
- package/dist/components/gui/save-load.ce.js.map +1 -1
- package/dist/components/gui/shop/shop.ce.js +2 -1
- package/dist/components/gui/shop/shop.ce.js.map +1 -1
- package/dist/components/gui/title-screen.ce.js +2 -1
- package/dist/components/gui/title-screen.ce.js.map +1 -1
- package/dist/components/interaction-components.ce.js +4 -2
- package/dist/components/interaction-components.ce.js.map +1 -1
- package/dist/components/player-components.ce.js +4 -2
- package/dist/components/player-components.ce.js.map +1 -1
- package/dist/components/prebuilt/hp-bar.ce.js +5 -3
- package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
- package/dist/components/prebuilt/light-halo.ce.js +4 -2
- package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
- package/dist/components/scenes/canvas.ce.js +2 -1
- package/dist/components/scenes/canvas.ce.js.map +1 -1
- package/dist/components/scenes/draw-map.ce.js +4 -2
- package/dist/components/scenes/draw-map.ce.js.map +1 -1
- package/dist/components/scenes/event-layer.ce.js +2 -1
- package/dist/components/scenes/event-layer.ce.js.map +1 -1
- package/dist/core/inject.js +1 -1
- package/dist/core/setup.js +1 -1
- package/dist/index.js +1 -1
- package/dist/module.js +1 -1
- package/dist/node_modules/.pnpm/{@signe_di@3.0.1 → @signe_di@3.1.0}/node_modules/@signe/di/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@signe_di@3.0.1 → @signe_di@3.1.0}/node_modules/@signe/di/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/{@signe_reactive@3.0.1 → @signe_reactive@3.1.0}/node_modules/@signe/reactive/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/{@signe_reactive@3.0.1 → @signe_reactive@3.1.0}/node_modules/@signe/reactive/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/{@signe_room@3.0.1 → @signe_room@3.1.0_react@19.2.7}/node_modules/@signe/room/dist/chunk-EUXUH3YW.js +1 -1
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/chunk-EUXUH3YW.js.map +1 -0
- package/dist/node_modules/.pnpm/{@signe_room@3.0.1 → @signe_room@3.1.0_react@19.2.7}/node_modules/@signe/room/dist/index.js +33 -31
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/{@signe_sync@3.0.1 → @signe_sync@3.1.0_react@19.2.7}/node_modules/@signe/sync/dist/client/index.js +2 -3
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/client/index.js.map +1 -0
- package/dist/node_modules/.pnpm/{@signe_sync@3.0.1 → @signe_sync@3.1.0_react@19.2.7}/node_modules/@signe/sync/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/{partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js → partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js} +30 -17
- package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/{partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js → partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js} +65 -34
- package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js +13 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +106 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +13 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js +121 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js +10 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +110 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +99 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +82 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js.map +1 -0
- package/dist/node_modules/.pnpm/{zod@3.24.2/node_modules/zod/lib/index.js → zod@3.25.76/node_modules/zod/v3/types.js} +93 -630
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js.map +1 -0
- package/dist/services/loadMap.js +1 -1
- package/dist/services/mmorpg.js +1 -1
- package/dist/services/standalone.js +1 -1
- package/package.json +13 -13
- package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/chunk-EUXUH3YW.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/client/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +0 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +0 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +0 -2
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["isSignal2"],"sources":["../../../../../../../../../../node_modules/.pnpm/@signe+sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/index.js"],"sourcesContent":["// src/core.ts\nimport {\n isArraySubject,\n isObjectSubject,\n isSignal,\n isComputed\n} from \"@signe/reactive\";\n\n// src/utils.ts\nfunction isFunction(val) {\n return {}.toString.call(val) === \"[object Function]\";\n}\nfunction isClass(obj) {\n return typeof obj === \"function\" && obj.prototype && obj.prototype.constructor === obj;\n}\nvar isObject = (item) => item && typeof item === \"object\" && !Array.isArray(item) && item !== null;\nfunction isInstanceOfClass(value) {\n if (value === null || typeof value !== \"object\" || value === void 0 || Array.isArray(value)) {\n return false;\n }\n return Object.getPrototypeOf(value) !== Object.prototype;\n}\nfunction generateShortUUID() {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let uuid = \"\";\n for (let i = 0; i < 8; i++) {\n const randomIndex = Math.floor(Math.random() * chars.length);\n uuid += chars[randomIndex];\n }\n return uuid;\n}\n\n// src/core.ts\nvar DELETE_TOKEN = \"$delete\";\nvar syncClass = (instance, options = {}) => {\n const cacheSync = /* @__PURE__ */ new Map();\n const cachePersist = /* @__PURE__ */ new Map();\n instance.$valuesChanges = {\n set: (path, value) => {\n cacheSync.set(path, value);\n options.onSync?.(cacheSync);\n },\n setPersist: (path, value) => {\n if (path == \"\") path = \".\";\n cachePersist.set(path, value);\n options.onPersist?.(cachePersist);\n },\n has: (path) => {\n return cacheSync.has(path);\n },\n get: (path) => {\n return cacheSync.get(path);\n }\n };\n createSyncClass(instance);\n};\nfunction createStatesSnapshot(instance) {\n let persistObject = {};\n if (instance?.$snapshot) {\n for (const key of instance.$snapshot.keys()) {\n const signal = instance.$snapshot.get(key);\n const persist2 = signal.options.persist ?? true;\n let value = signal();\n if (isObject(value) || Array.isArray(value)) {\n continue;\n }\n if (persist2) {\n persistObject[key] = value;\n }\n }\n }\n return persistObject;\n}\nvar SNAPSHOT_SKIP = Symbol(\"snapshot-skip\");\nvar serializeSnapshotDeep = (value, path, options, seen) => {\n if (isSignal(value)) {\n return serializeSnapshotDeep(value(), path, options, seen);\n }\n if (value instanceof Map) {\n return SNAPSHOT_SKIP;\n }\n if (options.filter && !options.filter(value, path)) {\n return SNAPSHOT_SKIP;\n }\n if (value instanceof Date) {\n return options.dateToString ? options.dateToString(value) : value.toISOString();\n }\n if (value && typeof value === \"object\") {\n if (seen.has(value)) {\n return SNAPSHOT_SKIP;\n }\n seen.add(value);\n if (Array.isArray(value)) {\n const result2 = [];\n value.forEach((item, index) => {\n const itemPath = path ? `${path}.${index}` : String(index);\n const serialized = serializeSnapshotDeep(item, itemPath, options, seen);\n if (serialized !== SNAPSHOT_SKIP) {\n result2.push(serialized);\n }\n });\n return result2;\n }\n const result = {};\n const idKey = isInstanceOfClass(value) ? value.constructor?._propertyMetadata?.get(\"id\") : void 0;\n const entries = Object.entries(value).filter(\n ([key]) => isInstanceOfClass(value) ? key.startsWith(\"__\") || (idKey ? key === idKey : false) : true\n );\n for (const [key, childValue] of entries) {\n const normalizedKey = key.startsWith(\"__\") ? key.slice(2) : key;\n const childPath = path ? `${path}.${normalizedKey}` : normalizedKey;\n const serialized = serializeSnapshotDeep(childValue, childPath, options, seen);\n if (serialized !== SNAPSHOT_SKIP) {\n result[normalizedKey] = serialized;\n }\n }\n return result;\n }\n return value;\n};\nfunction createStatesSnapshotDeep(instance, options = {}) {\n const persistObject = {};\n if (instance?.$snapshot) {\n for (const key of instance.$snapshot.keys()) {\n const signal = instance.$snapshot.get(key);\n const persist2 = signal.options.persist ?? true;\n if (!persist2) {\n continue;\n }\n const value = signal();\n const serialized = serializeSnapshotDeep(\n value,\n key,\n options,\n /* @__PURE__ */ new WeakSet()\n );\n if (serialized !== SNAPSHOT_SKIP) {\n persistObject[key] = serialized;\n }\n }\n }\n return persistObject;\n}\nfunction setMetadata(target, key, value) {\n const meta = target.constructor._propertyMetadata;\n const propId = meta?.get(key);\n if (propId) {\n if (isSignal(target[propId])) {\n target[propId].set(value);\n } else {\n target[propId] = value;\n }\n }\n}\nvar createSyncClass = (currentClass, parentKey = null, parentClass = null, path = \"\") => {\n currentClass.$path = path;\n if (parentClass) {\n currentClass.$valuesChanges = parentClass.$valuesChanges;\n }\n if (parentKey) {\n setMetadata(currentClass, \"id\", parentKey);\n }\n applyDecoratedSignalMetadata(currentClass);\n if (currentClass.$snapshot) {\n for (const key of currentClass.$snapshot.keys()) {\n const signal = currentClass.$snapshot.get(key);\n const syncToClient = signal.options?.syncToClient ?? true;\n const persist2 = signal.options?.persist ?? true;\n const transform = signal.options?.transform;\n let signalValue = signal();\n if (transform) {\n signalValue = transform(signalValue);\n }\n if (isObject(signalValue) || Array.isArray(signalValue)) {\n signalValue = { ...signalValue };\n }\n const transformedValue = signalValue;\n const newPath = (path ? path + \".\" : \"\") + key;\n if (syncToClient) {\n currentClass.$valuesChanges.set(newPath, transformedValue);\n }\n if (persist2) {\n if (parentClass)\n currentClass.$valuesChanges.setPersist(path, transformedValue);\n }\n if (isComputed(signal)) {\n signal.observable.subscribe((newValue) => {\n if (syncToClient) {\n const transformedNewValue = transform ? transform(newValue) : newValue;\n currentClass.$valuesChanges.set(newPath, transformedNewValue);\n }\n });\n }\n }\n }\n};\nfunction applyDecoratedSignalMetadata(currentClass) {\n const syncMetadata = currentClass.constructor?._syncMetadata;\n if (!syncMetadata) {\n return;\n }\n for (const [propertyKey, options] of syncMetadata) {\n const signal = currentClass[propertyKey];\n if (!isSignal(signal) || signal.options) {\n continue;\n }\n currentClass[propertyKey] = type(\n signal,\n propertyKey,\n { ...options, skipInitialSync: true },\n currentClass\n );\n }\n}\nvar type = (_signal, path, options = {}, currentInstance) => {\n const { syncToClient = true, persist: persist2 = true, transform, skipInitialSync = false } = options;\n let init = true;\n const handleObjectSubject = (value, propPath) => {\n const newPath = `${propPath}${value.key ? `.${value.key}` : \"\"}`;\n if ([\"add\", \"reset\", \"update\"].includes(value.type)) {\n if (isInstanceOfClass(value.value)) {\n createSyncClass(value.value, value.key, currentInstance, newPath);\n } else if (value.type === \"update\" && (isObject(value.value) || Array.isArray(value.value))) {\n createSyncClass(value.value, value.key, currentInstance, newPath);\n } else {\n savePath(newPath, value.value);\n }\n } else if (value.type === \"remove\") {\n savePath(newPath, DELETE_TOKEN);\n }\n };\n const handleArraySubject = (value, propPath) => {\n if (value.type === \"reset\" && Array.isArray(value.items)) {\n value.items.forEach((item, index) => {\n const newPath2 = `${propPath}.${index}`;\n if (isInstanceOfClass(item)) {\n createSyncClass(item, value.key, currentInstance, newPath2);\n } else {\n savePath(newPath2, item);\n }\n });\n return;\n }\n const newPath = `${propPath}.${value.index}`;\n const firstItem = value.items?.[0];\n if ([\"add\", \"update\"].includes(value.type) && firstItem !== void 0) {\n if (isInstanceOfClass(firstItem)) {\n createSyncClass(firstItem, value.key, currentInstance, newPath);\n } else if (value.type === \"update\" && (isObject(firstItem) || Array.isArray(firstItem))) {\n createSyncClass(firstItem, value.key, currentInstance, newPath);\n } else {\n savePath(newPath, firstItem);\n }\n } else if (value.type === \"remove\") {\n savePath(newPath, DELETE_TOKEN);\n }\n };\n const savePath = (propPath, value) => {\n const transformedValue = transform && value !== DELETE_TOKEN ? transform(value) : value;\n if (syncToClient) {\n currentInstance.$valuesChanges.set(propPath, transformedValue);\n }\n if (persist2 && currentInstance.$path !== void 0) {\n currentInstance.$valuesChanges.setPersist(\n propPath,\n transformedValue\n );\n }\n };\n const setupSubscription = (signal, signalPath) => {\n if (!isSignal(signal)) return;\n if (syncToClient && !skipInitialSync && currentInstance.$valuesChanges) {\n const initialValue = signal();\n const transformedInitialValue = transform ? transform(initialValue) : initialValue;\n const initialPath = currentInstance.$path !== void 0 ? `${currentInstance.$path ? `${currentInstance.$path}.` : \"\"}${signalPath}` : signalPath;\n currentInstance.$valuesChanges.set(initialPath, transformedInitialValue);\n }\n signal.options = options;\n signal.observable.subscribe((value) => {\n if (init) return;\n if (currentInstance.$path !== void 0) {\n const fullPath = `${currentInstance.$path ? currentInstance.$path + \".\" : \"\"}${signalPath}`;\n if (isComputed(signal)) {\n savePath(fullPath, value);\n } else if (isObjectSubject(signal._subject)) {\n handleObjectSubject(value, fullPath);\n } else if (isArraySubject(signal._subject)) {\n handleArraySubject(value, fullPath);\n } else {\n savePath(fullPath, value);\n }\n }\n });\n if (!currentInstance.$snapshot) {\n currentInstance.$snapshot = /* @__PURE__ */ new Map();\n }\n currentInstance.$snapshot.set(path, signal);\n };\n if (!isSignal(_signal)) {\n if (_signal && typeof _signal === \"object\" && !Array.isArray(_signal)) {\n for (const key in _signal) {\n if (Object.prototype.hasOwnProperty.call(_signal, key)) {\n const value = _signal[key];\n const propertyPath = `${path}.${key}`;\n if (isSignal(value)) {\n setupSubscription(value, propertyPath);\n } else if (value && typeof value === \"object\" && !Array.isArray(value)) {\n type(value, propertyPath, options, currentInstance);\n }\n }\n }\n init = false;\n }\n return _signal;\n }\n setupSubscription(_signal, path);\n init = false;\n return _signal;\n};\n\n// src/decorators.ts\nfunction normalizeSyncOptions(options) {\n let classType;\n let persist2 = true;\n let syncToClient = true;\n let transform;\n if (typeof options === \"function\") {\n classType = options;\n } else if (typeof options === \"object\") {\n classType = options.classType;\n if (options.hasOwnProperty(\"persist\")) {\n persist2 = options.persist;\n }\n if (options.hasOwnProperty(\"syncToClient\")) {\n syncToClient = options.syncToClient;\n }\n if (options.hasOwnProperty(\"transform\")) {\n transform = options.transform;\n }\n }\n return { classType, persist: persist2, syncToClient, transform };\n}\nfunction setSyncMetadata(target, propertyKey, options) {\n if (!target.constructor._syncMetadata) {\n target.constructor._syncMetadata = /* @__PURE__ */ new Map();\n }\n target.constructor._syncMetadata.set(propertyKey, options);\n}\nfunction sync(options) {\n const normalizedOptions = normalizeSyncOptions(options);\n return function(target, propertyKey) {\n setSyncMetadata(target, propertyKey, normalizedOptions);\n const privatePropertyKey = `__${propertyKey}`;\n const getter = function() {\n return this[privatePropertyKey];\n };\n const setter = function(newVal) {\n this[privatePropertyKey] = type(\n newVal,\n propertyKey,\n normalizedOptions,\n this\n );\n };\n Object.defineProperty(target, propertyKey, {\n get: getter,\n set: setter,\n enumerable: true,\n configurable: true\n });\n };\n}\nfunction id() {\n return function(target, propertyKey) {\n if (!target.constructor._propertyMetadata) {\n target.constructor._propertyMetadata = /* @__PURE__ */ new Map();\n }\n target.constructor._propertyMetadata.set(\"id\", propertyKey);\n };\n}\nfunction users(options) {\n return function(target, propertyKey) {\n if (!target.constructor._propertyMetadata) {\n target.constructor._propertyMetadata = /* @__PURE__ */ new Map();\n }\n target.constructor._propertyMetadata.set(\"users\", propertyKey);\n sync(options)(target, propertyKey);\n };\n}\nfunction persist() {\n return sync({\n persist: true,\n syncToClient: false\n });\n}\nfunction connected() {\n return function(target, propertyKey) {\n if (!target.constructor._propertyMetadata) {\n target.constructor._propertyMetadata = /* @__PURE__ */ new Map();\n }\n target.constructor._propertyMetadata.set(\"connected\", propertyKey);\n sync({\n persist: false\n })(target, propertyKey);\n };\n}\n\n// src/load.ts\nimport { isSignal as isSignal2 } from \"@signe/reactive\";\nfunction load(rootInstance, values, valueIsObject) {\n if (valueIsObject) {\n loadFromObject(rootInstance, values);\n } else {\n loadFromPaths(rootInstance, values);\n }\n}\nfunction loadFromPaths(rootInstance, values) {\n for (const [path, value] of Object.entries(values)) {\n const parts = path.split(\".\");\n loadValue(rootInstance, parts, value);\n }\n}\nfunction loadFromObject(rootInstance, values, currentPath = \"\") {\n for (let key in values) {\n const value = values[key];\n const newPath = currentPath ? `${currentPath}.${key}` : key;\n if (typeof value === \"object\" && !Array.isArray(value) && value !== null) {\n loadFromObject(rootInstance, value, newPath);\n } else {\n const parts = newPath.split(\".\");\n loadValue(rootInstance, parts, value);\n }\n }\n}\nfunction loadValue(rootInstance, parts, value) {\n let current = rootInstance;\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n if (i === parts.length - 1) {\n if (value == DELETE_TOKEN) {\n if (isSignal2(current)) {\n current = current();\n }\n Reflect.deleteProperty(current, part);\n } else if (current[part]?._subject) {\n current[part].set(value);\n } else if (isSignal2(current) && Array.isArray(current()) && !isNaN(Number(part))) {\n current()[Number(part)] = value;\n } else {\n current[part] = value;\n }\n } else {\n if (isSignal2(current)) {\n current = current();\n }\n const currentValue = current[part];\n if (currentValue === void 0) {\n const parentInstance = getByPath(\n rootInstance,\n parts.slice(0, i).join(\".\")\n );\n const classType = parentInstance?.options?.classType;\n if (classType) {\n current[part] = !isClass(classType) ? classType(part) : new classType();\n setMetadata(current[part], \"id\", part);\n } else {\n current[part] = {};\n }\n }\n current = current[part];\n }\n }\n}\nfunction getByPath(root, path) {\n const parts = path.split(\".\");\n let current = root;\n for (const part of parts) {\n if (isSignal2(current)) {\n current = current();\n }\n if (current[part]) {\n current = current[part];\n } else {\n return void 0;\n }\n }\n return current;\n}\nexport {\n DELETE_TOKEN,\n connected,\n createStatesSnapshot,\n createStatesSnapshotDeep,\n createSyncClass,\n generateShortUUID,\n getByPath,\n id,\n isClass,\n isFunction,\n isInstanceOfClass,\n isObject,\n load,\n normalizeSyncOptions,\n persist,\n setMetadata,\n sync,\n syncClass,\n type,\n users\n};\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0],"mappings":";;AAYA,SAAS,QAAQ,KAAK;CACpB,OAAO,OAAO,QAAQ,cAAc,IAAI,aAAa,IAAI,UAAU,gBAAgB;AACrF;AACA,IAAI,YAAY,SAAS,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,IAAI,KAAK,SAAS;AAC9F,SAAS,kBAAkB,OAAO;CAChC,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,UAAU,KAAK,KAAK,MAAM,QAAQ,KAAK,GACxF,OAAO;CAET,OAAO,OAAO,eAAe,KAAK,MAAM,OAAO;AACjD;AAYA,IAAI,eAAe;AA8GnB,SAAS,YAAY,QAAQ,KAAK,OAAO;CAEvC,MAAM,SADO,OAAO,YAAY,mBACX,IAAI,GAAG;CAC5B,IAAI,QACF,IAAI,SAAS,OAAO,OAAO,GACzB,OAAO,QAAQ,IAAI,KAAK;MAExB,OAAO,UAAU;AAGvB;AACA,IAAI,mBAAmB,cAAc,YAAY,MAAM,cAAc,MAAM,OAAO,OAAO;CACvF,aAAa,QAAQ;CACrB,IAAI,aACF,aAAa,iBAAiB,YAAY;CAE5C,IAAI,WACF,YAAY,cAAc,MAAM,SAAS;CAE3C,6BAA6B,YAAY;CACzC,IAAI,aAAa,WACf,KAAK,MAAM,OAAO,aAAa,UAAU,KAAK,GAAG;EAC/C,MAAM,SAAS,aAAa,UAAU,IAAI,GAAG;EAC7C,MAAM,eAAe,OAAO,SAAS,gBAAgB;EACrD,MAAM,WAAW,OAAO,SAAS,WAAW;EAC5C,MAAM,YAAY,OAAO,SAAS;EAClC,I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ACrB,cACA,MAAM,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,CAEG,GAAG,SAAS;IAC3C,IAAI,WAAW;KACb,QAAQ,QAAQ,CAAC,QAAQ,SAAS,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU;KACtE,YAAY,QAAQ,OAAO,MAAM,IAAI;IACvC,OACE,QAAQ,QAAQ,CAAC;GAErB;GACA,UAAU,QAAQ;EACpB;CACF;AACF;AACA,SAAS,UAAU,MAAM,MAAM;CAC7B,MAAM,QAAQ,KAAK,MAAM,GAAG;CAC5B,IAAI,UAAU;CACd,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAIA,SAAU,OAAO,GACnB,UAAU,QAAQ;EAEpB,IAAI,QAAQ,OACV,UAAU,QAAQ;OAElB;CAEJ;CACA,OAAO;AACT"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ReconnectingWebSocket } from "./
|
|
2
|
-
//#region ../../node_modules/.pnpm/partysocket@1.
|
|
1
|
+
import { ReconnectingWebSocket } from "./ws.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js
|
|
3
3
|
var valueIsNotNil = (keyValuePair) => keyValuePair[1] !== null && keyValuePair[1] !== void 0;
|
|
4
4
|
function generateUUID() {
|
|
5
|
-
if (
|
|
6
|
-
let d =
|
|
7
|
-
let d2 =
|
|
5
|
+
if (crypto?.randomUUID) return crypto.randomUUID();
|
|
6
|
+
let d = Date.now();
|
|
7
|
+
let d2 = performance?.now && performance.now() * 1e3 || 0;
|
|
8
8
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
9
9
|
let r = Math.random() * 16;
|
|
10
10
|
if (d > 0) {
|
|
@@ -21,12 +21,12 @@ function getPartyInfo(partySocketOptions, defaultProtocol, defaultParams = {}) {
|
|
|
21
21
|
const { host: rawHost, path: rawPath, protocol: rawProtocol, room, party, basePath, prefix, query } = partySocketOptions;
|
|
22
22
|
let host = rawHost.replace(/^(http|https|ws|wss):\/\//, "");
|
|
23
23
|
if (host.endsWith("/")) host = host.slice(0, -1);
|
|
24
|
-
if (rawPath
|
|
24
|
+
if (rawPath?.startsWith("/")) throw new Error("path must not start with a slash");
|
|
25
25
|
const name = party ?? "main";
|
|
26
26
|
const path = rawPath ? `/${rawPath}` : "";
|
|
27
27
|
const protocol = rawProtocol || (host.startsWith("localhost:") || host.startsWith("127.0.0.1:") || host.startsWith("192.168.") || host.startsWith("10.") || host.startsWith("172.") && host.split(".")[1] >= "16" && host.split(".")[1] <= "31" || host.startsWith("[::ffff:7f00:1]:") ? defaultProtocol : `${defaultProtocol}s`);
|
|
28
28
|
const baseUrl = `${protocol}://${host}/${basePath || `${prefix || "parties"}/${name}/${room}`}${path}`;
|
|
29
|
-
const makeUrl = (
|
|
29
|
+
const makeUrl = (query = {}) => `${baseUrl}?${new URLSearchParams([...Object.entries(defaultParams), ...Object.entries(query).filter(valueIsNotNil)])}`;
|
|
30
30
|
const urlProvider = typeof query === "function" ? async () => makeUrl(await query()) : makeUrl(query);
|
|
31
31
|
return {
|
|
32
32
|
host,
|
|
@@ -39,25 +39,35 @@ function getPartyInfo(partySocketOptions, defaultProtocol, defaultParams = {}) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
var PartySocket = class extends ReconnectingWebSocket {
|
|
42
|
-
constructor(partySocketOptions) {
|
|
43
|
-
const wsOptions = getWSOptions(partySocketOptions);
|
|
44
|
-
super(wsOptions.urlProvider, wsOptions.protocols, wsOptions.socketOptions);
|
|
45
|
-
this.partySocketOptions = partySocketOptions;
|
|
46
|
-
this.setWSProperties(wsOptions);
|
|
47
|
-
}
|
|
48
42
|
_pk;
|
|
49
43
|
_pkurl;
|
|
50
44
|
name;
|
|
51
45
|
room;
|
|
52
46
|
host;
|
|
53
47
|
path;
|
|
48
|
+
basePath;
|
|
49
|
+
constructor(partySocketOptions) {
|
|
50
|
+
const wsOptions = getWSOptions(partySocketOptions);
|
|
51
|
+
super(wsOptions.urlProvider, wsOptions.protocols, wsOptions.socketOptions);
|
|
52
|
+
this.partySocketOptions = partySocketOptions;
|
|
53
|
+
this.setWSProperties(wsOptions);
|
|
54
|
+
if (!partySocketOptions.startClosed && !this.room && !this.basePath) {
|
|
55
|
+
this.close();
|
|
56
|
+
throw new Error("Either room or basePath must be provided to connect. Use startClosed: true to create a socket and set them via updateProperties before calling reconnect().");
|
|
57
|
+
}
|
|
58
|
+
if (!partySocketOptions.disableNameValidation) {
|
|
59
|
+
if (partySocketOptions.party?.includes("/")) console.warn(`PartySocket: party name "${partySocketOptions.party}" contains forward slash which may cause routing issues. Consider using a name without forward slashes or set disableNameValidation: true to bypass this warning.`);
|
|
60
|
+
if (partySocketOptions.room?.includes("/")) console.warn(`PartySocket: room name "${partySocketOptions.room}" contains forward slash which may cause routing issues. Consider using a name without forward slashes or set disableNameValidation: true to bypass this warning.`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
54
63
|
updateProperties(partySocketOptions) {
|
|
55
64
|
const wsOptions = getWSOptions({
|
|
56
65
|
...this.partySocketOptions,
|
|
57
66
|
...partySocketOptions,
|
|
58
67
|
host: partySocketOptions.host ?? this.host,
|
|
59
68
|
room: partySocketOptions.room ?? this.room,
|
|
60
|
-
path: partySocketOptions.path ?? this.path
|
|
69
|
+
path: partySocketOptions.path ?? this.path,
|
|
70
|
+
basePath: partySocketOptions.basePath ?? this.basePath
|
|
61
71
|
});
|
|
62
72
|
this._url = wsOptions.urlProvider;
|
|
63
73
|
this._protocols = wsOptions.protocols;
|
|
@@ -65,16 +75,18 @@ var PartySocket = class extends ReconnectingWebSocket {
|
|
|
65
75
|
this.setWSProperties(wsOptions);
|
|
66
76
|
}
|
|
67
77
|
setWSProperties(wsOptions) {
|
|
68
|
-
const { _pk, _pkurl, name, room, host, path } = wsOptions;
|
|
78
|
+
const { _pk, _pkurl, name, room, host, path, basePath } = wsOptions;
|
|
69
79
|
this._pk = _pk;
|
|
70
80
|
this._pkurl = _pkurl;
|
|
71
81
|
this.name = name;
|
|
72
82
|
this.room = room;
|
|
73
83
|
this.host = host;
|
|
74
84
|
this.path = path;
|
|
85
|
+
this.basePath = basePath;
|
|
75
86
|
}
|
|
76
87
|
reconnect(code, reason) {
|
|
77
|
-
if (!this.
|
|
88
|
+
if (!this.host) throw new Error("The host must be set before connecting, use `updateProperties` method to set it or pass it to the constructor.");
|
|
89
|
+
if (!this.room && !this.basePath) throw new Error("The room (or basePath) must be set before connecting, use `updateProperties` method to set it or pass it to the constructor.");
|
|
78
90
|
super.reconnect(code, reason);
|
|
79
91
|
}
|
|
80
92
|
get id() {
|
|
@@ -104,6 +116,7 @@ function getWSOptions(partySocketOptions) {
|
|
|
104
116
|
room: party.room,
|
|
105
117
|
host: party.host,
|
|
106
118
|
path: party.path,
|
|
119
|
+
basePath: partySocketOptions.basePath,
|
|
107
120
|
protocols,
|
|
108
121
|
socketOptions,
|
|
109
122
|
urlProvider: party.urlProvider
|
|
@@ -112,4 +125,4 @@ function getWSOptions(partySocketOptions) {
|
|
|
112
125
|
//#endregion
|
|
113
126
|
export { PartySocket };
|
|
114
127
|
|
|
115
|
-
//# sourceMappingURL=
|
|
128
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../../../../node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js"],"sourcesContent":["import ReconnectingWebSocket from \"./ws.js\";\n//#region src/index.ts\nconst valueIsNotNil = (keyValuePair) =>\n keyValuePair[1] !== null && keyValuePair[1] !== void 0;\nfunction generateUUID() {\n if (crypto?.randomUUID) return crypto.randomUUID();\n let d = Date.now();\n let d2 = (performance?.now && performance.now() * 1e3) || 0;\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n let r = Math.random() * 16;\n if (d > 0) {\n r = ((d + r) % 16) | 0;\n d = Math.floor(d / 16);\n } else {\n r = ((d2 + r) % 16) | 0;\n d2 = Math.floor(d2 / 16);\n }\n return (c === \"x\" ? r : (r & 3) | 8).toString(16);\n });\n}\nfunction getPartyInfo(partySocketOptions, defaultProtocol, defaultParams = {}) {\n const {\n host: rawHost,\n path: rawPath,\n protocol: rawProtocol,\n room,\n party,\n basePath,\n prefix,\n query\n } = partySocketOptions;\n let host = rawHost.replace(/^(http|https|ws|wss):\\/\\//, \"\");\n if (host.endsWith(\"/\")) host = host.slice(0, -1);\n if (rawPath?.startsWith(\"/\"))\n throw new Error(\"path must not start with a slash\");\n const name = party ?? \"main\";\n const path = rawPath ? `/${rawPath}` : \"\";\n const protocol =\n rawProtocol ||\n (host.startsWith(\"localhost:\") ||\n host.startsWith(\"127.0.0.1:\") ||\n host.startsWith(\"192.168.\") ||\n host.startsWith(\"10.\") ||\n (host.startsWith(\"172.\") &&\n host.split(\".\")[1] >= \"16\" &&\n host.split(\".\")[1] <= \"31\") ||\n host.startsWith(\"[::ffff:7f00:1]:\")\n ? defaultProtocol\n : `${defaultProtocol}s`);\n const baseUrl = `${protocol}://${host}/${basePath || `${prefix || \"parties\"}/${name}/${room}`}${path}`;\n const makeUrl = (query = {}) =>\n `${baseUrl}?${new URLSearchParams([...Object.entries(defaultParams), ...Object.entries(query).filter(valueIsNotNil)])}`;\n const urlProvider =\n typeof query === \"function\"\n ? async () => makeUrl(await query())\n : makeUrl(query);\n return {\n host,\n path,\n room,\n name,\n protocol,\n partyUrl: baseUrl,\n urlProvider\n };\n}\nvar PartySocket = class extends ReconnectingWebSocket {\n _pk;\n _pkurl;\n name;\n room;\n host;\n path;\n basePath;\n constructor(partySocketOptions) {\n const wsOptions = getWSOptions(partySocketOptions);\n super(wsOptions.urlProvider, wsOptions.protocols, wsOptions.socketOptions);\n this.partySocketOptions = partySocketOptions;\n this.setWSProperties(wsOptions);\n if (!partySocketOptions.startClosed && !this.room && !this.basePath) {\n this.close();\n throw new Error(\n \"Either room or basePath must be provided to connect. Use startClosed: true to create a socket and set them via updateProperties before calling reconnect().\"\n );\n }\n if (!partySocketOptions.disableNameValidation) {\n if (partySocketOptions.party?.includes(\"/\"))\n console.warn(\n `PartySocket: party name \"${partySocketOptions.party}\" contains forward slash which may cause routing issues. Consider using a name without forward slashes or set disableNameValidation: true to bypass this warning.`\n );\n if (partySocketOptions.room?.includes(\"/\"))\n console.warn(\n `PartySocket: room name \"${partySocketOptions.room}\" contains forward slash which may cause routing issues. Consider using a name without forward slashes or set disableNameValidation: true to bypass this warning.`\n );\n }\n }\n updateProperties(partySocketOptions) {\n const wsOptions = getWSOptions({\n ...this.partySocketOptions,\n ...partySocketOptions,\n host: partySocketOptions.host ?? this.host,\n room: partySocketOptions.room ?? this.room,\n path: partySocketOptions.path ?? this.path,\n basePath: partySocketOptions.basePath ?? this.basePath\n });\n this._url = wsOptions.urlProvider;\n this._protocols = wsOptions.protocols;\n this._options = wsOptions.socketOptions;\n this.setWSProperties(wsOptions);\n }\n setWSProperties(wsOptions) {\n const { _pk, _pkurl, name, room, host, path, basePath } = wsOptions;\n this._pk = _pk;\n this._pkurl = _pkurl;\n this.name = name;\n this.room = room;\n this.host = host;\n this.path = path;\n this.basePath = basePath;\n }\n reconnect(code, reason) {\n if (!this.host)\n throw new Error(\n \"The host must be set before connecting, use `updateProperties` method to set it or pass it to the constructor.\"\n );\n if (!this.room && !this.basePath)\n throw new Error(\n \"The room (or basePath) must be set before connecting, use `updateProperties` method to set it or pass it to the constructor.\"\n );\n super.reconnect(code, reason);\n }\n get id() {\n return this._pk;\n }\n /**\n * Exposes the static PartyKit room URL without applying query parameters.\n * To access the currently connected WebSocket url, use PartySocket#url.\n */\n get roomUrl() {\n return this._pkurl;\n }\n static async fetch(options, init) {\n const party = getPartyInfo(options, \"http\");\n const url =\n typeof party.urlProvider === \"string\"\n ? party.urlProvider\n : await party.urlProvider();\n return (options.fetch ?? fetch)(url, init);\n }\n};\nfunction getWSOptions(partySocketOptions) {\n const {\n id,\n host: _host,\n path: _path,\n party: _party,\n room: _room,\n protocol: _protocol,\n query: _query,\n protocols,\n ...socketOptions\n } = partySocketOptions;\n const _pk = id || generateUUID();\n const party = getPartyInfo(partySocketOptions, \"ws\", { _pk });\n return {\n _pk,\n _pkurl: party.partyUrl,\n name: party.name,\n room: party.room,\n host: party.host,\n path: party.path,\n basePath: partySocketOptions.basePath,\n protocols,\n socketOptions,\n urlProvider: party.urlProvider\n };\n}\n//#endregion\nexport {\n PartySocket,\n PartySocket as default,\n ReconnectingWebSocket as WebSocket\n};\n\n//# sourceMappingURL=index.js.map\n"],"x_google_ignoreList":[0],"mappings":";;AAEA,IAAM,iBAAiB,iBACrB,aAAa,OAAO,QAAQ,aAAa,OAAO,KAAK;AACvD,SAAS,eAAe;CACtB,IAAI,QAAQ,YAAY,OAAO,OAAO,WAAW;CACjD,IAAI,IAAI,KAAK,IAAI;CACjB,IAAI,KAAM,aAAa,OAAO,YAAY,IAAI,IAAI,OAAQ;CAC1D,OAAO,uCAAuC,QAAQ,SAAS,SAAU,GAAG;EAC1E,IAAI,IAAI,KAAK,OAAO,IAAI;EACxB,IAAI,IAAI,GAAG;GACT,KAAM,IAAI,KAAK,KAAM;GACrB,IAAI,KAAK,MAAM,IAAI,EAAE;EACvB,OAAO;GACL,KAAM,KAAK,KAAK,KAAM;GACtB,KAAK,KAAK,MAAM,KAAK,EAAE;EACzB;EACA,QAAQ,MAAM,MAAM,IAAK,IAAI,IAAK,GAAG,SAAS,EAAE;CAClD,CAAC;AACH;AACA,SAAS,aAAa,oBAAoB,iBAAiB,gBAAgB,CAAC,GAAG;CAC7E,MAAM,EACJ,MAAM,SACN,MAAM,SACN,UAAU,aACV,MACA,OACA,UACA,QACA,UACE;CACJ,IAAI,OAAO,QAAQ,QAAQ,6BAA6B,EAAE;CAC1D,IAAI,KAAK,SAAS,GAAG,GAAG,OAAO,KAAK,MAAM,GAAG,EAAE;CAC/C,IAAI,SAAS,WAAW,G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,MAAM,MAAM,MAAM,aAAa;CAC/B,MAAM,QAAQ,aAAa,oBAAoB,MAAM,EAAE,IAAI,CAAC;CAC5D,OAAO;EACL;EACA,QAAQ,MAAM;EACd,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,UAAU,mBAAmB;EAC7B;EACA;EACA,aAAa,MAAM;CACrB;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/partysocket@1.
|
|
1
|
+
//#region ../../node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js
|
|
2
2
|
if (!globalThis.EventTarget || !globalThis.Event) console.error(`
|
|
3
3
|
PartySocket requires a global 'EventTarget' class to be available!
|
|
4
4
|
You can polyfill this global by adding this to your code before any partysocket imports:
|
|
@@ -44,11 +44,12 @@ function cloneEventNode(e) {
|
|
|
44
44
|
if ("error" in e) return new ErrorEvent(e.error, e);
|
|
45
45
|
return new Event(e.type, e);
|
|
46
46
|
}
|
|
47
|
-
var
|
|
48
|
-
var
|
|
47
|
+
var isNode = typeof process !== "undefined" && typeof process.versions?.node !== "undefined";
|
|
48
|
+
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
49
|
+
var cloneEvent = isNode || isReactNative ? cloneEventNode : cloneEventBrowser;
|
|
49
50
|
var DEFAULT = {
|
|
50
51
|
maxReconnectionDelay: 1e4,
|
|
51
|
-
minReconnectionDelay:
|
|
52
|
+
minReconnectionDelay: 3e3,
|
|
52
53
|
minUptime: 5e3,
|
|
53
54
|
reconnectionDelayGrowFactor: 1.3,
|
|
54
55
|
connectionTimeout: 4e3,
|
|
@@ -58,7 +59,8 @@ var DEFAULT = {
|
|
|
58
59
|
debug: false
|
|
59
60
|
};
|
|
60
61
|
var didWarnAboutMissingWebSocket = false;
|
|
61
|
-
|
|
62
|
+
function absorbError() {}
|
|
63
|
+
var ReconnectingWebSocket = class ReconnectingWebSocket extends EventTarget {
|
|
62
64
|
_ws;
|
|
63
65
|
_retryCount = -1;
|
|
64
66
|
_uptimeTimeout;
|
|
@@ -67,6 +69,7 @@ var ReconnectingWebSocket = class _ReconnectingWebSocket extends EventTarget {
|
|
|
67
69
|
_connectLock = false;
|
|
68
70
|
_binaryType = "blob";
|
|
69
71
|
_closeCalled = false;
|
|
72
|
+
_didWarnAboutClosedSend = false;
|
|
70
73
|
_messageQueue = [];
|
|
71
74
|
_debugLogger = console.log.bind(console);
|
|
72
75
|
_url;
|
|
@@ -94,16 +97,16 @@ var ReconnectingWebSocket = class _ReconnectingWebSocket extends EventTarget {
|
|
|
94
97
|
return 3;
|
|
95
98
|
}
|
|
96
99
|
get CONNECTING() {
|
|
97
|
-
return
|
|
100
|
+
return ReconnectingWebSocket.CONNECTING;
|
|
98
101
|
}
|
|
99
102
|
get OPEN() {
|
|
100
|
-
return
|
|
103
|
+
return ReconnectingWebSocket.OPEN;
|
|
101
104
|
}
|
|
102
105
|
get CLOSING() {
|
|
103
|
-
return
|
|
106
|
+
return ReconnectingWebSocket.CLOSING;
|
|
104
107
|
}
|
|
105
108
|
get CLOSED() {
|
|
106
|
-
return
|
|
109
|
+
return ReconnectingWebSocket.CLOSED;
|
|
107
110
|
}
|
|
108
111
|
get binaryType() {
|
|
109
112
|
return this._ws ? this._ws.binaryType : this._binaryType;
|
|
@@ -151,8 +154,9 @@ var ReconnectingWebSocket = class _ReconnectingWebSocket extends EventTarget {
|
|
|
151
154
|
* The current state of the connection; this is one of the Ready state constants
|
|
152
155
|
*/
|
|
153
156
|
get readyState() {
|
|
157
|
+
if (this._closeCalled) return ReconnectingWebSocket.CLOSED;
|
|
154
158
|
if (this._ws) return this._ws.readyState;
|
|
155
|
-
return this._options.startClosed ?
|
|
159
|
+
return this._options.startClosed ? ReconnectingWebSocket.CLOSED : ReconnectingWebSocket.CONNECTING;
|
|
156
160
|
}
|
|
157
161
|
/**
|
|
158
162
|
* The URL as resolved by the constructor
|
|
@@ -185,7 +189,14 @@ var ReconnectingWebSocket = class _ReconnectingWebSocket extends EventTarget {
|
|
|
185
189
|
onopen = null;
|
|
186
190
|
/**
|
|
187
191
|
* Closes the WebSocket connection or connection attempt, if any. If the connection is already
|
|
188
|
-
* CLOSED, this method does nothing
|
|
192
|
+
* CLOSED or CLOSING, this method does nothing.
|
|
193
|
+
*
|
|
194
|
+
* The `close` event is dispatched synchronously (mirroring how
|
|
195
|
+
* `reconnect()` dispatches its synthetic close). This guarantees
|
|
196
|
+
* consumers observe a terminal event for every explicit close, even
|
|
197
|
+
* if their listeners are detached right after this call — previously
|
|
198
|
+
* the real (asynchronous) browser close event could fire after
|
|
199
|
+
* listeners were removed and go unobserved entirely.
|
|
189
200
|
*/
|
|
190
201
|
close(code = 1e3, reason) {
|
|
191
202
|
this._closeCalled = true;
|
|
@@ -195,11 +206,11 @@ var ReconnectingWebSocket = class _ReconnectingWebSocket extends EventTarget {
|
|
|
195
206
|
this._debug("close enqueued: no ws instance");
|
|
196
207
|
return;
|
|
197
208
|
}
|
|
198
|
-
if (this._ws.readyState === this.CLOSED) {
|
|
199
|
-
this._debug("close: already closed");
|
|
209
|
+
if (this._ws.readyState === this.CLOSED || this._ws.readyState === this.CLOSING) {
|
|
210
|
+
this._debug("close: already closing or closed");
|
|
200
211
|
return;
|
|
201
212
|
}
|
|
202
|
-
this.
|
|
213
|
+
this._disconnect(code, reason);
|
|
203
214
|
}
|
|
204
215
|
/**
|
|
205
216
|
* Closes the WebSocket connection or connection attempt and connects again.
|
|
@@ -208,27 +219,52 @@ var ReconnectingWebSocket = class _ReconnectingWebSocket extends EventTarget {
|
|
|
208
219
|
reconnect(code, reason) {
|
|
209
220
|
this._shouldReconnect = true;
|
|
210
221
|
this._closeCalled = false;
|
|
222
|
+
this._didWarnAboutClosedSend = false;
|
|
211
223
|
this._retryCount = -1;
|
|
212
|
-
if (!this._ws || this._ws.readyState === this.CLOSED) this._connect();
|
|
224
|
+
if (!this._ws || this._ws.readyState === this.CLOSED || this._ws.readyState === this.CLOSING) this._connect();
|
|
213
225
|
else {
|
|
214
226
|
this._disconnect(code, reason);
|
|
215
227
|
this._connect();
|
|
216
228
|
}
|
|
217
229
|
}
|
|
218
230
|
/**
|
|
219
|
-
* Enqueue specified data to be transmitted to the server over the WebSocket connection
|
|
231
|
+
* Enqueue specified data to be transmitted to the server over the WebSocket connection.
|
|
232
|
+
*
|
|
233
|
+
* @returns `true` if the message was transmitted immediately over an open
|
|
234
|
+
* connection; `false` if it was buffered (sent when the connection next
|
|
235
|
+
* opens — the buffer is always flushed before the `open` event is
|
|
236
|
+
* dispatched) or dropped because `maxEnqueuedMessages` was reached.
|
|
220
237
|
*/
|
|
221
238
|
send(data) {
|
|
222
239
|
if (this._ws && this._ws.readyState === this.OPEN) {
|
|
223
240
|
this._debug("send", data);
|
|
224
241
|
this._ws.send(data);
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
if (this._closeCalled && !this._didWarnAboutClosedSend) {
|
|
245
|
+
this._didWarnAboutClosedSend = true;
|
|
246
|
+
console.warn("ReconnectingWebSocket: send() was called after close(). The message has been buffered, but it will only be delivered if reconnect() is called on this socket. If this socket has been discarded, the message is lost — this usually means a stale socket reference is being used.");
|
|
231
247
|
}
|
|
248
|
+
const { maxEnqueuedMessages = DEFAULT.maxEnqueuedMessages } = this._options;
|
|
249
|
+
if (this._messageQueue.length < maxEnqueuedMessages) {
|
|
250
|
+
this._debug("enqueue", data);
|
|
251
|
+
this._messageQueue.push(data);
|
|
252
|
+
}
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Removes and returns all messages that were passed to send() but never
|
|
257
|
+
* transmitted (they were buffered while the connection wasn't open).
|
|
258
|
+
*
|
|
259
|
+
* Useful when a socket is being discarded and replaced (e.g. the React
|
|
260
|
+
* hooks recreate the socket when connection options change): the
|
|
261
|
+
* replacement socket can re-send these messages, instead of them being
|
|
262
|
+
* silently lost with the old instance.
|
|
263
|
+
*/
|
|
264
|
+
drainQueuedMessages() {
|
|
265
|
+
const queue = this._messageQueue;
|
|
266
|
+
this._messageQueue = [];
|
|
267
|
+
return queue;
|
|
232
268
|
}
|
|
233
269
|
_debug(...args) {
|
|
234
270
|
if (this._options.debug) this._debugLogger("RWS>", ...args);
|
|
@@ -274,6 +310,7 @@ var ReconnectingWebSocket = class _ReconnectingWebSocket extends EventTarget {
|
|
|
274
310
|
const { maxRetries = DEFAULT.maxRetries, connectionTimeout = DEFAULT.connectionTimeout } = this._options;
|
|
275
311
|
if (this._retryCount >= maxRetries) {
|
|
276
312
|
this._debug("max retries reached", this._retryCount, ">=", maxRetries);
|
|
313
|
+
this._connectLock = false;
|
|
277
314
|
return;
|
|
278
315
|
}
|
|
279
316
|
this._retryCount++;
|
|
@@ -285,7 +322,7 @@ var ReconnectingWebSocket = class _ReconnectingWebSocket extends EventTarget {
|
|
|
285
322
|
return;
|
|
286
323
|
}
|
|
287
324
|
if (!this._options.WebSocket && typeof WebSocket === "undefined" && !didWarnAboutMissingWebSocket) {
|
|
288
|
-
console.error(
|
|
325
|
+
console.error(`‼️ No WebSocket implementation available. You should define options.WebSocket.
|
|
289
326
|
|
|
290
327
|
For example, if you're using node.js, run \`npm install ws\`, and then in your code:
|
|
291
328
|
|
|
@@ -325,9 +362,9 @@ const partysocket = new PartySocket({
|
|
|
325
362
|
if (!this._ws) return;
|
|
326
363
|
this._removeListeners();
|
|
327
364
|
try {
|
|
328
|
-
if (this._ws.readyState === this.OPEN) this._ws.close(code, reason);
|
|
365
|
+
if (this._ws.readyState === this.OPEN || this._ws.readyState === this.CONNECTING) this._ws.close(code, reason);
|
|
329
366
|
this._handleClose(new Events.CloseEvent(code, reason, this));
|
|
330
|
-
} catch (
|
|
367
|
+
} catch (_error) {}
|
|
331
368
|
}
|
|
332
369
|
_acceptOpen() {
|
|
333
370
|
this._debug("accept open");
|
|
@@ -341,8 +378,7 @@ const partysocket = new PartySocket({
|
|
|
341
378
|
assert(this._ws, "WebSocket is not defined");
|
|
342
379
|
this._ws.binaryType = this._binaryType;
|
|
343
380
|
this._messageQueue.forEach((message) => {
|
|
344
|
-
|
|
345
|
-
return (_a2 = this._ws) == null ? void 0 : _a2.send(message);
|
|
381
|
+
this._ws?.send(message);
|
|
346
382
|
});
|
|
347
383
|
this._messageQueue = [];
|
|
348
384
|
if (this.onopen) this.onopen(event);
|
|
@@ -375,6 +411,7 @@ const partysocket = new PartySocket({
|
|
|
375
411
|
this._ws.removeEventListener("close", this._handleClose);
|
|
376
412
|
this._ws.removeEventListener("message", this._handleMessage);
|
|
377
413
|
this._ws.removeEventListener("error", this._handleError);
|
|
414
|
+
this._ws.addEventListener("error", absorbError);
|
|
378
415
|
}
|
|
379
416
|
_addListeners() {
|
|
380
417
|
if (!this._ws) return;
|
|
@@ -389,13 +426,7 @@ const partysocket = new PartySocket({
|
|
|
389
426
|
clearTimeout(this._uptimeTimeout);
|
|
390
427
|
}
|
|
391
428
|
};
|
|
392
|
-
/*!
|
|
393
|
-
* Reconnecting WebSocket
|
|
394
|
-
* by Pedro Ladaria <pedro.ladaria@gmail.com>
|
|
395
|
-
* https://github.com/pladaria/reconnecting-websocket
|
|
396
|
-
* License MIT
|
|
397
|
-
*/
|
|
398
429
|
//#endregion
|
|
399
430
|
export { ReconnectingWebSocket };
|
|
400
431
|
|
|
401
|
-
//# sourceMappingURL=
|
|
432
|
+
//# sourceMappingURL=ws.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws.js","names":[],"sources":["../../../../../../../../../node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js"],"sourcesContent":["//#region src/ws.ts\nif (!globalThis.EventTarget || !globalThis.Event)\n console.error(`\n PartySocket requires a global 'EventTarget' class to be available!\n You can polyfill this global by adding this to your code before any partysocket imports: \n \n \\`\\`\\`\n import 'partysocket/event-target-polyfill';\n \\`\\`\\`\n Please file an issue at https://github.com/partykit/partykit if you're still having trouble.\n`);\nvar ErrorEvent = class extends Event {\n message;\n error;\n constructor(error, target) {\n super(\"error\", target);\n this.message = error.message;\n this.error = error;\n }\n};\nvar CloseEvent = class extends Event {\n code;\n reason;\n wasClean = true;\n constructor(code = 1e3, reason = \"\", target) {\n super(\"close\", target);\n this.code = code;\n this.reason = reason;\n }\n};\nconst Events = {\n Event,\n ErrorEvent,\n CloseEvent\n};\nfunction assert(condition, msg) {\n if (!condition) throw new Error(msg);\n}\nfunction cloneEventBrowser(e) {\n return new e.constructor(e.type, e);\n}\nfunction cloneEventNode(e) {\n if (\"data\" in e) return new MessageEvent(e.type, e);\n if (\"code\" in e || \"reason\" in e)\n return new CloseEvent(e.code || 1999, e.reason || \"unknown reason\", e);\n if (\"error\" in e) return new ErrorEvent(e.error, e);\n return new Event(e.type, e);\n}\nconst isNode =\n typeof process !== \"undefined\" &&\n typeof process.versions?.node !== \"undefined\";\nconst isReactNative =\n typeof navigator !== \"undefined\" && navigator.product === \"ReactNative\";\nconst cloneEvent = isNode || isReactNative ? cloneEventNode : cloneEventBrowser;\nconst DEFAULT = {\n maxReconnectionDelay: 1e4,\n minReconnectionDelay: 3e3,\n minUptime: 5e3,\n reconnectionDelayGrowFactor: 1.3,\n connectionTimeout: 4e3,\n maxRetries: Number.POSITIVE_INFINITY,\n maxEnqueuedMessages: Number.POSITIVE_INFINITY,\n startClosed: false,\n debug: false\n};\nlet didWarnAboutMissingWebSocket = false;\nfunction absorbError() {}\nvar ReconnectingWebSocket = class ReconnectingWebSocket extends EventTarget {\n _ws;\n _retryCount = -1;\n _uptimeTimeout;\n _connectTimeout;\n _shouldReconnect = true;\n _connectLock = false;\n _binaryType = \"blob\";\n _closeCalled = false;\n _didWarnAboutClosedSend = false;\n _messageQueue = [];\n _debugLogger = console.log.bind(console);\n _url;\n _protocols;\n _options;\n constructor(url, protocols, options = {}) {\n super();\n this._url = url;\n this._protocols = protocols;\n this._options = options;\n if (this._options.startClosed) this._shouldReconnect = false;\n if (this._options.debugLogger)\n this._debugLogger = this._options.debugLogger;\n this._connect();\n }\n static get CONNECTING() {\n return 0;\n }\n static get OPEN() {\n return 1;\n }\n static get CLOSING() {\n return 2;\n }\n static get CLOSED() {\n return 3;\n }\n get CONNECTING() {\n return ReconnectingWebSocket.CONNECTING;\n }\n get OPEN() {\n return ReconnectingWebSocket.OPEN;\n }\n get CLOSING() {\n return ReconnectingWebSocket.CLOSING;\n }\n get CLOSED() {\n return ReconnectingWebSocket.CLOSED;\n }\n get binaryType() {\n return this._ws ? this._ws.binaryType : this._binaryType;\n }\n set binaryType(value) {\n this._binaryType = value;\n if (this._ws) this._ws.binaryType = value;\n }\n /**\n * Returns the number or connection retries\n */\n get retryCount() {\n return Math.max(this._retryCount, 0);\n }\n /**\n * The number of bytes of data that have been queued using calls to send() but not yet\n * transmitted to the network. This value resets to zero once all queued data has been sent.\n * This value does not reset to zero when the connection is closed; if you keep calling send(),\n * this will continue to climb. Read only\n */\n get bufferedAmount() {\n return (\n this._messageQueue.reduce((acc, message) => {\n if (typeof message === \"string\") acc += message.length;\n else if (message instanceof Blob) acc += message.size;\n else acc += message.byteLength;\n return acc;\n }, 0) + (this._ws ? this._ws.bufferedAmount : 0)\n );\n }\n /**\n * The extensions selected by the server. This is currently only the empty string or a list of\n * extensions as negotiated by the connection\n */\n get extensions() {\n return this._ws ? this._ws.extensions : \"\";\n }\n /**\n * A string indicating the name of the sub-protocol the server selected;\n * this will be one of the strings specified in the protocols parameter when creating the\n * WebSocket object\n */\n get protocol() {\n return this._ws ? this._ws.protocol : \"\";\n }\n /**\n * The current state of the connection; this is one of the Ready state constants\n */\n get readyState() {\n if (this._closeCalled) return ReconnectingWebSocket.CLOSED;\n if (this._ws) return this._ws.readyState;\n return this._options.startClosed\n ? ReconnectingWebSocket.CLOSED\n : ReconnectingWebSocket.CONNECTING;\n }\n /**\n * The URL as resolved by the constructor\n */\n get url() {\n return this._ws ? this._ws.url : \"\";\n }\n /**\n * Whether the websocket object is now in reconnectable state\n */\n get shouldReconnect() {\n return this._shouldReconnect;\n }\n /**\n * An event listener to be called when the WebSocket connection's readyState changes to CLOSED\n */\n onclose = null;\n /**\n * An event listener to be called when an error occurs\n */\n onerror = null;\n /**\n * An event listener to be called when a message is received from the server\n */\n onmessage = null;\n /**\n * An event listener to be called when the WebSocket connection's readyState changes to OPEN;\n * this indicates that the connection is ready to send and receive data\n */\n onopen = null;\n /**\n * Closes the WebSocket connection or connection attempt, if any. If the connection is already\n * CLOSED or CLOSING, this method does nothing.\n *\n * The `close` event is dispatched synchronously (mirroring how\n * `reconnect()` dispatches its synthetic close). This guarantees\n * consumers observe a terminal event for every explicit close, even\n * if their listeners are detached right after this call — previously\n * the real (asynchronous) browser close event could fire after\n * listeners were removed and go unobserved entirely.\n */\n close(code = 1e3, reason) {\n this._closeCalled = true;\n this._shouldReconnect = false;\n this._clearTimeouts();\n if (!this._ws) {\n this._debug(\"close enqueued: no ws instance\");\n return;\n }\n if (\n this._ws.readyState === this.CLOSED ||\n this._ws.readyState === this.CLOSING\n ) {\n this._debug(\"close: already closing or closed\");\n return;\n }\n this._disconnect(code, reason);\n }\n /**\n * Closes the WebSocket connection or connection attempt and connects again.\n * Resets retry counter;\n */\n reconnect(code, reason) {\n this._shouldReconnect = true;\n this._closeCalled = false;\n this._didWarnAboutClosedSend = false;\n this._retryCount = -1;\n if (\n !this._ws ||\n this._ws.readyState === this.CLOSED ||\n this._ws.readyState === this.CLOSING\n )\n this._connect();\n else {\n this._disconnect(code, reason);\n this._connect();\n }\n }\n /**\n * Enqueue specified data to be transmitted to the server over the WebSocket connection.\n *\n * @returns `true` if the message was transmitted immediately over an open\n * connection; `false` if it was buffered (sent when the connection next\n * opens — the buffer is always flushed before the `open` event is\n * dispatched) or dropped because `maxEnqueuedMessages` was reached.\n */\n send(data) {\n if (this._ws && this._ws.readyState === this.OPEN) {\n this._debug(\"send\", data);\n this._ws.send(data);\n return true;\n }\n if (this._closeCalled && !this._didWarnAboutClosedSend) {\n this._didWarnAboutClosedSend = true;\n console.warn(\n \"ReconnectingWebSocket: send() was called after close(). The message has been buffered, but it will only be delivered if reconnect() is called on this socket. If this socket has been discarded, the message is lost — this usually means a stale socket reference is being used.\"\n );\n }\n const { maxEnqueuedMessages = DEFAULT.maxEnqueuedMessages } = this._options;\n if (this._messageQueue.length < maxEnqueuedMessages) {\n this._debug(\"enqueue\", data);\n this._messageQueue.push(data);\n }\n return false;\n }\n /**\n * Removes and returns all messages that were passed to send() but never\n * transmitted (they were buffered while the connection wasn't open).\n *\n * Useful when a socket is being discarded and replaced (e.g. the React\n * hooks recreate the socket when connection options change): the\n * replacement socket can re-send these messages, instead of them being\n * silently lost with the old instance.\n */\n drainQueuedMessages() {\n const queue = this._messageQueue;\n this._messageQueue = [];\n return queue;\n }\n _debug(...args) {\n if (this._options.debug) this._debugLogger(\"RWS>\", ...args);\n }\n _getNextDelay() {\n const {\n reconnectionDelayGrowFactor = DEFAULT.reconnectionDelayGrowFactor,\n minReconnectionDelay = DEFAULT.minReconnectionDelay,\n maxReconnectionDelay = DEFAULT.maxReconnectionDelay\n } = this._options;\n let delay = 0;\n if (this._retryCount > 0) {\n delay =\n minReconnectionDelay *\n reconnectionDelayGrowFactor ** (this._retryCount - 1);\n if (delay > maxReconnectionDelay) delay = maxReconnectionDelay;\n }\n this._debug(\"next delay\", delay);\n return delay;\n }\n _wait() {\n return new Promise((resolve) => {\n setTimeout(resolve, this._getNextDelay());\n });\n }\n _getNextProtocols(protocolsProvider) {\n if (!protocolsProvider) return Promise.resolve(null);\n if (\n typeof protocolsProvider === \"string\" ||\n Array.isArray(protocolsProvider)\n )\n return Promise.resolve(protocolsProvider);\n if (typeof protocolsProvider === \"function\") {\n const protocols = protocolsProvider();\n if (!protocols) return Promise.resolve(null);\n if (typeof protocols === \"string\" || Array.isArray(protocols))\n return Promise.resolve(protocols);\n if (protocols.then) return protocols;\n }\n throw Error(\"Invalid protocols\");\n }\n _getNextUrl(urlProvider) {\n if (typeof urlProvider === \"string\") return Promise.resolve(urlProvider);\n if (typeof urlProvider === \"function\") {\n const url = urlProvider();\n if (typeof url === \"string\") return Promise.resolve(url);\n if (url.then) return url;\n }\n throw Error(\"Invalid URL\");\n }\n _connect() {\n if (this._connectLock || !this._shouldReconnect) return;\n this._connectLock = true;\n const {\n maxRetries = DEFAULT.maxRetries,\n connectionTimeout = DEFAULT.connectionTimeout\n } = this._options;\n if (this._retryCount >= maxRetries) {\n this._debug(\"max retries reached\", this._retryCount, \">=\", maxRetries);\n this._connectLock = false;\n return;\n }\n this._retryCount++;\n this._debug(\"connect\", this._retryCount);\n this._removeListeners();\n this._wait()\n .then(() =>\n Promise.all([\n this._getNextUrl(this._url),\n this._getNextProtocols(this._protocols || null)\n ])\n )\n .then(([url, protocols]) => {\n if (this._closeCalled) {\n this._connectLock = false;\n return;\n }\n if (\n !this._options.WebSocket &&\n typeof WebSocket === \"undefined\" &&\n !didWarnAboutMissingWebSocket\n ) {\n console.error(`‼️ No WebSocket implementation available. You should define options.WebSocket. \n\nFor example, if you're using node.js, run \\`npm install ws\\`, and then in your code:\n\nimport PartySocket from 'partysocket';\nimport WS from 'ws';\n\nconst partysocket = new PartySocket({\n host: \"127.0.0.1:1999\",\n room: \"test-room\",\n WebSocket: WS\n});\n\n`);\n didWarnAboutMissingWebSocket = true;\n }\n const WS = this._options.WebSocket || WebSocket;\n this._debug(\"connect\", {\n url,\n protocols\n });\n this._ws = protocols ? new WS(url, protocols) : new WS(url);\n this._ws.binaryType = this._binaryType;\n this._connectLock = false;\n this._addListeners();\n this._connectTimeout = setTimeout(\n () => this._handleTimeout(),\n connectionTimeout\n );\n })\n .catch((err) => {\n this._connectLock = false;\n this._handleError(new Events.ErrorEvent(Error(err.message), this));\n });\n }\n _handleTimeout() {\n this._debug(\"timeout event\");\n this._handleError(new Events.ErrorEvent(Error(\"TIMEOUT\"), this));\n }\n _disconnect(code = 1e3, reason) {\n this._clearTimeouts();\n if (!this._ws) return;\n this._removeListeners();\n try {\n if (\n this._ws.readyState === this.OPEN ||\n this._ws.readyState === this.CONNECTING\n )\n this._ws.close(code, reason);\n this._handleClose(new Events.CloseEvent(code, reason, this));\n } catch (_error) {}\n }\n _acceptOpen() {\n this._debug(\"accept open\");\n this._retryCount = 0;\n }\n _handleOpen = (event) => {\n this._debug(\"open event\");\n const { minUptime = DEFAULT.minUptime } = this._options;\n clearTimeout(this._connectTimeout);\n this._uptimeTimeout = setTimeout(() => this._acceptOpen(), minUptime);\n assert(this._ws, \"WebSocket is not defined\");\n this._ws.binaryType = this._binaryType;\n this._messageQueue.forEach((message) => {\n this._ws?.send(message);\n });\n this._messageQueue = [];\n if (this.onopen) this.onopen(event);\n this.dispatchEvent(cloneEvent(event));\n };\n _handleMessage = (event) => {\n this._debug(\"message event\");\n if (this.onmessage) this.onmessage(event);\n this.dispatchEvent(cloneEvent(event));\n };\n _handleError = (event) => {\n this._debug(\"error event\", event.message);\n this._disconnect(void 0, event.message === \"TIMEOUT\" ? \"timeout\" : void 0);\n if (this.onerror) this.onerror(event);\n this._debug(\"exec error listeners\");\n this.dispatchEvent(cloneEvent(event));\n this._connect();\n };\n _handleClose = (event) => {\n this._debug(\"close event\");\n this._clearTimeouts();\n if (this._shouldReconnect) this._connect();\n if (this.onclose) this.onclose(event);\n this.dispatchEvent(cloneEvent(event));\n };\n _removeListeners() {\n if (!this._ws) return;\n this._debug(\"removeListeners\");\n this._ws.removeEventListener(\"open\", this._handleOpen);\n this._ws.removeEventListener(\"close\", this._handleClose);\n this._ws.removeEventListener(\"message\", this._handleMessage);\n this._ws.removeEventListener(\"error\", this._handleError);\n this._ws.addEventListener(\"error\", absorbError);\n }\n _addListeners() {\n if (!this._ws) return;\n this._debug(\"addListeners\");\n this._ws.addEventListener(\"open\", this._handleOpen);\n this._ws.addEventListener(\"close\", this._handleClose);\n this._ws.addEventListener(\"message\", this._handleMessage);\n this._ws.addEventListener(\"error\", this._handleError);\n }\n _clearTimeouts() {\n clearTimeout(this._connectTimeout);\n clearTimeout(this._uptimeTimeout);\n }\n};\n//#endregion\nexport { CloseEvent, ErrorEvent, ReconnectingWebSocket as default };\n\n//# sourceMappingURL=ws.js.map\n"],"x_google_ignoreList":[0],"mappings":";AACA,IAAI,CAAC,WAAW,eAAe,CAAC,WAAW,OACzC,QAAQ,MAAM;;;;;;;;CAQf;AACD,IAAI,aAAa,cAAc,MAAM;CACnC;CACA;CACA,YAAY,OAAO,QAAQ;EACzB,MAAM,SAAS,MAAM;EACrB,KAAK,UAAU,MAAM;EACrB,KAAK,QAAQ;CACf;AACF;AACA,IAAI,aAAa,cAAc,MAAM;CACnC;CACA;CACA,WAAW;CACX,YAAY,OAAO,KAAK,SAAS,IAAI,QAAQ;EAC3C,MAAM,SAAS,MAAM;EACrB,KAAK,OAAO;EACZ,KAAK,SAAS;CAChB;AACF;AACA,IAAM,SAAS;CACb;CACA;CACA;AACF;AACA,SAAS,OAAO,WAAW,KAAK;CAC9B,IAAI,CAAC,WAAW,MAAM,IAAI,MAAM,GAAG;AACrC;AACA,SAAS,kBAAkB,GAAG;CAC5B,OAAO,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC;AACpC;AACA,SAAS,eAAe,GAAG;CACzB,IAAI,UAAU,GAAG,OAAO,IAAI,aAAa,EAAE,MAAM,CAAC;CAClD,IAAI,UAAU,KAAK,YAAY,GAC7B,OAAO,IAAI,WAAW,EAAE,QAAQ,MAAM,EAAE,UAAU,kBAAkB,CAAC;CACvE,IAAI,WAAW,GAAG,OAAO,IAAI,WAAW,EAAE,OAAO,CAAC;CAClD,OAAO,IAAI,MAAM,EAAE,MAAM,CAAC;AAC5B;AACA,IAAM,SACJ,OAAO,YAAY,eACnB,OAAO,QAAQ,UAAU,SAAS;AACpC,IAAM,gBACJ,OAAO,cAAc,eAAe,UAAU,YAAY;AAC5D,IAAM,aAAa,UAAU,gBAAgB,iBAAiB;AAC9D,IAAM,U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4
|
+
import "./v3/errors.js";
|
|
5
|
+
import "./v3/helpers/parseUtil.js";
|
|
6
|
+
import "./v3/types.js";
|
|
7
|
+
import { external_exports } from "./v3/external.js";
|
|
8
|
+
//#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js
|
|
9
|
+
var zod_default = external_exports;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { zod_default as default };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["z"],"sources":["../../../../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js"],"sourcesContent":["import * as z from \"./v3/external.js\";\nexport * from \"./v3/external.js\";\nexport { z };\nexport default z;\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAGA,IAAA,cAAeA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { util } from "./helpers/util.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
3
|
+
var ZodIssueCode = util.arrayToEnum([
|
|
4
|
+
"invalid_type",
|
|
5
|
+
"invalid_literal",
|
|
6
|
+
"custom",
|
|
7
|
+
"invalid_union",
|
|
8
|
+
"invalid_union_discriminator",
|
|
9
|
+
"invalid_enum_value",
|
|
10
|
+
"unrecognized_keys",
|
|
11
|
+
"invalid_arguments",
|
|
12
|
+
"invalid_return_type",
|
|
13
|
+
"invalid_date",
|
|
14
|
+
"invalid_string",
|
|
15
|
+
"too_small",
|
|
16
|
+
"too_big",
|
|
17
|
+
"invalid_intersection_types",
|
|
18
|
+
"not_multiple_of",
|
|
19
|
+
"not_finite"
|
|
20
|
+
]);
|
|
21
|
+
var quotelessJson = (obj) => {
|
|
22
|
+
return JSON.stringify(obj, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
23
|
+
};
|
|
24
|
+
var ZodError = class ZodError extends Error {
|
|
25
|
+
get errors() {
|
|
26
|
+
return this.issues;
|
|
27
|
+
}
|
|
28
|
+
constructor(issues) {
|
|
29
|
+
super();
|
|
30
|
+
this.issues = [];
|
|
31
|
+
this.addIssue = (sub) => {
|
|
32
|
+
this.issues = [...this.issues, sub];
|
|
33
|
+
};
|
|
34
|
+
this.addIssues = (subs = []) => {
|
|
35
|
+
this.issues = [...this.issues, ...subs];
|
|
36
|
+
};
|
|
37
|
+
const actualProto = new.target.prototype;
|
|
38
|
+
if (Object.setPrototypeOf) Object.setPrototypeOf(this, actualProto);
|
|
39
|
+
else this.__proto__ = actualProto;
|
|
40
|
+
this.name = "ZodError";
|
|
41
|
+
this.issues = issues;
|
|
42
|
+
}
|
|
43
|
+
format(_mapper) {
|
|
44
|
+
const mapper = _mapper || function(issue) {
|
|
45
|
+
return issue.message;
|
|
46
|
+
};
|
|
47
|
+
const fieldErrors = { _errors: [] };
|
|
48
|
+
const processError = (error) => {
|
|
49
|
+
for (const issue of error.issues) if (issue.code === "invalid_union") issue.unionErrors.map(processError);
|
|
50
|
+
else if (issue.code === "invalid_return_type") processError(issue.returnTypeError);
|
|
51
|
+
else if (issue.code === "invalid_arguments") processError(issue.argumentsError);
|
|
52
|
+
else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
|
|
53
|
+
else {
|
|
54
|
+
let curr = fieldErrors;
|
|
55
|
+
let i = 0;
|
|
56
|
+
while (i < issue.path.length) {
|
|
57
|
+
const el = issue.path[i];
|
|
58
|
+
if (!(i === issue.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
59
|
+
else {
|
|
60
|
+
curr[el] = curr[el] || { _errors: [] };
|
|
61
|
+
curr[el]._errors.push(mapper(issue));
|
|
62
|
+
}
|
|
63
|
+
curr = curr[el];
|
|
64
|
+
i++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
processError(this);
|
|
69
|
+
return fieldErrors;
|
|
70
|
+
}
|
|
71
|
+
static assert(value) {
|
|
72
|
+
if (!(value instanceof ZodError)) throw new Error(`Not a ZodError: ${value}`);
|
|
73
|
+
}
|
|
74
|
+
toString() {
|
|
75
|
+
return this.message;
|
|
76
|
+
}
|
|
77
|
+
get message() {
|
|
78
|
+
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
|
|
79
|
+
}
|
|
80
|
+
get isEmpty() {
|
|
81
|
+
return this.issues.length === 0;
|
|
82
|
+
}
|
|
83
|
+
flatten(mapper = (issue) => issue.message) {
|
|
84
|
+
const fieldErrors = {};
|
|
85
|
+
const formErrors = [];
|
|
86
|
+
for (const sub of this.issues) if (sub.path.length > 0) {
|
|
87
|
+
const firstEl = sub.path[0];
|
|
88
|
+
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
|
|
89
|
+
fieldErrors[firstEl].push(mapper(sub));
|
|
90
|
+
} else formErrors.push(mapper(sub));
|
|
91
|
+
return {
|
|
92
|
+
formErrors,
|
|
93
|
+
fieldErrors
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
get formErrors() {
|
|
97
|
+
return this.flatten();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
ZodError.create = (issues) => {
|
|
101
|
+
return new ZodError(issues);
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { ZodError, ZodIssueCode, quotelessJson };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=ZodError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZodError.js","names":[],"sources":["../../../../../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js"],"sourcesContent":["import { util } from \"./helpers/util.js\";\nexport const ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nexport const quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nexport class ZodError extends Error {\n get errors() {\n return this.issues;\n }\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n // if (typeof el === \"string\") {\n // curr[el] = curr[el] || { _errors: [] };\n // } else if (typeof el === \"number\") {\n // const errorArray: any = [];\n // errorArray._errors = [];\n // curr[el] = curr[el] || errorArray;\n // }\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n static assert(value) {\n if (!(value instanceof ZodError)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n const firstEl = sub.path[0];\n fieldErrors[firstEl] = fieldErrors[firstEl] || [];\n fieldErrors[firstEl].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n"],"x_google_ignoreList":[0],"mappings":";;AACA,IAAa,eAAe,KAAK,YAAY;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ,CAAC;AACD,IAAa,iBAAiB,QAAQ;CAElC,OADa,KAAK,UAAU,KAAK,MAAM,CAC7B,EAAE,QAAQ,eAAe,KAAK;AAC5C;AACA,IAAa,WAAb,MAAa,iBAAiB,MAAM;CAChC,IAAI,SAAS;EACT,OAAO,KAAK;CAChB;CACA,YAAY,QAAQ;EAChB,MAAM;EACN,KAAK,SAAS,CAAC;EACf,KAAK,YAAY,QAAQ;GACrB,KAAK,SAAS,CAAC,GAAG,KAAK,QAAQ,GAAG;EACtC;EACA,KAAK,aAAa,OAAO,CAAC,MAAM;GAC5B,KAAK,SAAS,CAAC,GAAG,KAAK,QAAQ,GAAG,IAAI;EAC1C;EACA,MAAM,cAAc,IAAI,OAAO;EAC/B,IAAI,OAAO,gBAEP,OAAO,eAAe,MAAM,WAAW;OAGvC,KAAK,YAAY;EAErB,KAAK,OAAO;EACZ,KAAK,SAAS;CAClB;CACA,OAAO,SAAS;EACZ,MAAM,SAAS,WACX,SAAU,OAAO;GACb,OAAO,MAAM;EACjB;EACJ,MAAM,cAAc,EAAE,SAAS,CAAC,EAAE;EAClC,MAAM,gBAAgB,UAAU;GAC5B,KAAK,MAAM,SAAS,MAAM,QACtB,IAAI,MAAM,SAAS,iBACf,M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xB;AACJ;AACA,SAAS,UAAU,WAAW;CAE1B,OAAO,IADW,SAAS,MAChB;AACf"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import errorMap from "./locales/en.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
|
|
3
|
+
var overrideErrorMap = errorMap;
|
|
4
|
+
function setErrorMap(map) {
|
|
5
|
+
overrideErrorMap = map;
|
|
6
|
+
}
|
|
7
|
+
function getErrorMap() {
|
|
8
|
+
return overrideErrorMap;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { getErrorMap, setErrorMap };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","names":["defaultErrorMap"],"sources":["../../../../../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js"],"sourcesContent":["import defaultErrorMap from \"./locales/en.js\";\nlet overrideErrorMap = defaultErrorMap;\nexport { defaultErrorMap };\nexport function setErrorMap(map) {\n overrideErrorMap = map;\n}\nexport function getErrorMap() {\n return overrideErrorMap;\n}\n"],"x_google_ignoreList":[0],"mappings":";;AACA,IAAI,mBAAmBA;AAEvB,SAAgB,YAAY,KAAK;CAC7B,mBAAmB;AACvB;AACA,SAAgB,cAAc;CAC1B,OAAO;AACX"}
|