@astrale-domains/issues 0.6.6 → 0.7.1

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.
Files changed (54) hide show
  1. package/README.md +71 -12
  2. package/dist/schema/modules/comment/classes/issue-has-comment.d.ts +1 -1
  3. package/dist/schema/modules/issue/classes/index.d.ts +1 -0
  4. package/dist/schema/modules/issue/classes/index.js +1 -0
  5. package/dist/schema/modules/issue/classes/issue-assigned-to.d.ts +1 -1
  6. package/dist/schema/modules/issue/classes/issue-reported-by.d.ts +1 -1
  7. package/dist/schema/modules/issue/classes/issue-subtask-of.d.ts +2 -2
  8. package/dist/schema/modules/issue/classes/issue-tracked-by.d.ts +33 -0
  9. package/dist/schema/modules/issue/classes/issue-tracked-by.js +10 -0
  10. package/dist/schema/modules/issue/classes/issue.d.ts +32 -13
  11. package/dist/schema/modules/issue/classes/issue.js +6 -0
  12. package/dist/schema/modules/issue/classes/project-contains-issue.d.ts +2 -2
  13. package/dist/schema/modules/issue/functions/delete-issue.d.ts +7 -0
  14. package/dist/schema/modules/issue/functions/delete-issue.js +11 -0
  15. package/dist/schema/modules/issue/functions/edit-issue.d.ts +1 -1
  16. package/dist/schema/modules/issue/functions/index.d.ts +3 -0
  17. package/dist/schema/modules/issue/functions/index.js +3 -0
  18. package/dist/schema/modules/issue/functions/track-issue.d.ts +10 -0
  19. package/dist/schema/modules/issue/functions/track-issue.js +19 -0
  20. package/dist/schema/modules/issue/functions/transition-issue.d.ts +4 -4
  21. package/dist/schema/modules/issue/functions/transition-issue.js +1 -1
  22. package/dist/schema/modules/issue/functions/untrack-issue.d.ts +9 -0
  23. package/dist/schema/modules/issue/functions/untrack-issue.js +12 -0
  24. package/dist/schema/modules/issue/functions/update-issue.d.ts +1 -1
  25. package/dist/schema/modules/issue/index.d.ts +3 -3
  26. package/dist/schema/modules/issue/index.js +3 -3
  27. package/dist/schema/modules/issue/policies/index.d.ts +2 -0
  28. package/dist/schema/modules/issue/policies/index.js +2 -0
  29. package/dist/schema/modules/issue/policies/manage-issue.d.ts +1 -0
  30. package/dist/schema/modules/issue/policies/manage-issue.js +10 -0
  31. package/dist/schema/modules/issue/policies/traverse-issue-tracking.d.ts +2 -0
  32. package/dist/schema/modules/issue/policies/traverse-issue-tracking.js +20 -0
  33. package/dist/schema/modules/issue/states/issue-status.d.ts +0 -7
  34. package/dist/schema/modules/issue/states/issue-status.js +2 -3
  35. package/dist/schema/modules/issue/types/issue.d.ts +1 -1
  36. package/dist/schema/modules/project/classes/project-has-member.d.ts +1 -1
  37. package/dist/schema/modules/project/classes/project-owned-by.d.ts +1 -1
  38. package/dist/schema/modules/project/classes/project.d.ts +8 -1
  39. package/dist/schema/modules/project/classes/project.js +2 -0
  40. package/dist/schema/modules/project/functions/create-project-issue.d.ts +1 -1
  41. package/dist/schema/modules/project/functions/delete-project.d.ts +7 -0
  42. package/dist/schema/modules/project/functions/delete-project.js +11 -0
  43. package/dist/schema/modules/project/functions/index.d.ts +1 -0
  44. package/dist/schema/modules/project/functions/index.js +1 -0
  45. package/dist/schema/modules/project/index.d.ts +1 -1
  46. package/dist/schema/modules/project/index.js +1 -1
  47. package/dist/schema/modules/project/types/index.d.ts +1 -0
  48. package/dist/schema/modules/project/types/project-edges.d.ts +12 -0
  49. package/dist/schema/modules/project/types/project-edges.js +1 -0
  50. package/dist/schema/modules/tag/classes/issue-tagged-with.d.ts +1 -1
  51. package/dist/schema/modules/tag/classes/project-contains-tag.d.ts +1 -1
  52. package/dist/schema/schema.d.ts +86 -25
  53. package/dist/schema/schema.js +4 -1
  54. package/package.json +4 -1
package/README.md CHANGED
@@ -15,8 +15,9 @@ Project
15
15
 
16
16
  Issue
17
17
  immutable reference; title (100 characters); optional Markdown description (50,000 characters)
18
- status: open | accepted | resolved | deferred | closed
18
+ status: open | accepted | resolved | closed
19
19
  priority: 0..4; optional assignee; optional acyclic parent; Tags
20
+ tracked by at most one other Issue, in any Project
20
21
 
21
22
  Comment
22
23
  body; immutable author; belongs to one Issue
@@ -31,7 +32,9 @@ Comments by reading the graph under their own authority:
31
32
  ```text
32
33
  Project.create
33
34
  Project.update | addMember | removeMember | createIssue | receiveReport | createTag | archive
34
- Issue.update | edit | transition | assign | setTags | setParent | addComment | archive
35
+ | delete
36
+ Issue.update | edit | transition | assign | setTags | setParent | track | untrack | addComment
37
+ | archive | delete
35
38
  Comment.edit | delete
36
39
  Tag.edit | delete
37
40
  ```
@@ -42,11 +45,40 @@ enough Issues through `Issue.setTags`; the Action rejects them explicitly
42
45
  (`TAG_TOO_LARGE_TO_DELETE`) instead of submitting an oversized Mutation with a backend-dependent
43
46
  failure.
44
47
 
48
+ `Issue.delete` deletes an Issue for good, archived or not, in one atomic Mutation: its Comments,
49
+ and every Edge that holds the Issue or one of its Comments. Its sub-Issues stay, without a parent.
50
+ Its reference is never given again, since a Project's `nextIssueNumber` only grows. The Mutation
51
+ holds at most 2,048 writes: three per Comment, one per sub-Issue, Tag and person, and two for the
52
+ Issue in its Project. A larger Issue is refused (`ISSUE_TOO_LARGE_TO_DELETE`) until some Comments
53
+ are deleted or sub-Issues detached, and an archived Project refuses it (`PROJECT_ARCHIVED`). The
54
+ Edges are read from the graph, not from `reporterId`, `assigneeId` or `authorId`, so an Issue whose
55
+ reporter, assignee or Comment author was deleted is still deleted whole.
56
+
57
+ `Project.delete` lets the owner delete a Project for good, archived or not, in one atomic
58
+ Mutation: its Issues, their Comments, its Tags, and every Edge that holds one of them. An Issue of
59
+ another Project that one of its Issues tracks, or that tracks one of them, stays, untracked, with
60
+ its status. The Mutation holds at most 2,048 writes: one per Edge, Issue, Tag and Comment, and one
61
+ for the Project. A larger Project is refused (`PROJECT_TOO_LARGE_TO_DELETE`) until some Issues or
62
+ Comments are deleted, which only an open Project allows. The Edges are read from the graph, each
63
+ Class counted before it is listed, so the read stays within that bound whatever the Project holds.
64
+ An Edge of another Domain that holds the Project or one of its Nodes, such as a Fleet's report
65
+ intake, makes the Kernel refuse the deletion.
66
+
67
+ An Issue tracks Issues of any Project, such as a Product Issue tracking the reports it answers.
68
+ `Issue.track` accepts an open tracked Issue; from then on, each status event of the tracking Issue
69
+ is applied to every Issue it tracks for which it is legal, in the same Mutation. A tracked Issue
70
+ takes no transition of its own (`ISSUE_TRACKED`) until it is untracked, by either side, and keeps
71
+ its status when it is. Tracking is one level deep: an Issue that tracks others is tracked by none,
72
+ and tracking one that tracks others moves them to the new tracker. One Issue tracks at most 512
73
+ (`TOO_MANY_TRACKED_ISSUES`). Tracking needs a collaborator of both Projects; a tracking link is
74
+ visible to the collaborators of either Project, never to a reporter alone. Deleting either Issue
75
+ removes the link.
76
+
45
77
  `Project.create` requires authentication. A Project's owner and members observe the Project, its
46
78
  Issues and their Comments through the graph, under their own authority. A reporter observes its own
47
79
  Issues the same way: from its Identity through `issue_reported_by`, then each Issue's Comments.
48
80
  Receiver Methods use Schema-owned Policies: Project owners administer metadata, membership, Tags,
49
- and archival; owners and members contribute to Issues; an Issue's reporter edits its title and
81
+ and archival, and alone delete Issues; owners and members contribute to Issues; an Issue's reporter edits its title and
50
82
  description through `Issue.edit` and archives it; only a Comment author edits or deletes it.
51
83
  Priority, status,
52
84
  assignment, Tags, parent, and Comments remain collaborator operations. Issues and their Comments are
@@ -93,15 +125,42 @@ duplicate matching, or background processing.
93
125
  Other creation methods retain their existing retry semantics. Set-style changes converge naturally;
94
126
  stale concurrent edits reject through atomic mutation preconditions.
95
127
 
96
- The mounted View defaults to a focused open-Issue Inbox with queue progress and keyboard or button
97
- navigation. Accepted work has a dedicated discussion view, while Browse filters the visible Issues
98
- on the server and reads them a page at a time. A search keeps the Issues read so far that mention
99
- it and says when more may match. The roomy metadata drawer exposes Close, Defer,
100
- Resolved, and Accept triage actions plus priority, assignment, Tags, and parent controls without
101
- blurring the main view. The four outcomes display and honor the `C`, `D`, `R`, and `A` keyboard
102
- shortcuts whenever the user is not typing. The selected Issue description and its Comment thread remain below the
103
- inbox as one continuous Markdown conversation with strict Mermaid diagrams. Project, Issue, and Tag
104
- creation and Project membership administration intentionally remain API-first.
128
+ ## View
129
+
130
+ The mounted View is one full-width application under a top bar: Inbox, Issues and Projects, a
131
+ Project switcher that every screen keeps in its URL, a command palette (`⌘K`), New issue (`N`) and search (`/`).
132
+ Every screen, filter and Issue has its own URL. People appear as "You" for the caller and as a
133
+ short Identity id for anyone else, because the Kernel gives Identities no name the Domain may read.
134
+
135
+ - **Inbox** triages one open Issue at a time, highest priority first: Accept and Close (`A`,
136
+ `C`) move to the next Issue at once, and a refused triage puts the Issue back. The
137
+ Issue in focus shows its description, report environment and Comments, and takes a reply,
138
+ priority, assignee and Tags without leaving the queue.
139
+ - **Issues** lists the Issues of one status, Accepted by default, with each status's count.
140
+ Priority, assignee, Tags and order filters run on the server and read a page at a time; with
141
+ several Tags, an Issue has every one. The search box matches the Issues read so far and offers
142
+ to read further. Rows are selected with
143
+ the mouse or `x` and changed together: status, assignee and priority. A tracked Issue keeps its
144
+ status, and the change says so.
145
+ - **An Issue's page** shows its title, description and Comments as one Markdown timeline, with
146
+ Write and Preview tabs, editing and deleting under the Schema's Policies. A side column holds
147
+ status, assignee, priority, Tags, parent, sub-Issues with their progress, tracking, details,
148
+ report environment, archival and, for the Project owner, deletion. A tracked Issue names the
149
+ Issue it follows in place of its status control; an Issue of a Project the reader is not part of
150
+ shows as hidden.
151
+ - **New issue** creates an Issue in a Project, or a sub-Issue in its parent's Project, with its
152
+ priority, assignee and Tags.
153
+ - **Projects** lists the caller's Projects with their counts and creates a Project. A Project's
154
+ page lets its owner change its name and description, add and remove members by Identity id,
155
+ create, edit and delete Tags, archive it, and delete it.
156
+
157
+ Descriptions and Comments render Markdown as GitHub does: GFM, Mermaid diagrams, and the HTML that
158
+ GitHub's sanitization keeps (`details`, `kbd`, sized images, `sub` and `sup`, tables); scripts,
159
+ styles, event handlers, frames and forms are dropped.
160
+
161
+ Each change shows at once and is reconciled with the graph; a refused change comes back with its
162
+ reason. The View offers an action only where the Schema's Policies allow it; the Kernel still
163
+ decides every call.
105
164
 
106
165
  ## Development
107
166
 
@@ -10,7 +10,7 @@ export declare const issue_has_comment: import("@astrale-os/sdk/schema").Directe
10
10
  readonly abstract: false;
11
11
  readonly depth: 1;
12
12
  readonly properties: "archived" | "assigneeId" | "body" | "createdAt" | "description" | "name" | "priority" | "reference" | "report" | "reportRequestId" | "reporterId" | "status" | "updatedAt";
13
- readonly methods: "addComment" | "archive" | "assign" | "edit" | "setParent" | "setTags" | "transition" | "update";
13
+ readonly methods: "addComment" | "archive" | "assign" | "delete" | "edit" | "setParent" | "setTags" | "track" | "transition" | "untrack" | "update";
14
14
  })[];
15
15
  readonly outgoing: "0..*";
16
16
  };
@@ -1,5 +1,6 @@
1
1
  export { issue_assigned_to } from './issue-assigned-to.js';
2
2
  export { issue_reported_by } from './issue-reported-by.js';
3
3
  export { issue_subtask_of } from './issue-subtask-of.js';
4
+ export { issue_tracked_by } from './issue-tracked-by.js';
4
5
  export { Issue } from './issue.js';
5
6
  export { project_contains_issue } from './project-contains-issue.js';
@@ -1,5 +1,6 @@
1
1
  export { issue_assigned_to } from './issue-assigned-to.js';
2
2
  export { issue_reported_by } from './issue-reported-by.js';
3
3
  export { issue_subtask_of } from './issue-subtask-of.js';
4
+ export { issue_tracked_by } from './issue-tracked-by.js';
4
5
  export { Issue } from './issue.js';
5
6
  export { project_contains_issue } from './project-contains-issue.js';
@@ -17,7 +17,7 @@ export declare const issue_assigned_to: import("@astrale-os/sdk/schema").Directe
17
17
  readonly abstract: false;
18
18
  readonly depth: 1;
19
19
  readonly properties: "archived" | "assigneeId" | "body" | "createdAt" | "description" | "name" | "priority" | "reference" | "report" | "reportRequestId" | "reporterId" | "status" | "updatedAt";
20
- readonly methods: "addComment" | "archive" | "assign" | "edit" | "setParent" | "setTags" | "transition" | "update";
20
+ readonly methods: "addComment" | "archive" | "assign" | "delete" | "edit" | "setParent" | "setTags" | "track" | "transition" | "untrack" | "update";
21
21
  })[];
22
22
  readonly incoming: "0..1";
23
23
  };
@@ -17,7 +17,7 @@ export declare const issue_reported_by: import("@astrale-os/sdk/schema").Directe
17
17
  readonly abstract: false;
18
18
  readonly depth: 1;
19
19
  readonly properties: "archived" | "assigneeId" | "body" | "createdAt" | "description" | "name" | "priority" | "reference" | "report" | "reportRequestId" | "reporterId" | "status" | "updatedAt";
20
- readonly methods: "addComment" | "archive" | "assign" | "edit" | "setParent" | "setTags" | "transition" | "update";
20
+ readonly methods: "addComment" | "archive" | "assign" | "delete" | "edit" | "setParent" | "setTags" | "track" | "transition" | "untrack" | "update";
21
21
  })[];
22
22
  readonly incoming: "0..1";
23
23
  };
@@ -10,7 +10,7 @@ export declare const issue_subtask_of: import("@astrale-os/sdk/schema").Directed
10
10
  readonly abstract: false;
11
11
  readonly depth: 1;
12
12
  readonly properties: "archived" | "assigneeId" | "body" | "createdAt" | "description" | "name" | "priority" | "reference" | "report" | "reportRequestId" | "reporterId" | "status" | "updatedAt";
13
- readonly methods: "addComment" | "archive" | "assign" | "edit" | "setParent" | "setTags" | "transition" | "update";
13
+ readonly methods: "addComment" | "archive" | "assign" | "delete" | "edit" | "setParent" | "setTags" | "track" | "transition" | "untrack" | "update";
14
14
  })[];
15
15
  readonly outgoing: "0..1";
16
16
  };
@@ -21,7 +21,7 @@ export declare const issue_subtask_of: import("@astrale-os/sdk/schema").Directed
21
21
  readonly abstract: false;
22
22
  readonly depth: 1;
23
23
  readonly properties: "archived" | "assigneeId" | "body" | "createdAt" | "description" | "name" | "priority" | "reference" | "report" | "reportRequestId" | "reporterId" | "status" | "updatedAt";
24
- readonly methods: "addComment" | "archive" | "assign" | "edit" | "setParent" | "setTags" | "transition" | "update";
24
+ readonly methods: "addComment" | "archive" | "assign" | "delete" | "edit" | "setParent" | "setTags" | "track" | "transition" | "untrack" | "update";
25
25
  })[];
26
26
  readonly incoming: "0..*";
27
27
  };
@@ -0,0 +1,33 @@
1
+ export declare const issue_tracked_by: import("@astrale-os/sdk/schema").DirectedEdgeClass<{
2
+ readonly depth: 0;
3
+ readonly abstract: false;
4
+ readonly extends: readonly [];
5
+ readonly properties: never;
6
+ readonly source: {
7
+ readonly as: "tracked";
8
+ readonly accepts: readonly (() => {
9
+ readonly kind: 'node';
10
+ readonly abstract: false;
11
+ readonly depth: 1;
12
+ readonly properties: "archived" | "assigneeId" | "body" | "createdAt" | "description" | "name" | "priority" | "reference" | "report" | "reportRequestId" | "reporterId" | "status" | "updatedAt";
13
+ readonly methods: "addComment" | "archive" | "assign" | "delete" | "edit" | "setParent" | "setTags" | "track" | "transition" | "untrack" | "update";
14
+ })[];
15
+ readonly outgoing: "0..1";
16
+ };
17
+ readonly target: {
18
+ readonly as: "tracking";
19
+ readonly accepts: readonly (() => {
20
+ readonly kind: 'node';
21
+ readonly abstract: false;
22
+ readonly depth: 1;
23
+ readonly properties: "archived" | "assigneeId" | "body" | "createdAt" | "description" | "name" | "priority" | "reference" | "report" | "reportRequestId" | "reporterId" | "status" | "updatedAt";
24
+ readonly methods: "addComment" | "archive" | "assign" | "delete" | "edit" | "setParent" | "setTags" | "track" | "transition" | "untrack" | "update";
25
+ })[];
26
+ readonly incoming: "0..*";
27
+ };
28
+ readonly constraints: {
29
+ readonly noSelf: true;
30
+ readonly acyclic: true;
31
+ };
32
+ readonly effectiveProperties: never;
33
+ }>;
@@ -0,0 +1,10 @@
1
+ import { edgeClass } from '@astrale-os/sdk/schema';
2
+ import { TraverseIssueTracking } from '../policies/traverse-issue-tracking.js';
3
+ import { Issue } from './issue.js';
4
+ export const issue_tracked_by = edgeClass.directed({
5
+ description: 'One Issue is tracked by at most one other Issue, in any Project, and follows its status events; an Issue that tracks others is tracked by none.',
6
+ source: { as: 'tracked', accepts: [() => Issue], outgoing: '0..1' },
7
+ target: { as: 'tracking', accepts: [() => Issue], incoming: '0..*' },
8
+ constraints: { noSelf: true, acyclic: true },
9
+ policies: { read: () => TraverseIssueTracking, traverse: () => TraverseIssueTracking },
10
+ });
@@ -14,17 +14,10 @@ export declare const Issue: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
14
14
  status: import("@astrale-os/sdk/schema").StateProperty<import("@astrale-os/sdk/schema").StateMachine<{
15
15
  readonly open: {
16
16
  readonly accept: "accepted";
17
- readonly defer: "deferred";
18
17
  readonly close: "closed";
19
18
  };
20
19
  readonly accepted: {
21
20
  readonly resolve: "resolved";
22
- readonly defer: "deferred";
23
- readonly close: "closed";
24
- };
25
- readonly deferred: {
26
- readonly reopen: "open";
27
- readonly accept: "accepted";
28
21
  readonly close: "closed";
29
22
  };
30
23
  readonly resolved: {
@@ -92,7 +85,7 @@ export declare const Issue: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
92
85
  reference: string;
93
86
  title: string;
94
87
  description: string;
95
- status: "accepted" | "closed" | "deferred" | "open" | "resolved";
88
+ status: "accepted" | "closed" | "open" | "resolved";
96
89
  priority: number;
97
90
  archived: boolean;
98
91
  };
@@ -107,13 +100,13 @@ export declare const Issue: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
107
100
  reference: string;
108
101
  title: string;
109
102
  description: string;
110
- status: "accepted" | "closed" | "deferred" | "open" | "resolved";
103
+ status: "accepted" | "closed" | "open" | "resolved";
111
104
  priority: number;
112
105
  archived: boolean;
113
106
  };
114
107
  }, "authorized", false, false, undefined, undefined>>;
115
108
  transition: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
116
- event: "accept" | "close" | "defer" | "reopen" | "resolve";
109
+ event: "accept" | "close" | "reopen" | "resolve";
117
110
  }, {
118
111
  readonly mode: 'value';
119
112
  readonly value: {
@@ -123,15 +116,15 @@ export declare const Issue: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
123
116
  reference: string;
124
117
  title: string;
125
118
  description: string;
126
- status: "accepted" | "closed" | "deferred" | "open" | "resolved";
119
+ status: "accepted" | "closed" | "open" | "resolved";
127
120
  priority: number;
128
121
  archived: boolean;
129
122
  };
130
123
  } | {
131
124
  kind: "rejected";
132
125
  code: "STATE_TRANSITION_ILLEGAL";
133
- from: "accepted" | "closed" | "deferred" | "open" | "resolved";
134
- event: "accept" | "close" | "defer" | "reopen" | "resolve";
126
+ from: "accepted" | "closed" | "open" | "resolved";
127
+ event: "accept" | "close" | "reopen" | "resolve";
135
128
  };
136
129
  }, "authorized", false, false, undefined, undefined>>;
137
130
  assign: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
@@ -161,6 +154,25 @@ export declare const Issue: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
161
154
  parentId?: string | undefined;
162
155
  };
163
156
  }, "authorized", false, false, undefined, undefined>>;
157
+ track: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
158
+ issue: string;
159
+ }, {
160
+ readonly mode: 'value';
161
+ readonly value: {
162
+ trackingId: string;
163
+ trackedIds: string[];
164
+ status: "accepted" | "closed" | "open" | "resolved";
165
+ };
166
+ }, "authorized", false, false, undefined, undefined>>;
167
+ untrack: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
168
+ issue: string;
169
+ }, {
170
+ readonly mode: 'value';
171
+ readonly value: {
172
+ trackingId: string;
173
+ issueId: string;
174
+ };
175
+ }, "authorized", false, false, undefined, undefined>>;
164
176
  addComment: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
165
177
  body: string;
166
178
  }, {
@@ -177,6 +189,13 @@ export declare const Issue: import("@astrale-os/sdk/schema").AuthoredNodeClass<{
177
189
  archived: true;
178
190
  };
179
191
  }, "authorized", false, false, undefined, undefined>>;
192
+ delete: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
193
+ readonly mode: 'value';
194
+ readonly value: {
195
+ issueId: string;
196
+ deleted: true;
197
+ };
198
+ }, "authorized", false, false, undefined, undefined>>;
180
199
  };
181
200
  readonly policies: {
182
201
  read: () => import("@astrale-os/sdk/schema").Policy;
@@ -5,10 +5,13 @@ import { nodeIdValue } from '../../../types/index.js';
5
5
  import { addIssueCommentMethod } from '../functions/add-issue-comment.js';
6
6
  import { archiveIssueMethod } from '../functions/archive-issue.js';
7
7
  import { assignIssueMethod } from '../functions/assign-issue.js';
8
+ import { deleteIssueMethod } from '../functions/delete-issue.js';
8
9
  import { editIssueMethod } from '../functions/edit-issue.js';
9
10
  import { setIssueParentMethod } from '../functions/set-issue-parent.js';
10
11
  import { setIssueTagsMethod } from '../functions/set-issue-tags.js';
12
+ import { trackIssueMethod } from '../functions/track-issue.js';
11
13
  import { transitionIssueMethod } from '../functions/transition-issue.js';
14
+ import { untrackIssueMethod } from '../functions/untrack-issue.js';
12
15
  import { updateIssueMethod } from '../functions/update-issue.js';
13
16
  import { ContributeToIssueOrReportedIssue } from '../policies/contribute-to-issue-or-reported-issue.js';
14
17
  import { issueStatus } from '../states/index.js';
@@ -41,8 +44,11 @@ export const Issue = nodeClass({
41
44
  assign: assignIssueMethod,
42
45
  setTags: setIssueTagsMethod,
43
46
  setParent: setIssueParentMethod,
47
+ track: trackIssueMethod,
48
+ untrack: untrackIssueMethod,
44
49
  addComment: addIssueCommentMethod,
45
50
  archive: archiveIssueMethod,
51
+ delete: deleteIssueMethod,
46
52
  },
47
53
  policies: {
48
54
  read: () => ContributeToIssueOrReportedIssue,
@@ -10,7 +10,7 @@ export declare const project_contains_issue: import("@astrale-os/sdk/schema").Di
10
10
  readonly abstract: false;
11
11
  readonly depth: 1;
12
12
  readonly properties: "archived" | "createdAt" | "description" | "key" | "memberIds" | "name" | "nextIssueNumber" | "ownerId" | "updatedAt";
13
- readonly methods: "addMember" | "archive" | "create" | "createIssue" | "createTag" | "receiveReport" | "removeMember" | "update";
13
+ readonly methods: "addMember" | "archive" | "create" | "createIssue" | "createTag" | "delete" | "receiveReport" | "removeMember" | "update";
14
14
  })[];
15
15
  readonly outgoing: "0..*";
16
16
  };
@@ -21,7 +21,7 @@ export declare const project_contains_issue: import("@astrale-os/sdk/schema").Di
21
21
  readonly abstract: false;
22
22
  readonly depth: 1;
23
23
  readonly properties: "archived" | "assigneeId" | "body" | "createdAt" | "description" | "name" | "priority" | "reference" | "report" | "reportRequestId" | "reporterId" | "status" | "updatedAt";
24
- readonly methods: "addComment" | "archive" | "assign" | "edit" | "setParent" | "setTags" | "transition" | "update";
24
+ readonly methods: "addComment" | "archive" | "assign" | "delete" | "edit" | "setParent" | "setTags" | "track" | "transition" | "untrack" | "update";
25
25
  })[];
26
26
  readonly incoming: "1";
27
27
  };
@@ -0,0 +1,7 @@
1
+ export declare const deleteIssueMethod: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
2
+ readonly mode: 'value';
3
+ readonly value: {
4
+ issueId: string;
5
+ deleted: true;
6
+ };
7
+ }, "authorized", false, false, undefined, undefined>>;
@@ -0,0 +1,11 @@
1
+ import { method } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ import { nodeIdValue } from '../../../types/index.js';
4
+ import { ManageIssue } from '../policies/manage-issue.js';
5
+ export const deleteIssueMethod = method({
6
+ description: 'Delete this Issue and its Comments for good; its sub-Issues stay, without a parent. Its reference is never given again. Refused when that takes more than 2,048 writes.',
7
+ auth: 'authorized',
8
+ policy: ({ check, self }) => check(ManageIssue, self),
9
+ input: z.strictObject({}),
10
+ output: z.strictObject({ issueId: nodeIdValue, deleted: z.literal(true) }),
11
+ });
@@ -8,7 +8,7 @@ export declare const editIssueMethod: import("@astrale-os/sdk/schema").Method<im
8
8
  reference: string;
9
9
  title: string;
10
10
  description: string;
11
- status: "accepted" | "closed" | "deferred" | "open" | "resolved";
11
+ status: "accepted" | "closed" | "open" | "resolved";
12
12
  priority: number;
13
13
  archived: boolean;
14
14
  };
@@ -1,8 +1,11 @@
1
1
  export { addIssueCommentMethod } from './add-issue-comment.js';
2
2
  export { archiveIssueMethod } from './archive-issue.js';
3
3
  export { assignIssueMethod } from './assign-issue.js';
4
+ export { deleteIssueMethod } from './delete-issue.js';
4
5
  export { editIssueMethod } from './edit-issue.js';
5
6
  export { setIssueParentMethod } from './set-issue-parent.js';
6
7
  export { setIssueTagsMethod } from './set-issue-tags.js';
8
+ export { trackIssueMethod } from './track-issue.js';
7
9
  export { transitionIssueMethod } from './transition-issue.js';
10
+ export { untrackIssueMethod } from './untrack-issue.js';
8
11
  export { updateIssueMethod } from './update-issue.js';
@@ -1,8 +1,11 @@
1
1
  export { addIssueCommentMethod } from './add-issue-comment.js';
2
2
  export { archiveIssueMethod } from './archive-issue.js';
3
3
  export { assignIssueMethod } from './assign-issue.js';
4
+ export { deleteIssueMethod } from './delete-issue.js';
4
5
  export { editIssueMethod } from './edit-issue.js';
5
6
  export { setIssueParentMethod } from './set-issue-parent.js';
6
7
  export { setIssueTagsMethod } from './set-issue-tags.js';
8
+ export { trackIssueMethod } from './track-issue.js';
7
9
  export { transitionIssueMethod } from './transition-issue.js';
10
+ export { untrackIssueMethod } from './untrack-issue.js';
8
11
  export { updateIssueMethod } from './update-issue.js';
@@ -0,0 +1,10 @@
1
+ export declare const trackIssueMethod: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
2
+ issue: string;
3
+ }, {
4
+ readonly mode: 'value';
5
+ readonly value: {
6
+ trackingId: string;
7
+ trackedIds: string[];
8
+ status: "accepted" | "closed" | "open" | "resolved";
9
+ };
10
+ }, "authorized", false, false, undefined, undefined>>;
@@ -0,0 +1,19 @@
1
+ import { method, path } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ import { nodeIdValue } from '../../../types/index.js';
4
+ import { Issue } from '../classes/issue.js';
5
+ import { ContributeToIssue } from '../policies/contribute-to-issue.js';
6
+ import { issueStatus } from '../states/index.js';
7
+ export const trackIssueMethod = method({
8
+ description: 'Track another Issue, in any Project: an open one is accepted, then takes each status event of this Issue that is legal for it until untracked. The Issues it tracked move here with it.',
9
+ auth: 'authorized',
10
+ policy: ({ allOf, check, input, self }) => allOf(check(ContributeToIssue, self), check(ContributeToIssue, input.issue)),
11
+ input: z.strictObject({ issue: path(() => Issue) }),
12
+ output: z.strictObject({
13
+ trackingId: nodeIdValue,
14
+ /** The Issue tracked, then the Issues it tracked, which moved with it. */
15
+ trackedIds: z.array(nodeIdValue).min(1),
16
+ /** The status of the Issue tracked: accepted when it was open. */
17
+ status: issueStatus.stateSchema,
18
+ }),
19
+ });
@@ -1,5 +1,5 @@
1
1
  export declare const transitionIssueMethod: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
2
- event: "accept" | "close" | "defer" | "reopen" | "resolve";
2
+ event: "accept" | "close" | "reopen" | "resolve";
3
3
  }, {
4
4
  readonly mode: 'value';
5
5
  readonly value: {
@@ -9,14 +9,14 @@ export declare const transitionIssueMethod: import("@astrale-os/sdk/schema").Met
9
9
  reference: string;
10
10
  title: string;
11
11
  description: string;
12
- status: "accepted" | "closed" | "deferred" | "open" | "resolved";
12
+ status: "accepted" | "closed" | "open" | "resolved";
13
13
  priority: number;
14
14
  archived: boolean;
15
15
  };
16
16
  } | {
17
17
  kind: "rejected";
18
18
  code: "STATE_TRANSITION_ILLEGAL";
19
- from: "accepted" | "closed" | "deferred" | "open" | "resolved";
20
- event: "accept" | "close" | "defer" | "reopen" | "resolve";
19
+ from: "accepted" | "closed" | "open" | "resolved";
20
+ event: "accept" | "close" | "reopen" | "resolve";
21
21
  };
22
22
  }, "authorized", false, false, undefined, undefined>>;
@@ -4,7 +4,7 @@ import { ContributeToIssue } from '../policies/contribute-to-issue.js';
4
4
  import { issueStatus } from '../states/index.js';
5
5
  import { issueValue } from '../types/issue.js';
6
6
  export const transitionIssueMethod = method({
7
- description: 'Apply one legal Issue status event.',
7
+ description: 'Apply one legal Issue status event; each Issue it tracks takes the same event where it is legal. A tracked Issue moves only with the Issue that tracks it.',
8
8
  auth: 'authorized',
9
9
  policy: ({ check, self }) => check(ContributeToIssue, self),
10
10
  input: z.strictObject({ event: issueStatus.eventSchema }),
@@ -0,0 +1,9 @@
1
+ export declare const untrackIssueMethod: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
2
+ issue: string;
3
+ }, {
4
+ readonly mode: 'value';
5
+ readonly value: {
6
+ trackingId: string;
7
+ issueId: string;
8
+ };
9
+ }, "authorized", false, false, undefined, undefined>>;
@@ -0,0 +1,12 @@
1
+ import { method, path } from '@astrale-os/sdk/schema';
2
+ import { z } from 'zod';
3
+ import { nodeIdValue } from '../../../types/index.js';
4
+ import { Issue } from '../classes/issue.js';
5
+ import { ContributeToIssue } from '../policies/contribute-to-issue.js';
6
+ export const untrackIssueMethod = method({
7
+ description: 'Stop tracking an Issue: it keeps its status and takes its own transitions again. Either side may untrack, even when archived.',
8
+ auth: 'authorized',
9
+ policy: ({ anyOf, check, input, self }) => anyOf(check(ContributeToIssue, self), check(ContributeToIssue, input.issue)),
10
+ input: z.strictObject({ issue: path(() => Issue) }),
11
+ output: z.strictObject({ trackingId: nodeIdValue, issueId: nodeIdValue }),
12
+ });
@@ -9,7 +9,7 @@ export declare const updateIssueMethod: import("@astrale-os/sdk/schema").Method<
9
9
  reference: string;
10
10
  title: string;
11
11
  description: string;
12
- status: "accepted" | "closed" | "deferred" | "open" | "resolved";
12
+ status: "accepted" | "closed" | "open" | "resolved";
13
13
  priority: number;
14
14
  archived: boolean;
15
15
  };
@@ -1,5 +1,5 @@
1
1
  export { issueDescriptionValue, issueTitleValue, issueValue, reportContentValue, reportContextValue, receiveReportInput, reportReceiptValue, type ReportContent, } from './types/index.js';
2
2
  export { issueStatus, type IssueEvent, type IssueStatus } from './states/index.js';
3
- export { issue_assigned_to, issue_reported_by, issue_subtask_of, Issue, project_contains_issue, } from './classes/index.js';
4
- export { addIssueCommentMethod, archiveIssueMethod, assignIssueMethod, editIssueMethod, setIssueParentMethod, setIssueTagsMethod, transitionIssueMethod, updateIssueMethod, } from './functions/index.js';
5
- export { ContributeToIssue, ContributeToIssueOrReportedIssue, ReportedIssue, TraverseIssueAssignee, TraverseIssueParent, TraverseIssueReporter, TraverseProjectIssue, } from './policies/index.js';
3
+ export { issue_assigned_to, issue_reported_by, issue_subtask_of, issue_tracked_by, Issue, project_contains_issue, } from './classes/index.js';
4
+ export { addIssueCommentMethod, archiveIssueMethod, assignIssueMethod, deleteIssueMethod, editIssueMethod, setIssueParentMethod, setIssueTagsMethod, trackIssueMethod, transitionIssueMethod, untrackIssueMethod, updateIssueMethod, } from './functions/index.js';
5
+ export { ContributeToIssue, ContributeToIssueOrReportedIssue, ManageIssue, ReportedIssue, TraverseIssueAssignee, TraverseIssueParent, TraverseIssueReporter, TraverseIssueTracking, TraverseProjectIssue, } from './policies/index.js';
@@ -1,5 +1,5 @@
1
1
  export { issueDescriptionValue, issueTitleValue, issueValue, reportContentValue, reportContextValue, receiveReportInput, reportReceiptValue, } from './types/index.js';
2
2
  export { issueStatus } from './states/index.js';
3
- export { issue_assigned_to, issue_reported_by, issue_subtask_of, Issue, project_contains_issue, } from './classes/index.js';
4
- export { addIssueCommentMethod, archiveIssueMethod, assignIssueMethod, editIssueMethod, setIssueParentMethod, setIssueTagsMethod, transitionIssueMethod, updateIssueMethod, } from './functions/index.js';
5
- export { ContributeToIssue, ContributeToIssueOrReportedIssue, ReportedIssue, TraverseIssueAssignee, TraverseIssueParent, TraverseIssueReporter, TraverseProjectIssue, } from './policies/index.js';
3
+ export { issue_assigned_to, issue_reported_by, issue_subtask_of, issue_tracked_by, Issue, project_contains_issue, } from './classes/index.js';
4
+ export { addIssueCommentMethod, archiveIssueMethod, assignIssueMethod, deleteIssueMethod, editIssueMethod, setIssueParentMethod, setIssueTagsMethod, trackIssueMethod, transitionIssueMethod, untrackIssueMethod, updateIssueMethod, } from './functions/index.js';
5
+ export { ContributeToIssue, ContributeToIssueOrReportedIssue, ManageIssue, ReportedIssue, TraverseIssueAssignee, TraverseIssueParent, TraverseIssueReporter, TraverseIssueTracking, TraverseProjectIssue, } from './policies/index.js';
@@ -1,7 +1,9 @@
1
1
  export { ContributeToIssue } from './contribute-to-issue.js';
2
2
  export { ContributeToIssueOrReportedIssue } from './contribute-to-issue-or-reported-issue.js';
3
+ export { ManageIssue } from './manage-issue.js';
3
4
  export { ReportedIssue } from './reported-issue.js';
4
5
  export { TraverseIssueAssignee } from './traverse-issue-assignee.js';
5
6
  export { TraverseIssueParent } from './traverse-issue-parent.js';
6
7
  export { TraverseIssueReporter } from './traverse-issue-reporter.js';
8
+ export { TraverseIssueTracking } from './traverse-issue-tracking.js';
7
9
  export { TraverseProjectIssue } from './traverse-project-issue.js';
@@ -1,7 +1,9 @@
1
1
  export { ContributeToIssue } from './contribute-to-issue.js';
2
2
  export { ContributeToIssueOrReportedIssue } from './contribute-to-issue-or-reported-issue.js';
3
+ export { ManageIssue } from './manage-issue.js';
3
4
  export { ReportedIssue } from './reported-issue.js';
4
5
  export { TraverseIssueAssignee } from './traverse-issue-assignee.js';
5
6
  export { TraverseIssueParent } from './traverse-issue-parent.js';
6
7
  export { TraverseIssueReporter } from './traverse-issue-reporter.js';
8
+ export { TraverseIssueTracking } from './traverse-issue-tracking.js';
7
9
  export { TraverseProjectIssue } from './traverse-project-issue.js';
@@ -0,0 +1 @@
1
+ export declare const ManageIssue: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,10 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ import { Project, project_owned_by } from '../../project/index.js';
3
+ import { project_contains_issue } from '../classes/project-contains-issue.js';
4
+ export const ManageIssue = policy({
5
+ description: 'The caller owns the Project containing this Issue.',
6
+ match: ({ allOf, edge, exists, object, subject }) => exists(({ node }) => {
7
+ const project = node(() => Project);
8
+ return allOf(edge({ source: subject, class: () => project_owned_by, target: project }), edge({ source: project, class: () => project_contains_issue, target: object }));
9
+ }),
10
+ });
@@ -0,0 +1,2 @@
1
+ /** Flat rather than composed, as `ContributeToIssueOrReportedIssue`, to stay in the depth budget. */
2
+ export declare const TraverseIssueTracking: import("@astrale-os/sdk/schema").Policy;