@byline/host-tanstack-start 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin-shell/admin-roles/container.js +1 -2
- package/dist/admin-shell/admin-roles/delete.js +1 -1
- package/dist/admin-shell/admin-roles/list.js +1 -2
- package/dist/admin-shell/admin-users/container.js +1 -2
- package/dist/admin-shell/admin-users/delete.js +1 -1
- package/dist/admin-shell/admin-users/list.js +1 -2
- package/dist/admin-shell/chrome/admin-app-bar.js +1 -1
- package/dist/admin-shell/chrome/dashboard.js +1 -1
- package/dist/admin-shell/chrome/drawer-toggle.js +1 -1
- package/dist/admin-shell/chrome/menu-drawer.js +1 -1
- package/dist/admin-shell/chrome/preview-toggle.js +1 -1
- package/dist/admin-shell/chrome/route-error.js +1 -1
- package/dist/admin-shell/chrome/router-pager.d.ts +1 -1
- package/dist/admin-shell/chrome/router-pager.js +1 -1
- package/dist/admin-shell/chrome/th-sortable.js +1 -1
- package/dist/admin-shell/collections/api.js +1 -1
- package/dist/admin-shell/collections/create.js +1 -2
- package/dist/admin-shell/collections/edit.js +1 -2
- package/dist/admin-shell/collections/history.js +82 -6
- package/dist/admin-shell/collections/history.module.js +5 -0
- package/dist/admin-shell/collections/history_module.css +46 -0
- package/dist/admin-shell/collections/list.js +1 -2
- package/dist/admin-shell/collections/preview-link.js +1 -1
- package/dist/admin-shell/collections/restore-version-modal.d.ts +10 -0
- package/dist/admin-shell/collections/restore-version-modal.js +118 -0
- package/dist/admin-shell/collections/restore-version-modal.module.js +10 -0
- package/dist/admin-shell/collections/restore-version-modal_module.css +31 -0
- package/dist/admin-shell/collections/view-menu.js +1 -1
- package/dist/routes/create-admin-account-route.js +1 -2
- package/dist/routes/create-admin-role-edit-route.js +1 -1
- package/dist/routes/create-admin-user-edit-route.js +1 -1
- package/dist/routes/create-collection-list-route.js +1 -1
- package/dist/server-fns/collections/index.d.ts +1 -0
- package/dist/server-fns/collections/index.js +1 -0
- package/dist/server-fns/collections/restore-version.d.ts +21 -0
- package/dist/server-fns/collections/restore-version.js +41 -0
- package/package.json +10 -10
- package/src/admin-shell/admin-roles/container.tsx +1 -1
- package/src/admin-shell/admin-roles/delete.tsx +1 -1
- package/src/admin-shell/admin-roles/list.tsx +1 -1
- package/src/admin-shell/admin-users/container.tsx +1 -1
- package/src/admin-shell/admin-users/delete.tsx +1 -1
- package/src/admin-shell/admin-users/list.tsx +1 -1
- package/src/admin-shell/chrome/admin-app-bar.tsx +1 -1
- package/src/admin-shell/chrome/dashboard.tsx +1 -1
- package/src/admin-shell/chrome/drawer-toggle.tsx +1 -1
- package/src/admin-shell/chrome/menu-drawer.tsx +1 -1
- package/src/admin-shell/chrome/preview-toggle.tsx +1 -1
- package/src/admin-shell/chrome/route-error.tsx +1 -1
- package/src/admin-shell/chrome/router-pager.tsx +2 -2
- package/src/admin-shell/chrome/th-sortable.tsx +1 -1
- package/src/admin-shell/collections/api.tsx +1 -1
- package/src/admin-shell/collections/create.tsx +1 -1
- package/src/admin-shell/collections/edit.tsx +1 -1
- package/src/admin-shell/collections/history.module.css +50 -1
- package/src/admin-shell/collections/history.tsx +149 -67
- package/src/admin-shell/collections/list.tsx +1 -1
- package/src/admin-shell/collections/preview-link.tsx +1 -1
- package/src/admin-shell/collections/restore-version-modal.module.css +48 -0
- package/src/admin-shell/collections/restore-version-modal.tsx +131 -0
- package/src/admin-shell/collections/view-menu.tsx +1 -1
- package/src/routes/create-admin-account-route.tsx +1 -1
- package/src/routes/create-admin-role-edit-route.tsx +1 -1
- package/src/routes/create-admin-user-edit-route.tsx +1 -1
- package/src/routes/create-collection-list-route.tsx +1 -1
- package/src/server-fns/collections/index.ts +1 -0
- package/src/server-fns/collections/restore-version.ts +59 -0
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
export declare const restoreDocumentVersion: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
|
|
9
|
+
collection: string;
|
|
10
|
+
id: string;
|
|
11
|
+
versionId: string;
|
|
12
|
+
}) => {
|
|
13
|
+
collection: string;
|
|
14
|
+
id: string;
|
|
15
|
+
versionId: string;
|
|
16
|
+
}, Promise<{
|
|
17
|
+
status: "ok";
|
|
18
|
+
documentId: string;
|
|
19
|
+
documentVersionId: string;
|
|
20
|
+
sourceVersionId: string;
|
|
21
|
+
}>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createServerFn } from "@tanstack/react-start";
|
|
2
|
+
import { ERR_NOT_FOUND, getLogger, getServerConfig } from "@byline/core";
|
|
3
|
+
import { restoreDocumentVersion } from "@byline/core/services";
|
|
4
|
+
import { getAdminRequestContext } from "../../auth/auth-context.js";
|
|
5
|
+
import { ensureCollection } from "../../integrations/api-utils.js";
|
|
6
|
+
const restore_version_restoreDocumentVersion = createServerFn({
|
|
7
|
+
method: 'POST'
|
|
8
|
+
}).inputValidator((input)=>input).handler(async ({ data: input })=>{
|
|
9
|
+
const { collection: path, id, versionId } = input;
|
|
10
|
+
const logger = getLogger();
|
|
11
|
+
const config = await ensureCollection(path);
|
|
12
|
+
if (!config) throw ERR_NOT_FOUND({
|
|
13
|
+
message: 'Collection not found',
|
|
14
|
+
details: {
|
|
15
|
+
collectionPath: path
|
|
16
|
+
}
|
|
17
|
+
}).log(logger);
|
|
18
|
+
const serverConfig = getServerConfig();
|
|
19
|
+
const ctx = {
|
|
20
|
+
db: serverConfig.db,
|
|
21
|
+
definition: config.definition,
|
|
22
|
+
collectionId: config.collection.id,
|
|
23
|
+
collectionVersion: config.collection.version,
|
|
24
|
+
collectionPath: path,
|
|
25
|
+
logger,
|
|
26
|
+
defaultLocale: serverConfig.i18n.content.defaultLocale,
|
|
27
|
+
slugifier: serverConfig.slugifier,
|
|
28
|
+
requestContext: await getAdminRequestContext()
|
|
29
|
+
};
|
|
30
|
+
const result = await restoreDocumentVersion(ctx, {
|
|
31
|
+
documentId: id,
|
|
32
|
+
sourceVersionId: versionId
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
status: 'ok',
|
|
36
|
+
documentId: result.documentId,
|
|
37
|
+
documentVersionId: result.documentVersionId,
|
|
38
|
+
sourceVersionId: result.sourceVersionId
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
export { restore_version_restoreDocumentVersion as restoreDocumentVersion };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.2.0",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20.9.0"
|
|
9
9
|
},
|
|
@@ -101,19 +101,19 @@
|
|
|
101
101
|
"react-swipeable": "^7.0.2",
|
|
102
102
|
"uuid": "^14.0.0",
|
|
103
103
|
"zod": "^4.4.2",
|
|
104
|
-
"@byline/admin": "1.
|
|
105
|
-
"@byline/
|
|
106
|
-
"@byline/
|
|
107
|
-
"@byline/
|
|
108
|
-
"@byline/
|
|
104
|
+
"@byline/admin": "1.2.0",
|
|
105
|
+
"@byline/client": "1.2.0",
|
|
106
|
+
"@byline/ui": "1.2.0",
|
|
107
|
+
"@byline/auth": "1.2.0",
|
|
108
|
+
"@byline/core": "1.2.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
111
|
"@tanstack/react-router": "^1.167.0",
|
|
112
112
|
"@tanstack/react-start": "^1.167.0",
|
|
113
113
|
"react": "^19.0.0",
|
|
114
114
|
"react-dom": "^19.0.0",
|
|
115
|
-
"@byline/db-postgres": "1.
|
|
116
|
-
"@byline/storage-local": "1.
|
|
115
|
+
"@byline/db-postgres": "1.2.0",
|
|
116
|
+
"@byline/storage-local": "1.2.0"
|
|
117
117
|
},
|
|
118
118
|
"peerDependenciesMeta": {
|
|
119
119
|
"@byline/db-postgres": {
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
"typescript": "6.0.3",
|
|
140
140
|
"typescript-plugin-css-modules": "^5.2.0",
|
|
141
141
|
"vitest": "^4.1.5",
|
|
142
|
-
"@byline/
|
|
143
|
-
"@byline/
|
|
142
|
+
"@byline/storage-local": "1.2.0",
|
|
143
|
+
"@byline/db-postgres": "1.2.0"
|
|
144
144
|
},
|
|
145
145
|
"publishConfig": {
|
|
146
146
|
"access": "public",
|
|
@@ -29,7 +29,7 @@ import type React from 'react'
|
|
|
29
29
|
import { useState } from 'react'
|
|
30
30
|
import { useRouter } from '@tanstack/react-router'
|
|
31
31
|
|
|
32
|
-
import { Button, CloseIcon, Drawer, IconButton, Modal, useToastManager } from '@byline/ui'
|
|
32
|
+
import { Button, CloseIcon, Drawer, IconButton, Modal, useToastManager } from '@byline/ui/react'
|
|
33
33
|
import { LocalDateTime, RolePermissions, UpdateRole } from '@byline/ui/react'
|
|
34
34
|
import cx from 'classnames'
|
|
35
35
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { useState } from 'react'
|
|
21
21
|
import { useRouter } from '@tanstack/react-router'
|
|
22
22
|
|
|
23
|
-
import { Alert, Button, LoaderEllipsis, Modal } from '@byline/ui'
|
|
23
|
+
import { Alert, Button, LoaderEllipsis, Modal } from '@byline/ui/react'
|
|
24
24
|
import cx from 'classnames'
|
|
25
25
|
|
|
26
26
|
import { type AdminRoleResponse, deleteAdminRole } from '../../server-fns/admin-roles/index.js'
|
|
@@ -12,7 +12,7 @@ import type React from 'react'
|
|
|
12
12
|
import { useState } from 'react'
|
|
13
13
|
import { useRouter } from '@tanstack/react-router'
|
|
14
14
|
|
|
15
|
-
import { Button, CloseIcon, Drawer, EditIcon, IconButton, Modal, useToastManager } from '@byline/ui'
|
|
15
|
+
import { Button, CloseIcon, Drawer, EditIcon, IconButton, Modal, useToastManager } from '@byline/ui/react'
|
|
16
16
|
import { LocalDateTime, SetPassword, UpdateUser, UserRoles } from '@byline/ui/react'
|
|
17
17
|
import cx from 'classnames'
|
|
18
18
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
import { useState } from 'react'
|
|
24
24
|
import { useRouter } from '@tanstack/react-router'
|
|
25
25
|
|
|
26
|
-
import { Alert, Button, LoaderEllipsis, Modal } from '@byline/ui'
|
|
26
|
+
import { Alert, Button, LoaderEllipsis, Modal } from '@byline/ui/react'
|
|
27
27
|
import cx from 'classnames'
|
|
28
28
|
|
|
29
29
|
import { type AdminUserResponse, deleteAdminUser } from '../../server-fns/admin-users/index.js'
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import type { WorkflowStatus } from '@byline/core'
|
|
10
10
|
import { getClientConfig, getWorkflowStatuses } from '@byline/core'
|
|
11
|
-
import { Card, Container, Section } from '@byline/ui'
|
|
11
|
+
import { Card, Container, Section } from '@byline/ui/react'
|
|
12
12
|
import cx from 'classnames'
|
|
13
13
|
|
|
14
14
|
import styles from './dashboard.module.css'
|
|
@@ -12,7 +12,7 @@ import { useRouterState } from '@tanstack/react-router'
|
|
|
12
12
|
import { ADMIN_PERMISSIONS_ABILITIES } from '@byline/admin/admin-permissions'
|
|
13
13
|
import { ADMIN_ROLES_ABILITIES } from '@byline/admin/admin-roles'
|
|
14
14
|
import { ADMIN_USERS_ABILITIES } from '@byline/admin/admin-users'
|
|
15
|
-
import { HomeIcon, RolesIcon, SettingsSlidersIcon, UserIcon, UsersIcon } from '@byline/ui'
|
|
15
|
+
import { HomeIcon, RolesIcon, SettingsSlidersIcon, UserIcon, UsersIcon } from '@byline/ui/react'
|
|
16
16
|
import cx from 'classnames'
|
|
17
17
|
import { useSwipeable } from 'react-swipeable'
|
|
18
18
|
|
|
@@ -16,7 +16,7 @@ import type { ErrorComponentProps, NotFoundRouteProps } from '@tanstack/react-ro
|
|
|
16
16
|
import { useRouter } from '@tanstack/react-router'
|
|
17
17
|
|
|
18
18
|
import { BylineError, ErrorCodes } from '@byline/core'
|
|
19
|
-
import { Alert, Button, Container, Section } from '@byline/ui'
|
|
19
|
+
import { Alert, Button, Container, Section } from '@byline/ui/react'
|
|
20
20
|
import cx from 'classnames'
|
|
21
21
|
|
|
22
22
|
import styles from './route-error.module.css'
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
import { useRouterState } from '@tanstack/react-router'
|
|
10
10
|
|
|
11
|
-
import type { PaginationProps } from '@byline/ui'
|
|
11
|
+
import type { PaginationProps } from '@byline/ui/react'
|
|
12
12
|
import {
|
|
13
13
|
ChevronLeftDoubleIcon,
|
|
14
14
|
ChevronLeftIcon,
|
|
15
15
|
ChevronRightDoubleIcon,
|
|
16
16
|
ChevronRightIcon,
|
|
17
17
|
Pagination,
|
|
18
|
-
} from '@byline/ui'
|
|
18
|
+
} from '@byline/ui/react'
|
|
19
19
|
|
|
20
20
|
import { Link } from './loose-router.js'
|
|
21
21
|
|
|
@@ -10,7 +10,7 @@ import type React from 'react'
|
|
|
10
10
|
import { useEffect, useState } from 'react'
|
|
11
11
|
import { useRouterState } from '@tanstack/react-router'
|
|
12
12
|
|
|
13
|
-
import { Table } from '@byline/ui'
|
|
13
|
+
import { Table } from '@byline/ui/react'
|
|
14
14
|
import cx from 'classnames'
|
|
15
15
|
|
|
16
16
|
import { useNavigate } from './loose-router.js'
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import type { CollectionDefinition } from '@byline/core'
|
|
10
10
|
import type { AnyCollectionSchemaTypes } from '@byline/core/zod-schemas'
|
|
11
|
-
import { Container, Section } from '@byline/ui'
|
|
11
|
+
import { Container, Section } from '@byline/ui/react'
|
|
12
12
|
import cx from 'classnames'
|
|
13
13
|
import { allExpanded, darkStyles, JsonView } from 'react-json-view-lite'
|
|
14
14
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { useState } from 'react'
|
|
10
10
|
|
|
11
11
|
import type { CollectionAdminConfig, CollectionDefinition } from '@byline/core'
|
|
12
|
-
import { Container, Section, useToastManager } from '@byline/ui'
|
|
12
|
+
import { Container, Section, useToastManager } from '@byline/ui/react'
|
|
13
13
|
import { FormRenderer } from '@byline/ui/react'
|
|
14
14
|
|
|
15
15
|
import { createCollectionDocument } from '../../server-fns/collections/index.js'
|
|
@@ -11,7 +11,7 @@ import { useState } from 'react'
|
|
|
11
11
|
import type { CollectionAdminConfig, CollectionDefinition } from '@byline/core'
|
|
12
12
|
import { getDefaultStatus, getWorkflowStatuses } from '@byline/core'
|
|
13
13
|
import type { AnyCollectionSchemaTypes } from '@byline/core/zod-schemas'
|
|
14
|
-
import { Container, Section, useToastManager } from '@byline/ui'
|
|
14
|
+
import { Container, Section, useToastManager } from '@byline/ui/react'
|
|
15
15
|
import { FormRenderer } from '@byline/ui/react'
|
|
16
16
|
|
|
17
17
|
import {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
@media (min-width: 40rem) {
|
|
27
|
+
|
|
27
28
|
.head,
|
|
28
29
|
:global(.byline-coll-history-head) {
|
|
29
30
|
flex-direction: row;
|
|
@@ -73,6 +74,7 @@
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
@media (min-width: 40rem) {
|
|
77
|
+
|
|
76
78
|
.options,
|
|
77
79
|
:global(.byline-coll-history-options) {
|
|
78
80
|
flex-direction: row;
|
|
@@ -143,14 +145,61 @@
|
|
|
143
145
|
opacity: 0.75;
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
.colRestore,
|
|
149
|
+
:global(.byline-coll-history-col-restore) {
|
|
150
|
+
width: 1%;
|
|
151
|
+
white-space: nowrap;
|
|
152
|
+
background-color: var(--gray-50);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:is([data-theme="dark"], :global(.dark)) .colRestore,
|
|
156
|
+
:is([data-theme="dark"], :global(.dark)) :global(.byline-coll-history-col-restore) {
|
|
157
|
+
background-color: oklch(from var(--canvas-800) calc(l * 1.1) c h);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.restoreCell,
|
|
161
|
+
:global(.byline-coll-history-restore-cell) {
|
|
162
|
+
white-space: nowrap;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.restoreButton,
|
|
166
|
+
:global(.byline-coll-history-restore-button) {
|
|
167
|
+
opacity: 0;
|
|
168
|
+
transition: opacity 0.15s ease;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:global(tr:hover) .restoreButton,
|
|
172
|
+
:global(tr:hover .byline-coll-history-restore-button) {
|
|
173
|
+
opacity: 1;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.restoreButton:focus,
|
|
177
|
+
:global(.byline-coll-history-restore-button:focus) {
|
|
178
|
+
opacity: 1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.restoreModal,
|
|
182
|
+
:global(.byline-coll-history-restore-modal) {
|
|
183
|
+
max-width: 32rem;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.restoreModalHead,
|
|
187
|
+
:global(.byline-coll-history-restore-modal-head) {
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
justify-content: space-between;
|
|
191
|
+
margin-bottom: 1rem;
|
|
192
|
+
}
|
|
193
|
+
|
|
146
194
|
.pageSize,
|
|
147
195
|
:global(.byline-coll-history-page-size) {
|
|
148
196
|
/* fallback */
|
|
149
197
|
}
|
|
150
198
|
|
|
151
199
|
@media (min-width: 40rem) {
|
|
200
|
+
|
|
152
201
|
.pageSize,
|
|
153
202
|
:global(.byline-coll-history-page-size) {
|
|
154
203
|
margin-left: auto;
|
|
155
204
|
}
|
|
156
|
-
}
|
|
205
|
+
}
|