@milesroxas/design-hub 0.6.2 → 0.8.0
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 +16 -6
- package/core/review/model.ts +124 -6
- package/core/review/policy.test.ts +103 -24
- package/core/review/policy.ts +43 -7
- package/core/review/service.test.ts +569 -33
- package/core/review/service.ts +272 -76
- package/core/review/store.ts +24 -4
- package/dist/core/review/model.d.ts +59 -4
- package/dist/core/review/model.js +98 -4
- package/dist/core/review/policy.d.ts +21 -2
- package/dist/core/review/policy.js +34 -2
- package/dist/core/review/service.d.ts +39 -11
- package/dist/core/review/service.js +237 -77
- package/dist/core/review/store.d.ts +17 -4
- package/dist/core/review/store.js +21 -3
- package/dist/scripts/bootstrap.d.ts +16 -14
- package/dist/scripts/bootstrap.js +56 -39
- package/dist/scripts/comments.d.ts +10 -2
- package/dist/scripts/comments.js +18 -7
- package/dist/scripts/lib/deploy.d.ts +12 -4
- package/dist/scripts/lib/deploy.js +47 -13
- package/dist/scripts/lib/vercel.d.ts +8 -2
- package/dist/scripts/lib/vercel.js +23 -9
- package/dist/scripts/people.d.ts +13 -26
- package/dist/scripts/people.js +68 -35
- package/dist/scripts/preflight.js +2 -2
- package/dist/scripts/share.d.ts +2 -3
- package/dist/scripts/share.js +18 -10
- package/dist/server/api.d.ts +6 -2
- package/dist/server/api.js +65 -24
- package/dist/server/fake-upstash.js +3 -2
- package/dist/server/local.js +2 -0
- package/dist/server/session.d.ts +25 -10
- package/dist/server/session.js +69 -52
- package/dist/server/upstash.js +4 -3
- package/dist/vercel/proxy.d.ts +5 -3
- package/dist/vercel/proxy.js +183 -157
- package/dist/vite/plugin.js +5 -5
- package/kit/prefs.ts +19 -2
- package/package.json +2 -2
- package/shell/review/Bar.tsx +97 -4
- package/shell/review/People.tsx +178 -45
- package/shell/review/Pins.tsx +39 -24
- package/shell/review/Review.tsx +113 -29
- package/shell/review/ThreadCard.tsx +25 -13
- package/shell/review/client.ts +64 -23
- package/shell/review/review.css +16 -2
- package/shell/review/view.test.ts +73 -1
- package/shell/review/view.ts +49 -3
- package/skills/miles-deploy/SKILL.md +44 -16
- package/skills/miles-design-hub/SKILL.md +5 -5
- package/skills/miles-new-feature/SKILL.md +1 -1
- package/skills/miles-review/SKILL.md +10 -6
- package/skills/miles-worktrees/SKILL.md +1 -1
- package/templates/conductor/settings.toml +1 -1
- package/templates/guide.md +1 -1
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
/** Which side a person is on: the studio that makes the work, or the client it is for. */
|
|
2
2
|
export declare const PERSON_KINDS: readonly ['studio', 'client'];
|
|
3
3
|
export type PersonKind = (typeof PERSON_KINDS)[number];
|
|
4
|
+
/**
|
|
5
|
+
* Who a thread is for. Internal stays inside the studio; client-facing is
|
|
6
|
+
* read by everyone. Fixed when the thread is made: no op changes it.
|
|
7
|
+
*/
|
|
8
|
+
declare const AUDIENCES: readonly ['internal', 'client'];
|
|
9
|
+
export type Audience = (typeof AUDIENCES)[number];
|
|
4
10
|
/** How a comment is triaged: something broken, a design opinion, or the words. */
|
|
5
11
|
export declare const KINDS: readonly ['bug', 'taste', 'copy'];
|
|
6
12
|
export type Kind = (typeof KINDS)[number];
|
|
7
|
-
/** How long an
|
|
8
|
-
export declare const
|
|
13
|
+
/** How long an unused sign-in link lasts. A link signs in one device, then stops working. */
|
|
14
|
+
export declare const LINK_DAYS = 14;
|
|
15
|
+
/**
|
|
16
|
+
* How long a person keeps access: three months, six months, or open-ended.
|
|
17
|
+
* The project sets a default; Studio can set it for one person.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ACCESS: readonly ['3m', '6m', 'open'];
|
|
20
|
+
export type Access = (typeof ACCESS)[number];
|
|
21
|
+
/** The project default when none is set. */
|
|
22
|
+
export declare const DEFAULT_ACCESS: Access;
|
|
23
|
+
/** When access given at `from` ends, as an ISO time, or null for open-ended. */
|
|
24
|
+
export declare function accessEnd(access: Access, from: Date): string | null;
|
|
9
25
|
export declare const LIMITS: {
|
|
10
26
|
readonly name: 80;
|
|
11
27
|
readonly team: 80;
|
|
@@ -22,11 +38,20 @@ export type Person = {
|
|
|
22
38
|
/** The group a person belongs to, shown beside their name: the studio, or the client's company. */
|
|
23
39
|
team: string;
|
|
24
40
|
kind: PersonKind;
|
|
41
|
+
/** Always null until email sign-in exists. */
|
|
42
|
+
email: string | null;
|
|
43
|
+
/** When their access ends (ISO time), or null for open-ended. Their sessions end with it. */
|
|
44
|
+
accessEndsAt: string | null;
|
|
25
45
|
createdAt: string;
|
|
26
46
|
revokedAt: string | null;
|
|
27
|
-
/** Bumped on revoke and on
|
|
47
|
+
/** Bumped on revoke and on sign out everywhere, which ends every session signed with the old one. */
|
|
28
48
|
epoch: number;
|
|
29
49
|
};
|
|
50
|
+
/** A one-time sign-in link, stored under the hash of its token and deleted when used. */
|
|
51
|
+
export type Link = {
|
|
52
|
+
person: string;
|
|
53
|
+
expiresAt: string;
|
|
54
|
+
};
|
|
30
55
|
/** A comment's author as it was when they wrote it, so a revoked person's comments still read. */
|
|
31
56
|
export type Author = Pick<Person, 'id' | 'name' | 'team'>;
|
|
32
57
|
export type Anchor = {
|
|
@@ -68,7 +93,28 @@ export type Comment = {
|
|
|
68
93
|
status: 'open' | 'resolved';
|
|
69
94
|
resolvedBy: Author | null;
|
|
70
95
|
triage: Triage | null;
|
|
96
|
+
/** The thread's audience. Set on the root when it is made and copied onto every reply; never changed. */
|
|
97
|
+
audience: Audience;
|
|
98
|
+
/**
|
|
99
|
+
* The thread's number on its prototype, from 1, copied onto every reply. Never reused, so a
|
|
100
|
+
* deleted or hidden thread moves no other number. 0 for a thread stored before numbers existed.
|
|
101
|
+
*/
|
|
102
|
+
number: number;
|
|
71
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* A stored comment as the rules read it. A record with no audience, or one
|
|
106
|
+
* that is not a known value, is internal: a missing field never shows a
|
|
107
|
+
* Client anything. A missing or broken number reads as 0, no number.
|
|
108
|
+
*/
|
|
109
|
+
export declare function readComment(json: string): Comment;
|
|
110
|
+
/** Whether a stored profile (a person without revocation and epoch) is well formed. */
|
|
111
|
+
export declare function isProfile(v: unknown): v is Omit<Person, 'revokedAt' | 'epoch'>;
|
|
112
|
+
/**
|
|
113
|
+
* Whether someone may sign in at `at`: not revoked, and an access end that is
|
|
114
|
+
* open (null) or a parseable time still ahead. An access end that does not
|
|
115
|
+
* parse is no access.
|
|
116
|
+
*/
|
|
117
|
+
export declare function hasAccess(p: Pick<Person, 'revokedAt' | 'accessEndsAt'>, at: Date): boolean;
|
|
72
118
|
export declare const authorOf: (p: Person) => Author;
|
|
73
119
|
export declare const isRoot: (c: Comment) => boolean;
|
|
74
120
|
export type Checked<T> = {
|
|
@@ -78,9 +124,18 @@ export type Checked<T> = {
|
|
|
78
124
|
ok: false;
|
|
79
125
|
problems: string[];
|
|
80
126
|
};
|
|
81
|
-
export declare function
|
|
127
|
+
export declare function checkAccess(input: unknown): Checked<Access>;
|
|
128
|
+
export type PersonInput = Pick<Person, 'name' | 'team' | 'kind'> & {
|
|
129
|
+
access: Access | null;
|
|
130
|
+
};
|
|
131
|
+
export declare function checkPersonInput(input: unknown): Checked<PersonInput>;
|
|
132
|
+
/** A new thread's audience as asked: one of AUDIENCES, or null when none is given. */
|
|
133
|
+
export declare function checkAudience(input: unknown): Checked<Audience | null>;
|
|
134
|
+
/** Whose view of the comments is asked for: a person kind, or null for the caller's own. */
|
|
135
|
+
export declare function checkViewAs(input: unknown): Checked<PersonKind | null>;
|
|
82
136
|
export declare function checkBody(body: unknown): Checked<string>;
|
|
83
137
|
export declare function checkAnchor(input: unknown): Checked<Anchor>;
|
|
84
138
|
/** The README states a client offers for triage: trimmed, capped, de-duplicated. */
|
|
85
139
|
export declare function checkStates(input: unknown): string[];
|
|
86
140
|
export declare function checkTriage(input: unknown, states: string[] | null): Checked<Pick<Triage, 'kind' | 'state'>>;
|
|
141
|
+
export {};
|
|
@@ -6,10 +6,36 @@
|
|
|
6
6
|
import { SLUG } from '../feature.js';
|
|
7
7
|
/** Which side a person is on: the studio that makes the work, or the client it is for. */
|
|
8
8
|
export const PERSON_KINDS = ['studio', 'client'];
|
|
9
|
+
/**
|
|
10
|
+
* Who a thread is for. Internal stays inside the studio; client-facing is
|
|
11
|
+
* read by everyone. Fixed when the thread is made: no op changes it.
|
|
12
|
+
*/
|
|
13
|
+
const AUDIENCES = ['internal', 'client'];
|
|
9
14
|
/** How a comment is triaged: something broken, a design opinion, or the words. */
|
|
10
15
|
export const KINDS = ['bug', 'taste', 'copy'];
|
|
11
|
-
/** How long an
|
|
12
|
-
export const
|
|
16
|
+
/** How long an unused sign-in link lasts. A link signs in one device, then stops working. */
|
|
17
|
+
export const LINK_DAYS = 14;
|
|
18
|
+
/**
|
|
19
|
+
* How long a person keeps access: three months, six months, or open-ended.
|
|
20
|
+
* The project sets a default; Studio can set it for one person.
|
|
21
|
+
*/
|
|
22
|
+
export const ACCESS = ['3m', '6m', 'open'];
|
|
23
|
+
/** The project default when none is set. */
|
|
24
|
+
export const DEFAULT_ACCESS = '3m';
|
|
25
|
+
const ACCESS_MONTHS = { '3m': 3, '6m': 6 };
|
|
26
|
+
/** When access given at `from` ends, as an ISO time, or null for open-ended. */
|
|
27
|
+
export function accessEnd(access, from) {
|
|
28
|
+
if (access === 'open')
|
|
29
|
+
return null;
|
|
30
|
+
// On the same day of the month, or the target month's last day when it is shorter (30 Nov + 3m is 28 Feb).
|
|
31
|
+
const end = new Date(from.getTime());
|
|
32
|
+
const day = end.getUTCDate();
|
|
33
|
+
end.setUTCDate(1);
|
|
34
|
+
end.setUTCMonth(end.getUTCMonth() + ACCESS_MONTHS[access]);
|
|
35
|
+
const last = new Date(Date.UTC(end.getUTCFullYear(), end.getUTCMonth() + 1, 0)).getUTCDate();
|
|
36
|
+
end.setUTCDate(Math.min(day, last));
|
|
37
|
+
return end.toISOString();
|
|
38
|
+
}
|
|
13
39
|
export const LIMITS = {
|
|
14
40
|
name: 80,
|
|
15
41
|
team: 80,
|
|
@@ -20,6 +46,49 @@ export const LIMITS = {
|
|
|
20
46
|
states: 50,
|
|
21
47
|
stateName: 120,
|
|
22
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* A stored comment as the rules read it. A record with no audience, or one
|
|
51
|
+
* that is not a known value, is internal: a missing field never shows a
|
|
52
|
+
* Client anything. A missing or broken number reads as 0, no number.
|
|
53
|
+
*/
|
|
54
|
+
export function readComment(json) {
|
|
55
|
+
const c = JSON.parse(json);
|
|
56
|
+
const audience = c.audience === 'client' ? 'client' : 'internal';
|
|
57
|
+
const number = Number.isInteger(c.number) && c.number > 0 ? c.number : 0;
|
|
58
|
+
return { ...c, audience, number };
|
|
59
|
+
}
|
|
60
|
+
const isText = (v) => typeof v === 'string';
|
|
61
|
+
const isTextOrNull = (v) => v === null || typeof v === 'string';
|
|
62
|
+
/** What a stored profile must hold to be a person; anything else is no person at all. */
|
|
63
|
+
const PROFILE_RULES = [
|
|
64
|
+
['id', (v) => isText(v) && v !== ''],
|
|
65
|
+
['name', isText],
|
|
66
|
+
['team', isText],
|
|
67
|
+
['kind', (v) => PERSON_KINDS.includes(v)],
|
|
68
|
+
['email', isTextOrNull],
|
|
69
|
+
['accessEndsAt', isTextOrNull],
|
|
70
|
+
['createdAt', isText],
|
|
71
|
+
];
|
|
72
|
+
/** Whether a stored profile (a person without revocation and epoch) is well formed. */
|
|
73
|
+
export function isProfile(v) {
|
|
74
|
+
if (!v || typeof v !== 'object' || Array.isArray(v))
|
|
75
|
+
return false;
|
|
76
|
+
const o = v;
|
|
77
|
+
return PROFILE_RULES.every(([key, ok]) => ok(o[key]));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Whether someone may sign in at `at`: not revoked, and an access end that is
|
|
81
|
+
* open (null) or a parseable time still ahead. An access end that does not
|
|
82
|
+
* parse is no access.
|
|
83
|
+
*/
|
|
84
|
+
export function hasAccess(p, at) {
|
|
85
|
+
if (p.revokedAt !== null)
|
|
86
|
+
return false;
|
|
87
|
+
if (p.accessEndsAt === null)
|
|
88
|
+
return true;
|
|
89
|
+
const end = Date.parse(p.accessEndsAt);
|
|
90
|
+
return Number.isFinite(end) && end > at.getTime();
|
|
91
|
+
}
|
|
23
92
|
export const authorOf = (p) => ({ id: p.id, name: p.name, team: p.team });
|
|
24
93
|
export const isRoot = (c) => c.thread === c.id;
|
|
25
94
|
const text = (v, path, max, problems) => {
|
|
@@ -34,18 +103,43 @@ const text = (v, path, max, problems) => {
|
|
|
34
103
|
};
|
|
35
104
|
const fraction = (v) => typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 1;
|
|
36
105
|
const size = (v) => typeof v === 'number' && Number.isFinite(v) && v >= 0 && v < 100_000;
|
|
106
|
+
const isAccess = (v) => ACCESS.includes(v);
|
|
107
|
+
const ACCESS_PROBLEM = `access: one of ${ACCESS.join(', ')}`;
|
|
108
|
+
export function checkAccess(input) {
|
|
109
|
+
return isAccess(input) ? { ok: true, value: input } : { ok: false, problems: [ACCESS_PROBLEM] };
|
|
110
|
+
}
|
|
37
111
|
export function checkPersonInput(input) {
|
|
38
112
|
const i = (input ?? {});
|
|
39
113
|
const problems = [];
|
|
40
114
|
const name = text(i.name, 'name', LIMITS.name, problems);
|
|
41
115
|
const team = text(i.team, 'team', LIMITS.team, problems);
|
|
42
|
-
// Most people
|
|
116
|
+
// Most people added are on the client's side; Studio is the deliberate choice.
|
|
43
117
|
const kind = i.kind ?? 'client';
|
|
44
118
|
if (!PERSON_KINDS.includes(kind))
|
|
45
119
|
problems.push(`kind: one of ${PERSON_KINDS.join(', ')}`);
|
|
120
|
+
// Absent, the service picks: the project default for a Client, open-ended for Studio.
|
|
121
|
+
const access = i.access ?? null;
|
|
122
|
+
if (access !== null && !isAccess(access))
|
|
123
|
+
problems.push(ACCESS_PROBLEM);
|
|
46
124
|
return problems.length
|
|
47
125
|
? { ok: false, problems }
|
|
48
|
-
: { ok: true, value: { name, team, kind: kind } };
|
|
126
|
+
: { ok: true, value: { name, team, kind: kind, access: access } };
|
|
127
|
+
}
|
|
128
|
+
/** A new thread's audience as asked: one of AUDIENCES, or null when none is given. */
|
|
129
|
+
export function checkAudience(input) {
|
|
130
|
+
if (input === undefined || input === null)
|
|
131
|
+
return { ok: true, value: null };
|
|
132
|
+
return AUDIENCES.includes(input)
|
|
133
|
+
? { ok: true, value: input }
|
|
134
|
+
: { ok: false, problems: [`audience: one of ${AUDIENCES.join(', ')}`] };
|
|
135
|
+
}
|
|
136
|
+
/** Whose view of the comments is asked for: a person kind, or null for the caller's own. */
|
|
137
|
+
export function checkViewAs(input) {
|
|
138
|
+
if (input === undefined || input === null)
|
|
139
|
+
return { ok: true, value: null };
|
|
140
|
+
return PERSON_KINDS.includes(input)
|
|
141
|
+
? { ok: true, value: input }
|
|
142
|
+
: { ok: false, problems: [`viewAs: one of ${PERSON_KINDS.join(', ')}`] };
|
|
49
143
|
}
|
|
50
144
|
export function checkBody(body) {
|
|
51
145
|
const problems = [];
|
|
@@ -1,6 +1,25 @@
|
|
|
1
|
-
import type { Comment, Person } from './model.ts';
|
|
1
|
+
import type { Audience, Comment, Person, PersonKind } from './model.ts';
|
|
2
2
|
export type Action = 'read' | 'comment' | 'edit' | 'delete' | 'resolve' | 'triage' | 'people';
|
|
3
3
|
/** Only what the rules read, so the browser's signed-in person (no epoch) is checked by the same rules. */
|
|
4
4
|
type Actor = Pick<Person, 'id' | 'kind' | 'revokedAt'>;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* `root` is the thread acted on, `subject` the comment in it when that is a
|
|
7
|
+
* reply (edit or delete one); without `subject`, the root is the subject.
|
|
8
|
+
* Without a root, the action is on no thread: listing, or a new thread.
|
|
9
|
+
*/
|
|
10
|
+
export declare function can(actor: Actor | null, action: Action, root?: Comment, subject?: Comment): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The view a person gets: their own kind, or a narrower one they ask for.
|
|
13
|
+
* Studio may look as a Client does (Client view); a Client asking for
|
|
14
|
+
* Studio's still gets a Client's, so the view is never wider than the person.
|
|
15
|
+
*/
|
|
16
|
+
export declare function viewOf(actor: Pick<Person, 'kind'> | null, viewAs?: PersonKind | null): PersonKind;
|
|
17
|
+
/**
|
|
18
|
+
* The comments a view may see. Studio sees all. A Client sees a client-facing
|
|
19
|
+
* thread and its client-facing replies; a reply whose thread is not among
|
|
20
|
+
* them is not seen either.
|
|
21
|
+
*/
|
|
22
|
+
export declare function visibleTo(viewAs: PersonKind, comments: Comment[]): Comment[];
|
|
23
|
+
/** A new thread's audience: a Client's is always client-facing; Studio's is internal unless Studio asks otherwise. */
|
|
24
|
+
export declare function audienceFor(actor: Pick<Person, 'kind'>, asked: Audience | null): Audience;
|
|
6
25
|
export {};
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/** Whether a comment reaches a Client. Only the exact value counts, so a record without one stays inside. */
|
|
2
|
+
const clientFacing = (c) => c.audience === 'client';
|
|
3
|
+
/**
|
|
4
|
+
* `root` is the thread acted on, `subject` the comment in it when that is a
|
|
5
|
+
* reply (edit or delete one); without `subject`, the root is the subject.
|
|
6
|
+
* Without a root, the action is on no thread: listing, or a new thread.
|
|
7
|
+
*/
|
|
8
|
+
export function can(actor, action, root, subject) {
|
|
2
9
|
if (!actor || actor.revokedAt)
|
|
3
10
|
return false;
|
|
4
11
|
const studio = actor.kind === 'studio';
|
|
5
|
-
|
|
12
|
+
if (!studio && [root, subject].some((c) => c && !clientFacing(c)))
|
|
13
|
+
return false;
|
|
14
|
+
const own = (subject ?? root)?.author.id === actor.id;
|
|
6
15
|
switch (action) {
|
|
7
16
|
case 'read':
|
|
8
17
|
case 'comment':
|
|
@@ -17,3 +26,26 @@ export function can(actor, action, subject) {
|
|
|
17
26
|
return studio;
|
|
18
27
|
}
|
|
19
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* The view a person gets: their own kind, or a narrower one they ask for.
|
|
31
|
+
* Studio may look as a Client does (Client view); a Client asking for
|
|
32
|
+
* Studio's still gets a Client's, so the view is never wider than the person.
|
|
33
|
+
*/
|
|
34
|
+
export function viewOf(actor, viewAs) {
|
|
35
|
+
return actor?.kind === 'studio' && viewAs !== 'client' ? 'studio' : 'client';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The comments a view may see. Studio sees all. A Client sees a client-facing
|
|
39
|
+
* thread and its client-facing replies; a reply whose thread is not among
|
|
40
|
+
* them is not seen either.
|
|
41
|
+
*/
|
|
42
|
+
export function visibleTo(viewAs, comments) {
|
|
43
|
+
if (viewAs === 'studio')
|
|
44
|
+
return comments;
|
|
45
|
+
const roots = new Set(comments.filter((c) => c.thread === c.id && clientFacing(c)).map((c) => c.id));
|
|
46
|
+
return comments.filter((c) => clientFacing(c) && roots.has(c.thread));
|
|
47
|
+
}
|
|
48
|
+
/** A new thread's audience: a Client's is always client-facing; Studio's is internal unless Studio asks otherwise. */
|
|
49
|
+
export function audienceFor(actor, asked) {
|
|
50
|
+
return actor.kind === 'studio' ? (asked ?? 'internal') : 'client';
|
|
51
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Comment, type Person, type Triage } from './model.ts';
|
|
1
|
+
import { type Access, type Comment, type Person, type Triage } from './model.ts';
|
|
2
2
|
import { type KV } from './store.ts';
|
|
3
3
|
export type ErrorCode = 'unauthorized' | 'forbidden' | 'not_found' | 'invalid';
|
|
4
4
|
export declare class ReviewError extends Error {
|
|
@@ -24,25 +24,53 @@ export declare function createReview(kv: KV, overrides?: Partial<Deps>): {
|
|
|
24
24
|
/** The person a signed session names, if they still may sign in with it. */
|
|
25
25
|
sessionPerson(id: string, epoch: number): Promise<Person | null>;
|
|
26
26
|
listPeople(actor: Person | null): Promise<Person[]>;
|
|
27
|
-
|
|
27
|
+
/** A new person and their first link. Without an access length, a Client gets the project default and Studio is open-ended. */
|
|
28
|
+
addPerson(actor: Person | null, input: unknown): Promise<{
|
|
28
29
|
person: Person;
|
|
29
30
|
token: string;
|
|
30
31
|
}>;
|
|
31
|
-
/**
|
|
32
|
-
|
|
32
|
+
/** Another one-time link, for another device. Their sessions and other unused links stay. */
|
|
33
|
+
newLink(actor: Person | null, id: string): Promise<{
|
|
34
|
+
person: Person;
|
|
35
|
+
token: string;
|
|
36
|
+
}>;
|
|
37
|
+
/** Ends every session they hold and every unused link, and gives one new link. */
|
|
38
|
+
signOutEverywhere(actor: Person | null, id: string): Promise<{
|
|
33
39
|
person: Person;
|
|
34
40
|
token: string;
|
|
35
41
|
}>;
|
|
36
42
|
revoke(actor: Person | null, id: string): Promise<Person>;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
/** Sets one person's access length, counted from now. Their sessions follow at the gate's next check, within five minutes. */
|
|
44
|
+
setAccess(actor: Person | null, id: string, access: unknown): Promise<Person>;
|
|
45
|
+
/** How long a new Client keeps access unless Studio says otherwise. */
|
|
46
|
+
defaultAccess(actor: Person | null): Promise<Access>;
|
|
47
|
+
setDefaultAccess(actor: Person | null, access: unknown): Promise<Access>;
|
|
48
|
+
/** Who a link signs in, without using it: mail and chat previews open links too. */
|
|
49
|
+
peekLink(token: string): Promise<Person | null>;
|
|
50
|
+
/**
|
|
51
|
+
* Uses a link up and returns who it signs in. The delete is the claim: of
|
|
52
|
+
* two requests with one token, only the one whose delete removed the link
|
|
53
|
+
* gets a person, so a link signs in one device at most. Who it signs in is
|
|
54
|
+
* read and checked first, so the delete is the last store call.
|
|
55
|
+
*/
|
|
56
|
+
useLink(token: string): Promise<Person | null>;
|
|
57
|
+
/**
|
|
58
|
+
* A prototype's comments as the actor's view sees them. `viewAs: 'client'`
|
|
59
|
+
* is Studio's Client view; it never widens a Client's.
|
|
60
|
+
*/
|
|
61
|
+
listComments(actor: Person | null, prototype: string, viewAs?: unknown): Promise<Comment[]>;
|
|
62
|
+
/** Every comment on every prototype the actor may see, for the CLI (which acts as Studio). */
|
|
63
|
+
allComments(actor: Person | null): Promise<Comment[]>;
|
|
64
|
+
/**
|
|
65
|
+
* A new thread. A Client's is client-facing whatever the input says;
|
|
66
|
+
* Studio's is internal unless `audience` is 'client'. Its number is the
|
|
67
|
+
* prototype's next, never one used before.
|
|
68
|
+
*/
|
|
42
69
|
add(actor: Person | null, input: {
|
|
43
70
|
body?: unknown;
|
|
44
71
|
anchor?: unknown;
|
|
45
72
|
states?: unknown;
|
|
73
|
+
audience?: unknown;
|
|
46
74
|
}): Promise<Comment>;
|
|
47
75
|
reply(actor: Person | null, input: {
|
|
48
76
|
prototype: string;
|
|
@@ -70,8 +98,8 @@ export declare function createReview(kv: KV, overrides?: Partial<Deps>): {
|
|
|
70
98
|
triage?: unknown;
|
|
71
99
|
states?: unknown;
|
|
72
100
|
}): Promise<Comment>;
|
|
73
|
-
/** Where a comment lives, for the CLI, which has an id and no prototype. */
|
|
74
|
-
locate(id: string): Promise<{
|
|
101
|
+
/** Where a comment lives, for the CLI, which has an id and no prototype; null when the actor may not see it. */
|
|
102
|
+
locate(actor: Person | null, id: string): Promise<{
|
|
75
103
|
prototype: string;
|
|
76
104
|
comment: Comment;
|
|
77
105
|
} | null>;
|