diff --git a/package-lock.json b/package-lock.json index 6e3c62e..e654146 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "@dcl/catalyst-storage": "^2.0.3", "@dcl/schemas": "^6.6.0", "@dcl/snapshots-fetcher": "^5.0.4", + "@types/destroy": "^1.0.0", "@well-known-components/env-config-provider": "^1.1.1", "@well-known-components/http-server": "^1.1.1", "@well-known-components/interfaces": "^1.1.1", @@ -690,6 +691,24 @@ "node": ">16.0.0" } }, + "node_modules/@dcl/snapshots-fetcher/node_modules/@dcl/schemas": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@dcl/schemas/-/schemas-6.3.0.tgz", + "integrity": "sha512-Zhbly35/SZ5f4h0VnCtSjxxIaEbCpRzAo487Pd+PIuzx1vt5C9srJRHbMz0Cns6h3KiF8/E4Zsjl141NYIijzA==", + "dependencies": { + "ajv": "^8.11.0", + "ajv-errors": "^3.0.0", + "ajv-keywords": "^5.1.0" + } + }, + "node_modules/@dcl/snapshots-fetcher/node_modules/@well-known-components/metrics": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@well-known-components/metrics/-/metrics-2.0.1.tgz", + "integrity": "sha512-jgT9TuxVS9GzVMMYWXNJRM2qXvexuf4xfrFNBYa3w+gqEWCK4Id5R4zBee/bm6/F5yIPauAWxbOS6KNNDBIrGw==", + "dependencies": { + "prom-client": "^14.1.0" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -1694,6 +1713,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/aws-sdk": { "version": "2.1307.0", "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1307.0.tgz", @@ -6111,6 +6141,18 @@ "which-typed-array": "^1.1.2" } }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -6924,6 +6966,26 @@ "@well-known-components/interfaces": "^1.1.0", "@well-known-components/metrics": "^2.0.0", "p-queue": "^6.6.2" + }, + "dependencies": { + "@dcl/schemas": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@dcl/schemas/-/schemas-6.3.0.tgz", + "integrity": "sha512-Zhbly35/SZ5f4h0VnCtSjxxIaEbCpRzAo487Pd+PIuzx1vt5C9srJRHbMz0Cns6h3KiF8/E4Zsjl141NYIijzA==", + "requires": { + "ajv": "^8.11.0", + "ajv-errors": "^3.0.0", + "ajv-keywords": "^5.1.0" + } + }, + "@well-known-components/metrics": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@well-known-components/metrics/-/metrics-2.0.1.tgz", + "integrity": "sha512-jgT9TuxVS9GzVMMYWXNJRM2qXvexuf4xfrFNBYa3w+gqEWCK4Id5R4zBee/bm6/F5yIPauAWxbOS6KNNDBIrGw==", + "requires": { + "prom-client": "^14.1.0" + } + } } }, "@istanbuljs/load-nyc-config": { @@ -7769,6 +7831,11 @@ "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" }, + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" + }, "aws-sdk": { "version": "2.1307.0", "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1307.0.tgz", @@ -8027,6 +8094,15 @@ "get-intrinsic": "^1.0.2" } }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -11083,6 +11159,7 @@ } } }, + "url-parse": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", @@ -11093,6 +11170,7 @@ "requires-port": "^1.0.0" } }, + "util": { "version": "0.12.5", "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", diff --git a/package.json b/package.json index 3205a56..0d15ef3 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,10 @@ "semi": false }, "dependencies": { - "@dcl/catalyst-storage": "^2.0.3", "@dcl/schemas": "^6.6.0", + "@dcl/catalyst-storage": "^2.0.3", "@dcl/snapshots-fetcher": "^5.0.4", + "@types/destroy": "^1.0.0", "@well-known-components/env-config-provider": "^1.1.1", "@well-known-components/http-server": "^1.1.1", "@well-known-components/interfaces": "^1.1.1", @@ -25,4 +26,4 @@ "@well-known-components/metrics": "^2.0.1", "aws-sdk": "^2.1138.0" } -} +} \ No newline at end of file diff --git a/src/adapters/deployer/index.ts b/src/adapters/deployer/index.ts index af09b77..995da01 100644 --- a/src/adapters/deployer/index.ts +++ b/src/adapters/deployer/index.ts @@ -2,7 +2,7 @@ import { downloadEntityAndContentFiles } from "@dcl/snapshots-fetcher" import { IDeployerComponent } from "@dcl/snapshots-fetcher/dist/types" import { SNS } from "aws-sdk" import { AppComponents } from "../../types" -import { DeploymentToSqs } from "@dcl/schemas/dist/misc/deployments-to-sqs"; +import { DeploymentToSqs } from "@dcl/schemas/dist/misc/deployments-to-sqs" export function createDeployerComponent( components: Pick @@ -13,6 +13,7 @@ export function createDeployerComponent( return { async deployEntity(entity, servers) { + const markAsDeployed = entity.markAsDeployed ? entity.markAsDeployed : async () => { } if (entity.entityType == "scene" || entity.entityType == "wearable" || entity.entityType == "emote") { const exists = await components.storage.exist(entity.entityId) @@ -51,10 +52,15 @@ export function createDeployerComponent( SequenceNumber: receipt.SequenceNumber as any, }) } + await markAsDeployed() }) + } else { + await markAsDeployed() } + } else { + await markAsDeployed() } }, - async onIdle() {}, + async onIdle() { }, } } diff --git a/src/components.ts b/src/components.ts index e4d7ffb..71f8815 100644 --- a/src/components.ts +++ b/src/components.ts @@ -123,5 +123,7 @@ export async function initComponents(): Promise { synchronizer, deployer, sns, + processedSnapshotStorage, + snapshotStorage } } diff --git a/src/types.ts b/src/types.ts index f9012ab..ad61ba2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,5 +1,6 @@ import { IJobQueue } from "@dcl/snapshots-fetcher/dist/job-queue-port" -import { IDeployerComponent, SynchronizerComponent } from "@dcl/snapshots-fetcher/dist/types" +import { IDeployerComponent, IProcessedSnapshotStorageComponent, ISnapshotStorageComponent, SynchronizerComponent } from "@dcl/snapshots-fetcher/dist/types" + import type { IFetchComponent } from "@well-known-components/http-server" import type { IConfigComponent, @@ -26,6 +27,10 @@ export type BaseComponents = { fs: IFileSystemComponent storage: IContentStorageComponent synchronizer: SynchronizerComponent + + processedSnapshotStorage: IProcessedSnapshotStorageComponent + snapshotStorage: ISnapshotStorageComponent + deployer: IDeployerComponent sns: SnsComponent } @@ -47,11 +52,11 @@ export type TestComponents = BaseComponents & { export type HandlerContextWithPath< ComponentNames extends keyof AppComponents, Path extends string = any -> = IHttpServerComponent.PathAwareContext< - IHttpServerComponent.DefaultContext<{ - components: Pick - }>, - Path -> + > = IHttpServerComponent.PathAwareContext< + IHttpServerComponent.DefaultContext<{ + components: Pick + }>, + Path + > export type Context = IHttpServerComponent.PathAwareContext