terse-cli 0.1.19 → 0.1.20
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/README.md +15 -0
- package/dist/api.d.ts +3 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +16 -6
- package/dist/api.js.map +1 -1
- package/dist/assertProjectRoot.d.ts +4 -1
- package/dist/assertProjectRoot.d.ts.map +1 -1
- package/dist/assertProjectRoot.js +3 -3
- package/dist/assertProjectRoot.js.map +1 -1
- package/dist/attach.d.ts +3 -0
- package/dist/attach.d.ts.map +1 -0
- package/dist/attach.js +61 -0
- package/dist/attach.js.map +1 -0
- package/dist/auth.d.ts +1 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +29 -18
- package/dist/auth.js.map +1 -1
- package/dist/deploy.d.ts +1 -1
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +35 -10
- package/dist/deploy.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +7 -39
- package/dist/generate.js.map +1 -1
- package/dist/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +11 -1
- package/dist/init.js.map +1 -1
- package/dist/loadJob.d.ts +2 -2
- package/dist/loadJob.d.ts.map +1 -1
- package/dist/loadJob.js +11 -5
- package/dist/loadJob.js.map +1 -1
- package/dist/promptErrors.d.ts +2 -0
- package/dist/promptErrors.d.ts.map +1 -0
- package/dist/promptErrors.js +8 -0
- package/dist/promptErrors.js.map +1 -0
- package/dist/providers/LanguageProvider.d.ts +8 -2
- package/dist/providers/LanguageProvider.d.ts.map +1 -1
- package/dist/providers/codegenTypes.d.ts +6 -16
- package/dist/providers/codegenTypes.d.ts.map +1 -1
- package/dist/providers/fetchSdkVersion.d.ts +4 -0
- package/dist/providers/fetchSdkVersion.d.ts.map +1 -0
- package/dist/providers/fetchSdkVersion.js +24 -0
- package/dist/providers/fetchSdkVersion.js.map +1 -0
- package/dist/providers/python/PythonProvider.d.ts +20 -2
- package/dist/providers/python/PythonProvider.d.ts.map +1 -1
- package/dist/providers/python/PythonProvider.js +65 -28
- package/dist/providers/python/PythonProvider.js.map +1 -1
- package/dist/providers/python/preparePythonCodegenData.d.ts +50 -0
- package/dist/providers/python/preparePythonCodegenData.d.ts.map +1 -1
- package/dist/providers/python/preparePythonCodegenData.js +100 -7
- package/dist/providers/python/preparePythonCodegenData.js.map +1 -1
- package/dist/providers/resolveProvider.js +2 -2
- package/dist/providers/resolveProvider.js.map +1 -1
- package/dist/providers/shared/entryFileGuidance.d.ts +10 -0
- package/dist/providers/shared/entryFileGuidance.d.ts.map +1 -0
- package/dist/providers/shared/entryFileGuidance.js +20 -0
- package/dist/providers/shared/entryFileGuidance.js.map +1 -0
- package/dist/providers/shared/sessionStream.d.ts +4 -11
- package/dist/providers/shared/sessionStream.d.ts.map +1 -1
- package/dist/providers/shared/sessionStream.js +13 -68
- package/dist/providers/shared/sessionStream.js.map +1 -1
- package/dist/providers/typescript/TypeScriptProvider.d.ts +9 -3
- package/dist/providers/typescript/TypeScriptProvider.d.ts.map +1 -1
- package/dist/providers/typescript/TypeScriptProvider.js +43 -22
- package/dist/providers/typescript/TypeScriptProvider.js.map +1 -1
- package/dist/providers/typescript/prepareCodegenData.d.ts +1 -11
- package/dist/providers/typescript/prepareCodegenData.d.ts.map +1 -1
- package/dist/providers/typescript/prepareCodegenData.js +47 -50
- package/dist/providers/typescript/prepareCodegenData.js.map +1 -1
- package/dist/run.d.ts +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +8 -8
- package/dist/run.js.map +1 -1
- package/dist/test.d.ts +1 -1
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +26 -14
- package/dist/test.js.map +1 -1
- package/dist/util.d.ts +2 -3
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +3 -3
- package/dist/util.js.map +1 -1
- package/package.json +3 -3
- package/templates/python/codegen/generated.hbs +5 -0
- package/templates/python/codegen/partials/github-section.hbs +149 -0
- package/templates/python/codegen/partials/gmail-section.hbs +30 -0
- package/templates/python/codegen/partials/linear-section.hbs +229 -0
- package/templates/python/codegen/partials/schedule-section.hbs +8 -2
- package/templates/python/codegen/partials/slack-section.hbs +110 -22
- package/templates/python/codegen/partials/webhook-section.hbs +15 -0
- package/templates/python/codegen/partials/workos-section.hbs +149 -0
- package/templates/python/init/README.md.hbs +5 -3
- package/templates/python/init/src/main.py.hbs +10 -13
- package/templates/typescript/codegen/generated.hbs +0 -2
- package/templates/typescript/codegen/partials/github-section.hbs +16 -12
- package/templates/typescript/codegen/partials/gmail-section.hbs +2 -2
- package/templates/typescript/codegen/partials/linear-section.hbs +19 -13
- package/templates/typescript/codegen/partials/slack-section.hbs +15 -7
- package/templates/typescript/codegen/partials/system-section.hbs +4 -4
- package/templates/typescript/codegen/partials/workos-section.hbs +34 -22
- package/templates/typescript/init/package.json.hbs +1 -1
- package/templates/typescript/init/src/{index.ts.hbs → terse.jobs.ts.hbs} +2 -2
- package/templates/typescript/codegen/partials/atlassian-section.hbs +0 -32
- package/templates/typescript/codegen/partials/figma-section.hbs +0 -13
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{{~#if github}}
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# === GitHub ===
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class GitHubOwner(BaseModel):
|
|
8
|
+
model_config = ConfigDict(frozen=True)
|
|
9
|
+
name: str
|
|
10
|
+
{{#if github.owners.length}}
|
|
11
|
+
{{#each github.owners}}
|
|
12
|
+
{{staticName}}: ClassVar["GitHubOwner"]
|
|
13
|
+
{{/each}}
|
|
14
|
+
{{#each github.owners}}
|
|
15
|
+
|
|
16
|
+
GitHubOwner.{{staticName}} = GitHubOwner(name={{{nameRepr}}})
|
|
17
|
+
{{/each}}
|
|
18
|
+
{{/if}}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class GitHubRepo(BaseModel):
|
|
22
|
+
model_config = ConfigDict(frozen=True)
|
|
23
|
+
repository_id: int
|
|
24
|
+
name: str
|
|
25
|
+
owner: GitHubOwner
|
|
26
|
+
full_name: str
|
|
27
|
+
{{#each github.repoGroups}}
|
|
28
|
+
{{#each repos}}
|
|
29
|
+
{{staticName}}: ClassVar["GitHubRepo"]
|
|
30
|
+
{{/each}}
|
|
31
|
+
{{/each}}
|
|
32
|
+
{{#each github.repoGroups}}
|
|
33
|
+
{{#each repos}}
|
|
34
|
+
|
|
35
|
+
GitHubRepo.{{staticName}} = GitHubRepo(
|
|
36
|
+
repository_id={{{repositoryId}}},
|
|
37
|
+
name={{{nameRepr}}},
|
|
38
|
+
owner=GitHubOwner.{{ownerStaticName}},
|
|
39
|
+
full_name={{{fullNameRepr}}},
|
|
40
|
+
)
|
|
41
|
+
{{/each}}
|
|
42
|
+
{{/each}}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class GitHub:
|
|
46
|
+
@staticmethod
|
|
47
|
+
def on_push(*, repo: GitHubRepo) -> TriggerConfig[GithubPushTrigger]:
|
|
48
|
+
return TriggerConfig(
|
|
49
|
+
integration_id={{{github.instanceIdRepr}}},
|
|
50
|
+
integration_type='github',
|
|
51
|
+
config_type='github',
|
|
52
|
+
config=_compact_dict(
|
|
53
|
+
repositoryIds=[repo.repository_id],
|
|
54
|
+
eventTypes=[GitHubEventType.push],
|
|
55
|
+
),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
@staticmethod
|
|
59
|
+
def on_pr_opened(*, repo: GitHubRepo) -> TriggerConfig[GithubPROpenedTrigger]:
|
|
60
|
+
return TriggerConfig(
|
|
61
|
+
integration_id={{{github.instanceIdRepr}}},
|
|
62
|
+
integration_type='github',
|
|
63
|
+
config_type='github',
|
|
64
|
+
config=_compact_dict(
|
|
65
|
+
repositoryIds=[repo.repository_id],
|
|
66
|
+
eventTypes=[GitHubEventType.pull_request_opened],
|
|
67
|
+
),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
@staticmethod
|
|
71
|
+
def on_pr_merged(*, repo: GitHubRepo) -> TriggerConfig[GithubPRMergedTrigger]:
|
|
72
|
+
return TriggerConfig(
|
|
73
|
+
integration_id={{{github.instanceIdRepr}}},
|
|
74
|
+
integration_type='github',
|
|
75
|
+
config_type='github',
|
|
76
|
+
config=_compact_dict(
|
|
77
|
+
repositoryIds=[repo.repository_id],
|
|
78
|
+
eventTypes=[GitHubEventType.pull_request_merged],
|
|
79
|
+
),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
@staticmethod
|
|
83
|
+
def on_pr_closed(*, repo: GitHubRepo) -> TriggerConfig[GithubPRClosedTrigger]:
|
|
84
|
+
return TriggerConfig(
|
|
85
|
+
integration_id={{{github.instanceIdRepr}}},
|
|
86
|
+
integration_type='github',
|
|
87
|
+
config_type='github',
|
|
88
|
+
config=_compact_dict(
|
|
89
|
+
repositoryIds=[repo.repository_id],
|
|
90
|
+
eventTypes=[GitHubEventType.pull_request_closed],
|
|
91
|
+
),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
@staticmethod
|
|
95
|
+
def on_pr_synchronized(*, repo: GitHubRepo) -> TriggerConfig[GithubPRSynchronizedTrigger]:
|
|
96
|
+
return TriggerConfig(
|
|
97
|
+
integration_id={{{github.instanceIdRepr}}},
|
|
98
|
+
integration_type='github',
|
|
99
|
+
config_type='github',
|
|
100
|
+
config=_compact_dict(
|
|
101
|
+
repositoryIds=[repo.repository_id],
|
|
102
|
+
eventTypes=[GitHubEventType.pull_request_synchronize],
|
|
103
|
+
),
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
@staticmethod
|
|
107
|
+
def on_pr(*, repo: GitHubRepo) -> TriggerConfig[GithubPRTrigger]:
|
|
108
|
+
return TriggerConfig(
|
|
109
|
+
integration_id={{{github.instanceIdRepr}}},
|
|
110
|
+
integration_type='github',
|
|
111
|
+
config_type='github',
|
|
112
|
+
config=_compact_dict(
|
|
113
|
+
repositoryIds=[repo.repository_id],
|
|
114
|
+
eventTypes=[
|
|
115
|
+
GitHubEventType.pull_request_opened,
|
|
116
|
+
GitHubEventType.pull_request_merged,
|
|
117
|
+
GitHubEventType.pull_request_closed,
|
|
118
|
+
GitHubEventType.pull_request_synchronize,
|
|
119
|
+
],
|
|
120
|
+
),
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
@staticmethod
|
|
124
|
+
def trigger(
|
|
125
|
+
*,
|
|
126
|
+
repos: Sequence[GitHubRepo],
|
|
127
|
+
event_types: Sequence[GitHubEventType] | None = None,
|
|
128
|
+
) -> TriggerConfig[GithubTrigger]:
|
|
129
|
+
return TriggerConfig(
|
|
130
|
+
integration_id={{{github.instanceIdRepr}}},
|
|
131
|
+
integration_type='github',
|
|
132
|
+
config_type='github',
|
|
133
|
+
config=_compact_dict(
|
|
134
|
+
repositoryIds=[repo.repository_id for repo in repos],
|
|
135
|
+
eventTypes=list(event_types) if event_types is not None else None,
|
|
136
|
+
),
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
@staticmethod
|
|
140
|
+
def skill(*, repos: Sequence[GitHubRepo]) -> SkillConfig[str]:
|
|
141
|
+
return SkillConfig(
|
|
142
|
+
integration_id={{{github.instanceIdRepr}}},
|
|
143
|
+
integration_type='github',
|
|
144
|
+
config_type='github',
|
|
145
|
+
config=_compact_dict(
|
|
146
|
+
repositoryIds=[repo.repository_id for repo in repos],
|
|
147
|
+
),
|
|
148
|
+
)
|
|
149
|
+
{{~/if}}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{{~#if gmail}}
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# === Gmail ===
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Gmail:
|
|
8
|
+
@staticmethod
|
|
9
|
+
def on_email() -> TriggerConfig[GmailTrigger]:
|
|
10
|
+
return TriggerConfig(
|
|
11
|
+
integration_id={{{gmail.instanceIdRepr}}},
|
|
12
|
+
integration_type='gmail',
|
|
13
|
+
config_type='gmail',
|
|
14
|
+
config=_compact_dict(eventTypes=[GmailEventType.email_received]),
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
@staticmethod
|
|
18
|
+
def trigger(
|
|
19
|
+
*,
|
|
20
|
+
event_types: Sequence[GmailEventType] | None = None,
|
|
21
|
+
) -> TriggerConfig[GmailTrigger]:
|
|
22
|
+
return TriggerConfig(
|
|
23
|
+
integration_id={{{gmail.instanceIdRepr}}},
|
|
24
|
+
integration_type='gmail',
|
|
25
|
+
config_type='gmail',
|
|
26
|
+
config=_compact_dict(
|
|
27
|
+
eventTypes=list(event_types) if event_types is not None else None,
|
|
28
|
+
),
|
|
29
|
+
)
|
|
30
|
+
{{~/if}}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
{{~#if linear}}
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# === Linear ===
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class LinearTeam(BaseModel):
|
|
8
|
+
model_config = ConfigDict(frozen=True)
|
|
9
|
+
team_id: str
|
|
10
|
+
name: str
|
|
11
|
+
key: str
|
|
12
|
+
{{#if linear.teams.length}}
|
|
13
|
+
{{#each linear.teams}}
|
|
14
|
+
{{staticName}}: ClassVar["LinearTeam"]
|
|
15
|
+
{{/each}}
|
|
16
|
+
{{#each linear.teams}}
|
|
17
|
+
|
|
18
|
+
LinearTeam.{{staticName}} = LinearTeam(team_id={{{teamIdRepr}}}, name={{{nameRepr}}}, key={{{keyRepr}}})
|
|
19
|
+
{{/each}}
|
|
20
|
+
{{/if}}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class LinearProject(BaseModel):
|
|
24
|
+
model_config = ConfigDict(frozen=True)
|
|
25
|
+
project_id: str
|
|
26
|
+
name: str
|
|
27
|
+
{{#if linear.projects.length}}
|
|
28
|
+
{{#each linear.projects}}
|
|
29
|
+
{{staticName}}: ClassVar["LinearProject"]
|
|
30
|
+
{{/each}}
|
|
31
|
+
{{#each linear.projects}}
|
|
32
|
+
|
|
33
|
+
LinearProject.{{staticName}} = LinearProject(project_id={{{projectIdRepr}}}, name={{{nameRepr}}})
|
|
34
|
+
{{/each}}
|
|
35
|
+
{{/if}}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Linear:
|
|
39
|
+
@staticmethod
|
|
40
|
+
def on_issue_created(
|
|
41
|
+
*,
|
|
42
|
+
team: LinearTeam | None = None,
|
|
43
|
+
project: LinearProject | None = None,
|
|
44
|
+
) -> TriggerConfig[LinearIssueCreatedTrigger]:
|
|
45
|
+
return TriggerConfig(
|
|
46
|
+
integration_id={{{linear.instanceIdRepr}}},
|
|
47
|
+
integration_type='linear',
|
|
48
|
+
config_type='linear_input',
|
|
49
|
+
config=_compact_dict(
|
|
50
|
+
teamId=team.team_id if team is not None else None,
|
|
51
|
+
projectId=project.project_id if project is not None else None,
|
|
52
|
+
eventTypes=[LinearEventType.issue_created],
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
@staticmethod
|
|
57
|
+
def on_issue_updated(
|
|
58
|
+
*,
|
|
59
|
+
team: LinearTeam | None = None,
|
|
60
|
+
project: LinearProject | None = None,
|
|
61
|
+
) -> TriggerConfig[LinearIssueUpdatedTrigger]:
|
|
62
|
+
return TriggerConfig(
|
|
63
|
+
integration_id={{{linear.instanceIdRepr}}},
|
|
64
|
+
integration_type='linear',
|
|
65
|
+
config_type='linear_input',
|
|
66
|
+
config=_compact_dict(
|
|
67
|
+
teamId=team.team_id if team is not None else None,
|
|
68
|
+
projectId=project.project_id if project is not None else None,
|
|
69
|
+
eventTypes=[LinearEventType.issue_updated],
|
|
70
|
+
),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
@staticmethod
|
|
74
|
+
def on_comment(
|
|
75
|
+
*,
|
|
76
|
+
team: LinearTeam | None = None,
|
|
77
|
+
project: LinearProject | None = None,
|
|
78
|
+
) -> TriggerConfig[LinearCommentCreatedTrigger]:
|
|
79
|
+
return TriggerConfig(
|
|
80
|
+
integration_id={{{linear.instanceIdRepr}}},
|
|
81
|
+
integration_type='linear',
|
|
82
|
+
config_type='linear_input',
|
|
83
|
+
config=_compact_dict(
|
|
84
|
+
teamId=team.team_id if team is not None else None,
|
|
85
|
+
projectId=project.project_id if project is not None else None,
|
|
86
|
+
eventTypes=[LinearEventType.comment_created],
|
|
87
|
+
),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
@staticmethod
|
|
91
|
+
def trigger(
|
|
92
|
+
*,
|
|
93
|
+
team: LinearTeam | None = None,
|
|
94
|
+
project: LinearProject | None = None,
|
|
95
|
+
event_types: Sequence[LinearEventType] | None = None,
|
|
96
|
+
) -> TriggerConfig[LinearTrigger]:
|
|
97
|
+
return TriggerConfig(
|
|
98
|
+
integration_id={{{linear.instanceIdRepr}}},
|
|
99
|
+
integration_type='linear',
|
|
100
|
+
config_type='linear_input',
|
|
101
|
+
config=_compact_dict(
|
|
102
|
+
teamId=team.team_id if team is not None else None,
|
|
103
|
+
projectId=project.project_id if project is not None else None,
|
|
104
|
+
eventTypes=list(event_types) if event_types is not None else None,
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
@staticmethod
|
|
109
|
+
def skill(
|
|
110
|
+
*,
|
|
111
|
+
team: LinearTeam | None = None,
|
|
112
|
+
project: LinearProject | None = None,
|
|
113
|
+
) -> SkillConfig[str]:
|
|
114
|
+
return SkillConfig(
|
|
115
|
+
integration_id={{{linear.instanceIdRepr}}},
|
|
116
|
+
integration_type='linear',
|
|
117
|
+
config_type='linear_output',
|
|
118
|
+
config=_compact_dict(
|
|
119
|
+
teamId=team.team_id if team is not None else None,
|
|
120
|
+
teamName=team.name if team is not None else None,
|
|
121
|
+
projectId=project.project_id if project is not None else None,
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
{{~else}}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# === Linear ===
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
class LinearTeam:
|
|
131
|
+
def __init__(self, team_id: str, name: str, key: str) -> None:
|
|
132
|
+
self.team_id = team_id
|
|
133
|
+
self.name = name
|
|
134
|
+
self.key = key
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class LinearProject:
|
|
138
|
+
def __init__(self, project_id: str, name: str) -> None:
|
|
139
|
+
self.project_id = project_id
|
|
140
|
+
self.name = name
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class Linear:
|
|
144
|
+
@staticmethod
|
|
145
|
+
def on_issue_created(
|
|
146
|
+
*,
|
|
147
|
+
team: LinearTeam | None = None,
|
|
148
|
+
project: LinearProject | None = None,
|
|
149
|
+
) -> TriggerConfig[LinearIssueCreatedTrigger]:
|
|
150
|
+
return TriggerConfig(
|
|
151
|
+
integration_id='linear_placeholder',
|
|
152
|
+
integration_type='linear',
|
|
153
|
+
config_type='linear_input',
|
|
154
|
+
config=_compact_dict(
|
|
155
|
+
teamId=team.team_id if team is not None else None,
|
|
156
|
+
projectId=project.project_id if project is not None else None,
|
|
157
|
+
eventTypes=[LinearEventType.issue_created],
|
|
158
|
+
),
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
@staticmethod
|
|
162
|
+
def on_issue_updated(
|
|
163
|
+
*,
|
|
164
|
+
team: LinearTeam | None = None,
|
|
165
|
+
project: LinearProject | None = None,
|
|
166
|
+
) -> TriggerConfig[LinearIssueUpdatedTrigger]:
|
|
167
|
+
return TriggerConfig(
|
|
168
|
+
integration_id='linear_placeholder',
|
|
169
|
+
integration_type='linear',
|
|
170
|
+
config_type='linear_input',
|
|
171
|
+
config=_compact_dict(
|
|
172
|
+
teamId=team.team_id if team is not None else None,
|
|
173
|
+
projectId=project.project_id if project is not None else None,
|
|
174
|
+
eventTypes=[LinearEventType.issue_updated],
|
|
175
|
+
),
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
@staticmethod
|
|
179
|
+
def on_comment(
|
|
180
|
+
*,
|
|
181
|
+
team: LinearTeam | None = None,
|
|
182
|
+
project: LinearProject | None = None,
|
|
183
|
+
) -> TriggerConfig[LinearCommentCreatedTrigger]:
|
|
184
|
+
return TriggerConfig(
|
|
185
|
+
integration_id='linear_placeholder',
|
|
186
|
+
integration_type='linear',
|
|
187
|
+
config_type='linear_input',
|
|
188
|
+
config=_compact_dict(
|
|
189
|
+
teamId=team.team_id if team is not None else None,
|
|
190
|
+
projectId=project.project_id if project is not None else None,
|
|
191
|
+
eventTypes=[LinearEventType.comment_created],
|
|
192
|
+
),
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
@staticmethod
|
|
196
|
+
def trigger(
|
|
197
|
+
*,
|
|
198
|
+
team: LinearTeam | None = None,
|
|
199
|
+
project: LinearProject | None = None,
|
|
200
|
+
event_types: list[LinearEventType] | None = None,
|
|
201
|
+
) -> TriggerConfig[LinearTrigger]:
|
|
202
|
+
return TriggerConfig(
|
|
203
|
+
integration_id='linear_placeholder',
|
|
204
|
+
integration_type='linear',
|
|
205
|
+
config_type='linear_input',
|
|
206
|
+
config=_compact_dict(
|
|
207
|
+
teamId=team.team_id if team is not None else None,
|
|
208
|
+
projectId=project.project_id if project is not None else None,
|
|
209
|
+
eventTypes=list(event_types) if event_types is not None else None,
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
@staticmethod
|
|
214
|
+
def skill(
|
|
215
|
+
*,
|
|
216
|
+
team: LinearTeam | None = None,
|
|
217
|
+
project: LinearProject | None = None,
|
|
218
|
+
) -> SkillConfig[str]:
|
|
219
|
+
return SkillConfig(
|
|
220
|
+
integration_id='linear_placeholder',
|
|
221
|
+
integration_type='linear',
|
|
222
|
+
config_type='linear_output',
|
|
223
|
+
config=_compact_dict(
|
|
224
|
+
teamId=team.team_id if team is not None else None,
|
|
225
|
+
teamName=team.name if team is not None else None,
|
|
226
|
+
projectId=project.project_id if project is not None else None,
|
|
227
|
+
),
|
|
228
|
+
)
|
|
229
|
+
{{~/if}}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
# === Schedule ===
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Schedule:
|
|
7
8
|
@staticmethod
|
|
8
|
-
def cron(expression: str) -> TriggerConfig:
|
|
9
|
-
return TriggerConfig(
|
|
9
|
+
def cron(expression: str) -> TriggerConfig[CronTrigger]:
|
|
10
|
+
return TriggerConfig(
|
|
11
|
+
integration_id='system',
|
|
12
|
+
integration_type='cron_job',
|
|
13
|
+
config_type='time_trigger',
|
|
14
|
+
config=_compact_dict(cronExpression=expression),
|
|
15
|
+
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{{
|
|
1
|
+
{{~#if slack}}
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
# === Slack ===
|
|
@@ -12,8 +12,8 @@ class SlackChannel(BaseModel):
|
|
|
12
12
|
{{#each slack.channels}}
|
|
13
13
|
{{staticName}}: ClassVar["SlackChannel"]
|
|
14
14
|
{{/each}}
|
|
15
|
-
|
|
16
15
|
{{#each slack.channels}}
|
|
16
|
+
|
|
17
17
|
SlackChannel.{{staticName}} = SlackChannel(channel_id={{{channelIdRepr}}}, name={{{nameRepr}}})
|
|
18
18
|
{{/each}}
|
|
19
19
|
{{/if}}
|
|
@@ -21,7 +21,11 @@ SlackChannel.{{staticName}} = SlackChannel(channel_id={{{channelIdRepr}}}, name=
|
|
|
21
21
|
|
|
22
22
|
class Slack:
|
|
23
23
|
@staticmethod
|
|
24
|
-
def on_message(
|
|
24
|
+
def on_message(
|
|
25
|
+
channel: SlackChannel,
|
|
26
|
+
*,
|
|
27
|
+
user_ids: Sequence[str] | None = None,
|
|
28
|
+
) -> TriggerConfig[SlackMessageTrigger]:
|
|
25
29
|
return TriggerConfig(
|
|
26
30
|
integration_id={{{slack.instanceIdRepr}}},
|
|
27
31
|
integration_type='slack',
|
|
@@ -31,13 +35,13 @@ class Slack:
|
|
|
31
35
|
channelId=channel.channel_id,
|
|
32
36
|
channelName=channel.name,
|
|
33
37
|
listenToUserDms=False,
|
|
34
|
-
userIds=list(user_ids) if user_ids is not None else
|
|
38
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
35
39
|
eventTypes=['message'],
|
|
36
40
|
),
|
|
37
41
|
)
|
|
38
42
|
|
|
39
43
|
@staticmethod
|
|
40
|
-
def on_dm(*, user_ids: Sequence[str] | None = None) -> TriggerConfig:
|
|
44
|
+
def on_dm(*, user_ids: Sequence[str] | None = None) -> TriggerConfig[SlackMessageTrigger]:
|
|
41
45
|
return TriggerConfig(
|
|
42
46
|
integration_id={{{slack.instanceIdRepr}}},
|
|
43
47
|
integration_type='slack',
|
|
@@ -45,11 +49,51 @@ class Slack:
|
|
|
45
49
|
config_type='slack',
|
|
46
50
|
config=_compact_dict(
|
|
47
51
|
listenToUserDms=True,
|
|
48
|
-
userIds=list(user_ids) if user_ids is not None else
|
|
52
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
49
53
|
eventTypes=['message'],
|
|
50
54
|
),
|
|
51
55
|
)
|
|
52
56
|
|
|
57
|
+
@staticmethod
|
|
58
|
+
def on_app_mention(
|
|
59
|
+
channel: SlackChannel,
|
|
60
|
+
*,
|
|
61
|
+
user_ids: Sequence[str] | None = None,
|
|
62
|
+
) -> TriggerConfig[SlackAppMentionTrigger]:
|
|
63
|
+
return TriggerConfig(
|
|
64
|
+
integration_id={{{slack.instanceIdRepr}}},
|
|
65
|
+
integration_type='slack',
|
|
66
|
+
event_type='app_mention',
|
|
67
|
+
config_type='slack',
|
|
68
|
+
config=_compact_dict(
|
|
69
|
+
channelId=channel.channel_id,
|
|
70
|
+
channelName=channel.name,
|
|
71
|
+
listenToUserDms=False,
|
|
72
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
73
|
+
eventTypes=[SlackEventType.app_mention],
|
|
74
|
+
),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
@staticmethod
|
|
78
|
+
def on_reaction_added(
|
|
79
|
+
channel: SlackChannel,
|
|
80
|
+
*,
|
|
81
|
+
user_ids: Sequence[str] | None = None,
|
|
82
|
+
) -> TriggerConfig[SlackReactionAddedTrigger]:
|
|
83
|
+
return TriggerConfig(
|
|
84
|
+
integration_id={{{slack.instanceIdRepr}}},
|
|
85
|
+
integration_type='slack',
|
|
86
|
+
event_type='reaction_added',
|
|
87
|
+
config_type='slack',
|
|
88
|
+
config=_compact_dict(
|
|
89
|
+
channelId=channel.channel_id,
|
|
90
|
+
channelName=channel.name,
|
|
91
|
+
listenToUserDms=False,
|
|
92
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
93
|
+
eventTypes=[SlackEventType.reaction_added],
|
|
94
|
+
),
|
|
95
|
+
)
|
|
96
|
+
|
|
53
97
|
@staticmethod
|
|
54
98
|
def trigger(
|
|
55
99
|
*,
|
|
@@ -57,7 +101,7 @@ class Slack:
|
|
|
57
101
|
listen_to_user_dms: bool | None = None,
|
|
58
102
|
user_ids: Sequence[str] | None = None,
|
|
59
103
|
event_types: Sequence[SlackEventType] | None = None,
|
|
60
|
-
) -> TriggerConfig:
|
|
104
|
+
) -> TriggerConfig[SlackTrigger]:
|
|
61
105
|
return TriggerConfig(
|
|
62
106
|
integration_id={{{slack.instanceIdRepr}}},
|
|
63
107
|
integration_type='slack',
|
|
@@ -66,7 +110,7 @@ class Slack:
|
|
|
66
110
|
channelId=channel.channel_id if channel is not None else None,
|
|
67
111
|
channelName=channel.name if channel is not None else None,
|
|
68
112
|
listenToUserDms=listen_to_user_dms,
|
|
69
|
-
userIds=list(user_ids) if user_ids is not None else
|
|
113
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
70
114
|
eventTypes=list(event_types) if event_types is not None else None,
|
|
71
115
|
),
|
|
72
116
|
)
|
|
@@ -75,9 +119,9 @@ class Slack:
|
|
|
75
119
|
def skill(
|
|
76
120
|
*,
|
|
77
121
|
channel: SlackChannel | None = None,
|
|
78
|
-
user_ids: Sequence[str] | None =
|
|
79
|
-
user_names: Sequence[str] | None =
|
|
80
|
-
listen_to_user_dms: bool | None =
|
|
122
|
+
user_ids: Sequence[str] | None = [],
|
|
123
|
+
user_names: Sequence[str] | None = [],
|
|
124
|
+
listen_to_user_dms: bool | None = False,
|
|
81
125
|
) -> SkillConfig[{{slack.skillToolType}}]:
|
|
82
126
|
return SkillConfig(
|
|
83
127
|
integration_id={{{slack.instanceIdRepr}}},
|
|
@@ -86,12 +130,12 @@ class Slack:
|
|
|
86
130
|
config=_compact_dict(
|
|
87
131
|
channelId=channel.channel_id if channel is not None else None,
|
|
88
132
|
channelName=channel.name if channel is not None else None,
|
|
89
|
-
userIds=list(user_ids) if user_ids is not None else
|
|
133
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
90
134
|
userNames=list(user_names) if user_names is not None else None,
|
|
91
135
|
listenToUserDms=listen_to_user_dms,
|
|
92
136
|
),
|
|
93
137
|
)
|
|
94
|
-
{{else}}
|
|
138
|
+
{{~else}}
|
|
95
139
|
|
|
96
140
|
|
|
97
141
|
# === Slack ===
|
|
@@ -105,7 +149,11 @@ class SlackChannel:
|
|
|
105
149
|
|
|
106
150
|
class Slack:
|
|
107
151
|
@staticmethod
|
|
108
|
-
def on_message(
|
|
152
|
+
def on_message(
|
|
153
|
+
channel: SlackChannel,
|
|
154
|
+
*,
|
|
155
|
+
user_ids: list[str] | None = None,
|
|
156
|
+
) -> TriggerConfig[SlackMessageTrigger]:
|
|
109
157
|
return TriggerConfig(
|
|
110
158
|
integration_id='slack_placeholder',
|
|
111
159
|
integration_type='slack',
|
|
@@ -115,13 +163,13 @@ class Slack:
|
|
|
115
163
|
channelId=channel.channel_id,
|
|
116
164
|
channelName=channel.name,
|
|
117
165
|
listenToUserDms=False,
|
|
118
|
-
userIds=list(user_ids) if user_ids is not None else
|
|
166
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
119
167
|
eventTypes=['message'],
|
|
120
168
|
),
|
|
121
169
|
)
|
|
122
170
|
|
|
123
171
|
@staticmethod
|
|
124
|
-
def on_dm(*, user_ids: list[str] | None = None) -> TriggerConfig:
|
|
172
|
+
def on_dm(*, user_ids: list[str] | None = None) -> TriggerConfig[SlackMessageTrigger]:
|
|
125
173
|
return TriggerConfig(
|
|
126
174
|
integration_id='slack_placeholder',
|
|
127
175
|
integration_type='slack',
|
|
@@ -129,11 +177,51 @@ class Slack:
|
|
|
129
177
|
config_type='slack',
|
|
130
178
|
config=_compact_dict(
|
|
131
179
|
listenToUserDms=True,
|
|
132
|
-
userIds=list(user_ids) if user_ids is not None else
|
|
180
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
133
181
|
eventTypes=['message'],
|
|
134
182
|
),
|
|
135
183
|
)
|
|
136
184
|
|
|
185
|
+
@staticmethod
|
|
186
|
+
def on_app_mention(
|
|
187
|
+
channel: SlackChannel,
|
|
188
|
+
*,
|
|
189
|
+
user_ids: list[str] | None = None,
|
|
190
|
+
) -> TriggerConfig[SlackAppMentionTrigger]:
|
|
191
|
+
return TriggerConfig(
|
|
192
|
+
integration_id='slack_placeholder',
|
|
193
|
+
integration_type='slack',
|
|
194
|
+
event_type='app_mention',
|
|
195
|
+
config_type='slack',
|
|
196
|
+
config=_compact_dict(
|
|
197
|
+
channelId=channel.channel_id,
|
|
198
|
+
channelName=channel.name,
|
|
199
|
+
listenToUserDms=False,
|
|
200
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
201
|
+
eventTypes=[SlackEventType.app_mention],
|
|
202
|
+
),
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
@staticmethod
|
|
206
|
+
def on_reaction_added(
|
|
207
|
+
channel: SlackChannel,
|
|
208
|
+
*,
|
|
209
|
+
user_ids: list[str] | None = None,
|
|
210
|
+
) -> TriggerConfig[SlackReactionAddedTrigger]:
|
|
211
|
+
return TriggerConfig(
|
|
212
|
+
integration_id='slack_placeholder',
|
|
213
|
+
integration_type='slack',
|
|
214
|
+
event_type='reaction_added',
|
|
215
|
+
config_type='slack',
|
|
216
|
+
config=_compact_dict(
|
|
217
|
+
channelId=channel.channel_id,
|
|
218
|
+
channelName=channel.name,
|
|
219
|
+
listenToUserDms=False,
|
|
220
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
221
|
+
eventTypes=[SlackEventType.reaction_added],
|
|
222
|
+
),
|
|
223
|
+
)
|
|
224
|
+
|
|
137
225
|
@staticmethod
|
|
138
226
|
def trigger(
|
|
139
227
|
*,
|
|
@@ -141,7 +229,7 @@ class Slack:
|
|
|
141
229
|
listen_to_user_dms: bool | None = None,
|
|
142
230
|
user_ids: list[str] | None = None,
|
|
143
231
|
event_types: list[str] | None = None,
|
|
144
|
-
) -> TriggerConfig:
|
|
232
|
+
) -> TriggerConfig[SlackTrigger]:
|
|
145
233
|
return TriggerConfig(
|
|
146
234
|
integration_id='slack_placeholder',
|
|
147
235
|
integration_type='slack',
|
|
@@ -150,7 +238,7 @@ class Slack:
|
|
|
150
238
|
channelId=channel.channel_id if channel is not None else None,
|
|
151
239
|
channelName=channel.name if channel is not None else None,
|
|
152
240
|
listenToUserDms=listen_to_user_dms,
|
|
153
|
-
userIds=list(user_ids) if user_ids is not None else
|
|
241
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
154
242
|
eventTypes=list(event_types) if event_types is not None else None,
|
|
155
243
|
),
|
|
156
244
|
)
|
|
@@ -170,9 +258,9 @@ class Slack:
|
|
|
170
258
|
config=_compact_dict(
|
|
171
259
|
channelId=channel.channel_id if channel is not None else None,
|
|
172
260
|
channelName=channel.name if channel is not None else None,
|
|
173
|
-
userIds=list(user_ids) if user_ids is not None else
|
|
174
|
-
userNames=list(user_names) if user_names is not None else
|
|
261
|
+
userIds=list(user_ids) if user_ids is not None else [],
|
|
262
|
+
userNames=list(user_names) if user_names is not None else [],
|
|
175
263
|
listenToUserDms=listen_to_user_dms,
|
|
176
264
|
),
|
|
177
265
|
)
|
|
178
|
-
{{
|
|
266
|
+
{{~/if}}
|