@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.
- package/dist/admin-shell/admin-activity/list.js +15 -5
- package/dist/admin-shell/admin-roles/delete.js +2 -1
- package/dist/admin-shell/admin-roles/list.js +2 -1
- package/dist/admin-shell/admin-users/delete.js +2 -1
- package/dist/admin-shell/admin-users/list.js +4 -7
- package/dist/admin-shell/chrome/admin-app-bar.js +2 -1
- package/dist/admin-shell/chrome/admin-menu-drawer.js +9 -8
- package/dist/admin-shell/chrome/admin-menu-provider.js +2 -1
- package/dist/admin-shell/chrome/dashboard.js +4 -3
- package/dist/admin-shell/chrome/sign-in-page.d.ts +2 -2
- package/dist/admin-shell/chrome/sign-in-page.js +2 -2
- package/dist/admin-shell/collections/create.js +4 -3
- package/dist/admin-shell/collections/document-history.js +6 -1
- package/dist/admin-shell/collections/edit.js +18 -14
- package/dist/admin-shell/collections/history.js +5 -4
- package/dist/admin-shell/collections/list.js +8 -7
- package/dist/admin-shell/collections/restore-version-modal.js +2 -1
- package/dist/admin-shell/collections/tree-list.js +53 -17
- package/dist/admin-shell/collections/view-menu.js +9 -8
- package/dist/auth/auth-context.d.ts +13 -0
- package/dist/auth/auth-context.js +4 -0
- package/dist/auth/request-scope.d.ts +16 -0
- package/dist/auth/request-scope.js +24 -0
- package/dist/integrations/abilities.js +8 -7
- package/dist/integrations/byline-public-client.d.ts +38 -0
- package/dist/integrations/byline-public-client.js +8 -4
- package/dist/integrations/byline-viewer-client.d.ts +6 -0
- package/dist/integrations/byline-viewer-client.js +22 -17
- package/dist/integrations/start-errors.js +2 -1
- package/dist/routes/admin-path.d.ts +22 -0
- package/dist/routes/admin-path.js +35 -0
- package/dist/routes/create-admin-account-route.js +3 -2
- package/dist/routes/create-admin-activity-route.js +3 -2
- package/dist/routes/create-admin-dashboard-route.js +2 -1
- package/dist/routes/create-admin-layout-route.d.ts +1 -1
- package/dist/routes/create-admin-layout-route.js +3 -1
- package/dist/routes/create-admin-permissions-route.js +3 -2
- package/dist/routes/create-admin-role-edit-route.js +4 -3
- package/dist/routes/create-admin-roles-list-route.js +3 -2
- package/dist/routes/create-admin-user-edit-route.js +4 -3
- package/dist/routes/create-admin-users-list-route.js +3 -2
- package/dist/routes/create-collection-api-route.d.ts +1 -7
- package/dist/routes/create-collection-api-route.js +12 -8
- package/dist/routes/create-collection-create-route.js +4 -3
- package/dist/routes/create-collection-edit-route.d.ts +1 -7
- package/dist/routes/create-collection-edit-route.js +9 -6
- package/dist/routes/create-collection-history-route.d.ts +1 -7
- package/dist/routes/create-collection-history-route.js +10 -7
- package/dist/routes/create-collection-list-route.js +3 -2
- package/dist/routes/create-sign-in-route.js +3 -2
- package/dist/routes/get-content-locale-route-config.d.ts +12 -0
- package/dist/routes/get-content-locale-route-config.js +16 -0
- package/dist/routes/index.d.ts +3 -0
- package/dist/routes/index.js +2 -0
- package/dist/routes/sign-in-path.d.ts +13 -0
- package/dist/routes/sign-in-path.js +19 -0
- package/dist/server-fns/collections/delete-outcome.d.ts +30 -0
- package/dist/server-fns/collections/delete-outcome.js +34 -0
- package/dist/server-fns/collections/delete.d.ts +1 -4
- package/dist/server-fns/collections/delete.js +2 -4
- package/dist/server-fns/collections/index.d.ts +1 -0
- package/dist/server-fns/collections/index.js +1 -0
- package/dist/server-fns/collections/tree-mutation.d.ts +46 -0
- package/dist/server-fns/collections/tree-mutation.js +109 -0
- package/dist/server-fns/collections/tree-read.d.ts +6 -0
- package/dist/server-fns/collections/tree-read.js +15 -0
- package/dist/server-fns/collections/tree.d.ts +5 -4
- package/dist/server-fns/collections/tree.js +15 -12
- package/dist/server-fns/collections/update.js +2 -1
- package/dist/vite/client-hook-boundary.d.ts +19 -0
- package/dist/vite/client-hook-boundary.js +20 -0
- package/dist/vite/index.d.ts +8 -0
- package/dist/vite/index.js +1 -0
- package/package.json +15 -9
- package/src/admin-shell/admin-activity/list.tsx +13 -3
- package/src/admin-shell/admin-roles/delete.tsx +2 -1
- package/src/admin-shell/admin-roles/list.tsx +2 -1
- package/src/admin-shell/admin-users/delete.tsx +3 -2
- package/src/admin-shell/admin-users/list.tsx +9 -8
- package/src/admin-shell/chrome/admin-app-bar.tsx +2 -1
- package/src/admin-shell/chrome/admin-menu-drawer.tsx +13 -8
- package/src/admin-shell/chrome/admin-menu-provider.tsx +2 -1
- package/src/admin-shell/chrome/dashboard.tsx +4 -3
- package/src/admin-shell/chrome/sign-in-page.tsx +3 -3
- package/src/admin-shell/collections/create.tsx +4 -3
- package/src/admin-shell/collections/document-history.tsx +5 -0
- package/src/admin-shell/collections/edit.tsx +20 -13
- package/src/admin-shell/collections/history.tsx +6 -5
- package/src/admin-shell/collections/list.tsx +8 -7
- package/src/admin-shell/collections/restore-version-modal.tsx +2 -1
- package/src/admin-shell/collections/tree-list.tsx +78 -22
- package/src/admin-shell/collections/view-menu.tsx +9 -8
- package/src/auth/auth-context.test.node.ts +87 -0
- package/src/auth/auth-context.ts +18 -0
- package/src/auth/request-scope.test.node.ts +93 -0
- package/src/auth/request-scope.ts +62 -0
- package/src/integrations/abilities.tsx +14 -4
- package/src/integrations/byline-client.ts +6 -4
- package/src/integrations/byline-public-client.ts +18 -4
- package/src/integrations/byline-viewer-client.ts +30 -18
- package/src/integrations/request-context-contract.test.node.ts +131 -0
- package/src/integrations/request-context-factories.test.node.ts +140 -0
- package/src/integrations/start-errors.test.node.ts +22 -0
- package/src/integrations/start-errors.ts +1 -0
- package/src/routes/admin-path.test.node.ts +129 -0
- package/src/routes/admin-path.ts +66 -0
- package/src/routes/auth-routes.test.node.ts +39 -0
- package/src/routes/create-admin-account-route.tsx +3 -2
- package/src/routes/create-admin-activity-route.tsx +3 -2
- package/src/routes/create-admin-dashboard-route.tsx +2 -1
- package/src/routes/create-admin-layout-route.tsx +4 -4
- package/src/routes/create-admin-permissions-route.tsx +3 -2
- package/src/routes/create-admin-role-edit-route.tsx +7 -3
- package/src/routes/create-admin-roles-list-route.tsx +3 -2
- package/src/routes/create-admin-user-edit-route.tsx +7 -3
- package/src/routes/create-admin-users-list-route.tsx +3 -2
- package/src/routes/create-collection-api-route.tsx +15 -14
- package/src/routes/create-collection-create-route.tsx +7 -3
- package/src/routes/create-collection-edit-route.tsx +12 -12
- package/src/routes/create-collection-history-route.tsx +13 -13
- package/src/routes/create-collection-list-route.tsx +3 -2
- package/src/routes/create-sign-in-route.tsx +9 -3
- package/src/routes/get-content-locale-route-config.ts +26 -0
- package/src/routes/index.ts +11 -0
- package/src/routes/sign-in-path.test.node.ts +79 -0
- package/src/routes/sign-in-path.ts +36 -0
- package/src/server-fns/collections/delete-outcome.test.node.ts +72 -0
- package/src/server-fns/collections/delete-outcome.ts +80 -0
- package/src/server-fns/collections/delete.ts +2 -1
- package/src/server-fns/collections/get.ts +2 -0
- package/src/server-fns/collections/index.ts +1 -0
- package/src/server-fns/collections/tree-mutation.test.node.ts +225 -0
- package/src/server-fns/collections/tree-mutation.ts +165 -0
- package/src/server-fns/collections/tree-read.test.node.ts +46 -0
- package/src/server-fns/collections/tree-read.ts +26 -0
- package/src/server-fns/collections/tree.ts +26 -10
- package/src/server-fns/collections/update.ts +3 -0
- package/src/vite/client-hook-boundary.test.node.ts +50 -0
- package/src/vite/client-hook-boundary.ts +45 -0
- 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:
|
|
35
|
+
href: getAdminRoutePath()
|
|
35
36
|
},
|
|
36
37
|
{
|
|
37
38
|
label: t('chrome.account'),
|
|
38
|
-
href: '
|
|
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:
|
|
55
|
+
href: getAdminRoutePath()
|
|
55
56
|
},
|
|
56
57
|
{
|
|
57
58
|
label: t('activity.title'),
|
|
58
|
-
href: '
|
|
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:
|
|
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
|
-
/**
|
|
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
|
|
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:
|
|
25
|
+
href: getAdminRoutePath()
|
|
25
26
|
},
|
|
26
27
|
{
|
|
27
28
|
label: t('chrome.menu.permissions'),
|
|
28
|
-
href: '
|
|
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:
|
|
46
|
+
href: getAdminRoutePath()
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
label: t('chrome.menu.adminRoles'),
|
|
49
|
-
href: '
|
|
50
|
+
href: getAdminRoutePath('roles')
|
|
50
51
|
},
|
|
51
52
|
{
|
|
52
53
|
label: t('adminRoles.breadcrumbDetail'),
|
|
53
|
-
href:
|
|
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:
|
|
25
|
+
href: getAdminRoutePath()
|
|
25
26
|
},
|
|
26
27
|
{
|
|
27
28
|
label: t('chrome.menu.adminRoles'),
|
|
28
|
-
href: '
|
|
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:
|
|
53
|
+
href: getAdminRoutePath()
|
|
53
54
|
},
|
|
54
55
|
{
|
|
55
56
|
label: t('chrome.menu.adminUsers'),
|
|
56
|
-
href: '
|
|
57
|
+
href: getAdminRoutePath('users')
|
|
57
58
|
},
|
|
58
59
|
{
|
|
59
60
|
label: t('adminUsers.breadcrumbDetail'),
|
|
60
|
-
href:
|
|
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:
|
|
57
|
+
href: getAdminRoutePath()
|
|
57
58
|
},
|
|
58
59
|
{
|
|
59
60
|
label: t('chrome.menu.adminUsers'),
|
|
60
|
-
href: '
|
|
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
|
-
|
|
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
|
|
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
|
|
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:
|
|
47
|
+
href: getAdminRoutePath()
|
|
44
48
|
},
|
|
45
49
|
{
|
|
46
50
|
label: collectionDef.labels.plural,
|
|
47
|
-
href:
|
|
51
|
+
href: getAdminRoutePath('collections', collection)
|
|
48
52
|
},
|
|
49
53
|
{
|
|
50
54
|
label: t('common.actions.edit'),
|
|
51
|
-
href:
|
|
55
|
+
href: getAdminRoutePath('collections', collection, id)
|
|
52
56
|
},
|
|
53
57
|
{
|
|
54
58
|
label: t('collections.viewMenu.apiButton'),
|
|
55
|
-
href:
|
|
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:
|
|
65
|
-
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:
|
|
33
|
+
href: getAdminRoutePath()
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
label: collectionDef.labels.plural,
|
|
36
|
-
href:
|
|
37
|
+
href: getAdminRoutePath('collections', collection)
|
|
37
38
|
},
|
|
38
39
|
{
|
|
39
40
|
label: t('collections.breadcrumbs.create'),
|
|
40
|
-
href:
|
|
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
|
-
|
|
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
|
|
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:
|
|
90
|
+
href: getAdminRoutePath()
|
|
88
91
|
},
|
|
89
92
|
{
|
|
90
93
|
label: collectionDef.labels.plural,
|
|
91
|
-
href:
|
|
94
|
+
href: getAdminRoutePath('collections', collection)
|
|
92
95
|
},
|
|
93
96
|
{
|
|
94
97
|
label: t('common.actions.edit'),
|
|
95
|
-
href:
|
|
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:
|
|
105
|
-
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
|
-
|
|
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
|
|
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:
|
|
84
|
+
href: getAdminRoutePath()
|
|
82
85
|
},
|
|
83
86
|
{
|
|
84
87
|
label: collectionDef.labels.plural,
|
|
85
|
-
href:
|
|
88
|
+
href: getAdminRoutePath('collections', collection)
|
|
86
89
|
},
|
|
87
90
|
{
|
|
88
91
|
label: t('common.actions.edit'),
|
|
89
|
-
href:
|
|
92
|
+
href: getAdminRoutePath('collections', collection, Route.useParams().id)
|
|
90
93
|
},
|
|
91
94
|
{
|
|
92
95
|
label: t('collections.breadcrumbs.history'),
|
|
93
|
-
href:
|
|
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:
|
|
105
|
-
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:
|
|
122
|
+
href: getAdminRoutePath()
|
|
122
123
|
},
|
|
123
124
|
{
|
|
124
125
|
label: data.included.collection.labels.plural,
|
|
125
|
-
href:
|
|
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 =
|
|
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
|
-
|
|
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 };
|
package/dist/routes/index.d.ts
CHANGED
|
@@ -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
|
package/dist/routes/index.js
CHANGED
|
@@ -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;
|