@byline/host-tanstack-start 4.0.0 → 4.2.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.
Files changed (136) hide show
  1. package/dist/admin-shell/collections/tree-list-projection.d.ts +1 -1
  2. package/dist/i18n/resolve-locale.js +1 -1
  3. package/dist/index.d.ts +5 -6
  4. package/dist/integrations/host-bridge.d.ts +13 -0
  5. package/dist/integrations/host-bridge.js +22 -0
  6. package/dist/integrations/serve-uploads.d.ts +1 -0
  7. package/dist/integrations/serve-uploads.js +1 -0
  8. package/dist/server-fns/admin-account/change-password.js +1 -1
  9. package/dist/server-fns/admin-account/get.js +1 -1
  10. package/dist/server-fns/admin-account/update.js +1 -1
  11. package/dist/server-fns/admin-activity/get.js +1 -1
  12. package/dist/server-fns/admin-permissions/get-role-abilities.js +1 -1
  13. package/dist/server-fns/admin-permissions/list-registered.js +1 -1
  14. package/dist/server-fns/admin-permissions/set-role-abilities.js +1 -1
  15. package/dist/server-fns/admin-permissions/who-has.js +1 -1
  16. package/dist/server-fns/admin-roles/create.js +1 -1
  17. package/dist/server-fns/admin-roles/delete.js +1 -1
  18. package/dist/server-fns/admin-roles/get.js +1 -1
  19. package/dist/server-fns/admin-roles/list.js +1 -1
  20. package/dist/server-fns/admin-roles/reorder.js +1 -1
  21. package/dist/server-fns/admin-roles/update.js +1 -1
  22. package/dist/server-fns/admin-users/create.js +1 -1
  23. package/dist/server-fns/admin-users/delete.js +1 -1
  24. package/dist/server-fns/admin-users/disable.js +1 -1
  25. package/dist/server-fns/admin-users/enable.js +1 -1
  26. package/dist/server-fns/admin-users/get-user-roles.js +1 -1
  27. package/dist/server-fns/admin-users/get.js +1 -1
  28. package/dist/server-fns/admin-users/list.js +1 -1
  29. package/dist/server-fns/admin-users/set-password.js +1 -1
  30. package/dist/server-fns/admin-users/set-user-roles.js +1 -1
  31. package/dist/server-fns/admin-users/update.js +1 -1
  32. package/dist/server-fns/ai/execute.js +1 -1
  33. package/dist/server-fns/auth/current-user.js +1 -1
  34. package/dist/server-fns/auth/sign-in.js +1 -1
  35. package/dist/server-fns/auth/sign-out.js +1 -2
  36. package/dist/server-fns/collections/audit.js +1 -1
  37. package/dist/server-fns/collections/copy-to-locale.js +1 -1
  38. package/dist/server-fns/collections/create.js +1 -1
  39. package/dist/server-fns/collections/delete-locale.js +1 -1
  40. package/dist/server-fns/collections/delete.js +1 -1
  41. package/dist/server-fns/collections/duplicate.js +1 -1
  42. package/dist/server-fns/collections/get.js +1 -1
  43. package/dist/server-fns/collections/history.js +1 -1
  44. package/dist/server-fns/collections/list.js +1 -1
  45. package/dist/server-fns/collections/reindex.js +1 -1
  46. package/dist/server-fns/collections/reorder.js +1 -1
  47. package/dist/server-fns/collections/restore-version.js +1 -1
  48. package/dist/server-fns/collections/stats.js +1 -1
  49. package/dist/server-fns/collections/status.js +1 -1
  50. package/dist/server-fns/collections/tree.js +1 -1
  51. package/dist/server-fns/collections/update.js +1 -1
  52. package/dist/server-fns/collections/upload.js +2 -1
  53. package/dist/server-fns/i18n/set-locale.js +1 -1
  54. package/dist/server-fns/preview/disable.js +1 -1
  55. package/dist/server-fns/preview/enable.js +1 -2
  56. package/dist/server-fns/preview/state.js +1 -1
  57. package/package.json +8 -13
  58. package/src/admin-shell/collections/tree-list-projection.ts +1 -1
  59. package/src/i18n/resolve-locale.ts +1 -1
  60. package/src/index.ts +5 -6
  61. package/src/integrations/host-bridge.ts +56 -0
  62. package/src/integrations/serve-uploads.ts +6 -0
  63. package/src/server-fns/admin-account/change-password.ts +1 -1
  64. package/src/server-fns/admin-account/get.ts +1 -1
  65. package/src/server-fns/admin-account/update.ts +1 -1
  66. package/src/server-fns/admin-activity/get.ts +1 -1
  67. package/src/server-fns/admin-permissions/get-role-abilities.ts +1 -1
  68. package/src/server-fns/admin-permissions/list-registered.ts +1 -1
  69. package/src/server-fns/admin-permissions/set-role-abilities.ts +1 -1
  70. package/src/server-fns/admin-permissions/who-has.ts +1 -1
  71. package/src/server-fns/admin-roles/create.ts +1 -1
  72. package/src/server-fns/admin-roles/delete.ts +1 -1
  73. package/src/server-fns/admin-roles/get.ts +1 -1
  74. package/src/server-fns/admin-roles/list.ts +1 -1
  75. package/src/server-fns/admin-roles/reorder.ts +1 -1
  76. package/src/server-fns/admin-roles/update.ts +1 -1
  77. package/src/server-fns/admin-users/create.ts +1 -1
  78. package/src/server-fns/admin-users/delete.ts +1 -1
  79. package/src/server-fns/admin-users/disable.ts +1 -1
  80. package/src/server-fns/admin-users/enable.ts +1 -1
  81. package/src/server-fns/admin-users/get-user-roles.ts +1 -1
  82. package/src/server-fns/admin-users/get.ts +1 -1
  83. package/src/server-fns/admin-users/list.ts +1 -1
  84. package/src/server-fns/admin-users/set-password.ts +1 -1
  85. package/src/server-fns/admin-users/set-user-roles.ts +1 -1
  86. package/src/server-fns/admin-users/update.ts +1 -1
  87. package/src/server-fns/ai/execute.ts +1 -2
  88. package/src/server-fns/auth/current-user.ts +1 -1
  89. package/src/server-fns/auth/sign-in.ts +1 -1
  90. package/src/server-fns/auth/sign-out.ts +5 -3
  91. package/src/server-fns/collections/audit.ts +1 -1
  92. package/src/server-fns/collections/copy-to-locale.ts +1 -1
  93. package/src/server-fns/collections/create.ts +1 -1
  94. package/src/server-fns/collections/delete-locale.ts +1 -1
  95. package/src/server-fns/collections/delete.ts +1 -1
  96. package/src/server-fns/collections/duplicate.ts +1 -1
  97. package/src/server-fns/collections/get.ts +1 -1
  98. package/src/server-fns/collections/history.ts +1 -1
  99. package/src/server-fns/collections/list.ts +1 -1
  100. package/src/server-fns/collections/reindex.ts +1 -1
  101. package/src/server-fns/collections/reorder.ts +1 -1
  102. package/src/server-fns/collections/restore-version.ts +1 -1
  103. package/src/server-fns/collections/stats.ts +2 -1
  104. package/src/server-fns/collections/status.ts +1 -1
  105. package/src/server-fns/collections/tree.ts +2 -2
  106. package/src/server-fns/collections/update.ts +1 -1
  107. package/src/server-fns/collections/upload.ts +2 -1
  108. package/src/server-fns/i18n/set-locale.ts +1 -1
  109. package/src/server-fns/preview/disable.ts +1 -1
  110. package/src/server-fns/preview/enable.ts +1 -2
  111. package/src/server-fns/preview/state.ts +1 -1
  112. package/dist/auth/auth-context.d.ts +0 -50
  113. package/dist/auth/auth-context.js +0 -61
  114. package/dist/auth/auth-cookies.d.ts +0 -34
  115. package/dist/auth/auth-cookies.js +0 -46
  116. package/dist/auth/preview-cookies.d.ts +0 -19
  117. package/dist/auth/preview-cookies.js +0 -26
  118. package/dist/auth/request-scope.d.ts +0 -16
  119. package/dist/auth/request-scope.js +0 -24
  120. package/dist/integrations/byline-client.d.ts +0 -24
  121. package/dist/integrations/byline-client.js +0 -25
  122. package/dist/integrations/byline-public-client.d.ts +0 -47
  123. package/dist/integrations/byline-public-client.js +0 -19
  124. package/dist/integrations/byline-viewer-client.d.ts +0 -26
  125. package/dist/integrations/byline-viewer-client.js +0 -44
  126. package/src/auth/auth-context.test.node.ts +0 -302
  127. package/src/auth/auth-context.ts +0 -142
  128. package/src/auth/auth-cookies.ts +0 -113
  129. package/src/auth/preview-cookies.ts +0 -73
  130. package/src/auth/request-scope.test.node.ts +0 -93
  131. package/src/auth/request-scope.ts +0 -62
  132. package/src/integrations/byline-client.ts +0 -68
  133. package/src/integrations/byline-public-client.ts +0 -67
  134. package/src/integrations/byline-viewer-client.ts +0 -111
  135. package/src/integrations/request-context-contract.test.node.ts +0 -131
  136. package/src/integrations/request-context-factories.test.node.ts +0 -140
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "license": "MPL-2.0",
6
- "version": "4.0.0",
6
+ "version": "4.2.0",
7
7
  "engines": {
8
8
  "node": ">=20.9.0"
9
9
  },
@@ -89,10 +89,6 @@
89
89
  "types": "./dist/server-fns/*.d.ts",
90
90
  "import": "./dist/server-fns/*.js"
91
91
  },
92
- "./auth/*": {
93
- "types": "./dist/auth/*.d.ts",
94
- "import": "./dist/auth/*.js"
95
- },
96
92
  "./integrations/*": {
97
93
  "types": "./dist/integrations/*.d.ts",
98
94
  "import": "./dist/integrations/*.js"
@@ -121,15 +117,14 @@
121
117
  "npm-run-all": "^4.1.5",
122
118
  "react-json-view-lite": "^2.5.0",
123
119
  "react-swipeable": "^7.0.2",
124
- "uuid": "^14.0.1",
125
120
  "zod": "^4.4.3",
126
- "@byline/admin": "4.0.0",
127
- "@byline/auth": "4.0.0",
128
- "@byline/ui": "4.0.0",
129
- "@byline/i18n": "4.0.0",
130
- "@byline/ai": "4.0.0",
131
- "@byline/client": "4.0.0",
132
- "@byline/core": "4.0.0"
121
+ "@byline/auth": "4.2.0",
122
+ "@byline/admin": "4.2.0",
123
+ "@byline/client": "4.2.0",
124
+ "@byline/ai": "4.2.0",
125
+ "@byline/i18n": "4.2.0",
126
+ "@byline/core": "4.2.0",
127
+ "@byline/ui": "4.2.0"
133
128
  },
134
129
  "peerDependencies": {
135
130
  "@tanstack/react-router": "^1.167.0",
@@ -8,7 +8,7 @@
8
8
 
9
9
  /**
10
10
  * Pure projection helpers for the drag-to-reorder / re-parent tree list
11
- * (docs/04-collections/03-document-trees.md, phase 2). Adapted from the dnd-kit "sortable tree"
11
+ * (docs/04-collections/04-document-trees.md, phase 2). Adapted from the dnd-kit "sortable tree"
12
12
  * pattern: a pre-order flattened list where the drag's **horizontal** offset
13
13
  * projects a target depth, clamped to what the neighbouring rows allow, and the
14
14
  * target parent + sibling neighbours are resolved from that depth.
@@ -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` and `@byline/client`
28
- * (`bylineFieldServices`, `bylineAdminServices`, the admin
29
- * `BylineClient` singleton).
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