@kernhq/module-tracker 0.1.0 → 0.1.2
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/package.json +9 -5
- package/src/client/format.ts +1 -1
- package/src/client/group.ts +1 -1
- package/src/client/kql.ts +13 -5
- package/src/client/types.ts +1 -1
- package/src/contract/events.ts +94 -0
- package/src/contract/index.ts +5 -0
- package/src/contract/models.ts +1422 -0
- package/src/contract/notifications.ts +47 -0
- package/src/contract/permissions.ts +197 -0
- package/src/contract/router.ts +857 -0
- package/src/kql/ast.ts +136 -0
- package/src/kql/dates.ts +62 -0
- package/src/kql/fields.ts +150 -0
- package/src/kql/index.ts +15 -0
- package/src/kql/kql.test.ts +371 -0
- package/src/kql/lexer.ts +172 -0
- package/src/kql/parser.ts +300 -0
- package/src/kql/suggest.ts +102 -0
- package/src/kql/validate.ts +89 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { core } from '@kernhq/contracts'
|
|
2
|
+
|
|
3
|
+
/** Notification types emitted by the tracker (drives the user preference UI). */
|
|
4
|
+
export const trackerNotificationTypes: core.NotificationTypeDef[] = [
|
|
5
|
+
{
|
|
6
|
+
type: 'tracker.issue.assigned',
|
|
7
|
+
label: 'Issue assigned to you',
|
|
8
|
+
defaults: { inapp: true, push: true, email: true },
|
|
9
|
+
urgent: true,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
type: 'tracker.issue.mentioned',
|
|
13
|
+
label: 'Mentioned in an issue or comment',
|
|
14
|
+
defaults: { inapp: true, push: true, email: true },
|
|
15
|
+
urgent: true,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
type: 'tracker.issue.commented',
|
|
19
|
+
label: 'New comment on a watched issue',
|
|
20
|
+
defaults: { inapp: true, push: true, email: false },
|
|
21
|
+
urgent: false,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'tracker.issue.status_changed',
|
|
25
|
+
label: 'Status change on a watched issue',
|
|
26
|
+
defaults: { inapp: true, push: false, email: false },
|
|
27
|
+
urgent: false,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'tracker.issue.due_soon',
|
|
31
|
+
label: 'Issue due soon',
|
|
32
|
+
defaults: { inapp: true, push: true, email: true },
|
|
33
|
+
urgent: false,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'tracker.issue.approval_requested',
|
|
37
|
+
label: 'Your approval is requested',
|
|
38
|
+
defaults: { inapp: true, push: true, email: true },
|
|
39
|
+
urgent: true,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: 'tracker.cycle.ending',
|
|
43
|
+
label: 'Cycle ending soon',
|
|
44
|
+
defaults: { inapp: true, push: false, email: false },
|
|
45
|
+
urgent: false,
|
|
46
|
+
},
|
|
47
|
+
]
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { definePermissions } from '@kernhq/contracts'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Tracker permission keys. Bindings may be set at workspace scope (roles) or at project scope
|
|
5
|
+
* (per-project permission schemes via the kernel authz bindings API).
|
|
6
|
+
*/
|
|
7
|
+
export const trackerPermissions = definePermissions([
|
|
8
|
+
// projects
|
|
9
|
+
{
|
|
10
|
+
key: 'tracker.project.view',
|
|
11
|
+
label: 'View projects',
|
|
12
|
+
description: 'See projects and their configuration',
|
|
13
|
+
scope: 'project',
|
|
14
|
+
defaultRoles: ['owner', 'admin', 'member', 'guest'],
|
|
15
|
+
dangerous: false,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
key: 'tracker.project.create',
|
|
19
|
+
label: 'Create projects',
|
|
20
|
+
scope: 'workspace',
|
|
21
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
22
|
+
dangerous: false,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
key: 'tracker.project.manage',
|
|
26
|
+
label: 'Manage projects',
|
|
27
|
+
description: 'Edit project settings, members, components, labels and intake',
|
|
28
|
+
scope: 'project',
|
|
29
|
+
defaultRoles: ['owner', 'admin'],
|
|
30
|
+
dangerous: false,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
key: 'tracker.project.delete',
|
|
34
|
+
label: 'Delete projects',
|
|
35
|
+
scope: 'project',
|
|
36
|
+
defaultRoles: ['owner', 'admin'],
|
|
37
|
+
dangerous: true,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
// issues
|
|
41
|
+
{
|
|
42
|
+
key: 'tracker.issue.view',
|
|
43
|
+
label: 'View issues',
|
|
44
|
+
scope: 'project',
|
|
45
|
+
defaultRoles: ['owner', 'admin', 'member', 'guest'],
|
|
46
|
+
dangerous: false,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: 'tracker.issue.create',
|
|
50
|
+
label: 'Create issues',
|
|
51
|
+
scope: 'project',
|
|
52
|
+
defaultRoles: ['owner', 'admin', 'member', 'guest'],
|
|
53
|
+
dangerous: false,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'tracker.issue.edit',
|
|
57
|
+
label: 'Edit own issues',
|
|
58
|
+
description: 'Edit issues the user reported or is assigned to',
|
|
59
|
+
scope: 'project',
|
|
60
|
+
defaultRoles: ['owner', 'admin', 'member', 'guest'],
|
|
61
|
+
dangerous: false,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: 'tracker.issue.edit_any',
|
|
65
|
+
label: 'Edit any issue',
|
|
66
|
+
scope: 'project',
|
|
67
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
68
|
+
dangerous: false,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: 'tracker.issue.delete_any',
|
|
72
|
+
label: 'Delete issues',
|
|
73
|
+
scope: 'project',
|
|
74
|
+
defaultRoles: ['owner', 'admin'],
|
|
75
|
+
dangerous: true,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: 'tracker.issue.transition',
|
|
79
|
+
label: 'Transition issues',
|
|
80
|
+
description: 'Move issues through the workflow',
|
|
81
|
+
scope: 'project',
|
|
82
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
83
|
+
dangerous: false,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
key: 'tracker.issue.assign',
|
|
87
|
+
label: 'Assign issues',
|
|
88
|
+
scope: 'project',
|
|
89
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
90
|
+
dangerous: false,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: 'tracker.issue.manage_watchers',
|
|
94
|
+
label: 'Manage watchers',
|
|
95
|
+
description:
|
|
96
|
+
"Add or remove other people from an issue's watchers. Anyone who can see an issue can always watch or unwatch it themselves.",
|
|
97
|
+
scope: 'project',
|
|
98
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
99
|
+
dangerous: false,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: 'tracker.issue.comment',
|
|
103
|
+
label: 'Comment on issues',
|
|
104
|
+
scope: 'project',
|
|
105
|
+
defaultRoles: ['owner', 'admin', 'member', 'guest'],
|
|
106
|
+
dangerous: false,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: 'tracker.issue.bulk_edit',
|
|
110
|
+
label: 'Bulk edit issues',
|
|
111
|
+
scope: 'project',
|
|
112
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
113
|
+
dangerous: false,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: 'tracker.issue.archive',
|
|
117
|
+
label: 'Archive issues',
|
|
118
|
+
scope: 'project',
|
|
119
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
120
|
+
dangerous: false,
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
// planning & configuration
|
|
124
|
+
{
|
|
125
|
+
key: 'tracker.cycle.manage',
|
|
126
|
+
label: 'Manage cycles',
|
|
127
|
+
description: 'Create, start and complete cycles and milestones',
|
|
128
|
+
scope: 'project',
|
|
129
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
130
|
+
dangerous: false,
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
key: 'tracker.version.manage',
|
|
134
|
+
label: 'Manage versions',
|
|
135
|
+
description: 'Create and release versions',
|
|
136
|
+
scope: 'project',
|
|
137
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
138
|
+
dangerous: false,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
key: 'tracker.workflow.manage',
|
|
142
|
+
label: 'Manage workflows',
|
|
143
|
+
description: 'Edit workflows, workflow schemes and work item types',
|
|
144
|
+
scope: 'workspace',
|
|
145
|
+
defaultRoles: ['owner', 'admin'],
|
|
146
|
+
dangerous: false,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
key: 'tracker.field.manage',
|
|
150
|
+
label: 'Manage custom fields',
|
|
151
|
+
scope: 'workspace',
|
|
152
|
+
defaultRoles: ['owner', 'admin'],
|
|
153
|
+
dangerous: false,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
key: 'tracker.view.manage_shared',
|
|
157
|
+
label: 'Manage shared views',
|
|
158
|
+
description: 'Create and edit project/workspace visible views',
|
|
159
|
+
scope: 'project',
|
|
160
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
161
|
+
dangerous: false,
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
// time tracking
|
|
165
|
+
{
|
|
166
|
+
key: 'tracker.worklog.log',
|
|
167
|
+
label: 'Log work',
|
|
168
|
+
scope: 'project',
|
|
169
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
170
|
+
dangerous: false,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
key: 'tracker.worklog.edit_any',
|
|
174
|
+
label: 'Edit any worklog',
|
|
175
|
+
scope: 'project',
|
|
176
|
+
defaultRoles: ['owner', 'admin'],
|
|
177
|
+
dangerous: false,
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
// triage & import
|
|
181
|
+
{
|
|
182
|
+
key: 'tracker.triage.manage',
|
|
183
|
+
label: 'Manage triage',
|
|
184
|
+
description: 'Accept, decline and snooze triage items; configure intake',
|
|
185
|
+
scope: 'project',
|
|
186
|
+
defaultRoles: ['owner', 'admin', 'member'],
|
|
187
|
+
dangerous: false,
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
key: 'tracker.import.run',
|
|
191
|
+
label: 'Run imports',
|
|
192
|
+
description: 'Import issues from CSV, Jira or Linear',
|
|
193
|
+
scope: 'project',
|
|
194
|
+
defaultRoles: ['owner', 'admin'],
|
|
195
|
+
dangerous: true,
|
|
196
|
+
},
|
|
197
|
+
])
|