@byline/host-tanstack-start 1.2.0 → 1.2.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.
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { createServerFn } from "@tanstack/react-start";
|
|
2
2
|
import { AuthError } from "@byline/auth";
|
|
3
|
-
import { getServerConfig } from "@byline/core";
|
|
4
|
-
import { createAdminUsersRepository } from "@byline/db-postgres/admin";
|
|
5
3
|
import { getAdminRequestContext } from "../../auth/auth-context.js";
|
|
4
|
+
import { bylineCore } from "../../integrations/byline-core.js";
|
|
6
5
|
const getCurrentAdminUser = createServerFn({
|
|
7
6
|
method: 'GET'
|
|
8
7
|
}).handler(async ()=>{
|
|
9
8
|
const { actor } = await getAdminRequestContext();
|
|
10
9
|
if (!actor) throw new Error('unexpected null actor after getAdminRequestContext');
|
|
11
|
-
const
|
|
12
|
-
const users = createAdminUsersRepository(db);
|
|
13
|
-
const row = await users.getById(actor.id);
|
|
10
|
+
const row = await bylineCore().adminStore.adminUsers.getById(actor.id);
|
|
14
11
|
if (!row) throw new Error('admin user not found for current session');
|
|
15
12
|
return {
|
|
16
13
|
id: row.id,
|
|
@@ -33,9 +30,7 @@ const getCurrentAdminUserSoft = createServerFn({
|
|
|
33
30
|
throw err;
|
|
34
31
|
}
|
|
35
32
|
if (!actor) return null;
|
|
36
|
-
const
|
|
37
|
-
const users = createAdminUsersRepository(db);
|
|
38
|
-
const row = await users.getById(actor.id);
|
|
33
|
+
const row = await bylineCore().adminStore.adminUsers.getById(actor.id);
|
|
39
34
|
if (!row) return null;
|
|
40
35
|
return {
|
|
41
36
|
id: row.id,
|
|
@@ -2,7 +2,7 @@ import { createServerFn } from "@tanstack/react-start";
|
|
|
2
2
|
import { ERR_NOT_FOUND, ERR_VALIDATION, getServerConfig, getUploadFields } from "@byline/core";
|
|
3
3
|
import { getLogger, withLogContext } from "@byline/core/logger";
|
|
4
4
|
import { uploadField } from "@byline/core/services";
|
|
5
|
-
import { extractImageMeta, generateImageVariants, isBypassMimeType } from "@byline/
|
|
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) {
|
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.2.
|
|
6
|
+
"version": "1.2.1",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20.9.0"
|
|
9
9
|
},
|
|
@@ -101,27 +101,17 @@
|
|
|
101
101
|
"react-swipeable": "^7.0.2",
|
|
102
102
|
"uuid": "^14.0.0",
|
|
103
103
|
"zod": "^4.4.2",
|
|
104
|
-
"@byline/admin": "1.2.
|
|
105
|
-
"@byline/
|
|
106
|
-
"@byline/
|
|
107
|
-
"@byline/
|
|
108
|
-
"@byline/
|
|
104
|
+
"@byline/admin": "1.2.1",
|
|
105
|
+
"@byline/auth": "1.2.1",
|
|
106
|
+
"@byline/core": "1.2.1",
|
|
107
|
+
"@byline/client": "1.2.1",
|
|
108
|
+
"@byline/ui": "1.2.1"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
111
|
"@tanstack/react-router": "^1.167.0",
|
|
112
112
|
"@tanstack/react-start": "^1.167.0",
|
|
113
113
|
"react": "^19.0.0",
|
|
114
|
-
"react-dom": "^19.0.0"
|
|
115
|
-
"@byline/db-postgres": "1.2.0",
|
|
116
|
-
"@byline/storage-local": "1.2.0"
|
|
117
|
-
},
|
|
118
|
-
"peerDependenciesMeta": {
|
|
119
|
-
"@byline/db-postgres": {
|
|
120
|
-
"optional": false
|
|
121
|
-
},
|
|
122
|
-
"@byline/storage-local": {
|
|
123
|
-
"optional": false
|
|
124
|
-
}
|
|
114
|
+
"react-dom": "^19.0.0"
|
|
125
115
|
},
|
|
126
116
|
"devDependencies": {
|
|
127
117
|
"@biomejs/biome": "2.4.14",
|
|
@@ -138,9 +128,7 @@
|
|
|
138
128
|
"rimraf": "^6.1.3",
|
|
139
129
|
"typescript": "6.0.3",
|
|
140
130
|
"typescript-plugin-css-modules": "^5.2.0",
|
|
141
|
-
"vitest": "^4.1.5"
|
|
142
|
-
"@byline/storage-local": "1.2.0",
|
|
143
|
-
"@byline/db-postgres": "1.2.0"
|
|
131
|
+
"vitest": "^4.1.5"
|
|
144
132
|
},
|
|
145
133
|
"publishConfig": {
|
|
146
134
|
"access": "public",
|
|
@@ -21,11 +21,9 @@
|
|
|
21
21
|
import { createServerFn } from '@tanstack/react-start'
|
|
22
22
|
|
|
23
23
|
import { type Actor, AuthError } from '@byline/auth'
|
|
24
|
-
import { getServerConfig } from '@byline/core'
|
|
25
|
-
import type { PgAdapter } from '@byline/db-postgres'
|
|
26
|
-
import { createAdminUsersRepository } from '@byline/db-postgres/admin'
|
|
27
24
|
|
|
28
25
|
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
26
|
+
import { bylineCore } from '../../integrations/byline-core.js'
|
|
29
27
|
|
|
30
28
|
export interface CurrentAdminUser {
|
|
31
29
|
id: string
|
|
@@ -57,9 +55,7 @@ export const getCurrentAdminUser = createServerFn({ method: 'GET' }).handler(
|
|
|
57
55
|
throw new Error('unexpected null actor after getAdminRequestContext')
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
const
|
|
61
|
-
const users = createAdminUsersRepository(db)
|
|
62
|
-
const row = await users.getById(actor.id)
|
|
58
|
+
const row = await bylineCore().adminStore!.adminUsers.getById(actor.id)
|
|
63
59
|
if (!row) {
|
|
64
60
|
// Session resolved to an admin id that no longer exists — force the
|
|
65
61
|
// caller back through sign-in rather than return partial data.
|
|
@@ -97,9 +93,7 @@ export const getCurrentAdminUserSoft = createServerFn({ method: 'GET' }).handler
|
|
|
97
93
|
}
|
|
98
94
|
if (!actor) return null
|
|
99
95
|
|
|
100
|
-
const
|
|
101
|
-
const users = createAdminUsersRepository(db)
|
|
102
|
-
const row = await users.getById(actor.id)
|
|
96
|
+
const row = await bylineCore().adminStore!.adminUsers.getById(actor.id)
|
|
103
97
|
if (!row) return null
|
|
104
98
|
|
|
105
99
|
return {
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
import { ERR_NOT_FOUND, ERR_VALIDATION, getServerConfig, getUploadFields } from '@byline/core'
|
|
11
11
|
import { getLogger, withLogContext } from '@byline/core/logger'
|
|
12
12
|
import { uploadField as coreUploadField } from '@byline/core/services'
|
|
13
|
-
import { extractImageMeta, generateImageVariants, isBypassMimeType } from '@byline/
|
|
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'
|