interface downloads { // // download API as presented by download:app_store:sys-v0 // use standard.{package-id}; variant download-requests { // remote only remote-download(remote-download-request), chunk(chunk-request), progress(progress-update), size(size-update), // local only local-download(local-download-request), get-files(option), add-download(add-download-request), } variant download-responses { success, error(download-error), get-files(list), } record local-download-request { package-id: package-id, download-from: string, desired-version-hash: string, } record remote-download-request { package-id: package-id, worker-address: string, desired-version-hash: string, } variant download-error { no-package, not-mirroring, hash-mismatch(hash-mismatch), file-not-found, worker-spawn-failed, } record hash-mismatch { desired: string, actual: string, } record chunk-request { package-id: package-id, version-hash: string, offset: u64, length: u64, } record entry { name: string, is-file: bool, size: option, manifest: option, } // part of new-package-request local-only flow. record add-download-request { package-id: package-id, version-hash: string, mirror: bool, } record progress-update { package-id: package-id, version-hash: string, downloaded: u64, total: u64, } record size-update { package-id: package-id, size: u64, } } interface chain { // // on-chain API as presented by chain:app_store:sys-v0 // use standard.{package-id}; variant chain-requests { get-app(package-id), get-apps, get-our-apps, start-auto-update(package-id), stop-auto-update(package-id), } variant chain-responses { get-app(option), get-apps(list), get-our-apps(list), auto-update-started, auto-update-stopped, error(chain-error), } variant chain-error { no-package, } record onchain-app { package-id: package-id, tba: string, metadata-uri: string, metadata-hash: string, metadata: option, auto-update: bool, } record onchain-metadata { name: option, description: option, image: option, external-url: option, animation-url: option, properties: onchain-properties, } record onchain-properties { package-name: string, publisher: string, current-version: string, mirrors: list, code-hashes: list>, license: option, screenshots: option>, wit-version: option, dependencies: option>, } } interface main { // // app store API as presented by main:app_store:sys-v0 // use standard.{package-id}; use chain.{onchain-metadata, chain-error}; use downloads.{download-error}; variant request { local(local-request), } variant response { local(local-response), chain-error(chain-error), download-error(download-error), } variant local-request { new-package(new-package-request), install(install-package-request), uninstall(package-id), apis, get-api(package-id), } variant local-response { new-package-response(new-package-response), install-response(install-response), uninstall-response(uninstall-response), apis-response(apis-response), get-api-response(get-api-response), } record new-package-request { package-id: package-id, mirror: bool, } record install-package-request { package-id: package-id, metadata: option, // if None == local sideload package. version-hash: string, } enum new-package-response { success, no-blob, install-failed, already-exists, } enum install-response { success, failure, } enum uninstall-response { success, failure, } record apis-response { apis: list, } // the API itself will be in response blob if success! enum get-api-response { success, failure, } } world app-store-sys-v0 { import main; import downloads; import chain; include process-v0; }