From 4841b5d29c1f920828f4a29766d78e516d3f21ce Mon Sep 17 00:00:00 2001 From: Nacho Date: Thu, 6 Jun 2024 19:43:39 -0300 Subject: [PATCH] Rename medias to media --- .../backend/src/methods/create_moment.ts | 4 ++-- packages/drops/package.json | 6 ++--- packages/moments/README.md | 22 +++++++++---------- packages/moments/package.json | 6 ++--- .../moments/src/client/MomentsClient.spec.ts | 2 +- packages/moments/src/client/MomentsClient.ts | 10 ++++----- .../src/client/dtos/create/CreateInput.ts | 4 ++-- packages/poaps/package.json | 6 ++--- packages/providers/package.json | 4 ++-- packages/utils/package.json | 2 +- yarn.lock | 18 +++++++-------- 11 files changed, 42 insertions(+), 42 deletions(-) diff --git a/examples/moments/backend/src/methods/create_moment.ts b/examples/moments/backend/src/methods/create_moment.ts index 76dac84b..8ddc9f24 100644 --- a/examples/moments/backend/src/methods/create_moment.ts +++ b/examples/moments/backend/src/methods/create_moment.ts @@ -1,4 +1,4 @@ -import { MomentsClient, CreateMomentInput } from '@poap-xyz/moments'; +import { CreateMomentInput, MomentsClient } from '@poap-xyz/moments'; import fs from 'fs'; import mime from 'mime'; @@ -18,7 +18,7 @@ export const create_moment = async (client: MomentsClient): Promise => { */ tokenId: 6568008, author: '0x82AB2941Cf555CED5ad7Ed232a5B5f6083815FBC', - medias: [ + media: [ { fileBinary: fileBuffer, fileType: mimeType, diff --git a/packages/drops/package.json b/packages/drops/package.json index 6e8f4f27..54525ec3 100644 --- a/packages/drops/package.json +++ b/packages/drops/package.json @@ -1,6 +1,6 @@ { "name": "@poap-xyz/drops", - "version": "0.3.0", + "version": "0.4.0", "description": "Drops module for the poap.js library", "main": "dist/cjs/index.cjs", "module": "dist/esm/index.mjs", @@ -29,7 +29,7 @@ "node": ">=18" }, "dependencies": { - "@poap-xyz/providers": "0.3.0", - "@poap-xyz/utils": "0.3.0" + "@poap-xyz/providers": "0.4.0", + "@poap-xyz/utils": "0.4.0" } } diff --git a/packages/moments/README.md b/packages/moments/README.md index 30482259..945ac1e7 100644 --- a/packages/moments/README.md +++ b/packages/moments/README.md @@ -27,8 +27,8 @@ yarn add @poap-xyz/moments @poap-xyz/utils @poap-xyz/providers axio ## Usage ```javascript -import { MomentsClient, CreateMomentInput, Moment } from '@poap-xyz/moments'; -import { PoapCompass, PoapMomentsApi, AuthenticationProviderHttp } from '@poap-xyz/providers'; +import {MomentsClient, CreateMomentInput, Moment} from '@poap-xyz/moments'; +import {PoapCompass, PoapMomentsApi, AuthenticationProviderHttp} from '@poap-xyz/providers'; import fs from 'fs'; // Set up the PoapMomentsApi with proper authentication @@ -47,7 +47,7 @@ const client = new MomentsClient( const input: CreateMomentInput = { dropId: 110148, tokenId: 6568008, // Optional: The Token ID related to the moment - medias: [{ + media: [{ fileBinary: await fs.promises.readFile('src/assets/poap.png'), fileType: 'image/png', }], @@ -63,16 +63,16 @@ const input: CreateMomentInput = { }; const moment: Moment = await client.createMoment(input); ``` -Explanations for each step: -| Step Name | Explanation | -|-------------------------|----------------------------------------------------------| -| `UPLOADING_MEDIA` | The process of uploading media assets. | -| `PROCESSING_MEDIA` | The media assets are being processed after upload. | -| `PROCESSING_MEDIA_ERROR`| An error occurred during the media processing phase. | -| `UPLOADING_MOMENT` | The process of uploading the moment's data. | -| `FINISHED` | The entire operation of creating the moment is complete. | +Explanations for each step: +| Step Name | Explanation | +|--------------------------|----------------------------------------------------------| +| `UPLOADING_MEDIA` | The process of uploading media assets. | +| `PROCESSING_MEDIA` | The media assets are being processed after upload. | +| `PROCESSING_MEDIA_ERROR` | An error occurred during the media processing phase. | +| `UPLOADING_MOMENT` | The process of uploading the moment's data. | +| `FINISHED` | The entire operation of creating the moment is complete. | ## Documentation diff --git a/packages/moments/package.json b/packages/moments/package.json index 8962b551..c5ebd9a7 100644 --- a/packages/moments/package.json +++ b/packages/moments/package.json @@ -1,6 +1,6 @@ { "name": "@poap-xyz/moments", - "version": "0.3.0", + "version": "0.4.0", "description": "Moments module for the poap.js library", "main": "dist/cjs/index.cjs", "module": "dist/esm/index.mjs", @@ -26,8 +26,8 @@ "build": "rollup -c --bundleConfigAsCjs" }, "dependencies": { - "@poap-xyz/providers": "0.3.0", - "@poap-xyz/utils": "0.3.0", + "@poap-xyz/providers": "0.4.0", + "@poap-xyz/utils": "0.4.0", "uuid": "^9.0.0" }, "engines": { diff --git a/packages/moments/src/client/MomentsClient.spec.ts b/packages/moments/src/client/MomentsClient.spec.ts index b65a820a..2d7fb5e7 100644 --- a/packages/moments/src/client/MomentsClient.spec.ts +++ b/packages/moments/src/client/MomentsClient.spec.ts @@ -50,7 +50,7 @@ describe('MomentsClient', () => { const inputs: CreateMomentInput = { dropId: DROP_ID, tokenId: TOKEN_ID, - medias: MEDIAS_TO_CREATE, + media: MEDIAS_TO_CREATE, author: AUTHOR, onStepUpdate, description: DESCRIPTION, diff --git a/packages/moments/src/client/MomentsClient.ts b/packages/moments/src/client/MomentsClient.ts index 6dcbb772..b32c1be9 100644 --- a/packages/moments/src/client/MomentsClient.ts +++ b/packages/moments/src/client/MomentsClient.ts @@ -32,9 +32,9 @@ export class MomentsClient { public async createMoment(input: CreateMomentInput): Promise { let mediaKeys: string[] = []; - if (input.medias && input.medias.length > 0) { + if (input.media && input.media.length > 0) { mediaKeys = await this.uploadMedias( - input.medias, + input.media, input.onStepUpdate, input.onFileUploadProgress, input.timeOut, @@ -71,17 +71,17 @@ export class MomentsClient { } private async uploadMedias( - medias: CreateMedia[], + mediaArray: CreateMedia[], onStepUpdate?: (step: CreateSteps) => void | Promise, onFileUploadProgress?: (progress: number) => void | Promise, timeOut?: number, ): Promise { void onStepUpdate?.(CreateSteps.UPLOADING_MEDIA); const mediaKeys: string[] = []; - const progressPerMedia = 1 / medias.length; + const progressPerMedia = 1 / mediaArray.length; let progress = 0; - for (const media of medias) { + for (const media of mediaArray) { const mediaOnFileUploadProgress = (mediaProgress: number): void => { const totalProgress = progressPerMedia * mediaProgress + progress; void onFileUploadProgress?.(totalProgress); diff --git a/packages/moments/src/client/dtos/create/CreateInput.ts b/packages/moments/src/client/dtos/create/CreateInput.ts index 6ae1f308..264d04dd 100644 --- a/packages/moments/src/client/dtos/create/CreateInput.ts +++ b/packages/moments/src/client/dtos/create/CreateInput.ts @@ -11,7 +11,7 @@ import { CreateMedia } from './CreateMedia'; * @property {string} timeOut - The amount of time to wait until media is processed. * @property {(step: CreateSteps) => void | Promise} [onStepUpdate] - Optional callback function to be called when the step changes. * @property {(progress: number) => void | Promise} [onFileProgress] - Optional callback function to be called when the file upload progress change - progress is a number between 0 and 1. - * @property {CreateMedia[]} medias - The media to be uploaded. + * @property {CreateMedia[]} media - The media to be uploaded. */ export interface CreateMomentInput { author: string; @@ -21,5 +21,5 @@ export interface CreateMomentInput { timeOut?: number; onStepUpdate?: (step: CreateSteps) => void | Promise; onFileUploadProgress?: (progress: number) => void | Promise; - medias?: CreateMedia[]; + media?: CreateMedia[]; } diff --git a/packages/poaps/package.json b/packages/poaps/package.json index 8df73756..8cadba18 100644 --- a/packages/poaps/package.json +++ b/packages/poaps/package.json @@ -1,6 +1,6 @@ { "name": "@poap-xyz/poaps", - "version": "0.3.0", + "version": "0.4.0", "description": "Poaps module for the poap.js library", "main": "dist/cjs/index.cjs", "module": "dist/esm/index.mjs", @@ -26,8 +26,8 @@ "build": "rollup -c --bundleConfigAsCjs" }, "dependencies": { - "@poap-xyz/providers": "0.3.0", - "@poap-xyz/utils": "0.3.0" + "@poap-xyz/providers": "0.4.0", + "@poap-xyz/utils": "0.4.0" }, "engines": { "node": ">=18" diff --git a/packages/providers/package.json b/packages/providers/package.json index 83d7f73c..089fa2fc 100644 --- a/packages/providers/package.json +++ b/packages/providers/package.json @@ -1,6 +1,6 @@ { "name": "@poap-xyz/providers", - "version": "0.3.0", + "version": "0.4.0", "description": "Providers module for the poap.js library", "main": "dist/cjs/index.cjs", "module": "dist/esm/index.mjs", @@ -26,7 +26,7 @@ "build": "rollup -c --bundleConfigAsCjs" }, "dependencies": { - "@poap-xyz/utils": "0.3.0", + "@poap-xyz/utils": "0.4.0", "axios": "^1.6.8", "lodash.chunk": "^4.2.0" }, diff --git a/packages/utils/package.json b/packages/utils/package.json index 307759cf..12839631 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@poap-xyz/utils", - "version": "0.3.0", + "version": "0.4.0", "description": "Utils module for the poap.js library", "main": "dist/cjs/index.cjs", "module": "dist/esm/index.mjs", diff --git a/yarn.lock b/yarn.lock index 0808d89e..4c48476c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -884,8 +884,8 @@ __metadata: version: 0.0.0-use.local resolution: "@poap-xyz/drops@workspace:packages/drops" dependencies: - "@poap-xyz/providers": 0.3.0 - "@poap-xyz/utils": 0.3.0 + "@poap-xyz/providers": 0.4.0 + "@poap-xyz/utils": 0.4.0 languageName: unknown linkType: soft @@ -901,8 +901,8 @@ __metadata: version: 0.0.0-use.local resolution: "@poap-xyz/moments@workspace:packages/moments" dependencies: - "@poap-xyz/providers": 0.3.0 - "@poap-xyz/utils": 0.3.0 + "@poap-xyz/providers": 0.4.0 + "@poap-xyz/utils": 0.4.0 "@types/uuid": ^9.0.2 uuid: ^9.0.0 languageName: unknown @@ -912,16 +912,16 @@ __metadata: version: 0.0.0-use.local resolution: "@poap-xyz/poaps@workspace:packages/poaps" dependencies: - "@poap-xyz/providers": 0.3.0 - "@poap-xyz/utils": 0.3.0 + "@poap-xyz/providers": 0.4.0 + "@poap-xyz/utils": 0.4.0 languageName: unknown linkType: soft -"@poap-xyz/providers@*, @poap-xyz/providers@0.3.0, @poap-xyz/providers@workspace:packages/providers": +"@poap-xyz/providers@*, @poap-xyz/providers@0.4.0, @poap-xyz/providers@workspace:packages/providers": version: 0.0.0-use.local resolution: "@poap-xyz/providers@workspace:packages/providers" dependencies: - "@poap-xyz/utils": 0.3.0 + "@poap-xyz/utils": 0.4.0 axios: ^1.6.8 axios-mock-adapter: ^1.21.4 jest-fetch-mock: ^3.0.3 @@ -929,7 +929,7 @@ __metadata: languageName: unknown linkType: soft -"@poap-xyz/utils@*, @poap-xyz/utils@0.3.0, @poap-xyz/utils@workspace:packages/utils": +"@poap-xyz/utils@*, @poap-xyz/utils@0.4.0, @poap-xyz/utils@workspace:packages/utils": version: 0.0.0-use.local resolution: "@poap-xyz/utils@workspace:packages/utils" languageName: unknown