@byline/host-tanstack-start 4.15.0 → 4.17.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 (183) hide show
  1. package/dist/admin-shell/chrome/admin-menu-drawer.d.ts +2 -1
  2. package/dist/admin-shell/chrome/admin-menu-drawer.js +17 -5
  3. package/dist/admin-shell/chrome/dashboard.js +41 -5
  4. package/dist/admin-shell/chrome/dashboard.test.d.ts +8 -0
  5. package/dist/admin-shell/collections/api.d.ts +2 -2
  6. package/dist/admin-shell/collections/create.d.ts +2 -2
  7. package/dist/admin-shell/collections/create.js +1 -0
  8. package/dist/admin-shell/collections/edit.d.ts +2 -2
  9. package/dist/admin-shell/collections/edit.js +1 -0
  10. package/dist/admin-shell/collections/history.d.ts +4 -12
  11. package/dist/admin-shell/collections/history.js +112 -303
  12. package/dist/admin-shell/collections/reindex-button.d.ts +1 -1
  13. package/dist/admin-shell/collections/reindex-button.js +5 -1
  14. package/dist/admin-shell/collections/restore-version-modal.d.ts +4 -4
  15. package/dist/admin-shell/collections/restore-version-modal.js +8 -24
  16. package/dist/admin-shell/collections/version-history.d.ts +72 -0
  17. package/dist/admin-shell/collections/version-history.js +259 -0
  18. package/dist/admin-shell/singletons/history.d.ts +19 -0
  19. package/dist/admin-shell/singletons/history.js +170 -0
  20. package/dist/admin-shell/singletons/history.test.d.ts +8 -0
  21. package/dist/admin-shell/singletons/preview-link.d.ts +12 -0
  22. package/dist/admin-shell/singletons/preview-link.js +54 -0
  23. package/dist/admin-shell/singletons/view-menu.d.ts +13 -0
  24. package/dist/admin-shell/singletons/view-menu.js +116 -0
  25. package/dist/admin-shell/singletons/view.d.ts +18 -0
  26. package/dist/admin-shell/singletons/view.js +259 -0
  27. package/dist/admin-shell/singletons/view.test.d.ts +8 -0
  28. package/dist/integrations/analytics-agent.d.ts +20 -0
  29. package/dist/integrations/analytics-agent.js +57 -0
  30. package/dist/integrations/analytics-events.d.ts +51 -0
  31. package/dist/integrations/analytics-events.js +129 -0
  32. package/dist/integrations/api-utils.d.ts +18 -4
  33. package/dist/integrations/api-utils.js +10 -3
  34. package/dist/integrations/serve-analytics-agent.d.ts +8 -0
  35. package/dist/integrations/serve-analytics-agent.js +11 -0
  36. package/dist/routes/analytics-range.d.ts +12 -0
  37. package/dist/routes/analytics-range.js +35 -0
  38. package/dist/routes/create-admin-analytics-route.d.ts +8 -0
  39. package/dist/routes/create-admin-analytics-route.js +108 -0
  40. package/dist/routes/create-admin-dashboard-route.js +2 -2
  41. package/dist/routes/create-admin-layout-route.js +10 -4
  42. package/dist/routes/create-collection-api-route.js +3 -3
  43. package/dist/routes/create-collection-create-route.js +4 -3
  44. package/dist/routes/create-collection-edit-route.js +4 -3
  45. package/dist/routes/create-collection-history-route.js +4 -3
  46. package/dist/routes/create-collection-list-route.js +4 -3
  47. package/dist/routes/create-singleton-history-route.d.ts +8 -0
  48. package/dist/routes/create-singleton-history-route.js +99 -0
  49. package/dist/routes/create-singleton-route.d.ts +35 -0
  50. package/dist/routes/create-singleton-route.js +130 -0
  51. package/dist/routes/get-multi-collection-definition.d.ts +10 -0
  52. package/dist/routes/get-multi-collection-definition.js +6 -0
  53. package/dist/routes/get-singleton-definition.d.ts +10 -0
  54. package/dist/routes/get-singleton-definition.js +6 -0
  55. package/dist/routes/index.d.ts +3 -0
  56. package/dist/routes/index.js +3 -0
  57. package/dist/server-fns/actors.d.ts +16 -0
  58. package/dist/server-fns/actors.js +25 -0
  59. package/dist/server-fns/admin-document-presentation.d.ts +30 -0
  60. package/dist/server-fns/admin-document-presentation.js +32 -0
  61. package/dist/server-fns/analytics/index.d.ts +9 -0
  62. package/dist/server-fns/analytics/index.js +2 -0
  63. package/dist/server-fns/analytics/maintenance.d.ts +22 -0
  64. package/dist/server-fns/analytics/maintenance.js +42 -0
  65. package/dist/server-fns/analytics/queries.d.ts +25 -0
  66. package/dist/server-fns/analytics/queries.js +54 -0
  67. package/dist/server-fns/collections/actors.d.ts +1 -10
  68. package/dist/server-fns/collections/actors.js +1 -25
  69. package/dist/server-fns/collections/get.js +9 -26
  70. package/dist/server-fns/collections/reorder.js +1 -1
  71. package/dist/server-fns/collections/scheduled-publication.js +2 -2
  72. package/dist/server-fns/collections/upload.js +3 -3
  73. package/dist/server-fns/collections/utils.d.ts +1 -7
  74. package/dist/server-fns/collections/utils.js +1 -4
  75. package/dist/server-fns/serialise.d.ts +14 -0
  76. package/dist/server-fns/serialise.js +4 -0
  77. package/dist/server-fns/singleton-document-read.d.ts +20 -0
  78. package/dist/server-fns/singleton-document-read.js +10 -0
  79. package/dist/server-fns/singletons/cancel-scheduled-publish.d.ts +12 -0
  80. package/dist/server-fns/singletons/cancel-scheduled-publish.js +7 -0
  81. package/dist/server-fns/singletons/change-status.d.ts +14 -0
  82. package/dist/server-fns/singletons/change-status.js +7 -0
  83. package/dist/server-fns/singletons/confirm-scheduled-publish.d.ts +14 -0
  84. package/dist/server-fns/singletons/confirm-scheduled-publish.js +9 -0
  85. package/dist/server-fns/singletons/copy-to-locale.d.ts +18 -0
  86. package/dist/server-fns/singletons/copy-to-locale.js +11 -0
  87. package/dist/server-fns/singletons/find-by-version.d.ts +16 -0
  88. package/dist/server-fns/singletons/find-by-version.js +9 -0
  89. package/dist/server-fns/singletons/get-scheduled-publish.d.ts +12 -0
  90. package/dist/server-fns/singletons/get-scheduled-publish.js +7 -0
  91. package/dist/server-fns/singletons/get.d.ts +24 -0
  92. package/dist/server-fns/singletons/get.js +6 -0
  93. package/dist/server-fns/singletons/history.d.ts +31 -0
  94. package/dist/server-fns/singletons/history.js +22 -0
  95. package/dist/server-fns/singletons/index.d.ts +19 -0
  96. package/dist/server-fns/singletons/index.js +12 -0
  97. package/dist/server-fns/singletons/restore-version.d.ts +14 -0
  98. package/dist/server-fns/singletons/restore-version.js +7 -0
  99. package/dist/server-fns/singletons/schedule-publish.d.ts +16 -0
  100. package/dist/server-fns/singletons/schedule-publish.js +10 -0
  101. package/dist/server-fns/singletons/unpublish.d.ts +12 -0
  102. package/dist/server-fns/singletons/unpublish.js +7 -0
  103. package/dist/server-fns/singletons/update.d.ts +14 -0
  104. package/dist/server-fns/singletons/update.js +14 -0
  105. package/dist/vite/analytics-dev.d.ts +22 -0
  106. package/dist/vite/analytics-dev.js +28 -0
  107. package/dist/vite/index.d.ts +1 -0
  108. package/dist/vite/index.js +1 -0
  109. package/dist/vitest-jsdom.test.d.ts +8 -0
  110. package/package.json +28 -16
  111. package/src/admin-shell/chrome/admin-menu-drawer.tsx +19 -5
  112. package/src/admin-shell/chrome/dashboard.test.tsx +199 -0
  113. package/src/admin-shell/chrome/dashboard.tsx +43 -9
  114. package/src/admin-shell/collections/api.tsx +2 -2
  115. package/src/admin-shell/collections/create.tsx +6 -2
  116. package/src/admin-shell/collections/edit.tsx +6 -2
  117. package/src/admin-shell/collections/history.module.css +1 -1
  118. package/src/admin-shell/collections/history.tsx +162 -442
  119. package/src/admin-shell/collections/reindex-button.tsx +4 -2
  120. package/src/admin-shell/collections/restore-version-modal.tsx +19 -25
  121. package/src/admin-shell/collections/version-history.tsx +349 -0
  122. package/src/admin-shell/singletons/history.test.tsx +407 -0
  123. package/src/admin-shell/singletons/history.tsx +185 -0
  124. package/src/admin-shell/singletons/preview-link.tsx +75 -0
  125. package/src/admin-shell/singletons/view-menu.tsx +136 -0
  126. package/src/admin-shell/singletons/view.test.tsx +400 -0
  127. package/src/admin-shell/singletons/view.tsx +351 -0
  128. package/src/integrations/analytics-agent.tsx +91 -0
  129. package/src/integrations/analytics-events.test.node.ts +245 -0
  130. package/src/integrations/analytics-events.ts +224 -0
  131. package/src/integrations/api-utils.ts +34 -9
  132. package/src/integrations/serve-analytics-agent.test.node.ts +20 -0
  133. package/src/integrations/serve-analytics-agent.ts +19 -0
  134. package/src/routes/analytics-range.ts +55 -0
  135. package/src/routes/create-admin-analytics-route.test.node.ts +46 -0
  136. package/src/routes/create-admin-analytics-route.tsx +109 -0
  137. package/src/routes/create-admin-dashboard-route.test.node.ts +70 -0
  138. package/src/routes/create-admin-dashboard-route.tsx +10 -2
  139. package/src/routes/create-admin-layout-route.tsx +15 -8
  140. package/src/routes/create-collection-api-route.tsx +4 -4
  141. package/src/routes/create-collection-create-route.tsx +5 -8
  142. package/src/routes/create-collection-edit-route.tsx +5 -4
  143. package/src/routes/create-collection-history-route.tsx +5 -8
  144. package/src/routes/create-collection-list-route.tsx +5 -8
  145. package/src/routes/create-singleton-history-route.test.node.ts +148 -0
  146. package/src/routes/create-singleton-history-route.tsx +116 -0
  147. package/src/routes/create-singleton-route.test.node.ts +172 -0
  148. package/src/routes/create-singleton-route.tsx +176 -0
  149. package/src/routes/get-multi-collection-definition.ts +16 -0
  150. package/src/routes/get-singleton-definition.ts +16 -0
  151. package/src/routes/index.ts +3 -0
  152. package/src/server-fns/actors.ts +43 -0
  153. package/src/server-fns/admin-document-presentation.ts +78 -0
  154. package/src/server-fns/analytics/index.ts +23 -0
  155. package/src/server-fns/analytics/maintenance.ts +54 -0
  156. package/src/server-fns/analytics/queries.ts +86 -0
  157. package/src/server-fns/collections/actors.ts +1 -52
  158. package/src/server-fns/collections/get.ts +10 -49
  159. package/src/server-fns/collections/reorder.ts +1 -1
  160. package/src/server-fns/collections/scheduled-publication.ts +7 -1
  161. package/src/server-fns/collections/upload-singleton.test.node.ts +164 -0
  162. package/src/server-fns/collections/upload.ts +7 -3
  163. package/src/server-fns/collections/utils.ts +1 -9
  164. package/src/server-fns/serialise.ts +17 -0
  165. package/src/server-fns/singleton-document-read.ts +32 -0
  166. package/src/server-fns/singletons/cancel-scheduled-publish.ts +19 -0
  167. package/src/server-fns/singletons/change-status.ts +19 -0
  168. package/src/server-fns/singletons/confirm-scheduled-publish.ts +23 -0
  169. package/src/server-fns/singletons/copy-to-locale.ts +32 -0
  170. package/src/server-fns/singletons/find-by-version.ts +23 -0
  171. package/src/server-fns/singletons/get-scheduled-publish.ts +19 -0
  172. package/src/server-fns/singletons/get.ts +32 -0
  173. package/src/server-fns/singletons/history.ts +41 -0
  174. package/src/server-fns/singletons/index.ts +20 -0
  175. package/src/server-fns/singletons/restore-version.ts +19 -0
  176. package/src/server-fns/singletons/schedule-publish.ts +24 -0
  177. package/src/server-fns/singletons/singletons.test.node.ts +298 -0
  178. package/src/server-fns/singletons/unpublish.ts +19 -0
  179. package/src/server-fns/singletons/update.ts +31 -0
  180. package/src/vite/analytics-dev.test.node.ts +126 -0
  181. package/src/vite/analytics-dev.ts +56 -0
  182. package/src/vite/index.ts +1 -0
  183. package/src/vitest-jsdom.test.tsx +27 -0
@@ -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
+ /**
9
+ * Deep-serialise a value through JSON to convert Date objects to ISO strings.
10
+ * TanStack Start server functions pass return values directly during SSR
11
+ * (no automatic JSON round-trip), so Date instances from the DB driver would
12
+ * fail downstream string checks without this explicit step.
13
+ */
14
+ export declare function serialise<T>(value: T): T;
@@ -0,0 +1,4 @@
1
+ function serialise(value) {
2
+ return JSON.parse(JSON.stringify(value));
3
+ }
4
+ export { serialise };
@@ -0,0 +1,20 @@
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 SingletonDocumentReadInput {
9
+ singleton: string;
10
+ locale?: string;
11
+ depth?: number;
12
+ populateRelations?: boolean;
13
+ }
14
+ /**
15
+ * Read the singleton document with the presentation controls shared by the
16
+ * editor route and the public server function. Route-only lifecycle metadata
17
+ * is deliberately composed one layer up, where host database and actor
18
+ * context are available without widening the singleton transport contract.
19
+ */
20
+ export declare function readSingletonDocument(data: SingletonDocumentReadInput): Promise<import("@byline/client").SingletonDocument<Record<string, any>> | null>;
@@ -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,22 @@
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 { Plugin } from 'vite';
9
+ /**
10
+ * Complete the first-party analytics transport during Vite development.
11
+ *
12
+ * Browser script requests carry `Sec-Fetch-Dest: script`, which Vite routes
13
+ * into its module pipeline before TanStack Start can serve the agent route.
14
+ * This plugin serves the agent directly. The application event route remains
15
+ * responsible for its development identity because POST server routes can
16
+ * bypass Vite's ordinary middleware chain. Production continues to use the
17
+ * application-owned agent route.
18
+ */
19
+ export declare function bylineAnalyticsDev(options?: {
20
+ /** Public path that serves the standalone agent. */
21
+ agentPath?: string;
22
+ }): Plugin;
@@ -0,0 +1,28 @@
1
+ import { serveAnalyticsAgent } from "../integrations/serve-analytics-agent.js";
2
+ function bylineAnalyticsDev(options = {}) {
3
+ const agentPath = options.agentPath ?? '/b.js';
4
+ return {
5
+ name: 'byline:analytics-dev',
6
+ apply: 'serve',
7
+ configureServer (server) {
8
+ server.middlewares.use(async (request, response, next)=>{
9
+ const pathname = request.url?.split('?', 1)[0];
10
+ if ('GET' === request.method && pathname === agentPath) {
11
+ try {
12
+ const agentResponse = serveAnalyticsAgent();
13
+ response.statusCode = agentResponse.status;
14
+ agentResponse.headers.forEach((value, name)=>{
15
+ response.setHeader(name, value);
16
+ });
17
+ response.end(await agentResponse.text());
18
+ } catch (error) {
19
+ next(error);
20
+ }
21
+ return;
22
+ }
23
+ next();
24
+ });
25
+ }
26
+ };
27
+ }
28
+ export { bylineAnalyticsDev };
@@ -5,4 +5,5 @@
5
5
  *
6
6
  * Copyright (c) Infonomic Company Limited
7
7
  */
8
+ export { bylineAnalyticsDev } from './analytics-dev.js';
8
9
  export { bylineClientHookBoundary } from './client-hook-boundary.js';
@@ -1 +1,2 @@
1
+ export { bylineAnalyticsDev } from "./analytics-dev.js";
1
2
  export { bylineClientHookBoundary } from "./client-hook-boundary.js";
@@ -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.15.0",
6
+ "version": "4.17.0",
7
7
  "engines": {
8
8
  "node": ">=20.9.0"
9
9
  },
@@ -45,6 +45,10 @@
45
45
  "types": "./dist/server-fns/admin-account/index.d.ts",
46
46
  "import": "./dist/server-fns/admin-account/index.js"
47
47
  },
48
+ "./server-fns/analytics": {
49
+ "types": "./dist/server-fns/analytics/index.d.ts",
50
+ "import": "./dist/server-fns/analytics/index.js"
51
+ },
48
52
  "./server-fns/admin-activity": {
49
53
  "types": "./dist/server-fns/admin-activity/index.d.ts",
50
54
  "import": "./dist/server-fns/admin-activity/index.js"
@@ -73,6 +77,10 @@
73
77
  "types": "./dist/server-fns/collections/index.d.ts",
74
78
  "import": "./dist/server-fns/collections/index.js"
75
79
  },
80
+ "./server-fns/singletons": {
81
+ "types": "./dist/server-fns/singletons/index.d.ts",
82
+ "import": "./dist/server-fns/singletons/index.js"
83
+ },
76
84
  "./i18n": {
77
85
  "types": "./dist/i18n/index.d.ts",
78
86
  "import": "./dist/i18n/index.js"
@@ -117,13 +125,15 @@
117
125
  "react-json-view-lite": "^2.5.0",
118
126
  "react-swipeable": "^7.0.2",
119
127
  "zod": "^4.4.3",
120
- "@byline/admin": "4.15.0",
121
- "@byline/auth": "4.15.0",
122
- "@byline/ai": "4.15.0",
123
- "@byline/ui": "4.15.0",
124
- "@byline/core": "4.15.0",
125
- "@byline/client": "4.15.0",
126
- "@byline/i18n": "4.15.0"
128
+ "@byline/analytics": "4.17.0",
129
+ "@byline/ai": "4.17.0",
130
+ "@byline/auth": "4.17.0",
131
+ "@byline/analytics-agent": "4.17.0",
132
+ "@byline/i18n": "4.17.0",
133
+ "@byline/admin": "4.17.0",
134
+ "@byline/core": "4.17.0",
135
+ "@byline/ui": "4.17.0",
136
+ "@byline/client": "4.17.0"
127
137
  },
128
138
  "peerDependencies": {
129
139
  "@tanstack/react-router": "^1.167.0",
@@ -133,19 +143,19 @@
133
143
  "vite": "^8.0.0"
134
144
  },
135
145
  "devDependencies": {
136
- "@biomejs/biome": "2.5.9",
146
+ "@biomejs/biome": "2.5.10",
137
147
  "@rsbuild/plugin-react": "^2.1.0",
138
148
  "@rslib/core": "^0.23.2",
139
- "@tanstack/react-router": "^1.170.31",
140
- "@tanstack/react-start": "^1.168.48",
141
- "@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",
142
152
  "@types/react": "19.2.18",
143
- "@types/react-dom": "19.2.4",
144
- "lightningcss": "^1.33.0",
153
+ "@types/react-dom": "19.2.5",
154
+ "@vitejs/plugin-react": "^6.1.0",
155
+ "jsdom": "^30.0.1",
145
156
  "npm-run-all": "^4.1.5",
146
157
  "react": "^19.2.8",
147
158
  "react-dom": "^19.2.8",
148
- "rimraf": "^6.1.3",
149
159
  "typescript": "^7.0.2",
150
160
  "typescript-plugin-css-modules": "^5.2.0",
151
161
  "vite": "^8.2.2",
@@ -167,6 +177,8 @@
167
177
  "typecheck": "tsc --noEmit",
168
178
  "clean": "node scripts/clean.js node_modules dist build types .turbo",
169
179
  "lint": "biome check --write --unsafe --diagnostic-level=error",
170
- "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"
171
183
  }
172
184
  }