@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,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 { ownsOrBelongsToProjectOfIssue } from '../policies/owns-or-belongs-to-project-of-issue.js';
|
|
5
5
|
export const assignIssueMethod = method({
|
|
6
6
|
description: 'Assign this Issue to a Project participant or clear its assignee.',
|
|
7
7
|
auth: 'authorized',
|
|
8
|
-
policy: ({ check, self }) => check(
|
|
8
|
+
policy: ({ check, self }) => check(ownsOrBelongsToProjectOfIssue, self),
|
|
9
9
|
input: z.strictObject({ assigneeId: nodeIdValue.nullable() }),
|
|
10
10
|
output: z.strictObject({ issueId: nodeIdValue, assigneeId: nodeIdValue.optional() }),
|
|
11
11
|
});
|
|
@@ -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 { ownsProjectOfIssue } from '../policies/owns-project-of-issue.js';
|
|
5
5
|
export const deleteIssueMethod = method({
|
|
6
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
7
|
auth: 'authorized',
|
|
8
|
-
policy: ({ check, self }) => check(
|
|
8
|
+
policy: ({ check, self }) => check(ownsProjectOfIssue, self),
|
|
9
9
|
input: z.strictObject({}),
|
|
10
10
|
output: z.strictObject({ issueId: 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 { reportedIssue } from '../policies/reported-issue.js';
|
|
4
4
|
import { issueDescriptionValue, issueTitleValue, issueValue } from '../types/issue.js';
|
|
5
5
|
export const editIssueMethod = method({
|
|
6
6
|
description: 'Edit the title and description of this Issue as its reporter.',
|
|
7
7
|
auth: 'authorized',
|
|
8
|
-
policy: ({ check, self }) => check(
|
|
8
|
+
policy: ({ check, self }) => check(reportedIssue, self),
|
|
9
9
|
input: z.strictObject({
|
|
10
10
|
title: issueTitleValue.optional(),
|
|
11
11
|
description: issueDescriptionValue.optional(),
|
|
@@ -5,6 +5,7 @@ export { deleteIssueMethod } from './delete-issue.js';
|
|
|
5
5
|
export { editIssueMethod } from './edit-issue.js';
|
|
6
6
|
export { setIssueParentMethod } from './set-issue-parent.js';
|
|
7
7
|
export { setIssueTagsMethod } from './set-issue-tags.js';
|
|
8
|
+
export { setIssueTopicsMethod } from './set-issue-topics.js';
|
|
8
9
|
export { trackIssueMethod } from './track-issue.js';
|
|
9
10
|
export { transitionIssueMethod } from './transition-issue.js';
|
|
10
11
|
export { untrackIssueMethod } from './untrack-issue.js';
|
|
@@ -5,6 +5,7 @@ export { deleteIssueMethod } from './delete-issue.js';
|
|
|
5
5
|
export { editIssueMethod } from './edit-issue.js';
|
|
6
6
|
export { setIssueParentMethod } from './set-issue-parent.js';
|
|
7
7
|
export { setIssueTagsMethod } from './set-issue-tags.js';
|
|
8
|
+
export { setIssueTopicsMethod } from './set-issue-topics.js';
|
|
8
9
|
export { trackIssueMethod } from './track-issue.js';
|
|
9
10
|
export { transitionIssueMethod } from './transition-issue.js';
|
|
10
11
|
export { untrackIssueMethod } from './untrack-issue.js';
|
|
@@ -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 { ownsOrBelongsToProjectOfIssue } from '../policies/owns-or-belongs-to-project-of-issue.js';
|
|
5
5
|
export const setIssueParentMethod = method({
|
|
6
6
|
description: 'Set or clear this Issue parent inside the same Project.',
|
|
7
7
|
auth: 'authorized',
|
|
8
|
-
policy: ({ check, self }) => check(
|
|
8
|
+
policy: ({ check, self }) => check(ownsOrBelongsToProjectOfIssue, self),
|
|
9
9
|
input: z.strictObject({ parentId: nodeIdValue.nullable() }),
|
|
10
10
|
output: z.strictObject({ issueId: nodeIdValue, parentId: nodeIdValue.optional() }),
|
|
11
11
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
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 { ownsOrBelongsToProjectOfIssue } from '../policies/owns-or-belongs-to-project-of-issue.js';
|
|
5
5
|
import { MAX_ISSUE_TAGS } from '../types/index.js';
|
|
6
6
|
export const setIssueTagsMethod = method({
|
|
7
7
|
description: 'Replace this Issue Tag set with an exact Project-local set.',
|
|
8
8
|
auth: 'authorized',
|
|
9
|
-
policy: ({ check, self }) => check(
|
|
9
|
+
policy: ({ check, self }) => check(ownsOrBelongsToProjectOfIssue, self),
|
|
10
10
|
input: z.strictObject({ tagIds: z.array(nodeIdValue).max(MAX_ISSUE_TAGS) }),
|
|
11
11
|
output: z.strictObject({ issueId: nodeIdValue, tagIds: z.array(nodeIdValue) }),
|
|
12
12
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const setIssueTopicsMethod: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
2
|
+
topicIds: string[];
|
|
3
|
+
}, {
|
|
4
|
+
readonly mode: 'value';
|
|
5
|
+
readonly value: {
|
|
6
|
+
issueId: string;
|
|
7
|
+
topicIds: string[];
|
|
8
|
+
};
|
|
9
|
+
}, "authorized", false, false, undefined, undefined>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { nodeIdValue } from '../../../types/index.js';
|
|
4
|
+
import { ownsOrBelongsToProjectOfIssue } from '../policies/owns-or-belongs-to-project-of-issue.js';
|
|
5
|
+
import { MAX_ISSUE_TOPICS } from '../types/index.js';
|
|
6
|
+
export const setIssueTopicsMethod = method({
|
|
7
|
+
description: 'Replace the set of Nodes this Issue is about with an exact set the caller may read.',
|
|
8
|
+
auth: 'authorized',
|
|
9
|
+
policy: ({ check, self }) => check(ownsOrBelongsToProjectOfIssue, self),
|
|
10
|
+
input: z.strictObject({ topicIds: z.array(nodeIdValue).max(MAX_ISSUE_TOPICS) }),
|
|
11
|
+
output: z.strictObject({ issueId: nodeIdValue, topicIds: z.array(nodeIdValue) }),
|
|
12
|
+
});
|
|
@@ -2,12 +2,12 @@ import { method, path } from '@astrale-os/sdk/schema';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { nodeIdValue } from '../../../types/index.js';
|
|
4
4
|
import { Issue } from '../classes/issue.js';
|
|
5
|
-
import {
|
|
5
|
+
import { ownsOrBelongsToProjectOfIssue } from '../policies/owns-or-belongs-to-project-of-issue.js';
|
|
6
6
|
import { issueStatus } from '../states/index.js';
|
|
7
7
|
export const trackIssueMethod = method({
|
|
8
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
9
|
auth: 'authorized',
|
|
10
|
-
policy: ({ allOf, check, input, self }) => allOf(check(
|
|
10
|
+
policy: ({ allOf, check, input, self }) => allOf(check(ownsOrBelongsToProjectOfIssue, self), check(ownsOrBelongsToProjectOfIssue, input.issue)),
|
|
11
11
|
input: z.strictObject({ issue: path(() => Issue) }),
|
|
12
12
|
output: z.strictObject({
|
|
13
13
|
trackingId: nodeIdValue,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { method } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { ownsOrBelongsToProjectOfIssue } from '../policies/owns-or-belongs-to-project-of-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
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
|
-
policy: ({ check, self }) => check(
|
|
9
|
+
policy: ({ check, self }) => check(ownsOrBelongsToProjectOfIssue, self),
|
|
10
10
|
input: z.strictObject({ event: issueStatus.eventSchema }),
|
|
11
11
|
output: z.discriminatedUnion('kind', [
|
|
12
12
|
z.strictObject({ kind: z.literal('transitioned'), issue: issueValue }),
|
|
@@ -2,11 +2,11 @@ import { method, path } from '@astrale-os/sdk/schema';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { nodeIdValue } from '../../../types/index.js';
|
|
4
4
|
import { Issue } from '../classes/issue.js';
|
|
5
|
-
import {
|
|
5
|
+
import { ownsOrBelongsToProjectOfIssue } from '../policies/owns-or-belongs-to-project-of-issue.js';
|
|
6
6
|
export const untrackIssueMethod = method({
|
|
7
7
|
description: 'Stop tracking an Issue: it keeps its status and takes its own transitions again. Either side may untrack, even when archived.',
|
|
8
8
|
auth: 'authorized',
|
|
9
|
-
policy: ({ anyOf, check, input, self }) => anyOf(check(
|
|
9
|
+
policy: ({ anyOf, check, input, self }) => anyOf(check(ownsOrBelongsToProjectOfIssue, self), check(ownsOrBelongsToProjectOfIssue, input.issue)),
|
|
10
10
|
input: z.strictObject({ issue: path(() => Issue) }),
|
|
11
11
|
output: z.strictObject({ trackingId: nodeIdValue, issueId: nodeIdValue }),
|
|
12
12
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { method } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { ownsOrBelongsToProjectOfIssue } from '../policies/owns-or-belongs-to-project-of-issue.js';
|
|
4
4
|
import { issueDescriptionValue, issuePriorityValue, issueTitleValue, issueValue, } from '../types/issue.js';
|
|
5
5
|
export const updateIssueMethod = method({
|
|
6
6
|
description: 'Update mutable Issue fields.',
|
|
7
7
|
auth: 'authorized',
|
|
8
|
-
policy: ({ check, self }) => check(
|
|
8
|
+
policy: ({ check, self }) => check(ownsOrBelongsToProjectOfIssue, self),
|
|
9
9
|
input: z.strictObject({
|
|
10
10
|
title: issueTitleValue.optional(),
|
|
11
11
|
description: issueDescriptionValue.optional(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { issueDescriptionValue, issuePriorityValue, 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_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 {
|
|
3
|
+
export { issue_assigned_to, issue_is_about, 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, setIssueTopicsMethod, trackIssueMethod, transitionIssueMethod, untrackIssueMethod, updateIssueMethod, } from './functions/index.js';
|
|
5
|
+
export { ownsOrBelongsToProjectOfIssue, ownsOrBelongsToProjectOfIssueOrReportedIssue, ownsProjectOfIssue, reportedIssue, ownsOrBelongsToProjectOfAssignedIssue, ownsOrBelongsToProjectOfChildIssue, ownsOrBelongsToProjectOfReportedIssueOrReportedIssue, ownsOrBelongsToProjectOfIssueWithTopic, ownsOrBelongsToProjectOfTrackedOrTrackingIssue, } from './policies/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { issueDescriptionValue, issuePriorityValue, 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_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 {
|
|
3
|
+
export { issue_assigned_to, issue_is_about, 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, setIssueTopicsMethod, trackIssueMethod, transitionIssueMethod, untrackIssueMethod, updateIssueMethod, } from './functions/index.js';
|
|
5
|
+
export { ownsOrBelongsToProjectOfIssue, ownsOrBelongsToProjectOfIssueOrReportedIssue, ownsProjectOfIssue, reportedIssue, ownsOrBelongsToProjectOfAssignedIssue, ownsOrBelongsToProjectOfChildIssue, ownsOrBelongsToProjectOfReportedIssueOrReportedIssue, ownsOrBelongsToProjectOfIssueWithTopic, ownsOrBelongsToProjectOfTrackedOrTrackingIssue, } from './policies/index.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
1
|
+
export { ownsOrBelongsToProjectOfIssue } from './owns-or-belongs-to-project-of-issue.js';
|
|
2
|
+
export { ownsOrBelongsToProjectOfIssueOrReportedIssue } from './owns-or-belongs-to-project-of-issue-or-reported-issue.js';
|
|
3
|
+
export { ownsProjectOfIssue } from './owns-project-of-issue.js';
|
|
4
|
+
export { reportedIssue } from './reported-issue.js';
|
|
5
|
+
export { ownsOrBelongsToProjectOfAssignedIssue } from './owns-or-belongs-to-project-of-assigned-issue.js';
|
|
6
|
+
export { ownsOrBelongsToProjectOfChildIssue } from './owns-or-belongs-to-project-of-child-issue.js';
|
|
7
|
+
export { ownsOrBelongsToProjectOfReportedIssueOrReportedIssue } from './owns-or-belongs-to-project-of-reported-issue-or-reported-issue.js';
|
|
8
|
+
export { ownsOrBelongsToProjectOfIssueWithTopic } from './owns-or-belongs-to-project-of-issue-with-topic.js';
|
|
9
|
+
export { ownsOrBelongsToProjectOfTrackedOrTrackingIssue } from './owns-or-belongs-to-project-of-tracked-or-tracking-issue.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
1
|
+
export { ownsOrBelongsToProjectOfIssue } from './owns-or-belongs-to-project-of-issue.js';
|
|
2
|
+
export { ownsOrBelongsToProjectOfIssueOrReportedIssue } from './owns-or-belongs-to-project-of-issue-or-reported-issue.js';
|
|
3
|
+
export { ownsProjectOfIssue } from './owns-project-of-issue.js';
|
|
4
|
+
export { reportedIssue } from './reported-issue.js';
|
|
5
|
+
export { ownsOrBelongsToProjectOfAssignedIssue } from './owns-or-belongs-to-project-of-assigned-issue.js';
|
|
6
|
+
export { ownsOrBelongsToProjectOfChildIssue } from './owns-or-belongs-to-project-of-child-issue.js';
|
|
7
|
+
export { ownsOrBelongsToProjectOfReportedIssueOrReportedIssue } from './owns-or-belongs-to-project-of-reported-issue-or-reported-issue.js';
|
|
8
|
+
export { ownsOrBelongsToProjectOfIssueWithTopic } from './owns-or-belongs-to-project-of-issue-with-topic.js';
|
|
9
|
+
export { ownsOrBelongsToProjectOfTrackedOrTrackingIssue } from './owns-or-belongs-to-project-of-tracked-or-tracking-issue.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ownsOrBelongsToProjectOfAssignedIssue: 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_issue } from '../classes/project-contains-issue.js';
|
|
4
|
-
export const
|
|
4
|
+
export const ownsOrBelongsToProjectOfAssignedIssue = policy({
|
|
5
5
|
description: 'Issue assignment relationships are visible only inside the containing Project.',
|
|
6
6
|
match: ({ allOf, anyOf, edge, exists, subject, target }) => anyOf(exists(({ node }) => {
|
|
7
7
|
const project = node(() => Project);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ownsOrBelongsToProjectOfChildIssue: 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_issue } from '../classes/project-contains-issue.js';
|
|
4
|
-
export const
|
|
4
|
+
export const ownsOrBelongsToProjectOfChildIssue = policy({
|
|
5
5
|
description: 'Issue parent 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 ownsOrBelongsToProjectOfIssueOrReportedIssue: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -2,9 +2,9 @@ import { policy } from '@astrale-os/sdk/schema';
|
|
|
2
2
|
import { Project, project_has_member, project_owned_by } from '../../project/index.js';
|
|
3
3
|
import { issue_reported_by } from '../classes/issue-reported-by.js';
|
|
4
4
|
import { project_contains_issue } from '../classes/project-contains-issue.js';
|
|
5
|
-
// Flat rather than `policy.anyOf(
|
|
5
|
+
// Flat rather than `policy.anyOf(ownsOrBelongsToProjectOfIssue, reportedIssue)`: composition adds one level to
|
|
6
6
|
// the depth-4 collaborator walk, above the Pattern depth budget.
|
|
7
|
-
export const
|
|
7
|
+
export const ownsOrBelongsToProjectOfIssueOrReportedIssue = policy({
|
|
8
8
|
description: 'The caller owns or belongs to the Project containing this Issue, or is its immutable reporter.',
|
|
9
9
|
match: ({ allOf, anyOf, edge, exists, object, subject }) => anyOf(exists(({ node }) => {
|
|
10
10
|
const project = node(() => Project);
|
package/dist/schema/modules/issue/policies/owns-or-belongs-to-project-of-issue-with-topic.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ownsOrBelongsToProjectOfIssueWithTopic: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { Project, project_has_member, project_owned_by } from '../../project/index.js';
|
|
3
|
+
import { project_contains_issue } from '../classes/project-contains-issue.js';
|
|
4
|
+
export const ownsOrBelongsToProjectOfIssueWithTopic = policy({
|
|
5
|
+
description: 'What an Issue is about is visible only inside the containing Project.',
|
|
6
|
+
match: ({ allOf, anyOf, edge, exists, source, subject }) => anyOf(exists(({ node }) => {
|
|
7
|
+
const project = node(() => Project);
|
|
8
|
+
return allOf(edge({ source: project, class: () => project_contains_issue, target: source }), edge({ source: subject, class: () => project_owned_by, target: project }));
|
|
9
|
+
}), exists(({ node }) => {
|
|
10
|
+
const project = node(() => Project);
|
|
11
|
+
return allOf(edge({ source: project, class: () => project_contains_issue, target: source }), edge({ source: subject, class: () => project_has_member, target: project }));
|
|
12
|
+
})),
|
|
13
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ownsOrBelongsToProjectOfIssue: 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_issue } from '../classes/project-contains-issue.js';
|
|
4
|
-
export const
|
|
4
|
+
export const ownsOrBelongsToProjectOfIssue = policy({
|
|
5
5
|
description: 'The caller owns or belongs to the Project containing this Issue.',
|
|
6
6
|
match: ({ allOf, anyOf, edge, exists, object, subject }) => exists(({ node }) => {
|
|
7
7
|
const project = node(() => Project);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ownsOrBelongsToProjectOfReportedIssueOrReportedIssue: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -2,7 +2,7 @@ import { policy } from '@astrale-os/sdk/schema';
|
|
|
2
2
|
import { Project, project_has_member, project_owned_by } from '../../project/index.js';
|
|
3
3
|
import { issue_reported_by } from '../classes/issue-reported-by.js';
|
|
4
4
|
import { project_contains_issue } from '../classes/project-contains-issue.js';
|
|
5
|
-
export const
|
|
5
|
+
export const ownsOrBelongsToProjectOfReportedIssueOrReportedIssue = policy({
|
|
6
6
|
description: 'Issue reporter relationships are visible inside the containing Project and to the reporter.',
|
|
7
7
|
match: ({ allOf, anyOf, edge, exists, subject, target }) => anyOf(exists(({ node }) => {
|
|
8
8
|
const project = node(() => Project);
|
|
@@ -1,8 +1,8 @@
|
|
|
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_issue } from '../classes/project-contains-issue.js';
|
|
4
|
-
/** Flat rather than composed, as `
|
|
5
|
-
export const
|
|
4
|
+
/** Flat rather than composed, as `ownsOrBelongsToProjectOfIssueOrReportedIssue`, to stay in the depth budget. */
|
|
5
|
+
export const ownsOrBelongsToProjectOfTrackedOrTrackingIssue = policy({
|
|
6
6
|
description: 'A tracking relationship is visible to the owner and members of the Project of either Issue; never to a reporter alone.',
|
|
7
7
|
match: ({ anyOf, allOf, edge, exists, source, subject, target }) => {
|
|
8
8
|
const contributors = (issue) => [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ownsProjectOfIssue: 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_issue } from '../classes/project-contains-issue.js';
|
|
4
|
-
export const
|
|
4
|
+
export const ownsProjectOfIssue = policy({
|
|
5
5
|
description: 'The caller owns the Project containing this Issue.',
|
|
6
6
|
match: ({ allOf, edge, exists, object, subject }) => exists(({ node }) => {
|
|
7
7
|
const project = node(() => Project);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const reportedIssue: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { policy } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { issue_reported_by } from '../classes/issue-reported-by.js';
|
|
3
|
-
export const
|
|
3
|
+
export const reportedIssue = policy({
|
|
4
4
|
description: 'The caller is the immutable reporter of this Issue.',
|
|
5
5
|
match: ({ edge, object, subject }) => edge({ source: subject, class: () => issue_reported_by, target: object }),
|
|
6
6
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { issueDescriptionValue, issuePriorityValue, issueTitleValue, issueValue, MAX_ISSUE_TAGS, } from './issue.js';
|
|
1
|
+
export { issueDescriptionValue, issuePriorityValue, issueTitleValue, issueValue, MAX_ISSUE_TAGS, MAX_ISSUE_TOPICS, } from './issue.js';
|
|
2
2
|
export { reportContentValue, reportContextValue, receiveReportInput, reportReceiptValue, type ReportContent, } from './report.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { issueDescriptionValue, issuePriorityValue, issueTitleValue, issueValue, MAX_ISSUE_TAGS, } from './issue.js';
|
|
1
|
+
export { issueDescriptionValue, issuePriorityValue, issueTitleValue, issueValue, MAX_ISSUE_TAGS, MAX_ISSUE_TOPICS, } from './issue.js';
|
|
2
2
|
export { reportContentValue, reportContextValue, receiveReportInput, reportReceiptValue, } from './report.js';
|
|
@@ -3,6 +3,8 @@ import { z } from 'zod';
|
|
|
3
3
|
export declare const issueTitleValue: z.ZodString;
|
|
4
4
|
/** The Tags one Issue holds at most: `Issue.setTags` is the only call that tags an Issue. */
|
|
5
5
|
export declare const MAX_ISSUE_TAGS = 128;
|
|
6
|
+
/** The Nodes one Issue is about at most: `Issue.setTopics` is the only call that sets them. */
|
|
7
|
+
export declare const MAX_ISSUE_TOPICS = 32;
|
|
6
8
|
/** How urgent an Issue is: 0 is no priority, then 1 low, 2 medium, 3 high and 4 urgent. */
|
|
7
9
|
export declare const issuePriorityValue: z.ZodNumber;
|
|
8
10
|
/** An Issue description, as Markdown; empty when the Issue has none. */
|
|
@@ -5,6 +5,8 @@ import { issueStatus } from '../states/index.js';
|
|
|
5
5
|
export const issueTitleValue = z.string().min(1).max(100);
|
|
6
6
|
/** The Tags one Issue holds at most: `Issue.setTags` is the only call that tags an Issue. */
|
|
7
7
|
export const MAX_ISSUE_TAGS = 128;
|
|
8
|
+
/** The Nodes one Issue is about at most: `Issue.setTopics` is the only call that sets them. */
|
|
9
|
+
export const MAX_ISSUE_TOPICS = 32;
|
|
8
10
|
/** How urgent an Issue is: 0 is no priority, then 1 low, 2 medium, 3 high and 4 urgent. */
|
|
9
11
|
export const issuePriorityValue = z.number().int().min(0).max(4);
|
|
10
12
|
/** An Issue description, as Markdown; empty when the Issue has none. */
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { K, edgeClass } from '@astrale-os/sdk/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { ownsOrBelongsToProjectOfMembership } from '../policies/owns-or-belongs-to-project-of-membership.js';
|
|
3
3
|
import { Project } from './project.js';
|
|
4
4
|
export const project_has_member = edgeClass.directed({
|
|
5
5
|
description: 'An Identity admitted to collaborate in one Project.',
|
|
6
6
|
source: { as: 'member', accepts: [K.classes.Identity], outgoing: '0..*' },
|
|
7
7
|
target: { as: 'project', accepts: [() => Project], incoming: '0..*' },
|
|
8
|
-
policies: {
|
|
8
|
+
policies: {
|
|
9
|
+
read: () => ownsOrBelongsToProjectOfMembership,
|
|
10
|
+
traverse: () => ownsOrBelongsToProjectOfMembership,
|
|
11
|
+
},
|
|
9
12
|
});
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { K, edgeClass } from '@astrale-os/sdk/schema';
|
|
2
|
-
import {
|
|
2
|
+
import { ownsOrBelongsToProjectOfOwnership } from '../policies/owns-or-belongs-to-project-of-ownership.js';
|
|
3
3
|
import { Project } from './project.js';
|
|
4
4
|
export const project_owned_by = edgeClass.directed({
|
|
5
5
|
description: 'The exact Identity that owns and administers one Project. Deleting the owner removes this Edge; the Project stays, administered by no one.',
|
|
6
6
|
source: { as: 'owner', accepts: [K.classes.Identity], outgoing: '0..*' },
|
|
7
7
|
target: { as: 'project', accepts: [() => Project], incoming: '0..1' },
|
|
8
|
-
policies: {
|
|
8
|
+
policies: {
|
|
9
|
+
read: () => ownsOrBelongsToProjectOfOwnership,
|
|
10
|
+
traverse: () => ownsOrBelongsToProjectOfOwnership,
|
|
11
|
+
},
|
|
9
12
|
});
|
|
@@ -11,7 +11,7 @@ import { deleteProjectMethod } from '../functions/delete-project.js';
|
|
|
11
11
|
import { receiveProjectReportMethod } from '../functions/receive-project-report.js';
|
|
12
12
|
import { removeProjectMemberMethod } from '../functions/remove-project-member.js';
|
|
13
13
|
import { updateProjectMethod } from '../functions/update-project.js';
|
|
14
|
-
import {
|
|
14
|
+
import { ownsOrBelongsToProject } from '../policies/owns-or-belongs-to-project.js';
|
|
15
15
|
export const Project = nodeClass({
|
|
16
16
|
description: 'A collaborative namespace for numbered Issues, Tags, and membership.',
|
|
17
17
|
icon: classIcon.lucide(FolderKanban),
|
|
@@ -34,5 +34,5 @@ export const Project = nodeClass({
|
|
|
34
34
|
archive: archiveProjectMethod,
|
|
35
35
|
delete: deleteProjectMethod,
|
|
36
36
|
},
|
|
37
|
-
policies: { read: () =>
|
|
37
|
+
policies: { read: () => ownsOrBelongsToProject, traverse: () => ownsOrBelongsToProject },
|
|
38
38
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
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 { ownsProject } from '../policies/owns-project.js';
|
|
5
5
|
import { membershipChangeValue } from '../types/membership-change.js';
|
|
6
6
|
export const addProjectMemberMethod = method({
|
|
7
7
|
description: 'Add one Identity as a Project member.',
|
|
8
8
|
auth: 'authorized',
|
|
9
|
-
policy: ({ check, self }) => check(
|
|
9
|
+
policy: ({ check, self }) => check(ownsProject, self),
|
|
10
10
|
input: z.strictObject({ memberId: nodeIdValue }),
|
|
11
11
|
output: membershipChangeValue,
|
|
12
12
|
});
|
|
@@ -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 { ownsProject } from '../policies/owns-project.js';
|
|
5
5
|
export const archiveProjectMethod = method({
|
|
6
6
|
description: 'Archive this Project without deleting its aggregate.',
|
|
7
7
|
auth: 'authorized',
|
|
8
|
-
policy: ({ check, self }) => check(
|
|
8
|
+
policy: ({ check, self }) => check(ownsProject, self),
|
|
9
9
|
input: z.strictObject({}),
|
|
10
10
|
output: z.strictObject({ projectId: nodeIdValue, archived: 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
3
|
import { issueDescriptionValue, issuePriorityValue, issueTitleValue, issueValue, } from '../../issue/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { ownsOrBelongsToProject } from '../policies/owns-or-belongs-to-project.js';
|
|
5
5
|
export const createProjectIssueMethod = method({
|
|
6
6
|
description: 'Create one atomically numbered Issue in this Project.',
|
|
7
7
|
auth: 'authorized',
|
|
8
|
-
policy: ({ check, self }) => check(
|
|
8
|
+
policy: ({ check, self }) => check(ownsOrBelongsToProject, self),
|
|
9
9
|
input: z.strictObject({
|
|
10
10
|
title: issueTitleValue,
|
|
11
11
|
description: issueDescriptionValue.optional(),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { method } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { tagValue } from '../../tag/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { ownsProject } from '../policies/owns-project.js';
|
|
5
5
|
export const createProjectTagMethod = method({
|
|
6
6
|
description: 'Create one Project-local Tag.',
|
|
7
7
|
auth: 'authorized',
|
|
8
|
-
policy: ({ check, self }) => check(
|
|
8
|
+
policy: ({ check, self }) => check(ownsProject, self),
|
|
9
9
|
input: z.strictObject({
|
|
10
10
|
name: z.string().min(1).max(64),
|
|
11
11
|
color: z.string().optional(),
|
|
@@ -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 { ownsProject } from '../policies/owns-project.js';
|
|
5
5
|
export const deleteProjectMethod = method({
|
|
6
6
|
description: 'Delete this Project for good, archived or not, with its Issues, their Comments and its Tags. Issues of other Projects it tracks or that track one of its Issues stay, untracked. Refused when that takes more than 2,048 writes.',
|
|
7
7
|
auth: 'authorized',
|
|
8
|
-
policy: ({ check, self }) => check(
|
|
8
|
+
policy: ({ check, self }) => check(ownsProject, self),
|
|
9
9
|
input: z.strictObject({}),
|
|
10
10
|
output: z.strictObject({ projectId: nodeIdValue, deleted: z.literal(true) }),
|
|
11
11
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { method } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { receiveReportInput, reportReceiptValue } from '../../issue/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { ownsProject } from '../policies/owns-project.js';
|
|
4
4
|
export const receiveProjectReportMethod = method({
|
|
5
5
|
description: 'Receive an idempotent report from a trusted Project owner integration, attributing its verified reporter without granting Project membership.',
|
|
6
6
|
auth: 'authorized',
|
|
7
|
-
policy: ({ check, self }) => check(
|
|
7
|
+
policy: ({ check, self }) => check(ownsProject, self),
|
|
8
8
|
input: receiveReportInput,
|
|
9
9
|
output: reportReceiptValue,
|
|
10
10
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
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 { ownsProject } from '../policies/owns-project.js';
|
|
5
5
|
import { membershipChangeValue } from '../types/membership-change.js';
|
|
6
6
|
export const removeProjectMemberMethod = method({
|
|
7
7
|
description: 'Remove one unassigned Identity from Project membership.',
|
|
8
8
|
auth: 'authorized',
|
|
9
|
-
policy: ({ check, self }) => check(
|
|
9
|
+
policy: ({ check, self }) => check(ownsProject, self),
|
|
10
10
|
input: z.strictObject({ memberId: nodeIdValue }),
|
|
11
11
|
output: membershipChangeValue,
|
|
12
12
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { method } from '@astrale-os/sdk/schema';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { ownsProject } from '../policies/owns-project.js';
|
|
4
4
|
import { projectValue } from '../types/project.js';
|
|
5
5
|
export const updateProjectMethod = method({
|
|
6
6
|
description: 'Update mutable Project metadata.',
|
|
7
7
|
auth: 'authorized',
|
|
8
|
-
policy: ({ check, self }) => check(
|
|
8
|
+
policy: ({ check, self }) => check(ownsProject, self),
|
|
9
9
|
input: z.strictObject({
|
|
10
10
|
name: z.string().min(1).max(100).optional(),
|
|
11
11
|
description: z.string().max(1_000).optional(),
|