@byline/host-tanstack-start 4.0.0 → 4.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/i18n/resolve-locale.js +1 -1
- package/dist/index.d.ts +5 -6
- package/dist/integrations/host-bridge.d.ts +13 -0
- package/dist/integrations/host-bridge.js +22 -0
- package/dist/integrations/serve-uploads.d.ts +1 -0
- package/dist/integrations/serve-uploads.js +1 -0
- package/dist/server-fns/admin-account/change-password.js +1 -1
- package/dist/server-fns/admin-account/get.js +1 -1
- package/dist/server-fns/admin-account/update.js +1 -1
- package/dist/server-fns/admin-activity/get.js +1 -1
- package/dist/server-fns/admin-permissions/get-role-abilities.js +1 -1
- package/dist/server-fns/admin-permissions/list-registered.js +1 -1
- package/dist/server-fns/admin-permissions/set-role-abilities.js +1 -1
- package/dist/server-fns/admin-permissions/who-has.js +1 -1
- package/dist/server-fns/admin-roles/create.js +1 -1
- package/dist/server-fns/admin-roles/delete.js +1 -1
- package/dist/server-fns/admin-roles/get.js +1 -1
- package/dist/server-fns/admin-roles/list.js +1 -1
- package/dist/server-fns/admin-roles/reorder.js +1 -1
- package/dist/server-fns/admin-roles/update.js +1 -1
- package/dist/server-fns/admin-users/create.js +1 -1
- package/dist/server-fns/admin-users/delete.js +1 -1
- package/dist/server-fns/admin-users/disable.js +1 -1
- package/dist/server-fns/admin-users/enable.js +1 -1
- package/dist/server-fns/admin-users/get-user-roles.js +1 -1
- package/dist/server-fns/admin-users/get.js +1 -1
- package/dist/server-fns/admin-users/list.js +1 -1
- package/dist/server-fns/admin-users/set-password.js +1 -1
- package/dist/server-fns/admin-users/set-user-roles.js +1 -1
- package/dist/server-fns/admin-users/update.js +1 -1
- package/dist/server-fns/ai/execute.js +1 -1
- package/dist/server-fns/auth/current-user.js +1 -1
- package/dist/server-fns/auth/sign-in.js +1 -1
- package/dist/server-fns/auth/sign-out.js +1 -2
- package/dist/server-fns/collections/audit.js +1 -1
- package/dist/server-fns/collections/copy-to-locale.js +1 -1
- package/dist/server-fns/collections/create.js +1 -1
- package/dist/server-fns/collections/delete-locale.js +1 -1
- package/dist/server-fns/collections/delete.js +1 -1
- package/dist/server-fns/collections/duplicate.js +1 -1
- package/dist/server-fns/collections/get.js +1 -1
- package/dist/server-fns/collections/history.js +1 -1
- package/dist/server-fns/collections/list.js +1 -1
- package/dist/server-fns/collections/reindex.js +1 -1
- package/dist/server-fns/collections/reorder.js +1 -1
- package/dist/server-fns/collections/restore-version.js +1 -1
- package/dist/server-fns/collections/stats.js +1 -1
- package/dist/server-fns/collections/status.js +1 -1
- package/dist/server-fns/collections/tree.js +1 -1
- package/dist/server-fns/collections/update.js +1 -1
- package/dist/server-fns/collections/upload.js +1 -1
- package/dist/server-fns/i18n/set-locale.js +1 -1
- package/dist/server-fns/preview/disable.js +1 -1
- package/dist/server-fns/preview/enable.js +1 -2
- package/dist/server-fns/preview/state.js +1 -1
- package/package.json +8 -13
- package/src/i18n/resolve-locale.ts +1 -1
- package/src/index.ts +5 -6
- package/src/integrations/host-bridge.ts +56 -0
- package/src/integrations/serve-uploads.ts +6 -0
- package/src/server-fns/admin-account/change-password.ts +1 -1
- package/src/server-fns/admin-account/get.ts +1 -1
- package/src/server-fns/admin-account/update.ts +1 -1
- package/src/server-fns/admin-activity/get.ts +1 -1
- package/src/server-fns/admin-permissions/get-role-abilities.ts +1 -1
- package/src/server-fns/admin-permissions/list-registered.ts +1 -1
- package/src/server-fns/admin-permissions/set-role-abilities.ts +1 -1
- package/src/server-fns/admin-permissions/who-has.ts +1 -1
- package/src/server-fns/admin-roles/create.ts +1 -1
- package/src/server-fns/admin-roles/delete.ts +1 -1
- package/src/server-fns/admin-roles/get.ts +1 -1
- package/src/server-fns/admin-roles/list.ts +1 -1
- package/src/server-fns/admin-roles/reorder.ts +1 -1
- package/src/server-fns/admin-roles/update.ts +1 -1
- package/src/server-fns/admin-users/create.ts +1 -1
- package/src/server-fns/admin-users/delete.ts +1 -1
- package/src/server-fns/admin-users/disable.ts +1 -1
- package/src/server-fns/admin-users/enable.ts +1 -1
- package/src/server-fns/admin-users/get-user-roles.ts +1 -1
- package/src/server-fns/admin-users/get.ts +1 -1
- package/src/server-fns/admin-users/list.ts +1 -1
- package/src/server-fns/admin-users/set-password.ts +1 -1
- package/src/server-fns/admin-users/set-user-roles.ts +1 -1
- package/src/server-fns/admin-users/update.ts +1 -1
- package/src/server-fns/ai/execute.ts +1 -2
- package/src/server-fns/auth/current-user.ts +1 -1
- package/src/server-fns/auth/sign-in.ts +1 -1
- package/src/server-fns/auth/sign-out.ts +5 -3
- package/src/server-fns/collections/audit.ts +1 -1
- package/src/server-fns/collections/copy-to-locale.ts +1 -1
- package/src/server-fns/collections/create.ts +1 -1
- package/src/server-fns/collections/delete-locale.ts +1 -1
- package/src/server-fns/collections/delete.ts +1 -1
- package/src/server-fns/collections/duplicate.ts +1 -1
- package/src/server-fns/collections/get.ts +1 -1
- package/src/server-fns/collections/history.ts +1 -1
- package/src/server-fns/collections/list.ts +1 -1
- package/src/server-fns/collections/reindex.ts +1 -1
- package/src/server-fns/collections/reorder.ts +1 -1
- package/src/server-fns/collections/restore-version.ts +1 -1
- package/src/server-fns/collections/stats.ts +2 -1
- package/src/server-fns/collections/status.ts +1 -1
- package/src/server-fns/collections/tree.ts +1 -1
- package/src/server-fns/collections/update.ts +1 -1
- package/src/server-fns/collections/upload.ts +1 -1
- package/src/server-fns/i18n/set-locale.ts +1 -1
- package/src/server-fns/preview/disable.ts +1 -1
- package/src/server-fns/preview/enable.ts +1 -2
- package/src/server-fns/preview/state.ts +1 -1
- package/dist/auth/auth-context.d.ts +0 -50
- package/dist/auth/auth-context.js +0 -61
- package/dist/auth/auth-cookies.d.ts +0 -34
- package/dist/auth/auth-cookies.js +0 -46
- package/dist/auth/preview-cookies.d.ts +0 -19
- package/dist/auth/preview-cookies.js +0 -26
- package/dist/auth/request-scope.d.ts +0 -16
- package/dist/auth/request-scope.js +0 -24
- package/dist/integrations/byline-client.d.ts +0 -24
- package/dist/integrations/byline-client.js +0 -25
- package/dist/integrations/byline-public-client.d.ts +0 -47
- package/dist/integrations/byline-public-client.js +0 -19
- package/dist/integrations/byline-viewer-client.d.ts +0 -26
- package/dist/integrations/byline-viewer-client.js +0 -44
- package/src/auth/auth-context.test.node.ts +0 -302
- package/src/auth/auth-context.ts +0 -142
- package/src/auth/auth-cookies.ts +0 -113
- package/src/auth/preview-cookies.ts +0 -73
- package/src/auth/request-scope.test.node.ts +0 -93
- package/src/auth/request-scope.ts +0 -62
- package/src/integrations/byline-client.ts +0 -68
- package/src/integrations/byline-public-client.ts +0 -67
- package/src/integrations/byline-viewer-client.ts +0 -111
- package/src/integrations/request-context-contract.test.node.ts +0 -131
- package/src/integrations/request-context-factories.test.node.ts +0 -140
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
import { getRequestHeader } from '@tanstack/react-start/server'
|
|
24
24
|
|
|
25
25
|
import { AuthError, AuthErrorCodes } from '@byline/auth'
|
|
26
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
26
27
|
import type { LocaleCode } from '@byline/i18n'
|
|
27
28
|
import { resolveInterfaceLocale } from '@byline/i18n'
|
|
28
29
|
|
|
29
|
-
import { getAdminRequestContext } from '../auth/auth-context.js'
|
|
30
30
|
import { bylineCore } from '../integrations/byline-core.js'
|
|
31
31
|
import { readAdminLocaleCookie } from './locale-cookie.js'
|
|
32
32
|
|
package/src/index.ts
CHANGED
|
@@ -19,14 +19,13 @@
|
|
|
19
19
|
* - `@byline/host-tanstack-start/server-fns/<module>` — TanStack Start
|
|
20
20
|
* server functions for each admin module (admin-account, admin-roles,
|
|
21
21
|
* admin-users, admin-permissions, auth, collections).
|
|
22
|
-
* - `@byline/host-tanstack-start/auth/auth-context` — request-scoped
|
|
23
|
-
* `RequestContext` resolution that reads session cookies, refreshes
|
|
24
|
-
* transparently, and surfaces `ERR_UNAUTHENTICATED` to callers.
|
|
25
22
|
* - `@byline/host-tanstack-start/integrations/*` — host-side adapters
|
|
26
23
|
* binding TanStack Start primitives to the framework-neutral
|
|
27
|
-
* contracts in `@byline/ui
|
|
28
|
-
* (`bylineFieldServices`, `bylineAdminServices`,
|
|
29
|
-
* `
|
|
24
|
+
* contracts in `@byline/ui`, `@byline/core`, and `@byline/client`
|
|
25
|
+
* (`bylineFieldServices`, `bylineAdminServices`, and `host-bridge` —
|
|
26
|
+
* the `HostRequestBridge` implementation behind the
|
|
27
|
+
* `@byline/client/server` getters; request-context resolution and the
|
|
28
|
+
* client singletons themselves live in `@byline/client/server`).
|
|
30
29
|
* - `@byline/host-tanstack-start/admin-shell/{chrome,collections,...}` —
|
|
31
30
|
* router-coupled admin UI: shared shell chrome (menu drawer, app bar,
|
|
32
31
|
* route-error, breadcrumbs, etc.) plus per-area page containers.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The TanStack Start implementation of `HostRequestBridge` — the three
|
|
11
|
+
* request primitives (`getRequest` identity, cookie read, cookie write)
|
|
12
|
+
* that `@byline/client/server` is written against.
|
|
13
|
+
*
|
|
14
|
+
* Registered as a module side effect: every module in this package that
|
|
15
|
+
* fronts the server-side client stack imports this file first, so any
|
|
16
|
+
* code path that can reach a getter has already registered the bridge.
|
|
17
|
+
* Registration is idempotent (last-write-wins on a `globalThis` symbol
|
|
18
|
+
* slot), so repeated evaluation across Vite SSR module graphs is
|
|
19
|
+
* harmless.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { getCookie, getRequest, setCookie } from '@tanstack/react-start/server'
|
|
23
|
+
|
|
24
|
+
import {
|
|
25
|
+
type HostCookieSetOptions,
|
|
26
|
+
type HostRequestBridge,
|
|
27
|
+
registerHostRequestBridge,
|
|
28
|
+
} from '@byline/core'
|
|
29
|
+
|
|
30
|
+
const tanstackStartRequestBridge: HostRequestBridge = {
|
|
31
|
+
getRequest(): object | undefined {
|
|
32
|
+
try {
|
|
33
|
+
return getRequest()
|
|
34
|
+
} catch {
|
|
35
|
+
// No StartEvent in AsyncLocalStorage — running outside a request.
|
|
36
|
+
return undefined
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
getCookie(name: string): string | undefined {
|
|
40
|
+
return getCookie(name)
|
|
41
|
+
},
|
|
42
|
+
setCookie(name: string, value: string, options?: HostCookieSetOptions): void {
|
|
43
|
+
setCookie(name, value, options)
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Register the TanStack Start bridge. Safe to call any number of times;
|
|
49
|
+
* exported for hosts that want registration to be explicit in their
|
|
50
|
+
* server config rather than relying on a side-effect import.
|
|
51
|
+
*/
|
|
52
|
+
export function registerTanstackStartHostBridge(): void {
|
|
53
|
+
registerHostRequestBridge(tanstackStartRequestBridge)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
registerTanstackStartHostBridge()
|
|
@@ -46,6 +46,12 @@ import type { Stats } from 'node:fs'
|
|
|
46
46
|
import { readFile, stat } from 'node:fs/promises'
|
|
47
47
|
import { resolve as resolvePath } from 'node:path'
|
|
48
48
|
|
|
49
|
+
// Belt-and-braces bridge registration: `serveUploads` is imported by every
|
|
50
|
+
// scaffolded app's `src/server.ts` at boot, so pulling in the host bridge
|
|
51
|
+
// here guarantees `@byline/client/server` getters can resolve cookies even
|
|
52
|
+
// if a server config forgets the explicit `registerTanstackStartHostBridge()`.
|
|
53
|
+
import './host-bridge.js'
|
|
54
|
+
|
|
49
55
|
export interface UploadsHandlerOptions {
|
|
50
56
|
/**
|
|
51
57
|
* URL prefix to match. Trailing slash required. Default `'/uploads/'`.
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AccountResponse, changeAccountPasswordCommand } from '@byline/admin/admin-account'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export interface ChangeAccountPasswordInput {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AccountResponse, getAccountCommand } from '@byline/admin/admin-account'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AccountResponse, updateAccountCommand } from '@byline/admin/admin-account'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export interface UpdateAccountInput {
|
|
@@ -10,9 +10,9 @@ import { createServerFn } from '@tanstack/react-start'
|
|
|
10
10
|
|
|
11
11
|
import { assertAdminActor } from '@byline/admin'
|
|
12
12
|
import { ADMIN_ACTIVITY_ABILITIES } from '@byline/admin/admin-activity'
|
|
13
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
13
14
|
import { ERR_AUDIT_UNSUPPORTED, getLogger, getServerConfig } from '@byline/core'
|
|
14
15
|
|
|
15
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
16
16
|
import { type ActorLabelMap, resolveActorLabels } from '../collections/actors.js'
|
|
17
17
|
import type { AuditLogEntryDto } from '../collections/audit.js'
|
|
18
18
|
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
type GetRoleAbilitiesResponse,
|
|
13
13
|
getRoleAbilitiesCommand,
|
|
14
14
|
} from '@byline/admin/admin-permissions'
|
|
15
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
15
16
|
|
|
16
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
17
17
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
18
18
|
|
|
19
19
|
export const getRoleAbilities = createServerFn({ method: 'GET' })
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
type ListRegisteredAbilitiesResponse,
|
|
13
13
|
listRegisteredAbilitiesCommand,
|
|
14
14
|
} from '@byline/admin/admin-permissions'
|
|
15
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
15
16
|
|
|
16
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
17
17
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
type SetRoleAbilitiesResponse,
|
|
13
13
|
setRoleAbilitiesCommand,
|
|
14
14
|
} from '@byline/admin/admin-permissions'
|
|
15
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
15
16
|
|
|
16
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
17
17
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
18
18
|
|
|
19
19
|
export interface SetRoleAbilitiesInput {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type WhoHasAbilityResponse, whoHasAbilityCommand } from '@byline/admin/admin-permissions'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export const whoHasAbility = createServerFn({ method: 'GET' })
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AdminRoleResponse, createAdminRoleCommand } from '@byline/admin/admin-roles'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export interface CreateAdminRoleInput {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { deleteAdminRoleCommand } from '@byline/admin/admin-roles'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
// Return shape mirrors `OkResponse` from `@byline/admin/admin-users`.
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AdminRoleResponse, getAdminRoleCommand } from '@byline/admin/admin-roles'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export const getAdminRole = createServerFn({ method: 'GET' })
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AdminRoleListResponse, listAdminRolesCommand } from '@byline/admin/admin-roles'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { reorderAdminRolesCommand } from '@byline/admin/admin-roles'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export const reorderAdminRoles = createServerFn({ method: 'POST' })
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AdminRoleResponse, updateAdminRoleCommand } from '@byline/admin/admin-roles'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export interface UpdateAdminRoleInput {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AdminUserResponse, createAdminUserCommand } from '@byline/admin/admin-users'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export interface CreateAdminUserInput {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { deleteAdminUserCommand, type OkResponse } from '@byline/admin/admin-users'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export const deleteAdminUser = createServerFn({ method: 'POST' })
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { disableAdminUserCommand, type OkResponse } from '@byline/admin/admin-users'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
// No UI affordance yet — paired with `enable.ts`, both ship ahead of the
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { enableAdminUserCommand, type OkResponse } from '@byline/admin/admin-users'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
// No UI affordance yet — paired with `disable.ts`, both ship ahead of the
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { getRolesForUserCommand, type UserRolesResponse } from '@byline/admin/admin-roles'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export const getUserRoles = createServerFn({ method: 'GET' })
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AdminUserResponse, getAdminUserCommand } from '@byline/admin/admin-users'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export const getAdminUser = createServerFn({ method: 'GET' })
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
type AdminUserListResponse,
|
|
14
14
|
listAdminUsersCommand,
|
|
15
15
|
} from '@byline/admin/admin-users'
|
|
16
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
16
17
|
|
|
17
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
18
18
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
19
19
|
|
|
20
20
|
export interface ListAdminUsersInput {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AdminUserResponse, setAdminUserPasswordCommand } from '@byline/admin/admin-users'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export interface SetAdminUserPasswordInput {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { setRolesForUserCommand, type UserRolesResponse } from '@byline/admin/admin-roles'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export interface SetUserRolesInput {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
11
|
import { type AdminUserResponse, updateAdminUserCommand } from '@byline/admin/admin-users'
|
|
12
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
12
13
|
|
|
13
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
14
14
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
15
15
|
|
|
16
16
|
export interface UpdateAdminUserInput {
|
|
@@ -24,8 +24,7 @@ import type { ExecuteInstructionOptions, ExecuteInstructionParams } from '@bylin
|
|
|
24
24
|
// Server-only execute API — kept on the `/server` subpath so the browser
|
|
25
25
|
// barrel for `@byline/ai` stays free of pino + the provider SDKs.
|
|
26
26
|
import { executeInstruction, executeInstructionStreaming } from '@byline/ai/server'
|
|
27
|
-
|
|
28
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
27
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
29
28
|
|
|
30
29
|
/**
|
|
31
30
|
* Wire shape — the same as `ExecuteInstruction` minus the in-process-only
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
import { createServerFn } from '@tanstack/react-start'
|
|
22
22
|
|
|
23
23
|
import { type Actor, AuthError } from '@byline/auth'
|
|
24
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
24
25
|
|
|
25
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
26
26
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
27
27
|
|
|
28
28
|
export interface CurrentAdminUser {
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
import { createServerFn } from '@tanstack/react-start'
|
|
21
21
|
import { getRequestHeader } from '@tanstack/react-start/server'
|
|
22
22
|
|
|
23
|
+
import { setSessionCookies } from '@byline/client/server'
|
|
23
24
|
import { getServerConfig } from '@byline/core'
|
|
24
25
|
|
|
25
|
-
import { setSessionCookies } from '../../auth/auth-cookies.js'
|
|
26
26
|
import { readAdminLocaleCookie } from '../../i18n/locale-cookie.js'
|
|
27
27
|
import { bylineCore } from '../../integrations/byline-core.js'
|
|
28
28
|
|
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
|
|
24
24
|
import { createServerFn } from '@tanstack/react-start'
|
|
25
25
|
|
|
26
|
+
import {
|
|
27
|
+
clearPreviewCookie,
|
|
28
|
+
clearSessionCookies,
|
|
29
|
+
readRefreshTokenCookie,
|
|
30
|
+
} from '@byline/client/server'
|
|
26
31
|
import { getServerConfig } from '@byline/core'
|
|
27
32
|
|
|
28
|
-
import { clearSessionCookies, readRefreshTokenCookie } from '../../auth/auth-cookies.js'
|
|
29
|
-
import { clearPreviewCookie } from '../../auth/preview-cookies.js'
|
|
30
|
-
|
|
31
33
|
export const adminSignOut = createServerFn({ method: 'POST' }).handler(async () => {
|
|
32
34
|
const provider = getServerConfig().sessionProvider
|
|
33
35
|
const refreshToken = readRefreshTokenCookie()
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminBylineClient } from '@byline/client/server'
|
|
11
12
|
import { ERR_NOT_FOUND, getLogger } from '@byline/core'
|
|
12
13
|
|
|
13
14
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
14
|
-
import { getAdminBylineClient } from '../../integrations/byline-client.js'
|
|
15
15
|
import { type ActorLabelMap, resolveActorLabels } from './actors.js'
|
|
16
16
|
|
|
17
17
|
// ---------------------------------------------------------------------------
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
11
12
|
import { ERR_NOT_FOUND, getLogger, getServerConfig } from '@byline/core'
|
|
12
13
|
import type { CopyToLocaleResult, DocumentLifecycleContext } from '@byline/core/services'
|
|
13
14
|
import { copyToLocale } from '@byline/core/services'
|
|
14
15
|
|
|
15
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
16
16
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
17
17
|
|
|
18
18
|
// ---------------------------------------------------------------------------
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
11
12
|
import { ERR_NOT_FOUND, getLogger, getServerConfig } from '@byline/core'
|
|
12
13
|
import type { DocumentLifecycleContext } from '@byline/core/services'
|
|
13
14
|
import { createDocument } from '@byline/core/services'
|
|
14
15
|
|
|
15
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
16
16
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
17
17
|
|
|
18
18
|
// ---------------------------------------------------------------------------
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
11
12
|
import { ERR_NOT_FOUND, getLogger, getServerConfig } from '@byline/core'
|
|
12
13
|
import type { DeleteLocaleResult, DocumentLifecycleContext } from '@byline/core/services'
|
|
13
14
|
import { deleteLocale } from '@byline/core/services'
|
|
14
15
|
|
|
15
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
16
16
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
17
17
|
|
|
18
18
|
// ---------------------------------------------------------------------------
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
11
12
|
import { ERR_NOT_FOUND, getLogger, getServerConfig, getUploadFields } from '@byline/core'
|
|
12
13
|
import type { DocumentLifecycleContext } from '@byline/core/services'
|
|
13
14
|
import { deleteDocument as deleteDocumentService } from '@byline/core/services'
|
|
14
15
|
|
|
15
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
16
16
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
17
17
|
import { toDeleteDocumentResponse } from './delete-outcome.js'
|
|
18
18
|
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
11
12
|
import { ERR_NOT_FOUND, getLogger, getServerConfig } from '@byline/core'
|
|
12
13
|
import type { DocumentLifecycleContext, DuplicateDocumentResult } from '@byline/core/services'
|
|
13
14
|
import { duplicateDocument } from '@byline/core/services'
|
|
14
15
|
|
|
15
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
16
16
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
17
17
|
|
|
18
18
|
// ---------------------------------------------------------------------------
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminBylineClient } from '@byline/client/server'
|
|
11
12
|
import {
|
|
12
13
|
BylineError,
|
|
13
14
|
buildRelationSummaryPopulateMap,
|
|
@@ -22,7 +23,6 @@ import {
|
|
|
22
23
|
} from '@byline/core'
|
|
23
24
|
|
|
24
25
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
25
|
-
import { getAdminBylineClient } from '../../integrations/byline-client.js'
|
|
26
26
|
import { serialise } from './utils'
|
|
27
27
|
|
|
28
28
|
// ---------------------------------------------------------------------------
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminBylineClient } from '@byline/client/server'
|
|
11
12
|
import { ERR_NOT_FOUND, getCollectionSchemasForPath, getLogger } from '@byline/core'
|
|
12
13
|
|
|
13
14
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
14
|
-
import { getAdminBylineClient } from '../../integrations/byline-client.js'
|
|
15
15
|
import { type ActorLabelMap, resolveActorLabels } from './actors.js'
|
|
16
16
|
import { serialise } from './utils'
|
|
17
17
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminBylineClient } from '@byline/client/server'
|
|
11
12
|
import {
|
|
12
13
|
buildRelationSummaryPopulateMap,
|
|
13
14
|
ERR_NOT_FOUND,
|
|
@@ -21,7 +22,6 @@ import {
|
|
|
21
22
|
} from '@byline/core'
|
|
22
23
|
|
|
23
24
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
24
|
-
import { getAdminBylineClient } from '../../integrations/byline-client.js'
|
|
25
25
|
import { serialise } from './utils'
|
|
26
26
|
|
|
27
27
|
// ---------------------------------------------------------------------------
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
import { createServerFn } from '@tanstack/react-start'
|
|
23
23
|
|
|
24
24
|
import type { ReindexResult } from '@byline/client'
|
|
25
|
+
import { getAdminBylineClient } from '@byline/client/server'
|
|
25
26
|
import { ERR_NOT_FOUND, getLogger } from '@byline/core'
|
|
26
27
|
|
|
27
28
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
28
|
-
import { getAdminBylineClient } from '../../integrations/byline-client.js'
|
|
29
29
|
|
|
30
30
|
export type { ReindexResult }
|
|
31
31
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
11
12
|
import {
|
|
12
13
|
assertActorCanPerform,
|
|
13
14
|
ERR_NOT_FOUND,
|
|
@@ -18,7 +19,6 @@ import {
|
|
|
18
19
|
getServerConfig,
|
|
19
20
|
} from '@byline/core'
|
|
20
21
|
|
|
21
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
22
22
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
23
23
|
|
|
24
24
|
// ---------------------------------------------------------------------------
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
11
12
|
import { ERR_NOT_FOUND, getLogger, getServerConfig } from '@byline/core'
|
|
12
13
|
import type { DocumentLifecycleContext } from '@byline/core/services'
|
|
13
14
|
import { restoreDocumentVersion as restoreDocumentVersionService } from '@byline/core/services'
|
|
14
15
|
|
|
15
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
16
16
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
17
17
|
|
|
18
18
|
// ---------------------------------------------------------------------------
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminBylineClient } from '@byline/client/server'
|
|
12
|
+
|
|
11
13
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
12
|
-
import { getAdminBylineClient } from '../../integrations/byline-client.js'
|
|
13
14
|
|
|
14
15
|
// ---------------------------------------------------------------------------
|
|
15
16
|
// Shared types
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { createServerFn } from '@tanstack/react-start'
|
|
10
10
|
|
|
11
|
+
import { getAdminRequestContext } from '@byline/client/server'
|
|
11
12
|
import { ERR_NOT_FOUND, getLogger, getServerConfig } from '@byline/core'
|
|
12
13
|
import type { DocumentLifecycleContext } from '@byline/core/services'
|
|
13
14
|
import {
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
unpublishDocument as unpublishDocumentService,
|
|
16
17
|
} from '@byline/core/services'
|
|
17
18
|
|
|
18
|
-
import { getAdminRequestContext } from '../../auth/auth-context.js'
|
|
19
19
|
import { ensureCollection } from '../../integrations/api-utils.js'
|
|
20
20
|
|
|
21
21
|
// ---------------------------------------------------------------------------
|