@blinkk/root-cms 2.4.7 → 2.4.9

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
@@ -83,7 +83,7 @@ function convertOneOfTypes(collection) {
83
83
  // package.json
84
84
  var package_default = {
85
85
  name: "@blinkk/root-cms",
86
- version: "2.4.7",
86
+ version: "2.4.9",
87
87
  author: "s@blinkk.com",
88
88
  license: "MIT",
89
89
  engines: {
@@ -152,9 +152,9 @@ var package_default = {
152
152
  "@ag-grid-community/core": "32.3.9",
153
153
  "@ag-grid-community/react": "32.3.9",
154
154
  "@ag-grid-community/styles": "32.3.9",
155
- "@genkit-ai/ai": "1.18.0",
156
- "@genkit-ai/core": "1.18.0",
157
- "@genkit-ai/vertexai": "1.18.0",
155
+ "@genkit-ai/ai": "1.26.0",
156
+ "@genkit-ai/core": "1.26.0",
157
+ "@genkit-ai/google-genai": "1.26.0",
158
158
  "@google-cloud/firestore": "7.11.3",
159
159
  "@hello-pangea/dnd": "18.0.1",
160
160
  "@types/cli-progress": "3.11.6",
@@ -168,7 +168,7 @@ var package_default = {
168
168
  diff: "8.0.2",
169
169
  "dts-dom": "3.7.0",
170
170
  "fnv-plus": "1.3.1",
171
- genkit: "1.18.0",
171
+ genkit: "1.26.0",
172
172
  jsonwebtoken: "9.0.2",
173
173
  kleur: "4.1.5",
174
174
  sirv: "2.0.3",
@@ -248,7 +248,7 @@ var package_default = {
248
248
  yjs: "13.6.27"
249
249
  },
250
250
  peerDependencies: {
251
- "@blinkk/root": "2.4.7",
251
+ "@blinkk/root": "2.4.9",
252
252
  "firebase-admin": ">=11",
253
253
  "firebase-functions": ">=4",
254
254
  preact: ">=10",
@@ -3,10 +3,9 @@ import { App } from 'firebase-admin/app';
3
3
  import { Firestore, WriteBatch, Timestamp, Query } from 'firebase-admin/firestore';
4
4
 
5
5
  /**
6
- * Supported Root AI models. Defaults to 'vertexai/gemini-3-flash-preview'.
7
- * Custom model identifiers can also be provided as strings.
6
+ * Supported Root AI models. Defaults to 'gemini-3-flash-preview'.
8
7
  */
9
- type RootAiModel = 'vertexai/gemini-3-pro-preview' | 'vertexai/gemini-3-flash-preview' | 'vertexai/gemini-2.5-flash' | 'vertexai/gemini-2.0-pro' | string;
8
+ type RootAiModel = 'gemini-3-pro-preview' | 'gemini-3-flash-preview' | 'gemini-2.5-flash' | 'gemini-2.0-pro' | string;
10
9
 
11
10
  /**
12
11
  * Built-in sidebar tools that can be toggled on/off in the CMS UI.
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import '@blinkk/root';
2
2
  import 'firebase-admin/app';
3
3
  import 'firebase-admin/firestore';
4
- export { A as Action, p as ArrayObject, z as BatchRequest, B as BatchRequestOptions, w as BatchRequestQuery, x as BatchRequestQueryOptions, C as BatchResponse, c as DataSource, d as DataSourceData, e as DataSourceMode, b as Doc, D as DocMode, h as GetCountOptions, G as GetDocOptions, H as HttpMethod, k as ListActionsOptions, g as ListDocsOptions, L as LoadTranslationsOptions, a as LocaleTranslations, j as Release, R as RootCMSClient, f as SaveDraftOptions, S as SetDocOptions, i as Translation, y as TranslationsDoc, T as TranslationsMap, U as UserRole, m as getCmsPlugin, l as isRichTextData, q as marshalArray, n as marshalData, o as normalizeData, v as parseDocId, t as toArrayObject, s as translationsForLocale, r as unmarshalArray, u as unmarshalData } from './client-wkm3JBRI.js';
4
+ export { A as Action, p as ArrayObject, z as BatchRequest, B as BatchRequestOptions, w as BatchRequestQuery, x as BatchRequestQueryOptions, C as BatchResponse, c as DataSource, d as DataSourceData, e as DataSourceMode, b as Doc, D as DocMode, h as GetCountOptions, G as GetDocOptions, H as HttpMethod, k as ListActionsOptions, g as ListDocsOptions, L as LoadTranslationsOptions, a as LocaleTranslations, j as Release, R as RootCMSClient, f as SaveDraftOptions, S as SetDocOptions, i as Translation, y as TranslationsDoc, T as TranslationsMap, U as UserRole, m as getCmsPlugin, l as isRichTextData, q as marshalArray, n as marshalData, o as normalizeData, v as parseDocId, t as toArrayObject, s as translationsForLocale, r as unmarshalArray, u as unmarshalData } from './client-pSzji9ZN.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-wkm3JBRI.js';
2
- export { A as Action, p as ArrayObject, z as BatchRequest, B as BatchRequestOptions, w as BatchRequestQuery, x as BatchRequestQueryOptions, C as BatchResponse, c as DataSource, d as DataSourceData, e as DataSourceMode, b as Doc, h as GetCountOptions, G as GetDocOptions, H as HttpMethod, k as ListActionsOptions, g as ListDocsOptions, E as Locale, N as MultiLocaleTranslationsMap, j as Release, f as SaveDraftOptions, S as SetDocOptions, O as SingleLocaleTranslationsMap, F as SourceString, I as TranslatedString, i as Translation, y as TranslationsDoc, J as TranslationsDocMode, M as TranslationsLocaleDocEntry, K as TranslationsLocaleDocHashMap, P as TranslationsManager, U as UserRole, Q as buildTranslationsDbPath, V as buildTranslationsLocaleDocDbPath, m as getCmsPlugin, l as isRichTextData, q as marshalArray, n as marshalData, o as normalizeData, v as parseDocId, t as toArrayObject, s as translationsForLocale, r as unmarshalArray, u as unmarshalData } from './client-wkm3JBRI.js';
1
+ import { R as RootCMSClient, D as DocMode, L as LoadTranslationsOptions, T as TranslationsMap, a as LocaleTranslations } from './client-pSzji9ZN.js';
2
+ export { A as Action, p as ArrayObject, z as BatchRequest, B as BatchRequestOptions, w as BatchRequestQuery, x as BatchRequestQueryOptions, C as BatchResponse, c as DataSource, d as DataSourceData, e as DataSourceMode, b as Doc, h as GetCountOptions, G as GetDocOptions, H as HttpMethod, k as ListActionsOptions, g as ListDocsOptions, E as Locale, N as MultiLocaleTranslationsMap, j as Release, f as SaveDraftOptions, S as SetDocOptions, O as SingleLocaleTranslationsMap, F as SourceString, I as TranslatedString, i as Translation, y as TranslationsDoc, J as TranslationsDocMode, M as TranslationsLocaleDocEntry, K as TranslationsLocaleDocHashMap, P as TranslationsManager, U as UserRole, Q as buildTranslationsDbPath, V as buildTranslationsLocaleDocDbPath, m as getCmsPlugin, l as isRichTextData, q as marshalArray, n as marshalData, o as normalizeData, v as parseDocId, t as toArrayObject, s as translationsForLocale, r as unmarshalArray, u as unmarshalData } from './client-pSzji9ZN.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-Bux4PrV2.js';
package/dist/plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import '@blinkk/root';
2
2
  import 'firebase-admin/app';
3
3
  import 'firebase-admin/firestore';
4
- export { Y as CMSAIConfig, W as CMSBuiltInSidebarTool, $ as CMSPlugin, _ as CMSPluginOptions, Z as CMSSidebarTool, X as CMSUser, a0 as cmsPlugin } from './client-wkm3JBRI.js';
4
+ export { Y as CMSAIConfig, W as CMSBuiltInSidebarTool, $ as CMSPlugin, _ as CMSPluginOptions, Z as CMSSidebarTool, X as CMSUser, a0 as cmsPlugin } from './client-pSzji9ZN.js';
package/dist/plugin.js CHANGED
@@ -56,7 +56,7 @@ __export(ai_exports, {
56
56
  import crypto from "crypto";
57
57
  import fs from "fs";
58
58
  import path from "path";
59
- import { vertexAI } from "@genkit-ai/vertexai";
59
+ import { vertexAI } from "@genkit-ai/google-genai";
60
60
  import { Timestamp } from "firebase-admin/firestore";
61
61
  import { genkit } from "genkit";
62
62
  import { logger } from "genkit/logging";
@@ -93,8 +93,7 @@ async function summarizeDiff(cmsClient, options) {
93
93
  "",
94
94
  "Summarize the differences between the two payloads."
95
95
  ].join("\n");
96
- const res = await ai.generate({
97
- model,
96
+ const res = await generate(ai, model, {
98
97
  messages: [
99
98
  {
100
99
  role: "system",
@@ -108,7 +107,7 @@ async function summarizeDiff(cmsClient, options) {
108
107
  async function generateImage(cmsClient, options) {
109
108
  const cmsPluginOptions = cmsClient.cmsPlugin.getConfig();
110
109
  const firebaseConfig = cmsPluginOptions.firebaseConfig;
111
- const model = "vertexai/gemini-2.5-flash-image";
110
+ const model = options.model || DEFAULT_IMAGEGEN_MODEL;
112
111
  const ai = genkit({
113
112
  plugins: [
114
113
  vertexAI({
@@ -117,8 +116,7 @@ async function generateImage(cmsClient, options) {
117
116
  })
118
117
  ]
119
118
  });
120
- const res = await ai.generate({
121
- model,
119
+ const res = await generate(ai, model, {
122
120
  prompt: [
123
121
  {
124
122
  text: options.prompt
@@ -138,12 +136,33 @@ async function generateImage(cmsClient, options) {
138
136
  }
139
137
  return res.media.url;
140
138
  }
141
- var DEFAULT_MODEL, Chat, ChatClient;
139
+ async function generate(ai, model, options) {
140
+ const generateOptions = {
141
+ ...options,
142
+ model: vertexAI.model(model)
143
+ };
144
+ if (model.startsWith("gemini-3")) {
145
+ generateOptions.config = {
146
+ ...generateOptions.config,
147
+ location: "global"
148
+ };
149
+ }
150
+ return ai.generate(generateOptions);
151
+ }
152
+ function cleanModelName(model) {
153
+ return LEGACY_MODEL_RENAME[model] || model;
154
+ }
155
+ var DEFAULT_MODEL, DEFAULT_IMAGEGEN_MODEL, LEGACY_MODEL_RENAME, Chat, ChatClient;
142
156
  var init_ai = __esm({
143
157
  "core/ai.ts"() {
144
158
  "use strict";
145
159
  logger.setLogLevel("warn");
146
- DEFAULT_MODEL = "vertexai/gemini-3-flash-preview";
160
+ DEFAULT_MODEL = "gemini-3-flash-preview";
161
+ DEFAULT_IMAGEGEN_MODEL = "gemini-2.5-flash-image";
162
+ LEGACY_MODEL_RENAME = {
163
+ "vertexai/gemini-2.5-flash": "gemini-2.5-flash",
164
+ "vertexai/gemini-2.0-pro": "gemini-2.0-pro"
165
+ };
147
166
  Chat = class {
148
167
  constructor(chatClient, id, options) {
149
168
  this.chatClient = chatClient;
@@ -151,7 +170,9 @@ var init_ai = __esm({
151
170
  this.cmsPluginOptions = this.cmsClient.cmsPlugin.getConfig();
152
171
  this.id = id;
153
172
  this.history = options?.history ?? [];
154
- this.model = options?.model || (typeof this.cmsPluginOptions.experiments?.ai === "object" ? this.cmsPluginOptions.experiments.ai.model : void 0) || DEFAULT_MODEL;
173
+ this.model = cleanModelName(
174
+ options?.model || (typeof this.cmsPluginOptions.experiments?.ai === "object" ? this.cmsPluginOptions.experiments.ai.model : void 0) || DEFAULT_MODEL
175
+ );
155
176
  const firebaseConfig = this.cmsPluginOptions.firebaseConfig;
156
177
  this.ai = genkit({
157
178
  plugins: [
@@ -208,8 +229,7 @@ var init_ai = __esm({
208
229
  /** Sends the request to the AI and stores the history in the session and the database. */
209
230
  async sendPrompt(prompt, options = {}) {
210
231
  const chatRequest = await this.buildGenerateRequest(prompt, options);
211
- const res = await this.ai.generate({
212
- model: chatRequest.model,
232
+ const res = await generate(this.ai, chatRequest.model, {
213
233
  messages: chatRequest.messages,
214
234
  prompt: Array.isArray(prompt) ? prompt.flat() : prompt
215
235
  });
@@ -2639,7 +2659,7 @@ function api(server, options) {
2639
2659
  // package.json
2640
2660
  var package_default = {
2641
2661
  name: "@blinkk/root-cms",
2642
- version: "2.4.7",
2662
+ version: "2.4.9",
2643
2663
  author: "s@blinkk.com",
2644
2664
  license: "MIT",
2645
2665
  engines: {
@@ -2708,9 +2728,9 @@ var package_default = {
2708
2728
  "@ag-grid-community/core": "32.3.9",
2709
2729
  "@ag-grid-community/react": "32.3.9",
2710
2730
  "@ag-grid-community/styles": "32.3.9",
2711
- "@genkit-ai/ai": "1.18.0",
2712
- "@genkit-ai/core": "1.18.0",
2713
- "@genkit-ai/vertexai": "1.18.0",
2731
+ "@genkit-ai/ai": "1.26.0",
2732
+ "@genkit-ai/core": "1.26.0",
2733
+ "@genkit-ai/google-genai": "1.26.0",
2714
2734
  "@google-cloud/firestore": "7.11.3",
2715
2735
  "@hello-pangea/dnd": "18.0.1",
2716
2736
  "@types/cli-progress": "3.11.6",
@@ -2724,7 +2744,7 @@ var package_default = {
2724
2744
  diff: "8.0.2",
2725
2745
  "dts-dom": "3.7.0",
2726
2746
  "fnv-plus": "1.3.1",
2727
- genkit: "1.18.0",
2747
+ genkit: "1.26.0",
2728
2748
  jsonwebtoken: "9.0.2",
2729
2749
  kleur: "4.1.5",
2730
2750
  sirv: "2.0.3",
@@ -2804,7 +2824,7 @@ var package_default = {
2804
2824
  yjs: "13.6.27"
2805
2825
  },
2806
2826
  peerDependencies: {
2807
- "@blinkk/root": "2.4.7",
2827
+ "@blinkk/root": "2.4.9",
2808
2828
  "firebase-admin": ">=11",
2809
2829
  "firebase-functions": ">=4",
2810
2830
  preact: ">=10",
@@ -2840,6 +2860,10 @@ function sse(server) {
2840
2860
  });
2841
2861
  };
2842
2862
  server.use("/cms/api/sse.connect", async (req, res) => {
2863
+ if (!req.user) {
2864
+ res.status(401).json({ success: false, error: "NOT_AUTHORIZED" });
2865
+ return;
2866
+ }
2843
2867
  res.writeHead(200, {
2844
2868
  "Content-Type": "text/event-stream",
2845
2869
  "Cache-Control": "no-cache",