@playdrop/playdrop-cli 0.16.12 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/client-meta.json +4 -4
- package/dist/apiClient.d.ts +1 -2
- package/dist/apiClient.js +1 -16
- package/dist/appUrls.js +4 -0
- package/dist/apps/build.d.ts +12 -4
- package/dist/apps/build.js +55 -22
- package/dist/apps/index.d.ts +2 -1
- package/dist/apps/index.js +4 -1
- package/dist/apps/loadCheck.d.ts +5 -1
- package/dist/apps/loadCheck.js +52 -18
- package/dist/apps/serverBuild.d.ts +17 -0
- package/dist/apps/serverBuild.js +155 -0
- package/dist/apps/staticHtml.d.ts +1 -0
- package/dist/apps/staticHtml.js +19 -10
- package/dist/apps/upload.d.ts +12 -2
- package/dist/apps/upload.js +127 -46
- package/dist/catalogue.d.ts +23 -1
- package/dist/catalogue.js +126 -100
- package/dist/commandContext.d.ts +6 -3
- package/dist/commandContext.js +108 -18
- package/dist/commands/build.js +0 -7
- package/dist/commands/captureListing.d.ts +3 -0
- package/dist/commands/captureListing.js +48 -4
- package/dist/commands/chat.d.ts +4 -7
- package/dist/commands/chat.js +165 -77
- package/dist/commands/check.js +34 -1
- package/dist/commands/create.js +30 -263
- package/dist/commands/dev.js +37 -3
- package/dist/commands/devBrowser.js +2 -2
- package/dist/commands/devGameServer.d.ts +16 -0
- package/dist/commands/devGameServer.js +237 -0
- package/dist/commands/devRuntimeAssets.d.ts +1 -0
- package/dist/commands/devRuntimeAssets.js +2 -0
- package/dist/commands/devServer.d.ts +3 -0
- package/dist/commands/devServer.js +111 -5
- package/dist/commands/generation.d.ts +33 -4
- package/dist/commands/generation.js +304 -115
- package/dist/commands/login.js +23 -7
- package/dist/commands/review.d.ts +1 -1
- package/dist/commands/review.js +68 -95
- package/dist/commands/source.d.ts +19 -0
- package/dist/commands/source.js +142 -0
- package/dist/commands/tweaks.js +5 -11
- package/dist/commands/upload-content.d.ts +1 -1
- package/dist/commands/upload-content.js +16 -12
- package/dist/commands/upload.d.ts +17 -1
- package/dist/commands/upload.js +47 -10
- package/dist/commands/worker/archive-staging.d.ts +1 -0
- package/dist/commands/worker/archive-staging.js +13 -2
- package/dist/commands/worker/e2e-fixtures.d.ts +32 -0
- package/dist/commands/worker/e2e-fixtures.js +466 -0
- package/dist/commands/worker/game-server-infra.d.ts +80 -0
- package/dist/commands/worker/game-server-infra.js +595 -0
- package/dist/commands/worker/game-source-git.d.ts +126 -0
- package/dist/commands/worker/game-source-git.js +780 -0
- package/dist/commands/worker/generation.d.ts +94 -0
- package/dist/commands/worker/generation.js +1458 -0
- package/dist/commands/worker/provider-telemetry.js +1 -1
- package/dist/commands/worker/runtime.d.ts +8 -10
- package/dist/commands/worker/runtime.js +53 -48
- package/dist/commands/worker.d.ts +79 -19
- package/dist/commands/worker.js +1796 -419
- package/dist/config.d.ts +2 -0
- package/dist/config.js +16 -3
- package/dist/environment.d.ts +0 -1
- package/dist/environment.js +0 -8
- package/dist/index.js +92 -22
- package/dist/workerAppProject.d.ts +1 -1
- package/dist/workerAppProject.js +15 -2
- package/node_modules/@playdrop/api-client/dist/client.d.ts +143 -39
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +33 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts +1 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/core/request.js +17 -11
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts +51 -6
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.js +338 -41
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +24 -1
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/ai.js +20 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +13 -8
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +158 -90
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +4 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +27 -0
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts +152 -21
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/chat.js +477 -100
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts +2 -1
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.js +9 -0
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts +1 -2
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.js +0 -11
- package/node_modules/@playdrop/api-client/dist/domains/social.d.ts +29 -0
- package/node_modules/@playdrop/api-client/dist/domains/social.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/social.js +79 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +81 -30
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +217 -56
- package/node_modules/@playdrop/api-client/dist/runtime.d.ts +18 -0
- package/node_modules/@playdrop/api-client/dist/runtime.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/runtime.js +54 -0
- package/node_modules/@playdrop/api-client/package.json +7 -0
- package/node_modules/@playdrop/config/client-meta.json +4 -4
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts +11 -0
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/creator-plans.js +13 -1
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts +0 -1
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/deployment.js +0 -8
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts +0 -1
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/public-deployment.js +0 -8
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.d.ts +1 -1
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.js +2 -2
- package/node_modules/@playdrop/config/dist/src/server/logging.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/server/logging.js +31 -2
- package/node_modules/@playdrop/config/dist/test/creator-plans.test.js +10 -0
- package/node_modules/@playdrop/config/dist/test/deployment.test.js +0 -4
- package/node_modules/@playdrop/config/dist/test/runtime-service-origins.test.js +2 -0
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/config/package.json +6 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.d.ts +9 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.js +107 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.d.ts +29 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.js +64 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.d.ts +8 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.js +25 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.d.ts +39 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.js +195 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.d.ts +6 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.js +51 -0
- package/node_modules/@playdrop/game-source-git/dist/src/index.d.ts +10 -0
- package/node_modules/@playdrop/game-source-git/dist/src/index.d.ts.map +1 -0
- package/node_modules/@playdrop/{boxel-core/dist/src/humanoid/r15 → game-source-git/dist/src}/index.js +9 -4
- package/node_modules/@playdrop/game-source-git/dist/src/lock.d.ts +17 -0
- package/node_modules/@playdrop/game-source-git/dist/src/lock.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/lock.js +72 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.d.ts +10 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.js +99 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.d.ts +24 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.js +207 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.d.ts +66 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.js +213 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.d.ts +2 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.js +441 -0
- package/node_modules/@playdrop/game-source-git/dist/tsconfig.tsbuildinfo +1 -0
- package/node_modules/@playdrop/game-source-git/package.json +28 -0
- package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/agent-task-terminal.js +15 -9
- package/node_modules/@playdrop/types/dist/api.d.ts +730 -166
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +65 -18
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +2 -0
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.d.ts +22 -8
- package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.js +26 -26
- package/node_modules/@playdrop/types/dist/chat.d.ts +273 -31
- package/node_modules/@playdrop/types/dist/chat.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/chat.js +38 -4
- package/node_modules/@playdrop/types/dist/index.d.ts +3 -0
- package/node_modules/@playdrop/types/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/index.js +7 -1
- package/node_modules/@playdrop/types/dist/public-cache-tags.d.ts +11 -0
- package/node_modules/@playdrop/types/dist/public-cache-tags.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/public-cache-tags.js +78 -0
- package/node_modules/@playdrop/types/dist/realtime.d.ts +3 -15
- package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/social.d.ts +64 -0
- package/node_modules/@playdrop/types/dist/social.d.ts.map +1 -0
- package/node_modules/@playdrop/{boxel-three/dist/src/types.js → types/dist/social.js} +14 -2
- package/node_modules/@playdrop/types/dist/spritesheet.d.ts +51 -0
- package/node_modules/@playdrop/types/dist/spritesheet.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/spritesheet.js +73 -0
- package/node_modules/@playdrop/types/dist/version.d.ts +86 -58
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.js +111 -0
- package/node_modules/@playdrop/types/package.json +14 -0
- package/node_modules/@playdrop/vox-three/dist/src/index.d.ts +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/index.js +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/index.js.map +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/vox.d.ts +0 -3
- package/node_modules/@playdrop/vox-three/dist/src/vox.js +0 -110
- package/node_modules/@playdrop/vox-three/dist/src/vox.js.map +1 -1
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js +0 -18
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js.map +1 -1
- package/node_modules/@playdrop/vox-three/package.json +8 -4
- package/package.json +9 -11
- package/dist/assets/model-artifacts.d.ts +0 -8
- package/dist/assets/model-artifacts.js +0 -382
- package/dist/assets/model-worker.d.ts +0 -22
- package/dist/assets/model-worker.js +0 -123
- package/node_modules/@playdrop/ai-client/dist/index.d.ts +0 -441
- package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +0 -1
- package/node_modules/@playdrop/ai-client/dist/index.js +0 -499
- package/node_modules/@playdrop/ai-client/package.json +0 -22
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.d.ts +0 -13
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js +0 -141
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.d.ts +0 -47
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js +0 -313
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js +0 -36
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.d.ts +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.js +0 -11
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.js +0 -21
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.js +0 -24
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js +0 -387
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.d.ts +0 -6
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.js +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js +0 -373
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js +0 -215
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js +0 -18
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.d.ts +0 -42
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js +0 -145
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.d.ts +0 -26
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js +0 -65
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.d.ts +0 -33
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js +0 -175
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/humanoid_r15.json +0 -1517
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/humanoid_r6.json +0 -61
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.d.ts +0 -10
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/index.d.ts +0 -19
- package/node_modules/@playdrop/boxel-core/dist/src/index.js +0 -36
- package/node_modules/@playdrop/boxel-core/dist/src/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/materials.d.ts +0 -26
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js +0 -184
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.d.ts +0 -68
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js +0 -488
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js +0 -380
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/textures.d.ts +0 -29
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js +0 -208
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.d.ts +0 -9
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js +0 -312
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.d.ts +0 -9
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js +0 -154
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.d.ts +0 -2
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js +0 -121
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.d.ts +0 -20
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js +0 -389
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js +0 -206
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js +0 -81
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js +0 -318
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/types.d.ts +0 -168
- package/node_modules/@playdrop/boxel-core/dist/src/types.js +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/types.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/validation.d.ts +0 -24
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js +0 -620
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.d.ts +0 -11
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js +0 -135
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.d.ts +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js +0 -52
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/package.json +0 -19
- package/node_modules/@playdrop/boxel-three/dist/src/animations.d.ts +0 -4
- package/node_modules/@playdrop/boxel-three/dist/src/animations.js +0 -92
- package/node_modules/@playdrop/boxel-three/dist/src/builders.d.ts +0 -8
- package/node_modules/@playdrop/boxel-three/dist/src/builders.js +0 -363
- package/node_modules/@playdrop/boxel-three/dist/src/context.d.ts +0 -24
- package/node_modules/@playdrop/boxel-three/dist/src/context.js +0 -58
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.d.ts +0 -100
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.js +0 -927
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.d.ts +0 -18
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.js +0 -294
- package/node_modules/@playdrop/boxel-three/dist/src/index.d.ts +0 -17
- package/node_modules/@playdrop/boxel-three/dist/src/index.js +0 -64
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.d.ts +0 -40
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.js +0 -96
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.d.ts +0 -8
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.js +0 -88
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.d.ts +0 -7
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.js +0 -123
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.d.ts +0 -4
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.js +0 -48
- package/node_modules/@playdrop/boxel-three/dist/src/scene.d.ts +0 -3
- package/node_modules/@playdrop/boxel-three/dist/src/scene.js +0 -168
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.d.ts +0 -29
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.js +0 -623
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.d.ts +0 -13
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.js +0 -133
- package/node_modules/@playdrop/boxel-three/dist/src/textures.d.ts +0 -17
- package/node_modules/@playdrop/boxel-three/dist/src/textures.js +0 -216
- package/node_modules/@playdrop/boxel-three/dist/src/types.d.ts +0 -112
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.d.ts +0 -28
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.js +0 -344
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.d.ts +0 -24
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.js +0 -113
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.js +0 -137
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.d.ts +0 -20
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.js +0 -85
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +0 -104
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.js +0 -30
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +0 -88
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.js +0 -42
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.js +0 -73
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.js +0 -85
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +0 -73
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.js +0 -136
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.js +0 -42
- package/node_modules/@playdrop/boxel-three/package.json +0 -28
|
@@ -21,175 +21,325 @@ __export(chat_exports, {
|
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(chat_exports);
|
|
23
23
|
var import_request = require("../core/request.js");
|
|
24
|
-
function
|
|
24
|
+
function chatWebSocketUrl(baseUrl) {
|
|
25
|
+
const url = new URL(baseUrl);
|
|
26
|
+
if (url.protocol === "https:")
|
|
27
|
+
url.protocol = "wss:";
|
|
28
|
+
else if (url.protocol === "http:")
|
|
29
|
+
url.protocol = "ws:";
|
|
30
|
+
else
|
|
31
|
+
throw new Error("chat_realtime_invalid_api_url");
|
|
32
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}/chat/ws`;
|
|
33
|
+
url.search = "";
|
|
34
|
+
url.hash = "";
|
|
35
|
+
return url.toString();
|
|
36
|
+
}
|
|
37
|
+
function parseRealtimeFrame(value) {
|
|
38
|
+
if (typeof value !== "string")
|
|
39
|
+
throw new Error("chat_realtime_invalid_frame");
|
|
40
|
+
let parsed;
|
|
41
|
+
try {
|
|
42
|
+
parsed = JSON.parse(value);
|
|
43
|
+
} catch {
|
|
44
|
+
throw new Error("chat_realtime_invalid_frame");
|
|
45
|
+
}
|
|
46
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
47
|
+
throw new Error("chat_realtime_invalid_frame");
|
|
48
|
+
const frame = parsed;
|
|
49
|
+
const type = frame["type"];
|
|
50
|
+
if (type === "ready" && typeof frame["heartbeatIntervalMs"] === "number")
|
|
51
|
+
return parsed;
|
|
52
|
+
if ((type === "subscribed" || type === "inbox.resync_required" || type === "resync_required") && typeof frame["conversationId"] === "string") {
|
|
53
|
+
return parsed;
|
|
54
|
+
}
|
|
55
|
+
if (type === "conversation.event" && frame["event"] && typeof frame["event"] === "object") {
|
|
56
|
+
return parsed;
|
|
57
|
+
}
|
|
58
|
+
if (type === "inbox.snapshot" && Array.isArray(frame["conversations"])) {
|
|
59
|
+
return parsed;
|
|
60
|
+
}
|
|
61
|
+
if (type === "inbox.event" && frame["event"] && typeof frame["event"] === "object") {
|
|
62
|
+
return parsed;
|
|
63
|
+
}
|
|
64
|
+
if (type === "typing.updated" && typeof frame["conversationId"] === "string" && typeof frame["userId"] === "number" && typeof frame["active"] === "boolean" && typeof frame["expiresAt"] === "string") {
|
|
65
|
+
return parsed;
|
|
66
|
+
}
|
|
67
|
+
if (type === "playtrade.activity.updated" && frame["activity"] && typeof frame["activity"] === "object") {
|
|
68
|
+
return parsed;
|
|
69
|
+
}
|
|
70
|
+
if (type === "playtrade.activity.error" && typeof frame["sessionId"] === "string" && typeof frame["code"] === "string") {
|
|
71
|
+
return parsed;
|
|
72
|
+
}
|
|
73
|
+
if (type === "presence.snapshot" && Array.isArray(frame["entries"]))
|
|
74
|
+
return parsed;
|
|
75
|
+
if (type === "presence.updated" && frame["entry"] && typeof frame["entry"] === "object") {
|
|
76
|
+
return parsed;
|
|
77
|
+
}
|
|
78
|
+
if ((type === "platform.subscribed" || type === "platform.event" || type === "platform.resync_required") && typeof frame["topic"] === "string" && typeof frame["eventVersion"] === "string") {
|
|
79
|
+
return parsed;
|
|
80
|
+
}
|
|
81
|
+
if (type === "error" && typeof frame["code"] === "string")
|
|
82
|
+
return parsed;
|
|
83
|
+
throw new Error("chat_realtime_invalid_frame");
|
|
84
|
+
}
|
|
85
|
+
function pageQuery(options = {}, legacy = false) {
|
|
25
86
|
const params = new URLSearchParams();
|
|
26
|
-
if (options.beforeId !== void 0)
|
|
27
|
-
params.set("beforeId",
|
|
87
|
+
if (legacy && options.beforeId !== void 0)
|
|
88
|
+
params.set("beforeId", options.beforeId);
|
|
89
|
+
if (!legacy && options.before !== void 0)
|
|
90
|
+
params.set("before", options.before);
|
|
91
|
+
if (!legacy && options.after !== void 0)
|
|
92
|
+
params.set("after", options.after);
|
|
93
|
+
if (!legacy && options.around !== void 0)
|
|
94
|
+
params.set("around", options.around);
|
|
28
95
|
if (options.limit !== void 0)
|
|
29
96
|
params.set("limit", String(options.limit));
|
|
30
97
|
const query = params.toString();
|
|
31
98
|
return query ? `?${query}` : "";
|
|
32
99
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
...input.body !== void 0 ? { body: input.body } : {},
|
|
46
|
-
...input.attachments !== void 0 ? { attachments: input.attachments } : {},
|
|
47
|
-
..."clientKey" in input && input.clientKey !== void 0 ? { clientKey: input.clientKey } : {},
|
|
48
|
-
...input.eventType !== void 0 ? { eventType: input.eventType } : {},
|
|
49
|
-
...input.eventData !== void 0 ? { eventData: input.eventData } : {},
|
|
50
|
-
..."asSystem" in input && input.asSystem !== void 0 ? { asSystem: input.asSystem } : {}
|
|
51
|
-
};
|
|
100
|
+
function listQuery(input = {}) {
|
|
101
|
+
const params = new URLSearchParams();
|
|
102
|
+
if (input.type)
|
|
103
|
+
params.set("type", input.type);
|
|
104
|
+
if (input.cursor)
|
|
105
|
+
params.set("cursor", input.cursor);
|
|
106
|
+
if (input.limit !== void 0)
|
|
107
|
+
params.set("limit", String(input.limit));
|
|
108
|
+
if (input.query)
|
|
109
|
+
params.set("query", input.query);
|
|
110
|
+
const query = params.toString();
|
|
111
|
+
return query ? `?${query}` : "";
|
|
52
112
|
}
|
|
53
113
|
function buildChatApiClientMethods(input) {
|
|
54
114
|
const { request, handleApiError, fetchImpl, includeBrowserCredentials, resolveBaseUrl, resolveUrl, parseResponseBody, resolveToken, getClientHeaders } = input;
|
|
55
|
-
async function authorizedHeaders() {
|
|
115
|
+
async function authorizedHeaders(contentType) {
|
|
56
116
|
const headers = new Headers(getClientHeaders());
|
|
57
|
-
|
|
117
|
+
if (contentType)
|
|
118
|
+
headers.set("content-type", contentType);
|
|
119
|
+
else
|
|
120
|
+
headers.delete("content-type");
|
|
58
121
|
headers.set("accept", "application/json");
|
|
59
122
|
const token = await resolveToken();
|
|
60
123
|
if (token)
|
|
61
124
|
headers.set("authorization", `Bearer ${token}`);
|
|
62
125
|
return headers;
|
|
63
126
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
for (const link of message.links ?? [])
|
|
68
|
-
form.append("link", link);
|
|
69
|
-
for (const attachment of message.files ?? [])
|
|
70
|
-
form.append("file", attachment.file, fileName(attachment));
|
|
71
|
-
const response = await fetchImpl(resolveUrl(resolveBaseUrl(), path), {
|
|
72
|
-
method,
|
|
73
|
-
headers: await authorizedHeaders(),
|
|
74
|
-
body: form,
|
|
75
|
-
...(0, import_request.buildBrowserCredentialsInit)(includeBrowserCredentials)
|
|
76
|
-
});
|
|
77
|
-
const body = await parseResponseBody(response);
|
|
78
|
-
const result = { status: response.status, body, headers: response.headers };
|
|
79
|
-
if (response.status !== 200 && response.status !== 201)
|
|
80
|
-
handleApiError(result, "chat_write_failed");
|
|
81
|
-
return body;
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
async fetchChatChannels() {
|
|
85
|
-
const response = await request({ method: "GET", path: "/chat/channels" });
|
|
127
|
+
const methods = {
|
|
128
|
+
async fetchChatConversations(options = {}) {
|
|
129
|
+
const response = await request({ method: "GET", path: `/chat/conversations${listQuery(options)}` });
|
|
86
130
|
if (response.status !== 200)
|
|
87
|
-
handleApiError(response, "
|
|
131
|
+
handleApiError(response, "fetch_chat_conversations");
|
|
88
132
|
return response.body;
|
|
89
133
|
},
|
|
90
|
-
async
|
|
134
|
+
async fetchChatConversation(conversationId) {
|
|
135
|
+
const response = await request({ method: "GET", path: `/chat/conversations/${encodeURIComponent(conversationId)}` });
|
|
136
|
+
if (response.status !== 200)
|
|
137
|
+
handleApiError(response, "fetch_chat_conversation");
|
|
138
|
+
return response.body;
|
|
139
|
+
},
|
|
140
|
+
async createDirectChatConversation(username) {
|
|
141
|
+
const response = await request({ method: "POST", path: "/chat/direct-conversations", body: { username } });
|
|
142
|
+
if (response.status !== 200 && response.status !== 201)
|
|
143
|
+
handleApiError(response, "create_direct_chat_conversation");
|
|
144
|
+
return response.body;
|
|
145
|
+
},
|
|
146
|
+
async fetchConversationMessages(conversationId, options = {}) {
|
|
91
147
|
const response = await request({
|
|
92
148
|
method: "GET",
|
|
93
|
-
path: `/chat/
|
|
149
|
+
path: `/chat/conversations/${encodeURIComponent(conversationId)}/messages${pageQuery(options)}`
|
|
94
150
|
});
|
|
95
151
|
if (response.status !== 200)
|
|
96
152
|
handleApiError(response, "fetch_chat_messages");
|
|
97
153
|
return response.body;
|
|
98
154
|
},
|
|
99
|
-
async
|
|
155
|
+
async sendConversationMessage(conversationId, message) {
|
|
100
156
|
const response = await request({
|
|
101
|
-
method: "
|
|
102
|
-
path: `/chat/
|
|
103
|
-
body:
|
|
157
|
+
method: "POST",
|
|
158
|
+
path: `/chat/conversations/${encodeURIComponent(conversationId)}/messages`,
|
|
159
|
+
body: message
|
|
104
160
|
});
|
|
105
|
-
if (response.status !==
|
|
106
|
-
handleApiError(response, "
|
|
161
|
+
if (response.status !== 201)
|
|
162
|
+
handleApiError(response, "send_chat_message");
|
|
107
163
|
return response.body;
|
|
108
164
|
},
|
|
109
|
-
async
|
|
165
|
+
async sendSystemChatMessage(channel, message) {
|
|
110
166
|
const response = await request({
|
|
111
|
-
method: "
|
|
112
|
-
path: `/chat/
|
|
167
|
+
method: "POST",
|
|
168
|
+
path: `/admin/chat/channels/${encodeURIComponent(channel)}/system-messages`,
|
|
169
|
+
body: message
|
|
113
170
|
});
|
|
114
|
-
if (response.status !==
|
|
115
|
-
handleApiError(response, "
|
|
116
|
-
return response.body;
|
|
117
|
-
},
|
|
118
|
-
async sendChatMessage(channel, message) {
|
|
119
|
-
const path = `/chat/channels/${encodeURIComponent(channel)}/messages`;
|
|
120
|
-
if (needsMultipart(message))
|
|
121
|
-
return await multipartWrite("POST", path, message);
|
|
122
|
-
const response = await request({ method: "POST", path, body: jsonPayload(message) });
|
|
123
|
-
if (response.status !== 200 && response.status !== 201)
|
|
124
|
-
handleApiError(response, "send_chat_message");
|
|
171
|
+
if (response.status !== 201)
|
|
172
|
+
handleApiError(response, "send_system_chat_message");
|
|
125
173
|
return response.body;
|
|
126
174
|
},
|
|
127
175
|
async replyChatMessage(messageId, message) {
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
176
|
+
const response = await request({
|
|
177
|
+
method: "POST",
|
|
178
|
+
path: `/chat/messages/${encodeURIComponent(messageId)}/replies`,
|
|
179
|
+
body: message
|
|
180
|
+
});
|
|
181
|
+
if (response.status !== 201)
|
|
133
182
|
handleApiError(response, "reply_chat_message");
|
|
134
183
|
return response.body;
|
|
135
184
|
},
|
|
185
|
+
async replySystemChatMessage(messageId, message) {
|
|
186
|
+
const response = await request({
|
|
187
|
+
method: "POST",
|
|
188
|
+
path: `/admin/chat/messages/${encodeURIComponent(messageId)}/system-replies`,
|
|
189
|
+
body: message
|
|
190
|
+
});
|
|
191
|
+
if (response.status !== 201)
|
|
192
|
+
handleApiError(response, "reply_system_chat_message");
|
|
193
|
+
return response.body;
|
|
194
|
+
},
|
|
136
195
|
async editChatMessage(messageId, message) {
|
|
137
|
-
const
|
|
138
|
-
if (needsMultipart(message))
|
|
139
|
-
return await multipartWrite("PATCH", path, message);
|
|
140
|
-
const response = await request({ method: "PATCH", path, body: jsonPayload(message) });
|
|
196
|
+
const response = await request({ method: "PATCH", path: `/chat/messages/${encodeURIComponent(messageId)}`, body: message });
|
|
141
197
|
if (response.status !== 200)
|
|
142
198
|
handleApiError(response, "edit_chat_message");
|
|
143
199
|
return response.body;
|
|
144
200
|
},
|
|
201
|
+
async deleteChatMessage(messageId) {
|
|
202
|
+
const response = await request({ method: "DELETE", path: `/chat/messages/${encodeURIComponent(messageId)}` });
|
|
203
|
+
if (response.status !== 200)
|
|
204
|
+
handleApiError(response, "delete_chat_message");
|
|
205
|
+
return response.body;
|
|
206
|
+
},
|
|
207
|
+
async fetchChatThread(messageId, options = {}) {
|
|
208
|
+
const response = await request({ method: "GET", path: `/chat/messages/${encodeURIComponent(messageId)}/thread${pageQuery(options)}` });
|
|
209
|
+
if (response.status !== 200)
|
|
210
|
+
handleApiError(response, "fetch_chat_thread");
|
|
211
|
+
return response.body;
|
|
212
|
+
},
|
|
145
213
|
async reactChatMessage(messageId, emoji) {
|
|
146
|
-
const response = await request({
|
|
147
|
-
method: "PUT",
|
|
148
|
-
path: `/chat/messages/${encodeURIComponent(String(messageId))}/reactions/${encodeURIComponent(emoji)}`
|
|
149
|
-
});
|
|
214
|
+
const response = await request({ method: "PUT", path: `/chat/messages/${encodeURIComponent(messageId)}/reactions/${encodeURIComponent(emoji)}` });
|
|
150
215
|
if (response.status !== 200)
|
|
151
216
|
handleApiError(response, "react_chat_message");
|
|
152
217
|
return response.body;
|
|
153
218
|
},
|
|
154
219
|
async unreactChatMessage(messageId, emoji) {
|
|
155
|
-
const response = await request({
|
|
156
|
-
method: "DELETE",
|
|
157
|
-
path: `/chat/messages/${encodeURIComponent(String(messageId))}/reactions/${encodeURIComponent(emoji)}`
|
|
158
|
-
});
|
|
220
|
+
const response = await request({ method: "DELETE", path: `/chat/messages/${encodeURIComponent(messageId)}/reactions/${encodeURIComponent(emoji)}` });
|
|
159
221
|
if (response.status !== 200)
|
|
160
222
|
handleApiError(response, "unreact_chat_message");
|
|
161
223
|
return response.body;
|
|
162
224
|
},
|
|
163
|
-
async
|
|
225
|
+
async markChatConversationRead(conversationId, lastReadMessageId) {
|
|
164
226
|
const response = await request({
|
|
165
227
|
method: "PUT",
|
|
166
|
-
path: `/
|
|
167
|
-
body: {
|
|
228
|
+
path: `/chat/conversations/${encodeURIComponent(conversationId)}/read`,
|
|
229
|
+
body: { lastReadMessageId }
|
|
168
230
|
});
|
|
169
231
|
if (response.status !== 200)
|
|
170
|
-
handleApiError(response, "
|
|
232
|
+
handleApiError(response, "mark_chat_conversation_read");
|
|
171
233
|
return response.body;
|
|
172
234
|
},
|
|
173
|
-
async
|
|
235
|
+
async updateChatConversationState(conversationId, state) {
|
|
174
236
|
const response = await request({
|
|
175
|
-
method: "
|
|
176
|
-
path: `/
|
|
237
|
+
method: "PATCH",
|
|
238
|
+
path: `/chat/conversations/${encodeURIComponent(conversationId)}/state`,
|
|
239
|
+
body: state
|
|
177
240
|
});
|
|
241
|
+
if (response.status !== 200)
|
|
242
|
+
handleApiError(response, "update_chat_conversation_state");
|
|
243
|
+
return response.body;
|
|
244
|
+
},
|
|
245
|
+
async reportChatMessage(messageId, body) {
|
|
246
|
+
const response = await request({ method: "POST", path: `/chat/messages/${encodeURIComponent(messageId)}/report`, body });
|
|
247
|
+
if (response.status !== 201)
|
|
248
|
+
handleApiError(response, "report_chat_message");
|
|
249
|
+
return response.body;
|
|
250
|
+
},
|
|
251
|
+
async fetchChatFriends(options = {}) {
|
|
252
|
+
const response = await request({ method: "GET", path: `/me/friends${listQuery(options)}` });
|
|
253
|
+
if (response.status !== 200)
|
|
254
|
+
handleApiError(response, "fetch_chat_friends");
|
|
255
|
+
return response.body;
|
|
256
|
+
},
|
|
257
|
+
async fetchChatContacts(options = {}) {
|
|
258
|
+
const response = await request({ method: "GET", path: `/me/chat-contacts${listQuery(options)}` });
|
|
259
|
+
if (response.status !== 200)
|
|
260
|
+
handleApiError(response, "fetch_chat_contacts");
|
|
261
|
+
return response.body;
|
|
262
|
+
},
|
|
263
|
+
async fetchChatNotificationPreferences() {
|
|
264
|
+
const response = await request({ method: "GET", path: "/me/chat-notification-preferences" });
|
|
265
|
+
if (response.status !== 200)
|
|
266
|
+
handleApiError(response, "fetch_chat_notification_preferences");
|
|
267
|
+
return response.body;
|
|
268
|
+
},
|
|
269
|
+
async updateChatNotificationPreferences(preferences) {
|
|
270
|
+
const response = await request({ method: "PATCH", path: "/me/chat-notification-preferences", body: preferences });
|
|
271
|
+
if (response.status !== 200)
|
|
272
|
+
handleApiError(response, "update_chat_notification_preferences");
|
|
273
|
+
return response.body;
|
|
274
|
+
},
|
|
275
|
+
async createChatAttachmentUploadSession(conversationId, file) {
|
|
276
|
+
const response = await request({
|
|
277
|
+
method: "POST",
|
|
278
|
+
path: `/chat/conversations/${encodeURIComponent(conversationId)}/attachment-upload-sessions`,
|
|
279
|
+
body: file
|
|
280
|
+
});
|
|
281
|
+
if (response.status !== 201)
|
|
282
|
+
handleApiError(response, "create_chat_attachment_upload_session");
|
|
283
|
+
return response.body;
|
|
284
|
+
},
|
|
285
|
+
async uploadChatAttachment(session, file) {
|
|
286
|
+
const isSignedUpload = /^https?:/i.test(session.uploadUrl);
|
|
287
|
+
const response = await fetchImpl(resolveUrl(resolveBaseUrl(), session.uploadUrl), {
|
|
288
|
+
method: session.uploadMethod,
|
|
289
|
+
headers: isSignedUpload ? { "content-type": file.type || "application/octet-stream", ...session.uploadHeaders } : await authorizedHeaders(file.type || "application/octet-stream"),
|
|
290
|
+
body: file,
|
|
291
|
+
...!isSignedUpload ? (0, import_request.buildBrowserCredentialsInit)(includeBrowserCredentials) : {}
|
|
292
|
+
});
|
|
293
|
+
if (!response.ok) {
|
|
294
|
+
const body = await parseResponseBody(response);
|
|
295
|
+
handleApiError({ status: response.status, body, headers: response.headers }, "upload_chat_attachment");
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
async completeChatAttachmentUploadSession(sessionId) {
|
|
299
|
+
const response = await request({ method: "POST", path: `/chat/attachment-upload-sessions/${encodeURIComponent(sessionId)}/complete` });
|
|
300
|
+
if (response.status !== 200)
|
|
301
|
+
handleApiError(response, "complete_chat_attachment_upload_session");
|
|
302
|
+
},
|
|
303
|
+
async abortChatAttachmentUploadSession(sessionId) {
|
|
304
|
+
const response = await request({ method: "DELETE", path: `/chat/attachment-upload-sessions/${encodeURIComponent(sessionId)}` });
|
|
178
305
|
if (response.status !== 204)
|
|
179
|
-
handleApiError(response, "
|
|
306
|
+
handleApiError(response, "abort_chat_attachment_upload_session");
|
|
307
|
+
},
|
|
308
|
+
async createCommunityChatChannel(input2) {
|
|
309
|
+
const response = await request({ method: "POST", path: "/admin/chat/community-channels", body: input2 });
|
|
310
|
+
if (response.status !== 201)
|
|
311
|
+
handleApiError(response, "create_community_chat_channel");
|
|
312
|
+
return response.body;
|
|
180
313
|
},
|
|
181
|
-
async
|
|
314
|
+
async updateCommunityChatChannel(conversationId, input2) {
|
|
315
|
+
const response = await request({ method: "PATCH", path: `/admin/chat/community-channels/${encodeURIComponent(conversationId)}`, body: input2 });
|
|
316
|
+
if (response.status !== 200)
|
|
317
|
+
handleApiError(response, "update_community_chat_channel");
|
|
318
|
+
return response.body;
|
|
319
|
+
},
|
|
320
|
+
async fetchAdminDirectConversations(options = {}) {
|
|
321
|
+
const response = await request({ method: "GET", path: `/admin/chat/direct-conversations${listQuery(options)}` });
|
|
322
|
+
if (response.status !== 200)
|
|
323
|
+
handleApiError(response, "fetch_admin_direct_conversations");
|
|
324
|
+
return response.body;
|
|
325
|
+
},
|
|
326
|
+
async fetchAdminDirectConversationMessages(conversationId, options = {}) {
|
|
327
|
+
const response = await request({ method: "GET", path: `/admin/chat/direct-conversations/${encodeURIComponent(conversationId)}/messages${pageQuery(options)}` });
|
|
328
|
+
if (response.status !== 200)
|
|
329
|
+
handleApiError(response, "fetch_admin_direct_conversation_messages");
|
|
330
|
+
return response.body;
|
|
331
|
+
},
|
|
332
|
+
async moderateAdminDirectConversationMessage(conversationId, messageId) {
|
|
182
333
|
const response = await request({
|
|
183
|
-
method: "
|
|
184
|
-
path: `/admin/chat/
|
|
185
|
-
body: { readPolicy }
|
|
334
|
+
method: "DELETE",
|
|
335
|
+
path: `/admin/chat/direct-conversations/${encodeURIComponent(conversationId)}/messages/${encodeURIComponent(messageId)}`
|
|
186
336
|
});
|
|
187
337
|
if (response.status !== 200)
|
|
188
|
-
handleApiError(response, "
|
|
338
|
+
handleApiError(response, "moderate_admin_direct_conversation_message");
|
|
189
339
|
return response.body;
|
|
190
340
|
},
|
|
191
341
|
async fetchChatAttachment(attachmentId) {
|
|
192
|
-
const response = await fetchImpl(resolveUrl(resolveBaseUrl(), `/chat/attachments/${encodeURIComponent(
|
|
342
|
+
const response = await fetchImpl(resolveUrl(resolveBaseUrl(), `/chat/attachments/${encodeURIComponent(attachmentId)}`), {
|
|
193
343
|
method: "GET",
|
|
194
344
|
headers: await authorizedHeaders(),
|
|
195
345
|
...(0, import_request.buildBrowserCredentialsInit)(includeBrowserCredentials)
|
|
@@ -199,8 +349,235 @@ function buildChatApiClientMethods(input) {
|
|
|
199
349
|
handleApiError({ status: response.status, body, headers: response.headers }, "fetch_chat_attachment");
|
|
200
350
|
}
|
|
201
351
|
return await response.blob();
|
|
352
|
+
},
|
|
353
|
+
async fetchChatChannels() {
|
|
354
|
+
const response = await request({ method: "GET", path: "/chat/channels" });
|
|
355
|
+
if (response.status !== 200)
|
|
356
|
+
handleApiError(response, "fetch_chat_channels");
|
|
357
|
+
return response.body;
|
|
358
|
+
},
|
|
359
|
+
async fetchChatMessages(channel, options = {}) {
|
|
360
|
+
const response = await request({ method: "GET", path: `/chat/channels/${encodeURIComponent(channel)}/messages${pageQuery(options, true)}` });
|
|
361
|
+
if (response.status !== 200)
|
|
362
|
+
handleApiError(response, "fetch_chat_messages");
|
|
363
|
+
return response.body;
|
|
364
|
+
},
|
|
365
|
+
async markChatChannelRead(channel, lastReadMessageId) {
|
|
366
|
+
const response = await request({ method: "PUT", path: `/chat/channels/${encodeURIComponent(channel)}/read`, body: { lastReadMessageId } });
|
|
367
|
+
if (response.status !== 200)
|
|
368
|
+
handleApiError(response, "mark_chat_channel_read");
|
|
369
|
+
return response.body;
|
|
370
|
+
},
|
|
371
|
+
async sendChatMessage(channel, message) {
|
|
372
|
+
const response = await request({ method: "POST", path: `/chat/channels/${encodeURIComponent(channel)}/messages`, body: message });
|
|
373
|
+
if (response.status !== 201)
|
|
374
|
+
handleApiError(response, "send_chat_message");
|
|
375
|
+
return response.body;
|
|
376
|
+
},
|
|
377
|
+
connectChatRealtime(options) {
|
|
378
|
+
let socket = null;
|
|
379
|
+
let reconnectTimer = null;
|
|
380
|
+
let stopped = false;
|
|
381
|
+
let attempt = 0;
|
|
382
|
+
let presenceContext = "ONLINE";
|
|
383
|
+
const subscriptions = new Map((options.subscriptions ?? []).map((subscription) => [
|
|
384
|
+
subscription.conversationId,
|
|
385
|
+
subscription.lastEventVersion ?? null
|
|
386
|
+
]));
|
|
387
|
+
const platformSubscriptions = new Map((options.platformSubscriptions ?? []).map((subscription) => [
|
|
388
|
+
subscription.topic,
|
|
389
|
+
subscription.lastEventVersion ?? null
|
|
390
|
+
]));
|
|
391
|
+
const notifyState = (state) => options.onStateChange?.(state);
|
|
392
|
+
const factory = options.webSocketFactory ?? ((url) => {
|
|
393
|
+
if (typeof globalThis.WebSocket !== "function")
|
|
394
|
+
throw new Error("chat_realtime_websocket_unavailable");
|
|
395
|
+
return new globalThis.WebSocket(url);
|
|
396
|
+
});
|
|
397
|
+
const send = (frame) => {
|
|
398
|
+
if (socket?.readyState === 1)
|
|
399
|
+
socket.send(JSON.stringify(frame));
|
|
400
|
+
};
|
|
401
|
+
const sendSubscriptions = () => {
|
|
402
|
+
for (const [conversationId, lastEventVersion] of subscriptions) {
|
|
403
|
+
send({ type: "subscribe", conversationId, lastEventVersion });
|
|
404
|
+
}
|
|
405
|
+
for (const [topic, lastEventVersion] of platformSubscriptions) {
|
|
406
|
+
send({ type: "platform.subscribe", topic, lastEventVersion });
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
const scheduleReconnect = () => {
|
|
410
|
+
if (stopped || reconnectTimer)
|
|
411
|
+
return;
|
|
412
|
+
notifyState("reconnecting");
|
|
413
|
+
const exponentialDelay = Math.min(500 * 2 ** Math.min(attempt, 6), 3e4);
|
|
414
|
+
const delay = Math.round(exponentialDelay * (0.8 + Math.random() * 0.4));
|
|
415
|
+
attempt += 1;
|
|
416
|
+
reconnectTimer = setTimeout(() => {
|
|
417
|
+
reconnectTimer = null;
|
|
418
|
+
void connect();
|
|
419
|
+
}, delay);
|
|
420
|
+
};
|
|
421
|
+
const connect = async () => {
|
|
422
|
+
if (stopped)
|
|
423
|
+
return;
|
|
424
|
+
notifyState(attempt === 0 ? "connecting" : "reconnecting");
|
|
425
|
+
let token;
|
|
426
|
+
try {
|
|
427
|
+
token = await resolveToken() ?? "cookie";
|
|
428
|
+
if (stopped)
|
|
429
|
+
return;
|
|
430
|
+
socket = factory(chatWebSocketUrl(resolveBaseUrl()));
|
|
431
|
+
} catch (error) {
|
|
432
|
+
const code = error instanceof Error ? error.message : "chat_realtime_connection_failed";
|
|
433
|
+
options.onError?.(code);
|
|
434
|
+
if (code === "chat_realtime_unauthorized") {
|
|
435
|
+
stopped = true;
|
|
436
|
+
notifyState("closed");
|
|
437
|
+
} else
|
|
438
|
+
scheduleReconnect();
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
const activeSocket = socket;
|
|
442
|
+
activeSocket.addEventListener("open", () => {
|
|
443
|
+
if (!stopped && activeSocket === socket)
|
|
444
|
+
activeSocket.send(JSON.stringify({ type: "auth", token }));
|
|
445
|
+
});
|
|
446
|
+
activeSocket.addEventListener("message", (event) => {
|
|
447
|
+
if (stopped || activeSocket !== socket)
|
|
448
|
+
return;
|
|
449
|
+
try {
|
|
450
|
+
const frame = parseRealtimeFrame(event.data);
|
|
451
|
+
if (frame.type === "ready") {
|
|
452
|
+
attempt = 0;
|
|
453
|
+
notifyState("ready");
|
|
454
|
+
sendSubscriptions();
|
|
455
|
+
send({ type: "presence.context", context: presenceContext });
|
|
456
|
+
} else if (frame.type === "subscribed") {
|
|
457
|
+
subscriptions.set(frame.conversationId, frame.eventVersion);
|
|
458
|
+
} else if (frame.type === "conversation.event") {
|
|
459
|
+
try {
|
|
460
|
+
options.onEvent(frame.event);
|
|
461
|
+
subscriptions.set(frame.event.conversationId, frame.event.version);
|
|
462
|
+
} catch {
|
|
463
|
+
options.onError?.("chat_realtime_event_handler_failed");
|
|
464
|
+
activeSocket.close(1011, "chat_realtime_event_handler_failed");
|
|
465
|
+
}
|
|
466
|
+
} else if (frame.type === "inbox.snapshot") {
|
|
467
|
+
options.onInboxSnapshot?.(frame.conversations);
|
|
468
|
+
} else if (frame.type === "inbox.event") {
|
|
469
|
+
options.onInboxEvent?.(frame.event);
|
|
470
|
+
} else if (frame.type === "inbox.resync_required") {
|
|
471
|
+
options.onInboxResyncRequired?.(frame.conversationId);
|
|
472
|
+
} else if (frame.type === "typing.updated") {
|
|
473
|
+
options.onTypingUpdated?.(frame);
|
|
474
|
+
} else if (frame.type === "presence.snapshot") {
|
|
475
|
+
options.onPresenceSnapshot?.(frame.entries);
|
|
476
|
+
} else if (frame.type === "presence.updated") {
|
|
477
|
+
options.onPresenceUpdated?.(frame.entry);
|
|
478
|
+
} else if (frame.type === "platform.subscribed") {
|
|
479
|
+
platformSubscriptions.set(frame.topic, frame.eventVersion);
|
|
480
|
+
} else if (frame.type === "platform.event") {
|
|
481
|
+
options.onPlatformEvent?.({ topic: frame.topic, eventVersion: frame.eventVersion, resync: false });
|
|
482
|
+
platformSubscriptions.set(frame.topic, frame.eventVersion);
|
|
483
|
+
} else if (frame.type === "platform.resync_required") {
|
|
484
|
+
options.onPlatformEvent?.({ topic: frame.topic, eventVersion: frame.eventVersion, resync: true });
|
|
485
|
+
platformSubscriptions.set(frame.topic, frame.eventVersion);
|
|
486
|
+
} else if (frame.type === "playtrade.activity.updated") {
|
|
487
|
+
options.onPlayTradeActivity?.({ type: "updated", activity: frame.activity });
|
|
488
|
+
} else if (frame.type === "playtrade.activity.error") {
|
|
489
|
+
options.onPlayTradeActivity?.({
|
|
490
|
+
type: "error",
|
|
491
|
+
sessionId: frame.sessionId,
|
|
492
|
+
code: frame.code
|
|
493
|
+
});
|
|
494
|
+
} else if (frame.type === "resync_required") {
|
|
495
|
+
subscriptions.set(frame.conversationId, null);
|
|
496
|
+
options.onResyncRequired?.(frame.conversationId);
|
|
497
|
+
} else {
|
|
498
|
+
options.onError?.(frame.code);
|
|
499
|
+
if (frame.code === "chat_realtime_unauthorized")
|
|
500
|
+
stopped = true;
|
|
501
|
+
}
|
|
502
|
+
} catch (error) {
|
|
503
|
+
options.onError?.(error instanceof Error ? error.message : "chat_realtime_invalid_frame");
|
|
504
|
+
activeSocket.close(1008, "chat_realtime_invalid_frame");
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
activeSocket.addEventListener("error", () => {
|
|
508
|
+
if (!stopped && activeSocket === socket)
|
|
509
|
+
options.onError?.("chat_realtime_connection_failed");
|
|
510
|
+
});
|
|
511
|
+
activeSocket.addEventListener("close", (event) => {
|
|
512
|
+
if (activeSocket !== socket)
|
|
513
|
+
return;
|
|
514
|
+
socket = null;
|
|
515
|
+
if (stopped)
|
|
516
|
+
notifyState("closed");
|
|
517
|
+
else if (event.code === 1008 && event.reason === "chat_realtime_token_expired") {
|
|
518
|
+
attempt = Math.max(attempt, 1);
|
|
519
|
+
void connect();
|
|
520
|
+
} else if (event.code === 1008) {
|
|
521
|
+
stopped = true;
|
|
522
|
+
options.onError?.(event.reason || "chat_realtime_forbidden");
|
|
523
|
+
notifyState("closed");
|
|
524
|
+
} else
|
|
525
|
+
scheduleReconnect();
|
|
526
|
+
});
|
|
527
|
+
};
|
|
528
|
+
void connect();
|
|
529
|
+
return {
|
|
530
|
+
close() {
|
|
531
|
+
if (stopped)
|
|
532
|
+
return;
|
|
533
|
+
stopped = true;
|
|
534
|
+
if (reconnectTimer)
|
|
535
|
+
clearTimeout(reconnectTimer);
|
|
536
|
+
reconnectTimer = null;
|
|
537
|
+
socket?.close(1e3, "chat_realtime_client_closed");
|
|
538
|
+
socket = null;
|
|
539
|
+
notifyState("closed");
|
|
540
|
+
},
|
|
541
|
+
subscribe(conversationId, lastEventVersion = null) {
|
|
542
|
+
subscriptions.set(conversationId, lastEventVersion);
|
|
543
|
+
send({ type: "subscribe", conversationId, lastEventVersion });
|
|
544
|
+
},
|
|
545
|
+
unsubscribe(conversationId) {
|
|
546
|
+
subscriptions.delete(conversationId);
|
|
547
|
+
send({ type: "unsubscribe", conversationId });
|
|
548
|
+
},
|
|
549
|
+
setTyping(conversationId, active) {
|
|
550
|
+
if (!subscriptions.has(conversationId))
|
|
551
|
+
throw new Error("chat_realtime_not_subscribed");
|
|
552
|
+
send({ type: "typing", conversationId, active });
|
|
553
|
+
},
|
|
554
|
+
setPresenceContext(context) {
|
|
555
|
+
presenceContext = context;
|
|
556
|
+
send({ type: "presence.context", context });
|
|
557
|
+
},
|
|
558
|
+
getLastEventVersion(conversationId) {
|
|
559
|
+
return subscriptions.get(conversationId) ?? null;
|
|
560
|
+
},
|
|
561
|
+
subscribePlatform(topic, lastEventVersion = null) {
|
|
562
|
+
platformSubscriptions.set(topic, lastEventVersion);
|
|
563
|
+
send({ type: "platform.subscribe", topic, lastEventVersion });
|
|
564
|
+
},
|
|
565
|
+
unsubscribePlatform(topic) {
|
|
566
|
+
platformSubscriptions.delete(topic);
|
|
567
|
+
send({ type: "platform.unsubscribe", topic });
|
|
568
|
+
},
|
|
569
|
+
getPlatformEventVersion(topic) {
|
|
570
|
+
return platformSubscriptions.get(topic) ?? null;
|
|
571
|
+
},
|
|
572
|
+
sendPlayTradeActivity(frame) {
|
|
573
|
+
if (stopped || socket?.readyState !== 1)
|
|
574
|
+
throw new Error("chat_realtime_not_ready");
|
|
575
|
+
send({ type: "playtrade.activity", ...frame });
|
|
576
|
+
}
|
|
577
|
+
};
|
|
202
578
|
}
|
|
203
579
|
};
|
|
580
|
+
return methods;
|
|
204
581
|
}
|
|
205
582
|
// Annotate the CommonJS export names for ESM import in node:
|
|
206
583
|
0 && (module.exports = {
|