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-08 14:26:07 +03:00
|
|
|
variant downloads {
|
|
|
|
download(download-request),
|
|
|
|
chunk(chunk-request),
|
|
|
|
progress(progress-update),
|
|
|
|
size(size-update),
|
|
|
|
}
|
|
|
|
|
2024-08-06 21:06:43 +03:00
|
|
|
record download-request {
|
|
|
|
package-id: package-id,
|
2024-08-08 14:26:07 +03:00
|
|
|
download-from: option<string>, // note, might be too much implicit complexity,
|
|
|
|
// but: download-from received locally, is an instruction where to download-from
|
|
|
|
// and if received from remote, is an instruction where to send, where the "download-from" came from.
|
|
|
|
desired-version-hash: string,
|
2024-05-27 02:40:41 +03:00
|
|
|
}
|
|
|
|
|
2024-08-08 14:26:07 +03:00
|
|
|
record download-response {
|
|
|
|
success: bool,
|
|
|
|
error: option<string>,
|
|
|
|
}
|
|
|
|
|
|
|
|
record chunk-request {
|
|
|
|
package-id: package-id,
|
|
|
|
version-hash: string,
|
|
|
|
offset: u64,
|
|
|
|
length: u64,
|
|
|
|
}
|
|
|
|
|
|
|
|
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-08 18:52:53 +03:00
|
|
|
variant chains {
|
|
|
|
get-app(package-id),
|
|
|
|
start-auto-update(package-id),
|
|
|
|
stop-auto-update(package-id),
|
|
|
|
}
|
|
|
|
|
2024-08-06 21:06:43 +03:00
|
|
|
record on-chain-app {
|
2024-08-08 18:52:53 +03:00
|
|
|
// include package_id?
|
2024-08-06 21:06:43 +03:00
|
|
|
metadata-uri: string,
|
|
|
|
metadata-hash: string,
|
|
|
|
// this might be a thing internally, but could also just be fetched on demand
|
|
|
|
// would negate them becoming outdated
|
2024-08-08 18:52:53 +03:00
|
|
|
metadata: option<on-chain-metadata>,
|
|
|
|
}
|
|
|
|
|
|
|
|
record on-chain-metadata {
|
|
|
|
name: option<string>,
|
|
|
|
description: option<string>,
|
|
|
|
image: option<string>,
|
|
|
|
external-url: option<string>,
|
|
|
|
animation-url: option<string>,
|
|
|
|
properties: on-chain-properties,
|
2024-08-06 21:06:43 +03:00
|
|
|
}
|
|
|
|
|
2024-08-08 18:52:53 +03:00
|
|
|
record on-chain-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-06 21:06:43 +03:00
|
|
|
record get-app-response {
|
2024-08-08 18:52:53 +03:00
|
|
|
app: option<on-chain-app>,
|
2024-05-27 02:40: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-08 19:48:04 +03:00
|
|
|
use chain.{on-chain-metadata};
|
2024-08-08 14:26:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
variant request {
|
|
|
|
local(local-request),
|
|
|
|
}
|
|
|
|
|
|
|
|
variant response {
|
|
|
|
local(local-response),
|
|
|
|
}
|
|
|
|
|
2024-08-08 19:48:04 +03:00
|
|
|
// variant reason {
|
|
|
|
// no-package,
|
|
|
|
// not-mirroring,
|
|
|
|
// hash-mismatch(hash-mismatch),
|
|
|
|
// file-not-found,
|
|
|
|
// worker-spawn-failed
|
|
|
|
// }
|
2024-08-08 14:26:07 +03:00
|
|
|
|
2024-08-08 19:48:04 +03:00
|
|
|
// record hash-mismatch {
|
|
|
|
// requested: string,
|
|
|
|
// have: string,
|
|
|
|
// }
|
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),
|
|
|
|
install(package-id),
|
2024-05-27 02:40:41 +03:00
|
|
|
uninstall(package-id),
|
|
|
|
apis,
|
|
|
|
get-api(package-id),
|
|
|
|
}
|
|
|
|
|
2024-08-08 14:26:07 +03:00
|
|
|
record new-package-request {
|
|
|
|
package-id: package-id,
|
2024-08-08 19:48:04 +03:00
|
|
|
metadata: on-chain-metadata,
|
2024-08-08 14:26:07 +03:00
|
|
|
mirror: bool,
|
|
|
|
}
|
2024-05-27 02:40:41 +03:00
|
|
|
|
|
|
|
variant local-response {
|
2024-08-08 14:26:07 +03:00
|
|
|
new-package-response(new-package-response),
|
2024-05-27 02:40:41 +03:00
|
|
|
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
|
|
|
enum new-package-response {
|
|
|
|
success,
|
|
|
|
no-blob,
|
|
|
|
install-failed,
|
|
|
|
already-exists,
|
|
|
|
}
|
|
|
|
|
2024-05-27 02:40:41 +03:00
|
|
|
enum install-response {
|
|
|
|
success,
|
|
|
|
failure, // TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
enum uninstall-response {
|
|
|
|
success,
|
|
|
|
failure, // TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
record apis-response {
|
|
|
|
apis: list<package-id>,
|
|
|
|
}
|
|
|
|
|
|
|
|
// the API itself will be in response blob if success!
|
|
|
|
enum get-api-response {
|
|
|
|
success,
|
|
|
|
failure, // TODO
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|