Skip to content

Commit

Permalink
feat: add AssetBundleConversionManuallyQueuedEvent (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleortega authored Jan 14, 2025
1 parent 0969e6b commit b064830
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 25 deletions.
27 changes: 26 additions & 1 deletion report/schemas.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,29 @@ export namespace AssetBundleConversionFinishedEvent {
validate: ValidateFunction<AssetBundleConversionFinishedEvent>;
}

// Warning: (ae-missing-release-tag) "AssetBundleConversionManuallyQueuedEvent" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "AssetBundleConversionManuallyQueuedEvent" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type AssetBundleConversionManuallyQueuedEvent = BaseEvent & {
type: Events.Type.ASSET_BUNDLE;
subType: Events.SubType.AssetBundle.MANUALLY_QUEUED;
metadata: {
entityId: string;
platform: 'windows' | 'mac' | 'webgl';
isLods: boolean;
isPriority: boolean;
};
};

// @public (undocumented)
export namespace AssetBundleConversionManuallyQueuedEvent {
const // (undocumented)
schema: JSONSchema<AssetBundleConversionManuallyQueuedEvent>;
const // (undocumented)
validate: ValidateFunction<AssetBundleConversionManuallyQueuedEvent>;
}

// @public
export type AuthChain = AuthLink[];

Expand Down Expand Up @@ -1080,7 +1103,9 @@ export namespace Events {
// (undocumented)
export enum AssetBundle {
// (undocumented)
CONVERTED = "converted"
CONVERTED = "converted",
// (undocumented)
MANUALLY_QUEUED = "manually-queued"
}
// (undocumented)
export enum Badge {
Expand Down
3 changes: 2 additions & 1 deletion src/platform/events/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ export namespace Events {
}

export enum AssetBundle {
CONVERTED = 'converted'
CONVERTED = 'converted',
MANUALLY_QUEUED = 'manually-queued'
}
}
}
Expand Down
37 changes: 37 additions & 0 deletions src/platform/events/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,40 @@ export namespace AssetBundleConversionFinishedEvent {

export const validate: ValidateFunction<AssetBundleConversionFinishedEvent> = generateLazyValidator(schema)
}

export type AssetBundleConversionManuallyQueuedEvent = BaseEvent & {
type: Events.Type.ASSET_BUNDLE
subType: Events.SubType.AssetBundle.MANUALLY_QUEUED
metadata: {
entityId: string
platform: 'windows' | 'mac' | 'webgl'
isLods: boolean
isPriority: boolean
}
}

export namespace AssetBundleConversionManuallyQueuedEvent {
export const schema: JSONSchema<AssetBundleConversionManuallyQueuedEvent> = {
type: 'object',
properties: {
type: { type: 'string', const: Events.Type.ASSET_BUNDLE },
subType: { type: 'string', const: Events.SubType.AssetBundle.MANUALLY_QUEUED },
key: { type: 'string' },
timestamp: { type: 'number', minimum: 0 },
metadata: {
type: 'object',
properties: {
entityId: { type: 'string' },
platform: { type: 'string', enum: ['windows', 'mac', 'webgl'] },
isLods: { type: 'boolean' },
isPriority: { type: 'boolean' }
},
required: ['entityId', 'platform', 'isLods']
}
},
required: ['type', 'subType', 'key', 'timestamp', 'metadata'],
additionalProperties: true
}

export const validate: ValidateFunction<AssetBundleConversionManuallyQueuedEvent> = generateLazyValidator(schema)
}
23 changes: 0 additions & 23 deletions test/platform/events/asset-bundle-converted.spec.ts

This file was deleted.

44 changes: 44 additions & 0 deletions test/platform/events/asset-bundle.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import expect from 'expect'
import { AssetBundleConversionFinishedEvent, AssetBundleConversionManuallyQueuedEvent, Events } from '../../../src'

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',
statusCode: 1,
isLods: false
}
}

expect(AssetBundleConversionFinishedEvent.validate(event)).toEqual(true)
expect(AssetBundleConversionFinishedEvent.validate(null)).toEqual(false)
expect(AssetBundleConversionFinishedEvent.validate({})).toEqual(false)
})
})

describe('AssetBundleConversionManuallyQueued Events tests', () => {
it('AssetBundleConversionManuallyQueuedEvent static tests must pass', () => {
const event: AssetBundleConversionManuallyQueuedEvent = {
type: Events.Type.ASSET_BUNDLE,
subType: Events.SubType.AssetBundle.MANUALLY_QUEUED,
key: 'key',
timestamp: 1,
metadata: {
entityId: 'baf',
platform: 'mac',
isLods: false,
isPriority: false
}
}

expect(AssetBundleConversionManuallyQueuedEvent.validate(event)).toEqual(true)
expect(AssetBundleConversionManuallyQueuedEvent.validate(null)).toEqual(false)
expect(AssetBundleConversionManuallyQueuedEvent.validate({})).toEqual(false)
})
})

0 comments on commit b064830

Please sign in to comment.