@camox/api-contract 0.54.0 → 0.57.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/dist/drafts.d.ts +2 -2
- package/dist/drafts.js +1 -1
- package/dist/patrol.d.ts +114 -0
- package/dist/patrol.js +8 -0
- package/dist/query-keys.d.ts +4 -1
- package/dist/query-keys.js +2 -1
- package/dist/router.d.ts +473 -248
- package/dist/threads.d.ts +79 -26
- package/dist/threads.js +90 -24
- package/package.json +5 -1
- package/src/drafts.ts +2 -2
- package/src/patrol.ts +113 -0
- package/src/query-keys.ts +5 -1
- package/src/threads.ts +131 -34
package/dist/drafts.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export declare const DRAFT_SEARCH_PARAM = "camox-draft";
|
|
|
40
40
|
/** A regular draft is a named set of edits; a development draft backs a dev server. */
|
|
41
41
|
export type DraftKind = "regular" | "development";
|
|
42
42
|
/** How a regular draft ended. */
|
|
43
|
-
export type DraftOutcome = "published" | "
|
|
43
|
+
export type DraftOutcome = "published" | "deleted";
|
|
44
44
|
/** Who ended a draft, how and when, from its ended-drafts record (ADR 0009, ADR 0011). */
|
|
45
45
|
export type EndedDraft = {
|
|
46
46
|
draftId: string;
|
|
@@ -53,7 +53,7 @@ export type EndedDraft = {
|
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
55
55
|
* The oRPC error code a request naming an ended draft fails with. Its `data` is an `EndedDraft`,
|
|
56
|
-
* so a page can render Live and say who published or
|
|
56
|
+
* so a page can render Live and say who published or deleted the draft.
|
|
57
57
|
*/
|
|
58
58
|
export declare const DRAFT_ENDED_ERROR_CODE = "DRAFT_ENDED";
|
|
59
59
|
/**
|
package/dist/drafts.js
CHANGED
|
@@ -39,7 +39,7 @@ const NO_DEVELOPMENT_DRAFT_ERROR = "NO_DEVELOPMENT_DRAFT";
|
|
|
39
39
|
const DRAFT_SEARCH_PARAM = "camox-draft";
|
|
40
40
|
/**
|
|
41
41
|
* The oRPC error code a request naming an ended draft fails with. Its `data` is an `EndedDraft`,
|
|
42
|
-
* so a page can render Live and say who published or
|
|
42
|
+
* so a page can render Live and say who published or deleted the draft.
|
|
43
43
|
*/
|
|
44
44
|
const DRAFT_ENDED_ERROR_CODE = "DRAFT_ENDED";
|
|
45
45
|
/**
|
package/dist/patrol.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
//#region src/patrol.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The Patrol (ADR 0024): every patroller of a project, the work each did as reports, as the
|
|
4
|
+
* studio shows it at the top of the Agent Sidebar. The API reads it for one scope, a draft or
|
|
5
|
+
* Live, and names each report's subject, so the studio needs no entity loaded to show it.
|
|
6
|
+
*/
|
|
7
|
+
/** A patroller's stable id. The registry in the API lists them all. */
|
|
8
|
+
export type PatrollerId = "translator" | "seoManager";
|
|
9
|
+
/**
|
|
10
|
+
* What a structured report says was done. Each has a failed form, by the report's outcome. A
|
|
11
|
+
* merge with Live's localization reads as a translation.
|
|
12
|
+
*/
|
|
13
|
+
export type ReportVerb = "translated" | "mergedWithLive" | "wroteSeo" | "describedFile" | "publishedCatchUp";
|
|
14
|
+
/** What a report can be about. */
|
|
15
|
+
export type ReportEntity = "page" | "block" | "sharedContent" | "repeatableItem" | "record" | "file";
|
|
16
|
+
/** A report's subject, named as the Canvas names it, read when the Patrol is. */
|
|
17
|
+
export type ReportSubject = {
|
|
18
|
+
entity: ReportEntity;
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* What a report says: structured facts the studio turns into a sentence, in the studio's
|
|
24
|
+
* language, or text an AI wrote, shown as is. `locale` is a locale's tag.
|
|
25
|
+
*/
|
|
26
|
+
export type ReportSummary = {
|
|
27
|
+
kind: "structured";
|
|
28
|
+
verb: ReportVerb;
|
|
29
|
+
subject: ReportSubject | null;
|
|
30
|
+
locale: string | null;
|
|
31
|
+
} | {
|
|
32
|
+
kind: "text";
|
|
33
|
+
text: string;
|
|
34
|
+
};
|
|
35
|
+
/** The locale a summary's work was in: a structured summary's, if any. A text summary has none. */
|
|
36
|
+
export declare const reportLocale: (summary: {
|
|
37
|
+
kind: "structured";
|
|
38
|
+
locale: string | null;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "text";
|
|
41
|
+
}) => string | null;
|
|
42
|
+
/** Whether the work was done, or failed. A failure shows in its report only. */
|
|
43
|
+
export type ReportOutcome = "done" | "failed";
|
|
44
|
+
/** Whether a report needs a human. Nothing raises one yet. */
|
|
45
|
+
export type AttentionLevel = "none" | "needed";
|
|
46
|
+
/**
|
|
47
|
+
* Where the studio shows a report's subject: a page on the Canvas, with the block and repeatable
|
|
48
|
+
* item to select on it, a collection record, or a file.
|
|
49
|
+
*/
|
|
50
|
+
export type ReportPlace = {
|
|
51
|
+
kind: "page";
|
|
52
|
+
pageId: string;
|
|
53
|
+
blockId: string | null;
|
|
54
|
+
itemId: string | null;
|
|
55
|
+
} | {
|
|
56
|
+
kind: "record";
|
|
57
|
+
collectionId: string;
|
|
58
|
+
recordId: string;
|
|
59
|
+
} | {
|
|
60
|
+
kind: "file";
|
|
61
|
+
fileId: string;
|
|
62
|
+
};
|
|
63
|
+
export type ReportView = {
|
|
64
|
+
/** Unique among the patroller's reports in the view. */
|
|
65
|
+
id: string;
|
|
66
|
+
summary: ReportSummary;
|
|
67
|
+
outcome: ReportOutcome;
|
|
68
|
+
attention: AttentionLevel;
|
|
69
|
+
/** When the work last settled, in milliseconds since the epoch. */
|
|
70
|
+
at: number;
|
|
71
|
+
/** Whether the report is Live's, seen from a draft or from Live. */
|
|
72
|
+
live: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Where its subject shows, in the report's scope and locale. Null without a subject, or for one
|
|
75
|
+
* with no single place, such as a synced block's shared content or a layout's block.
|
|
76
|
+
*/
|
|
77
|
+
place: ReportPlace | null;
|
|
78
|
+
};
|
|
79
|
+
/** How many subjects a patroller is on in one locale, a locale's tag. */
|
|
80
|
+
export type LocaleCount = {
|
|
81
|
+
locale: string;
|
|
82
|
+
count: number;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* What a patroller is on: the one subject when there's one, and how many subjects in each
|
|
86
|
+
* locale, the most first. A subject in several locales counts in each.
|
|
87
|
+
*/
|
|
88
|
+
export type PatrollerWorking = {
|
|
89
|
+
subject: ReportSubject | null;
|
|
90
|
+
locales: LocaleCount[];
|
|
91
|
+
};
|
|
92
|
+
export type PatrollerView = {
|
|
93
|
+
id: PatrollerId;
|
|
94
|
+
/** Its role, as editors know it: "Translator", "SEO manager". */
|
|
95
|
+
role: string;
|
|
96
|
+
/** Null when it isn't working in the scope. */
|
|
97
|
+
working: PatrollerWorking | null;
|
|
98
|
+
/** Its latest activity in the scope, or null when it never worked there. */
|
|
99
|
+
lastActivityAt: number | null;
|
|
100
|
+
/** Its newest reports, newest first. */
|
|
101
|
+
reports: ReportView[];
|
|
102
|
+
/** How many more reports it has than `reports` shows, per locale, the most first. */
|
|
103
|
+
more: {
|
|
104
|
+
locale: string | null;
|
|
105
|
+
count: number;
|
|
106
|
+
}[];
|
|
107
|
+
};
|
|
108
|
+
/** Every patroller of the registry, the latest activity first; never-worked ones last. */
|
|
109
|
+
export type PatrolView = {
|
|
110
|
+
patrollers: PatrollerView[];
|
|
111
|
+
};
|
|
112
|
+
/** How many reports the Patrol shows of each patroller; the rest are counted. */
|
|
113
|
+
export declare const REPORTS_SHOWN = 5;
|
|
114
|
+
//#endregion
|
package/dist/patrol.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/patrol.ts
|
|
2
|
+
/** The locale a summary's work was in: a structured summary's, if any. A text summary has none. */
|
|
3
|
+
const reportLocale = (summary) => summary.kind === "structured" ? summary.locale : null;
|
|
4
|
+
/** How many reports the Patrol shows of each patroller; the rest are counted. */
|
|
5
|
+
const REPORTS_SHOWN = 5;
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { REPORTS_SHOWN, reportLocale };
|
package/dist/query-keys.d.ts
CHANGED
|
@@ -40,6 +40,9 @@ export declare const queryKeys: {
|
|
|
40
40
|
list: ["camox", string, string];
|
|
41
41
|
get: ["camox", string, string];
|
|
42
42
|
};
|
|
43
|
+
patrol: {
|
|
44
|
+
get: ["camox", string];
|
|
45
|
+
};
|
|
43
46
|
};
|
|
44
47
|
/** The last segment of a query key: what the query reads, Live or a draft (ADR 0011). */
|
|
45
48
|
export declare const LIVE_KEY_SCOPE = "live";
|
|
@@ -61,7 +64,7 @@ export type InvalidationMessage = {
|
|
|
61
64
|
draftId: string | null;
|
|
62
65
|
targets: QueryKey[];
|
|
63
66
|
};
|
|
64
|
-
/** A draft was published or
|
|
67
|
+
/** A draft was published or deleted: its viewers go back to Live. */
|
|
65
68
|
export type DraftEndedMessage = {
|
|
66
69
|
type: "draftEnded";
|
|
67
70
|
} & EndedDraft;
|
package/dist/query-keys.js
CHANGED