Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: revert "chore: update catalyst storage #140" #143

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@aws-sdk/client-sns": "^3.369.0",
"@dcl/catalyst-contracts": "^4.0.6",
"@dcl/catalyst-storage": "^3.0.1",
"@dcl/catalyst-storage": "^2.0.4",
"@dcl/crypto": "^3.4.2",
"@dcl/hashing": "^2.0.0",
"@dcl/protocol": "^1.0.0-5125382977.commit-f7db98f",
Expand All @@ -25,6 +25,7 @@
"@well-known-components/logger": "^3.1.2",
"@well-known-components/metrics": "^2.0.1",
"@well-known-components/thegraph-component": "^1.5.0",
"aws-sdk": "^2.1262.0",
"busboy": "^1.6.0",
"decentraland-crypto-middleware": "^1.1.0",
"eth-connect": "^6.2.0",
Expand Down
4 changes: 2 additions & 2 deletions src/adapters/worlds-indexer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppComponents, IWorldsIndexer, WorldData, WorldsIndex } from '../types'
import { bufferToStream, streamToBuffer } from '@dcl/catalyst-storage'
import { bufferToStream, streamToBuffer } from '@dcl/catalyst-storage/dist/content-item'
import { stringToUtf8Bytes } from 'eth-connect'
import { ContentMapping } from '@dcl/schemas/dist/misc/content-mapping'
import PQueue from 'p-queue'
Expand Down Expand Up @@ -76,7 +76,7 @@ export async function createWorldsIndexerComponent({
index = await createIndex()
} else {
index = JSON.parse((await streamToBuffer(await content.asStream())).toString())
// if older than 10 minutes, create a new one
// if older than 10 minutes create a new one
if (Date.now() - index.timestamp > 10 * 60 * 1000) {
index = await createIndex()
}
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/worlds-manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppComponents, IWorldsManager, WorldMetadata } from '../types'
import LRU from 'lru-cache'
import { bufferToStream, streamToBuffer } from '@dcl/catalyst-storage'
import { bufferToStream, streamToBuffer } from '@dcl/catalyst-storage/dist/content-item'
import { AuthChain, Entity } from '@dcl/schemas'
import { stringToUtf8Bytes } from 'eth-connect'

Expand Down
4 changes: 2 additions & 2 deletions src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export async function initComponents(): Promise<AppComponents> {
const fs = createFsComponent()

const storage = bucket
? await createAwsS3BasedFileSystemContentStorage({ config, logs }, bucket)
: await createFolderBasedFileSystemContentStorage({ fs, logs }, storageFolder)
? await createAwsS3BasedFileSystemContentStorage({ fs, config }, bucket)
: await createFolderBasedFileSystemContentStorage({ fs }, storageFolder)

const subGraphUrl = await config.requireString('MARKETPLACE_SUBGRAPH_URL')
const marketplaceSubGraph = await createSubgraphComponent({ config, logs, metrics, fetch }, subGraphUrl)
Expand Down
17 changes: 9 additions & 8 deletions src/controllers/handlers/deploy-entity-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { AuthChain, AuthLink, Entity } from '@dcl/schemas'
import { IHttpServerComponent, ILoggerComponent } from '@well-known-components/interfaces'
import { FormDataContext } from '../../logic/multipart'
import { AppComponents, HandlerContextWithPath } from '../../types'
import { bufferToStream, streamToBuffer } from '@dcl/catalyst-storage'
import { bufferToStream, streamToBuffer } from '@dcl/catalyst-storage/dist/content-item'
import { stringToUtf8Bytes } from 'eth-connect'
import { PublishCommand, SNSClient } from '@aws-sdk/client-sns'
import { SNS } from 'aws-sdk'
import { DeploymentToSqs } from '@dcl/schemas/dist/misc/deployments-to-sqs'

export function requireString(val: string | null | undefined): string {
Expand Down Expand Up @@ -155,12 +155,13 @@ export async function deployEntity(
},
contentServerUrls: [baseUrl]
}
const sns = new SNSClient({})
const command = new PublishCommand({
TopicArn: ctx.components.sns.arn,
Message: JSON.stringify(deploymentToSqs)
})
const receipt = await sns.send(command)
const sns = new SNS()
const receipt = await sns
.publish({
TopicArn: ctx.components.sns.arn,
Message: JSON.stringify(deploymentToSqs)
})
.promise()
logger.info('notification sent', {
MessageId: receipt.MessageId as any,
SequenceNumber: receipt.SequenceNumber as any
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/handlers/world-about-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
AboutResponse_MinimapConfiguration,
AboutResponse_SkyboxConfiguration
} from '@dcl/protocol/out-js/decentraland/bff/http_endpoints.gen'
import { streamToBuffer } from '@dcl/catalyst-storage'
import { streamToBuffer } from '@dcl/catalyst-storage/dist/content-item'
import { ContentMapping } from '@dcl/schemas/dist/misc/content-mapping'
import { l1Contracts, L1Network } from '@dcl/catalyst-contracts'

Expand Down
2 changes: 1 addition & 1 deletion src/service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Lifecycle } from '@well-known-components/interfaces'
import { setupRouter } from './controllers/routes'
import { AppComponents, GlobalContext, TestComponents } from './types'
import { bufferToStream, streamToBuffer } from '@dcl/catalyst-storage'
import { bufferToStream, streamToBuffer } from '@dcl/catalyst-storage/dist/content-item'
import { stringToUtf8Bytes } from 'eth-connect'

// this function wires the business logic (adapters & controllers) with the components (ports)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/acl-handlers.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test } from '../components'
import { getIdentity, storeJson } from '../utils'
import { Authenticator } from '@dcl/crypto'
import { streamToBuffer } from '@dcl/catalyst-storage'
import { streamToBuffer } from '@dcl/catalyst-storage/dist/content-item'

test('acl handler GET /acl/:world_name', function ({ components }) {
it('returns an error when world does not exist', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Sinon from 'sinon'
import { stringToUtf8Bytes } from 'eth-connect'
import { hashV1 } from '@dcl/hashing'
import { getIdentity, storeJson } from '../utils'
import { streamToBuffer } from '@dcl/catalyst-storage'
import { streamToBuffer } from '@dcl/catalyst-storage/dist/content-item'
import { DeploymentBuilder } from 'dcl-catalyst-client'

test('deployment works', function ({ components, stubComponents }) {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/index-handler.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test } from '../components'
import { bufferToStream } from '@dcl/catalyst-storage'
import { bufferToStream } from '@dcl/catalyst-storage/dist/content-item'
import { stringToUtf8Bytes } from 'eth-connect'
import { WorldData } from '../../src/types'

Expand Down
2 changes: 1 addition & 1 deletion test/unit/validations/scene.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { createMockNamePermissionChecker } from '../../mocks/dcl-name-checker-mo
import { getIdentity } from '../../utils'
import { IConfigComponent } from '@well-known-components/interfaces'
import { hashV1 } from '@dcl/hashing'
import { bufferToStream } from '@dcl/catalyst-storage'
import { bufferToStream } from '@dcl/catalyst-storage/dist/content-item'
import { createWorldsManagerComponent } from '../../../src/adapters/worlds-manager'
import { createLogComponent } from '@well-known-components/logger'
import {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/world-indexer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IConfigComponent } from '@well-known-components/interfaces'
import { createConfigComponent } from '@well-known-components/env-config-provider'
import { createInMemoryStorage } from '@dcl/catalyst-storage'
import { createWorldsManagerComponent } from '../../src/adapters/worlds-manager'
import { bufferToStream, streamToBuffer } from '@dcl/catalyst-storage'
import { bufferToStream, streamToBuffer } from '@dcl/catalyst-storage/dist/content-item'
import { stringToUtf8Bytes } from 'eth-connect'
import { WorldData } from '../../src/types'

Expand Down
Loading