Skip to content

Commit

Permalink
Merge branch 'main' into feat/outline-compatible-wearable-data
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo authored Jan 8, 2025
2 parents 0721835 + 7162c8a commit 4862583
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 3 deletions.
44 changes: 42 additions & 2 deletions report/schemas.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,29 @@ export namespace AnyMapping {
validate: ValidateFunction<Mapping>;
}

// 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 AssetBundleConversionFinishedEvent = BaseEvent & {
type: Events.Type.ASSET_BUNDLE;
subType: Events.SubType.AssetBundle.CONVERTED;
metadata: {
entityId: string;
platform: 'windows' | 'mac' | 'webgl';
statusCode: number;
isLods: boolean;
};
};

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

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

Expand Down Expand Up @@ -285,7 +308,7 @@ export type BaseBid = {
// @public (undocumented)
export type BaseEvent = {
type: Events.Type;
subType: Events.SubType.Blockchain | Events.SubType.CatalystDeployment | Events.SubType.Client | Events.SubType.Marketplace | Events.SubType.Rewards | Events.SubType.Badge;
subType: Events.SubType.Blockchain | Events.SubType.CatalystDeployment | Events.SubType.Client | Events.SubType.Marketplace | Events.SubType.Rewards | Events.SubType.Badge | Events.SubType.AssetBundle;
key: string;
timestamp: number;
};
Expand Down Expand Up @@ -1054,6 +1077,11 @@ export type Event = BadgeGrantedEvent | BidAcceptedEvent | BidReceivedEvent | Ca
export namespace Events {
// (undocumented)
export namespace SubType {
// (undocumented)
export enum AssetBundle {
// (undocumented)
CONVERTED = "converted"
}
// (undocumented)
export enum Badge {
// (undocumented)
Expand Down Expand Up @@ -1124,9 +1152,16 @@ export namespace Events {
// (undocumented)
REWARD_IN_PROGRESS = "reward-in-progress"
}
// (undocumented)
export enum Worlds {
// (undocumented)
DEPLOYMENT = "deployment"
}
}
// (undocumented)
export enum Type {
// (undocumented)
ASSET_BUNDLE = "asset-bundle",
// (undocumented)
BADGE = "badge",
// (undocumented)
Expand All @@ -1138,7 +1173,9 @@ export namespace Events {
// (undocumented)
MARKETPLACE = "marketplace",
// (undocumented)
REWARDS = "rewards"
REWARDS = "rewards",
// (undocumented)
WORLD = "world"
}
}

Expand Down Expand Up @@ -1524,6 +1561,7 @@ export type LinkerAuthorization = {
name: string;
[key: string]: string;
};
onlyDev?: boolean;
addresses: string[];
plots: string[];
};
Expand Down Expand Up @@ -2549,6 +2587,8 @@ export enum ProviderType {
// (undocumented)
MAGIC = "magic",
// (undocumented)
MAGIC_TEST = "magic_test",
// (undocumented)
METAMASK_MOBILE = "metamask_mobile",
// (undocumented)
NETWORK = "network",
Expand Down
1 change: 1 addition & 0 deletions src/dapps/provider-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { generateLazyValidator, JSONSchema, ValidateFunction } from '../validati
export enum ProviderType {
INJECTED = 'injected',
MAGIC = 'magic',
MAGIC_TEST = 'magic_test',
FORTMATIC = 'formatic',
NETWORK = 'network',
WALLET_CONNECT = 'wallet_connect',
Expand Down
5 changes: 5 additions & 0 deletions src/misc/deployments-to-sqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type DeploymentToSqs = {
lods?: string[]
contentServerUrls?: string[]
force?: boolean
animation?: string
}

/**
Expand Down Expand Up @@ -44,6 +45,10 @@ export namespace DeploymentToSqs {
force: {
type: 'boolean',
nullable: true
},
animation: {
type: 'string',
nullable: true
}
},
additionalProperties: true
Expand Down
2 changes: 2 additions & 0 deletions src/misc/linker-authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type LinkerAuthorization = {
name: string
[key: string]: string
}
onlyDev?: boolean
addresses: string[]
plots: string[]
}
Expand All @@ -33,6 +34,7 @@ export namespace LinkerAuthorization {
},
required: ['name']
},
onlyDev: { type: 'boolean', nullable: true },
addresses: {
type: 'array',
items: { type: 'string' },
Expand Down
13 changes: 12 additions & 1 deletion src/platform/events/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ export namespace Events {
export enum Type {
BLOCKCHAIN = 'blockchain',
CATALYST_DEPLOYMENT = 'catalyst-deployment',
WORLD = 'world',
CLIENT = 'client',
MARKETPLACE = 'marketplace',
REWARDS = 'rewards',
BADGE = 'badge'
BADGE = 'badge',
ASSET_BUNDLE = 'asset-bundle'
}

export namespace SubType {
Expand All @@ -60,6 +62,10 @@ export namespace Events {
OUTFITS = 'outfits'
}

export enum Worlds {
DEPLOYMENT = 'deployment'
}

export enum Client {
MOVE_TO_PARCEL = 'move-to-parcel',
USED_EMOTE = 'used-emote',
Expand All @@ -80,6 +86,10 @@ export namespace Events {
export enum Badge {
GRANTED = 'badge-granted'
}

export enum AssetBundle {
CONVERTED = 'converted'
}
}
}

Expand All @@ -92,6 +102,7 @@ export type BaseEvent = {
| Events.SubType.Marketplace
| Events.SubType.Rewards
| Events.SubType.Badge
| Events.SubType.AssetBundle
key: string
timestamp: number
}
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 @@ -39,3 +39,40 @@ export namespace BadgeGrantedEvent {

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

export type AssetBundleConversionFinishedEvent = BaseEvent & {
type: Events.Type.ASSET_BUNDLE
subType: Events.SubType.AssetBundle.CONVERTED
metadata: {
entityId: string
platform: 'windows' | 'mac' | 'webgl'
statusCode: number
isLods: boolean
}
}

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

export const validate: ValidateFunction<AssetBundleConversionFinishedEvent> = generateLazyValidator(schema)
}
17 changes: 17 additions & 0 deletions test/misc/linker-authorization.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,21 @@ describe('when validation authorizations', () => {
).toBe(true)
})
})

describe('and the authorization has the onlyDev property set as a boolean', () => {
it('should return true', () => {
expect(
LinkerAuthorization.validate({
name: 'aName',
desc: 'aDesc',
contactInfo: {
name: 'aContactInfoName'
},
addresses: ['0x4730182099bc4e60075C657cCeCEc8879826bb43'],
plots: ['-73,50'],
onlyDev: true
})
).toBe(true)
})
})
})
23 changes: 23 additions & 0 deletions test/platform/events/asset-bundle-converted.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import expect from 'expect'
import { AssetBundleConversionFinishedEvent, 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)
})
})
43 changes: 43 additions & 0 deletions test/platform/events/badges.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import expect from 'expect'
import { BadgeGrantedEvent, Events } from '../../../src'

describe('Badge Events tests', () => {
it('BadgeGrantedEvent static tests must pass', () => {
const event: BadgeGrantedEvent = {
type: Events.Type.BADGE,
subType: Events.SubType.Badge.GRANTED,
key: 'key',
timestamp: 1,
metadata: {
address: '0x',
badgeId: 'a-badge-id',
badgeImageUrl: 'https://an-url.tld',
badgeName: 'Badge Name'
}
}

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

it('BadgeGrantedEvent with tier badge id static tests must pass', () => {
const event: BadgeGrantedEvent = {
type: Events.Type.BADGE,
subType: Events.SubType.Badge.GRANTED,
key: 'key',
timestamp: 1,
metadata: {
address: '0x',
badgeId: 'a-badge-id',
badgeImageUrl: 'https://an-url.tld',
badgeName: 'Badge Name',
badgeTierName: 'tier-name'
}
}

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

0 comments on commit 4862583

Please sign in to comment.