@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.
- package/README.md +24 -12
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +1 -1
- package/dist/schema/modules/comment/classes/comment-authored-by.js +3 -3
- package/dist/schema/modules/comment/classes/comment.js +3 -3
- package/dist/schema/modules/comment/classes/issue-has-comment.d.ts +1 -1
- package/dist/schema/modules/comment/classes/issue-has-comment.js +5 -2
- package/dist/schema/modules/comment/functions/delete-comment.js +2 -2
- package/dist/schema/modules/comment/functions/edit-comment.js +2 -2
- package/dist/schema/modules/comment/index.d.ts +1 -1
- package/dist/schema/modules/comment/index.js +1 -1
- package/dist/schema/modules/comment/policies/authored-comment.d.ts +1 -0
- package/dist/schema/modules/comment/policies/{edit-own-comment.js → authored-comment.js} +1 -1
- package/dist/schema/modules/comment/policies/index.d.ts +4 -4
- package/dist/schema/modules/comment/policies/index.js +4 -4
- package/dist/schema/modules/comment/policies/owns-or-belongs-to-project-of-issue-of-authored-comment.d.ts +1 -0
- package/dist/schema/modules/comment/policies/{traverse-comment-relationship.js → owns-or-belongs-to-project-of-issue-of-authored-comment.js} +2 -2
- package/dist/schema/modules/comment/policies/owns-or-belongs-to-project-of-issue-of-comment-or-reported-issue-of-comment.d.ts +1 -0
- 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
- package/dist/schema/modules/comment/policies/owns-or-belongs-to-project-of-issue-with-comment-or-reported-issue-with-comment.d.ts +1 -0
- 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
- package/dist/schema/modules/issue/classes/index.d.ts +1 -0
- package/dist/schema/modules/issue/classes/index.js +1 -0
- package/dist/schema/modules/issue/classes/issue-assigned-to.d.ts +1 -1
- package/dist/schema/modules/issue/classes/issue-assigned-to.js +5 -2
- package/dist/schema/modules/issue/classes/issue-is-about.d.ts +30 -0
- package/dist/schema/modules/issue/classes/issue-is-about.js +16 -0
- package/dist/schema/modules/issue/classes/issue-reported-by.d.ts +1 -1
- package/dist/schema/modules/issue/classes/issue-reported-by.js +5 -2
- package/dist/schema/modules/issue/classes/issue-subtask-of.d.ts +2 -2
- package/dist/schema/modules/issue/classes/issue-subtask-of.js +5 -2
- package/dist/schema/modules/issue/classes/issue-tracked-by.d.ts +2 -2
- package/dist/schema/modules/issue/classes/issue-tracked-by.js +5 -2
- package/dist/schema/modules/issue/classes/issue.d.ts +9 -0
- package/dist/schema/modules/issue/classes/issue.js +5 -3
- package/dist/schema/modules/issue/classes/project-contains-issue.d.ts +1 -1
- package/dist/schema/modules/issue/classes/project-contains-issue.js +5 -3
- package/dist/schema/modules/issue/functions/add-issue-comment.js +2 -2
- package/dist/schema/modules/issue/functions/archive-issue.js +2 -2
- package/dist/schema/modules/issue/functions/assign-issue.js +2 -2
- package/dist/schema/modules/issue/functions/delete-issue.js +2 -2
- package/dist/schema/modules/issue/functions/edit-issue.js +2 -2
- package/dist/schema/modules/issue/functions/index.d.ts +1 -0
- package/dist/schema/modules/issue/functions/index.js +1 -0
- package/dist/schema/modules/issue/functions/set-issue-parent.js +2 -2
- package/dist/schema/modules/issue/functions/set-issue-tags.js +2 -2
- package/dist/schema/modules/issue/functions/set-issue-topics.d.ts +9 -0
- package/dist/schema/modules/issue/functions/set-issue-topics.js +12 -0
- package/dist/schema/modules/issue/functions/track-issue.js +2 -2
- package/dist/schema/modules/issue/functions/transition-issue.js +2 -2
- package/dist/schema/modules/issue/functions/untrack-issue.js +2 -2
- package/dist/schema/modules/issue/functions/update-issue.js +2 -2
- package/dist/schema/modules/issue/index.d.ts +3 -3
- package/dist/schema/modules/issue/index.js +3 -3
- package/dist/schema/modules/issue/policies/index.d.ts +9 -9
- package/dist/schema/modules/issue/policies/index.js +9 -9
- package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-assigned-issue.d.ts +1 -0
- package/dist/schema/modules/issue/policies/{traverse-issue-assignee.js → owns-or-belongs-to-project-of-assigned-issue.js} +1 -1
- package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-child-issue.d.ts +1 -0
- package/dist/schema/modules/issue/policies/{traverse-issue-parent.js → owns-or-belongs-to-project-of-child-issue.js} +1 -1
- package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-issue-or-reported-issue.d.ts +1 -0
- 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
- package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-issue-with-topic.d.ts +1 -0
- package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-issue-with-topic.js +13 -0
- package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-issue.d.ts +1 -0
- package/dist/schema/modules/issue/policies/{contribute-to-issue.js → owns-or-belongs-to-project-of-issue.js} +1 -1
- package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-reported-issue-or-reported-issue.d.ts +1 -0
- package/dist/schema/modules/issue/policies/{traverse-issue-reporter.js → owns-or-belongs-to-project-of-reported-issue-or-reported-issue.js} +1 -1
- package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-tracked-or-tracking-issue.d.ts +2 -0
- package/dist/schema/modules/issue/policies/{traverse-issue-tracking.js → owns-or-belongs-to-project-of-tracked-or-tracking-issue.js} +2 -2
- package/dist/schema/modules/issue/policies/owns-project-of-issue.d.ts +1 -0
- package/dist/schema/modules/issue/policies/{manage-issue.js → owns-project-of-issue.js} +1 -1
- package/dist/schema/modules/issue/policies/reported-issue.d.ts +1 -1
- package/dist/schema/modules/issue/policies/reported-issue.js +1 -1
- package/dist/schema/modules/issue/types/index.d.ts +1 -1
- package/dist/schema/modules/issue/types/index.js +1 -1
- package/dist/schema/modules/issue/types/issue.d.ts +2 -0
- package/dist/schema/modules/issue/types/issue.js +2 -0
- package/dist/schema/modules/project/classes/project-has-member.js +5 -2
- package/dist/schema/modules/project/classes/project-owned-by.js +5 -2
- package/dist/schema/modules/project/classes/project.js +2 -2
- package/dist/schema/modules/project/functions/add-project-member.js +2 -2
- package/dist/schema/modules/project/functions/archive-project.js +2 -2
- package/dist/schema/modules/project/functions/create-project-issue.js +2 -2
- package/dist/schema/modules/project/functions/create-project-tag.js +2 -2
- package/dist/schema/modules/project/functions/delete-project.js +2 -2
- package/dist/schema/modules/project/functions/receive-project-report.js +2 -2
- package/dist/schema/modules/project/functions/remove-project-member.js +2 -2
- package/dist/schema/modules/project/functions/update-project.js +2 -2
- package/dist/schema/modules/project/index.d.ts +1 -1
- package/dist/schema/modules/project/index.js +1 -1
- package/dist/schema/modules/project/policies/index.d.ts +5 -4
- package/dist/schema/modules/project/policies/index.js +5 -4
- package/dist/schema/modules/project/policies/owns-or-belongs-to-containing-project.d.ts +1 -0
- package/dist/schema/modules/project/policies/owns-or-belongs-to-containing-project.js +7 -0
- package/dist/schema/modules/project/policies/owns-or-belongs-to-project-of-membership.d.ts +1 -0
- package/dist/schema/modules/project/policies/{traverse-project-member.js → owns-or-belongs-to-project-of-membership.js} +1 -1
- package/dist/schema/modules/project/policies/owns-or-belongs-to-project-of-ownership.d.ts +1 -0
- package/dist/schema/modules/project/policies/{traverse-project-owner.js → owns-or-belongs-to-project-of-ownership.js} +1 -1
- package/dist/schema/modules/project/policies/owns-or-belongs-to-project.d.ts +1 -0
- package/dist/schema/modules/project/policies/{contribute-to-project.js → owns-or-belongs-to-project.js} +1 -1
- package/dist/schema/modules/project/policies/owns-project.d.ts +1 -0
- package/dist/schema/modules/project/policies/{manage-project.js → owns-project.js} +1 -1
- package/dist/schema/modules/project/types/project-edges.d.ts +1 -1
- package/dist/schema/modules/tag/classes/issue-tagged-with.d.ts +1 -1
- package/dist/schema/modules/tag/classes/issue-tagged-with.js +5 -2
- package/dist/schema/modules/tag/classes/project-contains-tag.js +5 -3
- package/dist/schema/modules/tag/classes/tag.js +5 -2
- package/dist/schema/modules/tag/functions/delete-tag.js +2 -2
- package/dist/schema/modules/tag/functions/edit-tag.js +2 -2
- package/dist/schema/modules/tag/index.d.ts +1 -1
- package/dist/schema/modules/tag/index.js +1 -1
- package/dist/schema/modules/tag/policies/index.d.ts +3 -4
- package/dist/schema/modules/tag/policies/index.js +3 -4
- package/dist/schema/modules/tag/policies/owns-or-belongs-to-project-of-tag.d.ts +1 -0
- package/dist/schema/modules/tag/policies/{contribute-to-tag.js → owns-or-belongs-to-project-of-tag.js} +1 -1
- package/dist/schema/modules/tag/policies/owns-or-belongs-to-project-of-tagged-issue.d.ts +1 -0
- package/dist/schema/modules/tag/policies/{traverse-issue-tag.js → owns-or-belongs-to-project-of-tagged-issue.js} +1 -1
- package/dist/schema/modules/tag/policies/owns-project-of-tag.d.ts +1 -0
- package/dist/schema/modules/tag/policies/{manage-tag.js → owns-project-of-tag.js} +1 -1
- package/dist/schema/schema.d.ts +979 -30
- package/dist/schema/schema.js +28 -26
- package/package.json +3 -1
- package/dist/schema/modules/comment/policies/contribute-to-comment-or-reported-issue-of-comment.d.ts +0 -1
- package/dist/schema/modules/comment/policies/edit-own-comment.d.ts +0 -1
- package/dist/schema/modules/comment/policies/traverse-comment-relationship.d.ts +0 -1
- package/dist/schema/modules/comment/policies/traverse-issue-comment.d.ts +0 -1
- package/dist/schema/modules/issue/policies/contribute-to-issue-or-reported-issue.d.ts +0 -1
- package/dist/schema/modules/issue/policies/contribute-to-issue.d.ts +0 -1
- package/dist/schema/modules/issue/policies/manage-issue.d.ts +0 -1
- package/dist/schema/modules/issue/policies/traverse-issue-assignee.d.ts +0 -1
- package/dist/schema/modules/issue/policies/traverse-issue-parent.d.ts +0 -1
- package/dist/schema/modules/issue/policies/traverse-issue-reporter.d.ts +0 -1
- package/dist/schema/modules/issue/policies/traverse-issue-tracking.d.ts +0 -2
- package/dist/schema/modules/issue/policies/traverse-project-issue.d.ts +0 -1
- package/dist/schema/modules/issue/policies/traverse-project-issue.js +0 -6
- package/dist/schema/modules/project/policies/contribute-to-project.d.ts +0 -1
- package/dist/schema/modules/project/policies/manage-project.d.ts +0 -1
- package/dist/schema/modules/project/policies/traverse-project-member.d.ts +0 -1
- package/dist/schema/modules/project/policies/traverse-project-owner.d.ts +0 -1
- package/dist/schema/modules/tag/policies/contribute-to-tag.d.ts +0 -1
- package/dist/schema/modules/tag/policies/manage-tag.d.ts +0 -1
- package/dist/schema/modules/tag/policies/traverse-issue-tag.d.ts +0 -1
- package/dist/schema/modules/tag/policies/traverse-project-tag.d.ts +0 -1
- 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 {
|
|
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 {
|
|
4
|
+
export { ownsOrBelongsToProject, ownsOrBelongsToContainingProject, ownsProject, ownsOrBelongsToProjectOfMembership, ownsOrBelongsToProjectOfOwnership, } from './policies/index.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
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 {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 {
|
|
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: {
|
|
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: {
|
|
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 {
|
|
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: {
|
|
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 {
|
|
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(
|
|
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 {
|
|
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(
|
|
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 {
|
|
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 {
|
|
4
|
+
export { ownsOrBelongsToProjectOfTag, ownsProjectOfTag, ownsOrBelongsToProjectOfTaggedIssue, } from './policies/index.js';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
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 {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
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
|
|
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
|
|
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
|
|
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);
|