@byline/host-tanstack-start 1.2.1 → 1.3.1
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/server-fns/auth/current-user.js +2 -2
- package/dist/server-fns/collections/upload.js +2 -7
- package/package.json +6 -6
- package/src/admin-shell/admin-roles/container.tsx +11 -2
- package/src/admin-shell/admin-roles/list.tsx +2 -1
- package/src/admin-shell/admin-users/container.tsx +13 -2
- package/src/admin-shell/admin-users/list.tsx +2 -1
- package/src/admin-shell/collections/create.tsx +1 -2
- package/src/admin-shell/collections/edit.tsx +1 -2
- package/src/admin-shell/collections/history.module.css +1 -4
- package/src/admin-shell/collections/history.tsx +29 -19
- package/src/admin-shell/collections/list.tsx +2 -1
- package/src/routes/create-admin-account-route.tsx +1 -2
- package/src/server-fns/auth/current-user.ts +2 -2
- package/src/server-fns/collections/upload.ts +6 -14
|
@@ -7,7 +7,7 @@ const getCurrentAdminUser = createServerFn({
|
|
|
7
7
|
}).handler(async ()=>{
|
|
8
8
|
const { actor } = await getAdminRequestContext();
|
|
9
9
|
if (!actor) throw new Error('unexpected null actor after getAdminRequestContext');
|
|
10
|
-
const row = await bylineCore().adminStore
|
|
10
|
+
const row = await bylineCore().adminStore?.adminUsers.getById(actor.id);
|
|
11
11
|
if (!row) throw new Error('admin user not found for current session');
|
|
12
12
|
return {
|
|
13
13
|
id: row.id,
|
|
@@ -30,7 +30,7 @@ const getCurrentAdminUserSoft = createServerFn({
|
|
|
30
30
|
throw err;
|
|
31
31
|
}
|
|
32
32
|
if (!actor) return null;
|
|
33
|
-
const row = await bylineCore().adminStore
|
|
33
|
+
const row = await bylineCore().adminStore?.adminUsers.getById(actor.id);
|
|
34
34
|
if (!row) return null;
|
|
35
35
|
return {
|
|
36
36
|
id: row.id,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createServerFn } from "@tanstack/react-start";
|
|
2
2
|
import { ERR_NOT_FOUND, ERR_VALIDATION, getServerConfig, getUploadFields } from "@byline/core";
|
|
3
|
+
import { extractImageMeta, generateImageVariants, isBypassMimeType } from "@byline/core/image";
|
|
3
4
|
import { getLogger, withLogContext } from "@byline/core/logger";
|
|
4
5
|
import { uploadField } from "@byline/core/services";
|
|
5
|
-
import { extractImageMeta, generateImageVariants, isBypassMimeType } from "@byline/core/image";
|
|
6
6
|
import { getAdminRequestContext } from "../../auth/auth-context.js";
|
|
7
7
|
import { ensureCollection } from "../../integrations/api-utils.js";
|
|
8
8
|
function parseUploadFormData(data) {
|
|
@@ -101,12 +101,7 @@ const uploadCollectionField = createServerFn({
|
|
|
101
101
|
imageProcessor: {
|
|
102
102
|
extractMeta: extractImageMeta,
|
|
103
103
|
isBypassMimeType: isBypassMimeType,
|
|
104
|
-
generateVariants:
|
|
105
|
-
if (!('uploadDir' in storage) || 'string' != typeof storage.uploadDir) return [];
|
|
106
|
-
const uploadDir = storage.uploadDir;
|
|
107
|
-
const absoluteOriginalPath = `${uploadDir}/${storedFile.storagePath}`;
|
|
108
|
-
return generateImageVariants(buffer, mimeType, absoluteOriginalPath, uploadDir, upload.sizes ?? [], logger);
|
|
109
|
-
}
|
|
104
|
+
generateVariants: ({ buffer, mimeType, storedFile, storage, upload, logger })=>generateImageVariants(buffer, mimeType, storedFile, storage, upload.sizes ?? [], logger)
|
|
110
105
|
}
|
|
111
106
|
};
|
|
112
107
|
return uploadField(ctx, {
|
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.3.1",
|
|
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/admin": "1.
|
|
105
|
-
"@byline/
|
|
106
|
-
"@byline/core": "1.
|
|
107
|
-
"@byline/
|
|
108
|
-
"@byline/ui": "1.
|
|
104
|
+
"@byline/admin": "1.3.1",
|
|
105
|
+
"@byline/client": "1.4.0",
|
|
106
|
+
"@byline/core": "1.4.0",
|
|
107
|
+
"@byline/auth": "1.3.0",
|
|
108
|
+
"@byline/ui": "1.3.1"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
111
|
"@tanstack/react-router": "^1.167.0",
|
|
@@ -29,8 +29,17 @@ import type React from 'react'
|
|
|
29
29
|
import { useState } from 'react'
|
|
30
30
|
import { useRouter } from '@tanstack/react-router'
|
|
31
31
|
|
|
32
|
-
import {
|
|
33
|
-
|
|
32
|
+
import {
|
|
33
|
+
Button,
|
|
34
|
+
CloseIcon,
|
|
35
|
+
Drawer,
|
|
36
|
+
IconButton,
|
|
37
|
+
LocalDateTime,
|
|
38
|
+
Modal,
|
|
39
|
+
RolePermissions,
|
|
40
|
+
UpdateRole,
|
|
41
|
+
useToastManager,
|
|
42
|
+
} from '@byline/ui/react'
|
|
34
43
|
import cx from 'classnames'
|
|
35
44
|
|
|
36
45
|
import styles from './container.module.css'
|
|
@@ -29,11 +29,13 @@ import {
|
|
|
29
29
|
Button,
|
|
30
30
|
CloseIcon,
|
|
31
31
|
Container,
|
|
32
|
+
CreateAdminRole,
|
|
32
33
|
DraggableSortable,
|
|
33
34
|
Drawer,
|
|
34
35
|
GripperVerticalIcon,
|
|
35
36
|
IconButton,
|
|
36
37
|
LoaderEllipsis,
|
|
38
|
+
LocalDateTime,
|
|
37
39
|
moveItem,
|
|
38
40
|
PlusIcon,
|
|
39
41
|
Section,
|
|
@@ -41,7 +43,6 @@ import {
|
|
|
41
43
|
useSortable,
|
|
42
44
|
useToastManager,
|
|
43
45
|
} from '@byline/ui/react'
|
|
44
|
-
import { CreateAdminRole, LocalDateTime } from '@byline/ui/react'
|
|
45
46
|
import cx from 'classnames'
|
|
46
47
|
|
|
47
48
|
import { reorderAdminRoles } from '../../server-fns/admin-roles/reorder.js'
|
|
@@ -12,8 +12,19 @@ import type React from 'react'
|
|
|
12
12
|
import { useState } from 'react'
|
|
13
13
|
import { useRouter } from '@tanstack/react-router'
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
15
|
+
import {
|
|
16
|
+
Button,
|
|
17
|
+
CloseIcon,
|
|
18
|
+
Drawer,
|
|
19
|
+
EditIcon,
|
|
20
|
+
IconButton,
|
|
21
|
+
LocalDateTime,
|
|
22
|
+
Modal,
|
|
23
|
+
SetPassword,
|
|
24
|
+
UpdateUser,
|
|
25
|
+
UserRoles,
|
|
26
|
+
useToastManager,
|
|
27
|
+
} from '@byline/ui/react'
|
|
17
28
|
import cx from 'classnames'
|
|
18
29
|
|
|
19
30
|
import styles from './container.module.css'
|
|
@@ -14,8 +14,10 @@ import { useRouter, useRouterState } from '@tanstack/react-router'
|
|
|
14
14
|
import {
|
|
15
15
|
CloseIcon,
|
|
16
16
|
Container,
|
|
17
|
+
CreateAdminUser,
|
|
17
18
|
Drawer,
|
|
18
19
|
IconButton,
|
|
20
|
+
LocalDateTime,
|
|
19
21
|
PlusIcon,
|
|
20
22
|
Search,
|
|
21
23
|
Section,
|
|
@@ -23,7 +25,6 @@ import {
|
|
|
23
25
|
Table,
|
|
24
26
|
useToastManager,
|
|
25
27
|
} from '@byline/ui/react'
|
|
26
|
-
import { CreateAdminUser, LocalDateTime } from '@byline/ui/react'
|
|
27
28
|
import cx from 'classnames'
|
|
28
29
|
|
|
29
30
|
import { Link, useNavigate } from '../chrome/loose-router.js'
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
import { useState } from 'react'
|
|
10
10
|
|
|
11
11
|
import type { CollectionAdminConfig, CollectionDefinition } from '@byline/core'
|
|
12
|
-
import { Container, Section, useToastManager } from '@byline/ui/react'
|
|
13
|
-
import { FormRenderer } from '@byline/ui/react'
|
|
12
|
+
import { Container, FormRenderer, Section, useToastManager } from '@byline/ui/react'
|
|
14
13
|
|
|
15
14
|
import { createCollectionDocument } from '../../server-fns/collections/index.js'
|
|
16
15
|
import { useNavigate } from '../chrome/loose-router.js'
|
|
@@ -11,8 +11,7 @@ import { useState } from 'react'
|
|
|
11
11
|
import type { CollectionAdminConfig, CollectionDefinition } from '@byline/core'
|
|
12
12
|
import { getDefaultStatus, getWorkflowStatuses } from '@byline/core'
|
|
13
13
|
import type { AnyCollectionSchemaTypes } from '@byline/core/zod-schemas'
|
|
14
|
-
import { Container, Section, useToastManager } from '@byline/ui/react'
|
|
15
|
-
import { FormRenderer } from '@byline/ui/react'
|
|
14
|
+
import { Container, FormRenderer, Section, useToastManager } from '@byline/ui/react'
|
|
16
15
|
|
|
17
16
|
import {
|
|
18
17
|
deleteDocument,
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
@media (min-width: 40rem) {
|
|
27
|
-
|
|
28
27
|
.head,
|
|
29
28
|
:global(.byline-coll-history-head) {
|
|
30
29
|
flex-direction: row;
|
|
@@ -74,7 +73,6 @@
|
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
@media (min-width: 40rem) {
|
|
77
|
-
|
|
78
76
|
.options,
|
|
79
77
|
:global(.byline-coll-history-options) {
|
|
80
78
|
flex-direction: row;
|
|
@@ -197,9 +195,8 @@
|
|
|
197
195
|
}
|
|
198
196
|
|
|
199
197
|
@media (min-width: 40rem) {
|
|
200
|
-
|
|
201
198
|
.pageSize,
|
|
202
199
|
:global(.byline-coll-history-page-size) {
|
|
203
200
|
margin-left: auto;
|
|
204
201
|
}
|
|
205
|
-
}
|
|
202
|
+
}
|
|
@@ -11,8 +11,18 @@ import { useParams, useRouterState } from '@tanstack/react-router'
|
|
|
11
11
|
|
|
12
12
|
import type { CollectionAdminConfig, CollectionDefinition, WorkflowStatus } from '@byline/core'
|
|
13
13
|
import type { AnyCollectionSchemaTypes } from '@byline/core/zod-schemas'
|
|
14
|
-
import {
|
|
15
|
-
|
|
14
|
+
import {
|
|
15
|
+
Button,
|
|
16
|
+
CloseIcon,
|
|
17
|
+
Container,
|
|
18
|
+
IconButton,
|
|
19
|
+
Modal,
|
|
20
|
+
renderFormatted,
|
|
21
|
+
Section,
|
|
22
|
+
Select,
|
|
23
|
+
StatusBadge,
|
|
24
|
+
Table,
|
|
25
|
+
} from '@byline/ui/react'
|
|
16
26
|
import cx from 'classnames'
|
|
17
27
|
|
|
18
28
|
import { Link, useNavigate } from '../chrome/loose-router.js'
|
|
@@ -75,7 +85,7 @@ function padRows(value: number) {
|
|
|
75
85
|
key={`empty-row-${
|
|
76
86
|
// biome-ignore lint/suspicious/noArrayIndexKey: we're okay here
|
|
77
87
|
index
|
|
78
|
-
|
|
88
|
+
}`}
|
|
79
89
|
className={cx('byline-coll-history-pad-row', styles.padRow)}
|
|
80
90
|
>
|
|
81
91
|
|
|
@@ -262,15 +272,15 @@ export const HistoryView = ({
|
|
|
262
272
|
>
|
|
263
273
|
{column.formatter
|
|
264
274
|
? renderFormatted(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
275
|
+
getColumnValue(document, column.fieldName as string),
|
|
276
|
+
document,
|
|
277
|
+
column.formatter
|
|
278
|
+
)
|
|
269
279
|
: resolveDisplayValue(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
280
|
+
getColumnValue(document, column.fieldName as string),
|
|
281
|
+
locale,
|
|
282
|
+
defaultContentLocale
|
|
283
|
+
) || '------'}
|
|
274
284
|
</button>
|
|
275
285
|
) : (
|
|
276
286
|
<Link
|
|
@@ -282,15 +292,15 @@ export const HistoryView = ({
|
|
|
282
292
|
>
|
|
283
293
|
{column.formatter
|
|
284
294
|
? renderFormatted(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
295
|
+
getColumnValue(document, column.fieldName as string),
|
|
296
|
+
document,
|
|
297
|
+
column.formatter
|
|
298
|
+
)
|
|
289
299
|
: resolveDisplayValue(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
300
|
+
getColumnValue(document, column.fieldName as string),
|
|
301
|
+
locale,
|
|
302
|
+
defaultContentLocale
|
|
303
|
+
) || '------'}
|
|
294
304
|
</Link>
|
|
295
305
|
)
|
|
296
306
|
) : column.formatter ? (
|
|
@@ -16,12 +16,13 @@ import {
|
|
|
16
16
|
IconButton,
|
|
17
17
|
LoaderRing,
|
|
18
18
|
PlusIcon,
|
|
19
|
+
renderFormatted,
|
|
19
20
|
Search,
|
|
20
21
|
Section,
|
|
21
22
|
Select,
|
|
23
|
+
StatusBadge,
|
|
22
24
|
Table,
|
|
23
25
|
} from '@byline/ui/react'
|
|
24
|
-
import { renderFormatted, StatusBadge } from '@byline/ui/react'
|
|
25
26
|
import cx from 'classnames'
|
|
26
27
|
|
|
27
28
|
import { Link, useNavigate } from '../chrome/loose-router.js'
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { createFileRoute } from '@tanstack/react-router'
|
|
10
10
|
|
|
11
|
-
import { Container, Section } from '@byline/ui/react'
|
|
12
|
-
import { AccountSelfContainer } from '@byline/ui/react'
|
|
11
|
+
import { AccountSelfContainer, Container, Section } from '@byline/ui/react'
|
|
13
12
|
|
|
14
13
|
import { BreadcrumbsClient } from '../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js'
|
|
15
14
|
import { type AccountResponse, getAccount } from '../server-fns/admin-account/index.js'
|
|
@@ -55,7 +55,7 @@ export const getCurrentAdminUser = createServerFn({ method: 'GET' }).handler(
|
|
|
55
55
|
throw new Error('unexpected null actor after getAdminRequestContext')
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
const row = await bylineCore().adminStore
|
|
58
|
+
const row = await bylineCore().adminStore?.adminUsers.getById(actor.id)
|
|
59
59
|
if (!row) {
|
|
60
60
|
// Session resolved to an admin id that no longer exists — force the
|
|
61
61
|
// caller back through sign-in rather than return partial data.
|
|
@@ -93,7 +93,7 @@ export const getCurrentAdminUserSoft = createServerFn({ method: 'GET' }).handler
|
|
|
93
93
|
}
|
|
94
94
|
if (!actor) return null
|
|
95
95
|
|
|
96
|
-
const row = await bylineCore().adminStore
|
|
96
|
+
const row = await bylineCore().adminStore?.adminUsers.getById(actor.id)
|
|
97
97
|
if (!row) return null
|
|
98
98
|
|
|
99
99
|
return {
|
|
@@ -8,9 +8,9 @@ import type {
|
|
|
8
8
|
StoredFileValue,
|
|
9
9
|
} from '@byline/core'
|
|
10
10
|
import { ERR_NOT_FOUND, ERR_VALIDATION, getServerConfig, getUploadFields } from '@byline/core'
|
|
11
|
+
import { extractImageMeta, generateImageVariants, isBypassMimeType } from '@byline/core/image'
|
|
11
12
|
import { getLogger, withLogContext } from '@byline/core/logger'
|
|
12
13
|
import { uploadField as coreUploadField } from '@byline/core/services'
|
|
13
|
-
import { extractImageMeta, generateImageVariants, isBypassMimeType } from '@byline/core/image'
|
|
14
14
|
|
|
15
15
|
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
16
16
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
@@ -208,23 +208,15 @@ export const uploadCollectionField = createServerFn({ method: 'POST' })
|
|
|
208
208
|
imageProcessor: {
|
|
209
209
|
extractMeta: extractImageMeta,
|
|
210
210
|
isBypassMimeType,
|
|
211
|
-
generateVariants:
|
|
212
|
-
|
|
213
|
-
return []
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const uploadDir = (storage as any).uploadDir as string
|
|
217
|
-
const absoluteOriginalPath = `${uploadDir}/${storedFile.storagePath}`
|
|
218
|
-
|
|
219
|
-
return generateImageVariants(
|
|
211
|
+
generateVariants: ({ buffer, mimeType, storedFile, storage, upload, logger }) =>
|
|
212
|
+
generateImageVariants(
|
|
220
213
|
buffer,
|
|
221
214
|
mimeType,
|
|
222
|
-
|
|
223
|
-
|
|
215
|
+
storedFile,
|
|
216
|
+
storage,
|
|
224
217
|
upload.sizes ?? [],
|
|
225
218
|
logger
|
|
226
|
-
)
|
|
227
|
-
},
|
|
219
|
+
),
|
|
228
220
|
},
|
|
229
221
|
}
|
|
230
222
|
|