@ozguraltan/strapi-content-input 0.0.0-stage → 1.0.6

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 (62) hide show
  1. package/README.md +353 -2
  2. package/dist/admin/ContentInputField-BM2WS_KZ.js +18227 -0
  3. package/dist/admin/ContentInputField-D6rlm6Te.mjs +18224 -0
  4. package/dist/admin/en-D7v9nv9J.mjs +9 -0
  5. package/dist/admin/en-DF-a59T_.js +9 -0
  6. package/dist/admin/index-BA2XyNVO.mjs +172 -0
  7. package/dist/admin/index-IuCWhUHI.js +173 -0
  8. package/dist/admin/index.js +5 -0
  9. package/dist/admin/index.mjs +5 -0
  10. package/dist/admin/src/components/ContentInputField.d.ts +23 -0
  11. package/dist/admin/src/components/editor/CIContextMenu.d.ts +2 -0
  12. package/dist/admin/src/components/editor/CanvasNodes.d.ts +21 -0
  13. package/dist/admin/src/components/editor/VECanvas.d.ts +2 -0
  14. package/dist/admin/src/components/editor/VEInsertPoint.d.ts +7 -0
  15. package/dist/admin/src/components/editor/VELeftPanel.d.ts +5 -0
  16. package/dist/admin/src/components/editor/VENodeToolbar.d.ts +13 -0
  17. package/dist/admin/src/components/editor/VEPreviewFrame.d.ts +7 -0
  18. package/dist/admin/src/components/editor/VETopBar.d.ts +5 -0
  19. package/dist/admin/src/components/editor/VisualEditorModal.d.ts +6 -0
  20. package/dist/admin/src/components/editor/inspector/StyleControls.d.ts +49 -0
  21. package/dist/admin/src/components/editor/inspector/UnitInput.d.ts +18 -0
  22. package/dist/admin/src/components/editor/inspector/VEInspector.d.ts +5 -0
  23. package/dist/admin/src/components/icons/MaterialIcon.d.ts +9 -0
  24. package/dist/admin/src/components/widgets/MenuWidgetEditor.d.ts +30 -0
  25. package/dist/admin/src/components/widgets/RichHtmlEditor.d.ts +8 -0
  26. package/dist/admin/src/components/widgets/StrapiMediaPicker.d.ts +9 -0
  27. package/dist/admin/src/components/widgets/TabAccordionEditor.d.ts +26 -0
  28. package/dist/admin/src/components/widgets/WidgetEditor.d.ts +12 -0
  29. package/dist/admin/src/components/widgets/WidgetPreview.d.ts +9 -0
  30. package/dist/admin/src/core/EditorContext.d.ts +144 -0
  31. package/dist/admin/src/core/canvasClasses.d.ts +21 -0
  32. package/dist/admin/src/core/clipboard.d.ts +9 -0
  33. package/dist/admin/src/core/devices.d.ts +24 -0
  34. package/dist/admin/src/core/history.d.ts +13 -0
  35. package/dist/admin/src/core/i18n.d.ts +5 -0
  36. package/dist/admin/src/core/presets.d.ts +43 -0
  37. package/dist/admin/src/core/sampleData.d.ts +2 -0
  38. package/dist/admin/src/core/treeOps.d.ts +10 -0
  39. package/dist/admin/src/core/types.d.ts +79 -0
  40. package/dist/admin/src/index.d.ts +14 -0
  41. package/dist/admin/src/pluginId.d.ts +1 -0
  42. package/dist/admin/src/styles/ciCanvasStyles.d.ts +2 -0
  43. package/dist/admin/tr-ByHzf64V.mjs +9 -0
  44. package/dist/admin/tr-SNvSmKZQ.js +9 -0
  45. package/dist/server/index.js +702 -0
  46. package/dist/server/index.mjs +702 -0
  47. package/dist/server/src/bootstrap.d.ts +5 -0
  48. package/dist/server/src/config/index.d.ts +7 -0
  49. package/dist/server/src/content-types/ci-menu/schema.json.d.ts +46 -0
  50. package/dist/server/src/content-types/ci-template/schema.json.d.ts +42 -0
  51. package/dist/server/src/content-types/index.d.ts +88 -0
  52. package/dist/server/src/controllers/ci-menu.d.ts +12 -0
  53. package/dist/server/src/controllers/ci-template.d.ts +9 -0
  54. package/dist/server/src/controllers/index.d.ts +20 -0
  55. package/dist/server/src/destroy.d.ts +5 -0
  56. package/dist/server/src/index.d.ts +187 -0
  57. package/dist/server/src/register.d.ts +5 -0
  58. package/dist/server/src/routes/index.d.ts +14 -0
  59. package/dist/server/src/services/ci-menu.d.ts +36 -0
  60. package/dist/server/src/services/ci-template.d.ts +16 -0
  61. package/dist/server/src/services/index.d.ts +51 -0
  62. package/package.json +96 -4
@@ -0,0 +1,702 @@
1
+ const register = ({ strapi }) => {
2
+ strapi.customFields.register({
3
+ name: "content-input",
4
+ plugin: "content-input",
5
+ type: "json",
6
+ inputSize: {
7
+ default: 12,
8
+ isResizable: false
9
+ }
10
+ });
11
+ };
12
+ const bootstrap = ({ strapi }) => {
13
+ };
14
+ const destroy = ({ strapi }) => {
15
+ };
16
+ const config = {
17
+ default: {
18
+ previewUrl: "/ci-preview"
19
+ },
20
+ validator() {
21
+ }
22
+ };
23
+ const kind$1 = "collectionType";
24
+ const collectionName$1 = "ci_templates";
25
+ const info$1 = { "singularName": "ci-template", "pluralName": "ci-templates", "displayName": "ContentInput Template", "description": "Saved visual editor row/section templates" };
26
+ const options$1 = { "draftAndPublish": false };
27
+ const pluginOptions$1 = { "content-manager": { "visible": false }, "content-type-builder": { "visible": false } };
28
+ const attributes$1 = { "name": { "type": "string", "required": true }, "category": { "type": "string", "default": "custom" }, "structure": { "type": "json", "required": true }, "thumbnail": { "type": "string", "default": "" } };
29
+ const templateSchema = {
30
+ kind: kind$1,
31
+ collectionName: collectionName$1,
32
+ info: info$1,
33
+ options: options$1,
34
+ pluginOptions: pluginOptions$1,
35
+ attributes: attributes$1
36
+ };
37
+ const kind = "collectionType";
38
+ const collectionName = "ci_menus";
39
+ const info = { "singularName": "ci-menu", "pluralName": "ci-menus", "displayName": "ContentInput Menu", "description": "Reusable nested menus (horizontal & vertical) for ContentInput" };
40
+ const options = { "draftAndPublish": false };
41
+ const pluginOptions = { "content-manager": { "visible": false }, "content-type-builder": { "visible": false } };
42
+ const attributes = { "name": { "type": "string", "required": true }, "slug": { "type": "string", "required": true }, "mode": { "type": "string", "default": "horizontal" }, "items": { "type": "json", "required": true }, "options": { "type": "json" } };
43
+ const menuSchema = {
44
+ kind,
45
+ collectionName,
46
+ info,
47
+ options,
48
+ pluginOptions,
49
+ attributes
50
+ };
51
+ const contentTypes = {
52
+ "ci-template": {
53
+ schema: templateSchema
54
+ },
55
+ "ci-menu": {
56
+ schema: menuSchema
57
+ }
58
+ };
59
+ const ciTemplateController = ({ strapi }) => ({
60
+ async index(ctx) {
61
+ try {
62
+ const list = await strapi.plugin("content-input").service("ci-template").findAll();
63
+ ctx.body = list;
64
+ } catch (err) {
65
+ ctx.throw(500, err);
66
+ }
67
+ },
68
+ async save(ctx) {
69
+ try {
70
+ const { name, structure, category, thumbnail } = ctx.request.body || {};
71
+ if (!name || !structure) {
72
+ return ctx.badRequest("Name and structure are required");
73
+ }
74
+ const created = await strapi.plugin("content-input").service("ci-template").create({
75
+ name,
76
+ category,
77
+ structure,
78
+ thumbnail
79
+ });
80
+ ctx.status = 201;
81
+ ctx.body = created;
82
+ } catch (err) {
83
+ ctx.throw(500, err);
84
+ }
85
+ },
86
+ async delete(ctx) {
87
+ try {
88
+ const { id } = ctx.params;
89
+ const result = await strapi.plugin("content-input").service("ci-template").remove(id);
90
+ ctx.body = result;
91
+ } catch (err) {
92
+ ctx.throw(500, err);
93
+ }
94
+ }
95
+ });
96
+ const ciMenuController = ({ strapi }) => ({
97
+ async index(ctx) {
98
+ try {
99
+ const list = await strapi.plugin("content-input").service("ci-menu").findAll();
100
+ ctx.body = list;
101
+ } catch (err) {
102
+ ctx.throw(500, err);
103
+ }
104
+ },
105
+ async save(ctx) {
106
+ try {
107
+ const { id, name, slug, mode, items, options: options2 } = ctx.request.body || {};
108
+ if (!name) {
109
+ return ctx.badRequest("Menu name is required");
110
+ }
111
+ const saved = await strapi.plugin("content-input").service("ci-menu").save({
112
+ id,
113
+ name,
114
+ slug,
115
+ mode,
116
+ items: Array.isArray(items) ? items : [],
117
+ options: options2
118
+ });
119
+ ctx.status = 200;
120
+ ctx.body = saved;
121
+ } catch (err) {
122
+ ctx.throw(500, err);
123
+ }
124
+ },
125
+ async delete(ctx) {
126
+ try {
127
+ const { id } = ctx.params;
128
+ const result = await strapi.plugin("content-input").service("ci-menu").remove(id);
129
+ ctx.body = result;
130
+ } catch (err) {
131
+ ctx.throw(500, err);
132
+ }
133
+ },
134
+ async entityTypes(ctx) {
135
+ try {
136
+ const types = strapi.plugin("content-input").service("ci-menu").getEntityTypes();
137
+ ctx.body = types;
138
+ } catch (err) {
139
+ ctx.throw(500, err);
140
+ }
141
+ },
142
+ async entities(ctx) {
143
+ try {
144
+ const { uid, q, tree } = ctx.query || {};
145
+ const result = await strapi.plugin("content-input").service("ci-menu").searchEntities({
146
+ uid: uid ? String(uid) : void 0,
147
+ q: q ? String(q) : void 0,
148
+ tree: tree === "true" || tree === "1"
149
+ });
150
+ ctx.body = result;
151
+ } catch (err) {
152
+ ctx.throw(500, err);
153
+ }
154
+ },
155
+ async mediaList(ctx) {
156
+ try {
157
+ const files = await strapi.db.query("plugin::upload.file").findMany({
158
+ orderBy: { createdAt: "desc" },
159
+ limit: 120
160
+ });
161
+ ctx.body = { data: Array.isArray(files) ? files : [] };
162
+ } catch (err) {
163
+ ctx.throw(500, err);
164
+ }
165
+ }
166
+ });
167
+ const controllers = {
168
+ "ci-template": ciTemplateController,
169
+ "ci-menu": ciMenuController
170
+ };
171
+ const routes = {
172
+ admin: {
173
+ type: "admin",
174
+ routes: [
175
+ {
176
+ method: "GET",
177
+ path: "/templates",
178
+ handler: "ci-template.index",
179
+ config: {
180
+ policies: []
181
+ }
182
+ },
183
+ {
184
+ method: "POST",
185
+ path: "/templates",
186
+ handler: "ci-template.save",
187
+ config: {
188
+ policies: []
189
+ }
190
+ },
191
+ {
192
+ method: "DELETE",
193
+ path: "/templates/:id",
194
+ handler: "ci-template.delete",
195
+ config: {
196
+ policies: []
197
+ }
198
+ },
199
+ {
200
+ method: "GET",
201
+ path: "/menus",
202
+ handler: "ci-menu.index",
203
+ config: {
204
+ policies: []
205
+ }
206
+ },
207
+ {
208
+ method: "POST",
209
+ path: "/menus",
210
+ handler: "ci-menu.save",
211
+ config: {
212
+ policies: []
213
+ }
214
+ },
215
+ {
216
+ method: "DELETE",
217
+ path: "/menus/:id",
218
+ handler: "ci-menu.delete",
219
+ config: {
220
+ policies: []
221
+ }
222
+ },
223
+ {
224
+ method: "GET",
225
+ path: "/entity-types",
226
+ handler: "ci-menu.entityTypes",
227
+ config: {
228
+ policies: []
229
+ }
230
+ },
231
+ {
232
+ method: "GET",
233
+ path: "/entities",
234
+ handler: "ci-menu.entities",
235
+ config: {
236
+ policies: []
237
+ }
238
+ },
239
+ {
240
+ method: "GET",
241
+ path: "/media",
242
+ handler: "ci-menu.mediaList",
243
+ config: {
244
+ policies: []
245
+ }
246
+ }
247
+ ]
248
+ }
249
+ };
250
+ const UID = "plugin::content-input.ci-template";
251
+ const ciTemplateService = ({ strapi }) => ({
252
+ async findAll() {
253
+ const entries = await strapi.db.query(UID).findMany({
254
+ orderBy: { createdAt: "desc" }
255
+ });
256
+ return entries.map((item) => ({
257
+ ...item,
258
+ _id: item.documentId || String(item.id)
259
+ }));
260
+ },
261
+ async create(data) {
262
+ const structure = Array.isArray(data.structure) ? data.structure : [data.structure];
263
+ const created = await strapi.db.query(UID).create({
264
+ data: {
265
+ name: String(data.name || "").trim(),
266
+ category: data.category || "custom",
267
+ structure,
268
+ thumbnail: data.thumbnail || ""
269
+ }
270
+ });
271
+ return {
272
+ ...created,
273
+ _id: created.documentId || String(created.id)
274
+ };
275
+ },
276
+ async remove(idOrDocId) {
277
+ const numericId = Number(idOrDocId);
278
+ if (!Number.isNaN(numericId) && String(numericId) === String(idOrDocId)) {
279
+ await strapi.db.query(UID).delete({
280
+ where: { id: numericId }
281
+ });
282
+ } else {
283
+ await strapi.db.query(UID).delete({
284
+ where: { documentId: String(idOrDocId) }
285
+ });
286
+ }
287
+ return { success: true };
288
+ }
289
+ });
290
+ const MENU_UID = "plugin::content-input.ci-menu";
291
+ function slugifyTR(text) {
292
+ const map = {
293
+ ç: "c",
294
+ Ç: "c",
295
+ ğ: "g",
296
+ Ğ: "g",
297
+ ı: "i",
298
+ İ: "i",
299
+ ö: "o",
300
+ Ö: "o",
301
+ ş: "s",
302
+ Ş: "s",
303
+ ü: "u",
304
+ Ü: "u"
305
+ };
306
+ return String(text || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => map[ch] || ch).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
307
+ }
308
+ const DEFAULT_SEED_MENUS = [
309
+ {
310
+ name: "Üst Ana Navigasyon Menüsü",
311
+ slug: "main-header-menu",
312
+ mode: "horizontal",
313
+ options: {
314
+ mode: "horizontal",
315
+ bgColor: "#ffffff",
316
+ textColor: "#0f172a",
317
+ accentColor: "#2669a0"
318
+ },
319
+ items: [
320
+ {
321
+ _uId: "m_home",
322
+ title: "Ana Sayfa",
323
+ url: "/",
324
+ type: "custom",
325
+ target: "_self",
326
+ icon: "home",
327
+ children: []
328
+ },
329
+ {
330
+ _uId: "m_corp",
331
+ title: "Kurumsal",
332
+ url: "/kurumsal",
333
+ type: "custom",
334
+ target: "_self",
335
+ icon: "business",
336
+ children: [
337
+ {
338
+ _uId: "m_about",
339
+ title: "Hakkımızda",
340
+ url: "/kurumsal/hakkimizda",
341
+ type: "custom",
342
+ target: "_self",
343
+ children: []
344
+ },
345
+ {
346
+ _uId: "m_vision",
347
+ title: "Vizyon & Misyon",
348
+ url: "/kurumsal/vizyon-misyon",
349
+ type: "custom",
350
+ target: "_self",
351
+ children: [
352
+ {
353
+ _uId: "m_values",
354
+ title: "Değerlerimiz & İlkelerimiz",
355
+ url: "/kurumsal/degerlerimiz",
356
+ type: "custom",
357
+ target: "_self",
358
+ children: []
359
+ }
360
+ ]
361
+ },
362
+ {
363
+ _uId: "m_board",
364
+ title: "Yönetim Kurulu",
365
+ url: "/kurumsal/yonetim-kurulu",
366
+ type: "custom",
367
+ target: "_self",
368
+ children: []
369
+ }
370
+ ]
371
+ },
372
+ {
373
+ _uId: "m_solutions",
374
+ title: "Çözümlerimiz",
375
+ url: "/cozumler",
376
+ type: "custom",
377
+ target: "_self",
378
+ icon: "layers",
379
+ children: [
380
+ {
381
+ _uId: "m_sol_cms",
382
+ title: "Kurumsal İçerik Yönetimi (CMS)",
383
+ url: "/cozumler/cms",
384
+ type: "custom",
385
+ target: "_self",
386
+ children: []
387
+ },
388
+ {
389
+ _uId: "m_sol_cloud",
390
+ title: "Bulut & Mikroservis Mimarisi",
391
+ url: "/cozumler/bulut",
392
+ type: "custom",
393
+ target: "_self",
394
+ children: []
395
+ }
396
+ ]
397
+ },
398
+ {
399
+ _uId: "m_contact",
400
+ title: "İletişim",
401
+ url: "/iletisim",
402
+ type: "custom",
403
+ target: "_self",
404
+ icon: "mail",
405
+ children: []
406
+ }
407
+ ]
408
+ },
409
+ {
410
+ name: "Kurumsal Sol Yan Menü (Düşey Ağaç)",
411
+ slug: "corporate-sidebar-menu",
412
+ mode: "vertical",
413
+ options: {
414
+ mode: "vertical",
415
+ bgColor: "#f8fafc",
416
+ textColor: "#1e293b",
417
+ accentColor: "#2669a0"
418
+ },
419
+ items: [
420
+ {
421
+ _uId: "v_corp",
422
+ title: "Kurumsal Bilgiler",
423
+ url: "/kurumsal",
424
+ type: "custom",
425
+ target: "_self",
426
+ children: [
427
+ {
428
+ _uId: "v_history",
429
+ title: "Tarihçemiz",
430
+ url: "/kurumsal/tarihce",
431
+ type: "custom",
432
+ target: "_self",
433
+ children: []
434
+ },
435
+ {
436
+ _uId: "v_quality",
437
+ title: "Kalite Politikamız",
438
+ url: "/kurumsal/kalite",
439
+ type: "custom",
440
+ target: "_self",
441
+ children: [
442
+ {
443
+ _uId: "v_iso",
444
+ title: "ISO 27001 & Sertifikalar",
445
+ url: "/kurumsal/kalite/sertifikalar",
446
+ type: "custom",
447
+ target: "_self",
448
+ children: []
449
+ }
450
+ ]
451
+ }
452
+ ]
453
+ },
454
+ {
455
+ _uId: "v_career",
456
+ title: "İnsan Kaynakları & Kariyer",
457
+ url: "/kariyer",
458
+ type: "custom",
459
+ target: "_self",
460
+ children: []
461
+ }
462
+ ]
463
+ }
464
+ ];
465
+ const ciMenuService = ({ strapi }) => ({
466
+ async findAll() {
467
+ let entries = await strapi.db.query(MENU_UID).findMany({
468
+ orderBy: { createdAt: "desc" }
469
+ });
470
+ if (!entries || entries.length === 0) {
471
+ for (const seed of DEFAULT_SEED_MENUS) {
472
+ await strapi.db.query(MENU_UID).create({ data: seed });
473
+ }
474
+ entries = await strapi.db.query(MENU_UID).findMany({
475
+ orderBy: { createdAt: "desc" }
476
+ });
477
+ }
478
+ return entries.map((item) => ({
479
+ ...item,
480
+ _id: item.documentId || String(item.id)
481
+ }));
482
+ },
483
+ async save(data) {
484
+ const cleanName = String(data.name || "Menü").trim();
485
+ const cleanSlug = String(data.slug || slugifyTR(cleanName) || `menu-${Date.now()}`).trim();
486
+ const cleanMode = data.mode === "vertical" ? "vertical" : "horizontal";
487
+ const cleanItems = Array.isArray(data.items) ? data.items : [];
488
+ let existing = null;
489
+ if (data.id) {
490
+ const numId = Number(data.id);
491
+ if (!Number.isNaN(numId) && String(numId) === String(data.id)) {
492
+ existing = await strapi.db.query(MENU_UID).findOne({ where: { id: numId } });
493
+ } else {
494
+ existing = await strapi.db.query(MENU_UID).findOne({ where: { documentId: String(data.id) } });
495
+ }
496
+ }
497
+ if (!existing && cleanSlug) {
498
+ existing = await strapi.db.query(MENU_UID).findOne({ where: { slug: cleanSlug } });
499
+ }
500
+ if (existing) {
501
+ const updated = await strapi.db.query(MENU_UID).update({
502
+ where: { id: existing.id },
503
+ data: {
504
+ name: cleanName,
505
+ slug: cleanSlug,
506
+ mode: cleanMode,
507
+ items: cleanItems,
508
+ options: data.options || existing.options || {}
509
+ }
510
+ });
511
+ return {
512
+ ...updated,
513
+ _id: updated.documentId || String(updated.id)
514
+ };
515
+ }
516
+ const created = await strapi.db.query(MENU_UID).create({
517
+ data: {
518
+ name: cleanName,
519
+ slug: cleanSlug,
520
+ mode: cleanMode,
521
+ items: cleanItems,
522
+ options: data.options || {}
523
+ }
524
+ });
525
+ return {
526
+ ...created,
527
+ _id: created.documentId || String(created.id)
528
+ };
529
+ },
530
+ async remove(idOrDocId) {
531
+ const numericId = Number(idOrDocId);
532
+ if (!Number.isNaN(numericId) && String(numericId) === String(idOrDocId)) {
533
+ await strapi.db.query(MENU_UID).delete({
534
+ where: { id: numericId }
535
+ });
536
+ } else {
537
+ await strapi.db.query(MENU_UID).delete({
538
+ where: { documentId: String(idOrDocId) }
539
+ });
540
+ }
541
+ return { success: true };
542
+ },
543
+ getEntityTypes() {
544
+ const contentTypes2 = strapi.contentTypes || {};
545
+ const result = [];
546
+ for (const [uid, ct] of Object.entries(contentTypes2)) {
547
+ if (!uid.startsWith("api::")) continue;
548
+ const attrs = ct.attributes || {};
549
+ const attrNames = Object.keys(attrs);
550
+ const titleCandidates = ["title", "name", "label", "heading", "subject", "baslik", "ad"];
551
+ const titleField = titleCandidates.find((c) => attrNames.includes(c)) || attrNames.find((k) => ["string", "text"].includes(attrs[k]?.type)) || "id";
552
+ const slugCandidates = ["slug", "path", "url", "permalink", "code"];
553
+ const slugField = slugCandidates.find((c) => attrNames.includes(c)) || null;
554
+ let parentField = null;
555
+ for (const [k, attr] of Object.entries(attrs)) {
556
+ if (attr?.type === "relation" && attr?.target === uid || ["parent", "parentId", "parent_id", "ust"].includes(k)) {
557
+ parentField = k;
558
+ break;
559
+ }
560
+ }
561
+ result.push({
562
+ uid,
563
+ displayName: ct.info?.displayName || ct.info?.pluralName || uid,
564
+ singularName: ct.info?.singularName || "item",
565
+ pluralName: ct.info?.pluralName || "items",
566
+ kind: ct.kind || "collectionType",
567
+ titleField,
568
+ slugField,
569
+ parentField
570
+ });
571
+ }
572
+ return result;
573
+ },
574
+ async searchEntities(params) {
575
+ const types = this.getEntityTypes();
576
+ const targetUid = params.uid || types[0]?.uid || "api::page.page";
577
+ const meta = types.find((t) => t.uid === targetUid) || {
578
+ uid: targetUid,
579
+ displayName: targetUid,
580
+ singularName: "page",
581
+ pluralName: "pages",
582
+ kind: "collectionType",
583
+ titleField: "title",
584
+ slugField: "slug",
585
+ parentField: null
586
+ };
587
+ const populate = {};
588
+ if (meta.parentField) {
589
+ populate[meta.parentField] = true;
590
+ }
591
+ let rawEntries = [];
592
+ try {
593
+ rawEntries = await strapi.db.query(targetUid).findMany({
594
+ limit: 200,
595
+ orderBy: { id: "asc" },
596
+ populate: Object.keys(populate).length > 0 ? populate : void 0
597
+ });
598
+ } catch {
599
+ rawEntries = [];
600
+ }
601
+ const byDocId = /* @__PURE__ */ new Map();
602
+ for (const row of rawEntries) {
603
+ const key = String(row.documentId || row.id);
604
+ const existing = byDocId.get(key);
605
+ if (!existing || row.publishedAt && !existing.publishedAt) {
606
+ byDocId.set(key, row);
607
+ }
608
+ }
609
+ const searchQuery = String(params.q || "").trim().toLocaleLowerCase("tr-TR");
610
+ const flatNodes = Array.from(byDocId.values()).map((entry) => {
611
+ const rawTitle = entry[meta.titleField] || entry.title || entry.name || entry.label || `#${entry.documentId || entry.id}`;
612
+ const title = String(rawTitle);
613
+ const rawSlug = meta.slugField && entry[meta.slugField] || entry.slug || String(title).split(/[/|>»]+/).map((part) => slugifyTR(part.trim())).filter(Boolean).join("/");
614
+ const prefix = meta.pluralName === "pages" ? "" : `/${meta.pluralName}`;
615
+ const url = String(rawSlug).startsWith("/") ? String(rawSlug) : `${prefix}/${rawSlug}`.replace(/\/+/g, "/");
616
+ let parentDocId = null;
617
+ if (meta.parentField && entry[meta.parentField]) {
618
+ const p = entry[meta.parentField];
619
+ parentDocId = typeof p === "object" ? String(p.documentId || p.id) : String(p);
620
+ } else if (entry.parentId || entry.parent_id) {
621
+ parentDocId = String(entry.parentId || entry.parent_id);
622
+ }
623
+ return {
624
+ id: entry.id,
625
+ documentId: String(entry.documentId || entry.id),
626
+ uid: targetUid,
627
+ collectionName: meta.pluralName,
628
+ title,
629
+ slug: String(rawSlug),
630
+ url,
631
+ parentId: parentDocId,
632
+ children: []
633
+ };
634
+ }).filter((node) => {
635
+ if (!searchQuery) return true;
636
+ return node.title.toLocaleLowerCase("tr-TR").includes(searchQuery) || node.url.toLocaleLowerCase("tr-TR").includes(searchQuery) || node.slug.toLocaleLowerCase("tr-TR").includes(searchQuery);
637
+ });
638
+ if (!params.tree) {
639
+ return {
640
+ meta,
641
+ items: flatNodes
642
+ };
643
+ }
644
+ const nodeMap = /* @__PURE__ */ new Map();
645
+ const urlMap = /* @__PURE__ */ new Map();
646
+ flatNodes.forEach((n) => {
647
+ const cloned = { ...n, children: [] };
648
+ nodeMap.set(String(n.documentId), cloned);
649
+ nodeMap.set(String(n.id), cloned);
650
+ urlMap.set(n.url.replace(/\/+$/, ""), cloned);
651
+ });
652
+ const roots = [];
653
+ for (const orig of flatNodes) {
654
+ const current = nodeMap.get(String(orig.documentId));
655
+ if (!current) continue;
656
+ let attached = false;
657
+ if (orig.parentId && nodeMap.has(String(orig.parentId))) {
658
+ const parent = nodeMap.get(String(orig.parentId));
659
+ if (parent && parent !== current) {
660
+ parent.children.push(current);
661
+ attached = true;
662
+ }
663
+ }
664
+ if (!attached) {
665
+ const cleanUrl = orig.url.replace(/\/+$/, "");
666
+ const lastSlash = cleanUrl.lastIndexOf("/");
667
+ if (lastSlash > 0) {
668
+ const parentPath = cleanUrl.slice(0, lastSlash);
669
+ const parentByPath = urlMap.get(parentPath);
670
+ if (parentByPath && parentByPath !== current) {
671
+ parentByPath.children.push(current);
672
+ attached = true;
673
+ }
674
+ }
675
+ }
676
+ if (!attached) {
677
+ roots.push(current);
678
+ }
679
+ }
680
+ return {
681
+ meta,
682
+ items: roots
683
+ };
684
+ }
685
+ });
686
+ const services = {
687
+ "ci-template": ciTemplateService,
688
+ "ci-menu": ciMenuService
689
+ };
690
+ const index = {
691
+ register,
692
+ bootstrap,
693
+ destroy,
694
+ config,
695
+ controllers,
696
+ routes,
697
+ services,
698
+ contentTypes
699
+ };
700
+ export {
701
+ index as default
702
+ };
@@ -0,0 +1,5 @@
1
+ import { Core } from '@strapi/strapi';
2
+ declare const bootstrap: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => void;
5
+ export default bootstrap;
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ default: {
3
+ previewUrl: string;
4
+ };
5
+ validator(): void;
6
+ };
7
+ export default _default;