quasvel
Version:
Access and interact with Aragon Organizations and their apps.
61 lines (50 loc) • 1.44 kB
text/typescript
import { resolveMetadata, resolveManifest } from '../utils/metadata'
import {
AragonArtifact,
AragonArtifactRole,
AragonManifest,
Metadata,
RepoData,
} from '../types'
import Organization from './Organization'
export default class Repo {
readonly address: string
readonly contentUri?: string
readonly lastVersion?: string
readonly name: string
readonly registry?: string
readonly registryAddress?: string
constructor(data: RepoData, metadata: Metadata, organization: Organization) {
this.
this.
this.address = data.address
this.contentUri = data.contentUri
this.lastVersion = data.lastVersion
this.name = data.name
this.registry = data.registry
this.registryAddress = data.registryAddress
}
static async create(
data: RepoData,
organization: Organization
): Promise<Repo> {
const artifact = await resolveMetadata(
'artifact.json',
data.contentUri,
data.artifact
)
const manifest = await resolveManifest(data)
const metadata: Metadata = [artifact, manifest]
return new Repo(data, metadata, organization)
}
get artifact(): AragonArtifact {
return this.
}
get manifest(): AragonManifest {
return this.
}
get roles(): AragonArtifactRole[] {
return this.artifact.roles
}
}