@byline/host-tanstack-start 3.21.0 → 4.0.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 (134) hide show
  1. package/dist/admin-shell/admin-activity/list.js +15 -5
  2. package/dist/admin-shell/admin-roles/delete.js +2 -1
  3. package/dist/admin-shell/admin-roles/list.js +2 -1
  4. package/dist/admin-shell/admin-users/delete.js +2 -1
  5. package/dist/admin-shell/admin-users/list.js +4 -7
  6. package/dist/admin-shell/chrome/admin-app-bar.js +2 -1
  7. package/dist/admin-shell/chrome/admin-menu-drawer.js +9 -8
  8. package/dist/admin-shell/chrome/admin-menu-provider.js +2 -1
  9. package/dist/admin-shell/chrome/dashboard.js +4 -3
  10. package/dist/admin-shell/chrome/sign-in-page.d.ts +2 -2
  11. package/dist/admin-shell/chrome/sign-in-page.js +2 -2
  12. package/dist/admin-shell/collections/create.js +4 -3
  13. package/dist/admin-shell/collections/document-history.js +6 -1
  14. package/dist/admin-shell/collections/edit.js +18 -14
  15. package/dist/admin-shell/collections/history.js +5 -4
  16. package/dist/admin-shell/collections/list.js +8 -7
  17. package/dist/admin-shell/collections/restore-version-modal.js +2 -1
  18. package/dist/admin-shell/collections/tree-list.js +53 -17
  19. package/dist/admin-shell/collections/view-menu.js +9 -8
  20. package/dist/auth/auth-context.d.ts +13 -0
  21. package/dist/auth/auth-context.js +4 -0
  22. package/dist/auth/request-scope.d.ts +16 -0
  23. package/dist/auth/request-scope.js +24 -0
  24. package/dist/integrations/abilities.js +8 -7
  25. package/dist/integrations/byline-public-client.d.ts +38 -0
  26. package/dist/integrations/byline-public-client.js +8 -4
  27. package/dist/integrations/byline-viewer-client.d.ts +6 -0
  28. package/dist/integrations/byline-viewer-client.js +22 -17
  29. package/dist/integrations/start-errors.js +2 -1
  30. package/dist/routes/admin-path.d.ts +22 -0
  31. package/dist/routes/admin-path.js +35 -0
  32. package/dist/routes/create-admin-account-route.js +3 -2
  33. package/dist/routes/create-admin-activity-route.js +3 -2
  34. package/dist/routes/create-admin-dashboard-route.js +2 -1
  35. package/dist/routes/create-admin-layout-route.d.ts +1 -1
  36. package/dist/routes/create-admin-layout-route.js +3 -1
  37. package/dist/routes/create-admin-permissions-route.js +3 -2
  38. package/dist/routes/create-admin-role-edit-route.js +4 -3
  39. package/dist/routes/create-admin-roles-list-route.js +3 -2
  40. package/dist/routes/create-admin-user-edit-route.js +4 -3
  41. package/dist/routes/create-admin-users-list-route.js +3 -2
  42. package/dist/routes/create-collection-api-route.js +5 -4
  43. package/dist/routes/create-collection-create-route.js +4 -3
  44. package/dist/routes/create-collection-edit-route.js +4 -3
  45. package/dist/routes/create-collection-history-route.js +5 -4
  46. package/dist/routes/create-collection-list-route.js +3 -2
  47. package/dist/routes/create-sign-in-route.js +3 -2
  48. package/dist/routes/index.d.ts +3 -0
  49. package/dist/routes/index.js +2 -0
  50. package/dist/routes/sign-in-path.d.ts +13 -0
  51. package/dist/routes/sign-in-path.js +19 -0
  52. package/dist/server-fns/collections/delete-outcome.d.ts +30 -0
  53. package/dist/server-fns/collections/delete-outcome.js +34 -0
  54. package/dist/server-fns/collections/delete.d.ts +1 -4
  55. package/dist/server-fns/collections/delete.js +2 -4
  56. package/dist/server-fns/collections/index.d.ts +1 -0
  57. package/dist/server-fns/collections/index.js +1 -0
  58. package/dist/server-fns/collections/tree-mutation.d.ts +46 -0
  59. package/dist/server-fns/collections/tree-mutation.js +109 -0
  60. package/dist/server-fns/collections/tree-read.d.ts +6 -0
  61. package/dist/server-fns/collections/tree-read.js +15 -0
  62. package/dist/server-fns/collections/tree.d.ts +5 -4
  63. package/dist/server-fns/collections/tree.js +15 -12
  64. package/dist/server-fns/collections/update.js +2 -1
  65. package/dist/vite/client-hook-boundary.d.ts +19 -0
  66. package/dist/vite/client-hook-boundary.js +20 -0
  67. package/dist/vite/index.d.ts +8 -0
  68. package/dist/vite/index.js +1 -0
  69. package/package.json +15 -9
  70. package/src/admin-shell/admin-activity/list.tsx +13 -3
  71. package/src/admin-shell/admin-roles/delete.tsx +2 -1
  72. package/src/admin-shell/admin-roles/list.tsx +2 -1
  73. package/src/admin-shell/admin-users/delete.tsx +3 -2
  74. package/src/admin-shell/admin-users/list.tsx +9 -8
  75. package/src/admin-shell/chrome/admin-app-bar.tsx +2 -1
  76. package/src/admin-shell/chrome/admin-menu-drawer.tsx +13 -8
  77. package/src/admin-shell/chrome/admin-menu-provider.tsx +2 -1
  78. package/src/admin-shell/chrome/dashboard.tsx +4 -3
  79. package/src/admin-shell/chrome/sign-in-page.tsx +3 -3
  80. package/src/admin-shell/collections/create.tsx +4 -3
  81. package/src/admin-shell/collections/document-history.tsx +5 -0
  82. package/src/admin-shell/collections/edit.tsx +20 -13
  83. package/src/admin-shell/collections/history.tsx +6 -5
  84. package/src/admin-shell/collections/list.tsx +8 -7
  85. package/src/admin-shell/collections/restore-version-modal.tsx +2 -1
  86. package/src/admin-shell/collections/tree-list.tsx +78 -22
  87. package/src/admin-shell/collections/view-menu.tsx +9 -8
  88. package/src/auth/auth-context.test.node.ts +87 -0
  89. package/src/auth/auth-context.ts +18 -0
  90. package/src/auth/request-scope.test.node.ts +93 -0
  91. package/src/auth/request-scope.ts +62 -0
  92. package/src/integrations/abilities.tsx +14 -4
  93. package/src/integrations/byline-client.ts +6 -4
  94. package/src/integrations/byline-public-client.ts +18 -4
  95. package/src/integrations/byline-viewer-client.ts +30 -18
  96. package/src/integrations/request-context-contract.test.node.ts +131 -0
  97. package/src/integrations/request-context-factories.test.node.ts +140 -0
  98. package/src/integrations/start-errors.test.node.ts +22 -0
  99. package/src/integrations/start-errors.ts +1 -0
  100. package/src/routes/admin-path.test.node.ts +129 -0
  101. package/src/routes/admin-path.ts +66 -0
  102. package/src/routes/auth-routes.test.node.ts +39 -0
  103. package/src/routes/create-admin-account-route.tsx +3 -2
  104. package/src/routes/create-admin-activity-route.tsx +3 -2
  105. package/src/routes/create-admin-dashboard-route.tsx +2 -1
  106. package/src/routes/create-admin-layout-route.tsx +4 -4
  107. package/src/routes/create-admin-permissions-route.tsx +3 -2
  108. package/src/routes/create-admin-role-edit-route.tsx +7 -3
  109. package/src/routes/create-admin-roles-list-route.tsx +3 -2
  110. package/src/routes/create-admin-user-edit-route.tsx +7 -3
  111. package/src/routes/create-admin-users-list-route.tsx +3 -2
  112. package/src/routes/create-collection-api-route.tsx +8 -4
  113. package/src/routes/create-collection-create-route.tsx +7 -3
  114. package/src/routes/create-collection-edit-route.tsx +7 -3
  115. package/src/routes/create-collection-history-route.tsx +8 -4
  116. package/src/routes/create-collection-list-route.tsx +3 -2
  117. package/src/routes/create-sign-in-route.tsx +9 -3
  118. package/src/routes/index.ts +11 -0
  119. package/src/routes/sign-in-path.test.node.ts +79 -0
  120. package/src/routes/sign-in-path.ts +36 -0
  121. package/src/server-fns/collections/delete-outcome.test.node.ts +72 -0
  122. package/src/server-fns/collections/delete-outcome.ts +80 -0
  123. package/src/server-fns/collections/delete.ts +2 -1
  124. package/src/server-fns/collections/get.ts +2 -0
  125. package/src/server-fns/collections/index.ts +1 -0
  126. package/src/server-fns/collections/tree-mutation.test.node.ts +225 -0
  127. package/src/server-fns/collections/tree-mutation.ts +165 -0
  128. package/src/server-fns/collections/tree-read.test.node.ts +46 -0
  129. package/src/server-fns/collections/tree-read.ts +26 -0
  130. package/src/server-fns/collections/tree.ts +26 -10
  131. package/src/server-fns/collections/update.ts +3 -0
  132. package/src/vite/client-hook-boundary.test.node.ts +50 -0
  133. package/src/vite/client-hook-boundary.ts +45 -0
  134. package/src/vite/index.ts +9 -0
@@ -5,6 +5,7 @@ import { useTranslation } from "@byline/i18n/react";
5
5
  import { Container, Section } from "@byline/ui/react";
6
6
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
7
7
  import { getAccount } from "../server-fns/admin-account/index.js";
8
+ import { getAdminRoutePath } from "./admin-path.js";
8
9
  function displayNameFor(account) {
9
10
  const parts = [
10
11
  account.given_name,
@@ -31,11 +32,11 @@ function createAdminAccountRoute(path) {
31
32
  breadcrumbs: [
32
33
  {
33
34
  label: t('chrome.menu.dashboard'),
34
- href: '/admin'
35
+ href: getAdminRoutePath()
35
36
  },
36
37
  {
37
38
  label: t('chrome.account'),
38
- href: '/admin/account'
39
+ href: getAdminRoutePath('account')
39
40
  }
40
41
  ]
41
42
  }),
@@ -5,6 +5,7 @@ import { z } from "zod";
5
5
  import { ActivitySystemView } from "../admin-shell/admin-activity/list.js";
6
6
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
7
7
  import { getSystemActivityLog } from "../server-fns/admin-activity/index.js";
8
+ import { getAdminRoutePath } from "./admin-path.js";
8
9
  const searchSchema = z.object({
9
10
  page: z.coerce.number().int().min(1).optional(),
10
11
  page_size: z.coerce.number().int().min(1).max(100).optional(),
@@ -51,11 +52,11 @@ function createAdminActivityRoute(path) {
51
52
  breadcrumbs: [
52
53
  {
53
54
  label: t('chrome.menu.dashboard'),
54
- href: '/admin'
55
+ href: getAdminRoutePath()
55
56
  },
56
57
  {
57
58
  label: t('activity.title'),
58
- href: '/admin/activity'
59
+ href: getAdminRoutePath('activity')
59
60
  }
60
61
  ]
61
62
  }),
@@ -5,6 +5,7 @@ import { useTranslation } from "@byline/i18n/react";
5
5
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
6
6
  import { AdminDashboard } from "../admin-shell/chrome/dashboard.js";
7
7
  import { getCollectionStats } from "../server-fns/collections/index.js";
8
+ import { getAdminRoutePath } from "./admin-path.js";
8
9
  function createAdminDashboardRoute(path) {
9
10
  const Route = createFileRoute(path)({
10
11
  loader: async ()=>{
@@ -30,7 +31,7 @@ function createAdminDashboardRoute(path) {
30
31
  breadcrumbs: [
31
32
  {
32
33
  label: t('chrome.menu.dashboard'),
33
- href: '/admin'
34
+ href: getAdminRoutePath()
34
35
  }
35
36
  ]
36
37
  }),
@@ -6,7 +6,7 @@
6
6
  * Copyright (c) Infonomic Company Limited
7
7
  */
8
8
  interface AdminLayoutOpts {
9
- /** Path users are redirected to when unauthenticated. Defaults to `/sign-in`. */
9
+ /** @deprecated Configure `routes.signIn`; an override must resolve to the same path. */
10
10
  signInPath?: string;
11
11
  }
12
12
  export declare function createAdminLayoutRoute(path: string, opts?: AdminLayoutOpts): any;
@@ -20,10 +20,12 @@ import { BylineAiAdminProvider } from "../integrations/byline-ai.js";
20
20
  import { bylineFieldServices } from "../integrations/byline-field-services.js";
21
21
  import { getCurrentAdminUser } from "../server-fns/auth/index.js";
22
22
  import { getActiveLocaleFn, setInterfaceLocaleFn } from "../server-fns/i18n/index.js";
23
+ import { createSignInRoutePathResolver } from "./sign-in-path.js";
23
24
  function createAdminLayoutRoute(path, opts = {}) {
24
- const signInPath = opts.signInPath ?? '/sign-in';
25
+ const resolveSignInPath = createSignInRoutePathResolver(opts.signInPath);
25
26
  const Route = createFileRoute(path)({
26
27
  beforeLoad: async ({ location })=>{
28
+ const signInPath = resolveSignInPath();
27
29
  try {
28
30
  const user = await getCurrentAdminUser();
29
31
  const activeLocale = await getActiveLocaleFn();
@@ -4,6 +4,7 @@ import { AbilitiesInspector } from "@byline/admin/admin-permissions/components/i
4
4
  import { useTranslation } from "@byline/i18n/react";
5
5
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
6
6
  import { listRegisteredAbilities } from "../server-fns/admin-permissions/index.js";
7
+ import { getAdminRoutePath } from "./admin-path.js";
7
8
  function createAdminPermissionsRoute(path) {
8
9
  const Route = createFileRoute(path)({
9
10
  loader: async ()=>{
@@ -21,11 +22,11 @@ function createAdminPermissionsRoute(path) {
21
22
  breadcrumbs: [
22
23
  {
23
24
  label: t('chrome.menu.dashboard'),
24
- href: '/admin'
25
+ href: getAdminRoutePath()
25
26
  },
26
27
  {
27
28
  label: t('chrome.menu.permissions'),
28
- href: '/admin/permissions'
29
+ href: getAdminRoutePath('permissions')
29
30
  }
30
31
  ]
31
32
  }),
@@ -6,6 +6,7 @@ import { RoleContainer } from "../admin-shell/admin-roles/container.js";
6
6
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
7
7
  import { getRoleAbilities, listRegisteredAbilities } from "../server-fns/admin-permissions/index.js";
8
8
  import { getAdminRole } from "../server-fns/admin-roles/index.js";
9
+ import { getAdminRoutePath } from "./admin-path.js";
9
10
  function createAdminRoleEditRoute(path) {
10
11
  const Route = createFileRoute(path)({
11
12
  loader: async ({ params })=>{
@@ -42,15 +43,15 @@ function createAdminRoleEditRoute(path) {
42
43
  breadcrumbs: [
43
44
  {
44
45
  label: t('chrome.menu.dashboard'),
45
- href: '/admin'
46
+ href: getAdminRoutePath()
46
47
  },
47
48
  {
48
49
  label: t('chrome.menu.adminRoles'),
49
- href: '/admin/roles'
50
+ href: getAdminRoutePath('roles')
50
51
  },
51
52
  {
52
53
  label: t('adminRoles.breadcrumbDetail'),
53
- href: `/admin/roles/${role.id}`
54
+ href: getAdminRoutePath('roles', role.id)
54
55
  }
55
56
  ]
56
57
  }),
@@ -4,6 +4,7 @@ import { useTranslation } from "@byline/i18n/react";
4
4
  import { AdminRolesListView } from "../admin-shell/admin-roles/list.js";
5
5
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
6
6
  import { listAdminRoles } from "../server-fns/admin-roles/index.js";
7
+ import { getAdminRoutePath } from "./admin-path.js";
7
8
  function createAdminRolesListRoute(path) {
8
9
  const Route = createFileRoute(path)({
9
10
  loader: async ()=>{
@@ -21,11 +22,11 @@ function createAdminRolesListRoute(path) {
21
22
  breadcrumbs: [
22
23
  {
23
24
  label: t('chrome.menu.dashboard'),
24
- href: '/admin'
25
+ href: getAdminRoutePath()
25
26
  },
26
27
  {
27
28
  label: t('chrome.menu.adminRoles'),
28
- href: '/admin/roles'
29
+ href: getAdminRoutePath('roles')
29
30
  }
30
31
  ]
31
32
  }),
@@ -6,6 +6,7 @@ import { AccountContainer } from "../admin-shell/admin-users/container.js";
6
6
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
7
7
  import { listAdminRoles } from "../server-fns/admin-roles/index.js";
8
8
  import { getAdminUser, getUserRoles } from "../server-fns/admin-users/index.js";
9
+ import { getAdminRoutePath } from "./admin-path.js";
9
10
  function displayNameFor(user) {
10
11
  const parts = [
11
12
  user.given_name,
@@ -49,15 +50,15 @@ function createAdminUserEditRoute(path) {
49
50
  breadcrumbs: [
50
51
  {
51
52
  label: t('chrome.menu.dashboard'),
52
- href: '/admin'
53
+ href: getAdminRoutePath()
53
54
  },
54
55
  {
55
56
  label: t('chrome.menu.adminUsers'),
56
- href: '/admin/users'
57
+ href: getAdminRoutePath('users')
57
58
  },
58
59
  {
59
60
  label: t('adminUsers.breadcrumbDetail'),
60
- href: `/admin/users/${user.id}`
61
+ href: getAdminRoutePath('users', user.id)
61
62
  }
62
63
  ]
63
64
  }),
@@ -5,6 +5,7 @@ import { z } from "zod";
5
5
  import { AdminUsersListView } from "../admin-shell/admin-users/list.js";
6
6
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
7
7
  import { listAdminUsers } from "../server-fns/admin-users/index.js";
8
+ import { getAdminRoutePath } from "./admin-path.js";
8
9
  const orderSchema = z["enum"]([
9
10
  'given_name',
10
11
  'family_name',
@@ -53,11 +54,11 @@ function createAdminUsersListRoute(path) {
53
54
  breadcrumbs: [
54
55
  {
55
56
  label: t('chrome.menu.dashboard'),
56
- href: '/admin'
57
+ href: getAdminRoutePath()
57
58
  },
58
59
  {
59
60
  label: t('chrome.menu.adminUsers'),
60
- href: '/admin/users'
61
+ href: getAdminRoutePath('users')
61
62
  }
62
63
  ]
63
64
  }),
@@ -6,6 +6,7 @@ import { z } from "zod";
6
6
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
7
7
  import { ApiView } from "../admin-shell/collections/api.js";
8
8
  import { getCollectionDocument } from "../server-fns/collections/index.js";
9
+ import { getAdminRoutePath } from "./admin-path.js";
9
10
  import { getContentLocaleRouteConfig } from "./get-content-locale-route-config.js";
10
11
  const searchSchema = z.object({
11
12
  locale: z.string().optional(),
@@ -43,19 +44,19 @@ function createCollectionApiRoute(path) {
43
44
  breadcrumbs: [
44
45
  {
45
46
  label: t('chrome.menu.dashboard'),
46
- href: "/admin"
47
+ href: getAdminRoutePath()
47
48
  },
48
49
  {
49
50
  label: collectionDef.labels.plural,
50
- href: `/admin/collections/${collection}`
51
+ href: getAdminRoutePath('collections', collection)
51
52
  },
52
53
  {
53
54
  label: t('common.actions.edit'),
54
- href: `/admin/collections/${collection}/${id}`
55
+ href: getAdminRoutePath('collections', collection, id)
55
56
  },
56
57
  {
57
58
  label: t('collections.viewMenu.apiButton'),
58
- href: `/admin/collections/${collection}/${id}/api`
59
+ href: getAdminRoutePath('collections', collection, id, 'api')
59
60
  }
60
61
  ]
61
62
  }),
@@ -4,6 +4,7 @@ import { buildInitialDataFromFields, getCollectionAdminConfig, getCollectionDefi
4
4
  import { useTranslation } from "@byline/i18n/react";
5
5
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
6
6
  import { CreateView } from "../admin-shell/collections/create.js";
7
+ import { getAdminRoutePath } from "./admin-path.js";
7
8
  function createCollectionCreateRoute(path) {
8
9
  const Route = createFileRoute(path)({
9
10
  loader: async ({ params })=>{
@@ -29,15 +30,15 @@ function createCollectionCreateRoute(path) {
29
30
  breadcrumbs: [
30
31
  {
31
32
  label: t('chrome.menu.dashboard'),
32
- href: '/admin'
33
+ href: getAdminRoutePath()
33
34
  },
34
35
  {
35
36
  label: collectionDef.labels.plural,
36
- href: `/admin/collections/${collection}`
37
+ href: getAdminRoutePath('collections', collection)
37
38
  },
38
39
  {
39
40
  label: t('collections.breadcrumbs.create'),
40
- href: `/admin/collections/${collection}/create`
41
+ href: getAdminRoutePath('collections', collection, 'create')
41
42
  }
42
43
  ]
43
44
  }),
@@ -9,6 +9,7 @@ import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs
9
9
  import { useNavigate } from "../admin-shell/chrome/loose-router.js";
10
10
  import { EditView } from "../admin-shell/collections/edit.js";
11
11
  import { getCollectionDocument } from "../server-fns/collections/index.js";
12
+ import { getAdminRoutePath } from "./admin-path.js";
12
13
  import { getContentLocaleRouteConfig } from "./get-content-locale-route-config.js";
13
14
  const searchSchema = z.object({
14
15
  locale: z.string().optional(),
@@ -86,15 +87,15 @@ function createCollectionEditRoute(path) {
86
87
  breadcrumbs: [
87
88
  {
88
89
  label: t('chrome.menu.dashboard'),
89
- href: "/admin"
90
+ href: getAdminRoutePath()
90
91
  },
91
92
  {
92
93
  label: collectionDef.labels.plural,
93
- href: `/admin/collections/${collection}`
94
+ href: getAdminRoutePath('collections', collection)
94
95
  },
95
96
  {
96
97
  label: t('common.actions.edit'),
97
- href: `/admin/collections/${collection}/${id}`
98
+ href: getAdminRoutePath('collections', collection, id)
98
99
  }
99
100
  ]
100
101
  }),
@@ -6,6 +6,7 @@ import { z } from "zod";
6
6
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
7
7
  import { HistoryView } from "../admin-shell/collections/history.js";
8
8
  import { getCollectionDocument, getCollectionDocumentAuditLog, getCollectionDocumentHistory } from "../server-fns/collections/index.js";
9
+ import { getAdminRoutePath } from "./admin-path.js";
9
10
  import { getContentLocaleRouteConfig } from "./get-content-locale-route-config.js";
10
11
  const searchSchema = z.object({
11
12
  page: z.coerce.number().min(1).optional(),
@@ -80,19 +81,19 @@ function createCollectionHistoryRoute(path) {
80
81
  breadcrumbs: [
81
82
  {
82
83
  label: t('chrome.menu.dashboard'),
83
- href: "/admin"
84
+ href: getAdminRoutePath()
84
85
  },
85
86
  {
86
87
  label: collectionDef.labels.plural,
87
- href: `/admin/collections/${collection}`
88
+ href: getAdminRoutePath('collections', collection)
88
89
  },
89
90
  {
90
91
  label: t('common.actions.edit'),
91
- href: `/admin/collections/${collection}/${Route.useParams().id}`
92
+ href: getAdminRoutePath('collections', collection, Route.useParams().id)
92
93
  },
93
94
  {
94
95
  label: t('collections.breadcrumbs.history'),
95
- href: `/admin/collections/${collection}/${Route.useParams().id}/history`
96
+ href: getAdminRoutePath('collections', collection, Route.useParams().id, 'history')
96
97
  }
97
98
  ]
98
99
  }),
@@ -11,6 +11,7 @@ import { useNavigate } from "../admin-shell/chrome/loose-router.js";
11
11
  import { ListView } from "../admin-shell/collections/list.js";
12
12
  import { TreeListView } from "../admin-shell/collections/tree-list.js";
13
13
  import { getCollectionDocuments, getCollectionTree, placeTreeNode, reorderCollectionDocument } from "../server-fns/collections/index.js";
14
+ import { getAdminRoutePath } from "./admin-path.js";
14
15
  const searchSchema = z.object({
15
16
  page: z.coerce.number().min(1).optional(),
16
17
  page_size: z.coerce.number().max(100).optional(),
@@ -118,11 +119,11 @@ function createCollectionListRoute(path) {
118
119
  breadcrumbs: [
119
120
  {
120
121
  label: t('chrome.menu.dashboard'),
121
- href: "/admin"
122
+ href: getAdminRoutePath()
122
123
  },
123
124
  {
124
125
  label: data.included.collection.labels.plural,
125
- href: `/admin/collections/${collection}`
126
+ href: getAdminRoutePath('collections', collection)
126
127
  }
127
128
  ]
128
129
  }),
@@ -2,10 +2,11 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { createFileRoute } from "@tanstack/react-router";
3
3
  import { SignInPage } from "../admin-shell/chrome/sign-in-page.js";
4
4
  import { getActiveLocaleFn } from "../server-fns/i18n/index.js";
5
+ import { resolveAdminCallbackPath, resolveAdminSignInRedirect } from "./admin-path.js";
5
6
  function createSignInRoute(path) {
6
7
  const Route = createFileRoute(path)({
7
8
  validateSearch: (search)=>{
8
- const callbackUrl = 'string' == typeof search.callbackUrl ? search.callbackUrl : void 0;
9
+ const callbackUrl = resolveAdminCallbackPath(search.callbackUrl);
9
10
  return {
10
11
  callbackUrl
11
12
  };
@@ -20,7 +21,7 @@ function createSignInRoute(path) {
20
21
  const { callbackUrl } = Route.useSearch();
21
22
  const { activeLocale } = Route.useRouteContext();
22
23
  return /*#__PURE__*/ jsx(SignInPage, {
23
- callbackUrl: callbackUrl,
24
+ redirectTo: resolveAdminSignInRedirect(callbackUrl),
24
25
  activeLocale: activeLocale
25
26
  });
26
27
  }
@@ -5,6 +5,8 @@
5
5
  *
6
6
  * Copyright (c) Infonomic Company Limited
7
7
  */
8
+ export { getAdminRouteId, getAdminRoutePath, isAdminRoutePathActive, isRoutePathWithin, resolveAdminCallbackPath, resolveAdminSignInRedirect, } from './admin-path.js';
9
+ export { configureSignInRoutePath, getSignInRoutePath } from './sign-in-path.js';
8
10
  /**
9
11
  * Route factories for the Byline admin UI on TanStack Start.
10
12
  *
@@ -13,6 +15,7 @@
13
15
  * `createFileRoute(path)({...})`. The host's route file collapses to:
14
16
  *
15
17
  * import { createCollectionListRoute } from '@byline/host-tanstack-start/routes'
18
+ * // Default admin mount example:
16
19
  * export const Route = createCollectionListRoute('/_byline/admin/collections/$collection/')
17
20
  *
18
21
  * Routes that need host-specific data (i18n bridge component, content
@@ -1,3 +1,5 @@
1
+ export { getAdminRouteId, getAdminRoutePath, isAdminRoutePathActive, isRoutePathWithin, resolveAdminCallbackPath, resolveAdminSignInRedirect } from "./admin-path.js";
2
+ export { configureSignInRoutePath, getSignInRoutePath } from "./sign-in-path.js";
1
3
  export { createAdminAccountRoute } from "./create-admin-account-route.js";
2
4
  export { createAdminActivityRoute } from "./create-admin-activity-route.js";
3
5
  export { createAdminDashboardRoute } from "./create-admin-dashboard-route.js";
@@ -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
+ /** Read the canonical client-safe sign-in destination. */
9
+ export declare function getSignInRoutePath(): string;
10
+ /** @deprecated Configure `routes.signIn`; retained for route-factory input validation. */
11
+ export declare function configureSignInRoutePath(legacyOverride?: string): string;
12
+ /** Defer deprecated override validation until the admin route's beforeLoad boundary. */
13
+ export declare function createSignInRoutePathResolver(legacyOverride?: string): () => string;
@@ -0,0 +1,19 @@
1
+ import { getClientConfig, resolveRoutes } from "@byline/core";
2
+ function getSignInRoutePath() {
3
+ return getClientConfig().routes.signIn;
4
+ }
5
+ function configureSignInRoutePath(legacyOverride) {
6
+ const routes = getClientConfig().routes;
7
+ const configured = routes.signIn;
8
+ if (void 0 === legacyOverride) return configured;
9
+ const normalizedOverride = resolveRoutes({
10
+ ...routes,
11
+ signIn: legacyOverride
12
+ }).signIn;
13
+ if (normalizedOverride !== configured) throw new Error(`createAdminLayoutRoute signInPath (${normalizedOverride}) must match routes.signIn (${configured})`);
14
+ return configured;
15
+ }
16
+ function createSignInRoutePathResolver(legacyOverride) {
17
+ return void 0 === legacyOverride ? getSignInRoutePath : ()=>configureSignInRoutePath(legacyOverride);
18
+ }
19
+ export { configureSignInRoutePath, createSignInRoutePathResolver, getSignInRoutePath };
@@ -0,0 +1,30 @@
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
+ import type { DeleteDocumentResult, DeleteDocumentSideEffectCode, DeleteDocumentSideEffectPhase } from '@byline/core';
9
+ export type DeleteDocumentPublicSideEffectPhase = DeleteDocumentSideEffectPhase | 'unknown';
10
+ export type DeleteDocumentPublicSideEffectCode = DeleteDocumentSideEffectCode;
11
+ export interface DeleteDocumentPublicSideEffectFailure {
12
+ phase: DeleteDocumentPublicSideEffectPhase;
13
+ code: DeleteDocumentPublicSideEffectCode;
14
+ }
15
+ export type DeleteDocumentResponse = {
16
+ status: 'ok';
17
+ deletedVersionCount: number;
18
+ outcome: 'committed';
19
+ sideEffectFailures: [];
20
+ } | {
21
+ status: 'ok';
22
+ deletedVersionCount: number;
23
+ outcome: 'committed-with-side-effect-failures';
24
+ sideEffectFailures: [
25
+ DeleteDocumentPublicSideEffectFailure,
26
+ ...DeleteDocumentPublicSideEffectFailure[]
27
+ ];
28
+ };
29
+ export declare function toDeleteDocumentResponse(result: DeleteDocumentResult): DeleteDocumentResponse;
30
+ export declare function hasDeleteSideEffectFailures(result: Pick<DeleteDocumentResult, 'outcome'>): boolean;
@@ -0,0 +1,34 @@
1
+ import { ErrorCodes } from "@byline/core";
2
+ function sanitizePhase(phase) {
3
+ if ('storageCleanup' === phase || 'afterTreeChange' === phase || 'afterDelete' === phase) return phase;
4
+ return 'unknown';
5
+ }
6
+ function sanitizeCode(code) {
7
+ return code === ErrorCodes.STORAGE ? ErrorCodes.STORAGE : ErrorCodes.UNHANDLED;
8
+ }
9
+ function sanitizeFailure({ phase, code }) {
10
+ return {
11
+ phase: sanitizePhase(phase),
12
+ code: sanitizeCode(code)
13
+ };
14
+ }
15
+ function toDeleteDocumentResponse(result) {
16
+ if ('committed' === result.outcome) return {
17
+ status: 'ok',
18
+ ...result
19
+ };
20
+ const [firstFailure, ...remainingFailures] = result.sideEffectFailures;
21
+ return {
22
+ status: 'ok',
23
+ deletedVersionCount: result.deletedVersionCount,
24
+ outcome: result.outcome,
25
+ sideEffectFailures: [
26
+ sanitizeFailure(firstFailure),
27
+ ...remainingFailures.map(sanitizeFailure)
28
+ ]
29
+ };
30
+ }
31
+ function hasDeleteSideEffectFailures(result) {
32
+ return 'committed-with-side-effect-failures' === result.outcome;
33
+ }
34
+ export { hasDeleteSideEffectFailures, toDeleteDocumentResponse };
@@ -11,7 +11,4 @@ export declare const deleteDocument: import("@tanstack/react-start").RequiredFet
11
11
  }) => {
12
12
  collection: string;
13
13
  id: string;
14
- }, Promise<{
15
- status: 'ok';
16
- deletedVersionCount: number;
17
- }>>;
14
+ }, Promise<import("./delete-outcome.js").DeleteDocumentResponse>>;
@@ -3,6 +3,7 @@ import { ERR_NOT_FOUND, getLogger, getServerConfig, getUploadFields } from "@byl
3
3
  import { deleteDocument } from "@byline/core/services";
4
4
  import { getAdminRequestContext } from "../../auth/auth-context.js";
5
5
  import { ensureCollection } from "../../integrations/api-utils.js";
6
+ import { toDeleteDocumentResponse } from "./delete-outcome.js";
6
7
  const delete_deleteDocument = createServerFn({
7
8
  method: 'POST'
8
9
  }).validator((input)=>input).handler(async ({ data: input })=>{
@@ -36,9 +37,6 @@ const delete_deleteDocument = createServerFn({
36
37
  const result = await deleteDocument(ctx, {
37
38
  documentId: id
38
39
  });
39
- return {
40
- status: 'ok',
41
- deletedVersionCount: result.deletedVersionCount
42
- };
40
+ return toDeleteDocumentResponse(result);
43
41
  });
44
42
  export { delete_deleteDocument as deleteDocument };
@@ -9,6 +9,7 @@ export * from './copy-to-locale';
9
9
  export * from './create';
10
10
  export * from './delete';
11
11
  export * from './delete-locale';
12
+ export * from './delete-outcome';
12
13
  export * from './duplicate';
13
14
  export * from './get';
14
15
  export * from './history';
@@ -3,6 +3,7 @@ export * from "./copy-to-locale.js";
3
3
  export * from "./create.js";
4
4
  export * from "./delete.js";
5
5
  export * from "./delete-locale.js";
6
+ export * from "./delete-outcome.js";
6
7
  export * from "./duplicate.js";
7
8
  export * from "./get.js";
8
9
  export * from "./history.js";
@@ -0,0 +1,46 @@
1
+ import type { CollectionHandle, PlaceTreeNodeOptions, RemoveFromTreeOptions } from '@byline/client';
2
+ /** Prefer the code; the marker survives transports that reconstruct a code-less Error. */
3
+ export declare function isTreeMutationConflict(error: unknown): boolean;
4
+ /** Detect when tree/audit committed even if transport reconstruction dropped the code. */
5
+ export declare function isCommittedTreeHookFailure(error: unknown): boolean;
6
+ export type AdminTreeMoveOutcome = {
7
+ status: 'ok';
8
+ } | {
9
+ status: 'suppressed';
10
+ } | {
11
+ status: 'mutation-failed';
12
+ error: unknown;
13
+ refreshError?: unknown;
14
+ } | {
15
+ status: 'committed-hook-failed';
16
+ error: unknown;
17
+ refreshError?: unknown;
18
+ } | {
19
+ status: 'refresh-failed';
20
+ error: unknown;
21
+ };
22
+ export interface AdminTreeMoveUiEffects {
23
+ rollback: boolean;
24
+ preserveOptimistic: boolean;
25
+ structuralFailure: 'conflict' | 'generic' | null;
26
+ committedHookWarning: boolean;
27
+ refreshWarning: boolean;
28
+ }
29
+ /** Pure UI policy for every mutation/refresh outcome. */
30
+ export declare function getAdminTreeMoveUiEffects(outcome: AdminTreeMoveOutcome): AdminTreeMoveUiEffects;
31
+ /** Preserve a committed optimistic move until a later loader returns new row data. */
32
+ export declare function shouldSyncAdminTreeRows(rows: unknown, preservedRows: unknown, isMoving: boolean): boolean;
33
+ /** Keep mutation and canonical-refresh failures distinct for optimistic tree UIs. */
34
+ export declare function executeAdminTreeMove(mutate: () => Promise<unknown>, refresh: () => Promise<unknown>): Promise<AdminTreeMoveOutcome>;
35
+ export interface AdminTreeMoveController {
36
+ isMoving(): boolean;
37
+ execute(mutate: () => Promise<unknown>, refresh: () => Promise<unknown>): Promise<AdminTreeMoveOutcome>;
38
+ }
39
+ /** Single-flight controller shared by pointer and keyboard tree moves. */
40
+ export declare function createAdminTreeMoveController(): AdminTreeMoveController;
41
+ /** Admin retries reconcile post-commit tree hooks unless explicitly disabled. */
42
+ export declare function placeAdminTreeNode(handle: Pick<CollectionHandle, 'placeTreeNode'>, documentId: string, options: PlaceTreeNodeOptions): Promise<{
43
+ orderKey: string;
44
+ }>;
45
+ /** Admin retries reconcile post-commit tree hooks unless explicitly disabled. */
46
+ export declare function removeAdminTreeNode(handle: Pick<CollectionHandle, 'removeFromTree'>, documentId: string, options?: RemoveFromTreeOptions): Promise<void>;