From 4dd23a20c5390a5c41134761835ae3679e13d502 Mon Sep 17 00:00:00 2001 From: Alejo Thomas Ortega Date: Mon, 16 Dec 2024 09:49:16 -0300 Subject: [PATCH] feat: add properties to AssetBundleConvertedEvent (#322) * feat: add properties to AssetBundleConvertedEvent * refactor: rename AB Conversion event to AssetBundleConversionFinishedEvent --- report/schemas.api.md | 14 ++++++++------ src/platform/events/services.ts | 16 ++++++++++------ .../events/asset-bundle-converted.spec.ts | 18 ++++++++++-------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/report/schemas.api.md b/report/schemas.api.md index d1dde1a..3b1970b 100644 --- a/report/schemas.api.md +++ b/report/schemas.api.md @@ -134,25 +134,27 @@ export namespace AnyMapping { validate: ValidateFunction; } -// Warning: (ae-missing-release-tag) "AssetBundleConvertedEvent" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// Warning: (ae-missing-release-tag) "AssetBundleConvertedEvent" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "AssetBundleConversionFinishedEvent" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// Warning: (ae-missing-release-tag) "AssetBundleConversionFinishedEvent" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export type AssetBundleConvertedEvent = BaseEvent & { +export type AssetBundleConversionFinishedEvent = BaseEvent & { type: Events.Type.ASSET_BUNDLE; subType: Events.SubType.AssetBundle.CONVERTED; metadata: { entityId: string; platform: 'windows' | 'mac' | 'webglb'; + statusCode: number; + isLods: boolean; }; }; // @public (undocumented) -export namespace AssetBundleConvertedEvent { +export namespace AssetBundleConversionFinishedEvent { const // (undocumented) - schema: JSONSchema; + schema: JSONSchema; const // (undocumented) - validate: ValidateFunction; + validate: ValidateFunction; } // @public diff --git a/src/platform/events/services.ts b/src/platform/events/services.ts index f01e9b6..297c5c7 100644 --- a/src/platform/events/services.ts +++ b/src/platform/events/services.ts @@ -40,17 +40,19 @@ export namespace BadgeGrantedEvent { export const validate: ValidateFunction = generateLazyValidator(schema) } -export type AssetBundleConvertedEvent = BaseEvent & { +export type AssetBundleConversionFinishedEvent = BaseEvent & { type: Events.Type.ASSET_BUNDLE subType: Events.SubType.AssetBundle.CONVERTED metadata: { entityId: string platform: 'windows' | 'mac' | 'webglb' + statusCode: number + isLods: boolean } } -export namespace AssetBundleConvertedEvent { - export const schema: JSONSchema = { +export namespace AssetBundleConversionFinishedEvent { + export const schema: JSONSchema = { type: 'object', properties: { type: { type: 'string', const: Events.Type.ASSET_BUNDLE }, @@ -61,14 +63,16 @@ export namespace AssetBundleConvertedEvent { type: 'object', properties: { entityId: { type: 'string' }, - platform: { type: 'string', enum: ['windows', 'mac', 'webglb'] } + platform: { type: 'string', enum: ['windows', 'mac', 'webglb'] }, + statusCode: { type: 'number' }, + isLods: { type: 'boolean' } }, - required: ['entityId', 'platform'] + required: ['entityId', 'platform', 'statusCode', 'isLods'] } }, required: ['type', 'subType', 'key', 'timestamp', 'metadata'], additionalProperties: true } - export const validate: ValidateFunction = generateLazyValidator(schema) + export const validate: ValidateFunction = generateLazyValidator(schema) } diff --git a/test/platform/events/asset-bundle-converted.spec.ts b/test/platform/events/asset-bundle-converted.spec.ts index 9f2eaf3..719a094 100644 --- a/test/platform/events/asset-bundle-converted.spec.ts +++ b/test/platform/events/asset-bundle-converted.spec.ts @@ -1,21 +1,23 @@ import expect from 'expect' -import { AssetBundleConvertedEvent, Events } from '../../../src' +import { AssetBundleConversionFinishedEvent, Events } from '../../../src' -describe('AssetBundleConverted Events tests', () => { - it('AssetBundleConvertedEvent static tests must pass', () => { - const event: AssetBundleConvertedEvent = { +describe('AssetBundleConversionFinished Events tests', () => { + it('AssetBundleConversionFinishedEvent static tests must pass', () => { + const event: AssetBundleConversionFinishedEvent = { type: Events.Type.ASSET_BUNDLE, subType: Events.SubType.AssetBundle.CONVERTED, key: 'key', timestamp: 1, metadata: { entityId: 'baf', - platform: 'mac' + platform: 'mac', + statusCode: 1, + isLods: false } } - expect(AssetBundleConvertedEvent.validate(event)).toEqual(true) - expect(AssetBundleConvertedEvent.validate(null)).toEqual(false) - expect(AssetBundleConvertedEvent.validate({})).toEqual(false) + expect(AssetBundleConversionFinishedEvent.validate(event)).toEqual(true) + expect(AssetBundleConversionFinishedEvent.validate(null)).toEqual(false) + expect(AssetBundleConversionFinishedEvent.validate({})).toEqual(false) }) })