@camox/api-contract 0.51.0 → 0.52.2
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 +31 -1
- package/dist/drafts.js +39 -3
- package/dist/query-keys.d.ts +11 -1
- package/dist/router.d.ts +1089 -42
- package/dist/threads.d.ts +56 -1
- package/dist/threads.js +79 -10
- package/package.json +1 -1
- package/src/drafts.ts +43 -1
- package/src/query-keys.ts +7 -1
- package/src/threads.ts +83 -5
package/dist/drafts.d.ts
CHANGED
|
@@ -6,6 +6,20 @@ export declare const DRAFT_HEADER = "x-camox-draft";
|
|
|
6
6
|
* 0015). Absent means the project's default locale.
|
|
7
7
|
*/
|
|
8
8
|
export declare const LOCALE_HEADER = "x-camox-locale";
|
|
9
|
+
/**
|
|
10
|
+
* Request header the Worker a publish with code uploaded sends on its public reads, naming
|
|
11
|
+
* the draft it publishes (spec #560, section 13). While that draft is in its publishing state, a
|
|
12
|
+
* read naming it sees Live overlaid with the draft, with no session, so the new code serves the
|
|
13
|
+
* content it was previewed with from its first request. Once the draft has ended, or if it isn't
|
|
14
|
+
* publishing, the read is Live's. A request naming a draft with `DRAFT_HEADER` ignores it.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PUBLISHING_DRAFT_HEADER = "x-camox-publishing-draft";
|
|
17
|
+
/**
|
|
18
|
+
* The Worker variable carrying the publishing draft's ID, which the publish sets on the Worker it
|
|
19
|
+
* uploads (apps/api/src/domains/publishes/scripts.ts). The website's Worker sends it as
|
|
20
|
+
* `PUBLISHING_DRAFT_HEADER`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PUBLISHING_DRAFT_VAR = "CAMOX_PUBLISHING_DRAFT";
|
|
9
23
|
/**
|
|
10
24
|
* Request header asking the API to create the draft named by `DRAFT_HEADER` if it doesn't
|
|
11
25
|
* exist yet. Its value is `"1"`.
|
|
@@ -47,6 +61,21 @@ export declare const DRAFT_ENDED_ERROR_CODE = "DRAFT_ENDED";
|
|
|
47
61
|
* preview, so nothing was applied and the caller reviews the new preview.
|
|
48
62
|
*/
|
|
49
63
|
export declare const CONFLICTS_CHANGED_ERROR = "CONFLICTS_CHANGED";
|
|
64
|
+
/**
|
|
65
|
+
* oRPC error code for a publish of a draft with code whose revision isn't the one the review
|
|
66
|
+
* showed: the agent left a newer one, or the draft is already publishing. The caller reviews
|
|
67
|
+
* the new preview.
|
|
68
|
+
*/
|
|
69
|
+
export declare const REVISION_CHANGED_ERROR = "REVISION_CHANGED";
|
|
70
|
+
/**
|
|
71
|
+
* Why a publish with code went back to the review instead of landing: the agent left a revision
|
|
72
|
+
* after the one the review showed, Live's conflicts changed, the draft got a blocker, Live's code
|
|
73
|
+
* moved and the draft's merge of it clashed (the "doesn't merge with Live's" blocker, which
|
|
74
|
+
* Camox's turn fixes), Live's code moved and the draft took too long to merge it, or the publish
|
|
75
|
+
* failed on Camox's side.
|
|
76
|
+
*/
|
|
77
|
+
export declare const PUBLISH_ABORT_REASONS: readonly ["revisionChanged", "conflictsChanged", "blocked", "codeDoesNotMerge", "liveCodeMoved", "failed"];
|
|
78
|
+
export type PublishAbortReason = (typeof PUBLISH_ABORT_REASONS)[number];
|
|
50
79
|
/** oRPC error code for a publish refused because the draft still has blockers. */
|
|
51
80
|
export declare const PUBLISH_BLOCKED_ERROR = "PUBLISH_BLOCKED";
|
|
52
81
|
/**
|
|
@@ -57,12 +86,13 @@ export declare const TRANSLATIONS_PENDING_ERROR = "TRANSLATIONS_PENDING";
|
|
|
57
86
|
/**
|
|
58
87
|
* Why the publish tool published nothing of a draft with changes, and returned a fresh preview to
|
|
59
88
|
* review again, by the error code of each: Live changed since the preview, the draft has blockers,
|
|
60
|
-
*
|
|
89
|
+
* translations are still running, or the draft's code changed since the preview.
|
|
61
90
|
*/
|
|
62
91
|
export declare const NOT_PUBLISHED_CODES: {
|
|
63
92
|
readonly conflictsChanged: "CONFLICTS_CHANGED";
|
|
64
93
|
readonly blocked: "PUBLISH_BLOCKED";
|
|
65
94
|
readonly translating: "TRANSLATIONS_PENDING";
|
|
95
|
+
readonly revisionChanged: "REVISION_CHANGED";
|
|
66
96
|
};
|
|
67
97
|
export type NotPublishedReason = keyof typeof NOT_PUBLISHED_CODES;
|
|
68
98
|
/**
|
package/dist/drafts.js
CHANGED
|
@@ -7,6 +7,20 @@ const DRAFT_HEADER = "x-camox-draft";
|
|
|
7
7
|
*/
|
|
8
8
|
const LOCALE_HEADER = "x-camox-locale";
|
|
9
9
|
/**
|
|
10
|
+
* Request header the Worker a publish with code uploaded sends on its public reads, naming
|
|
11
|
+
* the draft it publishes (spec #560, section 13). While that draft is in its publishing state, a
|
|
12
|
+
* read naming it sees Live overlaid with the draft, with no session, so the new code serves the
|
|
13
|
+
* content it was previewed with from its first request. Once the draft has ended, or if it isn't
|
|
14
|
+
* publishing, the read is Live's. A request naming a draft with `DRAFT_HEADER` ignores it.
|
|
15
|
+
*/
|
|
16
|
+
const PUBLISHING_DRAFT_HEADER = "x-camox-publishing-draft";
|
|
17
|
+
/**
|
|
18
|
+
* The Worker variable carrying the publishing draft's ID, which the publish sets on the Worker it
|
|
19
|
+
* uploads (apps/api/src/domains/publishes/scripts.ts). The website's Worker sends it as
|
|
20
|
+
* `PUBLISHING_DRAFT_HEADER`.
|
|
21
|
+
*/
|
|
22
|
+
const PUBLISHING_DRAFT_VAR = "CAMOX_PUBLISHING_DRAFT";
|
|
23
|
+
/**
|
|
10
24
|
* Request header asking the API to create the draft named by `DRAFT_HEADER` if it doesn't
|
|
11
25
|
* exist yet. Its value is `"1"`.
|
|
12
26
|
*/
|
|
@@ -33,6 +47,27 @@ const DRAFT_ENDED_ERROR_CODE = "DRAFT_ENDED";
|
|
|
33
47
|
* preview, so nothing was applied and the caller reviews the new preview.
|
|
34
48
|
*/
|
|
35
49
|
const CONFLICTS_CHANGED_ERROR = "CONFLICTS_CHANGED";
|
|
50
|
+
/**
|
|
51
|
+
* oRPC error code for a publish of a draft with code whose revision isn't the one the review
|
|
52
|
+
* showed: the agent left a newer one, or the draft is already publishing. The caller reviews
|
|
53
|
+
* the new preview.
|
|
54
|
+
*/
|
|
55
|
+
const REVISION_CHANGED_ERROR = "REVISION_CHANGED";
|
|
56
|
+
/**
|
|
57
|
+
* Why a publish with code went back to the review instead of landing: the agent left a revision
|
|
58
|
+
* after the one the review showed, Live's conflicts changed, the draft got a blocker, Live's code
|
|
59
|
+
* moved and the draft's merge of it clashed (the "doesn't merge with Live's" blocker, which
|
|
60
|
+
* Camox's turn fixes), Live's code moved and the draft took too long to merge it, or the publish
|
|
61
|
+
* failed on Camox's side.
|
|
62
|
+
*/
|
|
63
|
+
const PUBLISH_ABORT_REASONS = [
|
|
64
|
+
"revisionChanged",
|
|
65
|
+
"conflictsChanged",
|
|
66
|
+
"blocked",
|
|
67
|
+
"codeDoesNotMerge",
|
|
68
|
+
"liveCodeMoved",
|
|
69
|
+
"failed"
|
|
70
|
+
];
|
|
36
71
|
/** oRPC error code for a publish refused because the draft still has blockers. */
|
|
37
72
|
const PUBLISH_BLOCKED_ERROR = "PUBLISH_BLOCKED";
|
|
38
73
|
/**
|
|
@@ -43,12 +78,13 @@ const TRANSLATIONS_PENDING_ERROR = "TRANSLATIONS_PENDING";
|
|
|
43
78
|
/**
|
|
44
79
|
* Why the publish tool published nothing of a draft with changes, and returned a fresh preview to
|
|
45
80
|
* review again, by the error code of each: Live changed since the preview, the draft has blockers,
|
|
46
|
-
*
|
|
81
|
+
* translations are still running, or the draft's code changed since the preview.
|
|
47
82
|
*/
|
|
48
83
|
const NOT_PUBLISHED_CODES = {
|
|
49
84
|
conflictsChanged: CONFLICTS_CHANGED_ERROR,
|
|
50
85
|
blocked: PUBLISH_BLOCKED_ERROR,
|
|
51
|
-
translating: TRANSLATIONS_PENDING_ERROR
|
|
86
|
+
translating: TRANSLATIONS_PENDING_ERROR,
|
|
87
|
+
revisionChanged: REVISION_CHANGED_ERROR
|
|
52
88
|
};
|
|
53
89
|
/**
|
|
54
90
|
* Who Camox's own work is by: the creator of the drafts it opens to catch translations up, their
|
|
@@ -143,4 +179,4 @@ function isContentWrite(path) {
|
|
|
143
179
|
}
|
|
144
180
|
|
|
145
181
|
//#endregion
|
|
146
|
-
export { CAMOX_ACTOR, CAMOX_NAME, CONFLICTS_CHANGED_ERROR, DEVELOPMENT_DRAFT, DRAFT_CREATE_HEADER, DRAFT_ENDED_ERROR_CODE, DRAFT_HEADER, DRAFT_SEARCH_PARAM, LIVE_READ_ONLY_ERROR, LOCALE_HEADER, NOT_PUBLISHED_CODES, NO_DEVELOPMENT_DRAFT_ERROR, PUBLISH_BLOCKED_ERROR, TRANSLATIONS_PENDING_ERROR, isContentWrite };
|
|
182
|
+
export { CAMOX_ACTOR, CAMOX_NAME, CONFLICTS_CHANGED_ERROR, DEVELOPMENT_DRAFT, DRAFT_CREATE_HEADER, DRAFT_ENDED_ERROR_CODE, DRAFT_HEADER, DRAFT_SEARCH_PARAM, LIVE_READ_ONLY_ERROR, LOCALE_HEADER, NOT_PUBLISHED_CODES, NO_DEVELOPMENT_DRAFT_ERROR, PUBLISHING_DRAFT_HEADER, PUBLISHING_DRAFT_VAR, PUBLISH_ABORT_REASONS, PUBLISH_BLOCKED_ERROR, REVISION_CHANGED_ERROR, TRANSLATIONS_PENDING_ERROR, isContentWrite };
|
package/dist/query-keys.d.ts
CHANGED
|
@@ -65,6 +65,16 @@ export type InvalidationMessage = {
|
|
|
65
65
|
export type DraftEndedMessage = {
|
|
66
66
|
type: "draftEnded";
|
|
67
67
|
} & EndedDraft;
|
|
68
|
+
/** A draft with code has a new revision, built with Camox's `sdkVersion`. */
|
|
69
|
+
export type RevisionAnnouncement = {
|
|
70
|
+
draftId: string;
|
|
71
|
+
revisionId: string;
|
|
72
|
+
sdkVersion: string;
|
|
73
|
+
};
|
|
74
|
+
/** A draft's new revision: its viewers' frames load it. */
|
|
75
|
+
export type RevisionMessage = {
|
|
76
|
+
type: "revision";
|
|
77
|
+
} & RevisionAnnouncement;
|
|
68
78
|
/** Everything the project room broadcasts. */
|
|
69
|
-
export type ProjectRoomMessage = InvalidationMessage | DraftEndedMessage;
|
|
79
|
+
export type ProjectRoomMessage = InvalidationMessage | DraftEndedMessage | RevisionMessage;
|
|
70
80
|
//#endregion
|