@byline/host-tanstack-start 3.20.4 → 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 (140) 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.d.ts +1 -7
  43. package/dist/routes/create-collection-api-route.js +12 -8
  44. package/dist/routes/create-collection-create-route.js +4 -3
  45. package/dist/routes/create-collection-edit-route.d.ts +1 -7
  46. package/dist/routes/create-collection-edit-route.js +9 -6
  47. package/dist/routes/create-collection-history-route.d.ts +1 -7
  48. package/dist/routes/create-collection-history-route.js +10 -7
  49. package/dist/routes/create-collection-list-route.js +3 -2
  50. package/dist/routes/create-sign-in-route.js +3 -2
  51. package/dist/routes/get-content-locale-route-config.d.ts +12 -0
  52. package/dist/routes/get-content-locale-route-config.js +16 -0
  53. package/dist/routes/index.d.ts +3 -0
  54. package/dist/routes/index.js +2 -0
  55. package/dist/routes/sign-in-path.d.ts +13 -0
  56. package/dist/routes/sign-in-path.js +19 -0
  57. package/dist/server-fns/collections/delete-outcome.d.ts +30 -0
  58. package/dist/server-fns/collections/delete-outcome.js +34 -0
  59. package/dist/server-fns/collections/delete.d.ts +1 -4
  60. package/dist/server-fns/collections/delete.js +2 -4
  61. package/dist/server-fns/collections/index.d.ts +1 -0
  62. package/dist/server-fns/collections/index.js +1 -0
  63. package/dist/server-fns/collections/tree-mutation.d.ts +46 -0
  64. package/dist/server-fns/collections/tree-mutation.js +109 -0
  65. package/dist/server-fns/collections/tree-read.d.ts +6 -0
  66. package/dist/server-fns/collections/tree-read.js +15 -0
  67. package/dist/server-fns/collections/tree.d.ts +5 -4
  68. package/dist/server-fns/collections/tree.js +15 -12
  69. package/dist/server-fns/collections/update.js +2 -1
  70. package/dist/vite/client-hook-boundary.d.ts +19 -0
  71. package/dist/vite/client-hook-boundary.js +20 -0
  72. package/dist/vite/index.d.ts +8 -0
  73. package/dist/vite/index.js +1 -0
  74. package/package.json +15 -9
  75. package/src/admin-shell/admin-activity/list.tsx +13 -3
  76. package/src/admin-shell/admin-roles/delete.tsx +2 -1
  77. package/src/admin-shell/admin-roles/list.tsx +2 -1
  78. package/src/admin-shell/admin-users/delete.tsx +3 -2
  79. package/src/admin-shell/admin-users/list.tsx +9 -8
  80. package/src/admin-shell/chrome/admin-app-bar.tsx +2 -1
  81. package/src/admin-shell/chrome/admin-menu-drawer.tsx +13 -8
  82. package/src/admin-shell/chrome/admin-menu-provider.tsx +2 -1
  83. package/src/admin-shell/chrome/dashboard.tsx +4 -3
  84. package/src/admin-shell/chrome/sign-in-page.tsx +3 -3
  85. package/src/admin-shell/collections/create.tsx +4 -3
  86. package/src/admin-shell/collections/document-history.tsx +5 -0
  87. package/src/admin-shell/collections/edit.tsx +20 -13
  88. package/src/admin-shell/collections/history.tsx +6 -5
  89. package/src/admin-shell/collections/list.tsx +8 -7
  90. package/src/admin-shell/collections/restore-version-modal.tsx +2 -1
  91. package/src/admin-shell/collections/tree-list.tsx +78 -22
  92. package/src/admin-shell/collections/view-menu.tsx +9 -8
  93. package/src/auth/auth-context.test.node.ts +87 -0
  94. package/src/auth/auth-context.ts +18 -0
  95. package/src/auth/request-scope.test.node.ts +93 -0
  96. package/src/auth/request-scope.ts +62 -0
  97. package/src/integrations/abilities.tsx +14 -4
  98. package/src/integrations/byline-client.ts +6 -4
  99. package/src/integrations/byline-public-client.ts +18 -4
  100. package/src/integrations/byline-viewer-client.ts +30 -18
  101. package/src/integrations/request-context-contract.test.node.ts +131 -0
  102. package/src/integrations/request-context-factories.test.node.ts +140 -0
  103. package/src/integrations/start-errors.test.node.ts +22 -0
  104. package/src/integrations/start-errors.ts +1 -0
  105. package/src/routes/admin-path.test.node.ts +129 -0
  106. package/src/routes/admin-path.ts +66 -0
  107. package/src/routes/auth-routes.test.node.ts +39 -0
  108. package/src/routes/create-admin-account-route.tsx +3 -2
  109. package/src/routes/create-admin-activity-route.tsx +3 -2
  110. package/src/routes/create-admin-dashboard-route.tsx +2 -1
  111. package/src/routes/create-admin-layout-route.tsx +4 -4
  112. package/src/routes/create-admin-permissions-route.tsx +3 -2
  113. package/src/routes/create-admin-role-edit-route.tsx +7 -3
  114. package/src/routes/create-admin-roles-list-route.tsx +3 -2
  115. package/src/routes/create-admin-user-edit-route.tsx +7 -3
  116. package/src/routes/create-admin-users-list-route.tsx +3 -2
  117. package/src/routes/create-collection-api-route.tsx +15 -14
  118. package/src/routes/create-collection-create-route.tsx +7 -3
  119. package/src/routes/create-collection-edit-route.tsx +12 -12
  120. package/src/routes/create-collection-history-route.tsx +13 -13
  121. package/src/routes/create-collection-list-route.tsx +3 -2
  122. package/src/routes/create-sign-in-route.tsx +9 -3
  123. package/src/routes/get-content-locale-route-config.ts +26 -0
  124. package/src/routes/index.ts +11 -0
  125. package/src/routes/sign-in-path.test.node.ts +79 -0
  126. package/src/routes/sign-in-path.ts +36 -0
  127. package/src/server-fns/collections/delete-outcome.test.node.ts +72 -0
  128. package/src/server-fns/collections/delete-outcome.ts +80 -0
  129. package/src/server-fns/collections/delete.ts +2 -1
  130. package/src/server-fns/collections/get.ts +2 -0
  131. package/src/server-fns/collections/index.ts +1 -0
  132. package/src/server-fns/collections/tree-mutation.test.node.ts +225 -0
  133. package/src/server-fns/collections/tree-mutation.ts +165 -0
  134. package/src/server-fns/collections/tree-read.test.node.ts +46 -0
  135. package/src/server-fns/collections/tree-read.ts +26 -0
  136. package/src/server-fns/collections/tree.ts +26 -10
  137. package/src/server-fns/collections/update.ts +3 -0
  138. package/src/vite/client-hook-boundary.test.node.ts +50 -0
  139. package/src/vite/client-hook-boundary.ts +45 -0
  140. 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
  }),
@@ -5,10 +5,4 @@
5
5
  *
6
6
  * Copyright (c) Infonomic Company Limited
7
7
  */
8
- import type { ContentLocaleOption } from '../admin-shell/collections/view-menu.js';
9
- interface CollectionApiOpts {
10
- contentLocales: ReadonlyArray<ContentLocaleOption>;
11
- defaultContentLocale: string;
12
- }
13
- export declare function createCollectionApiRoute(path: string, opts: CollectionApiOpts): any;
14
- export {};
8
+ export declare function createCollectionApiRoute(path: string): any;
@@ -6,11 +6,13 @@ 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";
10
+ import { getContentLocaleRouteConfig } from "./get-content-locale-route-config.js";
9
11
  const searchSchema = z.object({
10
12
  locale: z.string().optional(),
11
13
  depth: z.coerce.number().int().min(0).max(3).optional()
12
14
  });
13
- function createCollectionApiRoute(path, opts) {
15
+ function createCollectionApiRoute(path) {
14
16
  const Route = createFileRoute(path)({
15
17
  validateSearch: searchSchema,
16
18
  loaderDeps: ({ search })=>({
@@ -20,7 +22,8 @@ function createCollectionApiRoute(path, opts) {
20
22
  loader: async ({ params, deps })=>{
21
23
  const collectionDef = getCollectionDefinition(params.collection);
22
24
  if (!collectionDef) throw notFound();
23
- const resolvedLocale = deps.locale ?? opts.defaultContentLocale;
25
+ const { defaultContentLocale } = getContentLocaleRouteConfig();
26
+ const resolvedLocale = deps.locale ?? defaultContentLocale;
24
27
  const data = await getCollectionDocument(params.collection, params.id, resolvedLocale, deps.depth);
25
28
  if (!data) throw notFound();
26
29
  return data;
@@ -34,25 +37,26 @@ function createCollectionApiRoute(path, opts) {
34
37
  const { locale, depth } = Route.useSearch();
35
38
  const collectionDef = getCollectionDefinition(collection);
36
39
  const { t } = useTranslation('byline-admin');
40
+ const { contentLocales, defaultContentLocale } = getContentLocaleRouteConfig();
37
41
  return /*#__PURE__*/ jsxs(Fragment, {
38
42
  children: [
39
43
  /*#__PURE__*/ jsx(BreadcrumbsClient, {
40
44
  breadcrumbs: [
41
45
  {
42
46
  label: t('chrome.menu.dashboard'),
43
- href: "/admin"
47
+ href: getAdminRoutePath()
44
48
  },
45
49
  {
46
50
  label: collectionDef.labels.plural,
47
- href: `/admin/collections/${collection}`
51
+ href: getAdminRoutePath('collections', collection)
48
52
  },
49
53
  {
50
54
  label: t('common.actions.edit'),
51
- href: `/admin/collections/${collection}/${id}`
55
+ href: getAdminRoutePath('collections', collection, id)
52
56
  },
53
57
  {
54
58
  label: t('collections.viewMenu.apiButton'),
55
- href: `/admin/collections/${collection}/${id}/api`
59
+ href: getAdminRoutePath('collections', collection, id, 'api')
56
60
  }
57
61
  ]
58
62
  }),
@@ -61,8 +65,8 @@ function createCollectionApiRoute(path, opts) {
61
65
  initialData: data,
62
66
  locale: locale,
63
67
  depth: depth,
64
- contentLocales: opts.contentLocales,
65
- defaultContentLocale: opts.defaultContentLocale
68
+ contentLocales: contentLocales,
69
+ defaultContentLocale: defaultContentLocale
66
70
  })
67
71
  ]
68
72
  });
@@ -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
  }),
@@ -5,10 +5,4 @@
5
5
  *
6
6
  * Copyright (c) Infonomic Company Limited
7
7
  */
8
- import type { ContentLocaleOption } from '../admin-shell/collections/view-menu.js';
9
- interface CollectionEditOpts {
10
- contentLocales: ReadonlyArray<ContentLocaleOption>;
11
- defaultContentLocale: string;
12
- }
13
- export declare function createCollectionEditRoute(path: string, opts: CollectionEditOpts): any;
14
- export {};
8
+ export declare function createCollectionEditRoute(path: string): any;
@@ -9,13 +9,15 @@ 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";
13
+ import { getContentLocaleRouteConfig } from "./get-content-locale-route-config.js";
12
14
  const searchSchema = z.object({
13
15
  locale: z.string().optional(),
14
16
  action: z["enum"]([
15
17
  'created'
16
18
  ]).optional()
17
19
  });
18
- function createCollectionEditRoute(path, opts) {
20
+ function createCollectionEditRoute(path) {
19
21
  const Route = createFileRoute(path)({
20
22
  validateSearch: searchSchema,
21
23
  loaderDeps: ({ search })=>({
@@ -41,6 +43,7 @@ function createCollectionEditRoute(path, opts) {
41
43
  const { t } = useTranslation('byline-admin');
42
44
  const toastManager = useToastManager();
43
45
  const navigate = useNavigate();
46
+ const { contentLocales, defaultContentLocale } = getContentLocaleRouteConfig();
44
47
  const createdToastFiredRef = useRef(false);
45
48
  useEffect(()=>{
46
49
  if ('created' !== search.action) {
@@ -84,15 +87,15 @@ function createCollectionEditRoute(path, opts) {
84
87
  breadcrumbs: [
85
88
  {
86
89
  label: t('chrome.menu.dashboard'),
87
- href: "/admin"
90
+ href: getAdminRoutePath()
88
91
  },
89
92
  {
90
93
  label: collectionDef.labels.plural,
91
- href: `/admin/collections/${collection}`
94
+ href: getAdminRoutePath('collections', collection)
92
95
  },
93
96
  {
94
97
  label: t('common.actions.edit'),
95
- href: `/admin/collections/${collection}/${id}`
98
+ href: getAdminRoutePath('collections', collection, id)
96
99
  }
97
100
  ]
98
101
  }),
@@ -101,8 +104,8 @@ function createCollectionEditRoute(path, opts) {
101
104
  adminConfig: adminConfig ?? void 0,
102
105
  initialData: data,
103
106
  locale: locale,
104
- contentLocales: opts.contentLocales,
105
- defaultContentLocale: opts.defaultContentLocale
107
+ contentLocales: contentLocales,
108
+ defaultContentLocale: defaultContentLocale
106
109
  })
107
110
  ]
108
111
  });
@@ -5,10 +5,4 @@
5
5
  *
6
6
  * Copyright (c) Infonomic Company Limited
7
7
  */
8
- import type { ContentLocaleOption } from '../admin-shell/collections/view-menu.js';
9
- interface CollectionHistoryOpts {
10
- contentLocales: ReadonlyArray<ContentLocaleOption>;
11
- defaultContentLocale: string;
12
- }
13
- export declare function createCollectionHistoryRoute(path: string, opts: CollectionHistoryOpts): any;
14
- export {};
8
+ export declare function createCollectionHistoryRoute(path: string): any;
@@ -6,6 +6,8 @@ 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";
10
+ import { getContentLocaleRouteConfig } from "./get-content-locale-route-config.js";
9
11
  const searchSchema = z.object({
10
12
  page: z.coerce.number().min(1).optional(),
11
13
  page_size: z.coerce.number().max(100).optional(),
@@ -18,7 +20,7 @@ const searchSchema = z.object({
18
20
  ]).optional()
19
21
  });
20
22
  const AUDIT_LOG_PAGE_SIZE = 100;
21
- function createCollectionHistoryRoute(path, opts) {
23
+ function createCollectionHistoryRoute(path) {
22
24
  const Route = createFileRoute(path)({
23
25
  validateSearch: searchSchema,
24
26
  loaderDeps: ({ search })=>({
@@ -72,25 +74,26 @@ function createCollectionHistoryRoute(path, opts) {
72
74
  const collectionDef = getCollectionDefinition(collection);
73
75
  const adminConfig = getCollectionAdminConfig(collection);
74
76
  const { t } = useTranslation('byline-admin');
77
+ const { contentLocales, defaultContentLocale } = getContentLocaleRouteConfig();
75
78
  return /*#__PURE__*/ jsxs(Fragment, {
76
79
  children: [
77
80
  /*#__PURE__*/ jsx(BreadcrumbsClient, {
78
81
  breadcrumbs: [
79
82
  {
80
83
  label: t('chrome.menu.dashboard'),
81
- href: "/admin"
84
+ href: getAdminRoutePath()
82
85
  },
83
86
  {
84
87
  label: collectionDef.labels.plural,
85
- href: `/admin/collections/${collection}`
88
+ href: getAdminRoutePath('collections', collection)
86
89
  },
87
90
  {
88
91
  label: t('common.actions.edit'),
89
- href: `/admin/collections/${collection}/${Route.useParams().id}`
92
+ href: getAdminRoutePath('collections', collection, Route.useParams().id)
90
93
  },
91
94
  {
92
95
  label: t('collections.breadcrumbs.history'),
93
- href: `/admin/collections/${collection}/${Route.useParams().id}/history`
96
+ href: getAdminRoutePath('collections', collection, Route.useParams().id, 'history')
94
97
  }
95
98
  ]
96
99
  }),
@@ -101,8 +104,8 @@ function createCollectionHistoryRoute(path, opts) {
101
104
  data: history,
102
105
  auditLog: auditLog,
103
106
  currentDocument: currentDocument,
104
- contentLocales: opts.contentLocales,
105
- defaultContentLocale: opts.defaultContentLocale
107
+ contentLocales: contentLocales,
108
+ defaultContentLocale: defaultContentLocale
106
109
  })
107
110
  ]
108
111
  });
@@ -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
  }
@@ -0,0 +1,12 @@
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 { ContentLocaleOption } from '../admin-shell/collections/view-menu.js';
9
+ export declare function getContentLocaleRouteConfig(): {
10
+ contentLocales: ContentLocaleOption[];
11
+ defaultContentLocale: string;
12
+ };
@@ -0,0 +1,16 @@
1
+ import { getClientConfig } from "@byline/core";
2
+ function getContentLocaleRouteConfig() {
3
+ const content = getClientConfig().i18n.content;
4
+ const labels = new Map(content.localeDefinitions?.map(({ code, nativeName })=>[
5
+ code,
6
+ nativeName
7
+ ]) ?? []);
8
+ return {
9
+ contentLocales: content.locales.map((code)=>({
10
+ code,
11
+ label: labels.get(code) ?? code
12
+ })),
13
+ defaultContentLocale: content.defaultLocale
14
+ };
15
+ }
16
+ export { getContentLocaleRouteConfig };
@@ -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;