@kernhq/module-tracker 0.1.1 → 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 +4 -2
- package/src/client/api.ts +1 -1
- package/src/client/format.ts +1 -1
- package/src/client/group.ts +1 -1
- package/src/client/kql.ts +4 -4
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernhq/module-tracker",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Kern tracker module: projects, work item types, custom fields, workflows, issues, KQL, cycles, views, reports, intake, time tracking (server + client skeleton)",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"migrations",
|
|
18
|
-
"src/client"
|
|
18
|
+
"src/client",
|
|
19
|
+
"src/contract",
|
|
20
|
+
"src/kql"
|
|
19
21
|
],
|
|
20
22
|
"exports": {
|
|
21
23
|
"./contract": {
|
package/src/client/api.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { TrackerContract } from '@kernhq/module-tracker/contract'
|
|
2
1
|
import { createModuleClient, type KernClientOptions } from '@kernhq/sdk'
|
|
3
2
|
import type { ContractRouterClient } from '@orpc/contract'
|
|
3
|
+
import type { TrackerContract } from '../contract/index.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Typed oRPC client for `/api/tracker` (see `../contract`).
|
package/src/client/format.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Priority } from '@kernhq/module-tracker/contract'
|
|
2
1
|
import type { StatusCategory } from '@kernhq/workflow'
|
|
2
|
+
import type { Priority } from '../contract/index.js'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Presentation rules shared by every tracker surface (list rows, board cards, detail panel).
|
package/src/client/group.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GroupBy, Issue, Priority } from '@kernhq/module-tracker/contract'
|
|
2
1
|
import type { StatusCategory } from '@kernhq/workflow'
|
|
2
|
+
import type { GroupBy, Issue, Priority } from '../contract/index.js'
|
|
3
3
|
import { PRIORITY_GROUP_ORDER, STATUS_CATEGORY_ORDER } from './format.js'
|
|
4
4
|
import { byRank } from './rank.js'
|
|
5
5
|
|
package/src/client/kql.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { KqlError, KqlSuggestion } from '
|
|
2
|
-
import type { KqlExpr, KqlOp, KqlOrder, KqlQuery, KqlValue, Span } from '
|
|
1
|
+
import type { KqlError, KqlSuggestion } from '../contract/index.js'
|
|
2
|
+
import type { KqlExpr, KqlOp, KqlOrder, KqlQuery, KqlValue, Span } from '../kql/index.js'
|
|
3
3
|
import {
|
|
4
4
|
customKqlField,
|
|
5
5
|
findField,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
operatorsFor,
|
|
9
9
|
printQuery,
|
|
10
10
|
SYSTEM_FIELDS,
|
|
11
|
-
} from '
|
|
11
|
+
} from '../kql/index.js'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A KQL reader for the query box.
|
|
@@ -495,6 +495,6 @@ export type {
|
|
|
495
495
|
KqlQuery,
|
|
496
496
|
KqlValue,
|
|
497
497
|
Span,
|
|
498
|
-
} from '
|
|
498
|
+
} from '../kql/index.js'
|
|
499
499
|
export type { KqlField }
|
|
500
500
|
export { customKqlField, operatorsFor, SYSTEM_FIELDS }
|
package/src/client/types.ts
CHANGED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defineEvent, Id, UserId, WorkspaceId } from '@kernhq/contracts'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
import { IssueKey, Priority, StatusCategory } from './models.js'
|
|
4
|
+
|
|
5
|
+
const issueRef = z.object({
|
|
6
|
+
workspaceId: WorkspaceId,
|
|
7
|
+
projectId: Id,
|
|
8
|
+
issueId: Id,
|
|
9
|
+
key: IssueKey,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
/** Events published by the tracker module (also available as automation triggers). */
|
|
13
|
+
export const trackerEvents = {
|
|
14
|
+
issueCreated: defineEvent(
|
|
15
|
+
'tracker.issue.created',
|
|
16
|
+
issueRef.extend({
|
|
17
|
+
typeId: Id,
|
|
18
|
+
title: z.string(),
|
|
19
|
+
statusId: z.string(),
|
|
20
|
+
priority: Priority,
|
|
21
|
+
assigneeIds: z.array(UserId),
|
|
22
|
+
triage: z.boolean(),
|
|
23
|
+
source: z.string(),
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
26
|
+
issueUpdated: defineEvent(
|
|
27
|
+
'tracker.issue.updated',
|
|
28
|
+
issueRef.extend({
|
|
29
|
+
changes: z.array(z.object({ field: z.string(), from: z.unknown(), to: z.unknown() })),
|
|
30
|
+
}),
|
|
31
|
+
),
|
|
32
|
+
issueStatusChanged: defineEvent(
|
|
33
|
+
'tracker.issue.status_changed',
|
|
34
|
+
issueRef.extend({
|
|
35
|
+
fromStatusId: z.string().nullable(),
|
|
36
|
+
toStatusId: z.string(),
|
|
37
|
+
fromCategory: StatusCategory.nullable(),
|
|
38
|
+
toCategory: StatusCategory,
|
|
39
|
+
transitionId: z.string().nullable(),
|
|
40
|
+
resolution: z.string().nullable(),
|
|
41
|
+
}),
|
|
42
|
+
),
|
|
43
|
+
issueAssigned: defineEvent(
|
|
44
|
+
'tracker.issue.assigned',
|
|
45
|
+
issueRef.extend({ assigneeIds: z.array(UserId), added: z.array(UserId), removed: z.array(UserId) }),
|
|
46
|
+
),
|
|
47
|
+
issueCommented: defineEvent(
|
|
48
|
+
'tracker.issue.commented',
|
|
49
|
+
issueRef.extend({ commentId: Id, parentId: Id.nullable(), authorId: UserId.nullable() }),
|
|
50
|
+
),
|
|
51
|
+
issueDeleted: defineEvent('tracker.issue.deleted', issueRef),
|
|
52
|
+
issueArchived: defineEvent('tracker.issue.archived', issueRef.extend({ archived: z.boolean() })),
|
|
53
|
+
issueDue: defineEvent(
|
|
54
|
+
'tracker.issue.due',
|
|
55
|
+
issueRef.extend({ dueDate: z.string(), assigneeIds: z.array(UserId) }),
|
|
56
|
+
),
|
|
57
|
+
|
|
58
|
+
cycleStarted: defineEvent(
|
|
59
|
+
'tracker.cycle.started',
|
|
60
|
+
z.object({ workspaceId: WorkspaceId, projectId: Id, cycleId: Id, number: z.number().int() }),
|
|
61
|
+
),
|
|
62
|
+
cycleCompleted: defineEvent(
|
|
63
|
+
'tracker.cycle.completed',
|
|
64
|
+
z.object({
|
|
65
|
+
workspaceId: WorkspaceId,
|
|
66
|
+
projectId: Id,
|
|
67
|
+
cycleId: Id,
|
|
68
|
+
number: z.number().int(),
|
|
69
|
+
carriedOver: z.number().int(),
|
|
70
|
+
}),
|
|
71
|
+
),
|
|
72
|
+
|
|
73
|
+
projectCreated: defineEvent(
|
|
74
|
+
'tracker.project.created',
|
|
75
|
+
z.object({ workspaceId: WorkspaceId, projectId: Id, key: z.string(), name: z.string() }),
|
|
76
|
+
),
|
|
77
|
+
projectUpdated: defineEvent(
|
|
78
|
+
'tracker.project.updated',
|
|
79
|
+
z.object({ workspaceId: WorkspaceId, projectId: Id, changes: z.array(z.string()) }),
|
|
80
|
+
),
|
|
81
|
+
projectArchived: defineEvent(
|
|
82
|
+
'tracker.project.archived',
|
|
83
|
+
z.object({ workspaceId: WorkspaceId, projectId: Id, archived: z.boolean() }),
|
|
84
|
+
),
|
|
85
|
+
projectDeleted: defineEvent(
|
|
86
|
+
'tracker.project.deleted',
|
|
87
|
+
z.object({ workspaceId: WorkspaceId, projectId: Id, key: z.string() }),
|
|
88
|
+
),
|
|
89
|
+
|
|
90
|
+
versionReleased: defineEvent(
|
|
91
|
+
'tracker.version.released',
|
|
92
|
+
z.object({ workspaceId: WorkspaceId, projectId: Id, versionId: Id, name: z.string() }),
|
|
93
|
+
),
|
|
94
|
+
}
|