track-cli 3.0.0-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +3 -0
- package/esm/_dnt.polyfills.d.ts +6 -0
- package/esm/_dnt.polyfills.js +1 -0
- package/esm/_dnt.shims.d.ts +19 -0
- package/esm/_dnt.shims.js +78 -0
- package/esm/deps/deno.land/std@0.170.0/fmt/colors.d.ts +270 -0
- package/esm/deps/deno.land/std@0.170.0/fmt/colors.js +473 -0
- package/esm/deps/deno.land/std@0.195.0/_util/os.d.ts +4 -0
- package/esm/deps/deno.land/std@0.195.0/_util/os.js +18 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert.d.ts +2 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assert.js +8 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assertion_error.d.ts +4 -0
- package/esm/deps/deno.land/std@0.195.0/assert/assertion_error.js +12 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/_common.d.ts +50 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/_common.js +545 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/constants.d.ts +55 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/constants.js +57 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/day_of_year.d.ts +26 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/day_of_year.js +45 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/difference.d.ts +38 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/difference.js +93 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/format.d.ts +22 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/format.js +28 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/is_leap.d.ts +49 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/is_leap.js +60 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/mod.d.ts +43 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/mod.js +45 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/parse.d.ts +21 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/parse.js +29 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/to_imf.d.ts +17 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/to_imf.js +44 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/week_of_year.d.ts +13 -0
- package/esm/deps/deno.land/std@0.195.0/datetime/week_of_year.js +38 -0
- package/esm/deps/deno.land/std@0.195.0/fmt/colors.d.ts +270 -0
- package/esm/deps/deno.land/std@0.195.0/fmt/colors.js +474 -0
- package/esm/deps/deno.land/std@0.195.0/fmt/duration.d.ts +15 -0
- package/esm/deps/deno.land/std@0.195.0/fmt/duration.js +96 -0
- package/esm/deps/deno.land/std@0.195.0/fs/_util.d.ts +35 -0
- package/esm/deps/deno.land/std@0.195.0/fs/_util.js +80 -0
- package/esm/deps/deno.land/std@0.195.0/fs/copy.d.ts +51 -0
- package/esm/deps/deno.land/std@0.195.0/fs/copy.js +244 -0
- package/esm/deps/deno.land/std@0.195.0/fs/empty_dir.d.ts +31 -0
- package/esm/deps/deno.land/std@0.195.0/fs/empty_dir.js +74 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_dir.d.ts +27 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_dir.js +55 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_file.d.ts +33 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_file.js +75 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_link.d.ts +31 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_link.js +43 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_symlink.d.ts +17 -0
- package/esm/deps/deno.land/std@0.195.0/fs/ensure_symlink.js +68 -0
- package/esm/deps/deno.land/std@0.195.0/fs/eol.d.ts +40 -0
- package/esm/deps/deno.land/std@0.195.0/fs/eol.js +53 -0
- package/esm/deps/deno.land/std@0.195.0/fs/exists.d.ts +102 -0
- package/esm/deps/deno.land/std@0.195.0/fs/exists.js +163 -0
- package/esm/deps/deno.land/std@0.195.0/fs/expand_glob.d.ts +37 -0
- package/esm/deps/deno.land/std@0.195.0/fs/expand_glob.js +216 -0
- package/esm/deps/deno.land/std@0.195.0/fs/mod.d.ts +16 -0
- package/esm/deps/deno.land/std@0.195.0/fs/mod.js +17 -0
- package/esm/deps/deno.land/std@0.195.0/fs/move.d.ts +29 -0
- package/esm/deps/deno.land/std@0.195.0/fs/move.js +88 -0
- package/esm/deps/deno.land/std@0.195.0/fs/walk.d.ts +40 -0
- package/esm/deps/deno.land/std@0.195.0/fs/walk.js +158 -0
- package/esm/deps/deno.land/std@0.195.0/path/_constants.d.ts +39 -0
- package/esm/deps/deno.land/std@0.195.0/path/_constants.js +46 -0
- package/esm/deps/deno.land/std@0.195.0/path/_interface.d.ts +26 -0
- package/esm/deps/deno.land/std@0.195.0/path/_interface.js +3 -0
- package/esm/deps/deno.land/std@0.195.0/path/_util.d.ts +11 -0
- package/esm/deps/deno.land/std@0.195.0/path/_util.js +161 -0
- package/esm/deps/deno.land/std@0.195.0/path/common.d.ts +13 -0
- package/esm/deps/deno.land/std@0.195.0/path/common.js +36 -0
- package/esm/deps/deno.land/std@0.195.0/path/glob.d.ts +83 -0
- package/esm/deps/deno.land/std@0.195.0/path/glob.js +361 -0
- package/esm/deps/deno.land/std@0.195.0/path/mod.d.ts +9 -0
- package/esm/deps/deno.land/std@0.195.0/path/mod.js +33 -0
- package/esm/deps/deno.land/std@0.195.0/path/posix.d.ts +86 -0
- package/esm/deps/deno.land/std@0.195.0/path/posix.js +442 -0
- package/esm/deps/deno.land/std@0.195.0/path/separator.d.ts +2 -0
- package/esm/deps/deno.land/std@0.195.0/path/separator.js +5 -0
- package/esm/deps/deno.land/std@0.195.0/path/win32.d.ts +91 -0
- package/esm/deps/deno.land/std@0.195.0/path/win32.js +909 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/_utils/distance.d.ts +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/_utils/distance.js +26 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_errors.d.ts +76 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_errors.js +154 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_utils.d.ts +32 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/_utils.js +105 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/command.d.ts +831 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/command.js +1701 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_bash_completions_generator.d.ts +17 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_bash_completions_generator.js +201 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_fish_completions_generator.d.ts +14 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_fish_completions_generator.js +141 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_zsh_completions_generator.d.ts +21 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/_zsh_completions_generator.js +285 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/bash.d.ts +6 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/bash.js +38 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/complete.d.ts +8 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/complete.js +32 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/fish.d.ts +6 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/fish.js +38 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/mod.d.ts +6 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/mod.js +46 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/zsh.d.ts +6 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/completions/zsh.js +38 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deprecated.d.ts +45 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deprecated.js +2 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deps.d.ts +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/deps.js +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/_help_generator.d.ts +27 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/_help_generator.js +323 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/mod.d.ts +6 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/help/mod.js +34 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/mod.d.ts +18 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/mod.js +17 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/type.d.ts +41 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/type.js +24 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/action_list.d.ts +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/action_list.js +20 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/boolean.d.ts +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/boolean.js +13 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/child_command.d.ts +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/child_command.js +27 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/command.d.ts +7 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/command.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/enum.d.ts +10 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/enum.js +29 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/file.d.ts +5 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/file.js +12 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/integer.d.ts +7 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/integer.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/number.d.ts +7 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/number.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/string.d.ts +7 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types/string.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types.d.ts +118 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/types.js +2 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/mod.d.ts +5 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/mod.js +5 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/deno_land.d.ts +14 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/deno_land.js +46 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/github.d.ts +26 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/github.js +118 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/nest_land.d.ts +14 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider/nest_land.js +55 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider.d.ts +27 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/provider.js +102 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/upgrade_command.d.ts +17 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/command/upgrade/upgrade_command.js +75 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_errors.d.ts +60 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_errors.js +117 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_utils.d.ts +18 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_utils.js +106 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_validate_flags.d.ts +10 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/_validate_flags.js +157 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/deprecated.d.ts +24 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/deprecated.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/flags.d.ts +33 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/flags.js +402 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/boolean.d.ts +3 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/boolean.js +11 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/integer.d.ts +3 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/integer.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/number.d.ts +3 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/number.js +9 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/string.d.ts +3 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types/string.js +4 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types.d.ts +59 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/flags/types.js +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/border.d.ts +20 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/border.js +18 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/cell.d.ts +78 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/cell.js +128 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/deps.d.ts +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/deps.js +1 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/layout.d.ts +99 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/layout.js +529 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/row.d.ts +49 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/row.js +74 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/table.d.ts +135 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/table.js +237 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/utils.d.ts +13 -0
- package/esm/deps/deno.land/x/cliffy@v0.25.7/table/utils.js +60 -0
- package/esm/package.json +3 -0
- package/esm/src/action/add.d.ts +1 -0
- package/esm/src/action/add.js +57 -0
- package/esm/src/action/clone.d.ts +6 -0
- package/esm/src/action/clone.js +108 -0
- package/esm/src/action/lang.d.ts +1 -0
- package/esm/src/action/lang.js +40 -0
- package/esm/src/action/pull.d.ts +1 -0
- package/esm/src/action/pull.js +22 -0
- package/esm/src/action/remove.d.ts +4 -0
- package/esm/src/action/remove.js +67 -0
- package/esm/src/action/reset.d.ts +1 -0
- package/esm/src/action/reset.js +21 -0
- package/esm/src/action/run.d.ts +4 -0
- package/esm/src/action/run.js +163 -0
- package/esm/src/action/status.d.ts +1 -0
- package/esm/src/action/status.js +5 -0
- package/esm/src/main.d.ts +2 -0
- package/esm/src/main.js +96 -0
- package/esm/src/meta.d.ts +3 -0
- package/esm/src/meta.js +51 -0
- package/esm/src/orca/client.d.ts +20 -0
- package/esm/src/orca/client.js +152 -0
- package/esm/src/orca/types.d.ts +54 -0
- package/esm/src/orca/types.js +12 -0
- package/esm/src/shared/config.d.ts +24 -0
- package/esm/src/shared/config.js +24 -0
- package/esm/src/shared/errors.d.ts +82 -0
- package/esm/src/shared/errors.js +228 -0
- package/esm/src/shared/file.d.ts +30 -0
- package/esm/src/shared/file.js +110 -0
- package/esm/src/shared/mod.d.ts +40 -0
- package/esm/src/shared/mod.js +383 -0
- package/esm/src/shared/types.d.ts +12 -0
- package/esm/src/shared/types.js +1 -0
- package/esm/src/track/client.d.ts +60 -0
- package/esm/src/track/client.js +268 -0
- package/esm/src/track/types.d.ts +210 -0
- package/esm/src/track/types.js +40 -0
- package/package.json +35 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const FileType: {
|
|
2
|
+
readonly UTF8: "utf8";
|
|
3
|
+
readonly URL: "url";
|
|
4
|
+
readonly Base64: "base64";
|
|
5
|
+
};
|
|
6
|
+
export type FileType = (typeof FileType)[keyof typeof FileType];
|
|
7
|
+
export type CodeFile = {
|
|
8
|
+
name: string;
|
|
9
|
+
content: string;
|
|
10
|
+
type: FileType;
|
|
11
|
+
};
|
|
12
|
+
export type PrepareCommand = {
|
|
13
|
+
imageName: string;
|
|
14
|
+
interactive: boolean;
|
|
15
|
+
cacheDirs: string[];
|
|
16
|
+
username?: string;
|
|
17
|
+
baseDir?: string;
|
|
18
|
+
};
|
|
19
|
+
export type SimpleRunCommand = {
|
|
20
|
+
id: string;
|
|
21
|
+
imageName: string;
|
|
22
|
+
workingDir: string;
|
|
23
|
+
shellCmd: string;
|
|
24
|
+
attachVolume: boolean;
|
|
25
|
+
files: CodeFile[];
|
|
26
|
+
envVars: Record<string, string>;
|
|
27
|
+
tarballUrls: string[];
|
|
28
|
+
};
|
|
29
|
+
export type EnvVarsCommand = {
|
|
30
|
+
envVars: Record<string, string>;
|
|
31
|
+
};
|
|
32
|
+
export type StdOutData = {
|
|
33
|
+
id: string;
|
|
34
|
+
l: string;
|
|
35
|
+
};
|
|
36
|
+
export type StdErrData = {
|
|
37
|
+
id: string;
|
|
38
|
+
l: string;
|
|
39
|
+
};
|
|
40
|
+
export type CommandDoneData = {
|
|
41
|
+
id: string;
|
|
42
|
+
reason: string;
|
|
43
|
+
exitCode: number;
|
|
44
|
+
};
|
|
45
|
+
type Msg<E extends string, D> = {
|
|
46
|
+
e: E;
|
|
47
|
+
data: D;
|
|
48
|
+
};
|
|
49
|
+
export type OrcaMsg = Msg<"prepare", PrepareCommand> | Msg<"simple_run", SimpleRunCommand> | Msg<"env_vars", EnvVarsCommand> | Msg<"env_vars_done", void> | Msg<"stdout", StdOutData> | Msg<"stderr", StdErrData> | Msg<"cmd_done", CommandDoneData>;
|
|
50
|
+
export type LineHandler = {
|
|
51
|
+
handleLine(line: string): void;
|
|
52
|
+
};
|
|
53
|
+
export declare function convertToCodeFile(fileName: string, fileContent: string): CodeFile;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BasicAuth } from "../track/client.js";
|
|
2
|
+
import { ProgrammingLanguage } from "../track/types.js";
|
|
3
|
+
export declare const CONFIG_FILE_PATH = ".track/config.json";
|
|
4
|
+
export interface TrackConfig {
|
|
5
|
+
scheme: string;
|
|
6
|
+
host: string;
|
|
7
|
+
orgName: string;
|
|
8
|
+
basicAuth?: BasicAuth;
|
|
9
|
+
examToken: string;
|
|
10
|
+
applicantExamId: number;
|
|
11
|
+
challengeId: number;
|
|
12
|
+
challengeResultId: number;
|
|
13
|
+
cookies: Record<string, string>;
|
|
14
|
+
programmingLanguage?: ProgrammingLanguage;
|
|
15
|
+
}
|
|
16
|
+
export type SaveConfigOptions = {
|
|
17
|
+
path?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function save(config: TrackConfig, options?: SaveConfigOptions): Promise<void>;
|
|
20
|
+
export type LoadConfigOptions = {
|
|
21
|
+
path?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function load(options?: LoadConfigOptions): Promise<TrackConfig>;
|
|
24
|
+
export declare function webUrl(config: TrackConfig): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { MissingConfigFile } from "./errors.js";
|
|
3
|
+
import { ensureFile } from "../../deps/deno.land/std@0.195.0/fs/ensure_file.js";
|
|
4
|
+
export const CONFIG_FILE_PATH = ".track/config.json";
|
|
5
|
+
export async function save(config, options) {
|
|
6
|
+
const jsonStr = JSON.stringify(config, null, 2);
|
|
7
|
+
const configFilePath = options?.path ?? CONFIG_FILE_PATH;
|
|
8
|
+
await ensureFile(configFilePath);
|
|
9
|
+
await dntShim.Deno.writeFile(configFilePath, new TextEncoder().encode(jsonStr));
|
|
10
|
+
}
|
|
11
|
+
export async function load(options) {
|
|
12
|
+
let data;
|
|
13
|
+
try {
|
|
14
|
+
data = await dntShim.Deno.readFile(options?.path ?? CONFIG_FILE_PATH);
|
|
15
|
+
}
|
|
16
|
+
catch (_e) {
|
|
17
|
+
throw new MissingConfigFile();
|
|
18
|
+
}
|
|
19
|
+
const configStr = new TextDecoder().decode(data);
|
|
20
|
+
return JSON.parse(configStr);
|
|
21
|
+
}
|
|
22
|
+
export function webUrl(config) {
|
|
23
|
+
return `${config.scheme}://${config.host}/${config.orgName}/exams/${config.examToken}`;
|
|
24
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
3
|
+
export declare class TrackError extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class APIError extends TrackError {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
static fromResponse(res: dntShim.Response): Promise<APIError>;
|
|
9
|
+
static serializationError(body: string): APIError;
|
|
10
|
+
}
|
|
11
|
+
export declare class IOError extends TrackError {
|
|
12
|
+
error: Error | string;
|
|
13
|
+
constructor(error: Error | string);
|
|
14
|
+
}
|
|
15
|
+
export declare class JSONError extends TrackError {
|
|
16
|
+
error: Error;
|
|
17
|
+
constructor(error: Error);
|
|
18
|
+
}
|
|
19
|
+
export declare class WebsocketError extends TrackError {
|
|
20
|
+
error: Error | Event;
|
|
21
|
+
constructor(error: Error | Event);
|
|
22
|
+
}
|
|
23
|
+
export declare class ChallengeDirectoryExists extends TrackError {
|
|
24
|
+
path: string;
|
|
25
|
+
constructor(path: string);
|
|
26
|
+
}
|
|
27
|
+
export declare class ExamUnread extends TrackError {
|
|
28
|
+
webUrl: string;
|
|
29
|
+
constructor(webUrl: string);
|
|
30
|
+
}
|
|
31
|
+
export declare class ExamExpired extends TrackError {
|
|
32
|
+
constructor();
|
|
33
|
+
}
|
|
34
|
+
export declare class ExamCanceled extends TrackError {
|
|
35
|
+
constructor();
|
|
36
|
+
}
|
|
37
|
+
export declare class ExamSubmitted extends TrackError {
|
|
38
|
+
constructor();
|
|
39
|
+
}
|
|
40
|
+
export declare class MissingConfigFile extends TrackError {
|
|
41
|
+
constructor();
|
|
42
|
+
}
|
|
43
|
+
export declare class ChallengeAlreadyFinished extends TrackError {
|
|
44
|
+
constructor();
|
|
45
|
+
}
|
|
46
|
+
export declare class InvalidChallengeId extends TrackError {
|
|
47
|
+
challengeId: number;
|
|
48
|
+
constructor(challengeId: number);
|
|
49
|
+
}
|
|
50
|
+
export declare class CantChooseLanguage extends TrackError {
|
|
51
|
+
constructor();
|
|
52
|
+
}
|
|
53
|
+
export declare class NotASingleResponse extends TrackError {
|
|
54
|
+
constructor();
|
|
55
|
+
}
|
|
56
|
+
export declare class BadTarballURL extends TrackError {
|
|
57
|
+
url: string;
|
|
58
|
+
reason: string;
|
|
59
|
+
constructor(url: string, reason: string);
|
|
60
|
+
}
|
|
61
|
+
export declare class CantReadFile extends TrackError {
|
|
62
|
+
fileName: string;
|
|
63
|
+
constructor(fileName: string);
|
|
64
|
+
}
|
|
65
|
+
export declare class FileMissingOrOutsideDirectory extends TrackError {
|
|
66
|
+
fileName: string;
|
|
67
|
+
constructor(fileName: string);
|
|
68
|
+
}
|
|
69
|
+
export declare class NewFilesNotAllowed extends TrackError {
|
|
70
|
+
constructor();
|
|
71
|
+
}
|
|
72
|
+
export declare class DeleteFilesNotAllowed extends TrackError {
|
|
73
|
+
constructor();
|
|
74
|
+
}
|
|
75
|
+
export declare class LocalExamNotAllowed extends TrackError {
|
|
76
|
+
url: string;
|
|
77
|
+
constructor(url: string);
|
|
78
|
+
}
|
|
79
|
+
export declare class OtherError extends TrackError {
|
|
80
|
+
message: string;
|
|
81
|
+
constructor(message: string);
|
|
82
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { HttpStatus } from "./mod.js";
|
|
2
|
+
export class TrackError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "TrackError";
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export class APIError extends TrackError {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "APIError";
|
|
12
|
+
}
|
|
13
|
+
static async fromResponse(res) {
|
|
14
|
+
const body = await res.text();
|
|
15
|
+
if (HttpStatus.isClientError(res)) {
|
|
16
|
+
return new APIError(`A client error occurred (${res.status}): ${body}`);
|
|
17
|
+
}
|
|
18
|
+
else if (HttpStatus.isServerError(res)) {
|
|
19
|
+
return new APIError(`A server error occurred (${res.status}): ${body}`);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return new APIError(`An unknown error occurred (${res.status}): ${body}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
static serializationError(body) {
|
|
26
|
+
return new APIError(`A serialization error occurred: ${body}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class IOError extends TrackError {
|
|
30
|
+
constructor(error) {
|
|
31
|
+
super(`An unexpected IO error occurred: ${error}`);
|
|
32
|
+
Object.defineProperty(this, "error", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: error
|
|
37
|
+
});
|
|
38
|
+
this.name = "IOError";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export class JSONError extends TrackError {
|
|
42
|
+
constructor(error) {
|
|
43
|
+
super(`Error with JSON (de)serialization: ${error}`);
|
|
44
|
+
Object.defineProperty(this, "error", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true,
|
|
48
|
+
value: error
|
|
49
|
+
});
|
|
50
|
+
this.name = "JSONError";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export class WebsocketError extends TrackError {
|
|
54
|
+
constructor(error) {
|
|
55
|
+
super(`Websocket Error: ${error}`);
|
|
56
|
+
Object.defineProperty(this, "error", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
configurable: true,
|
|
59
|
+
writable: true,
|
|
60
|
+
value: error
|
|
61
|
+
});
|
|
62
|
+
this.name = "WebsocketError";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export class ChallengeDirectoryExists extends TrackError {
|
|
66
|
+
constructor(path) {
|
|
67
|
+
super(`The destination path '${path}' already exists and is not an empty directory`);
|
|
68
|
+
Object.defineProperty(this, "path", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
configurable: true,
|
|
71
|
+
writable: true,
|
|
72
|
+
value: path
|
|
73
|
+
});
|
|
74
|
+
this.name = "ChallengeDirectoryExists";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export class ExamUnread extends TrackError {
|
|
78
|
+
constructor(webUrl) {
|
|
79
|
+
super(`This exam has not started yet, please start it in your browser at: ${webUrl}`);
|
|
80
|
+
Object.defineProperty(this, "webUrl", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
configurable: true,
|
|
83
|
+
writable: true,
|
|
84
|
+
value: webUrl
|
|
85
|
+
});
|
|
86
|
+
this.name = "ExamUnread";
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export class ExamExpired extends TrackError {
|
|
90
|
+
constructor() {
|
|
91
|
+
super("This exam is no longer available because the deadline has expired");
|
|
92
|
+
this.name = "ExamExpired";
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export class ExamCanceled extends TrackError {
|
|
96
|
+
constructor() {
|
|
97
|
+
super("This exam has been canceled");
|
|
98
|
+
this.name = "ExamCanceled";
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export class ExamSubmitted extends TrackError {
|
|
102
|
+
constructor() {
|
|
103
|
+
super("This exam has already been submitted");
|
|
104
|
+
this.name = "ExamSubmitted";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export class MissingConfigFile extends TrackError {
|
|
108
|
+
constructor() {
|
|
109
|
+
super("Could not load track config file - are you in a track challenge directory?");
|
|
110
|
+
this.name = "MissingConfigFile";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export class ChallengeAlreadyFinished extends TrackError {
|
|
114
|
+
constructor() {
|
|
115
|
+
super("This challenge has already been finished");
|
|
116
|
+
this.name = "ChallengeAlreadyFinished";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export class InvalidChallengeId extends TrackError {
|
|
120
|
+
constructor(challengeId) {
|
|
121
|
+
super(`The challenge id specified in your URL (${challengeId}), is invalid`);
|
|
122
|
+
Object.defineProperty(this, "challengeId", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
configurable: true,
|
|
125
|
+
writable: true,
|
|
126
|
+
value: challengeId
|
|
127
|
+
});
|
|
128
|
+
this.name = "InvalidChallengeId";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
export class CantChooseLanguage extends TrackError {
|
|
132
|
+
constructor() {
|
|
133
|
+
super("This challenge does not support changing programming languages");
|
|
134
|
+
this.name = "CantChooseLanguage";
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export class NotASingleResponse extends TrackError {
|
|
138
|
+
constructor() {
|
|
139
|
+
super("Tried to extract a single result from an API response with no result");
|
|
140
|
+
this.name = "NotASingleResponse";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export class BadTarballURL extends TrackError {
|
|
144
|
+
constructor(url, reason) {
|
|
145
|
+
super(`The challenge tarball URL did not return a 200 response.\n\nReason = ${reason}\n\nURL = ${url}\n\nPlease try the command again`);
|
|
146
|
+
Object.defineProperty(this, "url", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
configurable: true,
|
|
149
|
+
writable: true,
|
|
150
|
+
value: url
|
|
151
|
+
});
|
|
152
|
+
Object.defineProperty(this, "reason", {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
configurable: true,
|
|
155
|
+
writable: true,
|
|
156
|
+
value: reason
|
|
157
|
+
});
|
|
158
|
+
this.name = "BadTarballURL";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// export class CantOpenFile extends TrackError {
|
|
162
|
+
// constructor(public fileName: string) {
|
|
163
|
+
// super(
|
|
164
|
+
// `Could not open file - ${fileName}\n\nIf you changed your submission in the web editor, try running \`track pull\` to pull your latest changes.`,
|
|
165
|
+
// );
|
|
166
|
+
// this.name = "CantOpenFile";
|
|
167
|
+
// }
|
|
168
|
+
// }
|
|
169
|
+
export class CantReadFile extends TrackError {
|
|
170
|
+
constructor(fileName) {
|
|
171
|
+
super(`Could not read file - ${fileName} - Please make sure it is saved with a UTF-8 encoding.`);
|
|
172
|
+
Object.defineProperty(this, "fileName", {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
configurable: true,
|
|
175
|
+
writable: true,
|
|
176
|
+
value: fileName
|
|
177
|
+
});
|
|
178
|
+
this.name = "CantReadFile";
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export class FileMissingOrOutsideDirectory extends TrackError {
|
|
182
|
+
constructor(fileName) {
|
|
183
|
+
super(`File missing or located outside of the challenge directory - ${fileName}`);
|
|
184
|
+
Object.defineProperty(this, "fileName", {
|
|
185
|
+
enumerable: true,
|
|
186
|
+
configurable: true,
|
|
187
|
+
writable: true,
|
|
188
|
+
value: fileName
|
|
189
|
+
});
|
|
190
|
+
this.name = "FileMissingOrOutsideDirectory";
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
export class NewFilesNotAllowed extends TrackError {
|
|
194
|
+
constructor() {
|
|
195
|
+
super("This challenge does not allow the addition of new files");
|
|
196
|
+
this.name = "NewFilesNotAllowed";
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
export class DeleteFilesNotAllowed extends TrackError {
|
|
200
|
+
constructor() {
|
|
201
|
+
super("This challenge does not allow the deletion of files");
|
|
202
|
+
this.name = "DeleteFilesNotAllowed";
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
export class LocalExamNotAllowed extends TrackError {
|
|
206
|
+
constructor(url) {
|
|
207
|
+
super(`You are not allowed to take this challenge in your local CLI.\nPlease continue your exam on tracks.run:\n\n${url}`);
|
|
208
|
+
Object.defineProperty(this, "url", {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
configurable: true,
|
|
211
|
+
writable: true,
|
|
212
|
+
value: url
|
|
213
|
+
});
|
|
214
|
+
this.name = "LocalExamNotAllowed";
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
export class OtherError extends TrackError {
|
|
218
|
+
constructor(message) {
|
|
219
|
+
super(message);
|
|
220
|
+
Object.defineProperty(this, "message", {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
configurable: true,
|
|
223
|
+
writable: true,
|
|
224
|
+
value: message
|
|
225
|
+
});
|
|
226
|
+
this.name = "OtherError";
|
|
227
|
+
}
|
|
228
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
export declare const _internals: {
|
|
3
|
+
SEP: string;
|
|
4
|
+
};
|
|
5
|
+
export type PathsToFilenameSetOptions = {
|
|
6
|
+
recursive?: boolean;
|
|
7
|
+
allowNonExistent?: boolean;
|
|
8
|
+
root?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Given a user-supplied Vec of file paths, this function will
|
|
12
|
+
* iterate over each one, optionally verify it exists, and optionally recursively
|
|
13
|
+
* add files in subdirectories if the supplied path is a directory
|
|
14
|
+
* It will also transform the path to be relative to the working directory
|
|
15
|
+
*/
|
|
16
|
+
export declare function pathsToFilenameSet(paths: string[], options?: PathsToFilenameSetOptions): Promise<Set<string>>;
|
|
17
|
+
export declare function stat(p: string): Promise<dntShim.Deno.FileInfo | null>;
|
|
18
|
+
export declare function isEmptyDirectory(p: string): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Given a path, will return an array with all files and sub-files recursively.
|
|
21
|
+
* If the given path is a file, just a Vec with the file will be returned.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getAllDirFiles(p: string): Promise<string[]>;
|
|
24
|
+
export declare function toNixStyle(p: string): string;
|
|
25
|
+
export declare function toNativeStyle(p: string): string;
|
|
26
|
+
export declare function untgz(compressed: Uint8Array, dest: string): Promise<void>;
|
|
27
|
+
export type GetUniqueDirNameOptions = {
|
|
28
|
+
root?: string;
|
|
29
|
+
};
|
|
30
|
+
export declare function getUniqueDirName(base: string, options?: GetUniqueDirNameOptions): Promise<string>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import * as path from "../../deps/deno.land/std@0.195.0/path/mod.js";
|
|
3
|
+
import { Foras, gunzip } from "@hazae41/foras";
|
|
4
|
+
import tar from "tar";
|
|
5
|
+
import * as fs from "../../deps/deno.land/std@0.195.0/fs/mod.js";
|
|
6
|
+
export const _internals = {
|
|
7
|
+
SEP: path.SEP,
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Given a user-supplied Vec of file paths, this function will
|
|
11
|
+
* iterate over each one, optionally verify it exists, and optionally recursively
|
|
12
|
+
* add files in subdirectories if the supplied path is a directory
|
|
13
|
+
* It will also transform the path to be relative to the working directory
|
|
14
|
+
*/
|
|
15
|
+
export async function pathsToFilenameSet(paths, options) {
|
|
16
|
+
const files = [];
|
|
17
|
+
const root = options?.root ?? dntShim.Deno.cwd();
|
|
18
|
+
for (const p of paths.map((p) => `${root}/${p}`)) {
|
|
19
|
+
const f = await stat(p);
|
|
20
|
+
const rp = toNixStyle(path.relative(root, p));
|
|
21
|
+
if (options?.recursive && f) {
|
|
22
|
+
const dirFiles = await getAllDirFiles(p);
|
|
23
|
+
dirFiles.forEach((file) => files.push(toNixStyle(path.relative(root, file))));
|
|
24
|
+
}
|
|
25
|
+
else if (f?.isFile) {
|
|
26
|
+
files.push(rp);
|
|
27
|
+
}
|
|
28
|
+
else if (options?.allowNonExistent) {
|
|
29
|
+
files.push(toNixStyle(path.relative(root, p)));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return new Set(files);
|
|
33
|
+
}
|
|
34
|
+
export async function stat(p) {
|
|
35
|
+
try {
|
|
36
|
+
return await dntShim.Deno.stat(p);
|
|
37
|
+
}
|
|
38
|
+
catch (_e) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export async function isEmptyDirectory(p) {
|
|
43
|
+
const f = await stat(p);
|
|
44
|
+
if (!f) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
else if (!f.isDirectory) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
for await (const _dirEntry of dntShim.Deno.readDir(p)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Given a path, will return an array with all files and sub-files recursively.
|
|
59
|
+
* If the given path is a file, just a Vec with the file will be returned.
|
|
60
|
+
*/
|
|
61
|
+
export async function getAllDirFiles(p) {
|
|
62
|
+
const allPaths = [];
|
|
63
|
+
async function addFilesRecursive(p) {
|
|
64
|
+
const f = await stat(p);
|
|
65
|
+
if (!f) {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
if (f.isDirectory) {
|
|
69
|
+
for await (const dirEntry of dntShim.Deno.readDir(p)) {
|
|
70
|
+
await addFilesRecursive(`${p}/${dirEntry.name}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
allPaths.push(p);
|
|
75
|
+
}
|
|
76
|
+
return allPaths;
|
|
77
|
+
}
|
|
78
|
+
await addFilesRecursive(p);
|
|
79
|
+
return allPaths;
|
|
80
|
+
}
|
|
81
|
+
export function toNixStyle(p) {
|
|
82
|
+
return p.replaceAll(/[\\\/]/g, "/");
|
|
83
|
+
}
|
|
84
|
+
export function toNativeStyle(p) {
|
|
85
|
+
return p.replaceAll(/[\\\/]/g, _internals.SEP);
|
|
86
|
+
}
|
|
87
|
+
export async function untgz(compressed, dest) {
|
|
88
|
+
Foras.initSyncBundledOnce();
|
|
89
|
+
const decompressed = gunzip(compressed);
|
|
90
|
+
const tmpTarFile = await dntShim.Deno.makeTempFile();
|
|
91
|
+
await dntShim.Deno.writeFile(tmpTarFile, decompressed);
|
|
92
|
+
await tar.x({
|
|
93
|
+
file: tmpTarFile,
|
|
94
|
+
cwd: dest,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
export async function getUniqueDirName(base, options) {
|
|
98
|
+
let counter = 1;
|
|
99
|
+
const root = options?.root ?? dntShim.Deno.cwd();
|
|
100
|
+
let uniqueDirName;
|
|
101
|
+
while (true) {
|
|
102
|
+
uniqueDirName = `${base}_${counter}`;
|
|
103
|
+
if (await fs.exists(`${root}/${uniqueDirName}`)) {
|
|
104
|
+
counter++;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return uniqueDirName;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { TrackCLIContext } from "./types.js";
|
|
3
|
+
import { TrackClient } from "../track/client.js";
|
|
4
|
+
import { ApplicantExamForNoAuth, ChallengeResult, ChallengeSettings, CodingContext, ExamSession, ExamSessionChallenge, FileListType, ProgrammingLanguageInfo } from "../track/types.js";
|
|
5
|
+
import { CodingAnswers } from "../track/types.js";
|
|
6
|
+
export declare const _internals: {
|
|
7
|
+
prompt: (message?: string | undefined, _default?: string | undefined) => string | null;
|
|
8
|
+
};
|
|
9
|
+
export declare const HttpStatus: {
|
|
10
|
+
readonly OK: 200;
|
|
11
|
+
readonly Unauthorized: 401;
|
|
12
|
+
readonly isSuccess: (r: number | dntShim.Response) => boolean;
|
|
13
|
+
readonly isClientError: (r: number | dntShim.Response) => boolean;
|
|
14
|
+
readonly isServerError: (r: number | dntShim.Response) => boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const Prompt: {
|
|
17
|
+
select(message: string, items: string[]): number | undefined;
|
|
18
|
+
};
|
|
19
|
+
export declare function printTimeLeft(timeLeftSeconds: number): void;
|
|
20
|
+
export declare function ensureExamInProgress(applicantExam: ApplicantExamForNoAuth, webUrlRedirect: string): void;
|
|
21
|
+
export declare function getChallengeFromExamSession(examSession: ExamSession, challengeId: number): ExamSessionChallenge | undefined;
|
|
22
|
+
export declare function tryStartingChallenge(challenge: ExamSessionChallenge, api: TrackClient, applicantExam: ApplicantExamForNoAuth, resultOpt?: ChallengeResult): Promise<ChallengeResult | undefined>;
|
|
23
|
+
export declare function chooseProgrammingLanguage(languages: ProgrammingLanguageInfo[]): ProgrammingLanguageInfo;
|
|
24
|
+
export declare function listFileNames(context: {
|
|
25
|
+
settings: ChallengeSettings;
|
|
26
|
+
answers: CodingAnswers;
|
|
27
|
+
}, fileListType: FileListType): string[];
|
|
28
|
+
export declare const SnakeCase: {
|
|
29
|
+
to<T>(obj: T): T;
|
|
30
|
+
from<T_1>(obj: T_1): T_1;
|
|
31
|
+
};
|
|
32
|
+
export declare function getCommonChallengeContext(): Promise<TrackCLIContext>;
|
|
33
|
+
export declare function printChallengeInfo(trackContext: TrackCLIContext): Promise<void>;
|
|
34
|
+
export declare function printWorkingFileSet(codingContext: CodingContext): void;
|
|
35
|
+
export declare function downloadChallengeFilesTo(codingContext: CodingContext, dest: string, api: TrackClient, applicantExamId: number, challengeResultId: number, showFileDiff: boolean, includeTarball: boolean): Promise<void>;
|
|
36
|
+
export type ArchiveExistingChallengeFilesOptions = {
|
|
37
|
+
challengeDir?: string;
|
|
38
|
+
selectedLanguage?: ProgrammingLanguageInfo;
|
|
39
|
+
};
|
|
40
|
+
export declare function archiveExistingChallengeFiles(orgName: string, challengePosition: number, options?: ArchiveExistingChallengeFilesOptions): Promise<void>;
|