@byline/host-tanstack-start 1.11.0 → 1.11.2
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/routes/create-collection-list-route.js +1 -1
- package/dist/server-fns/collections/list.js +2 -3
- package/dist/server-fns/collections/reorder.js +3 -4
- package/package.json +7 -7
- package/src/routes/create-collection-list-route.tsx +1 -1
- package/src/server-fns/collections/list.ts +1 -3
- package/src/server-fns/collections/reorder.ts +2 -4
|
@@ -120,7 +120,7 @@ function createCollectionListRoute(path) {
|
|
|
120
120
|
columns: columns,
|
|
121
121
|
workflowStatuses: workflowStatuses,
|
|
122
122
|
useAsTitle: collectionDef.useAsTitle,
|
|
123
|
-
orderable:
|
|
123
|
+
orderable: true === collectionDef.orderable,
|
|
124
124
|
onReorder: async ({ documentId, beforeDocumentId, afterDocumentId })=>{
|
|
125
125
|
await reorderCollectionDocument({
|
|
126
126
|
data: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createServerFn } from "@tanstack/react-start";
|
|
2
|
-
import { ERR_NOT_FOUND,
|
|
2
|
+
import { ERR_NOT_FOUND, getCollectionSchemasForPath, getLogger, getServerConfig } from "@byline/core";
|
|
3
3
|
import { ensureCollection } from "../../integrations/api-utils.js";
|
|
4
4
|
import { getAdminBylineClient } from "../../integrations/byline-client.js";
|
|
5
5
|
import { serialise } from "./utils.js";
|
|
@@ -20,8 +20,7 @@ const getCollectionDocuments = createServerFn({
|
|
|
20
20
|
const where = {};
|
|
21
21
|
if (params.status) where.status = params.status;
|
|
22
22
|
if (params.query) where.query = params.query;
|
|
23
|
-
const
|
|
24
|
-
const defaultSort = adminConfig?.orderable === true ? {
|
|
23
|
+
const defaultSort = true === config.definition.orderable ? {
|
|
25
24
|
order_key: 'asc'
|
|
26
25
|
} : void 0;
|
|
27
26
|
const sortSpec = params.order ? {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createServerFn } from "@tanstack/react-start";
|
|
2
|
-
import { ERR_NOT_FOUND, ERR_VALIDATION, assertActorCanPerform, generateKeyBetween, generateNKeysBetween,
|
|
2
|
+
import { ERR_NOT_FOUND, ERR_VALIDATION, assertActorCanPerform, generateKeyBetween, generateNKeysBetween, getLogger, getServerConfig } from "@byline/core";
|
|
3
3
|
import { getAdminRequestContext } from "../../auth/auth-context.js";
|
|
4
4
|
import { ensureCollection } from "../../integrations/api-utils.js";
|
|
5
5
|
const reorderCollectionDocument = createServerFn({
|
|
@@ -14,9 +14,8 @@ const reorderCollectionDocument = createServerFn({
|
|
|
14
14
|
collectionPath: path
|
|
15
15
|
}
|
|
16
16
|
}).log(logger);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
message: `collection '${path}' is not orderable; set \`orderable: true\` on its admin config to enable reordering`,
|
|
17
|
+
if (true !== config.definition.orderable) throw ERR_VALIDATION({
|
|
18
|
+
message: `collection '${path}' is not orderable; set \`orderable: true\` on its collection definition to enable reordering`,
|
|
20
19
|
details: {
|
|
21
20
|
collectionPath: path
|
|
22
21
|
}
|
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.11.
|
|
6
|
+
"version": "1.11.2",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20.9.0"
|
|
9
9
|
},
|
|
@@ -107,12 +107,12 @@
|
|
|
107
107
|
"react-swipeable": "^7.0.2",
|
|
108
108
|
"uuid": "^14.0.0",
|
|
109
109
|
"zod": "^4.4.3",
|
|
110
|
-
"@byline/
|
|
111
|
-
"@byline/auth": "1.11.
|
|
112
|
-
"@byline/ai": "1.11.
|
|
113
|
-
"@byline/
|
|
114
|
-
"@byline/core": "1.11.
|
|
115
|
-
"@byline/
|
|
110
|
+
"@byline/client": "1.11.2",
|
|
111
|
+
"@byline/auth": "1.11.2",
|
|
112
|
+
"@byline/ai": "1.11.2",
|
|
113
|
+
"@byline/ui": "1.11.2",
|
|
114
|
+
"@byline/core": "1.11.2",
|
|
115
|
+
"@byline/admin": "1.11.2"
|
|
116
116
|
},
|
|
117
117
|
"peerDependencies": {
|
|
118
118
|
"@tanstack/react-router": "^1.167.0",
|
|
@@ -167,7 +167,7 @@ export function createCollectionListRoute(path: string) {
|
|
|
167
167
|
columns={columns}
|
|
168
168
|
workflowStatuses={workflowStatuses}
|
|
169
169
|
useAsTitle={collectionDef.useAsTitle}
|
|
170
|
-
orderable={
|
|
170
|
+
orderable={collectionDef.orderable === true}
|
|
171
171
|
onReorder={async ({ documentId, beforeDocumentId, afterDocumentId }) => {
|
|
172
172
|
await reorderCollectionDocument({
|
|
173
173
|
data: {
|
|
@@ -10,7 +10,6 @@ import { createServerFn } from '@tanstack/react-start'
|
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
12
|
ERR_NOT_FOUND,
|
|
13
|
-
getCollectionAdminConfig,
|
|
14
13
|
getCollectionSchemasForPath,
|
|
15
14
|
getLogger,
|
|
16
15
|
getServerConfig,
|
|
@@ -69,9 +68,8 @@ export const getCollectionDocuments = createServerFn({ method: 'GET' })
|
|
|
69
68
|
// Default sort for `orderable: true` collections is the fractional
|
|
70
69
|
// `order_key` ascending. Caller's explicit `params.order` always wins
|
|
71
70
|
// so the admin can re-sort by other columns without surprise.
|
|
72
|
-
const adminConfig = getCollectionAdminConfig(path)
|
|
73
71
|
const defaultSort: Record<string, 'asc' | 'desc'> | undefined =
|
|
74
|
-
|
|
72
|
+
config.definition.orderable === true ? { order_key: 'asc' } : undefined
|
|
75
73
|
const sortSpec: Record<string, 'asc' | 'desc'> | undefined = params.order
|
|
76
74
|
? { [params.order]: params.desc === false ? 'asc' : 'desc' }
|
|
77
75
|
: defaultSort
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
ERR_VALIDATION,
|
|
15
15
|
generateKeyBetween,
|
|
16
16
|
generateNKeysBetween,
|
|
17
|
-
getCollectionAdminConfig,
|
|
18
17
|
getLogger,
|
|
19
18
|
getServerConfig,
|
|
20
19
|
} from '@byline/core'
|
|
@@ -59,10 +58,9 @@ export const reorderCollectionDocument = createServerFn({ method: 'POST' })
|
|
|
59
58
|
}).log(logger)
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
if (adminConfig?.orderable !== true) {
|
|
61
|
+
if (config.definition.orderable !== true) {
|
|
64
62
|
throw ERR_VALIDATION({
|
|
65
|
-
message: `collection '${path}' is not orderable; set \`orderable: true\` on its
|
|
63
|
+
message: `collection '${path}' is not orderable; set \`orderable: true\` on its collection definition to enable reordering`,
|
|
66
64
|
details: { collectionPath: path },
|
|
67
65
|
}).log(logger)
|
|
68
66
|
}
|