@getrefino/core 0.1.0-rc.6 → 0.1.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/api.d.ts +9 -0
- package/dist/api.js +12 -1
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -45,6 +45,15 @@ export type ContentApiBody = {
|
|
|
45
45
|
readonly message: string;
|
|
46
46
|
/** Present on CONFLICT so the editor can rebase without another request. */
|
|
47
47
|
readonly current?: ContentSnapshot;
|
|
48
|
+
/**
|
|
49
|
+
* The article the failure is about, when it is about one. The
|
|
50
|
+
* service layer already knows which document it refused; without
|
|
51
|
+
* this the editor can only guess, and a copy conflict and an
|
|
52
|
+
* article conflict read identically to the owner.
|
|
53
|
+
*
|
|
54
|
+
* An id, never a path: it is the same id the browser sent.
|
|
55
|
+
*/
|
|
56
|
+
readonly documentId?: DocumentId;
|
|
48
57
|
};
|
|
49
58
|
};
|
|
50
59
|
export interface ContentApiResponse {
|
package/dist/api.js
CHANGED
|
@@ -24,9 +24,20 @@ function toErrorResponse(error, options) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
if (isContentError(error)) {
|
|
27
|
+
// `details.documentId` is set by every document-service failure that is
|
|
28
|
+
// about one article. Passing it on costs nothing and is the only way the
|
|
29
|
+
// browser can tell an article conflict from a copy one.
|
|
30
|
+
const documentId = error.details.documentId;
|
|
27
31
|
return {
|
|
28
32
|
status: STATUS_BY_CODE[error.code],
|
|
29
|
-
body: {
|
|
33
|
+
body: {
|
|
34
|
+
ok: false,
|
|
35
|
+
error: {
|
|
36
|
+
code: error.code,
|
|
37
|
+
message: error.message,
|
|
38
|
+
...(isDocumentId(documentId) ? { documentId } : {}),
|
|
39
|
+
},
|
|
40
|
+
},
|
|
30
41
|
};
|
|
31
42
|
}
|
|
32
43
|
options.onError?.(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getrefino/core",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Core content model, draft state and persistence contracts for Refino, the in-browser editor for existing website copy. Framework-independent; the repository stays the source of truth.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"refino",
|