@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
@@ -7,7 +7,7 @@
7
7
  */
8
8
  /**
9
9
  * Pure projection helpers for the drag-to-reorder / re-parent tree list
10
- * (docs/04-collections/03-document-trees.md, phase 2). Adapted from the dnd-kit "sortable tree"
10
+ * (docs/04-collections/04-document-trees.md, phase 2). Adapted from the dnd-kit "sortable tree"
11
11
  * pattern: a pre-order flattened list where the drag's **horizontal** offset
12
12
  * projects a target depth, clamped to what the neighbouring rows allow, and the
13
13
  * target parent + sibling neighbours are resolved from that depth.
@@ -1,7 +1,7 @@
1
1
  import { getRequestHeader } from "@tanstack/react-start/server";
2
2
  import { AuthError, AuthErrorCodes } from "@byline/auth";
3
+ import { getAdminRequestContext } from "@byline/client/server";
3
4
  import { resolveInterfaceLocale } from "@byline/i18n";
4
- import { getAdminRequestContext } from "../auth/auth-context.js";
5
5
  import { bylineCore } from "../integrations/byline-core.js";
6
6
  import { readAdminLocaleCookie } from "./locale-cookie.js";
7
7
  async function resolveRequestLocale(options) {
package/dist/index.d.ts CHANGED
@@ -18,14 +18,13 @@
18
18
  * - `@byline/host-tanstack-start/server-fns/<module>` — TanStack Start
19
19
  * server functions for each admin module (admin-account, admin-roles,
20
20
  * admin-users, admin-permissions, auth, collections).
21
- * - `@byline/host-tanstack-start/auth/auth-context` — request-scoped
22
- * `RequestContext` resolution that reads session cookies, refreshes
23
- * transparently, and surfaces `ERR_UNAUTHENTICATED` to callers.
24
21
  * - `@byline/host-tanstack-start/integrations/*` — host-side adapters
25
22
  * binding TanStack Start primitives to the framework-neutral
26
- * contracts in `@byline/ui` and `@byline/client`
27
- * (`bylineFieldServices`, `bylineAdminServices`, the admin
28
- * `BylineClient` singleton).
23
+ * contracts in `@byline/ui`, `@byline/core`, and `@byline/client`
24
+ * (`bylineFieldServices`, `bylineAdminServices`, and `host-bridge` —
25
+ * the `HostRequestBridge` implementation behind the
26
+ * `@byline/client/server` getters; request-context resolution and the
27
+ * client singletons themselves live in `@byline/client/server`).
29
28
  * - `@byline/host-tanstack-start/admin-shell/{chrome,collections,...}` —
30
29
  * router-coupled admin UI: shared shell chrome (menu drawer, app bar,
31
30
  * route-error, breadcrumbs, etc.) plus per-area page containers.
@@ -0,0 +1,13 @@
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
+ * Register the TanStack Start bridge. Safe to call any number of times;
10
+ * exported for hosts that want registration to be explicit in their
11
+ * server config rather than relying on a side-effect import.
12
+ */
13
+ export declare function registerTanstackStartHostBridge(): void;
@@ -0,0 +1,22 @@
1
+ import { getCookie, getRequest, setCookie } from "@tanstack/react-start/server";
2
+ import { registerHostRequestBridge } from "@byline/core";
3
+ const tanstackStartRequestBridge = {
4
+ getRequest () {
5
+ try {
6
+ return getRequest();
7
+ } catch {
8
+ return;
9
+ }
10
+ },
11
+ getCookie (name) {
12
+ return getCookie(name);
13
+ },
14
+ setCookie (name, value, options) {
15
+ setCookie(name, value, options);
16
+ }
17
+ };
18
+ function registerTanstackStartHostBridge() {
19
+ registerHostRequestBridge(tanstackStartRequestBridge);
20
+ }
21
+ registerTanstackStartHostBridge();
22
+ export { registerTanstackStartHostBridge };
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * Copyright (c) Infonomic Company Limited
7
7
  */
8
+ import './host-bridge.js';
8
9
  export interface UploadsHandlerOptions {
9
10
  /**
10
11
  * URL prefix to match. Trailing slash required. Default `'/uploads/'`.
@@ -1,5 +1,6 @@
1
1
  import { readFile, stat } from "node:fs/promises";
2
2
  import { resolve } from "node:path";
3
+ import "./host-bridge.js";
3
4
  const DEFAULT_MIME = {
4
5
  '.avif': 'image/avif',
5
6
  '.webp': 'image/webp',
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { changeAccountPasswordCommand } from "@byline/admin/admin-account";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const changeAccountPassword = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { getAccountCommand } from "@byline/admin/admin-account";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const getAccount = createServerFn({
6
6
  method: 'GET'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { updateAccountCommand } from "@byline/admin/admin-account";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const updateAccount = createServerFn({
6
6
  method: 'POST'
@@ -1,8 +1,8 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { assertAdminActor } from "@byline/admin";
3
3
  import { ADMIN_ACTIVITY_ABILITIES } from "@byline/admin/admin-activity";
4
+ import { getAdminRequestContext } from "@byline/client/server";
4
5
  import { ERR_AUDIT_UNSUPPORTED, getLogger, getServerConfig } from "@byline/core";
5
- import { getAdminRequestContext } from "../../auth/auth-context.js";
6
6
  import { resolveActorLabels } from "../collections/actors.js";
7
7
  const getSystemActivityLog = createServerFn({
8
8
  method: 'GET'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { getRoleAbilitiesCommand } from "@byline/admin/admin-permissions";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const getRoleAbilities = createServerFn({
6
6
  method: 'GET'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { listRegisteredAbilitiesCommand } from "@byline/admin/admin-permissions";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const listRegisteredAbilities = createServerFn({
6
6
  method: 'GET'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { setRoleAbilitiesCommand } from "@byline/admin/admin-permissions";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const setRoleAbilities = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { whoHasAbilityCommand } from "@byline/admin/admin-permissions";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const whoHasAbility = createServerFn({
6
6
  method: 'GET'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { createAdminRoleCommand } from "@byline/admin/admin-roles";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const createAdminRole = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { deleteAdminRoleCommand } from "@byline/admin/admin-roles";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const deleteAdminRole = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { getAdminRoleCommand } from "@byline/admin/admin-roles";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const getAdminRole = createServerFn({
6
6
  method: 'GET'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { listAdminRolesCommand } from "@byline/admin/admin-roles";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const listAdminRoles = createServerFn({
6
6
  method: 'GET'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { reorderAdminRolesCommand } from "@byline/admin/admin-roles";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const reorderAdminRoles = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { updateAdminRoleCommand } from "@byline/admin/admin-roles";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const updateAdminRole = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { createAdminUserCommand } from "@byline/admin/admin-users";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const createAdminUser = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { deleteAdminUserCommand } from "@byline/admin/admin-users";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const deleteAdminUser = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { disableAdminUserCommand } from "@byline/admin/admin-users";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const disableAdminUser = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { enableAdminUserCommand } from "@byline/admin/admin-users";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const enableAdminUser = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { getRolesForUserCommand } from "@byline/admin/admin-roles";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const getUserRoles = createServerFn({
6
6
  method: 'GET'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { getAdminUserCommand } from "@byline/admin/admin-users";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const getAdminUser = createServerFn({
6
6
  method: 'GET'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { listAdminUsersCommand } from "@byline/admin/admin-users";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const listAdminUsers = createServerFn({
6
6
  method: 'GET'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { setAdminUserPasswordCommand } from "@byline/admin/admin-users";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const setAdminUserPassword = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { setRolesForUserCommand } from "@byline/admin/admin-roles";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const setUserRoles = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { updateAdminUserCommand } from "@byline/admin/admin-users";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const updateAdminUser = createServerFn({
6
6
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { executeInstruction, executeInstructionStreaming } from "@byline/ai/server";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  const executeAiInstruction = createServerFn({
5
5
  method: 'POST'
6
6
  }).validator((input)=>input).handler(async ({ data })=>{
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { AuthError } from "@byline/auth";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
+ import { getAdminRequestContext } from "@byline/client/server";
4
4
  import { bylineCore } from "../../integrations/byline-core.js";
5
5
  const getCurrentAdminUser = createServerFn({
6
6
  method: 'GET'
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { getRequestHeader } from "@tanstack/react-start/server";
3
+ import { setSessionCookies } from "@byline/client/server";
3
4
  import { getServerConfig } from "@byline/core";
4
- import { setSessionCookies } from "../../auth/auth-cookies.js";
5
5
  import { readAdminLocaleCookie } from "../../i18n/locale-cookie.js";
6
6
  import { bylineCore } from "../../integrations/byline-core.js";
7
7
  const adminSignIn = createServerFn({
@@ -1,7 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { clearPreviewCookie, clearSessionCookies, readRefreshTokenCookie } from "@byline/client/server";
2
3
  import { getServerConfig } from "@byline/core";
3
- import { clearSessionCookies, readRefreshTokenCookie } from "../../auth/auth-cookies.js";
4
- import { clearPreviewCookie } from "../../auth/preview-cookies.js";
5
4
  const adminSignOut = createServerFn({
6
5
  method: 'POST'
7
6
  }).handler(async ()=>{
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getLogger } from "@byline/core";
3
4
  import { ensureCollection } from "../../integrations/api-utils.js";
4
- import { getAdminBylineClient } from "../../integrations/byline-client.js";
5
5
  import { resolveActorLabels } from "./actors.js";
6
6
  const getCollectionDocumentAuditLog = createServerFn({
7
7
  method: 'GET'
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminRequestContext } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getLogger, getServerConfig } from "@byline/core";
3
4
  import { copyToLocale } from "@byline/core/services";
4
- import { getAdminRequestContext } from "../../auth/auth-context.js";
5
5
  import { ensureCollection } from "../../integrations/api-utils.js";
6
6
  const copyDocumentToLocale = createServerFn({
7
7
  method: 'POST'
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminRequestContext } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getLogger, getServerConfig } from "@byline/core";
3
4
  import { createDocument } from "@byline/core/services";
4
- import { getAdminRequestContext } from "../../auth/auth-context.js";
5
5
  import { ensureCollection } from "../../integrations/api-utils.js";
6
6
  const createCollectionDocument = createServerFn({
7
7
  method: 'POST'
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminRequestContext } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getLogger, getServerConfig } from "@byline/core";
3
4
  import { deleteLocale } from "@byline/core/services";
4
- import { getAdminRequestContext } from "../../auth/auth-context.js";
5
5
  import { ensureCollection } from "../../integrations/api-utils.js";
6
6
  const deleteDocumentLocale = createServerFn({
7
7
  method: 'POST'
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminRequestContext } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getLogger, getServerConfig, getUploadFields } from "@byline/core";
3
4
  import { deleteDocument } from "@byline/core/services";
4
- import { getAdminRequestContext } from "../../auth/auth-context.js";
5
5
  import { ensureCollection } from "../../integrations/api-utils.js";
6
6
  import { toDeleteDocumentResponse } from "./delete-outcome.js";
7
7
  const delete_deleteDocument = createServerFn({
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminRequestContext } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getLogger, getServerConfig } from "@byline/core";
3
4
  import { duplicateDocument } from "@byline/core/services";
4
- import { getAdminRequestContext } from "../../auth/auth-context.js";
5
5
  import { ensureCollection } from "../../integrations/api-utils.js";
6
6
  const duplicateCollectionDocument = createServerFn({
7
7
  method: 'POST'
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
2
3
  import { BylineError, ERR_NOT_FOUND, ErrorCodes, buildRelationSummaryPopulateMap, getCollectionAdminConfig, getCollectionDefinition, getCollectionSchemasForPath, getLogger, getServerConfig } from "@byline/core";
3
4
  import { ensureCollection } from "../../integrations/api-utils.js";
4
- import { getAdminBylineClient } from "../../integrations/byline-client.js";
5
5
  import { serialise } from "./utils.js";
6
6
  const getDocumentFn = createServerFn({
7
7
  method: 'GET'
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getCollectionSchemasForPath, getLogger } from "@byline/core";
3
4
  import { ensureCollection } from "../../integrations/api-utils.js";
4
- import { getAdminBylineClient } from "../../integrations/byline-client.js";
5
5
  import { resolveActorLabels } from "./actors.js";
6
6
  import { serialise } from "./utils.js";
7
7
  const getCollectionDocumentHistory = createServerFn({
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, buildRelationSummaryPopulateMap, getCollectionAdminConfig, getCollectionDefinition, getCollectionSchemasForPath, getLogger, getServerConfig } from "@byline/core";
3
4
  import { ensureCollection } from "../../integrations/api-utils.js";
4
- import { getAdminBylineClient } from "../../integrations/byline-client.js";
5
5
  import { serialise } from "./utils.js";
6
6
  const getCollectionDocuments = createServerFn({
7
7
  method: 'GET'
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getLogger } from "@byline/core";
3
4
  import { ensureCollection } from "../../integrations/api-utils.js";
4
- import { getAdminBylineClient } from "../../integrations/byline-client.js";
5
5
  const reindexCollection = createServerFn({
6
6
  method: 'POST'
7
7
  }).validator((input)=>input).handler(async ({ data })=>{
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminRequestContext } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, ERR_VALIDATION, assertActorCanPerform, generateKeyBetween, generateNKeysBetween, getLogger, getServerConfig } from "@byline/core";
3
- import { getAdminRequestContext } from "../../auth/auth-context.js";
4
4
  import { ensureCollection } from "../../integrations/api-utils.js";
5
5
  const reorderCollectionDocument = createServerFn({
6
6
  method: 'POST'
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminRequestContext } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getLogger, getServerConfig } from "@byline/core";
3
4
  import { restoreDocumentVersion } from "@byline/core/services";
4
- import { getAdminRequestContext } from "../../auth/auth-context.js";
5
5
  import { ensureCollection } from "../../integrations/api-utils.js";
6
6
  const restore_version_restoreDocumentVersion = createServerFn({
7
7
  method: 'POST'
@@ -1,6 +1,6 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
2
3
  import { ensureCollection } from "../../integrations/api-utils.js";
3
- import { getAdminBylineClient } from "../../integrations/byline-client.js";
4
4
  const getCollectionStatsFn = createServerFn({
5
5
  method: 'GET'
6
6
  }).validator((input)=>input).handler(async ({ data })=>{
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminRequestContext } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getLogger, getServerConfig } from "@byline/core";
3
4
  import { changeDocumentStatus, unpublishDocument } from "@byline/core/services";
4
- import { getAdminRequestContext } from "../../auth/auth-context.js";
5
5
  import { ensureCollection } from "../../integrations/api-utils.js";
6
6
  const updateDocumentStatus = createServerFn({
7
7
  method: 'POST'
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, createReadContext, getLogger } from "@byline/core";
3
4
  import { ensureCollection } from "../../integrations/api-utils.js";
4
- import { getAdminBylineClient } from "../../integrations/byline-client.js";
5
5
  import { placeAdminTreeNode, removeAdminTreeNode } from "./tree-mutation.js";
6
6
  import { getAdminTreeParent, getAdminUnplacedTreeDocuments } from "./tree-read.js";
7
7
  const placeTreeNode = createServerFn({
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminRequestContext } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, getLogger, getServerConfig } from "@byline/core";
3
4
  import { updateDocumentSystemFields, updateDocumentWithPatches } from "@byline/core/services";
4
- import { getAdminRequestContext } from "../../auth/auth-context.js";
5
5
  import { ensureCollection } from "../../integrations/api-utils.js";
6
6
  const updateCollectionDocumentWithPatches = createServerFn({
7
7
  method: 'POST'
@@ -1,9 +1,9 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminRequestContext } from "@byline/client/server";
2
3
  import { ERR_NOT_FOUND, ERR_VALIDATION, getServerConfig, getUploadFields } from "@byline/core";
3
4
  import { extractImageMeta, generateImageVariants, isBypassMimeType } from "@byline/core/image";
4
5
  import { getLogger, withLogContext } from "@byline/core/logger";
5
6
  import { uploadField } from "@byline/core/services";
6
- import { getAdminRequestContext } from "../../auth/auth-context.js";
7
7
  import { ensureCollection } from "../../integrations/api-utils.js";
8
8
  function parseUploadFormData(data) {
9
9
  if (!(data instanceof FormData)) throw new Error('Expected FormData upload payload.');
@@ -96,6 +96,7 @@ const uploadCollectionField = createServerFn({
96
96
  logger,
97
97
  defaultLocale: serverConfig.i18n.content.defaultLocale,
98
98
  slugifier: serverConfig.slugifier,
99
+ filenameSlugifier: serverConfig.uploads?.filenameSlugifier,
99
100
  requestContext: await getAdminRequestContext(),
100
101
  imageProcessor: {
101
102
  extractMeta: extractImageMeta,
@@ -1,7 +1,7 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
2
  import { setPreferredLocaleCommand } from "@byline/admin/admin-account";
3
3
  import { AuthError, AuthErrorCodes } from "@byline/auth";
4
- import { getAdminRequestContext } from "../../auth/auth-context.js";
4
+ import { getAdminRequestContext } from "@byline/client/server";
5
5
  import { clearAdminLocaleCookie, setAdminLocaleCookie } from "../../i18n/locale-cookie.js";
6
6
  import { bylineCore } from "../../integrations/byline-core.js";
7
7
  const setInterfaceLocaleFn = createServerFn({
@@ -1,5 +1,5 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
- import { clearPreviewCookie } from "../../auth/preview-cookies.js";
2
+ import { clearPreviewCookie } from "@byline/client/server";
3
3
  const disablePreviewModeFn = createServerFn({
4
4
  method: 'POST'
5
5
  }).handler(async ()=>{
@@ -1,6 +1,5 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
- import { getAdminRequestContext } from "../../auth/auth-context.js";
3
- import { setPreviewCookie } from "../../auth/preview-cookies.js";
2
+ import { getAdminRequestContext, setPreviewCookie } from "@byline/client/server";
4
3
  const enablePreviewModeFn = createServerFn({
5
4
  method: 'POST'
6
5
  }).handler(async ()=>{
@@ -1,5 +1,5 @@
1
1
  import { createServerFn } from "@tanstack/react-start";
2
- import { readPreviewCookie } from "../../auth/preview-cookies.js";
2
+ import { readPreviewCookie } from "@byline/client/server";
3
3
  const getPreviewStateFn = createServerFn({
4
4
  method: 'GET'
5
5
  }).handler(async ()=>({