@rpgjs/client 5.0.0-beta.2 → 5.0.0-beta.22
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 +130 -0
- package/dist/Game/AnimationManager.d.ts +2 -1
- package/dist/Game/AnimationManager.js +21 -9
- package/dist/Game/AnimationManager.js.map +1 -1
- package/dist/Game/AnimationManager.spec.d.ts +1 -0
- package/dist/Game/ClientVisuals.d.ts +61 -0
- package/dist/Game/ClientVisuals.js +96 -0
- package/dist/Game/ClientVisuals.js.map +1 -0
- package/dist/Game/ClientVisuals.spec.d.ts +1 -0
- package/dist/Game/Event.js.map +1 -1
- package/dist/Game/EventComponentResolver.d.ts +16 -0
- package/dist/Game/EventComponentResolver.js +52 -0
- package/dist/Game/EventComponentResolver.js.map +1 -0
- package/dist/Game/EventComponentResolver.spec.d.ts +1 -0
- package/dist/Game/Map.d.ts +9 -1
- package/dist/Game/Map.js +83 -5
- package/dist/Game/Map.js.map +1 -1
- package/dist/Game/Object.d.ts +49 -15
- package/dist/Game/Object.js +101 -42
- package/dist/Game/Object.js.map +1 -1
- package/dist/Game/Object.spec.d.ts +1 -0
- package/dist/Game/Player.js.map +1 -1
- package/dist/Game/ProjectileManager.d.ts +98 -0
- package/dist/Game/ProjectileManager.js +196 -0
- package/dist/Game/ProjectileManager.js.map +1 -0
- package/dist/Game/ProjectileManager.spec.d.ts +1 -0
- package/dist/Gui/Gui.d.ts +20 -6
- package/dist/Gui/Gui.js +132 -57
- package/dist/Gui/Gui.js.map +1 -1
- package/dist/Gui/Gui.spec.d.ts +1 -0
- package/dist/Gui/NotificationManager.js.map +1 -1
- package/dist/Resource.js +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/RpgClient.d.ts +194 -15
- package/dist/RpgClientEngine.d.ts +191 -19
- package/dist/RpgClientEngine.js +693 -74
- package/dist/RpgClientEngine.js.map +1 -1
- package/dist/Sound.js.map +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorate.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.122.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 +6 -5
- package/dist/components/animations/animation.ce.js.map +1 -1
- package/dist/components/animations/fx.ce.js +60 -0
- package/dist/components/animations/fx.ce.js.map +1 -0
- package/dist/components/animations/hit.ce.js +24 -28
- package/dist/components/animations/hit.ce.js.map +1 -1
- package/dist/components/animations/index.d.ts +1 -0
- package/dist/components/animations/index.js +6 -4
- package/dist/components/animations/index.js.map +1 -1
- package/dist/components/character.ce.js +748 -249
- package/dist/components/character.ce.js.map +1 -1
- package/dist/components/dynamics/bar.ce.js +99 -0
- package/dist/components/dynamics/bar.ce.js.map +1 -0
- package/dist/components/dynamics/image.ce.js +26 -0
- package/dist/components/dynamics/image.ce.js.map +1 -0
- package/dist/components/dynamics/parse-value.d.ts +3 -0
- package/dist/components/dynamics/parse-value.js +54 -35
- package/dist/components/dynamics/parse-value.js.map +1 -1
- package/dist/components/dynamics/parse-value.spec.d.ts +1 -0
- package/dist/components/dynamics/shape-utils.d.ts +16 -0
- package/dist/components/dynamics/shape-utils.js +73 -0
- package/dist/components/dynamics/shape-utils.js.map +1 -0
- package/dist/components/dynamics/shape-utils.spec.d.ts +1 -0
- package/dist/components/dynamics/shape.ce.js +86 -0
- package/dist/components/dynamics/shape.ce.js.map +1 -0
- package/dist/components/dynamics/text.ce.js +36 -56
- package/dist/components/dynamics/text.ce.js.map +1 -1
- package/dist/components/gui/box.ce.js +9 -9
- package/dist/components/gui/box.ce.js.map +1 -1
- package/dist/components/gui/dialogbox/index.ce.js +75 -65
- package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
- package/dist/components/gui/gameover.ce.js +47 -68
- package/dist/components/gui/gameover.ce.js.map +1 -1
- package/dist/components/gui/hud/hud.ce.js +23 -31
- package/dist/components/gui/hud/hud.ce.js.map +1 -1
- package/dist/components/gui/menu/equip-menu.ce.js +121 -172
- package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/exit-menu.ce.js +15 -10
- package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/items-menu.ce.js +62 -77
- package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/main-menu.ce.js +89 -104
- package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/options-menu.ce.js +12 -8
- package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/skills-menu.ce.js +17 -19
- package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
- package/dist/components/gui/mobile/index.d.ts +51 -2
- package/dist/components/gui/mobile/index.js +14 -6
- package/dist/components/gui/mobile/index.js.map +1 -1
- package/dist/components/gui/mobile/index.spec.d.ts +1 -0
- package/dist/components/gui/mobile/mobile.ce.js +309 -59
- package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
- package/dist/components/gui/notification/notification.ce.js +28 -26
- package/dist/components/gui/notification/notification.ce.js.map +1 -1
- package/dist/components/gui/save-load.ce.js +81 -256
- package/dist/components/gui/save-load.ce.js.map +1 -1
- package/dist/components/gui/shop/shop.ce.js +107 -142
- package/dist/components/gui/shop/shop.ce.js.map +1 -1
- package/dist/components/gui/title-screen.ce.js +50 -73
- package/dist/components/gui/title-screen.ce.js.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +1 -0
- package/dist/components/interaction-components.ce.js +22 -0
- package/dist/components/interaction-components.ce.js.map +1 -0
- package/dist/components/player-components-utils.d.ts +67 -0
- package/dist/components/player-components-utils.js +162 -0
- package/dist/components/player-components-utils.js.map +1 -0
- package/dist/components/player-components-utils.spec.d.ts +1 -0
- package/dist/components/player-components.ce.js +191 -0
- package/dist/components/player-components.ce.js.map +1 -0
- package/dist/components/prebuilt/hp-bar.ce.js +45 -45
- package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
- package/dist/components/prebuilt/light-halo.ce.js +39 -60
- package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
- package/dist/components/scenes/canvas.ce.js +205 -27
- package/dist/components/scenes/canvas.ce.js.map +1 -1
- package/dist/components/scenes/draw-map.ce.js +39 -39
- package/dist/components/scenes/draw-map.ce.js.map +1 -1
- package/dist/components/scenes/event-layer.ce.js +51 -10
- package/dist/components/scenes/event-layer.ce.js.map +1 -1
- package/dist/core/inject.js +1 -1
- package/dist/core/inject.js.map +1 -1
- package/dist/core/setup.js +1 -1
- package/dist/core/setup.js.map +1 -1
- package/dist/decorators/spritesheet.d.ts +1 -0
- package/dist/decorators/spritesheet.js +11 -0
- package/dist/decorators/spritesheet.js.map +1 -0
- package/dist/i18n.d.ts +55 -0
- package/dist/i18n.js +60 -0
- package/dist/i18n.js.map +1 -0
- package/dist/i18n.spec.d.ts +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +29 -21
- package/dist/module.js +45 -4
- package/dist/module.js.map +1 -1
- package/dist/node_modules/.pnpm/{@signe_di@2.9.0 → @signe_di@3.1.0}/node_modules/@signe/di/dist/index.js +7 -117
- package/dist/node_modules/.pnpm/@signe_di@3.1.0/node_modules/@signe/di/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js +239 -0
- package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/chunk-EUXUH3YW.js +13 -0
- 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.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js +698 -0
- 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.1.0_react@19.2.7/node_modules/@signe/sync/dist/client/index.js +43 -0
- 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@2.9.0 → @signe_sync@3.1.0_react@19.2.7}/node_modules/@signe/sync/dist/index.js +57 -141
- 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} +74 -611
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js.map +1 -0
- package/dist/presets/animation.js.map +1 -1
- package/dist/presets/faceset.js.map +1 -1
- package/dist/presets/icon.js.map +1 -1
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/lpc.js.map +1 -1
- package/dist/presets/rmspritesheet.js.map +1 -1
- package/dist/services/AbstractSocket.d.ts +2 -0
- package/dist/services/AbstractSocket.js.map +1 -1
- package/dist/services/actionInput.d.ts +14 -0
- package/dist/services/actionInput.js +59 -0
- package/dist/services/actionInput.js.map +1 -0
- package/dist/services/actionInput.spec.d.ts +1 -0
- package/dist/services/cameraFollow.d.ts +51 -0
- package/dist/services/cameraFollow.js +134 -0
- package/dist/services/cameraFollow.js.map +1 -0
- package/dist/services/cameraFollow.spec.d.ts +1 -0
- package/dist/services/interactions.d.ts +159 -0
- package/dist/services/interactions.js +460 -0
- package/dist/services/interactions.js.map +1 -0
- package/dist/services/interactions.spec.d.ts +1 -0
- package/dist/services/keyboardControls.d.ts +1 -0
- package/dist/services/keyboardControls.js +1 -0
- package/dist/services/keyboardControls.js.map +1 -1
- package/dist/services/loadMap.d.ts +9 -0
- package/dist/services/loadMap.js +1 -1
- package/dist/services/loadMap.js.map +1 -1
- package/dist/services/mmorpg-connection.d.ts +5 -0
- package/dist/services/mmorpg-connection.js +50 -0
- package/dist/services/mmorpg-connection.js.map +1 -0
- package/dist/services/mmorpg-connection.spec.d.ts +1 -0
- package/dist/services/mmorpg.d.ts +11 -4
- package/dist/services/mmorpg.js +57 -33
- package/dist/services/mmorpg.js.map +1 -1
- package/dist/services/pointerContext.d.ts +11 -0
- package/dist/services/pointerContext.js +48 -0
- package/dist/services/pointerContext.js.map +1 -0
- package/dist/services/pointerContext.spec.d.ts +1 -0
- package/dist/services/save.js.map +1 -1
- package/dist/services/save.spec.d.ts +1 -0
- package/dist/services/standalone-message.d.ts +1 -0
- package/dist/services/standalone-message.js +9 -0
- package/dist/services/standalone-message.js.map +1 -0
- package/dist/services/standalone.d.ts +4 -1
- package/dist/services/standalone.js +36 -16
- package/dist/services/standalone.js.map +1 -1
- package/dist/services/standalone.spec.d.ts +1 -0
- package/dist/utils/getEntityProp.js +4 -3
- package/dist/utils/getEntityProp.js.map +1 -1
- package/dist/utils/getEntityProp.spec.d.ts +1 -0
- package/dist/utils/mapId.d.ts +1 -0
- package/dist/utils/mapId.js +6 -0
- package/dist/utils/mapId.js.map +1 -0
- package/dist/utils/readPropValue.d.ts +2 -0
- package/dist/utils/readPropValue.js +13 -0
- package/dist/utils/readPropValue.js.map +1 -0
- package/package.json +13 -13
- package/src/Game/AnimationManager.spec.ts +30 -0
- package/src/Game/AnimationManager.ts +26 -10
- package/src/Game/ClientVisuals.spec.ts +56 -0
- package/src/Game/ClientVisuals.ts +184 -0
- package/src/Game/EventComponentResolver.spec.ts +84 -0
- package/src/Game/EventComponentResolver.ts +74 -0
- package/src/Game/Map.ts +134 -2
- package/src/Game/Object.spec.ts +59 -0
- package/src/Game/Object.ts +181 -77
- package/src/Game/ProjectileManager.spec.ts +449 -0
- package/src/Game/ProjectileManager.ts +346 -0
- package/src/Gui/Gui.spec.ts +359 -0
- package/src/Gui/Gui.ts +178 -67
- package/src/Resource.ts +1 -2
- package/src/RpgClient.ts +220 -17
- package/src/RpgClientEngine.ts +995 -133
- package/src/components/animations/fx.ce +101 -0
- package/src/components/animations/index.ts +4 -2
- package/src/components/character.ce +839 -45
- package/src/components/dynamics/bar.ce +88 -0
- package/src/components/dynamics/image.ce +21 -0
- package/src/components/dynamics/parse-value.spec.ts +83 -0
- package/src/components/dynamics/parse-value.ts +111 -37
- package/src/components/dynamics/shape-utils.spec.ts +46 -0
- package/src/components/dynamics/shape-utils.ts +61 -0
- package/src/components/dynamics/shape.ce +90 -0
- package/src/components/dynamics/text.ce +35 -149
- package/src/components/gui/dialogbox/index.ce +52 -21
- package/src/components/gui/gameover.ce +6 -4
- package/src/components/gui/menu/equip-menu.ce +11 -9
- package/src/components/gui/menu/exit-menu.ce +6 -4
- package/src/components/gui/menu/items-menu.ce +11 -9
- package/src/components/gui/menu/main-menu.ce +14 -12
- package/src/components/gui/menu/options-menu.ce +4 -3
- package/src/components/gui/menu/skills-menu.ce +2 -1
- package/src/components/gui/mobile/index.spec.ts +94 -0
- package/src/components/gui/mobile/index.ts +74 -6
- package/src/components/gui/mobile/mobile.ce +347 -65
- package/src/components/gui/notification/notification.ce +7 -1
- package/src/components/gui/save-load.ce +13 -11
- package/src/components/gui/shop/shop.ce +20 -18
- package/src/components/gui/title-screen.ce +6 -4
- package/src/components/index.ts +2 -1
- package/src/components/interaction-components.ce +23 -0
- package/src/components/player-components-utils.spec.ts +109 -0
- package/src/components/player-components-utils.ts +205 -0
- package/src/components/player-components.ce +222 -0
- package/src/components/prebuilt/hp-bar.ce +4 -3
- package/src/components/prebuilt/light-halo.ce +2 -2
- package/src/components/scenes/canvas.ce +219 -15
- package/src/components/scenes/draw-map.ce +34 -22
- package/src/components/scenes/event-layer.ce +55 -4
- package/src/core/setup.ts +2 -2
- package/src/decorators/spritesheet.ts +8 -0
- package/src/i18n.spec.ts +39 -0
- package/src/i18n.ts +59 -0
- package/src/index.ts +19 -0
- package/src/module.ts +61 -11
- package/src/services/AbstractSocket.ts +3 -0
- package/src/services/actionInput.spec.ts +155 -0
- package/src/services/actionInput.ts +120 -0
- package/src/services/cameraFollow.spec.ts +220 -0
- package/src/services/cameraFollow.ts +222 -0
- package/src/services/interactions.spec.ts +175 -0
- package/src/services/interactions.ts +722 -0
- package/src/services/keyboardControls.ts +2 -1
- package/src/services/loadMap.ts +5 -1
- package/src/services/mmorpg-connection.spec.ts +99 -0
- package/src/services/mmorpg-connection.ts +69 -0
- package/src/services/mmorpg.ts +70 -36
- package/src/services/pointerContext.spec.ts +36 -0
- package/src/services/pointerContext.ts +84 -0
- package/src/services/save.spec.ts +127 -0
- package/src/services/standalone-message.ts +7 -0
- package/src/services/standalone.spec.ts +54 -0
- package/src/services/standalone.ts +44 -12
- package/src/utils/getEntityProp.spec.ts +96 -0
- package/src/utils/getEntityProp.ts +4 -3
- package/src/utils/mapId.ts +2 -0
- package/src/utils/readPropValue.ts +16 -0
- package/dist/node_modules/.pnpm/@signe_di@2.9.0/node_modules/@signe/di/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js +0 -457
- package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js +0 -463
- package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js +0 -2191
- package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js +0 -10
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js +0 -91
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js +0 -14
- package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/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
|
@@ -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,U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AI,CAAC,KAAK,KAAK;EACf,KAAK,OAAO,cAAc;EAC1B,KAAK,IAAI,iBAAiB,QAAQ,KAAK,WAAW;EAClD,KAAK,IAAI,iBAAiB,SAAS,KAAK,YAAY;EACpD,KAAK,IAAI,iBAAiB,WAAW,KAAK,cAAc;EACxD,KAAK,IAAI,iBAAiB,SAAS,KAAK,YAAY;CACtD;CACA,iBAAiB;EACf,aAAa,KAAK,eAAe;EACjC,aAAa,KAAK,cAAc;CAClC;AACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "./v3/helpers/util.js";
|
|
2
|
+
import "./v3/ZodError.js";
|
|
3
|
+
import "./v3/locales/en.js";
|
|
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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,UAAU;EACV,OAAO,KAAK,OAAO,WAAW;CAClC;CACA,QAAQ,UAAU,UAAU,MAAM,SAAS;EACvC,MAAM,cAAc,CAAC;EACrB,MAAM,aAAa,CAAC;EACpB,KAAK,MAAM,OAAO,KAAK,QACnB,IAAI,IAAI,KAAK,SAAS,GAAG;GACrB,MAAM,UAAU,IAAI,KAAK;GACzB,YAAY,WAAW,YAAY,YAAY,CAAC;GAChD,YAAY,SAAS,KAAK,OAAO,GAAG,CAAC;EACzC,OAEI,WAAW,KAAK,OAAO,GAAG,CAAC;EAGnC,OAAO;GAAE;GAAY;EAAY;CACrC;CACA,IAAI,aAAa;EACb,OAAO,KAAK,QAAQ;CACxB;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"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { __exportAll } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { ZodParsedType, getParsedType, objectUtil, util } from "./helpers/util.js";
|
|
3
|
+
import { ZodError, ZodIssueCode, quotelessJson } from "./ZodError.js";
|
|
4
|
+
import errorMap from "./locales/en.js";
|
|
5
|
+
import { getErrorMap, setErrorMap } from "./errors.js";
|
|
6
|
+
import { DIRTY, EMPTY_PATH, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue } from "./helpers/parseUtil.js";
|
|
7
|
+
import { BRAND, NEVER, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEffects, ZodEnum, ZodFirstPartyTypeKind, ZodFunction, ZodIntersection, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodPipeline, ZodPromise, ZodReadonly, ZodRecord, ZodSet, ZodString, ZodSymbol, ZodTuple, ZodType, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, anyType, arrayType, bigIntType, booleanType, coerce, custom, dateType, datetimeRegex, discriminatedUnionType, effectsType, enumType, functionType, instanceOfType, intersectionType, late, lazyType, literalType, mapType, nanType, nativeEnumType, neverType, nullType, nullableType, numberType, objectType, oboolean, onumber, optionalType, ostring, pipelineType, preprocessType, promiseType, recordType, setType, strictObjectType, stringType, symbolType, tupleType, undefinedType, unionType, unknownType, voidType } from "./types.js";
|
|
8
|
+
//#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
9
|
+
var external_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
BRAND: () => BRAND,
|
|
11
|
+
DIRTY: () => DIRTY,
|
|
12
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
13
|
+
INVALID: () => INVALID,
|
|
14
|
+
NEVER: () => NEVER,
|
|
15
|
+
OK: () => OK,
|
|
16
|
+
ParseStatus: () => ParseStatus,
|
|
17
|
+
Schema: () => ZodType,
|
|
18
|
+
ZodAny: () => ZodAny,
|
|
19
|
+
ZodArray: () => ZodArray,
|
|
20
|
+
ZodBigInt: () => ZodBigInt,
|
|
21
|
+
ZodBoolean: () => ZodBoolean,
|
|
22
|
+
ZodBranded: () => ZodBranded,
|
|
23
|
+
ZodCatch: () => ZodCatch,
|
|
24
|
+
ZodDate: () => ZodDate,
|
|
25
|
+
ZodDefault: () => ZodDefault,
|
|
26
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
27
|
+
ZodEffects: () => ZodEffects,
|
|
28
|
+
ZodEnum: () => ZodEnum,
|
|
29
|
+
ZodError: () => ZodError,
|
|
30
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
31
|
+
ZodFunction: () => ZodFunction,
|
|
32
|
+
ZodIntersection: () => ZodIntersection,
|
|
33
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
34
|
+
ZodLazy: () => ZodLazy,
|
|
35
|
+
ZodLiteral: () => ZodLiteral,
|
|
36
|
+
ZodMap: () => ZodMap,
|
|
37
|
+
ZodNaN: () => ZodNaN,
|
|
38
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
39
|
+
ZodNever: () => ZodNever,
|
|
40
|
+
ZodNull: () => ZodNull,
|
|
41
|
+
ZodNullable: () => ZodNullable,
|
|
42
|
+
ZodNumber: () => ZodNumber,
|
|
43
|
+
ZodObject: () => ZodObject,
|
|
44
|
+
ZodOptional: () => ZodOptional,
|
|
45
|
+
ZodParsedType: () => ZodParsedType,
|
|
46
|
+
ZodPipeline: () => ZodPipeline,
|
|
47
|
+
ZodPromise: () => ZodPromise,
|
|
48
|
+
ZodReadonly: () => ZodReadonly,
|
|
49
|
+
ZodRecord: () => ZodRecord,
|
|
50
|
+
ZodSchema: () => ZodType,
|
|
51
|
+
ZodSet: () => ZodSet,
|
|
52
|
+
ZodString: () => ZodString,
|
|
53
|
+
ZodSymbol: () => ZodSymbol,
|
|
54
|
+
ZodTransformer: () => ZodEffects,
|
|
55
|
+
ZodTuple: () => ZodTuple,
|
|
56
|
+
ZodType: () => ZodType,
|
|
57
|
+
ZodUndefined: () => ZodUndefined,
|
|
58
|
+
ZodUnion: () => ZodUnion,
|
|
59
|
+
ZodUnknown: () => ZodUnknown,
|
|
60
|
+
ZodVoid: () => ZodVoid,
|
|
61
|
+
addIssueToContext: () => addIssueToContext,
|
|
62
|
+
any: () => anyType,
|
|
63
|
+
array: () => arrayType,
|
|
64
|
+
bigint: () => bigIntType,
|
|
65
|
+
boolean: () => booleanType,
|
|
66
|
+
coerce: () => coerce,
|
|
67
|
+
custom: () => custom,
|
|
68
|
+
date: () => dateType,
|
|
69
|
+
datetimeRegex: () => datetimeRegex,
|
|
70
|
+
defaultErrorMap: () => errorMap,
|
|
71
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
72
|
+
effect: () => effectsType,
|
|
73
|
+
enum: () => enumType,
|
|
74
|
+
function: () => functionType,
|
|
75
|
+
getErrorMap: () => getErrorMap,
|
|
76
|
+
getParsedType: () => getParsedType,
|
|
77
|
+
instanceof: () => instanceOfType,
|
|
78
|
+
intersection: () => intersectionType,
|
|
79
|
+
isAborted: () => isAborted,
|
|
80
|
+
isAsync: () => isAsync,
|
|
81
|
+
isDirty: () => isDirty,
|
|
82
|
+
isValid: () => isValid,
|
|
83
|
+
late: () => late,
|
|
84
|
+
lazy: () => lazyType,
|
|
85
|
+
literal: () => literalType,
|
|
86
|
+
makeIssue: () => makeIssue,
|
|
87
|
+
map: () => mapType,
|
|
88
|
+
nan: () => nanType,
|
|
89
|
+
nativeEnum: () => nativeEnumType,
|
|
90
|
+
never: () => neverType,
|
|
91
|
+
null: () => nullType,
|
|
92
|
+
nullable: () => nullableType,
|
|
93
|
+
number: () => numberType,
|
|
94
|
+
object: () => objectType,
|
|
95
|
+
objectUtil: () => objectUtil,
|
|
96
|
+
oboolean: () => oboolean,
|
|
97
|
+
onumber: () => onumber,
|
|
98
|
+
optional: () => optionalType,
|
|
99
|
+
ostring: () => ostring,
|
|
100
|
+
pipeline: () => pipelineType,
|
|
101
|
+
preprocess: () => preprocessType,
|
|
102
|
+
promise: () => promiseType,
|
|
103
|
+
quotelessJson: () => quotelessJson,
|
|
104
|
+
record: () => recordType,
|
|
105
|
+
set: () => setType,
|
|
106
|
+
setErrorMap: () => setErrorMap,
|
|
107
|
+
strictObject: () => strictObjectType,
|
|
108
|
+
string: () => stringType,
|
|
109
|
+
symbol: () => symbolType,
|
|
110
|
+
transformer: () => effectsType,
|
|
111
|
+
tuple: () => tupleType,
|
|
112
|
+
undefined: () => undefinedType,
|
|
113
|
+
union: () => unionType,
|
|
114
|
+
unknown: () => unknownType,
|
|
115
|
+
util: () => util,
|
|
116
|
+
void: () => voidType
|
|
117
|
+
});
|
|
118
|
+
//#endregion
|
|
119
|
+
export { external_exports };
|
|
120
|
+
|
|
121
|
+
//# sourceMappingURL=external.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external.js","names":[],"sources":["../../../../../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js"],"sourcesContent":["export * from \"./errors.js\";\nexport * from \"./helpers/parseUtil.js\";\nexport * from \"./helpers/typeAliases.js\";\nexport * from \"./helpers/util.js\";\nexport * from \"./types.js\";\nexport * from \"./ZodError.js\";\n"],"x_google_ignoreList":[0],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
|
|
2
|
+
var errorUtil;
|
|
3
|
+
(function(errorUtil) {
|
|
4
|
+
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
5
|
+
errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
6
|
+
})(errorUtil || (errorUtil = {}));
|
|
7
|
+
//#endregion
|
|
8
|
+
export { errorUtil };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=errorUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorUtil.js","names":[],"sources":["../../../../../../../../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js"],"sourcesContent":["export var errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n // biome-ignore lint:\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message?.message;\n})(errorUtil || (errorUtil = {}));\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAW;CACV,SAAU,WAAW;CAClB,UAAU,YAAY,YAAY,OAAO,YAAY,WAAW,EAAE,QAAQ,IAAI,WAAW,CAAC;CAE1F,UAAU,YAAY,YAAY,OAAO,YAAY,WAAW,UAAU,SAAS;AACvF,GAAG,cAAc,YAAY,CAAC,EAAE"}
|