@byline/host-tanstack-start 1.4.0 → 1.6.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.
|
@@ -82,6 +82,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
const publishedVersion = initialData?._publishedVersion ?? null;
|
|
85
|
+
const restoreWarnings = initialData?._restoreWarnings;
|
|
85
86
|
const handleUnpublish = async ()=>{
|
|
86
87
|
try {
|
|
87
88
|
await unpublishDocument({
|
|
@@ -262,6 +263,7 @@ const EditView = ({ collectionDefinition, adminConfig, initialData, locale, cont
|
|
|
262
263
|
onUnpublish: publishedVersion ? handleUnpublish : void 0,
|
|
263
264
|
onDelete: handleDelete,
|
|
264
265
|
publishedVersion: publishedVersion,
|
|
266
|
+
restoreWarnings: restoreWarnings,
|
|
265
267
|
nextStatus: nextStatus,
|
|
266
268
|
workflowStatuses: workflowStatuses,
|
|
267
269
|
onCancel: ()=>navigate({
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* `{target_document_id, target_collection_id}` refs.
|
|
17
17
|
*/
|
|
18
18
|
export declare function getCollectionDocument(collection: string, id: string, locale?: string, depth?: number, populateRelations?: boolean): Promise<{
|
|
19
|
+
_restoreWarnings?: string[] | undefined;
|
|
19
20
|
_publishedVersion: Record<string, any> | null;
|
|
20
21
|
} | null>;
|
|
21
22
|
/**
|
|
@@ -38,7 +38,8 @@ const getDocumentFn = createServerFn({
|
|
|
38
38
|
locale: locale ?? 'en',
|
|
39
39
|
populate,
|
|
40
40
|
depth: resolvedDepth,
|
|
41
|
-
status: 'any'
|
|
41
|
+
status: 'any',
|
|
42
|
+
lenient: true
|
|
42
43
|
});
|
|
43
44
|
if (!document) throw ERR_NOT_FOUND({
|
|
44
45
|
message: 'Document not found',
|
|
@@ -67,9 +68,13 @@ const getDocumentFn = createServerFn({
|
|
|
67
68
|
updatedAt: pv.updated_at
|
|
68
69
|
}) : null;
|
|
69
70
|
}
|
|
71
|
+
const restoreWarnings = serialised._restoreWarnings;
|
|
70
72
|
return {
|
|
71
73
|
...parsed,
|
|
72
|
-
_publishedVersion: publishedVersion
|
|
74
|
+
_publishedVersion: publishedVersion,
|
|
75
|
+
...restoreWarnings && restoreWarnings.length > 0 ? {
|
|
76
|
+
_restoreWarnings: restoreWarnings
|
|
77
|
+
} : {}
|
|
73
78
|
};
|
|
74
79
|
});
|
|
75
80
|
const getDocumentByVersionFn = createServerFn({
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.6.0",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20.9.0"
|
|
9
9
|
},
|
|
@@ -101,11 +101,11 @@
|
|
|
101
101
|
"react-swipeable": "^7.0.2",
|
|
102
102
|
"uuid": "^14.0.0",
|
|
103
103
|
"zod": "^4.4.2",
|
|
104
|
-
"@byline/
|
|
105
|
-
"@byline/
|
|
106
|
-
"@byline/
|
|
107
|
-
"@byline/
|
|
108
|
-
"@byline/ui": "1.
|
|
104
|
+
"@byline/auth": "1.6.0",
|
|
105
|
+
"@byline/core": "1.6.0",
|
|
106
|
+
"@byline/admin": "1.6.0",
|
|
107
|
+
"@byline/client": "1.6.0",
|
|
108
|
+
"@byline/ui": "1.6.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
111
|
"@tanstack/react-router": "^1.167.0",
|
|
@@ -119,6 +119,13 @@ export const EditView = ({
|
|
|
119
119
|
// biome-ignore lint/suspicious/noExplicitAny: storage shape
|
|
120
120
|
const publishedVersion = (initialData as any)?._publishedVersion ?? null
|
|
121
121
|
|
|
122
|
+
// Schema-mismatch warnings — attached by getCollectionDocument when the
|
|
123
|
+
// document was loaded leniently (admin edit path) and at least one
|
|
124
|
+
// orphan row was skipped because the collection schema has moved on
|
|
125
|
+
// since the document was written.
|
|
126
|
+
// biome-ignore lint/suspicious/noExplicitAny: storage shape
|
|
127
|
+
const restoreWarnings = (initialData as any)?._restoreWarnings as string[] | undefined
|
|
128
|
+
|
|
122
129
|
const handleUnpublish = async () => {
|
|
123
130
|
try {
|
|
124
131
|
await unpublishDocument({ data: { collection: path, id: String(initialData.id) } })
|
|
@@ -302,6 +309,7 @@ export const EditView = ({
|
|
|
302
309
|
onUnpublish={publishedVersion ? handleUnpublish : undefined}
|
|
303
310
|
onDelete={handleDelete}
|
|
304
311
|
publishedVersion={publishedVersion}
|
|
312
|
+
restoreWarnings={restoreWarnings}
|
|
305
313
|
nextStatus={nextStatus}
|
|
306
314
|
workflowStatuses={workflowStatuses}
|
|
307
315
|
onCancel={() =>
|
|
@@ -88,6 +88,10 @@ const getDocumentFn = createServerFn({ method: 'GET' })
|
|
|
88
88
|
populate,
|
|
89
89
|
depth: resolvedDepth,
|
|
90
90
|
status: 'any',
|
|
91
|
+
// Admin edit path: tolerate schema-mismatch warnings rather than
|
|
92
|
+
// hard-failing the load. Warnings (if any) come back on the document
|
|
93
|
+
// as `_restoreWarnings` and the edit form surfaces them via an Alert.
|
|
94
|
+
lenient: true,
|
|
91
95
|
})
|
|
92
96
|
|
|
93
97
|
if (!document) {
|
|
@@ -136,7 +140,21 @@ const getDocumentFn = createServerFn({ method: 'GET' })
|
|
|
136
140
|
: null
|
|
137
141
|
}
|
|
138
142
|
|
|
139
|
-
|
|
143
|
+
// Preserve `_restoreWarnings` across the Zod parse — the parse strips
|
|
144
|
+
// unknown keys, so the warnings list (set by `findById({ lenient: true })`
|
|
145
|
+
// when older rows can't be reconstructed against the current schema)
|
|
146
|
+
// would otherwise be lost before reaching the edit form.
|
|
147
|
+
const restoreWarnings = (serialised as Record<string, any>)._restoreWarnings as
|
|
148
|
+
| string[]
|
|
149
|
+
| undefined
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
...(parsed as Record<string, any>),
|
|
153
|
+
_publishedVersion: publishedVersion,
|
|
154
|
+
...(restoreWarnings && restoreWarnings.length > 0
|
|
155
|
+
? { _restoreWarnings: restoreWarnings }
|
|
156
|
+
: {}),
|
|
157
|
+
}
|
|
140
158
|
})
|
|
141
159
|
|
|
142
160
|
// ---------------------------------------------------------------------------
|