@kumori/kdsl 0.0.54 → 0.1.0
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/bin/cli.js +9 -3
- package/dist/build/helpers/deployment.d.ts +13 -13
- package/dist/build/main.js +32 -13
- package/dist/build/main.js.map +1 -1
- package/dist/deployment/gen/deployment-template.kumori +1 -1
- package/dist/deployment/gen/main.d.ts +1 -2
- package/dist/deployment/gen/main.js +7 -14
- package/dist/deployment/gen/main.js.map +1 -1
- package/dist/index/create/main.d.ts +1 -0
- package/dist/index/create/main.js +35 -15
- package/dist/index/create/main.js.map +1 -1
- package/dist/index/create/types.d.ts +1 -1
- package/dist/index/main.js +2 -0
- package/dist/index/main.js.map +1 -1
- package/dist/index/remove/main.d.ts +11 -0
- package/dist/index/remove/main.js +136 -0
- package/dist/index/remove/main.js.map +1 -0
- package/dist/lib/build.js +29 -42
- package/dist/lib/check.js +15 -45
- package/dist/lib/clean.js +1 -39
- package/dist/lib/deployment.d.ts +0 -3
- package/dist/lib/deployment.js +1 -5
- package/dist/lib/deployment.js.map +1 -1
- package/dist/lib/index-cmd.js +151 -60
- package/dist/lib/index.js +260 -54
- package/dist/lib/mod.js +78 -144
- package/dist/lib/registry.js +1 -67
- package/dist/mod/dependency/main.js +3 -4
- package/dist/mod/dependency/main.js.map +1 -1
- package/dist/mod/jsonschema/gen/main.js +3 -5
- package/dist/mod/jsonschema/gen/main.js.map +1 -1
- package/dist/mod/update/main.js +2 -2
- package/dist/mod/update/main.js.map +1 -1
- package/dist/util/git-or-fs-client.d.ts +13 -0
- package/dist/util/git-or-fs-client.js +86 -0
- package/dist/util/git-or-fs-client.js.map +1 -0
- package/out/deployment/gen/deployment-template.kumori +1 -1
- package/package.json +21 -15
- package/dist/lib/io/lib.kumori +0 -3
- package/dist/lib/kumori/builtin/apiserver.h.kumori +0 -19
- package/dist/lib/kumori/builtin/httpinbound.h.kumori +0 -34
- package/dist/lib/kumori/builtin/tcpinbound.h.kumori +0 -23
- package/dist/lib/kumori/builtin.kumori +0 -16
- package/dist/lib/kumori/component.kumori +0 -120
- package/dist/lib/kumori/deployment.kumori +0 -14
- package/dist/lib/kumori/resource.kumori +0 -23
- package/dist/lib/kumori/service.kumori +0 -51
- package/dist/lib/kumori/shared.kumori +0 -18
- package/dist/lib/kumori/sized.kumori +0 -25
- package/dist/lib/sized.kumori +0 -8
- package/dist/lib/std.kumori +0 -8
- package/dist/lib/strconv/lib.kumori +0 -9
- package/out/deployment-template.kumori +0 -33
- package/out/lib/io/lib.kumori +0 -3
- package/out/lib/kumori/builtin/apiserver.h.kumori +0 -19
- package/out/lib/kumori/builtin/httpinbound.h.kumori +0 -34
- package/out/lib/kumori/builtin/tcpinbound.h.kumori +0 -23
- package/out/lib/kumori/builtin.kumori +0 -16
- package/out/lib/kumori/component.kumori +0 -120
- package/out/lib/kumori/deployment.kumori +0 -14
- package/out/lib/kumori/resource.kumori +0 -23
- package/out/lib/kumori/service.kumori +0 -51
- package/out/lib/kumori/shared.kumori +0 -18
- package/out/lib/kumori/sized.kumori +0 -25
- package/out/lib/sized.kumori +0 -8
- package/out/lib/std.kumori +0 -8
- package/out/lib/strconv/lib.kumori +0 -9
- package/out/main.cjs +0 -820
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/mod/update/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/mod/update/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,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,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { URI } from "langium";
|
|
2
|
+
import { ILogLayer } from "loglayer";
|
|
3
|
+
export declare class GitOrLocalFsClient {
|
|
4
|
+
private log?;
|
|
5
|
+
private tempDir;
|
|
6
|
+
private g;
|
|
7
|
+
constructor(log?: ILogLayer);
|
|
8
|
+
isGitUri(uri: URI): boolean;
|
|
9
|
+
private parseGitUri;
|
|
10
|
+
private ensureRepoUpdated;
|
|
11
|
+
readFile(uri: URI): Promise<string>;
|
|
12
|
+
write(uri: URI, data: string | Uint8Array | Blob | ArrayBuffer): Promise<number>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import * as git from "simple-git";
|
|
5
|
+
export class GitOrLocalFsClient {
|
|
6
|
+
constructor(log) {
|
|
7
|
+
this.log = log?.withPrefix("GitOrLocalFs");
|
|
8
|
+
this.tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "fs-client-"));
|
|
9
|
+
this.g = (baseDir) => git.simpleGit(baseDir).env({ ...process.env });
|
|
10
|
+
process.on("exit", () => {
|
|
11
|
+
fs.rmdirSync(this.tempDir, { recursive: true });
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
isGitUri(uri) {
|
|
15
|
+
return (uri.scheme === "git" ||
|
|
16
|
+
uri.scheme.startsWith("git+") ||
|
|
17
|
+
(uri.scheme.startsWith("http") && uri.toString().includes(".git")));
|
|
18
|
+
}
|
|
19
|
+
parseGitUri(uri) {
|
|
20
|
+
const urlStr = uri.toString();
|
|
21
|
+
const gitMatch = urlStr.indexOf(".git");
|
|
22
|
+
if (gitMatch !== -1) {
|
|
23
|
+
let repoUrl = urlStr.substring(0, gitMatch + 4);
|
|
24
|
+
if (repoUrl.startsWith("git+")) {
|
|
25
|
+
repoUrl = repoUrl.substring(4);
|
|
26
|
+
}
|
|
27
|
+
else if (repoUrl.startsWith("git://")) {
|
|
28
|
+
repoUrl = "https://" + repoUrl.substring(6);
|
|
29
|
+
}
|
|
30
|
+
const filePath = urlStr.substring(gitMatch + 4);
|
|
31
|
+
const repoDir = path.join(this.tempDir, Buffer.from(repoUrl).toString("hex"));
|
|
32
|
+
return {
|
|
33
|
+
repoUrl,
|
|
34
|
+
repoDir,
|
|
35
|
+
filePath: path.join(repoDir, filePath), //filePath.startsWith("/") ? filePath.substring(1) : filePath,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`Invalid git URI format: ${urlStr}`);
|
|
39
|
+
}
|
|
40
|
+
async ensureRepoUpdated(repoDir, repoUrl) {
|
|
41
|
+
this.log?.info(`Checking repo status at ${repoDir}`);
|
|
42
|
+
if (!fs.existsSync(repoDir)) {
|
|
43
|
+
this.log?.info(`${repoUrl} is not available - cloning`);
|
|
44
|
+
await fs.promises.mkdir(repoDir);
|
|
45
|
+
await this.g(repoDir).clone(repoUrl, repoDir, [
|
|
46
|
+
"--single-branch",
|
|
47
|
+
"--depth",
|
|
48
|
+
"1",
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.log?.info(`refreshing ${repoUrl}`);
|
|
53
|
+
await this.g(repoDir).pull();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async readFile(uri) {
|
|
57
|
+
if (this.isGitUri(uri)) {
|
|
58
|
+
const { repoUrl, repoDir, filePath } = this.parseGitUri(uri);
|
|
59
|
+
await this.ensureRepoUpdated(repoDir, repoUrl);
|
|
60
|
+
this.log?.info(`Reading from up-to-date repo path "${filePath}"`);
|
|
61
|
+
return fs.promises.readFile(filePath, "utf-8");
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return fs.promises.readFile(uri.fsPath, "utf-8");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async write(uri, data) {
|
|
68
|
+
if (this.isGitUri(uri)) {
|
|
69
|
+
const { repoUrl, repoDir, filePath } = this.parseGitUri(uri);
|
|
70
|
+
await this.ensureRepoUpdated(repoDir, repoUrl);
|
|
71
|
+
this.log?.info(`Writing file to commit at "${filePath}"`);
|
|
72
|
+
const bytesWritten = await Bun.write(filePath, data);
|
|
73
|
+
this.log?.info(`Adding and committing "${filePath}"`);
|
|
74
|
+
await this.g(repoDir).add([filePath]);
|
|
75
|
+
await this.g(repoDir).commit(`Update ${filePath.substring(filePath.lastIndexOf("/") + 1)}`, filePath);
|
|
76
|
+
this.log?.info(`Pushing "${repoUrl}"`);
|
|
77
|
+
await this.g(repoDir).push();
|
|
78
|
+
this.log?.info(`Completed push`);
|
|
79
|
+
return bytesWritten;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return Bun.write(uri.fsPath, data);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=git-or-fs-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-or-fs-client.js","sourceRoot":"","sources":["../../src/util/git-or-fs-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,KAAK,GAAG,MAAM,YAAY,CAAA;AAGjC,MAAM,OAAO,kBAAkB;IAK7B,YAAY,GAAe;QACzB,IAAI,CAAC,GAAG,GAAG,GAAG,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;QAC1C,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,YAAY,CAAC,CAAC,CAAA;QACnE,IAAI,CAAC,CAAC,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,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,OAAO,CAAC,CAAC,IAAI,EAAE,CAAA;YAC5B,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAA;YAChC,OAAO,YAAY,CAAA;QACrB,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumori/kdsl",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"bin",
|
|
@@ -55,29 +55,34 @@
|
|
|
55
55
|
"import": "./dist/lib/index-cmd.js",
|
|
56
56
|
"require": "./out/lib/index-cmd.cjs",
|
|
57
57
|
"types": "./dist/lib/index-cmd.d.ts"
|
|
58
|
-
}
|
|
58
|
+
},
|
|
59
|
+
"./deployment-template.kumori": "./dist/deployment/gen/deployment-template.kumori"
|
|
59
60
|
},
|
|
60
61
|
"scripts": {
|
|
61
|
-
"build": "
|
|
62
|
+
"build": "bun run fix && bun run build:types && bun run build:cli && bun run build:lib && bun run copy-loader",
|
|
62
63
|
"build:types": "tsc -b tsconfig.json",
|
|
63
|
-
"build:cli": "
|
|
64
|
-
"build:lib": "
|
|
65
|
-
"copy-loader": "mkdir -p out/lib dist/lib && rsync -av --include='*/' --include='*.kumori' --exclude='*' src/ out/ && rsync -av --include='*/' --include='*.kumori' --exclude='*' src/ dist/
|
|
66
|
-
"test": "
|
|
64
|
+
"build:cli": "bun run build.ts --minify",
|
|
65
|
+
"build:lib": "bun run build.ts --minify --target=cjs && bun run build.ts --minify --target=esm",
|
|
66
|
+
"copy-loader": "mkdir -p out/lib dist/lib && rsync -av --include='*/' --include='*.kumori' --exclude='*' src/ out/ && rsync -av --include='*/' --include='*.kumori' --exclude='*' src/ dist/",
|
|
67
|
+
"test": "bun test",
|
|
67
68
|
"clean": "rm -rf dist/ out/ tsconfig.tsbuildinfo",
|
|
68
|
-
"prepublishOnly": "
|
|
69
|
+
"prepublishOnly": "bun run build",
|
|
69
70
|
"lint": "eslint .",
|
|
70
71
|
"prettier": "prettier src/ test/ --write",
|
|
71
|
-
"fix": "
|
|
72
|
+
"fix": "bun run lint && bun run prettier"
|
|
72
73
|
},
|
|
73
74
|
"dependencies": {
|
|
74
75
|
"@commander-js/extra-typings": "^14.0.0",
|
|
75
|
-
"@inquirer/prompts": "^8.0
|
|
76
|
-
"@kumori/kdsl-lsp": "0.
|
|
76
|
+
"@inquirer/prompts": "^8.2.0",
|
|
77
|
+
"@kumori/kdsl-lsp": "^0.1.0",
|
|
77
78
|
"ajv": "^8.17.1",
|
|
78
79
|
"chalk": "~5.6.2",
|
|
79
80
|
"commander": "~14.0.2",
|
|
80
|
-
"
|
|
81
|
+
"handlebars": "^4.7.8",
|
|
82
|
+
"isomorphic-git": "^1.36.1",
|
|
83
|
+
"simple-git": "3.33.0",
|
|
84
|
+
"vscode-languageserver": "^9.0.1",
|
|
85
|
+
"zod": "^4.3.5"
|
|
81
86
|
},
|
|
82
87
|
"license": "EUPL",
|
|
83
88
|
"keywords": [
|
|
@@ -89,11 +94,12 @@
|
|
|
89
94
|
],
|
|
90
95
|
"gitHead": "89bea74c68de5f90f37ccc0e64b340408c90b76d",
|
|
91
96
|
"devDependencies": {
|
|
92
|
-
"@eslint/js": "^9.39.
|
|
93
|
-
"
|
|
97
|
+
"@eslint/js": "^9.39.2",
|
|
98
|
+
"@types/bun": "^1.3.6",
|
|
99
|
+
"eslint": "^9.39.2",
|
|
94
100
|
"globals": "^16.5.0",
|
|
95
101
|
"jiti": "^2.6.1",
|
|
96
102
|
"prettier": "3.7.3",
|
|
97
|
-
"typescript-eslint": "^8.
|
|
103
|
+
"typescript-eslint": "^8.53.0"
|
|
98
104
|
}
|
|
99
105
|
}
|
package/dist/lib/io/lib.kumori
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import "kumori"
|
|
2
|
-
|
|
3
|
-
builtin HTTPInbound {
|
|
4
|
-
id {
|
|
5
|
-
name "inbound"
|
|
6
|
-
kind "service"
|
|
7
|
-
domain "kumori.systems"
|
|
8
|
-
module "builtins/inbound"
|
|
9
|
-
version "1.3.0"
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
srv {
|
|
13
|
-
client { inbound "http" }
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
config {
|
|
17
|
-
type "https"
|
|
18
|
-
websocket?: bool = false
|
|
19
|
-
remoteaddressheader?: string = ""
|
|
20
|
-
cleanxforwardedfor?: bool = false
|
|
21
|
-
certrequired?: bool = false
|
|
22
|
-
|
|
23
|
-
accesspolicies?: kumori.AccessPolicies
|
|
24
|
-
|
|
25
|
-
requestHeaders?: kumori.StringMap = {}
|
|
26
|
-
responseHeaders?: kumori.StringMap = {}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
resource {
|
|
30
|
-
servercert: kumori.Certificate
|
|
31
|
-
serverdomain: kumori.Domain
|
|
32
|
-
clientcertca?: kumori.CA
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import "kumori"
|
|
2
|
-
|
|
3
|
-
builtin TCPInbound {
|
|
4
|
-
id {
|
|
5
|
-
name "inbound"
|
|
6
|
-
kind "service"
|
|
7
|
-
domain "kumori.systems"
|
|
8
|
-
module "builtins/inbound"
|
|
9
|
-
version "1.3.0"
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
srv {
|
|
13
|
-
client { inbound "tcp" }
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
config {
|
|
17
|
-
type "tcp"
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
resource {
|
|
21
|
-
port: kumori.Port
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
library
|
|
2
|
-
|
|
3
|
-
alias ComponentInterface struct {
|
|
4
|
-
srv? Links
|
|
5
|
-
config? struct open[]
|
|
6
|
-
resource? struct open[Resource]
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
alias component struct {
|
|
10
|
-
srv? Links
|
|
11
|
-
config? struct open[]
|
|
12
|
-
resource? struct open[Resource]
|
|
13
|
-
scale? number
|
|
14
|
-
|
|
15
|
-
code? struct open[Code]
|
|
16
|
-
init? []struct {
|
|
17
|
-
cmd? []string
|
|
18
|
-
image Image
|
|
19
|
-
entrypoint? []string
|
|
20
|
-
|
|
21
|
-
size struct {
|
|
22
|
-
memory RAMSized
|
|
23
|
-
cpu CPUSized
|
|
24
|
-
mincpu? CPUSized
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
env? struct open[Env]
|
|
28
|
-
fs? struct open[File]
|
|
29
|
-
}
|
|
30
|
-
size struct {
|
|
31
|
-
bandwidth BandwidthSized
|
|
32
|
-
minbandwidth? BandwidthSized
|
|
33
|
-
mincpu CPUSized
|
|
34
|
-
}
|
|
35
|
-
probe? struct open[Probes]
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
alias Code struct {
|
|
39
|
-
cmd? []string
|
|
40
|
-
image Image
|
|
41
|
-
entrypoint? []string
|
|
42
|
-
|
|
43
|
-
size struct {
|
|
44
|
-
memory RAMSized
|
|
45
|
-
cpu CPUSized
|
|
46
|
-
mincpu? CPUSized
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
user? struct {userid: number, groupid: number}
|
|
50
|
-
env? struct open[Env]
|
|
51
|
-
fs? struct open[File]
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
alias Image string | struct { hub: struct { name: string, secret?: string }, tag: string }
|
|
55
|
-
|
|
56
|
-
alias File string | FSMap | struct { volume: string }
|
|
57
|
-
alias FSMap FSData | FSSecret | FSPort | FSDomain | FSCertificate | FSCa
|
|
58
|
-
|
|
59
|
-
alias AllowedFormat "text" | "json" | "yaml" | "flatdict"
|
|
60
|
-
|
|
61
|
-
alias FSData struct { data: string, mode?: number, format?: AllowedFormat, rebootOnUpdate?: bool }
|
|
62
|
-
alias FSSecret struct { secret: string, mode?: number, format?: AllowedFormat, rebootOnUpdate?: bool }
|
|
63
|
-
alias FSPort struct { port: string, mode?: number, format?: AllowedFormat, rebootOnUpdate?: bool }
|
|
64
|
-
alias FSDomain struct { domain: string, mode?: number, format?: AllowedFormat, rebootOnUpdate?: bool }
|
|
65
|
-
alias FSCertificate struct { certificate: string, mode?: number, format?: AllowedFormat, rebootOnUpdate?: bool }
|
|
66
|
-
alias FSCa struct { ca: string, mode?: number, format?: AllowedFormat, rebootOnUpdate?: bool }
|
|
67
|
-
|
|
68
|
-
alias Env string | bool | number | struct { secret: string }
|
|
69
|
-
|
|
70
|
-
alias Probes struct {
|
|
71
|
-
liveness? LivenessProbeAttributes
|
|
72
|
-
readiness? ReadinessProbeAttributes
|
|
73
|
-
pmetrics? PrometheusMetricsProbeAttributes
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
alias LivenessProbeAttributes struct {
|
|
77
|
-
protocol ProbeProtocol
|
|
78
|
-
startupGraceWindow? StartupGraceWindow
|
|
79
|
-
frequency? any
|
|
80
|
-
timeout? number
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
alias ReadinessProbeAttributes struct {
|
|
84
|
-
protocol ProbeProtocol
|
|
85
|
-
frequency? any
|
|
86
|
-
timeout? number
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
alias PrometheusMetricsProbeAttributes struct {
|
|
90
|
-
protocol HTTPOnlyProbeProtocol
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
alias ProbeProtocol struct {
|
|
94
|
-
http? HTTPProbeProtocol
|
|
95
|
-
tcp? TCPProbeProtocol
|
|
96
|
-
exec? ExecProbeProtocol
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
alias HTTPOnlyProbeProtocol struct {
|
|
100
|
-
http HTTPProbeProtocol
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
alias HTTPProbeProtocol struct {
|
|
104
|
-
port number
|
|
105
|
-
path string
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
alias TCPProbeProtocol struct {
|
|
109
|
-
port number
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
alias ExecProbeProtocol struct {
|
|
113
|
-
path string
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
alias StartupGraceWindow struct {
|
|
117
|
-
unit "ms" | "attempt"
|
|
118
|
-
duration number
|
|
119
|
-
probe bool
|
|
120
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
library
|
|
2
|
-
|
|
3
|
-
alias Resource Volume | CA | Certificate | Secret | Domain | Port
|
|
4
|
-
|
|
5
|
-
type CA string
|
|
6
|
-
type Certificate string
|
|
7
|
-
type Secret string
|
|
8
|
-
type Domain string
|
|
9
|
-
type Port string
|
|
10
|
-
|
|
11
|
-
alias Volume Registered | InlineVolume | DeprecatedVolume
|
|
12
|
-
alias InlineVolume NonReplicated | Persisted | Volatile
|
|
13
|
-
|
|
14
|
-
type Registered string
|
|
15
|
-
type NonReplicated StorageSized
|
|
16
|
-
type Persisted StorageSized
|
|
17
|
-
type Volatile StorageSized
|
|
18
|
-
|
|
19
|
-
// NOTE: These are here to retain backwards compatibility.
|
|
20
|
-
// **Do not use.** Will be removed in the future.
|
|
21
|
-
alias DeprecatedVolume Ephemeral | Persistent
|
|
22
|
-
type Ephemeral StorageSized
|
|
23
|
-
type Persistent string
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
library
|
|
2
|
-
|
|
3
|
-
alias ServiceInterface struct {
|
|
4
|
-
srv? Links
|
|
5
|
-
config? struct open[]
|
|
6
|
-
resource? struct open[Resource]
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
alias service struct {
|
|
10
|
-
srv? Links
|
|
11
|
-
config? struct open[]
|
|
12
|
-
resource? struct open[Resource]
|
|
13
|
-
resilience? number
|
|
14
|
-
|
|
15
|
-
role? struct open[Role]
|
|
16
|
-
connect? struct open[Connection]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
alias Role struct {
|
|
20
|
-
artifact any // TODO: service, component or builtin
|
|
21
|
-
|
|
22
|
-
scale? ScaleSpec
|
|
23
|
-
resilience? number
|
|
24
|
-
config? struct open[]
|
|
25
|
-
resource? struct open[Resource]
|
|
26
|
-
meta? struct open[]
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
alias Connection LoadBalancer | FullConnector
|
|
30
|
-
|
|
31
|
-
type LoadBalancer struct {
|
|
32
|
-
from struct { target string, channel string } | []struct { target string, channel string }
|
|
33
|
-
to struct { target string, channel string } | []struct { target string, channel string, meta? any }
|
|
34
|
-
|
|
35
|
-
meta? any
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type FullConnector ReducedFullConnector | CompleteFullConnector
|
|
39
|
-
|
|
40
|
-
alias ReducedFullConnector struct {
|
|
41
|
-
target string
|
|
42
|
-
channel string
|
|
43
|
-
meta? any
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
alias CompleteFullConnector struct {
|
|
47
|
-
from struct { target string, channel string } | []struct { target string, channel string }
|
|
48
|
-
to struct { target string, channel string } | []struct { target string, channel string, meta? any }
|
|
49
|
-
|
|
50
|
-
meta? any
|
|
51
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
library
|
|
2
|
-
|
|
3
|
-
alias Links struct {
|
|
4
|
-
client? struct open[Client]
|
|
5
|
-
server? struct open[Server]
|
|
6
|
-
duplex? struct open[Server]
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
alias Channel "udp" | "tcp" | "http" | "grpc"
|
|
10
|
-
alias Client Channel
|
|
11
|
-
alias Server Channel | struct { protocol Channel, port number }
|
|
12
|
-
|
|
13
|
-
alias AccessPolicies struct {
|
|
14
|
-
allowediplist?: []string
|
|
15
|
-
deniediplist?: []string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
alias StringMap struct open[string]
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
library
|
|
2
|
-
|
|
3
|
-
alias StorageUnit "k" | "M" | "G" | "T" | "P" | "E" | "Ki" | "Mi" | "Gi" | "Ti" | "Pi" | "Ei"
|
|
4
|
-
alias StorageSized struct {
|
|
5
|
-
size number
|
|
6
|
-
unit StorageUnit
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
alias CPUUnit "m"
|
|
10
|
-
alias CPUSized struct {
|
|
11
|
-
size number
|
|
12
|
-
unit CPUUnit
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
alias RAMUnit "G" | "M" | "Gi" | "Mi"
|
|
16
|
-
alias RAMSized struct {
|
|
17
|
-
size number
|
|
18
|
-
unit RAMUnit
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
alias BandwidthUnit "G" | "M" | "Gi" | "Mi"
|
|
22
|
-
alias BandwidthSized struct {
|
|
23
|
-
size number
|
|
24
|
-
unit BandwidthUnit
|
|
25
|
-
}
|
package/dist/lib/sized.kumori
DELETED
package/dist/lib/std.kumori
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import (
|
|
2
|
-
{{#each imports}}
|
|
3
|
-
"{{this}}"
|
|
4
|
-
{{/each}}
|
|
5
|
-
)
|
|
6
|
-
|
|
7
|
-
deployment {
|
|
8
|
-
name "{{name}}"
|
|
9
|
-
artifact {{artifact}}
|
|
10
|
-
resilience {{resilience}}
|
|
11
|
-
|
|
12
|
-
config {
|
|
13
|
-
{{#each config}}
|
|
14
|
-
{{this}}
|
|
15
|
-
{{/each}}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
resource {
|
|
19
|
-
{{#each resources}}
|
|
20
|
-
{{this}}
|
|
21
|
-
{{/each}}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
{{#if scale}}
|
|
25
|
-
scale {
|
|
26
|
-
{{#each scale}}
|
|
27
|
-
{{this}}
|
|
28
|
-
{{/each}}
|
|
29
|
-
}
|
|
30
|
-
{{else if hasScaleValue}}
|
|
31
|
-
scale {{scaleValue}}
|
|
32
|
-
{{/if}}
|
|
33
|
-
}
|
package/out/lib/io/lib.kumori
DELETED