From 94dc961848c2c0750f449558f0ecd434606827bd Mon Sep 17 00:00:00 2001 From: Hugo Arregui <969314+hugoArregui@users.noreply.github.com> Date: Fri, 22 Dec 2023 11:28:58 -0300 Subject: [PATCH] chore: update about (#232) --- docker-compose.yml | 17 ++++ package.json | 5 +- .../handlers/world-about-handler.ts | 21 +++-- test/integration/world-about-handler.spec.ts | 10 ++- yarn.lock | 81 +++---------------- 5 files changed, 49 insertions(+), 85 deletions(-) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..253abc2d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3.8' +services: + postgres: + container_name: "world_content_server_db" + image: 'postgres:latest' + restart: always + user: postgres + volumes: + - postgres_volume:/var/lib/postgresql/data + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=pass1234 + - POSTGRES_DB=world_content_server + ports: + - '5450:5432' +volumes: + postgres_volume: diff --git a/package.json b/package.json index fd2ab2f9..d3380029 100644 --- a/package.json +++ b/package.json @@ -8,16 +8,17 @@ "lint:fix": "eslint '**/*.{js,ts}' --fix", "start": "node --trace-warnings --abort-on-uncaught-exception --unhandled-rejections=strict dist/index.js", "test": "jest --forceExit --detectOpenHandles --verbose", - "test:coverage": "jest --forceExit --detectOpenHandles --coverage --verbose" + "test:coverage": "jest --forceExit --detectOpenHandles --coverage --verbose", + "start:db": "docker-compose up -d && docker exec world_content_server_db bash -c \"until pg_isready; do sleep 1; done\" && sleep 5" }, "dependencies": { + "@dcl/catalyst-api-specs": "^3.2.4", "@dcl/catalyst-contracts": "^4.3.1", "@dcl/catalyst-storage": "^4.1.0", "@dcl/crypto": "^3.4.5", "@dcl/hashing": "^3.0.4", "@dcl/platform-crypto-middleware": "^1.0.2", "@dcl/platform-server-commons": "^0.0.3", - "@dcl/protocol": "^1.0.0-6200210039.commit-75f18e8", "@dcl/schemas": "^9.9.0", "@ensdomains/eth-ens-namehash": "^2.0.15", "@types/busboy": "^1.5.0", diff --git a/src/controllers/handlers/world-about-handler.ts b/src/controllers/handlers/world-about-handler.ts index 93c25dc7..368ab6ba 100644 --- a/src/controllers/handlers/world-about-handler.ts +++ b/src/controllers/handlers/world-about-handler.ts @@ -1,9 +1,5 @@ import { HandlerContextWithPath } from '../../types' -import { - AboutResponse, - AboutResponse_MinimapConfiguration, - AboutResponse_SkyboxConfiguration -} from '@dcl/protocol/out-js/decentraland/bff/http_endpoints.gen' +import { About, AboutConfigurationsMinimap, AboutConfigurationsSkybox } from '@dcl/catalyst-api-specs/lib/client' import { l1Contracts, L1Network } from '@dcl/catalyst-contracts' import { assertNotBlockedOrWithinInGracePeriod } from '../../logic/blocked' import { NotFoundError } from '@dcl/platform-server-commons' @@ -40,7 +36,7 @@ export async function worldAboutHandler({ } const roomPrefix = await config.requireString('COMMS_ROOM_PREFIX') - const fixedAdapter = await resolveFixedAdapter(params.world_name, runtimeMetadata.fixedAdapter, baseUrl, roomPrefix) + const adapter = await resolveFixedAdapter(params.world_name, runtimeMetadata.fixedAdapter, baseUrl, roomPrefix) const globalScenesURN = await config.getString('GLOBAL_SCENES_URN') @@ -54,7 +50,7 @@ export async function worldAboutHandler({ return defaultImage } - const minimap: AboutResponse_MinimapConfiguration = { + const minimap: AboutConfigurationsMinimap = { enabled: runtimeMetadata.minimapVisible } if (minimap.enabled || runtimeMetadata.minimapDataImage) { @@ -67,13 +63,13 @@ export async function worldAboutHandler({ ) } - const skybox: AboutResponse_SkyboxConfiguration = { + const skybox: AboutConfigurationsSkybox = { fixedHour: runtimeMetadata.skyboxFixedTime, textures: runtimeMetadata.skyboxTextures?.map((texture: string) => urlForFile(texture)) || [] } const healthy = contentStatus.healthy && lambdasStatus.healthy - const body: AboutResponse = { + const body: About = { healthy, acceptingUsers: healthy, configurations: { @@ -85,6 +81,7 @@ export async function worldAboutHandler({ realmName: runtimeMetadata.name }, content: { + synchronizationStatus: 'Syncing', healthy: contentStatus.healthy, publicUrl: contentStatus.publicUrl }, @@ -95,7 +92,7 @@ export async function worldAboutHandler({ comms: { healthy: true, protocol: 'v3', - fixedAdapter: fixedAdapter + adapter } } @@ -112,8 +109,8 @@ async function resolveFixedAdapter( roomPrefix: string ) { if (fixedAdapter === 'offline:offline') { - return 'offline:offline' + return 'fixed-adapter:offline:offline' } - return `signed-login:${baseUrl}/get-comms-adapter/${roomPrefix}${worldName.toLowerCase()}` + return `fixed-adapter:signed-login:${baseUrl}/get-comms-adapter/${roomPrefix}${worldName.toLowerCase()}` } diff --git a/test/integration/world-about-handler.spec.ts b/test/integration/world-about-handler.spec.ts index c3769a3a..80564291 100644 --- a/test/integration/world-about-handler.spec.ts +++ b/test/integration/world-about-handler.spec.ts @@ -83,12 +83,16 @@ test('world about handler /world/:world_name/about', function ({ components, stu }, realmName: worldName }, - content: { healthy: true, publicUrl: 'https://peer.com/content' }, + content: { + healthy: true, + publicUrl: 'https://peer.com/content', + synchronizationStatus: 'Syncing' + }, lambdas: { healthy: true, publicUrl: 'https://peer.com/lambdas' }, comms: { healthy: true, protocol: 'v3', - fixedAdapter: `signed-login:http://0.0.0.0:3000/get-comms-adapter/world-${worldName}` + adapter: `fixed-adapter:signed-login:http://0.0.0.0:3000/get-comms-adapter/world-${worldName}` } }) }) @@ -230,7 +234,7 @@ test('world about handler /world/:world_name/about', function ({ components, stu comms: { healthy: true, protocol: 'v3', - fixedAdapter: 'offline:offline' + adapter: 'fixed-adapter:offline:offline' } }) }) diff --git a/yarn.lock b/yarn.lock index 3bcd20c0..afb3f9bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -497,6 +497,13 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@dcl/catalyst-api-specs@^3.2.4": + version "3.2.5" + resolved "https://registry.yarnpkg.com/@dcl/catalyst-api-specs/-/catalyst-api-specs-3.2.5.tgz#ce5cdc0c90d38108d64d9b8ea147cb3a02b29124" + integrity sha512-x6zFbYLOpcwxm+LI20aa9EB+IuLF8QYxOx5D86XgZVVGvIjHlyUVpZrkE+C/VAtQsOK3Ry80jGu7G1n0BHXw9w== + dependencies: + yaml "^2.3.4" + "@dcl/catalyst-contracts@^4.0.2", "@dcl/catalyst-contracts@^4.3.1": version "4.3.1" resolved "https://registry.yarnpkg.com/@dcl/catalyst-contracts/-/catalyst-contracts-4.3.1.tgz#ee79b4bf9c07fbe79c35b208323b6e30bf6e2598" @@ -561,13 +568,6 @@ "@well-known-components/interfaces" "^1.4.2" node-fetch "^2.7.0" -"@dcl/protocol@^1.0.0-6200210039.commit-75f18e8": - version "1.0.0-6200210039.commit-75f18e8" - resolved "https://registry.yarnpkg.com/@dcl/protocol/-/protocol-1.0.0-6200210039.commit-75f18e8.tgz#5d6579e9ae74a5f92e981ff1741e58918545e4af" - integrity sha512-713H4P0TfuamhxvcQd0ck4tBYap+k/JKMUL9xYT0XJ3Fuog2tLhqYORW43c4n9dVoU4ljciNvfUqhqLE8NIweA== - dependencies: - "@dcl/ts-proto" "1.154.0" - "@dcl/schemas@^9.0.0", "@dcl/schemas@^9.2.0", "@dcl/schemas@^9.9.0": version "9.9.0" resolved "https://registry.yarnpkg.com/@dcl/schemas/-/schemas-9.9.0.tgz#868693b46ef3d64b166d095bb0405d5119de461a" @@ -577,19 +577,6 @@ ajv-errors "^3.0.0" ajv-keywords "^5.1.0" -"@dcl/ts-proto@1.154.0": - version "1.154.0" - resolved "https://registry.yarnpkg.com/@dcl/ts-proto/-/ts-proto-1.154.0.tgz#25cc76d90b148500bf95c7bffde86702fcde3329" - integrity sha512-2S5AKMMPVZrVfa/1WRy4/h0niikcbu3Yf6dCoudh7ScG7BsyKAPC3CMg6IJKHzrmWS593UZClq7YJof6Vt4O+w== - dependencies: - "@types/object-hash" "^3.0.2" - case-anything "^2.1.10" - dataloader "^1.4.0" - object-hash "^3.0.0" - protobufjs "^7.2.4" - ts-poet "^6.4.1" - ts-proto-descriptors "^1.15.0" - "@ensdomains/eth-ens-namehash@^2.0.15": version "2.0.15" resolved "https://registry.yarnpkg.com/@ensdomains/eth-ens-namehash/-/eth-ens-namehash-2.0.15.tgz#5e5f2f24ba802aff8bc19edd822c9a11200cdf4a" @@ -1231,11 +1218,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.19.tgz#cb03fca8910fdeb7595b755126a8a78144714eea" integrity sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA== -"@types/object-hash@^3.0.2": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/object-hash/-/object-hash-3.0.2.tgz#f3656433e6c6049571fc3fb3fb42f389af96c0eb" - integrity sha512-tfyXl1JPCf2hzIDK29gO7qGqJjThKBzg/Cn3bA68R9NmWdOx+f7k5mm4to/n43BHspCwcoUC6FU4NpUoK/h9bQ== - "@types/pg@^8.0.0", "@types/pg@^8.6.5": version "8.10.2" resolved "https://registry.yarnpkg.com/@types/pg/-/pg-8.10.2.tgz#7814d1ca02c8071f4d0864c1b17c589b061dba43" @@ -1838,11 +1820,6 @@ caniuse-lite@^1.0.30001503: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001513.tgz#382fe5fbfb0f7abbaf8c55ca3ac71a0307a752e9" integrity sha512-pnjGJo7SOOjAGytZZ203Em95MRM8Cr6jhCXNF/FAXTpCTRTECnqQWLpiTRqrFtdYcth8hf4WECUpkezuYsMVww== -case-anything@^2.1.10: - version "2.1.10" - resolved "https://registry.yarnpkg.com/case-anything/-/case-anything-2.1.10.tgz#d18a6ca968d54ec3421df71e3e190f3bced23410" - integrity sha512-JczJwVrCP0jPKh05McyVsuOg6AYosrB9XWZKbQzXeDAm2ClE/PJE/BcrrQrVyGYH7Jg8V/LDupmyL4kFlVsVFQ== - chalk@^2.0.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -1993,11 +1970,6 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -dataloader@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-1.4.0.tgz#bca11d867f5d3f1b9ed9f737bd15970c65dff5c8" - integrity sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw== - dcl-catalyst-client@^21.5.5: version "21.5.5" resolved "https://registry.yarnpkg.com/dcl-catalyst-client/-/dcl-catalyst-client-21.5.5.tgz#ee76ee00dd93b0c070e3bc2e59475f400a1d5787" @@ -2066,11 +2038,6 @@ destroy@^1.2.0: resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== -detect-libc@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg== - detect-libc@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.2.tgz#8ccf2ba9315350e1241b88d0ac3b0e1fbd99605d" @@ -2117,13 +2084,6 @@ dotenv@^16.0.1: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07" integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ== -dprint-node@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/dprint-node/-/dprint-node-1.0.7.tgz#f571eaf61affb3a696cff1bdde78a021875ba540" - integrity sha512-NTZOW9A7ipb0n7z7nC3wftvsbceircwVHSgzobJsEQa+7RnOMbhrfX5IflA6CtC4GA63DSAiHYXa4JKEy9F7cA== - dependencies: - detect-libc "^1.0.3" - ecdsa-sig-formatter@1.0.11: version "1.0.11" resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" @@ -3536,7 +3496,7 @@ lodash@^4.17.20, lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -long@^5.0.0, long@^5.2.3: +long@^5.0.0: version "5.2.3" resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== @@ -3781,11 +3741,6 @@ object-assign@^4.1.1: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== -object-hash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" - integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== - obuf@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" @@ -4599,21 +4554,6 @@ ts-jest@^29.1.0: semver "^7.5.3" yargs-parser "^21.0.1" -ts-poet@^6.4.1: - version "6.4.1" - resolved "https://registry.yarnpkg.com/ts-poet/-/ts-poet-6.4.1.tgz#e68d314a07cf9c0d568a3bfd87023ec91ff77964" - integrity sha512-AjZEs4h2w4sDfwpHMxQKHrTlNh2wRbM5NRXmLz0RiH+yPGtSQFbe9hBpNocU8vqVNgfh0BIOiXR80xDz3kKxUQ== - dependencies: - dprint-node "^1.0.7" - -ts-proto-descriptors@^1.15.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/ts-proto-descriptors/-/ts-proto-descriptors-1.15.0.tgz#e859e3a2887da2d954c552524719b80bdb6ee355" - integrity sha512-TYyJ7+H+7Jsqawdv+mfsEpZPTIj9siDHS6EMCzG/z3b/PZiphsX+mWtqFfFVe5/N0Th6V3elK9lQqjnrgTOfrg== - dependencies: - long "^5.2.3" - protobufjs "^7.2.4" - tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -4829,6 +4769,11 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== +yaml@^2.3.4: + version "2.3.4" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.4.tgz#53fc1d514be80aabf386dc6001eb29bf3b7523b2" + integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA== + yargs-parser@^21.0.0, yargs-parser@^21.0.1, yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"