@byline/host-tanstack-start 3.17.0 → 3.18.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/admin-shell/collections/api.d.ts +1 -1
- package/dist/admin-shell/collections/edit.d.ts +1 -1
- package/dist/admin-shell/collections/history.d.ts +1 -1
- package/dist/admin-shell/collections/list.d.ts +1 -1
- package/dist/server-fns/admin-permissions/list-registered.d.ts +2 -2
- package/dist/server-fns/admin-users/list.d.ts +1 -1
- package/dist/server-fns/auth/sign-out.d.ts +1 -1
- package/dist/server-fns/collections/create.d.ts +1 -1
- package/dist/server-fns/collections/delete.d.ts +1 -1
- package/dist/server-fns/collections/get.d.ts +3 -3
- package/dist/server-fns/collections/history.d.ts +5 -5
- package/dist/server-fns/collections/list.d.ts +4 -4
- package/dist/server-fns/collections/reorder.d.ts +1 -1
- package/dist/server-fns/collections/restore-version.d.ts +1 -1
- package/dist/server-fns/collections/status.d.ts +2 -2
- package/dist/server-fns/collections/tree.d.ts +2 -2
- package/dist/server-fns/collections/update.d.ts +2 -2
- package/dist/server-fns/collections/upload.js +6 -7
- package/dist/server-fns/preview/disable.d.ts +1 -1
- package/dist/server-fns/preview/enable.d.ts +1 -1
- package/package.json +20 -20
- package/src/server-fns/collections/upload.ts +12 -18
|
@@ -17,7 +17,7 @@ import 'react-json-view-lite/dist/index.css';
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const ApiView: ({ collectionDefinition, initialData, locale, depth, contentLocales, defaultContentLocale, }: {
|
|
19
19
|
collectionDefinition: CollectionDefinition;
|
|
20
|
-
initialData: AnyCollectionSchemaTypes[
|
|
20
|
+
initialData: AnyCollectionSchemaTypes['UpdateType'];
|
|
21
21
|
/** Currently active locale from the route search param (undefined → all). */
|
|
22
22
|
locale?: string;
|
|
23
23
|
/** Populate depth from the route search param (undefined → 0, no populate). */
|
|
@@ -11,7 +11,7 @@ import type { ContentLocaleOption } from './view-menu.js';
|
|
|
11
11
|
export declare const EditView: ({ collectionDefinition, adminConfig, initialData, locale, contentLocales, defaultContentLocale, }: {
|
|
12
12
|
collectionDefinition: CollectionDefinition;
|
|
13
13
|
adminConfig?: CollectionAdminConfig;
|
|
14
|
-
initialData: AnyCollectionSchemaTypes[
|
|
14
|
+
initialData: AnyCollectionSchemaTypes['UpdateType'];
|
|
15
15
|
locale?: string;
|
|
16
16
|
contentLocales: ReadonlyArray<ContentLocaleOption>;
|
|
17
17
|
defaultContentLocale: string;
|
|
@@ -12,7 +12,7 @@ import type { ContentLocaleOption } from './view-menu.js';
|
|
|
12
12
|
export declare const HistoryView: ({ collectionDefinition, adminConfig, data, auditLog, workflowStatuses, currentDocument, contentLocales, defaultContentLocale, }: {
|
|
13
13
|
collectionDefinition: CollectionDefinition;
|
|
14
14
|
adminConfig?: CollectionAdminConfig;
|
|
15
|
-
data: AnyCollectionSchemaTypes[
|
|
15
|
+
data: AnyCollectionSchemaTypes['HistoryType'] & {
|
|
16
16
|
/**
|
|
17
17
|
* Audit display labels (the acting user per version), resolved admin-side from each
|
|
18
18
|
* version's `createdBy` id (see docs/06-auth-and-security/02-auditability.md — Workstream 1). Ids
|
|
@@ -14,7 +14,7 @@ type ReorderFn = (params: {
|
|
|
14
14
|
afterDocumentId: string | null;
|
|
15
15
|
}) => Promise<unknown>;
|
|
16
16
|
export declare const ListView: ({ data, columns, workflowStatuses, useAsTitle, orderable, onReorder, listActions, }: {
|
|
17
|
-
data: AnyCollectionSchemaTypes[
|
|
17
|
+
data: AnyCollectionSchemaTypes['ListType'];
|
|
18
18
|
columns: ColumnDefinition[];
|
|
19
19
|
workflowStatuses?: WorkflowStatus[];
|
|
20
20
|
useAsTitle?: string;
|
|
@@ -16,7 +16,7 @@ export declare const listRegisteredAbilities: import("@tanstack/react-start").Op
|
|
|
16
16
|
label: string;
|
|
17
17
|
description: string | null;
|
|
18
18
|
group: string;
|
|
19
|
-
source: "
|
|
19
|
+
source: "admin" | "collection" | "core" | "plugin" | null;
|
|
20
20
|
}[];
|
|
21
21
|
groups: {
|
|
22
22
|
group: string;
|
|
@@ -25,7 +25,7 @@ export declare const listRegisteredAbilities: import("@tanstack/react-start").Op
|
|
|
25
25
|
label: string;
|
|
26
26
|
description: string | null;
|
|
27
27
|
group: string;
|
|
28
|
-
source: "
|
|
28
|
+
source: "admin" | "collection" | "core" | "plugin" | null;
|
|
29
29
|
}[];
|
|
30
30
|
}[];
|
|
31
31
|
total: number;
|
|
@@ -45,7 +45,7 @@ export declare const listAdminUsers: import("@tanstack/react-start").RequiredFet
|
|
|
45
45
|
page: number;
|
|
46
46
|
page_size: number;
|
|
47
47
|
query: string;
|
|
48
|
-
order: "
|
|
48
|
+
order: "created_at" | "email" | "family_name" | "given_name" | "updated_at" | "username";
|
|
49
49
|
desc: boolean;
|
|
50
50
|
};
|
|
51
51
|
}>>;
|
|
@@ -16,10 +16,10 @@
|
|
|
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
|
-
_availableVersionLocales?: string[] | undefined;
|
|
20
|
-
availableLocales?: string[] | undefined;
|
|
21
|
-
_restoreWarnings?: string[] | undefined;
|
|
22
19
|
_publishedVersion: Record<string, any> | null;
|
|
20
|
+
_restoreWarnings?: string[] | undefined;
|
|
21
|
+
availableLocales?: string[] | undefined;
|
|
22
|
+
_availableVersionLocales?: string[] | undefined;
|
|
23
23
|
} | null>;
|
|
24
24
|
/**
|
|
25
25
|
* Fetch a specific historical version of a document. Returns `null` when the
|
|
@@ -22,19 +22,18 @@ export declare const getCollectionDocumentHistory: import("@tanstack/react-start
|
|
|
22
22
|
id: string;
|
|
23
23
|
params: HistorySearchParams;
|
|
24
24
|
}, Promise<{
|
|
25
|
-
actors: ActorLabelMap;
|
|
26
25
|
docs: {
|
|
27
|
-
fields: Record<string, any>;
|
|
28
26
|
id: string;
|
|
29
|
-
status: string;
|
|
30
|
-
createdAt: string;
|
|
31
|
-
updatedAt: string;
|
|
32
27
|
versionId?: string | undefined;
|
|
33
28
|
path?: string | undefined;
|
|
34
29
|
sourceLocale?: string | undefined;
|
|
30
|
+
status: string;
|
|
35
31
|
hasPublishedVersion?: boolean | undefined;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
36
34
|
createdBy?: string | undefined;
|
|
37
35
|
eventType?: string | undefined;
|
|
36
|
+
fields: Record<string, any>;
|
|
38
37
|
}[];
|
|
39
38
|
meta: {
|
|
40
39
|
page: number;
|
|
@@ -44,4 +43,5 @@ export declare const getCollectionDocumentHistory: import("@tanstack/react-start
|
|
|
44
43
|
order?: string | undefined;
|
|
45
44
|
desc?: boolean | undefined;
|
|
46
45
|
};
|
|
46
|
+
actors: ActorLabelMap;
|
|
47
47
|
}>>;
|
|
@@ -23,17 +23,17 @@ export declare const getCollectionDocuments: import("@tanstack/react-start").Req
|
|
|
23
23
|
params: CollectionSearchParams;
|
|
24
24
|
}, Promise<{
|
|
25
25
|
docs: {
|
|
26
|
-
fields: Record<string, any>;
|
|
27
26
|
id: string;
|
|
28
|
-
status: string;
|
|
29
|
-
createdAt: string;
|
|
30
|
-
updatedAt: string;
|
|
31
27
|
versionId?: string | undefined;
|
|
32
28
|
path?: string | undefined;
|
|
33
29
|
sourceLocale?: string | undefined;
|
|
30
|
+
status: string;
|
|
34
31
|
hasPublishedVersion?: boolean | undefined;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
35
34
|
createdBy?: string | undefined;
|
|
36
35
|
eventType?: string | undefined;
|
|
36
|
+
fields: Record<string, any>;
|
|
37
37
|
}[];
|
|
38
38
|
meta: {
|
|
39
39
|
page: number;
|
|
@@ -14,7 +14,7 @@ export declare const updateDocumentStatus: import("@tanstack/react-start").Requi
|
|
|
14
14
|
id: string;
|
|
15
15
|
status: string;
|
|
16
16
|
}, Promise<{
|
|
17
|
-
status:
|
|
17
|
+
status: 'ok';
|
|
18
18
|
previousStatus: string;
|
|
19
19
|
newStatus: string;
|
|
20
20
|
}>>;
|
|
@@ -25,6 +25,6 @@ export declare const unpublishDocument: import("@tanstack/react-start").Required
|
|
|
25
25
|
collection: string;
|
|
26
26
|
id: string;
|
|
27
27
|
}, Promise<{
|
|
28
|
-
status:
|
|
28
|
+
status: 'ok';
|
|
29
29
|
archivedCount: number;
|
|
30
30
|
}>>;
|
|
@@ -18,7 +18,7 @@ export declare const placeTreeNode: import("@tanstack/react-start").RequiredFetc
|
|
|
18
18
|
beforeDocumentId?: string | null;
|
|
19
19
|
afterDocumentId?: string | null;
|
|
20
20
|
}, Promise<{
|
|
21
|
-
status:
|
|
21
|
+
status: 'ok';
|
|
22
22
|
orderKey: string;
|
|
23
23
|
}>>;
|
|
24
24
|
export declare const removeFromTree: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
|
|
@@ -28,7 +28,7 @@ export declare const removeFromTree: import("@tanstack/react-start").RequiredFet
|
|
|
28
28
|
collection: string;
|
|
29
29
|
documentId: string;
|
|
30
30
|
}, Promise<{
|
|
31
|
-
status:
|
|
31
|
+
status: 'ok';
|
|
32
32
|
}>>;
|
|
33
33
|
export declare const getTreeAncestors: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
|
|
34
34
|
collection: string;
|
|
@@ -19,7 +19,7 @@ export declare const updateCollectionDocumentWithPatches: import("@tanstack/reac
|
|
|
19
19
|
versionId?: string;
|
|
20
20
|
locale?: string;
|
|
21
21
|
}, Promise<{
|
|
22
|
-
status:
|
|
22
|
+
status: 'ok';
|
|
23
23
|
}>>;
|
|
24
24
|
export declare const updateCollectionDocumentSystemFields: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
|
|
25
25
|
collection: string;
|
|
@@ -38,5 +38,5 @@ export declare const updateCollectionDocumentSystemFields: import("@tanstack/rea
|
|
|
38
38
|
/** Editorial advertised-locale set; omitted means no advertised-locale write. */
|
|
39
39
|
availableLocales?: string[];
|
|
40
40
|
}, Promise<{
|
|
41
|
-
status:
|
|
41
|
+
status: 'ok';
|
|
42
42
|
}>>;
|
|
@@ -25,7 +25,7 @@ function parseUploadFormData(data) {
|
|
|
25
25
|
fields
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function resolveUploadField(definition, collectionPath, requested) {
|
|
29
29
|
const candidates = getUploadFields(definition);
|
|
30
30
|
if (requested) {
|
|
31
31
|
const match = candidates.find((f)=>f.name === requested);
|
|
@@ -37,9 +37,9 @@ function resolveUploadFieldName(definition, collectionPath, requested) {
|
|
|
37
37
|
available: candidates.map((f)=>f.name)
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
-
return match
|
|
40
|
+
return match;
|
|
41
41
|
}
|
|
42
|
-
if (1 === candidates.length) return candidates[0]
|
|
42
|
+
if (1 === candidates.length) return candidates[0];
|
|
43
43
|
if (0 === candidates.length) throw ERR_VALIDATION({
|
|
44
44
|
message: `Collection '${collectionPath}' has no upload-capable image/file field. Add an 'upload' block to one of its image/file fields.`,
|
|
45
45
|
details: {
|
|
@@ -72,10 +72,9 @@ const uploadCollectionField = createServerFn({
|
|
|
72
72
|
}
|
|
73
73
|
}, uploadCollectionField).log(logger);
|
|
74
74
|
const serverConfig = getServerConfig();
|
|
75
|
-
const
|
|
76
|
-
const targetField = config.definition.fields.find((f)=>f.name === resolvedFieldName);
|
|
75
|
+
const targetField = resolveUploadField(config.definition, collectionPath, fieldName);
|
|
77
76
|
const storage = targetField.upload?.storage ?? serverConfig.storage;
|
|
78
|
-
if (!storage) throw new Error(`No storage provider configured for field '${
|
|
77
|
+
if (!storage) throw new Error(`No storage provider configured for field '${targetField.name}' on collection '${collectionPath}'. Set either field.upload.storage or the site-wide ServerConfig.storage.`);
|
|
79
78
|
let buffer;
|
|
80
79
|
try {
|
|
81
80
|
buffer = Buffer.from(await file.arrayBuffer());
|
|
@@ -92,7 +91,7 @@ const uploadCollectionField = createServerFn({
|
|
|
92
91
|
collectionId: config.collection.id,
|
|
93
92
|
collectionVersion: config.collection.version,
|
|
94
93
|
collectionPath,
|
|
95
|
-
fieldName:
|
|
94
|
+
fieldName: targetField.name,
|
|
96
95
|
storage,
|
|
97
96
|
logger,
|
|
98
97
|
defaultLocale: serverConfig.i18n.content.defaultLocale,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.18.0",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20.9.0"
|
|
9
9
|
},
|
|
@@ -117,15 +117,15 @@
|
|
|
117
117
|
"npm-run-all": "^4.1.5",
|
|
118
118
|
"react-json-view-lite": "^2.5.0",
|
|
119
119
|
"react-swipeable": "^7.0.2",
|
|
120
|
-
"uuid": "^14.0.
|
|
120
|
+
"uuid": "^14.0.1",
|
|
121
121
|
"zod": "^4.4.3",
|
|
122
|
-
"@byline/admin": "3.
|
|
123
|
-
"@byline/
|
|
124
|
-
"@byline/
|
|
125
|
-
"@byline/
|
|
126
|
-
"@byline/
|
|
127
|
-
"@byline/i18n": "3.
|
|
128
|
-
"@byline/
|
|
122
|
+
"@byline/admin": "3.18.0",
|
|
123
|
+
"@byline/ai": "3.18.0",
|
|
124
|
+
"@byline/client": "3.18.0",
|
|
125
|
+
"@byline/core": "3.18.0",
|
|
126
|
+
"@byline/auth": "3.18.0",
|
|
127
|
+
"@byline/i18n": "3.18.0",
|
|
128
|
+
"@byline/ui": "3.18.0"
|
|
129
129
|
},
|
|
130
130
|
"peerDependencies": {
|
|
131
131
|
"@tanstack/react-router": "^1.167.0",
|
|
@@ -134,21 +134,21 @@
|
|
|
134
134
|
"react-dom": "^19.0.0"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
|
-
"@biomejs/biome": "2.
|
|
138
|
-
"@rsbuild/plugin-react": "^2.
|
|
139
|
-
"@rslib/core": "^0.
|
|
140
|
-
"@tanstack/react-router": "^1.170.
|
|
141
|
-
"@tanstack/react-start": "^1.168.
|
|
142
|
-
"@types/node": "^
|
|
143
|
-
"@types/react": "19.2.
|
|
137
|
+
"@biomejs/biome": "2.5.2",
|
|
138
|
+
"@rsbuild/plugin-react": "^2.1.0",
|
|
139
|
+
"@rslib/core": "^0.23.2",
|
|
140
|
+
"@tanstack/react-router": "^1.170.17",
|
|
141
|
+
"@tanstack/react-start": "^1.168.27",
|
|
142
|
+
"@types/node": "^26.1.0",
|
|
143
|
+
"@types/react": "19.2.17",
|
|
144
144
|
"@types/react-dom": "19.2.3",
|
|
145
145
|
"lightningcss": "^1.32.0",
|
|
146
|
-
"react": "19.2.
|
|
147
|
-
"react-dom": "19.2.
|
|
146
|
+
"react": "^19.2.7",
|
|
147
|
+
"react-dom": "^19.2.7",
|
|
148
148
|
"rimraf": "^6.1.3",
|
|
149
|
-
"typescript": "
|
|
149
|
+
"typescript": "^7.0.2",
|
|
150
150
|
"typescript-plugin-css-modules": "^5.2.0",
|
|
151
|
-
"vitest": "^4.1.
|
|
151
|
+
"vitest": "^4.1.10"
|
|
152
152
|
},
|
|
153
153
|
"publishConfig": {
|
|
154
154
|
"access": "public",
|
|
@@ -84,16 +84,17 @@ function parseUploadFormData(data: FormData): UploadDocumentInput {
|
|
|
84
84
|
* wins; otherwise default to the unique upload-capable field. Throws
|
|
85
85
|
* `ERR_VALIDATION` when the request is ambiguous.
|
|
86
86
|
*
|
|
87
|
-
*
|
|
88
|
-
* `blocks`
|
|
89
|
-
*
|
|
90
|
-
*
|
|
87
|
+
* Candidates come from `getUploadFields`, which recurses into `group` /
|
|
88
|
+
* `array` / `blocks` — upload fields nested in repeating structures are
|
|
89
|
+
* addressed by their leaf field name. Note the ambiguity fallback counts
|
|
90
|
+
* nested fields too: a collection whose only extra upload field is
|
|
91
|
+
* nested still requires an explicit `field` selector.
|
|
91
92
|
*/
|
|
92
|
-
function
|
|
93
|
+
function resolveUploadField(
|
|
93
94
|
definition: CollectionDefinition,
|
|
94
95
|
collectionPath: string,
|
|
95
96
|
requested: string | null
|
|
96
|
-
):
|
|
97
|
+
): ImageField | FileField {
|
|
97
98
|
const candidates = getUploadFields(definition)
|
|
98
99
|
|
|
99
100
|
if (requested) {
|
|
@@ -110,10 +111,10 @@ function resolveUploadFieldName(
|
|
|
110
111
|
},
|
|
111
112
|
})
|
|
112
113
|
}
|
|
113
|
-
return match
|
|
114
|
+
return match
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
if (candidates.length === 1) return candidates[0]
|
|
117
|
+
if (candidates.length === 1) return candidates[0]
|
|
117
118
|
|
|
118
119
|
if (candidates.length === 0) {
|
|
119
120
|
throw ERR_VALIDATION({
|
|
@@ -167,19 +168,12 @@ export const uploadCollectionField = createServerFn({ method: 'POST' })
|
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
const serverConfig = getServerConfig()
|
|
170
|
-
const
|
|
171
|
-
config.definition,
|
|
172
|
-
collectionPath,
|
|
173
|
-
fieldName
|
|
174
|
-
)
|
|
175
|
-
const targetField = config.definition.fields.find((f) => f.name === resolvedFieldName) as
|
|
176
|
-
| ImageField
|
|
177
|
-
| FileField
|
|
171
|
+
const targetField = resolveUploadField(config.definition, collectionPath, fieldName)
|
|
178
172
|
// Per-field storage routing falls through to the site-wide default.
|
|
179
173
|
const storage = targetField.upload?.storage ?? serverConfig.storage
|
|
180
174
|
if (!storage) {
|
|
181
175
|
throw new Error(
|
|
182
|
-
`No storage provider configured for field '${
|
|
176
|
+
`No storage provider configured for field '${targetField.name}' on collection ` +
|
|
183
177
|
`'${collectionPath}'. Set either field.upload.storage or the site-wide ` +
|
|
184
178
|
'ServerConfig.storage.'
|
|
185
179
|
)
|
|
@@ -199,7 +193,7 @@ export const uploadCollectionField = createServerFn({ method: 'POST' })
|
|
|
199
193
|
collectionId: config.collection.id,
|
|
200
194
|
collectionVersion: config.collection.version,
|
|
201
195
|
collectionPath,
|
|
202
|
-
fieldName:
|
|
196
|
+
fieldName: targetField.name,
|
|
203
197
|
storage,
|
|
204
198
|
logger,
|
|
205
199
|
defaultLocale: serverConfig.i18n.content.defaultLocale,
|