@azlib/cms 0.7.1 → 0.8.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/README.md CHANGED
@@ -392,6 +392,182 @@ console.log(`Remaining days: ${leaveReport.totalRemaining}`);
392
392
 
393
393
  ---
394
394
 
395
+ ## Built-in SEO & Metadata Plugin (`seoPlugin`)
396
+
397
+ Automates dynamic XML sitemap generation, search engine `robots.txt`, OpenGraph/Twitter social cards, JSON-LD structured data, and content readability/SEO auditing.
398
+
399
+ ```typescript
400
+ import {
401
+ createCMSEngine,
402
+ defineConfig,
403
+ seoPlugin,
404
+ getSeoService,
405
+ } from "@azlib/cms";
406
+
407
+ const config = defineConfig({
408
+ plugins: [
409
+ seoPlugin({
410
+ siteUrl: "https://example.com",
411
+ defaultTitle: "My Site",
412
+ titleTemplate: "%s | My Site",
413
+ autoExtendCollections: ["posts", "pages"], // Injects SEO fields into posts/pages
414
+ }),
415
+ ],
416
+ });
417
+
418
+ const cms = createCMSEngine(config);
419
+ await cms.init();
420
+
421
+ // Exposes REST endpoints:
422
+ // GET /sitemap.xml
423
+ // GET /robots.txt
424
+ // GET /api/seo/metadata/:collection/:id
425
+ // POST /api/seo/analyze
426
+ ```
427
+
428
+ ---
429
+
430
+ ## Built-in Search Indexing Plugin (`searchPlugin`)
431
+
432
+ High-performance inverted-index full-text search with automatic real-time indexing across content create, update, publish, and delete hooks.
433
+
434
+ ```typescript
435
+ import {
436
+ createCMSEngine,
437
+ defineConfig,
438
+ searchPlugin,
439
+ getSearchService,
440
+ } from "@azlib/cms";
441
+
442
+ const config = defineConfig({
443
+ plugins: [
444
+ searchPlugin({
445
+ enableAutoIndex: true, // Automatically updates search index on content mutations
446
+ }),
447
+ ],
448
+ });
449
+
450
+ const cms = createCMSEngine(config);
451
+ await cms.init();
452
+
453
+ const searchService = getSearchService(cms);
454
+ const results = await searchService.search({ q: "microservices", limit: 10 });
455
+
456
+ // Exposes REST endpoints:
457
+ // GET /api/search?q=...&collections=...&limit=...
458
+ // POST /api/search/reindex
459
+ ```
460
+
461
+ ---
462
+
463
+ ## Built-in Audit Log Plugin (`auditLogPlugin`)
464
+
465
+ Immutable enterprise compliance logging tracking all mutations across content, media, taxonomies, options, and auth with field-level diffs.
466
+
467
+ ```typescript
468
+ import {
469
+ createCMSEngine,
470
+ defineConfig,
471
+ auditLogPlugin,
472
+ getAuditLogService,
473
+ } from "@azlib/cms";
474
+
475
+ const config = defineConfig({
476
+ plugins: [auditLogPlugin()],
477
+ });
478
+
479
+ const cms = createCMSEngine(config);
480
+ await cms.init();
481
+
482
+ const auditService = getAuditLogService(cms);
483
+ const history = await auditService.query({ action: "update", limit: 20 });
484
+
485
+ // Exposes REST endpoints:
486
+ // GET /api/audit-logs?action=...&actorId=...
487
+ // GET /api/audit-logs/:id
488
+ ```
489
+
490
+ ---
491
+
492
+ ## Built-in Dynamic Forms Plugin (`formsPlugin`)
493
+
494
+ Dynamic form schema builder with honeypot anti-spam protection, submission validation, and storage.
495
+
496
+ ```typescript
497
+ import {
498
+ createCMSEngine,
499
+ defineConfig,
500
+ formsPlugin,
501
+ getFormsService,
502
+ } from "@azlib/cms";
503
+
504
+ const config = defineConfig({
505
+ plugins: [formsPlugin()],
506
+ });
507
+
508
+ const cms = createCMSEngine(config);
509
+ await cms.init();
510
+
511
+ const formsService = getFormsService(cms);
512
+ await formsService.registerForm({
513
+ slug: "contact",
514
+ title: "Contact Us",
515
+ fields: [
516
+ { name: "fullName", label: "Full Name", type: "text", required: true },
517
+ { name: "email", label: "Email", type: "email", required: true },
518
+ { name: "message", label: "Message", type: "textarea", required: true },
519
+ ],
520
+ });
521
+
522
+ // Exposes REST endpoints:
523
+ // GET /api/forms
524
+ // GET /api/forms/:slug
525
+ // POST /api/forms/:slug/submit
526
+ // GET /api/forms/:slug/submissions
527
+ // PUT /api/forms/submissions/:id/status
528
+ ```
529
+
530
+ ---
531
+
532
+ ## Built-in Frontend Cache & Revalidation Plugin (`revalidationPlugin`)
533
+
534
+ On-demand cache invalidation and ISR revalidation (Next.js, Vercel, Cloudflare, Astro) dispatching HMAC-signed webhook requests.
535
+
536
+ ```typescript
537
+ import {
538
+ createCMSEngine,
539
+ defineConfig,
540
+ revalidationPlugin,
541
+ getRevalidationService,
542
+ } from "@azlib/cms";
543
+
544
+ const config = defineConfig({
545
+ plugins: [
546
+ revalidationPlugin({
547
+ endpoints: [
548
+ {
549
+ url: "https://my-frontend.com/api/revalidate",
550
+ secret: process.env.REVALIDATION_SECRET,
551
+ },
552
+ ],
553
+ collectionPathMap: {
554
+ posts: (item) => [`/blog/${item.slug}`, "/blog"],
555
+ },
556
+ }),
557
+ ],
558
+ });
559
+
560
+ const cms = createCMSEngine(config);
561
+ await cms.init();
562
+
563
+ // Automatically derives tags and paths and notifies frontends with HMAC signature.
564
+ // Exposes REST endpoints:
565
+ // POST /api/revalidate
566
+ // GET /api/revalidate/history
567
+ ```
568
+
569
+ ---
570
+
395
571
  ## License
396
572
 
397
573
  MIT © Google / azlib