2024-08-08 14:26:07 +03:00
|
|
|
interface downloads {
|
2024-05-27 02:40:41 +03:00
|
|
|
//
|
2024-08-06 21:06:43 +03:00
|
|
|
// download API as presented by download:app_store:sys-v0
|
2024-05-27 02:40:41 +03:00
|
|
|
//
|
|
|
|
|
2024-05-29 00:51:55 +03:00
|
|
|
use standard.{package-id};
|
2024-05-27 02:40:41 +03:00
|
|
|
|
2024-08-15 14:14:09 +03:00
|
|
|
variant download-requests {
|
|
|
|
// remote only
|
|
|
|
remote-download(remote-download-request),
|
2024-08-08 14:26:07 +03:00
|
|
|
chunk(chunk-request),
|
|
|
|
progress(progress-update),
|
|
|
|
size(size-update),
|
2024-08-14 12:05:12 +03:00
|
|
|
// local only
|
2024-08-15 14:14:09 +03:00
|
|
|
local-download(local-download-request),
|
2024-08-09 19:23:36 +03:00
|
|
|
get-files(option<package-id>),
|
2024-08-13 03:32:52 +03:00
|
|
|
add-download(add-download-request),
|
2024-08-08 14:26:07 +03:00
|
|
|
}
|
|
|
|
|
2024-08-15 14:14:09 +03:00
|
|
|
variant download-responses {
|
|
|
|
success,
|
|
|
|
error(download-error),
|
|
|
|
get-files(list<entry>),
|
|
|
|
}
|
|
|
|
|
|
|
|
record local-download-request {
|
2024-08-06 21:06:43 +03:00
|
|
|
package-id: package-id,
|
2024-08-15 14:14:09 +03:00
|
|
|
download-from: string,
|
2024-08-08 14:26:07 +03:00
|
|
|
desired-version-hash: string,
|
2024-05-27 02:40:41 +03:00
|
|
|
}
|
|
|
|
|
2024-08-15 14:14:09 +03:00
|
|
|
record remote-download-request {
|
|
|
|
package-id: package-id,
|
|
|
|
worker-address: string,
|
|
|
|
desired-version-hash: string,
|
|
|
|
}
|
|
|
|
|
|
|
|
record download-error {
|
|
|
|
kind: download-error-types,
|
|
|
|
reason: option<string>,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum download-error-types {
|
|
|
|
no-package,
|
|
|
|
not-mirroring,
|
|
|
|
hash-mismatch,
|
|
|
|
file-not-found,
|
|
|
|
worker-spawn-failed,
|
2024-08-08 14:26:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
record chunk-request {
|
|
|
|
package-id: package-id,
|
|
|
|
version-hash: string,
|
|
|
|
offset: u64,
|
|
|
|
length: u64,
|
|
|
|
}
|
|
|
|
|
2024-08-09 19:23:36 +03:00
|
|
|
record entry {
|
|
|
|
name: string,
|
|
|
|
is-file: bool,
|
2024-08-15 14:14:09 +03:00
|
|
|
size: option<u64>,
|
|
|
|
manifest: option<string>,
|
2024-08-09 19:23:36 +03:00
|
|
|
}
|
|
|
|
|
2024-08-13 03:32:52 +03:00
|
|
|
// part of new-package-request local-only flow.
|
|
|
|
record add-download-request {
|
|
|
|
package-id: package-id,
|
|
|
|
version-hash: string,
|
|
|
|
mirror: bool,
|
|
|
|
}
|
|
|
|
|
2024-08-08 14:26:07 +03:00
|
|
|
record progress-update {
|
|
|
|
package-id: package-id,
|
|
|
|
version-hash: string,
|
|
|
|
downloaded: u64,
|
|
|
|
total: u64,
|
|
|
|
}
|
|
|
|
|
|
|
|
record size-update {
|
|
|
|
package-id: package-id,
|
|
|
|
size: u64,
|
2024-08-06 21:06:43 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
interface chain {
|
|
|
|
//
|
|
|
|
// on-chain API as presented by chain:app_store:sys-v0
|
|
|
|
//
|
|
|
|
|
|
|
|
use standard.{package-id};
|
|
|
|
|
2024-08-15 14:14:09 +03:00
|
|
|
variant chain-requests {
|
2024-08-08 18:52:53 +03:00
|
|
|
get-app(package-id),
|
2024-08-13 17:27:41 +03:00
|
|
|
get-apps,
|
|
|
|
get-our-apps,
|
2024-08-08 18:52:53 +03:00
|
|
|
start-auto-update(package-id),
|
|
|
|
stop-auto-update(package-id),
|
|
|
|
}
|
2024-08-15 14:14:09 +03:00
|
|
|
|
|
|
|
variant chain-responses {
|
|
|
|
get-app(get-app-response),
|
|
|
|
get-apps(get-apps-response),
|
|
|
|
get-our-apps(get-our-apps-response),
|
|
|
|
auto-update-started,
|
|
|
|
auto-update-stopped,
|
|
|
|
error(chain-error),
|
|
|
|
}
|
|
|
|
|
|
|
|
record chain-error {
|
|
|
|
kind: chain-error-types,
|
|
|
|
reason: option<string>,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum chain-error-types {
|
|
|
|
no-package,
|
|
|
|
}
|
2024-08-08 18:52:53 +03:00
|
|
|
|
2024-08-15 14:14:09 +03:00
|
|
|
record onchain-app {
|
2024-08-13 17:27:41 +03:00
|
|
|
package-id: package-id,
|
|
|
|
tba: string,
|
2024-08-06 21:06:43 +03:00
|
|
|
metadata-uri: string,
|
|
|
|
metadata-hash: string,
|
2024-08-15 14:14:09 +03:00
|
|
|
metadata: option<onchain-metadata>,
|
2024-08-13 17:27:41 +03:00
|
|
|
auto-update: bool,
|
2024-08-08 18:52:53 +03:00
|
|
|
}
|
|
|
|
|
2024-08-15 14:14:09 +03:00
|
|
|
record onchain-metadata {
|
2024-08-08 18:52:53 +03:00
|
|
|
name: option<string>,
|
|
|
|
description: option<string>,
|
|
|
|
image: option<string>,
|
|
|
|
external-url: option<string>,
|
|
|
|
animation-url: option<string>,
|
2024-08-15 14:14:09 +03:00
|
|
|
properties: onchain-properties,
|
2024-08-06 21:06:43 +03:00
|
|
|
}
|
|
|
|
|
2024-08-15 14:14:09 +03:00
|
|
|
record onchain-properties {
|
2024-05-27 02:40:41 +03:00
|
|
|
package-name: string,
|
|
|
|
publisher: string,
|
|
|
|
current-version: string,
|
|
|
|
mirrors: list<string>,
|
|
|
|
code-hashes: list<tuple<string, string>>,
|
|
|
|
license: option<string>,
|
|
|
|
screenshots: option<list<string>>,
|
|
|
|
wit-version: option<u32>,
|
|
|
|
dependencies: option<list<string>>,
|
|
|
|
}
|
|
|
|
|
2024-08-13 17:27:41 +03:00
|
|
|
record get-apps-response {
|
2024-08-15 14:14:09 +03:00
|
|
|
apps: list<onchain-app>,
|
2024-08-13 17:27:41 +03:00
|
|
|
}
|
|
|
|
|
2024-08-06 21:06:43 +03:00
|
|
|
record get-app-response {
|
2024-08-15 14:14:09 +03:00
|
|
|
app: option<onchain-app>,
|
2024-05-27 02:40:41 +03:00
|
|
|
}
|
2024-08-13 17:27:41 +03:00
|
|
|
|
|
|
|
record get-our-apps-response {
|
2024-08-15 14:14:09 +03:00
|
|
|
apps: list<onchain-app>,
|
2024-08-13 17:27:41 +03:00
|
|
|
}
|
2024-08-06 21:06:43 +03:00
|
|
|
}
|
2024-05-31 04:27:19 +03:00
|
|
|
|
2024-08-06 21:06:43 +03:00
|
|
|
interface main {
|
|
|
|
//
|
2024-08-08 14:26:07 +03:00
|
|
|
// app store API as presented by main:app_store:sys-v0
|
2024-08-06 21:06:43 +03:00
|
|
|
//
|
2024-05-27 02:40:41 +03:00
|
|
|
|
2024-08-08 14:26:07 +03:00
|
|
|
use standard.{package-id};
|
2024-08-15 14:14:09 +03:00
|
|
|
use chain.{onchain-metadata, chain-error};
|
|
|
|
use downloads.{download-error};
|
2024-08-13 03:32:52 +03:00
|
|
|
|
2024-08-08 14:26:07 +03:00
|
|
|
variant request {
|
|
|
|
local(local-request),
|
|
|
|
}
|
|
|
|
|
|
|
|
variant response {
|
|
|
|
local(local-response),
|
2024-08-15 14:14:09 +03:00
|
|
|
error(error-types),
|
2024-08-08 14:26:07 +03:00
|
|
|
}
|
|
|
|
|
2024-08-15 14:14:09 +03:00
|
|
|
variant error-types {
|
|
|
|
chain(chain-error),
|
|
|
|
download(download-error),
|
|
|
|
}
|
2024-08-08 14:26:07 +03:00
|
|
|
|
2024-05-27 02:40:41 +03:00
|
|
|
variant local-request {
|
2024-08-08 14:26:07 +03:00
|
|
|
new-package(new-package-request),
|
2024-08-13 03:32:52 +03:00
|
|
|
install(install-package-request),
|
2024-05-27 02:40:41 +03:00
|
|
|
uninstall(package-id),
|
|
|
|
apis,
|
|
|
|
get-api(package-id),
|
|
|
|
}
|
|
|
|
|
2024-08-15 14:14:09 +03:00
|
|
|
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),
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-08-08 14:26:07 +03:00
|
|
|
record new-package-request {
|
|
|
|
package-id: package-id,
|
|
|
|
mirror: bool,
|
|
|
|
}
|
2024-08-13 03:32:52 +03:00
|
|
|
|
|
|
|
record install-package-request {
|
|
|
|
package-id: package-id,
|
2024-08-15 14:14:09 +03:00
|
|
|
metadata: option<onchain-metadata>, // if None == local sideload package.
|
2024-08-13 03:32:52 +03:00
|
|
|
version-hash: string,
|
|
|
|
}
|
2024-05-27 02:40:41 +03:00
|
|
|
|
2024-08-08 14:26:07 +03:00
|
|
|
enum new-package-response {
|
|
|
|
success,
|
|
|
|
no-blob,
|
|
|
|
install-failed,
|
|
|
|
already-exists,
|
|
|
|
}
|
|
|
|
|
2024-05-27 02:40:41 +03:00
|
|
|
enum install-response {
|
|
|
|
success,
|
2024-08-15 14:14:09 +03:00
|
|
|
failure,
|
2024-05-27 02:40:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
enum uninstall-response {
|
|
|
|
success,
|
2024-08-15 14:14:09 +03:00
|
|
|
failure,
|
2024-05-27 02:40:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
record apis-response {
|
|
|
|
apis: list<package-id>,
|
|
|
|
}
|
|
|
|
|
|
|
|
// the API itself will be in response blob if success!
|
|
|
|
enum get-api-response {
|
|
|
|
success,
|
2024-08-15 14:14:09 +03:00
|
|
|
failure,
|
2024-05-27 02:40:41 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
world app-store-sys-v0 {
|
|
|
|
import main;
|
2024-08-08 14:26:07 +03:00
|
|
|
import downloads;
|
2024-08-06 21:06:43 +03:00
|
|
|
import chain;
|
2024-05-27 02:40:41 +03:00
|
|
|
include process-v0;
|
|
|
|
}
|