@aglyn/plugins-ai 1.33.1 → 1.34.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/package.json +17 -17
- package/src/lib/declarations.server.js +14 -3
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/jobs/ai-job-template-step.js +1 -1
- package/src/lib/jobs/ai-job-template-step.js.map +1 -1
- package/src/lib/runtime/ai-eval-live.js +118 -0
- package/src/lib/runtime/ai-eval-live.js.map +1 -1
- package/src/lib/site-style-starters/index.d.ts +53 -0
- package/src/lib/site-style-starters/index.js +83 -0
- package/src/lib/site-style-starters/index.js.map +1 -0
- package/src/lib/site-style-starters/records.server.d.ts +65 -0
- package/src/lib/site-style-starters/records.server.js +212 -0
- package/src/lib/site-style-starters/records.server.js.map +1 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /**
|
|
17
|
+
* The site each style in Create site starts (2026-12-01): the home page the
|
|
18
|
+
* style's card pictures, its header and footer, and the full theme its look
|
|
19
|
+
* builds, as a starter carries them.
|
|
20
|
+
*
|
|
21
|
+
* GENERATED, never edited by hand: each `<kind>.json` is written by
|
|
22
|
+
* `libs/plugins/ai/scripts/build-site-style-starters.mts` from the same
|
|
23
|
+
* stand-in page (`scripts/site-style-previews.json`) the card's picture is
|
|
24
|
+
* drawn from, so the two cannot drift. Change the page there and run both
|
|
25
|
+
* that script and `render-site-style-previews.mts`.
|
|
26
|
+
*
|
|
27
|
+
* Each is loaded on the create that asks for it, and only on the server.
|
|
28
|
+
*/ const STARTERS = {
|
|
29
|
+
beauty: ()=>import("./beauty.json"),
|
|
30
|
+
blog: ()=>import("./blog.json"),
|
|
31
|
+
business: ()=>import("./business.json"),
|
|
32
|
+
'coming-soon': ()=>import("./coming-soon.json"),
|
|
33
|
+
education: ()=>import("./education.json"),
|
|
34
|
+
events: ()=>import("./events.json"),
|
|
35
|
+
fitness: ()=>import("./fitness.json"),
|
|
36
|
+
landing: ()=>import("./landing.json"),
|
|
37
|
+
music: ()=>import("./music.json"),
|
|
38
|
+
nonprofit: ()=>import("./nonprofit.json"),
|
|
39
|
+
personal: ()=>import("./personal.json"),
|
|
40
|
+
photography: ()=>import("./photography.json"),
|
|
41
|
+
portfolio: ()=>import("./portfolio.json"),
|
|
42
|
+
professional: ()=>import("./professional.json"),
|
|
43
|
+
realestate: ()=>import("./realestate.json"),
|
|
44
|
+
restaurant: ()=>import("./restaurant.json"),
|
|
45
|
+
store: ()=>import("./store.json"),
|
|
46
|
+
studio: ()=>import("./studio.json"),
|
|
47
|
+
trades: ()=>import("./trades.json"),
|
|
48
|
+
wellness: ()=>import("./wellness.json"),
|
|
49
|
+
yoga: ()=>import("./yoga.json")
|
|
50
|
+
};
|
|
51
|
+
/** The styles that start a site of their own. */ export const SITE_STYLE_STARTER_IDS = Object.keys(STARTERS);
|
|
52
|
+
const loaded = new Map();
|
|
53
|
+
/** The site a style starts, or `null` for a style with none. */ export function siteStyleStarter(styleId) {
|
|
54
|
+
const load = Object.prototype.hasOwnProperty.call(STARTERS, styleId) ? STARTERS[styleId] : undefined;
|
|
55
|
+
if (!load) return Promise.resolve(null);
|
|
56
|
+
let starter = loaded.get(styleId);
|
|
57
|
+
if (!starter) {
|
|
58
|
+
starter = load().then((module)=>{
|
|
59
|
+
var _module_default;
|
|
60
|
+
return (_module_default = module.default) != null ? _module_default : module;
|
|
61
|
+
});
|
|
62
|
+
// A load that failed is tried again on the next create, not remembered.
|
|
63
|
+
starter.catch(()=>loaded.delete(styleId));
|
|
64
|
+
loaded.set(styleId, starter);
|
|
65
|
+
}
|
|
66
|
+
// A copy, so a create that adjusts what it writes never changes the next
|
|
67
|
+
// one's. The payload is JSON as read, so a JSON round trip copies it whole.
|
|
68
|
+
return starter.then((payload)=>payload ? JSON.parse(JSON.stringify(payload)) : null);
|
|
69
|
+
}
|
|
70
|
+
const RECORDS = {
|
|
71
|
+
blog: ()=>import("./records/blog.json"),
|
|
72
|
+
store: ()=>import("./records/store.json")
|
|
73
|
+
};
|
|
74
|
+
/** The styles whose starter lists records of its own. */ export const SITE_STYLE_RECORDS_IDS = Object.keys(RECORDS);
|
|
75
|
+
/** The records a style's starter writes, or `null` for a style that lists none. */ export async function siteStyleStarterRecords(styleId) {
|
|
76
|
+
var _loaded_default;
|
|
77
|
+
const load = Object.prototype.hasOwnProperty.call(RECORDS, styleId) ? RECORDS[styleId] : undefined;
|
|
78
|
+
if (!load) return null;
|
|
79
|
+
const loaded = await load();
|
|
80
|
+
return JSON.parse(JSON.stringify((_loaded_default = loaded.default) != null ? _loaded_default : loaded));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/site-style-starters/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SiteStarterPayload } from '@aglyn/aglyn/app-utils/site-starter'\n\n/**\n * The site each style in Create site starts (2026-12-01): the home page the\n * style's card pictures, its header and footer, and the full theme its look\n * builds, as a starter carries them.\n *\n * GENERATED, never edited by hand: each `<kind>.json` is written by\n * `libs/plugins/ai/scripts/build-site-style-starters.mts` from the same\n * stand-in page (`scripts/site-style-previews.json`) the card's picture is\n * drawn from, so the two cannot drift. Change the page there and run both\n * that script and `render-site-style-previews.mts`.\n *\n * Each is loaded on the create that asks for it, and only on the server.\n */\nconst STARTERS: Readonly<Record<string, () => Promise<unknown>>> = {\n beauty: () => import('./beauty.json'),\n blog: () => import('./blog.json'),\n business: () => import('./business.json'),\n 'coming-soon': () => import('./coming-soon.json'),\n education: () => import('./education.json'),\n events: () => import('./events.json'),\n fitness: () => import('./fitness.json'),\n landing: () => import('./landing.json'),\n music: () => import('./music.json'),\n nonprofit: () => import('./nonprofit.json'),\n personal: () => import('./personal.json'),\n photography: () => import('./photography.json'),\n portfolio: () => import('./portfolio.json'),\n professional: () => import('./professional.json'),\n realestate: () => import('./realestate.json'),\n restaurant: () => import('./restaurant.json'),\n store: () => import('./store.json'),\n studio: () => import('./studio.json'),\n trades: () => import('./trades.json'),\n wellness: () => import('./wellness.json'),\n yoga: () => import('./yoga.json'),\n}\n\n/** The styles that start a site of their own. */\nexport const SITE_STYLE_STARTER_IDS: readonly string[] = Object.keys(STARTERS)\n\nconst loaded = new Map<string, Promise<SiteStarterPayload | null>>()\n\n/** The site a style starts, or `null` for a style with none. */\nexport function siteStyleStarter(styleId: string): Promise<SiteStarterPayload | null> {\n const load = Object.prototype.hasOwnProperty.call(STARTERS, styleId) ? STARTERS[styleId] : undefined\n if (!load) return Promise.resolve(null)\n let starter = loaded.get(styleId)\n if (!starter) {\n starter = load().then((module) => ((module as { default?: unknown }).default ?? module) as SiteStarterPayload)\n // A load that failed is tried again on the next create, not remembered.\n starter.catch(() => loaded.delete(styleId))\n loaded.set(styleId, starter)\n }\n // A copy, so a create that adjusts what it writes never changes the next\n // one's. The payload is JSON as read, so a JSON round trip copies it whole.\n return starter.then((payload) => (payload ? (JSON.parse(JSON.stringify(payload)) as SiteStarterPayload) : null))\n}\n\n/** A product a store's starter lists, as its card shows it, for the owner to replace. */\nexport interface SiteStyleStarterProduct {\n name: string\n description: string\n seoDescription: string\n priceUsd: number\n /** A served path, under `/_static/starter/`. */\n photo: string\n}\n\n/** A post a blog's starter publishes, as the site's own first words. */\nexport interface SiteStyleStarterPost {\n title: string\n excerpt: string\n /** Markdown-lite, as a guided start's posts are written. */\n body: string\n seoDescription: string\n /** A served path, under `/_static/starter/`, or none. */\n cover: string | null\n}\n\n/**\n * The records a style's listings list (2026-12-01): a store's products and a\n * blog's posts, which its Home page's product grid and posts show. GENERATED\n * beside the starter, into `records/<kind>.json`, by the same script.\n */\nexport interface SiteStyleStarterRecords {\n products?: SiteStyleStarterProduct[]\n posts?: SiteStyleStarterPost[]\n}\n\nconst RECORDS: Readonly<Record<string, () => Promise<unknown>>> = {\n blog: () => import('./records/blog.json'),\n store: () => import('./records/store.json'),\n}\n\n/** The styles whose starter lists records of its own. */\nexport const SITE_STYLE_RECORDS_IDS: readonly string[] = Object.keys(RECORDS)\n\n/** The records a style's starter writes, or `null` for a style that lists none. */\nexport async function siteStyleStarterRecords(styleId: string): Promise<SiteStyleStarterRecords | null> {\n const load = Object.prototype.hasOwnProperty.call(RECORDS, styleId) ? RECORDS[styleId] : undefined\n if (!load) return null\n const loaded = (await load()) as { default?: unknown }\n return JSON.parse(JSON.stringify(loaded.default ?? loaded)) as SiteStyleStarterRecords\n}\n"],"names":["STARTERS","beauty","blog","business","education","events","fitness","landing","music","nonprofit","personal","photography","portfolio","professional","realestate","restaurant","store","studio","trades","wellness","yoga","SITE_STYLE_STARTER_IDS","Object","keys","loaded","Map","siteStyleStarter","styleId","load","prototype","hasOwnProperty","call","undefined","Promise","resolve","starter","get","then","module","default","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AC,CAACC;gBAAY;oBAAA,kBAAA,AAACA,OAAiCC,OAAO,YAAzC,kBAA6CD;;QAChF,wEAAwE;QACxEH,QAAQK,KAAK,CAAC,IAAMhB,OAAOiB,MAAM,CAACd;QAClCH,OAAOkB,GAAG,CAACf,SAASQ;IACtB;IACA,yEAAyE;IACzE,4EAA4E;IAC5E,OAAOA,QAAQE,IAAI,CAAC,CAACM,UAAaA,UAAWC,KAAKC,KAAK,CAACD,KAAKE,SAAS,CAACH,YAAmC;AAC5G;AAiCA,MAAMI,UAA4D;IAChE7C,MAAM,IAAM,MAAM,CAAC;IACnBc,OAAO,IAAM,MAAM,CAAC;AACtB;AAEA,uDAAuD,GACvD,OAAO,MAAMgC,yBAA4C1B,OAAOC,IAAI,CAACwB,SAAQ;AAE7E,iFAAiF,GACjF,OAAO,eAAeE,wBAAwBtB,OAAe;QAI1BH;IAHjC,MAAMI,OAAON,OAAOO,SAAS,CAACC,cAAc,CAACC,IAAI,CAACgB,SAASpB,WAAWoB,OAAO,CAACpB,QAAQ,GAAGK;IACzF,IAAI,CAACJ,MAAM,OAAO;IAClB,MAAMJ,SAAU,MAAMI;IACtB,OAAOgB,KAAKC,KAAK,CAACD,KAAKE,SAAS,EAACtB,kBAAAA,OAAOe,OAAO,YAAdf,kBAAkBA;AACrD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { SiteStyleRecordsSite, SiteStyleRecordsWritten } from '@aglyn/aglyn/plugin-manager/plugin-site-style-looks';
|
|
18
|
+
import { pluginResourceDraftWriter } from '@aglyn/aglyn/plugin-manager/plugin-resource-drafts';
|
|
19
|
+
import { publishContentEntries, writeContentCollection, writeContentEntryDraft } from '@aglyn/tenant-data-admin/server/content-entry-drafts';
|
|
20
|
+
import { aiSiteContentRefusal } from '../jobs/ai-job-site-content';
|
|
21
|
+
import { siteStyleStarterRecords } from '.';
|
|
22
|
+
type Firestore = FirebaseFirestore.Firestore;
|
|
23
|
+
/**
|
|
24
|
+
* THE RECORDS A STYLE'S STARTER LISTS (2026-12-01).
|
|
25
|
+
*
|
|
26
|
+
* A store's starter Home page has a product grid and a blog's lists the
|
|
27
|
+
* blog's posts, so a site created from either is written the example's
|
|
28
|
+
* records beside its pages, as the card pictured them: the same as a guided
|
|
29
|
+
* start writes its first products and posts (`ai-job-site-content.ts`,
|
|
30
|
+
* AGL-3676), through the same rules.
|
|
31
|
+
*
|
|
32
|
+
* - PRODUCTS go through the commerce plugin's `product` draft writer:
|
|
33
|
+
* LISTED at once (`comingSoon`), so the storefront shows "Price coming
|
|
34
|
+
* soon" and no door sells one until the owner prices it; marked a SAMPLE
|
|
35
|
+
* (`sample`, AGL-4065), which Products shows as one to replace and the
|
|
36
|
+
* storefront never does. Asked first what a guided start's products are
|
|
37
|
+
* (`aiSiteContentRefusal`: the plan's commerce feature, Commerce on for the
|
|
38
|
+
* site, the role, the allowance): a site that may not have them gets none,
|
|
39
|
+
* and its grid shows its empty state. The Free plan includes no product.
|
|
40
|
+
* - POSTS go in a content collection "Blog" at `/blog` (the address the
|
|
41
|
+
* page's listing and links read), each a draft bylined with the site's
|
|
42
|
+
* name, then PUBLISHED, as the site itself is born published.
|
|
43
|
+
*
|
|
44
|
+
* Never throws and never refuses the create: the site already exists, and
|
|
45
|
+
* what was not written is the owner's to add. Ids are fixed per record, so a
|
|
46
|
+
* second call writes nothing twice.
|
|
47
|
+
*/
|
|
48
|
+
/** The address a blog starter's posts are served at: its listing's `collectionSlug`. */
|
|
49
|
+
export declare const SITE_STYLE_BLOG_SLUG = "blog";
|
|
50
|
+
/** The id a style starter's Blog collection, its `index`th post, and its `index`th product are written under. */
|
|
51
|
+
export declare const SITE_STYLE_BLOG_ID = "style-starter-blog";
|
|
52
|
+
export declare const siteStyleStarterPostId: (index: number) => string;
|
|
53
|
+
export declare const siteStyleStarterProductId: (index: number) => string;
|
|
54
|
+
export interface SiteStyleRecordsDeps {
|
|
55
|
+
firestore?: () => Firestore;
|
|
56
|
+
records?: typeof siteStyleStarterRecords;
|
|
57
|
+
writerFor?: typeof pluginResourceDraftWriter;
|
|
58
|
+
productsRefusal?: typeof aiSiteContentRefusal;
|
|
59
|
+
writeCollection?: typeof writeContentCollection;
|
|
60
|
+
writeEntry?: typeof writeContentEntryDraft;
|
|
61
|
+
publish?: typeof publishContentEntries;
|
|
62
|
+
}
|
|
63
|
+
/** Writes the records a style's starter lists on the site created from it. */
|
|
64
|
+
export declare function writeSiteStyleStarterRecords(styleId: string, site: SiteStyleRecordsSite, deps?: SiteStyleRecordsDeps): Promise<SiteStyleRecordsWritten>;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
17
|
+
import { pluginResourceDraftWriter } from "@aglyn/aglyn/plugin-manager/plugin-resource-drafts";
|
|
18
|
+
import { publishContentEntries, writeContentCollection, writeContentEntryDraft } from "@aglyn/tenant-data-admin/server/content-entry-drafts";
|
|
19
|
+
import { firebaseAdmin } from "@aglyn/tenant-data-admin/server/firebase-admin";
|
|
20
|
+
import { aiSiteContentRefusal } from "../jobs/ai-job-site-content.js";
|
|
21
|
+
import { AI_SITE_BLOG_NAME } from "../model/ai-site-job.js";
|
|
22
|
+
import { siteStyleStarterRecords } from "./index.js";
|
|
23
|
+
/**
|
|
24
|
+
* THE RECORDS A STYLE'S STARTER LISTS (2026-12-01).
|
|
25
|
+
*
|
|
26
|
+
* A store's starter Home page has a product grid and a blog's lists the
|
|
27
|
+
* blog's posts, so a site created from either is written the example's
|
|
28
|
+
* records beside its pages, as the card pictured them: the same as a guided
|
|
29
|
+
* start writes its first products and posts (`ai-job-site-content.ts`,
|
|
30
|
+
* AGL-3676), through the same rules.
|
|
31
|
+
*
|
|
32
|
+
* - PRODUCTS go through the commerce plugin's `product` draft writer:
|
|
33
|
+
* LISTED at once (`comingSoon`), so the storefront shows "Price coming
|
|
34
|
+
* soon" and no door sells one until the owner prices it; marked a SAMPLE
|
|
35
|
+
* (`sample`, AGL-4065), which Products shows as one to replace and the
|
|
36
|
+
* storefront never does. Asked first what a guided start's products are
|
|
37
|
+
* (`aiSiteContentRefusal`: the plan's commerce feature, Commerce on for the
|
|
38
|
+
* site, the role, the allowance): a site that may not have them gets none,
|
|
39
|
+
* and its grid shows its empty state. The Free plan includes no product.
|
|
40
|
+
* - POSTS go in a content collection "Blog" at `/blog` (the address the
|
|
41
|
+
* page's listing and links read), each a draft bylined with the site's
|
|
42
|
+
* name, then PUBLISHED, as the site itself is born published.
|
|
43
|
+
*
|
|
44
|
+
* Never throws and never refuses the create: the site already exists, and
|
|
45
|
+
* what was not written is the owner's to add. Ids are fixed per record, so a
|
|
46
|
+
* second call writes nothing twice.
|
|
47
|
+
*/ /** The address a blog starter's posts are served at: its listing's `collectionSlug`. */ export const SITE_STYLE_BLOG_SLUG = 'blog';
|
|
48
|
+
/** The id a style starter's Blog collection, its `index`th post, and its `index`th product are written under. */ export const SITE_STYLE_BLOG_ID = 'style-starter-blog';
|
|
49
|
+
export const siteStyleStarterPostId = (index)=>`style-starter-post-${index}`;
|
|
50
|
+
export const siteStyleStarterProductId = (index)=>`style-starter-product-${index}`;
|
|
51
|
+
/** How the records say they arrived, as the site's own create does. */ const VIA = 'system:starter';
|
|
52
|
+
/** Writes the records a style's starter lists on the site created from it. */ export async function writeSiteStyleStarterRecords(styleId, site, deps = {}) {
|
|
53
|
+
var _deps_records, _deps_firestore;
|
|
54
|
+
var _records_products, _records_posts;
|
|
55
|
+
const written = {
|
|
56
|
+
products: 0,
|
|
57
|
+
posts: 0
|
|
58
|
+
};
|
|
59
|
+
const records = await ((_deps_records = deps.records) != null ? _deps_records : siteStyleStarterRecords)(styleId).catch((error)=>{
|
|
60
|
+
console.error('style starter records: could not be read', {
|
|
61
|
+
styleId,
|
|
62
|
+
error
|
|
63
|
+
});
|
|
64
|
+
return null;
|
|
65
|
+
});
|
|
66
|
+
if (!records) return written;
|
|
67
|
+
const firestore = ((_deps_firestore = deps.firestore) != null ? _deps_firestore : ()=>firebaseAdmin.app().firestore())();
|
|
68
|
+
if ((_records_products = records.products) == null ? void 0 : _records_products.length) {
|
|
69
|
+
written.products = await writeProducts(firestore, records.products, site, deps).catch((error)=>{
|
|
70
|
+
console.error('style starter records: products threw', {
|
|
71
|
+
hostId: site.hostId,
|
|
72
|
+
error
|
|
73
|
+
});
|
|
74
|
+
return 0;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if ((_records_posts = records.posts) == null ? void 0 : _records_posts.length) {
|
|
78
|
+
written.posts = await writePosts(firestore, records.posts, site, deps).catch((error)=>{
|
|
79
|
+
console.error('style starter records: posts threw', {
|
|
80
|
+
hostId: site.hostId,
|
|
81
|
+
error
|
|
82
|
+
});
|
|
83
|
+
return 0;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return written;
|
|
87
|
+
}
|
|
88
|
+
async function writeProducts(firestore, products, site, deps) {
|
|
89
|
+
var _deps_writerFor, _deps_productsRefusal;
|
|
90
|
+
const keeper = ((_deps_writerFor = deps.writerFor) != null ? _deps_writerFor : pluginResourceDraftWriter)('product');
|
|
91
|
+
if (!keeper) return 0;
|
|
92
|
+
const refused = await ((_deps_productsRefusal = deps.productsRefusal) != null ? _deps_productsRefusal : aiSiteContentRefusal)('products', {
|
|
93
|
+
firestore,
|
|
94
|
+
org: site.org,
|
|
95
|
+
now: site.now,
|
|
96
|
+
job: {
|
|
97
|
+
orgId: site.orgId,
|
|
98
|
+
hostId: site.hostId,
|
|
99
|
+
createdBy: site.uid,
|
|
100
|
+
inputs: {}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
// Not on this plan, or not for this member or site: the grid shows its empty state.
|
|
104
|
+
if (refused) return 0;
|
|
105
|
+
let count = 0;
|
|
106
|
+
for (const [index, product] of products.entries()){
|
|
107
|
+
const result = await keeper.writer.write({
|
|
108
|
+
orgId: site.orgId,
|
|
109
|
+
hostId: site.hostId,
|
|
110
|
+
uid: site.uid,
|
|
111
|
+
via: VIA,
|
|
112
|
+
org: site.org,
|
|
113
|
+
now: site.now,
|
|
114
|
+
id: siteStyleStarterProductId(index),
|
|
115
|
+
name: product.name,
|
|
116
|
+
content: {
|
|
117
|
+
name: product.name,
|
|
118
|
+
description: product.description,
|
|
119
|
+
seoTitle: product.name,
|
|
120
|
+
seoDescription: product.seoDescription,
|
|
121
|
+
priceUsd: product.priceUsd,
|
|
122
|
+
mediaUrls: [
|
|
123
|
+
product.photo
|
|
124
|
+
],
|
|
125
|
+
comingSoon: true,
|
|
126
|
+
sample: true
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
if (result.ok === false) {
|
|
130
|
+
// A 400 is the product's rules refusing what we made: that one is left
|
|
131
|
+
// out. Anything else (the allowance, the role) stops the rest.
|
|
132
|
+
console.error('style starter records: a product was refused', {
|
|
133
|
+
hostId: site.hostId,
|
|
134
|
+
index,
|
|
135
|
+
error: result.error
|
|
136
|
+
});
|
|
137
|
+
if (result.status !== 400) break;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
count += 1;
|
|
141
|
+
}
|
|
142
|
+
return count;
|
|
143
|
+
}
|
|
144
|
+
async function writePosts(firestore, posts, site, deps) {
|
|
145
|
+
var _deps_writeCollection, _deps_publish;
|
|
146
|
+
const blog = await ((_deps_writeCollection = deps.writeCollection) != null ? _deps_writeCollection : writeContentCollection)(firestore, {
|
|
147
|
+
hostId: site.hostId,
|
|
148
|
+
uid: site.uid,
|
|
149
|
+
id: SITE_STYLE_BLOG_ID,
|
|
150
|
+
displayName: AI_SITE_BLOG_NAME,
|
|
151
|
+
slugs: [
|
|
152
|
+
SITE_STYLE_BLOG_SLUG
|
|
153
|
+
],
|
|
154
|
+
now: site.now
|
|
155
|
+
});
|
|
156
|
+
if (blog.ok === false) {
|
|
157
|
+
console.error('style starter records: the blog was refused', {
|
|
158
|
+
hostId: site.hostId,
|
|
159
|
+
error: blog.error
|
|
160
|
+
});
|
|
161
|
+
return 0;
|
|
162
|
+
}
|
|
163
|
+
const ids = [];
|
|
164
|
+
for (const [index, post] of posts.entries()){
|
|
165
|
+
var _deps_writeEntry;
|
|
166
|
+
const entry = await ((_deps_writeEntry = deps.writeEntry) != null ? _deps_writeEntry : writeContentEntryDraft)(firestore, {
|
|
167
|
+
hostId: site.hostId,
|
|
168
|
+
collectionId: blog.id,
|
|
169
|
+
uid: site.uid,
|
|
170
|
+
id: siteStyleStarterPostId(index),
|
|
171
|
+
content: _extends({
|
|
172
|
+
title: post.title,
|
|
173
|
+
excerpt: post.excerpt,
|
|
174
|
+
body: post.body,
|
|
175
|
+
seoDescription: post.seoDescription
|
|
176
|
+
}, post.cover ? {
|
|
177
|
+
coverImage: post.cover,
|
|
178
|
+
coverImageAlt: post.title
|
|
179
|
+
} : {}, site.siteName ? {
|
|
180
|
+
authorName: site.siteName
|
|
181
|
+
} : {}),
|
|
182
|
+
now: site.now
|
|
183
|
+
});
|
|
184
|
+
if (entry.ok === false) {
|
|
185
|
+
console.error('style starter records: a post was refused', {
|
|
186
|
+
hostId: site.hostId,
|
|
187
|
+
index,
|
|
188
|
+
error: entry.error
|
|
189
|
+
});
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
ids.push(entry.id);
|
|
193
|
+
}
|
|
194
|
+
if (!ids.length) return 0;
|
|
195
|
+
const published = await ((_deps_publish = deps.publish) != null ? _deps_publish : publishContentEntries)(firestore, {
|
|
196
|
+
hostId: site.hostId,
|
|
197
|
+
collectionId: blog.id,
|
|
198
|
+
uid: site.uid,
|
|
199
|
+
ids,
|
|
200
|
+
now: site.now
|
|
201
|
+
});
|
|
202
|
+
if ('ok' in published) {
|
|
203
|
+
console.error('style starter records: the posts stay drafts', {
|
|
204
|
+
hostId: site.hostId,
|
|
205
|
+
error: published.error
|
|
206
|
+
});
|
|
207
|
+
return 0;
|
|
208
|
+
}
|
|
209
|
+
return published.published.length;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
//# sourceMappingURL=records.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/site-style-starters/records.server.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n SiteStyleRecordsSite,\n SiteStyleRecordsWritten,\n} from '@aglyn/aglyn/plugin-manager/plugin-site-style-looks'\nimport { pluginResourceDraftWriter } from '@aglyn/aglyn/plugin-manager/plugin-resource-drafts'\nimport {\n publishContentEntries,\n writeContentCollection,\n writeContentEntryDraft,\n} from '@aglyn/tenant-data-admin/server/content-entry-drafts'\nimport { firebaseAdmin } from '@aglyn/tenant-data-admin/server/firebase-admin'\nimport { aiSiteContentRefusal } from '../jobs/ai-job-site-content'\nimport { AI_SITE_BLOG_NAME } from '../model/ai-site-job'\nimport { siteStyleStarterRecords, type SiteStyleStarterPost, type SiteStyleStarterProduct } from '.'\n\ntype Firestore = FirebaseFirestore.Firestore\n\n/**\n * THE RECORDS A STYLE'S STARTER LISTS (2026-12-01).\n *\n * A store's starter Home page has a product grid and a blog's lists the\n * blog's posts, so a site created from either is written the example's\n * records beside its pages, as the card pictured them: the same as a guided\n * start writes its first products and posts (`ai-job-site-content.ts`,\n * AGL-3676), through the same rules.\n *\n * - PRODUCTS go through the commerce plugin's `product` draft writer:\n * LISTED at once (`comingSoon`), so the storefront shows \"Price coming\n * soon\" and no door sells one until the owner prices it; marked a SAMPLE\n * (`sample`, AGL-4065), which Products shows as one to replace and the\n * storefront never does. Asked first what a guided start's products are\n * (`aiSiteContentRefusal`: the plan's commerce feature, Commerce on for the\n * site, the role, the allowance): a site that may not have them gets none,\n * and its grid shows its empty state. The Free plan includes no product.\n * - POSTS go in a content collection \"Blog\" at `/blog` (the address the\n * page's listing and links read), each a draft bylined with the site's\n * name, then PUBLISHED, as the site itself is born published.\n *\n * Never throws and never refuses the create: the site already exists, and\n * what was not written is the owner's to add. Ids are fixed per record, so a\n * second call writes nothing twice.\n */\n\n/** The address a blog starter's posts are served at: its listing's `collectionSlug`. */\nexport const SITE_STYLE_BLOG_SLUG = 'blog'\n\n/** The id a style starter's Blog collection, its `index`th post, and its `index`th product are written under. */\nexport const SITE_STYLE_BLOG_ID = 'style-starter-blog'\nexport const siteStyleStarterPostId = (index: number): string => `style-starter-post-${index}`\nexport const siteStyleStarterProductId = (index: number): string => `style-starter-product-${index}`\n\n/** How the records say they arrived, as the site's own create does. */\nconst VIA = 'system:starter'\n\nexport interface SiteStyleRecordsDeps {\n firestore?: () => Firestore\n records?: typeof siteStyleStarterRecords\n writerFor?: typeof pluginResourceDraftWriter\n productsRefusal?: typeof aiSiteContentRefusal\n writeCollection?: typeof writeContentCollection\n writeEntry?: typeof writeContentEntryDraft\n publish?: typeof publishContentEntries\n}\n\n/** Writes the records a style's starter lists on the site created from it. */\nexport async function writeSiteStyleStarterRecords(\n styleId: string,\n site: SiteStyleRecordsSite,\n deps: SiteStyleRecordsDeps = {},\n): Promise<SiteStyleRecordsWritten> {\n const written: SiteStyleRecordsWritten = { products: 0, posts: 0 }\n const records = await (deps.records ?? siteStyleStarterRecords)(styleId).catch((error: unknown) => {\n console.error('style starter records: could not be read', { styleId, error })\n return null\n })\n if (!records) return written\n const firestore = (deps.firestore ?? (() => firebaseAdmin.app().firestore() as unknown as Firestore))()\n if (records.products?.length) {\n written.products = await writeProducts(firestore, records.products, site, deps).catch((error: unknown) => {\n console.error('style starter records: products threw', { hostId: site.hostId, error })\n return 0\n })\n }\n if (records.posts?.length) {\n written.posts = await writePosts(firestore, records.posts, site, deps).catch((error: unknown) => {\n console.error('style starter records: posts threw', { hostId: site.hostId, error })\n return 0\n })\n }\n return written\n}\n\nasync function writeProducts(\n firestore: Firestore,\n products: readonly SiteStyleStarterProduct[],\n site: SiteStyleRecordsSite,\n deps: SiteStyleRecordsDeps,\n): Promise<number> {\n const keeper = (deps.writerFor ?? pluginResourceDraftWriter)('product')\n if (!keeper) return 0\n const refused = await (deps.productsRefusal ?? aiSiteContentRefusal)('products', {\n firestore,\n org: site.org,\n now: site.now,\n job: { orgId: site.orgId, hostId: site.hostId, createdBy: site.uid, inputs: {} },\n })\n // Not on this plan, or not for this member or site: the grid shows its empty state.\n if (refused) return 0\n let count = 0\n for (const [index, product] of products.entries()) {\n const result = await keeper.writer.write({\n orgId: site.orgId,\n hostId: site.hostId,\n uid: site.uid,\n via: VIA,\n org: site.org,\n now: site.now,\n id: siteStyleStarterProductId(index),\n name: product.name,\n content: {\n name: product.name,\n description: product.description,\n seoTitle: product.name,\n seoDescription: product.seoDescription,\n priceUsd: product.priceUsd,\n mediaUrls: [product.photo],\n comingSoon: true,\n sample: true,\n },\n })\n if (result.ok === false) {\n // A 400 is the product's rules refusing what we made: that one is left\n // out. Anything else (the allowance, the role) stops the rest.\n console.error('style starter records: a product was refused', { hostId: site.hostId, index, error: result.error })\n if (result.status !== 400) break\n continue\n }\n count += 1\n }\n return count\n}\n\nasync function writePosts(\n firestore: Firestore,\n posts: readonly SiteStyleStarterPost[],\n site: SiteStyleRecordsSite,\n deps: SiteStyleRecordsDeps,\n): Promise<number> {\n const blog = await (deps.writeCollection ?? writeContentCollection)(firestore, {\n hostId: site.hostId,\n uid: site.uid,\n id: SITE_STYLE_BLOG_ID,\n displayName: AI_SITE_BLOG_NAME,\n slugs: [SITE_STYLE_BLOG_SLUG],\n now: site.now,\n })\n if (blog.ok === false) {\n console.error('style starter records: the blog was refused', { hostId: site.hostId, error: blog.error })\n return 0\n }\n const ids: string[] = []\n for (const [index, post] of posts.entries()) {\n const entry = await (deps.writeEntry ?? writeContentEntryDraft)(firestore, {\n hostId: site.hostId,\n collectionId: blog.id,\n uid: site.uid,\n id: siteStyleStarterPostId(index),\n content: {\n title: post.title,\n excerpt: post.excerpt,\n body: post.body,\n seoDescription: post.seoDescription,\n ...(post.cover ? { coverImage: post.cover, coverImageAlt: post.title } : {}),\n ...(site.siteName ? { authorName: site.siteName } : {}),\n },\n now: site.now,\n })\n if (entry.ok === false) {\n console.error('style starter records: a post was refused', { hostId: site.hostId, index, error: entry.error })\n continue\n }\n ids.push(entry.id)\n }\n if (!ids.length) return 0\n const published = await (deps.publish ?? publishContentEntries)(firestore, {\n hostId: site.hostId,\n collectionId: blog.id,\n uid: site.uid,\n ids,\n now: site.now,\n })\n if ('ok' in published) {\n console.error('style starter records: the posts stay drafts', { hostId: site.hostId, error: published.error })\n return 0\n }\n return published.published.length\n}\n"],"names":["pluginResourceDraftWriter","publishContentEntries","writeContentCollection","writeContentEntryDraft","firebaseAdmin","aiSiteContentRefusal","AI_SITE_BLOG_NAME","siteStyleStarterRecords","SITE_STYLE_BLOG_SLUG","SITE_STYLE_BLOG_ID","siteStyleStarterPostId","index","siteStyleStarterProductId","VIA","writeSiteStyleStarterRecords","styleId","site","deps","records","written","products","posts","catch","error","console","firestore","app","length","writeProducts","hostId","writePosts","keeper","writerFor","refused","productsRefusal","org","now","job","orgId","createdBy","uid","inputs","count","product","entries","result","writer","write","via","id","name","content","description","seoTitle","seoDescription","priceUsd","mediaUrls","photo","comingSoon","sample","ok","status","blog","writeCollection","displayName","slugs","ids","post","entry","writeEntry","collectionId","title","excerpt","body","cover","coverImage","coverImageAlt","siteName","authorName","push","published","publish"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAMD,SAASA,yBAAyB,QAAQ,qDAAoD;AAC9F,SACEC,qBAAqB,EACrBC,sBAAsB,EACtBC,sBAAsB,QACjB,uDAAsD;AAC7D,SAASC,aAAa,QAAQ,iDAAgD;AAC9E,SAASC,oBAAoB,QAAQ,iCAA6B;AAClE,SAASC,iBAAiB,QAAQ,0BAAsB;AACxD,SAASC,uBAAuB,QAAiE,aAAG;AAIpG;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GAED,sFAAsF,GACtF,OAAO,MAAMC,uBAAuB,OAAM;AAE1C,+GAA+G,GAC/G,OAAO,MAAMC,qBAAqB,qBAAoB;AACtD,OAAO,MAAMC,yBAAyB,CAACC,QAA0B,CAAC,mBAAmB,EAAEA,OAAO,CAAA;AAC9F,OAAO,MAAMC,4BAA4B,CAACD,QAA0B,CAAC,sBAAsB,EAAEA,OAAO,CAAA;AAE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