aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/installation/interfaces.ts
blob: 50b635921860a1ced73fee3824e18476f2db65af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import * as vscode from "vscode";

export interface GithubRepo {
    name: string;
    owner: string;
}

/**
 * Metadata about particular artifact retrieved from GitHub releases.
 */
export interface ArtifactReleaseInfo {
    releaseName: string;
    downloadUrl: string;
}

/**
 * Represents the source of a an artifact which is either specified by the user
 * explicitly, or bundled by this extension from GitHub releases.
 */
export type ArtifactSource = ArtifactSource.ExplicitPath | ArtifactSource.GithubRelease;

export namespace ArtifactSource {
    /**
     * Type tag for `ArtifactSource` discriminated union.
     */
    export const enum Type { ExplicitPath, GithubRelease }

    export interface ExplicitPath {
        type: Type.ExplicitPath;

        /**
         * Filesystem path to the binary specified by the user explicitly.
         */
        path: string;
    }

    export interface GithubRelease {
        type: Type.GithubRelease;

        /**
         * Repository where the binary is stored.
         */
        repo: GithubRepo;

        /**
         * Directory on the filesystem where the bundled binary is stored.
         */
        dir: string;

        /**
         * Name of the binary file. It is stored under the same name on GitHub releases
         * and in local `.dir`.
         */
        file: string;

        /**
         * Tag of github release that denotes a version required by this extension.
         */
        tag: string;

        /**
         * Object that provides `get()/update()` operations to store metadata
         * about the actual binary, e.g. its actual version.
         */
        storage: vscode.Memento;

        /**
         * Ask for the user permission before downloading the artifact.
         */
        askBeforeDownload: boolean;
    }

}