@blinkk/root-cms 2.5.13 → 3.0.1-alpha.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/app.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getServerVersion
3
- } from "./chunk-EKLY6WLD.js";
3
+ } from "./chunk-N4Z3O53K.js";
4
4
  import {
5
5
  getCollectionSchema,
6
6
  getProjectSchemas
@@ -10,7 +10,7 @@ import "./chunk-MLKGABMK.js";
10
10
  // core/app.tsx
11
11
  import crypto from "crypto";
12
12
  import path from "path";
13
- import { render as renderToString } from "preact-render-to-string";
13
+ import { renderJsxToString } from "@blinkk/root/jsx";
14
14
  import { jsx, jsxs } from "preact/jsx-runtime";
15
15
  var DEFAULT_FAVICON_URL = "https://lh3.googleusercontent.com/ijK50TfQlV_yJw3i-CMlnD6osH4PboZBILZrJcWhoNMEmoyCD5e1bAxXbaOPe5w4gG_Scf37EXrmZ6p8sP2lue5fLZ419m5JyLMs=e385-w256";
16
16
  function App(props) {
@@ -139,7 +139,7 @@ async function renderApp(req, res, options) {
139
139
  };
140
140
  const projectName = cmsConfig.name || cmsConfig.id || "";
141
141
  const title = getCmsTitle(projectName, cmsConfig.minimalBranding);
142
- const mainHtml = renderToString(
142
+ const mainHtml = renderJsxToString(
143
143
  /* @__PURE__ */ jsx(App, { title, ctx, favicon: cmsConfig.favicon })
144
144
  );
145
145
  const nonce = generateNonce();
@@ -234,7 +234,7 @@ async function renderSignIn(req, res, options) {
234
234
  ctx.warning = "Dev warning: Server may be misconfigured. See logs for more information.";
235
235
  }
236
236
  }
237
- const mainHtml = renderToString(
237
+ const mainHtml = renderJsxToString(
238
238
  /* @__PURE__ */ jsx(SignIn, { title: "Sign in", ctx, favicon: options.cmsConfig.favicon })
239
239
  );
240
240
  const nonce = generateNonce();
@@ -4,6 +4,7 @@ import {
4
4
  } from "./chunk-YMUZ5H5C.js";
5
5
 
6
6
  // core/versions.ts
7
+ import fs from "fs";
7
8
  import path from "path";
8
9
  import { Timestamp } from "firebase-admin/firestore";
9
10
  import glob from "tiny-glob";
@@ -27,7 +28,14 @@ var VersionsService = class {
27
28
  const now = Timestamp.now().toMillis();
28
29
  const versions = changedDocs.filter((doc) => {
29
30
  const modifiedAt = doc.sys.modifiedAt.toMillis();
30
- return modifiedAt <= now - DOCUMENT_SAVE_OFFSET;
31
+ if (modifiedAt > now - DOCUMENT_SAVE_OFFSET) {
32
+ return false;
33
+ }
34
+ const publishedAt = doc.sys.publishedAt?.toMillis?.();
35
+ if (publishedAt && Math.abs(publishedAt - modifiedAt) < 5e3) {
36
+ return false;
37
+ }
38
+ return true;
31
39
  });
32
40
  if (versions.length > 0) {
33
41
  this.saveVersionsToFirestore(versions);
@@ -94,9 +102,13 @@ var VersionsService = class {
94
102
  * Returns a list of collection ids for the Root project.
95
103
  */
96
104
  async listCollections() {
105
+ const collectionsDir = path.join(this.rootConfig.rootDir, "collections");
106
+ if (!fs.existsSync(collectionsDir)) {
107
+ return [];
108
+ }
97
109
  const collectionIds = [];
98
110
  const collectionFileNames = await glob("*.schema.ts", {
99
- cwd: path.join(this.rootConfig.rootDir, "collections")
111
+ cwd: collectionsDir
100
112
  });
101
113
  collectionFileNames.forEach((filename) => {
102
114
  collectionIds.push(filename.slice(0, -10));
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@blinkk/root-cms",
4
- version: "2.5.13",
4
+ version: "3.0.1-alpha.0",
5
5
  author: "s@blinkk.com",
6
6
  license: "MIT",
7
7
  engines: {
@@ -12,9 +12,6 @@ var package_default = {
12
12
  url: "git+https://github.com/blinkk/rootjs.git",
13
13
  directory: "packages/root-cms"
14
14
  },
15
- publishConfig: {
16
- provenance: true
17
- },
18
15
  files: [
19
16
  "dist/**/*"
20
17
  ],
@@ -138,8 +135,8 @@ var package_default = {
138
135
  "@types/google.accounts": "0.0.14",
139
136
  "@types/jsonwebtoken": "9.0.1",
140
137
  "@types/node": "24.3.1",
141
- "@vitest/browser": "4.0.10",
142
- "@vitest/browser-playwright": "4.0.10",
138
+ "@vitest/browser": "4.1.2",
139
+ "@vitest/browser-playwright": "4.1.2",
143
140
  concurrently: "7.6.0",
144
141
  esbuild: "0.25.9",
145
142
  firebase: "12.2.1",
@@ -157,23 +154,21 @@ var package_default = {
157
154
  playwright: "1.56.1",
158
155
  preact: "10.27.1",
159
156
  "preact-iso": "2.11.1",
160
- "preact-render-to-string": "6.6.1",
157
+ "preact-render-to-string": "6.6.7",
161
158
  react: "npm:@preact/compat@18.3.1",
162
159
  "react-dom": "npm:@preact/compat@18.3.1",
163
160
  "react-easy-crop": "5.5.6",
164
161
  "react-json-view-compare": "2.0.2",
165
162
  tsup: "8.5.0",
166
163
  typescript: "5.9.2",
167
- vite: "7.1.4",
168
- vitest: "4.0.10",
164
+ vite: "8.0.3",
165
+ vitest: "4.1.2",
169
166
  yjs: "13.6.27"
170
167
  },
171
168
  peerDependencies: {
172
- "@blinkk/root": "2.5.13",
169
+ "@blinkk/root": "3.0.1-alpha.0",
173
170
  "firebase-admin": ">=11",
174
- "firebase-functions": ">=4",
175
- preact: ">=10",
176
- "preact-render-to-string": ">=5"
171
+ "firebase-functions": ">=4"
177
172
  },
178
173
  peerDependenciesMeta: {
179
174
  "firebase-functions": {
@@ -95,6 +95,34 @@ interface TranslationExportResult {
95
95
  /** Optional label for the link. Defaults to "Open". */
96
96
  label?: string;
97
97
  };
98
+ /**
99
+ * Notification status controlling the color of the notification.
100
+ * - `'success'`: green
101
+ * - `'error'`: red
102
+ * - `'info'` (default): neutral
103
+ */
104
+ status?: 'success' | 'info' | 'error';
105
+ }
106
+ /** Result returned by an onImport handler when no rows are imported. */
107
+ interface TranslationImportResult {
108
+ /** Optional title displayed in the notification after import. */
109
+ title?: string;
110
+ /** Optional message displayed in the notification after import. */
111
+ message?: string;
112
+ /** Optional link displayed in the notification (e.g. to the translation service). */
113
+ link?: {
114
+ /** The URL to link to. */
115
+ url: string;
116
+ /** Optional label for the link. Defaults to "Open". */
117
+ label?: string;
118
+ };
119
+ /**
120
+ * Notification status controlling the color of the notification.
121
+ * - `'success'`: green
122
+ * - `'error'`: red
123
+ * - `'info'` (default): neutral
124
+ */
125
+ status?: 'success' | 'info' | 'error';
98
126
  }
99
127
  /** Configuration for defining a CMS translation service. */
100
128
  interface CMSTranslationService {
@@ -110,9 +138,10 @@ interface CMSTranslationService {
110
138
  /**
111
139
  * Async function to import translations from the service. Should return an
112
140
  * array of translation rows that will be merged into the CMS translations
113
- * database.
141
+ * database, or a `TranslationImportResult` object to display a notification
142
+ * without importing any rows.
114
143
  */
115
- onImport?: (ctx: TranslationServiceContext, data: TranslationRow[]) => Promise<TranslationRow[]>;
144
+ onImport?: (ctx: TranslationServiceContext, data: TranslationRow[]) => Promise<TranslationRow[] | TranslationImportResult>;
116
145
  /**
117
146
  * Async function to export translations to the service. Receives the
118
147
  * current translation rows for the document. Can optionally return an object
@@ -1227,4 +1256,4 @@ declare class BatchResponse {
1227
1256
  private getTranslationsMap;
1228
1257
  }
1229
1258
 
1230
- export { type CMSAIConfig as $, type Action as A, type BatchRequestOptions as B, type CronUnit as C, type DocMode as D, type TranslationsDoc as E, BatchRequest as F, type GetDocOptions as G, type HttpMethod as H, BatchResponse as I, type Locale as J, type SourceString as K, type LoadTranslationsOptions as L, type TranslatedString as M, type TranslationsDocMode as N, type TranslationsLocaleDocHashMap as O, type TranslationsLocaleDocEntry as P, type MultiLocaleTranslationsMap as Q, RootCMSClient as R, type SetDocOptions as S, type TranslationsMap as T, type UserRole as U, type SingleLocaleTranslationsMap as V, TranslationsManager as W, buildTranslationsDbPath as X, buildTranslationsLocaleDocDbPath as Y, type CMSBuiltInSidebarTool as Z, type CMSUser as _, type LocaleTranslations as a, type CMSSidebarTool as a0, type CMSPluginOptions as a1, type CMSPlugin as a2, cmsPlugin as a3, type CMSCheck as a4, type CheckResult as a5, type CheckContext as a6, type CheckStatus as a7, translationsCheck as a8, type TranslationsCheckOptions as a9, type CMSTranslationService as aa, type TranslationExportResult as ab, type TranslationRow as ac, type TranslationServiceContext as ad, type Doc as b, type DataSourceCron as c, type DataSource as d, type DataSourceData as e, type DataSourceMode as f, type SaveDraftOptions as g, type UpdateDraftOptions as h, type ListDocsOptions as i, type GetCountOptions as j, type Translation as k, type Release as l, type ListActionsOptions as m, isRichTextData as n, getCmsPlugin as o, marshalData as p, normalizeData as q, type ArrayObject as r, marshalArray as s, toArrayObject as t, unmarshalData as u, unmarshalArray as v, translationsForLocale as w, parseDocId as x, type BatchRequestQuery as y, type BatchRequestQueryOptions as z };
1259
+ export { type CMSAIConfig as $, type Action as A, type BatchRequestOptions as B, type CronUnit as C, type DocMode as D, type TranslationsDoc as E, BatchRequest as F, type GetDocOptions as G, type HttpMethod as H, BatchResponse as I, type Locale as J, type SourceString as K, type LoadTranslationsOptions as L, type TranslatedString as M, type TranslationsDocMode as N, type TranslationsLocaleDocHashMap as O, type TranslationsLocaleDocEntry as P, type MultiLocaleTranslationsMap as Q, RootCMSClient as R, type SetDocOptions as S, type TranslationsMap as T, type UserRole as U, type SingleLocaleTranslationsMap as V, TranslationsManager as W, buildTranslationsDbPath as X, buildTranslationsLocaleDocDbPath as Y, type CMSBuiltInSidebarTool as Z, type CMSUser as _, type LocaleTranslations as a, type CMSSidebarTool as a0, type CMSPluginOptions as a1, type CMSPlugin as a2, cmsPlugin as a3, type CMSCheck as a4, type CheckResult as a5, type CheckContext as a6, type CheckStatus as a7, translationsCheck as a8, type TranslationsCheckOptions as a9, type CMSTranslationService as aa, type TranslationExportResult as ab, type TranslationImportResult as ac, type TranslationRow as ad, type TranslationServiceContext as ae, type Doc as b, type DataSourceCron as c, type DataSource as d, type DataSourceData as e, type DataSourceMode as f, type SaveDraftOptions as g, type UpdateDraftOptions as h, type ListDocsOptions as i, type GetCountOptions as j, type Translation as k, type Release as l, type ListActionsOptions as m, isRichTextData as n, getCmsPlugin as o, marshalData as p, normalizeData as q, type ArrayObject as r, marshalArray as s, toArrayObject as t, unmarshalData as u, unmarshalArray as v, translationsForLocale as w, parseDocId as x, type BatchRequestQuery as y, type BatchRequestQueryOptions as z };
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '@blinkk/root';
2
2
  import 'firebase-admin/app';
3
3
  import 'firebase-admin/firestore';
4
- export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, D as DocMode, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, L as LoadTranslationsOptions, a as LocaleTranslations, l as Release, R as RootCMSClient, g as SaveDraftOptions, S as SetDocOptions, k as Translation, E as TranslationsDoc, T as TranslationsMap, h as UpdateDraftOptions, U as UserRole, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-B_x5Fbkq.js';
4
+ export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, D as DocMode, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, L as LoadTranslationsOptions, a as LocaleTranslations, l as Release, R as RootCMSClient, g as SaveDraftOptions, S as SetDocOptions, k as Translation, E as TranslationsDoc, T as TranslationsMap, h as UpdateDraftOptions, U as UserRole, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-cP6yMgT8.js';
5
5
  import './schema-D7MOj-YC.js';
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RootCMSClient, D as DocMode, L as LoadTranslationsOptions, T as TranslationsMap, a as LocaleTranslations } from './client-B_x5Fbkq.js';
2
- export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, J as Locale, Q as MultiLocaleTranslationsMap, l as Release, g as SaveDraftOptions, S as SetDocOptions, V as SingleLocaleTranslationsMap, K as SourceString, M as TranslatedString, k as Translation, E as TranslationsDoc, N as TranslationsDocMode, P as TranslationsLocaleDocEntry, O as TranslationsLocaleDocHashMap, W as TranslationsManager, h as UpdateDraftOptions, U as UserRole, X as buildTranslationsDbPath, Y as buildTranslationsLocaleDocDbPath, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-B_x5Fbkq.js';
1
+ import { R as RootCMSClient, D as DocMode, L as LoadTranslationsOptions, T as TranslationsMap, a as LocaleTranslations } from './client-cP6yMgT8.js';
2
+ export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, J as Locale, Q as MultiLocaleTranslationsMap, l as Release, g as SaveDraftOptions, S as SetDocOptions, V as SingleLocaleTranslationsMap, K as SourceString, M as TranslatedString, k as Translation, E as TranslationsDoc, N as TranslationsDocMode, P as TranslationsLocaleDocEntry, O as TranslationsLocaleDocHashMap, W as TranslationsManager, h as UpdateDraftOptions, U as UserRole, X as buildTranslationsDbPath, Y as buildTranslationsLocaleDocDbPath, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-cP6yMgT8.js';
3
3
  import { Request, RootConfig, Response, RouteParams, GetStaticProps, GetStaticPaths } from '@blinkk/root';
4
4
  import { Query } from 'firebase-admin/firestore';
5
5
  export { s as schema } from './schema-D7MOj-YC.js';
package/dist/functions.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runCronJobs
3
- } from "./chunk-PKD2TDSV.js";
3
+ } from "./chunk-H6ZKML2S.js";
4
4
  import "./chunk-YMUZ5H5C.js";
5
5
  import "./chunk-MLKGABMK.js";
6
6
 
package/dist/plugin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '@blinkk/root';
2
2
  import 'firebase-admin/app';
3
3
  import 'firebase-admin/firestore';
4
- export { $ as CMSAIConfig, Z as CMSBuiltInSidebarTool, a4 as CMSCheck, a2 as CMSPlugin, a1 as CMSPluginOptions, a0 as CMSSidebarTool, aa as CMSTranslationService, _ as CMSUser, a6 as CheckContext, a5 as CheckResult, a7 as CheckStatus, ab as TranslationExportResult, ac as TranslationRow, ad as TranslationServiceContext, a9 as TranslationsCheckOptions, a3 as cmsPlugin, a8 as translationsCheck } from './client-B_x5Fbkq.js';
4
+ export { $ as CMSAIConfig, Z as CMSBuiltInSidebarTool, a4 as CMSCheck, a2 as CMSPlugin, a1 as CMSPluginOptions, a0 as CMSSidebarTool, aa as CMSTranslationService, _ as CMSUser, a6 as CheckContext, a5 as CheckResult, a7 as CheckStatus, ab as TranslationExportResult, ac as TranslationImportResult, ad as TranslationRow, ae as TranslationServiceContext, a9 as TranslationsCheckOptions, a3 as cmsPlugin, a8 as translationsCheck } from './client-cP6yMgT8.js';
5
5
  import './schema-D7MOj-YC.js';
package/dist/plugin.js CHANGED
@@ -4,10 +4,10 @@ import {
4
4
  } from "./chunk-T5UK2H24.js";
5
5
  import {
6
6
  getServerVersion
7
- } from "./chunk-EKLY6WLD.js";
7
+ } from "./chunk-N4Z3O53K.js";
8
8
  import {
9
9
  runCronJobs
10
- } from "./chunk-PKD2TDSV.js";
10
+ } from "./chunk-H6ZKML2S.js";
11
11
  import {
12
12
  RootCMSClient,
13
13
  parseDocId,