+8
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/knot.tsp
+8
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/knot.tsp
+80
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/pipeline.tsp
+80
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/pipeline.tsp
···
1
+
import "@typelex/emitter";
2
+
3
+
namespace sh.tangled.pipeline {
4
+
@rec("tid")
5
+
model Main {
6
+
@required triggerMetadata: TriggerMetadata;
7
+
@required workflows: Workflow[];
8
+
}
9
+
10
+
@closed
11
+
@inline
12
+
union TriggerKind {
13
+
"push",
14
+
"pull_request",
15
+
"manual",
16
+
}
17
+
18
+
model TriggerMetadata {
19
+
@required kind: TriggerKind;
20
+
@required repo: TriggerRepo;
21
+
push?: PushTriggerData;
22
+
pullRequest?: PullRequestTriggerData;
23
+
manual?: ManualTriggerData;
24
+
}
25
+
26
+
model TriggerRepo {
27
+
@required knot: string;
28
+
@required did: did;
29
+
@required repo: string;
30
+
@required defaultBranch: string;
31
+
}
32
+
33
+
model PushTriggerData {
34
+
@required ref: string;
35
+
36
+
@required
37
+
@minLength(40)
38
+
@maxLength(40)
39
+
newSha: string;
40
+
41
+
@required
42
+
@minLength(40)
43
+
@maxLength(40)
44
+
oldSha: string;
45
+
}
46
+
47
+
model PullRequestTriggerData {
48
+
@required sourceBranch: string;
49
+
@required targetBranch: string;
50
+
51
+
@required
52
+
@minLength(40)
53
+
@maxLength(40)
54
+
sourceSha: string;
55
+
56
+
@required action: string;
57
+
}
58
+
59
+
model ManualTriggerData {
60
+
inputs?: Pair[];
61
+
}
62
+
63
+
model Workflow {
64
+
@required name: string;
65
+
@required engine: string;
66
+
@required clone: CloneOpts;
67
+
@required raw: string;
68
+
}
69
+
70
+
model CloneOpts {
71
+
@required skip: boolean;
72
+
@required depth: integer;
73
+
@required submodules: boolean;
74
+
}
75
+
76
+
model Pair {
77
+
@required key: string;
78
+
@required value: string;
79
+
}
80
+
}
+41
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/repo/mergeCheck.tsp
+41
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/repo/mergeCheck.tsp
···
1
+
import "@typelex/emitter";
2
+
3
+
namespace sh.tangled.repo.mergeCheck {
4
+
/** Check if a merge is possible between two branches */
5
+
@procedure
6
+
op main(
7
+
input: {
8
+
/** DID of the repository owner */
9
+
@required did: did,
10
+
11
+
/** Name of the repository */
12
+
@required name: string,
13
+
14
+
/** Patch or pull request to check for merge conflicts */
15
+
@required patch: string,
16
+
17
+
/** Target branch to merge into */
18
+
@required branch: string,
19
+
}
20
+
): {
21
+
/** Whether the merge has conflicts */
22
+
@required is_conflicted: boolean;
23
+
24
+
/** List of files with merge conflicts */
25
+
conflicts?: ConflictInfo[];
26
+
27
+
/** Additional message about the merge check */
28
+
message?: string;
29
+
30
+
/** Error message if check failed */
31
+
error?: string;
32
+
};
33
+
34
+
model ConflictInfo {
35
+
/** Name of the conflicted file */
36
+
@required filename: string;
37
+
38
+
/** Reason for the conflict */
39
+
@required reason: string;
40
+
}
41
+
}
+16
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/repo/removeSecret.tsp
+16
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/repo/removeSecret.tsp
+80
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/repo/tree.tsp
+80
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/repo/tree.tsp
···
1
+
import "@typelex/emitter";
2
+
3
+
namespace sh.tangled.repo.tree {
4
+
@query
5
+
@errors(RepoNotFound, RefNotFound, PathNotFound, InvalidRequest)
6
+
op main(
7
+
/** Repository identifier in format 'did:plc:.../repoName' */
8
+
@required repo: string,
9
+
10
+
/** Git reference (branch, tag, or commit SHA) */
11
+
@required ref: string,
12
+
13
+
/** Path within the repository tree */
14
+
path?: string = "",
15
+
): {
16
+
/** The git reference used */
17
+
@required ref: string;
18
+
19
+
/** The parent path in the tree */
20
+
parent?: string;
21
+
22
+
/** Parent directory path */
23
+
dotdot?: string;
24
+
25
+
/** Readme for this file tree */
26
+
readme?: Readme;
27
+
28
+
@required files: TreeEntry[];
29
+
};
30
+
31
+
model Readme {
32
+
/** Name of the readme file */
33
+
@required filename: string;
34
+
35
+
/** Contents of the readme file */
36
+
@required contents: string;
37
+
}
38
+
39
+
model TreeEntry {
40
+
/** Relative file or directory name */
41
+
@required name: string;
42
+
43
+
/** File mode */
44
+
@required mode: string;
45
+
46
+
/** File size in bytes */
47
+
@required size: integer;
48
+
49
+
/** Whether this entry is a file */
50
+
@required is_file: boolean;
51
+
52
+
/** Whether this entry is a directory/subtree */
53
+
@required is_subtree: boolean;
54
+
55
+
last_commit?: LastCommit;
56
+
}
57
+
58
+
model LastCommit {
59
+
/** Commit hash */
60
+
@required hash: string;
61
+
62
+
/** Commit message */
63
+
@required message: string;
64
+
65
+
/** Commit timestamp */
66
+
@required when: datetime;
67
+
}
68
+
69
+
/** Repository not found or access denied */
70
+
model RepoNotFound {}
71
+
72
+
/** Git reference not found */
73
+
model RefNotFound {}
74
+
75
+
/** Path not found in repository tree */
76
+
model PathNotFound {}
77
+
78
+
/** Invalid request parameters */
79
+
model InvalidRequest {}
80
+
}
+8
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/spindle.tsp
+8
packages/emitter/test/integration/lexicon-examples/input/sh/tangled/spindle.tsp
-38
packages/emitter/test/integration/lexicon-examples/output/sh/tangled/string.json
-38
packages/emitter/test/integration/lexicon-examples/output/sh/tangled/string.json
···
1
-
{
2
-
"lexicon": 1,
3
-
"id": "sh.tangled.string",
4
-
"defs": {
5
-
"main": {
6
-
"type": "record",
7
-
"key": "tid",
8
-
"record": {
9
-
"type": "object",
10
-
"required": [
11
-
"filename",
12
-
"description",
13
-
"createdAt",
14
-
"contents"
15
-
],
16
-
"properties": {
17
-
"filename": {
18
-
"type": "string",
19
-
"maxGraphemes": 140,
20
-
"minGraphemes": 1
21
-
},
22
-
"description": {
23
-
"type": "string",
24
-
"maxGraphemes": 280
25
-
},
26
-
"createdAt": {
27
-
"type": "string",
28
-
"format": "datetime"
29
-
},
30
-
"contents": {
31
-
"type": "string",
32
-
"minGraphemes": 1
33
-
}
34
-
}
35
-
}
36
-
}
37
-
}
38
-
}