@astrale-domains/issues 0.7.3 → 0.7.5

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 (145) hide show
  1. package/README.md +24 -12
  2. package/dist/schema/index.d.ts +1 -1
  3. package/dist/schema/index.js +1 -1
  4. package/dist/schema/modules/comment/classes/comment-authored-by.js +3 -3
  5. package/dist/schema/modules/comment/classes/comment.js +3 -3
  6. package/dist/schema/modules/comment/classes/issue-has-comment.d.ts +1 -1
  7. package/dist/schema/modules/comment/classes/issue-has-comment.js +5 -2
  8. package/dist/schema/modules/comment/functions/delete-comment.js +2 -2
  9. package/dist/schema/modules/comment/functions/edit-comment.js +2 -2
  10. package/dist/schema/modules/comment/index.d.ts +1 -1
  11. package/dist/schema/modules/comment/index.js +1 -1
  12. package/dist/schema/modules/comment/policies/authored-comment.d.ts +1 -0
  13. package/dist/schema/modules/comment/policies/{edit-own-comment.js → authored-comment.js} +1 -1
  14. package/dist/schema/modules/comment/policies/index.d.ts +4 -4
  15. package/dist/schema/modules/comment/policies/index.js +4 -4
  16. package/dist/schema/modules/comment/policies/owns-or-belongs-to-project-of-issue-of-authored-comment.d.ts +1 -0
  17. package/dist/schema/modules/comment/policies/{traverse-comment-relationship.js → owns-or-belongs-to-project-of-issue-of-authored-comment.js} +2 -2
  18. package/dist/schema/modules/comment/policies/owns-or-belongs-to-project-of-issue-of-comment-or-reported-issue-of-comment.d.ts +1 -0
  19. package/dist/schema/modules/comment/policies/{contribute-to-comment-or-reported-issue-of-comment.js → owns-or-belongs-to-project-of-issue-of-comment-or-reported-issue-of-comment.js} +1 -1
  20. package/dist/schema/modules/comment/policies/owns-or-belongs-to-project-of-issue-with-comment-or-reported-issue-with-comment.d.ts +1 -0
  21. package/dist/schema/modules/comment/policies/{traverse-issue-comment.js → owns-or-belongs-to-project-of-issue-with-comment-or-reported-issue-with-comment.js} +1 -1
  22. package/dist/schema/modules/issue/classes/index.d.ts +1 -0
  23. package/dist/schema/modules/issue/classes/index.js +1 -0
  24. package/dist/schema/modules/issue/classes/issue-assigned-to.d.ts +1 -1
  25. package/dist/schema/modules/issue/classes/issue-assigned-to.js +5 -2
  26. package/dist/schema/modules/issue/classes/issue-is-about.d.ts +30 -0
  27. package/dist/schema/modules/issue/classes/issue-is-about.js +16 -0
  28. package/dist/schema/modules/issue/classes/issue-reported-by.d.ts +1 -1
  29. package/dist/schema/modules/issue/classes/issue-reported-by.js +5 -2
  30. package/dist/schema/modules/issue/classes/issue-subtask-of.d.ts +2 -2
  31. package/dist/schema/modules/issue/classes/issue-subtask-of.js +5 -2
  32. package/dist/schema/modules/issue/classes/issue-tracked-by.d.ts +2 -2
  33. package/dist/schema/modules/issue/classes/issue-tracked-by.js +5 -2
  34. package/dist/schema/modules/issue/classes/issue.d.ts +9 -0
  35. package/dist/schema/modules/issue/classes/issue.js +5 -3
  36. package/dist/schema/modules/issue/classes/project-contains-issue.d.ts +1 -1
  37. package/dist/schema/modules/issue/classes/project-contains-issue.js +5 -3
  38. package/dist/schema/modules/issue/functions/add-issue-comment.js +2 -2
  39. package/dist/schema/modules/issue/functions/archive-issue.js +2 -2
  40. package/dist/schema/modules/issue/functions/assign-issue.js +2 -2
  41. package/dist/schema/modules/issue/functions/delete-issue.js +2 -2
  42. package/dist/schema/modules/issue/functions/edit-issue.js +2 -2
  43. package/dist/schema/modules/issue/functions/index.d.ts +1 -0
  44. package/dist/schema/modules/issue/functions/index.js +1 -0
  45. package/dist/schema/modules/issue/functions/set-issue-parent.js +2 -2
  46. package/dist/schema/modules/issue/functions/set-issue-tags.js +2 -2
  47. package/dist/schema/modules/issue/functions/set-issue-topics.d.ts +9 -0
  48. package/dist/schema/modules/issue/functions/set-issue-topics.js +12 -0
  49. package/dist/schema/modules/issue/functions/track-issue.js +2 -2
  50. package/dist/schema/modules/issue/functions/transition-issue.js +2 -2
  51. package/dist/schema/modules/issue/functions/untrack-issue.js +2 -2
  52. package/dist/schema/modules/issue/functions/update-issue.js +2 -2
  53. package/dist/schema/modules/issue/index.d.ts +3 -3
  54. package/dist/schema/modules/issue/index.js +3 -3
  55. package/dist/schema/modules/issue/policies/index.d.ts +9 -9
  56. package/dist/schema/modules/issue/policies/index.js +9 -9
  57. package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-assigned-issue.d.ts +1 -0
  58. package/dist/schema/modules/issue/policies/{traverse-issue-assignee.js → owns-or-belongs-to-project-of-assigned-issue.js} +1 -1
  59. package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-child-issue.d.ts +1 -0
  60. package/dist/schema/modules/issue/policies/{traverse-issue-parent.js → owns-or-belongs-to-project-of-child-issue.js} +1 -1
  61. package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-issue-or-reported-issue.d.ts +1 -0
  62. package/dist/schema/modules/issue/policies/{contribute-to-issue-or-reported-issue.js → owns-or-belongs-to-project-of-issue-or-reported-issue.js} +2 -2
  63. package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-issue-with-topic.d.ts +1 -0
  64. package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-issue-with-topic.js +13 -0
  65. package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-issue.d.ts +1 -0
  66. package/dist/schema/modules/issue/policies/{contribute-to-issue.js → owns-or-belongs-to-project-of-issue.js} +1 -1
  67. package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-reported-issue-or-reported-issue.d.ts +1 -0
  68. package/dist/schema/modules/issue/policies/{traverse-issue-reporter.js → owns-or-belongs-to-project-of-reported-issue-or-reported-issue.js} +1 -1
  69. package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-tracked-or-tracking-issue.d.ts +2 -0
  70. package/dist/schema/modules/issue/policies/{traverse-issue-tracking.js → owns-or-belongs-to-project-of-tracked-or-tracking-issue.js} +2 -2
  71. package/dist/schema/modules/issue/policies/owns-project-of-issue.d.ts +1 -0
  72. package/dist/schema/modules/issue/policies/{manage-issue.js → owns-project-of-issue.js} +1 -1
  73. package/dist/schema/modules/issue/policies/reported-issue.d.ts +1 -1
  74. package/dist/schema/modules/issue/policies/reported-issue.js +1 -1
  75. package/dist/schema/modules/issue/types/index.d.ts +1 -1
  76. package/dist/schema/modules/issue/types/index.js +1 -1
  77. package/dist/schema/modules/issue/types/issue.d.ts +2 -0
  78. package/dist/schema/modules/issue/types/issue.js +2 -0
  79. package/dist/schema/modules/project/classes/project-has-member.js +5 -2
  80. package/dist/schema/modules/project/classes/project-owned-by.js +5 -2
  81. package/dist/schema/modules/project/classes/project.js +2 -2
  82. package/dist/schema/modules/project/functions/add-project-member.js +2 -2
  83. package/dist/schema/modules/project/functions/archive-project.js +2 -2
  84. package/dist/schema/modules/project/functions/create-project-issue.js +2 -2
  85. package/dist/schema/modules/project/functions/create-project-tag.js +2 -2
  86. package/dist/schema/modules/project/functions/delete-project.js +2 -2
  87. package/dist/schema/modules/project/functions/receive-project-report.js +2 -2
  88. package/dist/schema/modules/project/functions/remove-project-member.js +2 -2
  89. package/dist/schema/modules/project/functions/update-project.js +2 -2
  90. package/dist/schema/modules/project/index.d.ts +1 -1
  91. package/dist/schema/modules/project/index.js +1 -1
  92. package/dist/schema/modules/project/policies/index.d.ts +5 -4
  93. package/dist/schema/modules/project/policies/index.js +5 -4
  94. package/dist/schema/modules/project/policies/owns-or-belongs-to-containing-project.d.ts +1 -0
  95. package/dist/schema/modules/project/policies/owns-or-belongs-to-containing-project.js +7 -0
  96. package/dist/schema/modules/project/policies/owns-or-belongs-to-project-of-membership.d.ts +1 -0
  97. package/dist/schema/modules/project/policies/{traverse-project-member.js → owns-or-belongs-to-project-of-membership.js} +1 -1
  98. package/dist/schema/modules/project/policies/owns-or-belongs-to-project-of-ownership.d.ts +1 -0
  99. package/dist/schema/modules/project/policies/{traverse-project-owner.js → owns-or-belongs-to-project-of-ownership.js} +1 -1
  100. package/dist/schema/modules/project/policies/owns-or-belongs-to-project.d.ts +1 -0
  101. package/dist/schema/modules/project/policies/{contribute-to-project.js → owns-or-belongs-to-project.js} +1 -1
  102. package/dist/schema/modules/project/policies/owns-project.d.ts +1 -0
  103. package/dist/schema/modules/project/policies/{manage-project.js → owns-project.js} +1 -1
  104. package/dist/schema/modules/project/types/project-edges.d.ts +1 -1
  105. package/dist/schema/modules/tag/classes/issue-tagged-with.d.ts +1 -1
  106. package/dist/schema/modules/tag/classes/issue-tagged-with.js +5 -2
  107. package/dist/schema/modules/tag/classes/project-contains-tag.js +5 -3
  108. package/dist/schema/modules/tag/classes/tag.js +5 -2
  109. package/dist/schema/modules/tag/functions/delete-tag.js +2 -2
  110. package/dist/schema/modules/tag/functions/edit-tag.js +2 -2
  111. package/dist/schema/modules/tag/index.d.ts +1 -1
  112. package/dist/schema/modules/tag/index.js +1 -1
  113. package/dist/schema/modules/tag/policies/index.d.ts +3 -4
  114. package/dist/schema/modules/tag/policies/index.js +3 -4
  115. package/dist/schema/modules/tag/policies/owns-or-belongs-to-project-of-tag.d.ts +1 -0
  116. package/dist/schema/modules/tag/policies/{contribute-to-tag.js → owns-or-belongs-to-project-of-tag.js} +1 -1
  117. package/dist/schema/modules/tag/policies/owns-or-belongs-to-project-of-tagged-issue.d.ts +1 -0
  118. package/dist/schema/modules/tag/policies/{traverse-issue-tag.js → owns-or-belongs-to-project-of-tagged-issue.js} +1 -1
  119. package/dist/schema/modules/tag/policies/owns-project-of-tag.d.ts +1 -0
  120. package/dist/schema/modules/tag/policies/{manage-tag.js → owns-project-of-tag.js} +1 -1
  121. package/dist/schema/schema.d.ts +979 -30
  122. package/dist/schema/schema.js +28 -26
  123. package/package.json +3 -1
  124. package/dist/schema/modules/comment/policies/contribute-to-comment-or-reported-issue-of-comment.d.ts +0 -1
  125. package/dist/schema/modules/comment/policies/edit-own-comment.d.ts +0 -1
  126. package/dist/schema/modules/comment/policies/traverse-comment-relationship.d.ts +0 -1
  127. package/dist/schema/modules/comment/policies/traverse-issue-comment.d.ts +0 -1
  128. package/dist/schema/modules/issue/policies/contribute-to-issue-or-reported-issue.d.ts +0 -1
  129. package/dist/schema/modules/issue/policies/contribute-to-issue.d.ts +0 -1
  130. package/dist/schema/modules/issue/policies/manage-issue.d.ts +0 -1
  131. package/dist/schema/modules/issue/policies/traverse-issue-assignee.d.ts +0 -1
  132. package/dist/schema/modules/issue/policies/traverse-issue-parent.d.ts +0 -1
  133. package/dist/schema/modules/issue/policies/traverse-issue-reporter.d.ts +0 -1
  134. package/dist/schema/modules/issue/policies/traverse-issue-tracking.d.ts +0 -2
  135. package/dist/schema/modules/issue/policies/traverse-project-issue.d.ts +0 -1
  136. package/dist/schema/modules/issue/policies/traverse-project-issue.js +0 -6
  137. package/dist/schema/modules/project/policies/contribute-to-project.d.ts +0 -1
  138. package/dist/schema/modules/project/policies/manage-project.d.ts +0 -1
  139. package/dist/schema/modules/project/policies/traverse-project-member.d.ts +0 -1
  140. package/dist/schema/modules/project/policies/traverse-project-owner.d.ts +0 -1
  141. package/dist/schema/modules/tag/policies/contribute-to-tag.d.ts +0 -1
  142. package/dist/schema/modules/tag/policies/manage-tag.d.ts +0 -1
  143. package/dist/schema/modules/tag/policies/traverse-issue-tag.d.ts +0 -1
  144. package/dist/schema/modules/tag/policies/traverse-project-tag.d.ts +0 -1
  145. package/dist/schema/modules/tag/policies/traverse-project-tag.js +0 -6
@@ -1,4 +1,4 @@
1
1
  export { membershipChangeValue, projectValue } from './types/index.js';
2
2
  export { project_has_member, project_owned_by, Project } from './classes/index.js';
3
3
  export { addProjectMemberMethod, archiveProjectMethod, createProjectIssueMethod, createProjectTagMethod, createProjectMethod, deleteProjectMethod, removeProjectMemberMethod, updateProjectMethod, } from './functions/index.js';
4
- export { ContributeToProject, ManageProject, TraverseProjectMember, TraverseProjectOwner, } from './policies/index.js';
4
+ export { ownsOrBelongsToProject, ownsOrBelongsToContainingProject, ownsProject, ownsOrBelongsToProjectOfMembership, ownsOrBelongsToProjectOfOwnership, } from './policies/index.js';
@@ -1,4 +1,4 @@
1
1
  export { membershipChangeValue, projectValue } from './types/index.js';
2
2
  export { project_has_member, project_owned_by, Project } from './classes/index.js';
3
3
  export { addProjectMemberMethod, archiveProjectMethod, createProjectIssueMethod, createProjectTagMethod, createProjectMethod, deleteProjectMethod, removeProjectMemberMethod, updateProjectMethod, } from './functions/index.js';
4
- export { ContributeToProject, ManageProject, TraverseProjectMember, TraverseProjectOwner, } from './policies/index.js';
4
+ export { ownsOrBelongsToProject, ownsOrBelongsToContainingProject, ownsProject, ownsOrBelongsToProjectOfMembership, ownsOrBelongsToProjectOfOwnership, } from './policies/index.js';
@@ -1,4 +1,5 @@
1
- export { ContributeToProject } from './contribute-to-project.js';
2
- export { ManageProject } from './manage-project.js';
3
- export { TraverseProjectMember } from './traverse-project-member.js';
4
- export { TraverseProjectOwner } from './traverse-project-owner.js';
1
+ export { ownsOrBelongsToProject } from './owns-or-belongs-to-project.js';
2
+ export { ownsProject } from './owns-project.js';
3
+ export { ownsOrBelongsToProjectOfMembership } from './owns-or-belongs-to-project-of-membership.js';
4
+ export { ownsOrBelongsToProjectOfOwnership } from './owns-or-belongs-to-project-of-ownership.js';
5
+ export { ownsOrBelongsToContainingProject } from './owns-or-belongs-to-containing-project.js';
@@ -1,4 +1,5 @@
1
- export { ContributeToProject } from './contribute-to-project.js';
2
- export { ManageProject } from './manage-project.js';
3
- export { TraverseProjectMember } from './traverse-project-member.js';
4
- export { TraverseProjectOwner } from './traverse-project-owner.js';
1
+ export { ownsOrBelongsToProject } from './owns-or-belongs-to-project.js';
2
+ export { ownsProject } from './owns-project.js';
3
+ export { ownsOrBelongsToProjectOfMembership } from './owns-or-belongs-to-project-of-membership.js';
4
+ export { ownsOrBelongsToProjectOfOwnership } from './owns-or-belongs-to-project-of-ownership.js';
5
+ export { ownsOrBelongsToContainingProject } from './owns-or-belongs-to-containing-project.js';
@@ -0,0 +1 @@
1
+ export declare const ownsOrBelongsToContainingProject: import("@astrale-os/sdk/schema").Policy;
@@ -0,0 +1,7 @@
1
+ import { policy } from '@astrale-os/sdk/schema';
2
+ import { project_has_member } from '../classes/project-has-member.js';
3
+ import { project_owned_by } from '../classes/project-owned-by.js';
4
+ export const ownsOrBelongsToContainingProject = policy({
5
+ description: 'The caller owns or belongs to the Project containing the Issue or Tag.',
6
+ match: ({ anyOf, edge, source, subject }) => anyOf(edge({ source: subject, class: () => project_owned_by, target: source }), edge({ source: subject, class: () => project_has_member, target: source })),
7
+ });
@@ -0,0 +1 @@
1
+ export declare const ownsOrBelongsToProjectOfMembership: import("@astrale-os/sdk/schema").Policy;
@@ -1,7 +1,7 @@
1
1
  import { policy } from '@astrale-os/sdk/schema';
2
2
  import { project_has_member } from '../classes/project-has-member.js';
3
3
  import { project_owned_by } from '../classes/project-owned-by.js';
4
- export const TraverseProjectMember = policy({
4
+ export const ownsOrBelongsToProjectOfMembership = policy({
5
5
  description: 'Project membership is visible only to that Project owner and members.',
6
6
  match: ({ anyOf, edge, subject, target }) => anyOf(edge({ source: subject, class: () => project_owned_by, target }), edge({ source: subject, class: () => project_has_member, target })),
7
7
  });
@@ -0,0 +1 @@
1
+ export declare const ownsOrBelongsToProjectOfOwnership: import("@astrale-os/sdk/schema").Policy;
@@ -1,7 +1,7 @@
1
1
  import { policy } from '@astrale-os/sdk/schema';
2
2
  import { project_has_member } from '../classes/project-has-member.js';
3
3
  import { project_owned_by } from '../classes/project-owned-by.js';
4
- export const TraverseProjectOwner = policy({
4
+ export const ownsOrBelongsToProjectOfOwnership = policy({
5
5
  description: 'Project ownership is visible only to that Project owner and members.',
6
6
  match: ({ anyOf, edge, subject, target }) => anyOf(edge({ source: subject, class: () => project_owned_by, target }), edge({ source: subject, class: () => project_has_member, target })),
7
7
  });
@@ -0,0 +1 @@
1
+ export declare const ownsOrBelongsToProject: import("@astrale-os/sdk/schema").Policy;
@@ -1,7 +1,7 @@
1
1
  import { policy } from '@astrale-os/sdk/schema';
2
2
  import { project_has_member } from '../classes/project-has-member.js';
3
3
  import { project_owned_by } from '../classes/project-owned-by.js';
4
- export const ContributeToProject = policy({
4
+ export const ownsOrBelongsToProject = policy({
5
5
  description: 'The caller owns or is a member of this Project.',
6
6
  match: ({ anyOf, edge, object, subject }) => anyOf(edge({ source: subject, class: () => project_owned_by, target: object }), edge({ source: subject, class: () => project_has_member, target: object })),
7
7
  });
@@ -0,0 +1 @@
1
+ export declare const ownsProject: import("@astrale-os/sdk/schema").Policy;
@@ -1,6 +1,6 @@
1
1
  import { policy } from '@astrale-os/sdk/schema';
2
2
  import { project_owned_by } from '../classes/project-owned-by.js';
3
- export const ManageProject = policy({
3
+ export const ownsProject = policy({
4
4
  description: 'The caller is the exact owner of this Project.',
5
5
  match: ({ edge, object, subject }) => edge({ source: subject, class: () => project_owned_by, target: object }),
6
6
  });
@@ -1,6 +1,6 @@
1
1
  import type { NodeId } from '@astrale-os/sdk/graph/node';
2
2
  /** The Edge Classes that hold a Project, one of its Issues, Tags or Comments. */
3
- export type ProjectEdgeClass = 'project_owned_by' | 'project_has_member' | 'project_contains_tag' | 'project_contains_issue' | 'issue_reported_by' | 'issue_assigned_to' | 'issue_subtask_of' | 'issue_tracked_by' | 'issue_tagged_with' | 'issue_has_comment' | 'comment_authored_by';
3
+ export type ProjectEdgeClass = 'project_owned_by' | 'project_has_member' | 'project_contains_tag' | 'project_contains_issue' | 'issue_reported_by' | 'issue_assigned_to' | 'issue_subtask_of' | 'issue_tracked_by' | 'issue_tagged_with' | 'issue_is_about' | 'issue_has_comment' | 'comment_authored_by';
4
4
  /** One Edge, by the Nodes at its ends. */
5
5
  export interface EdgeEnds {
6
6
  readonly source: NodeId;
@@ -10,7 +10,7 @@ export declare const issue_tagged_with: 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" | "delete" | "edit" | "setParent" | "setTags" | "track" | "transition" | "untrack" | "update";
13
+ readonly methods: "addComment" | "archive" | "assign" | "delete" | "edit" | "setParent" | "setTags" | "setTopics" | "track" | "transition" | "untrack" | "update";
14
14
  })[];
15
15
  readonly outgoing: "0..*";
16
16
  };
@@ -1,10 +1,13 @@
1
1
  import { edgeClass } from '@astrale-os/sdk/schema';
2
2
  import { Issue } from '../../issue/index.js';
3
- import { TraverseIssueTag } from '../policies/traverse-issue-tag.js';
3
+ import { ownsOrBelongsToProjectOfTaggedIssue } from '../policies/owns-or-belongs-to-project-of-tagged-issue.js';
4
4
  import { Tag } from './tag.js';
5
5
  export const issue_tagged_with = edgeClass.directed({
6
6
  description: 'One Issue is classified by one Tag from the same Project.',
7
7
  source: { as: 'issue', accepts: [() => Issue], outgoing: '0..*' },
8
8
  target: { as: 'tag', accepts: [() => Tag], incoming: '0..*' },
9
- policies: { read: () => TraverseIssueTag, traverse: () => TraverseIssueTag },
9
+ policies: {
10
+ read: () => ownsOrBelongsToProjectOfTaggedIssue,
11
+ traverse: () => ownsOrBelongsToProjectOfTaggedIssue,
12
+ },
10
13
  });
@@ -1,10 +1,12 @@
1
1
  import { edgeClass } from '@astrale-os/sdk/schema';
2
- import { Project } from '../../project/index.js';
3
- import { TraverseProjectTag } from '../policies/traverse-project-tag.js';
2
+ import { Project, ownsOrBelongsToContainingProject } from '../../project/index.js';
4
3
  import { Tag } from './tag.js';
5
4
  export const project_contains_tag = edgeClass.directed({
6
5
  description: 'One Project owns one local Tag vocabulary entry.',
7
6
  source: { as: 'project', accepts: [() => Project], outgoing: '0..*' },
8
7
  target: { as: 'tag', accepts: [() => Tag], incoming: '1' },
9
- policies: { read: () => TraverseProjectTag, traverse: () => TraverseProjectTag },
8
+ policies: {
9
+ read: () => ownsOrBelongsToContainingProject,
10
+ traverse: () => ownsOrBelongsToContainingProject,
11
+ },
10
12
  });
@@ -3,7 +3,7 @@ import { Tags } from '@astrale-os/sdk/schema/icons';
3
3
  import { z } from 'zod';
4
4
  import { deleteTagMethod } from '../functions/delete-tag.js';
5
5
  import { editTagMethod } from '../functions/edit-tag.js';
6
- import { ContributeToTag } from '../policies/contribute-to-tag.js';
6
+ import { ownsOrBelongsToProjectOfTag } from '../policies/owns-or-belongs-to-project-of-tag.js';
7
7
  export const Tag = nodeClass({
8
8
  description: 'One Project-local label with a canonical slug.',
9
9
  icon: classIcon.lucide(Tags),
@@ -13,5 +13,8 @@ export const Tag = nodeClass({
13
13
  color: property(z.string().min(7).max(7), { required: false }),
14
14
  },
15
15
  methods: { edit: editTagMethod, delete: deleteTagMethod },
16
- policies: { read: () => ContributeToTag, traverse: () => ContributeToTag },
16
+ policies: {
17
+ read: () => ownsOrBelongsToProjectOfTag,
18
+ traverse: () => ownsOrBelongsToProjectOfTag,
19
+ },
17
20
  });
@@ -1,11 +1,11 @@
1
1
  import { method } from '@astrale-os/sdk/schema';
2
2
  import { z } from 'zod';
3
3
  import { nodeIdValue } from '../../../types/index.js';
4
- import { ManageTag } from '../policies/manage-tag.js';
4
+ import { ownsProjectOfTag } from '../policies/owns-project-of-tag.js';
5
5
  export const deleteTagMethod = method({
6
6
  description: 'Detach and delete this Project-local Tag when it labels at most 2,046 Issues; unlink larger sets first.',
7
7
  auth: 'authorized',
8
- policy: ({ check, self }) => check(ManageTag, self),
8
+ policy: ({ check, self }) => check(ownsProjectOfTag, self),
9
9
  input: z.strictObject({}),
10
10
  output: z.strictObject({ tagId: nodeIdValue, deleted: z.literal(true) }),
11
11
  });
@@ -1,11 +1,11 @@
1
1
  import { method } from '@astrale-os/sdk/schema';
2
2
  import { z } from 'zod';
3
- import { ManageTag } from '../policies/manage-tag.js';
3
+ import { ownsProjectOfTag } from '../policies/owns-project-of-tag.js';
4
4
  import { tagValue } from '../types/tag.js';
5
5
  export const editTagMethod = method({
6
6
  description: 'Edit this Project-local Tag.',
7
7
  auth: 'authorized',
8
- policy: ({ check, self }) => check(ManageTag, self),
8
+ policy: ({ check, self }) => check(ownsProjectOfTag, self),
9
9
  input: z.strictObject({
10
10
  name: z.string().min(1).max(64).optional(),
11
11
  color: z.string().nullable().optional(),
@@ -1,4 +1,4 @@
1
1
  export { tagValue } from './types/index.js';
2
2
  export { issue_tagged_with, project_contains_tag, Tag } from './classes/index.js';
3
3
  export { deleteTagMethod, editTagMethod } from './functions/index.js';
4
- export { ContributeToTag, ManageTag, TraverseIssueTag, TraverseProjectTag, } from './policies/index.js';
4
+ export { ownsOrBelongsToProjectOfTag, ownsProjectOfTag, ownsOrBelongsToProjectOfTaggedIssue, } from './policies/index.js';
@@ -1,4 +1,4 @@
1
1
  export { tagValue } from './types/index.js';
2
2
  export { issue_tagged_with, project_contains_tag, Tag } from './classes/index.js';
3
3
  export { deleteTagMethod, editTagMethod } from './functions/index.js';
4
- export { ContributeToTag, ManageTag, TraverseIssueTag, TraverseProjectTag, } from './policies/index.js';
4
+ export { ownsOrBelongsToProjectOfTag, ownsProjectOfTag, ownsOrBelongsToProjectOfTaggedIssue, } from './policies/index.js';
@@ -1,4 +1,3 @@
1
- export { ContributeToTag } from './contribute-to-tag.js';
2
- export { ManageTag } from './manage-tag.js';
3
- export { TraverseIssueTag } from './traverse-issue-tag.js';
4
- export { TraverseProjectTag } from './traverse-project-tag.js';
1
+ export { ownsOrBelongsToProjectOfTag } from './owns-or-belongs-to-project-of-tag.js';
2
+ export { ownsProjectOfTag } from './owns-project-of-tag.js';
3
+ export { ownsOrBelongsToProjectOfTaggedIssue } from './owns-or-belongs-to-project-of-tagged-issue.js';
@@ -1,4 +1,3 @@
1
- export { ContributeToTag } from './contribute-to-tag.js';
2
- export { ManageTag } from './manage-tag.js';
3
- export { TraverseIssueTag } from './traverse-issue-tag.js';
4
- export { TraverseProjectTag } from './traverse-project-tag.js';
1
+ export { ownsOrBelongsToProjectOfTag } from './owns-or-belongs-to-project-of-tag.js';
2
+ export { ownsProjectOfTag } from './owns-project-of-tag.js';
3
+ export { ownsOrBelongsToProjectOfTaggedIssue } from './owns-or-belongs-to-project-of-tagged-issue.js';
@@ -0,0 +1 @@
1
+ export declare const ownsOrBelongsToProjectOfTag: import("@astrale-os/sdk/schema").Policy;
@@ -1,7 +1,7 @@
1
1
  import { policy } from '@astrale-os/sdk/schema';
2
2
  import { Project, project_has_member, project_owned_by } from '../../project/index.js';
3
3
  import { project_contains_tag } from '../classes/project-contains-tag.js';
4
- export const ContributeToTag = policy({
4
+ export const ownsOrBelongsToProjectOfTag = policy({
5
5
  description: 'The caller owns or belongs to the Project containing this Tag.',
6
6
  match: ({ allOf, anyOf, edge, exists, object, subject }) => exists(({ node }) => {
7
7
  const project = node(() => Project);
@@ -0,0 +1 @@
1
+ export declare const ownsOrBelongsToProjectOfTaggedIssue: import("@astrale-os/sdk/schema").Policy;
@@ -1,7 +1,7 @@
1
1
  import { policy } from '@astrale-os/sdk/schema';
2
2
  import { project_contains_issue } from '../../issue/index.js';
3
3
  import { Project, project_has_member, project_owned_by } from '../../project/index.js';
4
- export const TraverseIssueTag = policy({
4
+ export const ownsOrBelongsToProjectOfTaggedIssue = policy({
5
5
  description: 'Issue Tag relationships are visible only inside the containing Project.',
6
6
  match: ({ allOf, anyOf, edge, exists, source, subject }) => anyOf(exists(({ node }) => {
7
7
  const project = node(() => Project);
@@ -0,0 +1 @@
1
+ export declare const ownsProjectOfTag: import("@astrale-os/sdk/schema").Policy;
@@ -1,7 +1,7 @@
1
1
  import { policy } from '@astrale-os/sdk/schema';
2
2
  import { Project, project_owned_by } from '../../project/index.js';
3
3
  import { project_contains_tag } from '../classes/project-contains-tag.js';
4
- export const ManageTag = policy({
4
+ export const ownsProjectOfTag = policy({
5
5
  description: 'The caller owns the Project containing this Tag.',
6
6
  match: ({ allOf, edge, exists, object, subject }) => exists(({ node }) => {
7
7
  const project = node(() => Project);