@brightsideoy/kama 1.0.0-alpha.2 → 1.0.0-alpha.21
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/bin/cli.js +604 -364
- package/content/definitions/block-kama-forms.yaml +5 -0
- package/content/definitions/blocks/button.yaml +15 -5
- package/content/definitions/blocks/image-gallery.yaml +34 -0
- package/content/definitions/blocks/node-list.yaml +75 -0
- package/content/definitions/blocks/youtube.yaml +8 -0
- package/content/definitions/field-sets/access.yaml +10 -0
- package/content/definitions/field-sets/channel-base.yaml +7 -0
- package/content/definitions/field-sets/page-base.yaml +16 -1
- package/content/definitions/nodes/article.yaml +17 -1
- package/content/definitions/taxonomies/categories.yaml +5 -2
- package/content/definitions/taxonomies/media-tag.yaml +15 -0
- package/content/definitions/taxonomies/tags.yaml +5 -2
- package/content/forms/contact.yaml +44 -0
- package/content/forms/subscription.yaml +32 -0
- package/definitions/editor/default.ts +15 -1
- package/dist/assets/AssetEditor-B4W7tV1a.js +1 -0
- package/dist/assets/AssetEditor-D9sz6bfN.css +1 -0
- package/dist/assets/CmsBadge-BNsgxyyB.css +1 -0
- package/dist/assets/CmsBadge-D0Ob9qPU.js +1 -0
- package/dist/assets/CmsButton-BQ85-YXn.css +1 -0
- package/dist/assets/CmsButton-CbOfxvjr.js +1 -0
- package/dist/assets/CmsDataRow--H4iI_u_.js +1 -0
- package/dist/assets/CmsDataRow-CYNxfVaZ.css +1 -0
- package/dist/assets/CmsFieldTaxonomy-CVlKL-l2.css +1 -0
- package/dist/assets/CmsFieldTaxonomy-C_AwHDwY.js +1 -0
- package/dist/assets/CmsHelp-BO_vWABq.css +1 -0
- package/dist/assets/CmsHelp-BQkr9KyU.js +1 -0
- package/dist/assets/CmsImagePreview-CujwG8r_.css +1 -0
- package/dist/assets/CmsImagePreview-DuHPBzml.js +1 -0
- package/dist/assets/CmsPaneResizer-B62ZqsnE.js +1 -0
- package/dist/assets/CmsPaneResizer-Dkidd4pI.css +1 -0
- package/dist/assets/CmsPublisher-CugEqTD8.css +1 -0
- package/dist/assets/CmsPublisher-XSCPrp5L.js +3 -0
- package/dist/assets/CmsUserCenter-Ac0GywlR.css +1 -0
- package/dist/assets/CmsUserCenter-D3XDzKDC.js +1 -0
- package/dist/assets/EditorSplitPreview-BzKh4wFB.css +1 -0
- package/dist/assets/EditorSplitPreview-Cp2x0O_P.js +1 -0
- package/dist/assets/NodeContextMenu-BYeWzmQ5.css +1 -0
- package/dist/assets/NodeContextMenu-C_HWBGeb.js +1 -0
- package/dist/assets/NodeEditor-4TsNvk2f.css +1 -0
- package/dist/assets/NodeEditor-DA5GRtRP.js +161 -0
- package/dist/assets/StatusPill-CbeW5SMT.js +1 -0
- package/dist/assets/StatusPill-Dlm6uvGe.css +1 -0
- package/dist/assets/TrashWorkspace-CATe46WF.js +1 -0
- package/dist/assets/TrashWorkspace-DtMgxg13.css +1 -0
- package/dist/assets/_plugin-vue_export-helper-CQxWhVtr.js +5 -0
- package/dist/assets/circle-check-A-QeFqt3.js +1 -0
- package/dist/assets/database-hg5SqKLG.js +1 -0
- package/dist/assets/folder-tree-BWYot72H.js +1 -0
- package/dist/assets/globe-BraoljaN.js +1 -0
- package/dist/assets/history-pqIbKK9u.js +1 -0
- package/dist/assets/index-CY0VYSyt.css +1 -0
- package/dist/assets/index-DdG9Pozx.js +14 -0
- package/dist/assets/layers-B6RgfpPR.js +1 -0
- package/dist/assets/loader-circle-BoUkhDjq.js +1 -0
- package/dist/assets/monitor-CrpvInqG.js +1 -0
- package/dist/assets/panel-left-close-CVFakVaA.js +1 -0
- package/dist/assets/plus-CX_GHzXs.js +1 -0
- package/dist/assets/rotate-ccw-CWE4pOjs.js +1 -0
- package/dist/assets/save-Ctv8vW9H.js +1 -0
- package/dist/assets/schema-helpers-DvficKko.js +1 -0
- package/dist/assets/send-F-mJeL54.js +1 -0
- package/dist/assets/smartphone-EPce6VdP.js +1 -0
- package/dist/assets/trash-2-CAUF1KtI.js +1 -0
- package/dist/assets/useLocalStorage-C805uplI.js +1 -0
- package/dist/assets/useNodes-CqFlc72m.js +1 -0
- package/dist/assets/user-IFlT6mYq.js +1 -0
- package/dist/build-seed.js +495 -0
- package/dist/{dist-Dy7-HUEG.js → dist-3Xc2TTZw.js} +3189 -1394
- package/dist/index.html +34 -2
- package/dist/index.js +3116 -1315
- package/dist/schema-compiler.js +5 -5
- package/documentation/EXTENSIONS.md +204 -0
- package/extension-registry.js +5 -0
- package/package.json +13 -6
- package/schema.sql +44 -1
- package/templates/astro-starter/src/components/blocks/BlockRenderer.astro +9 -0
- package/templates/astro-starter/src/components/blocks/Form.astro +143 -0
- package/templates/astro-starter/src/components/blocks/HeaderImage.astro +6 -12
- package/templates/astro-starter/src/components/blocks/ImageBlock.astro +5 -6
- package/templates/astro-starter/src/components/blocks/NodeList.astro +274 -0
- package/templates/astro-starter/src/components/global/Breadcrumb.astro +50 -9
- package/templates/astro-starter/src/components/global/Footer.astro +7 -46
- package/templates/astro-starter/src/components/global/Header.astro +10 -16
- package/templates/astro-starter/src/components/global/NavigationMenu.astro +68 -49
- package/templates/astro-starter/src/components/ui/KamaImage.astro +13 -5
- package/templates/astro-starter/src/layouts/StandardLayout.astro +4 -3
- package/templates/astro-starter/src/lib/cms.ts +33 -11
- package/templates/astro-starter/src/lib/media/kama-image-service.ts +15 -4
- package/templates/astro-starter/src/lib/media/media-proxy.ts +22 -3
- package/templates/astro-starter/src/lib/media/media-url.ts +17 -3
- package/templates/astro-starter/src/middleware.ts +158 -100
- package/templates/astro-starter/src/pages/[...slug].astro +77 -3
- package/templates/astro-starter/src/pages/api/load-nodes.ts +68 -0
- package/templates/astro-starter/src/pages/api/partials/node-cards.astro +101 -0
- package/templates/kama-worker/index.js +38 -15
- package/templates/kama-worker/server.js +13 -5
- package/templates/kama-worker/setup-local-db.mjs +17 -0
- package/dist/assets/index-F2rfUymo.css +0 -1
- package/dist/assets/index-lXxH3VFK.js +0 -164
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import e from "node:fs";
|
|
2
|
+
import t from "node:path";
|
|
3
|
+
//#region scripts/build-seed.ts
|
|
4
|
+
var n = [
|
|
5
|
+
{
|
|
6
|
+
city: "Tallinn",
|
|
7
|
+
area: "Harju County",
|
|
8
|
+
country: "Estonia",
|
|
9
|
+
zip: "10111",
|
|
10
|
+
lat: 59.437,
|
|
11
|
+
lng: 24.7535,
|
|
12
|
+
tz: "Europe/Tallinn"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
city: "London",
|
|
16
|
+
area: "Greater London",
|
|
17
|
+
country: "United Kingdom",
|
|
18
|
+
zip: "EC1A 1BB",
|
|
19
|
+
lat: 51.5074,
|
|
20
|
+
lng: -.1278,
|
|
21
|
+
tz: "Europe/London"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
city: "New York",
|
|
25
|
+
area: "NY",
|
|
26
|
+
country: "United States",
|
|
27
|
+
zip: "10001",
|
|
28
|
+
lat: 40.7128,
|
|
29
|
+
lng: -74.006,
|
|
30
|
+
tz: "America/New_York"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
city: "Berlin",
|
|
34
|
+
area: "Berlin State",
|
|
35
|
+
country: "Germany",
|
|
36
|
+
zip: "10115",
|
|
37
|
+
lat: 52.52,
|
|
38
|
+
lng: 13.405,
|
|
39
|
+
tz: "Europe/Berlin"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
city: "Tokyo",
|
|
43
|
+
area: "Kanto",
|
|
44
|
+
country: "Japan",
|
|
45
|
+
zip: "100-0001",
|
|
46
|
+
lat: 35.6762,
|
|
47
|
+
lng: 139.6503,
|
|
48
|
+
tz: "Asia/Tokyo"
|
|
49
|
+
}
|
|
50
|
+
], r = [
|
|
51
|
+
"Main St",
|
|
52
|
+
"Oak Ave",
|
|
53
|
+
"Narva mnt",
|
|
54
|
+
"Broadway",
|
|
55
|
+
"High St",
|
|
56
|
+
"Pärnu mnt",
|
|
57
|
+
"Sunset Blvd",
|
|
58
|
+
"Park Ave"
|
|
59
|
+
], i = [
|
|
60
|
+
"Emma",
|
|
61
|
+
"Liam",
|
|
62
|
+
"Olivia",
|
|
63
|
+
"Noah",
|
|
64
|
+
"Ava",
|
|
65
|
+
"Oliver",
|
|
66
|
+
"Isabella",
|
|
67
|
+
"Elijah",
|
|
68
|
+
"Sophia",
|
|
69
|
+
"William",
|
|
70
|
+
"Mia",
|
|
71
|
+
"James",
|
|
72
|
+
"Charlotte",
|
|
73
|
+
"Benjamin",
|
|
74
|
+
"Amelia",
|
|
75
|
+
"Lucas",
|
|
76
|
+
"Harper",
|
|
77
|
+
"Henry",
|
|
78
|
+
"Evelyn",
|
|
79
|
+
"Alexander"
|
|
80
|
+
], a = [
|
|
81
|
+
"Smith",
|
|
82
|
+
"Johnson",
|
|
83
|
+
"Williams",
|
|
84
|
+
"Brown",
|
|
85
|
+
"Jones",
|
|
86
|
+
"Garcia",
|
|
87
|
+
"Miller",
|
|
88
|
+
"Davis",
|
|
89
|
+
"Rodriguez",
|
|
90
|
+
"Martinez",
|
|
91
|
+
"Hernandez",
|
|
92
|
+
"Lopez",
|
|
93
|
+
"Gonzalez",
|
|
94
|
+
"Wilson",
|
|
95
|
+
"Anderson",
|
|
96
|
+
"Thomas",
|
|
97
|
+
"Taylor",
|
|
98
|
+
"Moore",
|
|
99
|
+
"Jackson",
|
|
100
|
+
"Martin"
|
|
101
|
+
], o = [
|
|
102
|
+
"Senior Engineer",
|
|
103
|
+
"Product Manager",
|
|
104
|
+
"Lead Designer",
|
|
105
|
+
"Content Strategist",
|
|
106
|
+
"DevOps Specialist",
|
|
107
|
+
"Marketing Director",
|
|
108
|
+
"Data Scientist",
|
|
109
|
+
"System Architect"
|
|
110
|
+
], s = [
|
|
111
|
+
"Corporate Tech Summit",
|
|
112
|
+
"Developer Conference",
|
|
113
|
+
"Design System Workshop",
|
|
114
|
+
"API Masterclass",
|
|
115
|
+
"AI & Edge Computing Expo",
|
|
116
|
+
"Product Design Forum",
|
|
117
|
+
"Vue & TypeScript Meetup"
|
|
118
|
+
], c = [
|
|
119
|
+
"Future of Web Development",
|
|
120
|
+
"Mastering Vue 3 and TypeScript",
|
|
121
|
+
"SQLite Performance Strategies",
|
|
122
|
+
"Design Systems at Scale",
|
|
123
|
+
"Building Scalable Architecture",
|
|
124
|
+
"Optimizing CMS Workflows",
|
|
125
|
+
"Tailwind CSS Tricks",
|
|
126
|
+
"Modern API Security Patterns",
|
|
127
|
+
"Edge Computing Explained",
|
|
128
|
+
"Micro-Frontends in 2026",
|
|
129
|
+
"State Management Patterns",
|
|
130
|
+
"Headless CMS Tradeoffs"
|
|
131
|
+
], l = [
|
|
132
|
+
"Comprehensive Guide to",
|
|
133
|
+
"Deep Dive into",
|
|
134
|
+
"Secrets of",
|
|
135
|
+
"Practical Intro to",
|
|
136
|
+
"Advanced Tips for",
|
|
137
|
+
"The Complete Handbook of",
|
|
138
|
+
"Understanding",
|
|
139
|
+
"Future Outlook of"
|
|
140
|
+
], u = [
|
|
141
|
+
{
|
|
142
|
+
id: 1,
|
|
143
|
+
title: "Home",
|
|
144
|
+
slug: "home",
|
|
145
|
+
parentId: "NULL"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: 2,
|
|
149
|
+
title: "About Us",
|
|
150
|
+
slug: "about-us",
|
|
151
|
+
parentId: 1
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 3,
|
|
155
|
+
title: "Leadership & Team",
|
|
156
|
+
slug: "leadership",
|
|
157
|
+
parentId: 2
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: 4,
|
|
161
|
+
title: "Our Mission & Values",
|
|
162
|
+
slug: "mission",
|
|
163
|
+
parentId: 2
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: 5,
|
|
167
|
+
title: "Services",
|
|
168
|
+
slug: "services",
|
|
169
|
+
parentId: 1
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: 6,
|
|
173
|
+
title: "Enterprise Consulting",
|
|
174
|
+
slug: "enterprise-consulting",
|
|
175
|
+
parentId: 5
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: 7,
|
|
179
|
+
title: "Cloud Architecture",
|
|
180
|
+
slug: "cloud-architecture",
|
|
181
|
+
parentId: 5
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: 8,
|
|
185
|
+
title: "Solutions",
|
|
186
|
+
slug: "solutions",
|
|
187
|
+
parentId: 1
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: 9,
|
|
191
|
+
title: "Digital Transformation",
|
|
192
|
+
slug: "digital-transformation",
|
|
193
|
+
parentId: 8
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: 10,
|
|
197
|
+
title: "Careers",
|
|
198
|
+
slug: "careers",
|
|
199
|
+
parentId: 1
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
id: 11,
|
|
203
|
+
title: "Open Positions",
|
|
204
|
+
slug: "open-positions",
|
|
205
|
+
parentId: 10
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: 12,
|
|
209
|
+
title: "News & Press",
|
|
210
|
+
slug: "news",
|
|
211
|
+
parentId: 1
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
id: 13,
|
|
215
|
+
title: "Investor Relations",
|
|
216
|
+
slug: "investors",
|
|
217
|
+
parentId: 1
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
id: 14,
|
|
221
|
+
title: "Contact",
|
|
222
|
+
slug: "contact",
|
|
223
|
+
parentId: 1
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
id: 15,
|
|
227
|
+
title: "Global Offices",
|
|
228
|
+
slug: "offices",
|
|
229
|
+
parentId: 1
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: 16,
|
|
233
|
+
title: "Sustainability",
|
|
234
|
+
slug: "sustainability",
|
|
235
|
+
parentId: 2
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: 17,
|
|
239
|
+
title: "Partners",
|
|
240
|
+
slug: "partners",
|
|
241
|
+
parentId: 1
|
|
242
|
+
}
|
|
243
|
+
], d = [
|
|
244
|
+
{
|
|
245
|
+
id: 20,
|
|
246
|
+
title: "Store Home",
|
|
247
|
+
slug: "home",
|
|
248
|
+
parentId: "NULL"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
id: 21,
|
|
252
|
+
title: "Product Catalog",
|
|
253
|
+
slug: "catalog",
|
|
254
|
+
parentId: 20
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
id: 22,
|
|
258
|
+
title: "Bulk Ordering",
|
|
259
|
+
slug: "bulk-orders",
|
|
260
|
+
parentId: 20
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: 23,
|
|
264
|
+
title: "My Account",
|
|
265
|
+
slug: "account",
|
|
266
|
+
parentId: 20
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: 24,
|
|
270
|
+
title: "Support & Docs",
|
|
271
|
+
slug: "support",
|
|
272
|
+
parentId: 20
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
id: 25,
|
|
276
|
+
title: "API Documentation",
|
|
277
|
+
slug: "api",
|
|
278
|
+
parentId: 24
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
id: 26,
|
|
282
|
+
title: "Pricing",
|
|
283
|
+
slug: "pricing",
|
|
284
|
+
parentId: 20
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
id: 27,
|
|
288
|
+
title: "Enterprise Licensing",
|
|
289
|
+
slug: "enterprise-licensing",
|
|
290
|
+
parentId: 26
|
|
291
|
+
}
|
|
292
|
+
], f = [
|
|
293
|
+
{
|
|
294
|
+
id: 30,
|
|
295
|
+
title: "Privacy Policy",
|
|
296
|
+
slug: "privacy-policy",
|
|
297
|
+
parentId: "NULL"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
id: 31,
|
|
301
|
+
title: "Terms of Service",
|
|
302
|
+
slug: "terms-of-service",
|
|
303
|
+
parentId: "NULL"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
id: 32,
|
|
307
|
+
title: "Cookie Policy",
|
|
308
|
+
slug: "cookie-policy",
|
|
309
|
+
parentId: "NULL"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
id: 33,
|
|
313
|
+
title: "Refund Policy",
|
|
314
|
+
slug: "refund-policy",
|
|
315
|
+
parentId: "NULL"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
id: 34,
|
|
319
|
+
title: "Security Hub",
|
|
320
|
+
slug: "security",
|
|
321
|
+
parentId: "NULL"
|
|
322
|
+
}
|
|
323
|
+
];
|
|
324
|
+
function p(e) {
|
|
325
|
+
return `${l[e % l.length]} ${c[e * 7 % c.length]} #${e}`;
|
|
326
|
+
}
|
|
327
|
+
function m(e = 2024) {
|
|
328
|
+
let t = new Date(e, 0, 1).getTime();
|
|
329
|
+
return new Date(t + Math.random() * (Date.now() - t)).toISOString();
|
|
330
|
+
}
|
|
331
|
+
function h(e = 2024, t = 2026) {
|
|
332
|
+
let n = new Date(e, 0, 1).getTime(), r = new Date(t, 11, 31, 23, 59, 59).getTime();
|
|
333
|
+
return new Date(n + Math.random() * (r - n)).toISOString();
|
|
334
|
+
}
|
|
335
|
+
function g(e) {
|
|
336
|
+
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
337
|
+
}
|
|
338
|
+
function _(e) {
|
|
339
|
+
return e.replace(/\\/g, "\\\\").replace(/'/g, "''");
|
|
340
|
+
}
|
|
341
|
+
function v(e, t, n, r, i = 50) {
|
|
342
|
+
for (let a = 0; a < r.length; a += i) {
|
|
343
|
+
let o = r.slice(a, a + i);
|
|
344
|
+
e.push(`INSERT INTO ${t} (${n.join(", ")}) VALUES\n ${o.join(",\n ")};`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function y() {
|
|
348
|
+
console.log("⚡ Generating Massive Cloudflare D1-optimized seed chunks...");
|
|
349
|
+
let c = [];
|
|
350
|
+
c.push("PRAGMA foreign_keys = OFF;"), [
|
|
351
|
+
"sessions",
|
|
352
|
+
"user_accounts",
|
|
353
|
+
"node_revisions",
|
|
354
|
+
"content_blocks",
|
|
355
|
+
"tree_nodes",
|
|
356
|
+
"node_channels",
|
|
357
|
+
"node_relations",
|
|
358
|
+
"channel_trees",
|
|
359
|
+
"content_nodes",
|
|
360
|
+
"trees",
|
|
361
|
+
"channels",
|
|
362
|
+
"users"
|
|
363
|
+
].forEach((e) => c.push(`DELETE FROM ${e};`));
|
|
364
|
+
let l = "usr_admin_01";
|
|
365
|
+
c.push(`INSERT INTO users (id, email, name, globalRole) VALUES ('${l}', 'admin@example.com', 'Superadmin User', 'superadmin');`), c.push(`INSERT INTO user_accounts (id, userId, provider, providerAccountId, passwordHash) VALUES ('acc_admin_01', '${l}', 'credentials', 'admin@example.com', '\$2a\$10\$w82H/kG7k8bW8Vq5i4.D/.7n0s8s2h2X3f0j1k2l3m4n5o6p7q8r9');`), c.push(`INSERT INTO channels (id, key, label, channelType, defaultLanguage, isHidden, createdById) VALUES (1, 'corporate', 'Corporate Website', 'website', 'en', 0, '${l}');`), c.push(`INSERT INTO channels (id, key, label, channelType, defaultLanguage, isHidden, createdById) VALUES (2, 'campaigns', 'Campaigns', 'website', 'en', 0, '${l}');`), c.push(`INSERT INTO channels (id, key, label, channelType, defaultLanguage, isHidden, createdById) VALUES (3, 'store', 'Storefront', 'ecommerce', 'en', 0, '${l}');`), c.push(`INSERT INTO trees (id, key, label, treeType, channelId, createdById) VALUES (1, 'main-nav', 'Corporate Nav', 'navigation', 1, '${l}');`), c.push(`INSERT INTO trees (id, key, label, treeType, channelId, createdById) VALUES (2, 'legal-nav', 'Legal Nav', 'navigation', 1, '${l}');`), c.push(`INSERT INTO trees (id, key, label, treeType, channelId, createdById) VALUES (3, 'b2b-nav', 'Store Nav', 'navigation', 3, '${l}');`), c.push("INSERT INTO channel_trees (channelId, treeId, key) VALUES (1, 1, 'main');"), c.push("INSERT INTO channel_trees (channelId, treeId, key) VALUES (1, 2, 'footer');"), c.push("INSERT INTO channel_trees (channelId, treeId, key) VALUES (3, 3, 'main');");
|
|
366
|
+
let y = [], b = [], x = [], S = [], C = [];
|
|
367
|
+
function w(e, t) {
|
|
368
|
+
let n = `<h1>${t}</h1><p>Detailed overview regarding ${t}. Lorem ipsum dolor sit amet.</p>`, r = _(JSON.stringify({
|
|
369
|
+
content: n,
|
|
370
|
+
html: n,
|
|
371
|
+
body: n,
|
|
372
|
+
text: n
|
|
373
|
+
}));
|
|
374
|
+
S.push(`(${e}, 'content', 'text', '${r}', 0, 1)`), S.push(`(${e}, 'content', 'text', '${r}', 0, 0)`);
|
|
375
|
+
}
|
|
376
|
+
[
|
|
377
|
+
...u.map((e) => ({
|
|
378
|
+
...e,
|
|
379
|
+
cId: 1,
|
|
380
|
+
tId: 1
|
|
381
|
+
})),
|
|
382
|
+
...d.map((e) => ({
|
|
383
|
+
...e,
|
|
384
|
+
cId: 3,
|
|
385
|
+
tId: 3
|
|
386
|
+
})),
|
|
387
|
+
...f.map((e) => ({
|
|
388
|
+
...e,
|
|
389
|
+
cId: 1,
|
|
390
|
+
tId: 2
|
|
391
|
+
}))
|
|
392
|
+
].forEach((e, t) => {
|
|
393
|
+
let n = m(2024), r = e.parentId === "NULL", i = JSON.stringify({
|
|
394
|
+
channelId: e.cId,
|
|
395
|
+
channels: [e.cId],
|
|
396
|
+
menuTitle: e.title,
|
|
397
|
+
layoutId: r ? "single-column" : "inherit"
|
|
398
|
+
});
|
|
399
|
+
y.push(`(${e.id}, 'page', '${_(e.title)}', '${e.slug}', 0, 'published', '{}', '${_(i)}', '${_(i)}', '${_(i)}', '${n}', '${l}', '${l}', '${n}', '${n}')`), b.push(`(${e.id}, ${e.cId})`), x.push(`(${e.tId}, ${e.id}, ${e.parentId}, ${t + 1})`), w(e.id, e.title);
|
|
400
|
+
});
|
|
401
|
+
let T = 100, E = [];
|
|
402
|
+
console.log("Generating 500 People...");
|
|
403
|
+
for (let e = 1; e <= 500; e++) {
|
|
404
|
+
let t = i[e % i.length], n = a[e % a.length], r = `${t} ${n}`, s = m(2024), c = JSON.stringify({
|
|
405
|
+
firstName: t,
|
|
406
|
+
lastName: n,
|
|
407
|
+
position: o[e % o.length],
|
|
408
|
+
channels: [1]
|
|
409
|
+
});
|
|
410
|
+
y.push(`(${T}, 'person', '${_(r)}', '${g(r) + `-${e}`}', 0, 'published', '{}', '${_(c)}', '${_(c)}', '${_(c)}', '${s}', '${l}', '${l}', '${s}', '${s}')`), b.push(`(${T}, 1)`), E.push(T), T++;
|
|
411
|
+
}
|
|
412
|
+
console.log("Generating 500 Addresses...");
|
|
413
|
+
for (let e = 1; e <= 500; e++) {
|
|
414
|
+
let t = n[e % n.length], i = t.lat + (Math.random() - .5) * .15, a = t.lng + (Math.random() - .5) * .15, o = `${e * 12 % 199 + 1} ${r[e % r.length]}`, s = m(2024), c = JSON.stringify({
|
|
415
|
+
street: o,
|
|
416
|
+
city: t.city,
|
|
417
|
+
country: t.country,
|
|
418
|
+
zip: t.zip,
|
|
419
|
+
lat: i,
|
|
420
|
+
lng: a,
|
|
421
|
+
channels: [1]
|
|
422
|
+
});
|
|
423
|
+
y.push(`(${T}, 'address', '${_(`${t.city} Hub #${e}`)}', 'address-${t.city.toLowerCase()}-${e}', 0, 'published', '{}', '${_(c)}', '${_(c)}', '${_(c)}', '${s}', '${l}', '${l}', '${s}', '${s}')`), b.push(`(${T}, 1)`), T++;
|
|
424
|
+
}
|
|
425
|
+
console.log("Generating 4,000 Events...");
|
|
426
|
+
for (let e = 1; e <= 4e3; e++) {
|
|
427
|
+
let t = s[e % s.length], n = `${t} 2026 #${e}`, r = m(2024), i = JSON.stringify({
|
|
428
|
+
startTime: h(2024, 2027),
|
|
429
|
+
channels: [1],
|
|
430
|
+
layoutId: "single-column"
|
|
431
|
+
});
|
|
432
|
+
y.push(`(${T}, 'event', '${_(n)}', 'event-${g(t)}-${e}', 0, 'published', '{}', '${_(i)}', '${_(i)}', '${_(i)}', '${r}', '${l}', '${l}', '${r}', '${r}')`), b.push(`(${T}, 1)`), w(T, n), T++;
|
|
433
|
+
}
|
|
434
|
+
console.log("Generating 4,000 Articles (and linking relations)...");
|
|
435
|
+
for (let e = 1; e <= 4e3; e++) {
|
|
436
|
+
let t = p(e), n = m(2024), r = [];
|
|
437
|
+
for (let t = 0; t < e % 2 + 1; t++) {
|
|
438
|
+
let n = E[(e + t * 7) % E.length];
|
|
439
|
+
C.push(`(${T}, ${n}, 'authors', ${t})`), r.push(n);
|
|
440
|
+
}
|
|
441
|
+
let i = JSON.stringify({
|
|
442
|
+
articleDate: n.split("T")[0],
|
|
443
|
+
authors: r,
|
|
444
|
+
channels: [1],
|
|
445
|
+
layoutId: "single-column"
|
|
446
|
+
});
|
|
447
|
+
y.push(`(${T}, 'article', '${_(t)}', '${g(t)}-${e}', 0, 'published', '{}', '${_(i)}', '${_(i)}', '${_(i)}', '${n}', '${l}', '${l}', '${n}', '${n}')`), b.push(`(${T}, 1)`), w(T, t), T++;
|
|
448
|
+
}
|
|
449
|
+
console.log("Writing Batches..."), v(c, "content_nodes", [
|
|
450
|
+
"id",
|
|
451
|
+
"contentType",
|
|
452
|
+
"title",
|
|
453
|
+
"slug",
|
|
454
|
+
"isHidden",
|
|
455
|
+
"status",
|
|
456
|
+
"disabledRegionsJson",
|
|
457
|
+
"dataJson",
|
|
458
|
+
"draftDataJson",
|
|
459
|
+
"publishedDataJson",
|
|
460
|
+
"publishedAt",
|
|
461
|
+
"createdById",
|
|
462
|
+
"updatedById",
|
|
463
|
+
"createdAt",
|
|
464
|
+
"updatedAt"
|
|
465
|
+
], y, 50), v(c, "node_channels", ["nodeId", "channelId"], b, 100), v(c, "tree_nodes", [
|
|
466
|
+
"treeId",
|
|
467
|
+
"contentId",
|
|
468
|
+
"parentId",
|
|
469
|
+
"sortOrder"
|
|
470
|
+
], x, 50), v(c, "content_blocks", [
|
|
471
|
+
"contentId",
|
|
472
|
+
"region",
|
|
473
|
+
"elementType",
|
|
474
|
+
"dataJson",
|
|
475
|
+
"sortOrder",
|
|
476
|
+
"isDraft"
|
|
477
|
+
], S, 100), v(c, "node_relations", [
|
|
478
|
+
"sourceNodeId",
|
|
479
|
+
"targetNodeId",
|
|
480
|
+
"fieldKey",
|
|
481
|
+
"sortOrder"
|
|
482
|
+
], C, 100), c.push("PRAGMA foreign_keys = ON;");
|
|
483
|
+
let D = 0, O = t.resolve(process.cwd(), "./seed.sql");
|
|
484
|
+
e.existsSync(O) && e.unlinkSync(O);
|
|
485
|
+
for (let n = 0; n < c.length; n += 50) {
|
|
486
|
+
let r = c.slice(n, n + 50);
|
|
487
|
+
D++;
|
|
488
|
+
let i = String(D).padStart(3, "0"), a = t.resolve(process.cwd(), `./seed-${i}.sql`);
|
|
489
|
+
e.writeFileSync(a, r.join("\n\n"), "utf-8");
|
|
490
|
+
}
|
|
491
|
+
console.log(`✅ Success! Data split across ${D} files (seed-001.sql to seed-${String(D).padStart(3, "0")}.sql) for safe remote processing.`);
|
|
492
|
+
}
|
|
493
|
+
y();
|
|
494
|
+
//#endregion
|
|
495
|
+
export { y as generateSqlFile };
|