@byline/host-tanstack-start 4.16.0 → 4.18.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 (153) hide show
  1. package/dist/admin-shell/chrome/admin-menu-drawer.js +14 -14
  2. package/dist/admin-shell/chrome/dashboard.js +41 -5
  3. package/dist/admin-shell/chrome/dashboard.test.d.ts +8 -0
  4. package/dist/admin-shell/chrome/router-pager.d.ts +7 -0
  5. package/dist/admin-shell/chrome/router-pager.js +13 -0
  6. package/dist/admin-shell/chrome/scroll-to-top.d.ts +20 -0
  7. package/dist/admin-shell/chrome/scroll-to-top.js +9 -0
  8. package/dist/admin-shell/collections/api.d.ts +2 -2
  9. package/dist/admin-shell/collections/create.d.ts +2 -2
  10. package/dist/admin-shell/collections/create.js +1 -0
  11. package/dist/admin-shell/collections/edit.d.ts +2 -2
  12. package/dist/admin-shell/collections/edit.js +1 -0
  13. package/dist/admin-shell/collections/history.d.ts +4 -12
  14. package/dist/admin-shell/collections/history.js +112 -303
  15. package/dist/admin-shell/collections/reindex-button.d.ts +1 -1
  16. package/dist/admin-shell/collections/reindex-button.js +5 -1
  17. package/dist/admin-shell/collections/restore-version-modal.d.ts +4 -4
  18. package/dist/admin-shell/collections/restore-version-modal.js +8 -24
  19. package/dist/admin-shell/collections/version-history.d.ts +72 -0
  20. package/dist/admin-shell/collections/version-history.js +259 -0
  21. package/dist/admin-shell/singletons/history.d.ts +19 -0
  22. package/dist/admin-shell/singletons/history.js +170 -0
  23. package/dist/admin-shell/singletons/history.test.d.ts +8 -0
  24. package/dist/admin-shell/singletons/preview-link.d.ts +12 -0
  25. package/dist/admin-shell/singletons/preview-link.js +54 -0
  26. package/dist/admin-shell/singletons/view-menu.d.ts +13 -0
  27. package/dist/admin-shell/singletons/view-menu.js +116 -0
  28. package/dist/admin-shell/singletons/view.d.ts +18 -0
  29. package/dist/admin-shell/singletons/view.js +259 -0
  30. package/dist/admin-shell/singletons/view.test.d.ts +8 -0
  31. package/dist/integrations/api-utils.d.ts +18 -4
  32. package/dist/integrations/api-utils.js +10 -3
  33. package/dist/routes/create-admin-dashboard-route.js +2 -2
  34. package/dist/routes/create-collection-api-route.js +3 -3
  35. package/dist/routes/create-collection-create-route.js +4 -3
  36. package/dist/routes/create-collection-edit-route.js +4 -3
  37. package/dist/routes/create-collection-history-route.js +4 -3
  38. package/dist/routes/create-collection-list-route.js +4 -3
  39. package/dist/routes/create-singleton-history-route.d.ts +8 -0
  40. package/dist/routes/create-singleton-history-route.js +99 -0
  41. package/dist/routes/create-singleton-route.d.ts +35 -0
  42. package/dist/routes/create-singleton-route.js +130 -0
  43. package/dist/routes/get-multi-collection-definition.d.ts +10 -0
  44. package/dist/routes/get-multi-collection-definition.js +6 -0
  45. package/dist/routes/get-singleton-definition.d.ts +10 -0
  46. package/dist/routes/get-singleton-definition.js +6 -0
  47. package/dist/routes/index.d.ts +2 -0
  48. package/dist/routes/index.js +2 -0
  49. package/dist/server-fns/actors.d.ts +16 -0
  50. package/dist/server-fns/actors.js +25 -0
  51. package/dist/server-fns/admin-document-presentation.d.ts +30 -0
  52. package/dist/server-fns/admin-document-presentation.js +32 -0
  53. package/dist/server-fns/collections/actors.d.ts +1 -10
  54. package/dist/server-fns/collections/actors.js +1 -25
  55. package/dist/server-fns/collections/get.js +9 -26
  56. package/dist/server-fns/collections/reorder.js +1 -1
  57. package/dist/server-fns/collections/scheduled-publication.js +2 -2
  58. package/dist/server-fns/collections/upload.js +3 -3
  59. package/dist/server-fns/collections/utils.d.ts +1 -7
  60. package/dist/server-fns/collections/utils.js +1 -4
  61. package/dist/server-fns/serialise.d.ts +14 -0
  62. package/dist/server-fns/serialise.js +4 -0
  63. package/dist/server-fns/singleton-document-read.d.ts +20 -0
  64. package/dist/server-fns/singleton-document-read.js +10 -0
  65. package/dist/server-fns/singletons/cancel-scheduled-publish.d.ts +12 -0
  66. package/dist/server-fns/singletons/cancel-scheduled-publish.js +7 -0
  67. package/dist/server-fns/singletons/change-status.d.ts +14 -0
  68. package/dist/server-fns/singletons/change-status.js +7 -0
  69. package/dist/server-fns/singletons/confirm-scheduled-publish.d.ts +14 -0
  70. package/dist/server-fns/singletons/confirm-scheduled-publish.js +9 -0
  71. package/dist/server-fns/singletons/copy-to-locale.d.ts +18 -0
  72. package/dist/server-fns/singletons/copy-to-locale.js +11 -0
  73. package/dist/server-fns/singletons/find-by-version.d.ts +16 -0
  74. package/dist/server-fns/singletons/find-by-version.js +9 -0
  75. package/dist/server-fns/singletons/get-scheduled-publish.d.ts +12 -0
  76. package/dist/server-fns/singletons/get-scheduled-publish.js +7 -0
  77. package/dist/server-fns/singletons/get.d.ts +24 -0
  78. package/dist/server-fns/singletons/get.js +6 -0
  79. package/dist/server-fns/singletons/history.d.ts +31 -0
  80. package/dist/server-fns/singletons/history.js +22 -0
  81. package/dist/server-fns/singletons/index.d.ts +19 -0
  82. package/dist/server-fns/singletons/index.js +12 -0
  83. package/dist/server-fns/singletons/restore-version.d.ts +14 -0
  84. package/dist/server-fns/singletons/restore-version.js +7 -0
  85. package/dist/server-fns/singletons/schedule-publish.d.ts +16 -0
  86. package/dist/server-fns/singletons/schedule-publish.js +10 -0
  87. package/dist/server-fns/singletons/unpublish.d.ts +12 -0
  88. package/dist/server-fns/singletons/unpublish.js +7 -0
  89. package/dist/server-fns/singletons/update.d.ts +14 -0
  90. package/dist/server-fns/singletons/update.js +14 -0
  91. package/dist/vitest-jsdom.test.d.ts +8 -0
  92. package/package.json +24 -18
  93. package/src/admin-shell/chrome/admin-menu-drawer.tsx +13 -13
  94. package/src/admin-shell/chrome/dashboard.test.tsx +199 -0
  95. package/src/admin-shell/chrome/dashboard.tsx +43 -9
  96. package/src/admin-shell/chrome/router-pager.tsx +22 -0
  97. package/src/admin-shell/chrome/scroll-to-top.test.ts +56 -0
  98. package/src/admin-shell/chrome/scroll-to-top.ts +28 -0
  99. package/src/admin-shell/collections/api.tsx +2 -2
  100. package/src/admin-shell/collections/create.tsx +6 -2
  101. package/src/admin-shell/collections/edit.tsx +6 -2
  102. package/src/admin-shell/collections/history.module.css +1 -1
  103. package/src/admin-shell/collections/history.tsx +162 -442
  104. package/src/admin-shell/collections/reindex-button.tsx +4 -2
  105. package/src/admin-shell/collections/restore-version-modal.tsx +19 -25
  106. package/src/admin-shell/collections/version-history.tsx +349 -0
  107. package/src/admin-shell/singletons/history.test.tsx +407 -0
  108. package/src/admin-shell/singletons/history.tsx +185 -0
  109. package/src/admin-shell/singletons/preview-link.tsx +75 -0
  110. package/src/admin-shell/singletons/view-menu.tsx +136 -0
  111. package/src/admin-shell/singletons/view.test.tsx +400 -0
  112. package/src/admin-shell/singletons/view.tsx +351 -0
  113. package/src/integrations/api-utils.ts +34 -9
  114. package/src/routes/create-admin-dashboard-route.test.node.ts +70 -0
  115. package/src/routes/create-admin-dashboard-route.tsx +10 -2
  116. package/src/routes/create-collection-api-route.tsx +4 -4
  117. package/src/routes/create-collection-create-route.tsx +5 -8
  118. package/src/routes/create-collection-edit-route.tsx +5 -4
  119. package/src/routes/create-collection-history-route.tsx +5 -8
  120. package/src/routes/create-collection-list-route.tsx +5 -8
  121. package/src/routes/create-singleton-history-route.test.node.ts +148 -0
  122. package/src/routes/create-singleton-history-route.tsx +116 -0
  123. package/src/routes/create-singleton-route.test.node.ts +172 -0
  124. package/src/routes/create-singleton-route.tsx +176 -0
  125. package/src/routes/get-multi-collection-definition.ts +16 -0
  126. package/src/routes/get-singleton-definition.ts +16 -0
  127. package/src/routes/index.ts +2 -0
  128. package/src/server-fns/actors.ts +43 -0
  129. package/src/server-fns/admin-document-presentation.ts +78 -0
  130. package/src/server-fns/collections/actors.ts +1 -52
  131. package/src/server-fns/collections/get.ts +10 -49
  132. package/src/server-fns/collections/reorder.ts +1 -1
  133. package/src/server-fns/collections/scheduled-publication.ts +7 -1
  134. package/src/server-fns/collections/upload-singleton.test.node.ts +164 -0
  135. package/src/server-fns/collections/upload.ts +7 -3
  136. package/src/server-fns/collections/utils.ts +1 -9
  137. package/src/server-fns/serialise.ts +17 -0
  138. package/src/server-fns/singleton-document-read.ts +32 -0
  139. package/src/server-fns/singletons/cancel-scheduled-publish.ts +19 -0
  140. package/src/server-fns/singletons/change-status.ts +19 -0
  141. package/src/server-fns/singletons/confirm-scheduled-publish.ts +23 -0
  142. package/src/server-fns/singletons/copy-to-locale.ts +32 -0
  143. package/src/server-fns/singletons/find-by-version.ts +23 -0
  144. package/src/server-fns/singletons/get-scheduled-publish.ts +19 -0
  145. package/src/server-fns/singletons/get.ts +32 -0
  146. package/src/server-fns/singletons/history.ts +41 -0
  147. package/src/server-fns/singletons/index.ts +20 -0
  148. package/src/server-fns/singletons/restore-version.ts +19 -0
  149. package/src/server-fns/singletons/schedule-publish.ts +24 -0
  150. package/src/server-fns/singletons/singletons.test.node.ts +298 -0
  151. package/src/server-fns/singletons/unpublish.ts +19 -0
  152. package/src/server-fns/singletons/update.ts +31 -0
  153. package/src/vitest-jsdom.test.tsx +27 -0
@@ -0,0 +1,10 @@
1
+ import { getAdminBylineClient } from "@byline/client/server";
2
+ import { getCollectionDefinition } from "@byline/core";
3
+ import { resolveAdminDocumentRead } from "./admin-document-presentation.js";
4
+ import { serialise } from "./serialise.js";
5
+ async function readSingletonDocument(data) {
6
+ const handle = getAdminBylineClient().singleton(data.singleton);
7
+ const { options } = resolveAdminDocumentRead(getCollectionDefinition(data.singleton), data);
8
+ return serialise(await handle.get(options));
9
+ }
10
+ export { readSingletonDocument };
@@ -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
+ export declare const cancelSingletonScheduledPublish: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
9
+ singleton: string;
10
+ }) => {
11
+ singleton: string;
12
+ }, Promise<import("@byline/client").DocumentPublishScheduleInfo | null>>;
@@ -0,0 +1,7 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { serialise } from "../serialise.js";
4
+ const cancelSingletonScheduledPublish = createServerFn({
5
+ method: 'POST'
6
+ }).validator((input)=>input).handler(async ({ data })=>serialise(await getAdminBylineClient().singleton(data.singleton).cancelScheduledPublish()));
7
+ export { cancelSingletonScheduledPublish };
@@ -0,0 +1,14 @@
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 changeSingletonStatus: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
9
+ singleton: string;
10
+ status: string;
11
+ }) => {
12
+ singleton: string;
13
+ status: string;
14
+ }, Promise<import("@byline/core").ChangeStatusResult>>;
@@ -0,0 +1,7 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { serialise } from "../serialise.js";
4
+ const changeSingletonStatus = createServerFn({
5
+ method: 'POST'
6
+ }).validator((input)=>input).handler(async ({ data })=>serialise(await getAdminBylineClient().singleton(data.singleton).changeStatus(data.status)));
7
+ export { changeSingletonStatus };
@@ -0,0 +1,14 @@
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 confirmSingletonScheduledPublish: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
9
+ singleton: string;
10
+ expectedVersionId: string;
11
+ }) => {
12
+ singleton: string;
13
+ expectedVersionId: string;
14
+ }, Promise<import("@byline/client").DocumentPublishScheduleInfo>>;
@@ -0,0 +1,9 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { serialise } from "../serialise.js";
4
+ const confirmSingletonScheduledPublish = createServerFn({
5
+ method: 'POST'
6
+ }).validator((input)=>input).handler(async ({ data })=>serialise(await getAdminBylineClient().singleton(data.singleton).confirmScheduledPublish({
7
+ expectedVersionId: data.expectedVersionId
8
+ })));
9
+ export { confirmSingletonScheduledPublish };
@@ -0,0 +1,18 @@
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 copySingletonToLocale: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
9
+ singleton: string;
10
+ sourceLocale: string;
11
+ targetLocale: string;
12
+ overwrite?: boolean;
13
+ }) => {
14
+ singleton: string;
15
+ sourceLocale: string;
16
+ targetLocale: string;
17
+ overwrite?: boolean;
18
+ }, Promise<import("@byline/core").SingletonSaveResult>>;
@@ -0,0 +1,11 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { serialise } from "../serialise.js";
4
+ const copySingletonToLocale = createServerFn({
5
+ method: 'POST'
6
+ }).validator((input)=>input).handler(async ({ data })=>serialise(await getAdminBylineClient().singleton(data.singleton).copyToLocale({
7
+ sourceLocale: data.sourceLocale,
8
+ targetLocale: data.targetLocale,
9
+ overwrite: data.overwrite
10
+ })));
11
+ export { copySingletonToLocale };
@@ -0,0 +1,16 @@
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 findSingletonByVersion: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
9
+ singleton: string;
10
+ versionId: string;
11
+ locale?: string;
12
+ }) => {
13
+ singleton: string;
14
+ versionId: string;
15
+ locale?: string;
16
+ }, Promise<import("@byline/client").ClientDocument<Record<string, any>> | null>>;
@@ -0,0 +1,9 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { serialise } from "../serialise.js";
4
+ const findSingletonByVersion = createServerFn({
5
+ method: 'GET'
6
+ }).validator((input)=>input).handler(async ({ data })=>serialise(await getAdminBylineClient().singleton(data.singleton).findByVersion(data.versionId, {
7
+ locale: data.locale ?? 'all'
8
+ })));
9
+ export { findSingletonByVersion };
@@ -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
+ export declare const getSingletonScheduledPublish: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
9
+ singleton: string;
10
+ }) => {
11
+ singleton: string;
12
+ }, Promise<import("@byline/client").DocumentPublishScheduleInfo | null>>;
@@ -0,0 +1,7 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { serialise } from "../serialise.js";
4
+ const getSingletonScheduledPublish = createServerFn({
5
+ method: 'GET'
6
+ }).validator((input)=>input).handler(async ({ data })=>serialise(await getAdminBylineClient().singleton(data.singleton).getScheduledPublish()));
7
+ export { getSingletonScheduledPublish };
@@ -0,0 +1,24 @@
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 interface GetSingletonInput {
9
+ singleton: string;
10
+ locale?: string;
11
+ depth?: number;
12
+ populateRelations?: boolean;
13
+ }
14
+ /**
15
+ * Task 4 singleton-loader contract:
16
+ *
17
+ * - this shared host layer owns lenient reads, raw missing-locale values,
18
+ * relation-summary population, transport serialization, and preservation of
19
+ * restore warnings and locale metadata;
20
+ * - the route loader composes published-version metadata plus scheduled-
21
+ * publication enablement, capability, and schedule aliases because those
22
+ * require host-only database and actor context beyond the singleton handle.
23
+ */
24
+ export declare const getSingleton: import("@tanstack/react-start").RequiredFetcher<undefined, (input: GetSingletonInput) => GetSingletonInput, Promise<import("@byline/client").SingletonDocument<Record<string, any>> | null>>;
@@ -0,0 +1,6 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { readSingletonDocument } from "../singleton-document-read.js";
3
+ const getSingleton = createServerFn({
4
+ method: 'GET'
5
+ }).validator((input)=>input).handler(async ({ data })=>readSingletonDocument(data));
6
+ export { getSingleton };
@@ -0,0 +1,31 @@
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 ActorLabelMap } from '../actors.js';
9
+ export interface SingletonHistorySearchParams {
10
+ page?: number;
11
+ page_size?: number;
12
+ order?: string;
13
+ desc?: boolean;
14
+ locale?: string;
15
+ }
16
+ export declare const getSingletonHistory: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
17
+ singleton: string;
18
+ params?: SingletonHistorySearchParams;
19
+ }) => {
20
+ singleton: string;
21
+ params?: SingletonHistorySearchParams;
22
+ }, Promise<{
23
+ docs: import("@byline/client").ClientDocument<Record<string, any>>[];
24
+ meta: {
25
+ total: number;
26
+ page: number;
27
+ pageSize: number;
28
+ totalPages: number;
29
+ };
30
+ actors: ActorLabelMap;
31
+ }>>;
@@ -0,0 +1,22 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { resolveActorLabels } from "../actors.js";
4
+ import { serialise } from "../serialise.js";
5
+ const getSingletonHistory = createServerFn({
6
+ method: 'GET'
7
+ }).validator((input)=>input).handler(async ({ data })=>{
8
+ const params = data.params ?? {};
9
+ const result = await getAdminBylineClient().singleton(data.singleton).history({
10
+ locale: params.locale ?? 'en',
11
+ page: params.page,
12
+ pageSize: params.page_size,
13
+ order: params.order,
14
+ desc: params.desc
15
+ });
16
+ const actors = await resolveActorLabels(result.docs.map((item)=>item.createdBy));
17
+ return {
18
+ ...serialise(result),
19
+ actors
20
+ };
21
+ });
22
+ export { getSingletonHistory };
@@ -0,0 +1,19 @@
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 * from './cancel-scheduled-publish.js';
9
+ export * from './change-status.js';
10
+ export * from './confirm-scheduled-publish.js';
11
+ export * from './copy-to-locale.js';
12
+ export * from './find-by-version.js';
13
+ export * from './get.js';
14
+ export * from './get-scheduled-publish.js';
15
+ export * from './history.js';
16
+ export * from './restore-version.js';
17
+ export * from './schedule-publish.js';
18
+ export * from './unpublish.js';
19
+ export * from './update.js';
@@ -0,0 +1,12 @@
1
+ export * from "./cancel-scheduled-publish.js";
2
+ export * from "./change-status.js";
3
+ export * from "./confirm-scheduled-publish.js";
4
+ export * from "./copy-to-locale.js";
5
+ export * from "./find-by-version.js";
6
+ export * from "./get.js";
7
+ export * from "./get-scheduled-publish.js";
8
+ export * from "./history.js";
9
+ export * from "./restore-version.js";
10
+ export * from "./schedule-publish.js";
11
+ export * from "./unpublish.js";
12
+ export * from "./update.js";
@@ -0,0 +1,14 @@
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 restoreSingletonVersion: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
9
+ singleton: string;
10
+ versionId: string;
11
+ }) => {
12
+ singleton: string;
13
+ versionId: string;
14
+ }, Promise<import("@byline/core").SingletonSaveResult>>;
@@ -0,0 +1,7 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { serialise } from "../serialise.js";
4
+ const restoreSingletonVersion = createServerFn({
5
+ method: 'POST'
6
+ }).validator((input)=>input).handler(async ({ data })=>serialise(await getAdminBylineClient().singleton(data.singleton).restoreVersion(data.versionId)));
7
+ export { restoreSingletonVersion };
@@ -0,0 +1,16 @@
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 scheduleSingletonPublish: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
9
+ singleton: string;
10
+ publishAt: string;
11
+ expectedVersionId: string;
12
+ }) => {
13
+ singleton: string;
14
+ publishAt: string;
15
+ expectedVersionId: string;
16
+ }, Promise<import("@byline/client").DocumentPublishScheduleInfo>>;
@@ -0,0 +1,10 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { serialise } from "../serialise.js";
4
+ const scheduleSingletonPublish = createServerFn({
5
+ method: 'POST'
6
+ }).validator((input)=>input).handler(async ({ data })=>serialise(await getAdminBylineClient().singleton(data.singleton).schedulePublish({
7
+ publishAt: data.publishAt,
8
+ expectedVersionId: data.expectedVersionId
9
+ })));
10
+ export { scheduleSingletonPublish };
@@ -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
+ export declare const unpublishSingleton: import("@tanstack/react-start").RequiredFetcher<undefined, (input: {
9
+ singleton: string;
10
+ }) => {
11
+ singleton: string;
12
+ }, Promise<import("@byline/core").UnpublishResult>>;
@@ -0,0 +1,7 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { serialise } from "../serialise.js";
4
+ const unpublishSingleton = createServerFn({
5
+ method: 'POST'
6
+ }).validator((input)=>input).handler(async ({ data })=>serialise(await getAdminBylineClient().singleton(data.singleton).unpublish()));
7
+ export { unpublishSingleton };
@@ -0,0 +1,14 @@
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 interface UpdateSingletonInput {
9
+ singleton: string;
10
+ data: Record<string, any>;
11
+ locale?: string;
12
+ expectedVersionId?: string;
13
+ }
14
+ export declare const updateSingleton: import("@tanstack/react-start").RequiredFetcher<undefined, (input: UpdateSingletonInput) => UpdateSingletonInput, Promise<import("@byline/core").SingletonSaveResult>>;
@@ -0,0 +1,14 @@
1
+ import { createServerFn } from "@tanstack/react-start";
2
+ import { getAdminBylineClient } from "@byline/client/server";
3
+ import { serialise } from "../serialise.js";
4
+ const updateSingleton = createServerFn({
5
+ method: 'POST'
6
+ }).validator((input)=>input).handler(async ({ data })=>{
7
+ const { singleton, data: fields, locale, expectedVersionId } = data;
8
+ const result = await getAdminBylineClient().singleton(singleton).update(fields, {
9
+ locale,
10
+ expectedVersionId
11
+ });
12
+ return serialise(result);
13
+ });
14
+ export { updateSingleton };
@@ -0,0 +1,8 @@
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 {};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "license": "MPL-2.0",
6
- "version": "4.16.0",
6
+ "version": "4.18.0",
7
7
  "engines": {
8
8
  "node": ">=20.9.0"
9
9
  },
@@ -77,6 +77,10 @@
77
77
  "types": "./dist/server-fns/collections/index.d.ts",
78
78
  "import": "./dist/server-fns/collections/index.js"
79
79
  },
80
+ "./server-fns/singletons": {
81
+ "types": "./dist/server-fns/singletons/index.d.ts",
82
+ "import": "./dist/server-fns/singletons/index.js"
83
+ },
80
84
  "./i18n": {
81
85
  "types": "./dist/i18n/index.d.ts",
82
86
  "import": "./dist/i18n/index.js"
@@ -121,15 +125,15 @@
121
125
  "react-json-view-lite": "^2.5.0",
122
126
  "react-swipeable": "^7.0.2",
123
127
  "zod": "^4.4.3",
124
- "@byline/admin": "4.16.0",
125
- "@byline/analytics-agent": "4.16.0",
126
- "@byline/ai": "4.16.0",
127
- "@byline/analytics": "4.16.0",
128
- "@byline/client": "4.16.0",
129
- "@byline/core": "4.16.0",
130
- "@byline/auth": "4.16.0",
131
- "@byline/i18n": "4.16.0",
132
- "@byline/ui": "4.16.0"
128
+ "@byline/admin": "4.18.0",
129
+ "@byline/ai": "4.18.0",
130
+ "@byline/analytics-agent": "4.18.0",
131
+ "@byline/client": "4.18.0",
132
+ "@byline/auth": "4.18.0",
133
+ "@byline/analytics": "4.18.0",
134
+ "@byline/i18n": "4.18.0",
135
+ "@byline/core": "4.18.0",
136
+ "@byline/ui": "4.18.0"
133
137
  },
134
138
  "peerDependencies": {
135
139
  "@tanstack/react-router": "^1.167.0",
@@ -139,19 +143,19 @@
139
143
  "vite": "^8.0.0"
140
144
  },
141
145
  "devDependencies": {
142
- "@biomejs/biome": "2.5.9",
146
+ "@biomejs/biome": "2.5.10",
143
147
  "@rsbuild/plugin-react": "^2.1.0",
144
148
  "@rslib/core": "^0.23.2",
145
- "@tanstack/react-router": "^1.170.31",
146
- "@tanstack/react-start": "^1.168.48",
147
- "@types/node": "^26.2.0",
149
+ "@tanstack/react-router": "^1.170.32",
150
+ "@tanstack/react-start": "^1.168.49",
151
+ "@types/node": "^26.4.0",
148
152
  "@types/react": "19.2.18",
149
- "@types/react-dom": "19.2.4",
150
- "lightningcss": "^1.33.0",
153
+ "@types/react-dom": "19.2.5",
154
+ "@vitejs/plugin-react": "^6.1.0",
155
+ "jsdom": "^30.0.1",
151
156
  "npm-run-all": "^4.1.5",
152
157
  "react": "^19.2.8",
153
158
  "react-dom": "^19.2.8",
154
- "rimraf": "^6.1.3",
155
159
  "typescript": "^7.0.2",
156
160
  "typescript-plugin-css-modules": "^5.2.0",
157
161
  "vite": "^8.2.2",
@@ -173,6 +177,8 @@
173
177
  "typecheck": "tsc --noEmit",
174
178
  "clean": "node scripts/clean.js node_modules dist build types .turbo",
175
179
  "lint": "biome check --write --unsafe --diagnostic-level=error",
176
- "test": "vitest run --mode=node"
180
+ "test": "vitest run --mode=jsdom && vitest run --mode=node",
181
+ "test:jsdom": "vitest run --mode=jsdom",
182
+ "test:node": "vitest run --mode=node"
177
183
  }
178
184
  }
@@ -14,13 +14,13 @@ import { ADMIN_PERMISSIONS_ABILITIES } from '@byline/admin/admin-permissions'
14
14
  import { ADMIN_ROLES_ABILITIES } from '@byline/admin/admin-roles'
15
15
  import { ADMIN_USERS_ABILITIES } from '@byline/admin/admin-users'
16
16
  import { ANALYTICS_ABILITIES } from '@byline/admin/analytics'
17
- import { collectionAbilityKey, getAdminConfig } from '@byline/core'
17
+ import { documentAbilityKey, getAdminConfig } from '@byline/core'
18
18
  import { useTranslation } from '@byline/i18n/react'
19
19
  import {
20
20
  ActivityIcon,
21
21
  AnalyticsIcon,
22
22
  CalendarIcon,
23
- HomeIcon,
23
+ DashboardIcon,
24
24
  RolesIcon,
25
25
  SettingsSlidersIcon,
26
26
  Tooltip,
@@ -105,8 +105,8 @@ export function AdminMenuDrawer({
105
105
  scheduledPublicationEnabled &&
106
106
  getAdminConfig().collections.some(
107
107
  (collection) =>
108
- has(collectionAbilityKey(collection.path, 'changeStatus')) &&
109
- has(collectionAbilityKey(collection.path, 'publish'))
108
+ has(documentAbilityKey(collection, 'changeStatus')) &&
109
+ has(documentAbilityKey(collection, 'publish'))
110
110
  )
111
111
  const showAdminSection = canReadUsers || canReadRoles || canReadPermissions || canReadActivity
112
112
 
@@ -144,24 +144,24 @@ export function AdminMenuDrawer({
144
144
  <MenuItem
145
145
  to={getAdminRoutePath()}
146
146
  label={t('chrome.menu.dashboard')}
147
- icon={<HomeIcon width="20px" height="20px" />}
147
+ icon={<DashboardIcon width="20px" height="20px" />}
148
148
  pathname={pathname}
149
149
  compact={compact}
150
150
  />
151
- {canSeeScheduledPublications && (
151
+ {canReadAnalytics && (
152
152
  <MenuItem
153
- to={getAdminRoutePath('scheduled-publications')}
154
- label={t('chrome.menu.scheduledPublications')}
155
- icon={<CalendarIcon width="18px" height="18px" />}
153
+ to={getAdminRoutePath('analytics')}
154
+ label={t('chrome.menu.analytics')}
155
+ icon={<AnalyticsIcon width="20px" height="20px" />}
156
156
  pathname={pathname}
157
157
  compact={compact}
158
158
  />
159
159
  )}
160
- {canReadAnalytics && (
160
+ {canSeeScheduledPublications && (
161
161
  <MenuItem
162
- to={getAdminRoutePath('analytics')}
163
- label={t('chrome.menu.analytics')}
164
- icon={<AnalyticsIcon width="20px" height="20px" />}
162
+ to={getAdminRoutePath('scheduled-publications')}
163
+ label={t('chrome.menu.scheduledPublications')}
164
+ icon={<CalendarIcon width="18px" height="18px" />}
165
165
  pathname={pathname}
166
166
  compact={compact}
167
167
  />