@azlib/cms 0.7.0 → 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 +176 -0
- package/dist/index.cjs +2227 -55
- package/dist/index.d.cts +658 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +658 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2198 -56
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -522,6 +522,10 @@ declare class CMSEngine {
|
|
|
522
522
|
* Check if a plugin is registered.
|
|
523
523
|
*/
|
|
524
524
|
hasPlugin(name: string): boolean;
|
|
525
|
+
/**
|
|
526
|
+
* Check if a collection is registered.
|
|
527
|
+
*/
|
|
528
|
+
hasCollection(slug: string): boolean;
|
|
525
529
|
/**
|
|
526
530
|
* Register a collection dynamically.
|
|
527
531
|
*/
|
|
@@ -2690,5 +2694,658 @@ declare const transferPlugin: (options?: void | TransferPluginOptions | undefine
|
|
|
2690
2694
|
*/
|
|
2691
2695
|
declare function getTransferService(engine: CMSEngine, options?: TransferPluginOptions): TransferService;
|
|
2692
2696
|
//#endregion
|
|
2693
|
-
|
|
2697
|
+
//#region src/plugins/seo/types.d.ts
|
|
2698
|
+
/**
|
|
2699
|
+
* @azlib/cms - Built-in SEO & Metadata Plugin Types
|
|
2700
|
+
*/
|
|
2701
|
+
interface RobotsTxtPolicy {
|
|
2702
|
+
userAgent: string;
|
|
2703
|
+
allow?: string[];
|
|
2704
|
+
disallow?: string[];
|
|
2705
|
+
}
|
|
2706
|
+
interface RobotsTxtConfig {
|
|
2707
|
+
policies?: RobotsTxtPolicy[];
|
|
2708
|
+
sitemapUrl?: string;
|
|
2709
|
+
host?: string;
|
|
2710
|
+
}
|
|
2711
|
+
interface SeoPluginOptions {
|
|
2712
|
+
siteUrl?: string;
|
|
2713
|
+
defaultTitle?: string;
|
|
2714
|
+
titleTemplate?: string | ((title: string) => string);
|
|
2715
|
+
defaultDescription?: string;
|
|
2716
|
+
defaultOgImage?: string;
|
|
2717
|
+
defaultTwitterCard?: "summary" | "summary_large_image" | "app" | "player";
|
|
2718
|
+
sitemapCollections?: string[];
|
|
2719
|
+
robotsTxt?: RobotsTxtConfig;
|
|
2720
|
+
apiPrefix?: string;
|
|
2721
|
+
enableRoutes?: boolean;
|
|
2722
|
+
autoExtendCollections?: boolean | string[];
|
|
2723
|
+
}
|
|
2724
|
+
interface SeoMetadata {
|
|
2725
|
+
title: string;
|
|
2726
|
+
description?: string;
|
|
2727
|
+
canonicalUrl?: string;
|
|
2728
|
+
ogTitle?: string;
|
|
2729
|
+
ogDescription?: string;
|
|
2730
|
+
ogImage?: string;
|
|
2731
|
+
ogType?: string;
|
|
2732
|
+
twitterCard?: "summary" | "summary_large_image" | "app" | "player";
|
|
2733
|
+
robots?: string;
|
|
2734
|
+
keywords?: string[];
|
|
2735
|
+
jsonLd?: Record<string, unknown>;
|
|
2736
|
+
}
|
|
2737
|
+
interface SitemapItem {
|
|
2738
|
+
loc: string;
|
|
2739
|
+
lastmod?: string;
|
|
2740
|
+
changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
|
|
2741
|
+
priority?: number;
|
|
2742
|
+
}
|
|
2743
|
+
interface SeoCheckResult {
|
|
2744
|
+
name: string;
|
|
2745
|
+
passed: boolean;
|
|
2746
|
+
message: string;
|
|
2747
|
+
scoreImpact: number;
|
|
2748
|
+
}
|
|
2749
|
+
interface SeoContentAnalysisInput {
|
|
2750
|
+
title?: string;
|
|
2751
|
+
content?: string;
|
|
2752
|
+
keyword?: string;
|
|
2753
|
+
metaDescription?: string;
|
|
2754
|
+
}
|
|
2755
|
+
interface SeoContentAnalysis {
|
|
2756
|
+
wordCount: number;
|
|
2757
|
+
readingTimeMinutes: number;
|
|
2758
|
+
keywordDensity: number;
|
|
2759
|
+
score: number;
|
|
2760
|
+
checks: SeoCheckResult[];
|
|
2761
|
+
recommendations: string[];
|
|
2762
|
+
}
|
|
2763
|
+
//#endregion
|
|
2764
|
+
//#region src/plugins/seo/schemas.d.ts
|
|
2765
|
+
/**
|
|
2766
|
+
* Generate standard SEO field definitions to attach to or extend content collections.
|
|
2767
|
+
*/
|
|
2768
|
+
declare function createSeoFieldDefinitions(): readonly FieldDefinition[];
|
|
2769
|
+
//#endregion
|
|
2770
|
+
//#region src/plugins/seo/service.d.ts
|
|
2771
|
+
declare class SeoService {
|
|
2772
|
+
private engine;
|
|
2773
|
+
private options;
|
|
2774
|
+
private siteUrl;
|
|
2775
|
+
constructor(engine: CMSEngine, options?: SeoPluginOptions);
|
|
2776
|
+
/**
|
|
2777
|
+
* Generate an XML sitemap for all published content items in configured collections.
|
|
2778
|
+
*/
|
|
2779
|
+
generateSitemap(): Promise<string>;
|
|
2780
|
+
/**
|
|
2781
|
+
* Generate robots.txt content adhering to search crawler specifications.
|
|
2782
|
+
*/
|
|
2783
|
+
generateRobotsTxt(): string;
|
|
2784
|
+
/**
|
|
2785
|
+
* Resolve consolidated SEO metadata for a document, using smart fallbacks.
|
|
2786
|
+
*/
|
|
2787
|
+
resolveMetadata(collectionSlug: string, documentOrId: string | ContentItem): Promise<SeoMetadata>;
|
|
2788
|
+
/**
|
|
2789
|
+
* Generate schema.org JSON-LD structured data for a content item.
|
|
2790
|
+
*/
|
|
2791
|
+
generateJsonLd(collectionSlug: string, item: ContentItem): Record<string, unknown>;
|
|
2792
|
+
/**
|
|
2793
|
+
* Analyze text content and title for SEO optimization, readability, and keyword density.
|
|
2794
|
+
*/
|
|
2795
|
+
analyzeContent(input: SeoContentAnalysisInput): SeoContentAnalysis;
|
|
2796
|
+
private formatTitle;
|
|
2797
|
+
private stripHtml;
|
|
2798
|
+
private escapeXml;
|
|
2799
|
+
}
|
|
2800
|
+
/**
|
|
2801
|
+
* Retrieve the active SeoService instance associated with a CMSEngine.
|
|
2802
|
+
*/
|
|
2803
|
+
declare function getSeoService(engine: CMSEngine, options?: SeoPluginOptions): SeoService;
|
|
2804
|
+
//#endregion
|
|
2805
|
+
//#region src/plugins/seo/client.d.ts
|
|
2806
|
+
declare class SeoClient {
|
|
2807
|
+
private client;
|
|
2808
|
+
private options;
|
|
2809
|
+
private service?;
|
|
2810
|
+
private prefix;
|
|
2811
|
+
constructor(client: CMSClient, options?: SeoPluginOptions);
|
|
2812
|
+
/**
|
|
2813
|
+
* Fetch XML sitemap string.
|
|
2814
|
+
*/
|
|
2815
|
+
getSitemapXml(): Promise<string>;
|
|
2816
|
+
/**
|
|
2817
|
+
* Fetch robots.txt plain text string.
|
|
2818
|
+
*/
|
|
2819
|
+
getRobotsTxt(): Promise<string>;
|
|
2820
|
+
/**
|
|
2821
|
+
* Resolve consolidated SEO metadata for a document.
|
|
2822
|
+
*/
|
|
2823
|
+
getMetadata(collection: string, id: string): Promise<SeoMetadata>;
|
|
2824
|
+
/**
|
|
2825
|
+
* Run SEO and readability analysis on draft content.
|
|
2826
|
+
*/
|
|
2827
|
+
analyze(input: SeoContentAnalysisInput): Promise<SeoContentAnalysis>;
|
|
2828
|
+
}
|
|
2829
|
+
/**
|
|
2830
|
+
* Get or create an SeoClient adapter for a CMSClient.
|
|
2831
|
+
*/
|
|
2832
|
+
declare function getSeoClient(client: CMSClient, options?: SeoPluginOptions): SeoClient;
|
|
2833
|
+
//#endregion
|
|
2834
|
+
//#region src/plugins/seo/index.d.ts
|
|
2835
|
+
/**
|
|
2836
|
+
* Built-in SEO & Metadata plugin factory for @azlib/cms.
|
|
2837
|
+
* Equips the CMS engine with dynamic XML sitemaps, robots.txt generation,
|
|
2838
|
+
* OpenGraph/Twitter social cards, JSON-LD structured data, SEO readability scoring,
|
|
2839
|
+
* and declarative schema field extensions.
|
|
2840
|
+
*/
|
|
2841
|
+
declare const seoPlugin: (options?: void | SeoPluginOptions | undefined) => CMSPlugin;
|
|
2842
|
+
//#endregion
|
|
2843
|
+
//#region src/plugins/search/types.d.ts
|
|
2844
|
+
interface SearchDocument {
|
|
2845
|
+
id: string;
|
|
2846
|
+
collection: string;
|
|
2847
|
+
title: string;
|
|
2848
|
+
slug: string;
|
|
2849
|
+
content?: string;
|
|
2850
|
+
excerpt?: string;
|
|
2851
|
+
status?: string;
|
|
2852
|
+
terms?: Record<string, string[]>;
|
|
2853
|
+
data?: Record<string, unknown>;
|
|
2854
|
+
boost?: number;
|
|
2855
|
+
}
|
|
2856
|
+
interface SearchCollectionRule {
|
|
2857
|
+
fields?: string[];
|
|
2858
|
+
weights?: Record<string, number>;
|
|
2859
|
+
filter?: (item: ContentItem) => boolean;
|
|
2860
|
+
}
|
|
2861
|
+
interface SearchQuery {
|
|
2862
|
+
q: string;
|
|
2863
|
+
collections?: string[];
|
|
2864
|
+
limit?: number;
|
|
2865
|
+
offset?: number;
|
|
2866
|
+
status?: string;
|
|
2867
|
+
filters?: Record<string, unknown>;
|
|
2868
|
+
}
|
|
2869
|
+
interface SearchResultItem {
|
|
2870
|
+
id: string;
|
|
2871
|
+
collection: string;
|
|
2872
|
+
title: string;
|
|
2873
|
+
slug: string;
|
|
2874
|
+
snippet?: string;
|
|
2875
|
+
score: number;
|
|
2876
|
+
terms?: Record<string, string[]>;
|
|
2877
|
+
}
|
|
2878
|
+
interface SearchResults {
|
|
2879
|
+
items: SearchResultItem[];
|
|
2880
|
+
total: number;
|
|
2881
|
+
query: string;
|
|
2882
|
+
tookMs: number;
|
|
2883
|
+
}
|
|
2884
|
+
interface SearchAdapterContract {
|
|
2885
|
+
index(docs: SearchDocument[]): Promise<void>;
|
|
2886
|
+
remove(collection: string, id: string): Promise<void>;
|
|
2887
|
+
search(query: SearchQuery): Promise<SearchResults>;
|
|
2888
|
+
clear(): Promise<void>;
|
|
2889
|
+
}
|
|
2890
|
+
interface SearchPluginOptions {
|
|
2891
|
+
collections?: string[] | Record<string, SearchCollectionRule>;
|
|
2892
|
+
enableAutoIndex?: boolean;
|
|
2893
|
+
enableRoutes?: boolean;
|
|
2894
|
+
apiPrefix?: string;
|
|
2895
|
+
adapter?: SearchAdapterContract;
|
|
2896
|
+
}
|
|
2897
|
+
//#endregion
|
|
2898
|
+
//#region src/plugins/search/adapters/memory-search-adapter.d.ts
|
|
2899
|
+
declare class MemorySearchAdapter implements SearchAdapterContract {
|
|
2900
|
+
private docs;
|
|
2901
|
+
private invertedIndex;
|
|
2902
|
+
index(documents: SearchDocument[]): Promise<void>;
|
|
2903
|
+
remove(collection: string, id: string): Promise<void>;
|
|
2904
|
+
clear(): Promise<void>;
|
|
2905
|
+
search(query: SearchQuery): Promise<SearchResults>;
|
|
2906
|
+
private generateSnippet;
|
|
2907
|
+
private tokenize;
|
|
2908
|
+
}
|
|
2909
|
+
//#endregion
|
|
2910
|
+
//#region src/plugins/search/service.d.ts
|
|
2911
|
+
declare class SearchService {
|
|
2912
|
+
private engine;
|
|
2913
|
+
private options;
|
|
2914
|
+
private adapter;
|
|
2915
|
+
constructor(engine: CMSEngine, options?: SearchPluginOptions);
|
|
2916
|
+
getAdapter(): SearchAdapterContract;
|
|
2917
|
+
/**
|
|
2918
|
+
* Search across indexed CMS collections.
|
|
2919
|
+
*/
|
|
2920
|
+
search(query: SearchQuery): Promise<SearchResults>;
|
|
2921
|
+
/**
|
|
2922
|
+
* Index or update a single content item.
|
|
2923
|
+
*/
|
|
2924
|
+
indexItem(item: ContentItem): Promise<void>;
|
|
2925
|
+
/**
|
|
2926
|
+
* Remove a single content item from the search index.
|
|
2927
|
+
*/
|
|
2928
|
+
removeItem(collection: string, id: string): Promise<void>;
|
|
2929
|
+
/**
|
|
2930
|
+
* Reindex all published items across configured CMS collections.
|
|
2931
|
+
*/
|
|
2932
|
+
reindexAll(): Promise<{
|
|
2933
|
+
indexedCount: number;
|
|
2934
|
+
}>;
|
|
2935
|
+
private shouldIndex;
|
|
2936
|
+
private toSearchDocument;
|
|
2937
|
+
private getTargetCollections;
|
|
2938
|
+
private attachHooks;
|
|
2939
|
+
}
|
|
2940
|
+
/**
|
|
2941
|
+
* Retrieve the active SearchService instance associated with a CMSEngine.
|
|
2942
|
+
*/
|
|
2943
|
+
declare function getSearchService(engine: CMSEngine, options?: SearchPluginOptions): SearchService;
|
|
2944
|
+
//#endregion
|
|
2945
|
+
//#region src/plugins/search/client.d.ts
|
|
2946
|
+
declare class SearchClient {
|
|
2947
|
+
private client;
|
|
2948
|
+
private options;
|
|
2949
|
+
private service?;
|
|
2950
|
+
private prefix;
|
|
2951
|
+
constructor(client: CMSClient, options?: SearchPluginOptions);
|
|
2952
|
+
/**
|
|
2953
|
+
* Search across indexed CMS collections.
|
|
2954
|
+
*/
|
|
2955
|
+
search(query: SearchQuery): Promise<SearchResults>;
|
|
2956
|
+
/**
|
|
2957
|
+
* Reindex all content in the search index.
|
|
2958
|
+
*/
|
|
2959
|
+
reindex(): Promise<{
|
|
2960
|
+
success: boolean;
|
|
2961
|
+
indexedCount: number;
|
|
2962
|
+
}>;
|
|
2963
|
+
}
|
|
2964
|
+
/**
|
|
2965
|
+
* Get or create a SearchClient adapter for a CMSClient.
|
|
2966
|
+
*/
|
|
2967
|
+
declare function getSearchClient(client: CMSClient, options?: SearchPluginOptions): SearchClient;
|
|
2968
|
+
//#endregion
|
|
2969
|
+
//#region src/plugins/search/index.d.ts
|
|
2970
|
+
/**
|
|
2971
|
+
* Built-in Search Indexing & Discovery plugin factory for @azlib/cms.
|
|
2972
|
+
* Equips the CMS engine with fast inverted-index full-text search, field weighting,
|
|
2973
|
+
* fuzzy/prefix matching, snippet highlights, and automatic indexing via lifecycle hooks.
|
|
2974
|
+
*/
|
|
2975
|
+
declare const searchPlugin: (options?: void | SearchPluginOptions | undefined) => CMSPlugin;
|
|
2976
|
+
//#endregion
|
|
2977
|
+
//#region src/plugins/audit-log/types.d.ts
|
|
2978
|
+
/**
|
|
2979
|
+
* @azlib/cms - Built-in Audit Log & Activity Trail Plugin Types
|
|
2980
|
+
*/
|
|
2981
|
+
type AuditAction = "create" | "update" | "delete" | "publish" | "restore" | "upload" | "login" | "logout" | "option_change";
|
|
2982
|
+
type AuditEntityType = "content" | "media" | "taxonomy" | "auth" | "option" | "system";
|
|
2983
|
+
interface AuditDiff {
|
|
2984
|
+
before?: Record<string, unknown>;
|
|
2985
|
+
after?: Record<string, unknown>;
|
|
2986
|
+
changedFields?: string[];
|
|
2987
|
+
}
|
|
2988
|
+
interface AuditLogEntry {
|
|
2989
|
+
id: string;
|
|
2990
|
+
action: AuditAction | string;
|
|
2991
|
+
entityType: AuditEntityType | string;
|
|
2992
|
+
collectionSlug?: string;
|
|
2993
|
+
entityId: string;
|
|
2994
|
+
actorId?: string | null;
|
|
2995
|
+
actorName?: string;
|
|
2996
|
+
ip?: string;
|
|
2997
|
+
userAgent?: string;
|
|
2998
|
+
diff?: AuditDiff;
|
|
2999
|
+
timestamp: string;
|
|
3000
|
+
metadata?: Record<string, unknown>;
|
|
3001
|
+
}
|
|
3002
|
+
interface AuditLogQuery {
|
|
3003
|
+
entityType?: string;
|
|
3004
|
+
collectionSlug?: string;
|
|
3005
|
+
entityId?: string;
|
|
3006
|
+
actorId?: string;
|
|
3007
|
+
action?: string;
|
|
3008
|
+
startDate?: string;
|
|
3009
|
+
endDate?: string;
|
|
3010
|
+
limit?: number;
|
|
3011
|
+
offset?: number;
|
|
3012
|
+
}
|
|
3013
|
+
interface AuditLogPluginOptions {
|
|
3014
|
+
collections?: string[];
|
|
3015
|
+
recordMedia?: boolean;
|
|
3016
|
+
recordTaxonomies?: boolean;
|
|
3017
|
+
recordOptions?: boolean;
|
|
3018
|
+
apiPrefix?: string;
|
|
3019
|
+
enableRoutes?: boolean;
|
|
3020
|
+
maxEntries?: number;
|
|
3021
|
+
}
|
|
3022
|
+
//#endregion
|
|
3023
|
+
//#region src/plugins/audit-log/schemas.d.ts
|
|
3024
|
+
declare function createAuditLogCollection(_options?: AuditLogPluginOptions): CollectionConfig;
|
|
3025
|
+
//#endregion
|
|
3026
|
+
//#region src/plugins/audit-log/service.d.ts
|
|
3027
|
+
declare class AuditLogService {
|
|
3028
|
+
private engine;
|
|
3029
|
+
private options;
|
|
3030
|
+
private inMemoryLogs;
|
|
3031
|
+
private maxEntries;
|
|
3032
|
+
constructor(engine: CMSEngine, options?: AuditLogPluginOptions);
|
|
3033
|
+
/**
|
|
3034
|
+
* Record an audit log entry.
|
|
3035
|
+
*/
|
|
3036
|
+
record(entry: Omit<AuditLogEntry, "id" | "timestamp">): Promise<AuditLogEntry>;
|
|
3037
|
+
/**
|
|
3038
|
+
* Query audit logs with multi-attribute filtering and pagination.
|
|
3039
|
+
*/
|
|
3040
|
+
query(query?: AuditLogQuery): Promise<PaginatedResult<AuditLogEntry>>;
|
|
3041
|
+
/**
|
|
3042
|
+
* Get an audit log entry by its ID.
|
|
3043
|
+
*/
|
|
3044
|
+
getById(id: string): Promise<AuditLogEntry | null>;
|
|
3045
|
+
/**
|
|
3046
|
+
* Calculate a field-level diff between two states.
|
|
3047
|
+
*/
|
|
3048
|
+
calculateDiff(before?: Record<string, unknown> | null, after?: Record<string, unknown> | null): AuditDiff;
|
|
3049
|
+
private shouldAuditCollection;
|
|
3050
|
+
private attachHooks;
|
|
3051
|
+
}
|
|
3052
|
+
/**
|
|
3053
|
+
* Retrieve the active AuditLogService instance associated with a CMSEngine.
|
|
3054
|
+
*/
|
|
3055
|
+
declare function getAuditLogService(engine: CMSEngine, options?: AuditLogPluginOptions): AuditLogService;
|
|
3056
|
+
//#endregion
|
|
3057
|
+
//#region src/plugins/audit-log/client.d.ts
|
|
3058
|
+
declare class AuditLogClient {
|
|
3059
|
+
private client;
|
|
3060
|
+
private options;
|
|
3061
|
+
private service?;
|
|
3062
|
+
private prefix;
|
|
3063
|
+
constructor(client: CMSClient, options?: AuditLogPluginOptions);
|
|
3064
|
+
/**
|
|
3065
|
+
* Query recorded audit logs with multi-field filters.
|
|
3066
|
+
*/
|
|
3067
|
+
query(query?: AuditLogQuery): Promise<PaginatedResult<AuditLogEntry>>;
|
|
3068
|
+
/**
|
|
3069
|
+
* Fetch a single audit log entry by ID.
|
|
3070
|
+
*/
|
|
3071
|
+
get(id: string): Promise<AuditLogEntry | null>;
|
|
3072
|
+
}
|
|
3073
|
+
/**
|
|
3074
|
+
* Get or create an AuditLogClient adapter for a CMSClient.
|
|
3075
|
+
*/
|
|
3076
|
+
declare function getAuditLogClient(client: CMSClient, options?: AuditLogPluginOptions): AuditLogClient;
|
|
3077
|
+
//#endregion
|
|
3078
|
+
//#region src/plugins/audit-log/index.d.ts
|
|
3079
|
+
/**
|
|
3080
|
+
* Built-in Audit Log & Activity Trail plugin factory for @azlib/cms.
|
|
3081
|
+
* Equips the CMS engine with immutable enterprise change logs, mutation auditing
|
|
3082
|
+
* across content, media, taxonomies, and options, field-level diffs, and query APIs.
|
|
3083
|
+
*/
|
|
3084
|
+
declare const auditLogPlugin: (options?: void | AuditLogPluginOptions | undefined) => CMSPlugin;
|
|
3085
|
+
//#endregion
|
|
3086
|
+
//#region src/plugins/forms/types.d.ts
|
|
3087
|
+
/**
|
|
3088
|
+
* @azlib/cms - Built-in Forms & Submissions Plugin Types
|
|
3089
|
+
*/
|
|
3090
|
+
type FormFieldType = "text" | "email" | "number" | "textarea" | "select" | "checkbox" | "radio" | "url" | "tel";
|
|
3091
|
+
interface FormFieldRule {
|
|
3092
|
+
name: string;
|
|
3093
|
+
label: string;
|
|
3094
|
+
type: FormFieldType;
|
|
3095
|
+
required?: boolean;
|
|
3096
|
+
placeholder?: string;
|
|
3097
|
+
defaultValue?: unknown;
|
|
3098
|
+
options?: string[];
|
|
3099
|
+
pattern?: string;
|
|
3100
|
+
minLength?: number;
|
|
3101
|
+
maxLength?: number;
|
|
3102
|
+
min?: number;
|
|
3103
|
+
max?: number;
|
|
3104
|
+
}
|
|
3105
|
+
interface FormDefinition {
|
|
3106
|
+
id?: string;
|
|
3107
|
+
slug: string;
|
|
3108
|
+
title: string;
|
|
3109
|
+
description?: string;
|
|
3110
|
+
fields: FormFieldRule[];
|
|
3111
|
+
successMessage?: string;
|
|
3112
|
+
redirectUrl?: string;
|
|
3113
|
+
notifyEmails?: string[];
|
|
3114
|
+
isActive?: boolean;
|
|
3115
|
+
}
|
|
3116
|
+
type SubmissionStatus = "unread" | "read" | "spam" | "archived";
|
|
3117
|
+
interface FormSubmission {
|
|
3118
|
+
id: string;
|
|
3119
|
+
formSlug: string;
|
|
3120
|
+
data: Record<string, unknown>;
|
|
3121
|
+
ip?: string;
|
|
3122
|
+
userAgent?: string;
|
|
3123
|
+
submittedAt: string;
|
|
3124
|
+
status: SubmissionStatus;
|
|
3125
|
+
}
|
|
3126
|
+
interface SubmitFormInput {
|
|
3127
|
+
data: Record<string, unknown>;
|
|
3128
|
+
honeypotValue?: string;
|
|
3129
|
+
}
|
|
3130
|
+
interface FormValidationResult {
|
|
3131
|
+
valid: boolean;
|
|
3132
|
+
errors: Record<string, string>;
|
|
3133
|
+
sanitizedData: Record<string, unknown>;
|
|
3134
|
+
}
|
|
3135
|
+
interface FormsPluginOptions {
|
|
3136
|
+
enableAntiSpam?: boolean;
|
|
3137
|
+
honeypotFieldName?: string;
|
|
3138
|
+
enableRoutes?: boolean;
|
|
3139
|
+
apiPrefix?: string;
|
|
3140
|
+
}
|
|
3141
|
+
//#endregion
|
|
3142
|
+
//#region src/plugins/forms/schemas.d.ts
|
|
3143
|
+
/**
|
|
3144
|
+
* Forms definition collection schema.
|
|
3145
|
+
*/
|
|
3146
|
+
declare function createFormsCollection(_options?: FormsPluginOptions): CollectionConfig;
|
|
3147
|
+
/**
|
|
3148
|
+
* Form submissions collection schema.
|
|
3149
|
+
*/
|
|
3150
|
+
declare function createSubmissionsCollection(_options?: FormsPluginOptions): CollectionConfig;
|
|
3151
|
+
//#endregion
|
|
3152
|
+
//#region src/plugins/forms/service.d.ts
|
|
3153
|
+
declare class FormsService {
|
|
3154
|
+
private engine;
|
|
3155
|
+
private options;
|
|
3156
|
+
private inMemoryForms;
|
|
3157
|
+
private inMemorySubmissions;
|
|
3158
|
+
private honeypotField;
|
|
3159
|
+
constructor(engine: CMSEngine, options?: FormsPluginOptions);
|
|
3160
|
+
/**
|
|
3161
|
+
* Register or update a form schema programmatically or dynamically.
|
|
3162
|
+
*/
|
|
3163
|
+
registerForm(form: FormDefinition): Promise<FormDefinition>;
|
|
3164
|
+
/**
|
|
3165
|
+
* Retrieve a form definition by its slug.
|
|
3166
|
+
*/
|
|
3167
|
+
getForm(slug: string): Promise<FormDefinition | null>;
|
|
3168
|
+
/**
|
|
3169
|
+
* List all registered forms.
|
|
3170
|
+
*/
|
|
3171
|
+
listForms(): Promise<FormDefinition[]>;
|
|
3172
|
+
/**
|
|
3173
|
+
* Validate a submission payload against the form's field definitions.
|
|
3174
|
+
*/
|
|
3175
|
+
validateSubmission(form: FormDefinition, input: SubmitFormInput): FormValidationResult;
|
|
3176
|
+
/**
|
|
3177
|
+
* Submit data to a form by its slug.
|
|
3178
|
+
*/
|
|
3179
|
+
submit(formSlug: string, input: SubmitFormInput, clientMeta?: {
|
|
3180
|
+
ip?: string;
|
|
3181
|
+
userAgent?: string;
|
|
3182
|
+
}): Promise<FormSubmission>;
|
|
3183
|
+
/**
|
|
3184
|
+
* List submissions for a specific form.
|
|
3185
|
+
*/
|
|
3186
|
+
listSubmissions(formSlug: string, options?: {
|
|
3187
|
+
status?: SubmissionStatus;
|
|
3188
|
+
limit?: number;
|
|
3189
|
+
offset?: number;
|
|
3190
|
+
}): Promise<PaginatedResult<FormSubmission>>;
|
|
3191
|
+
/**
|
|
3192
|
+
* Update submission status (e.g. read, spam, archived).
|
|
3193
|
+
*/
|
|
3194
|
+
updateSubmissionStatus(id: string, status: SubmissionStatus): Promise<FormSubmission | null>;
|
|
3195
|
+
}
|
|
3196
|
+
/**
|
|
3197
|
+
* Retrieve the active FormsService instance associated with a CMSEngine.
|
|
3198
|
+
*/
|
|
3199
|
+
declare function getFormsService(engine: CMSEngine, options?: FormsPluginOptions): FormsService;
|
|
3200
|
+
//#endregion
|
|
3201
|
+
//#region src/plugins/forms/client.d.ts
|
|
3202
|
+
declare class FormsClient {
|
|
3203
|
+
private client;
|
|
3204
|
+
private options;
|
|
3205
|
+
private service?;
|
|
3206
|
+
private prefix;
|
|
3207
|
+
constructor(client: CMSClient, options?: FormsPluginOptions);
|
|
3208
|
+
/**
|
|
3209
|
+
* List public forms.
|
|
3210
|
+
*/
|
|
3211
|
+
listForms(): Promise<FormDefinition[]>;
|
|
3212
|
+
/**
|
|
3213
|
+
* Get public form schema definition by slug.
|
|
3214
|
+
*/
|
|
3215
|
+
getForm(slug: string): Promise<FormDefinition | null>;
|
|
3216
|
+
/**
|
|
3217
|
+
* Submit data to a form.
|
|
3218
|
+
*/
|
|
3219
|
+
submit(slug: string, data: Record<string, unknown>, honeypotValue?: string): Promise<{
|
|
3220
|
+
success: boolean;
|
|
3221
|
+
message: string;
|
|
3222
|
+
submissionId: string;
|
|
3223
|
+
redirectUrl?: string;
|
|
3224
|
+
}>;
|
|
3225
|
+
/**
|
|
3226
|
+
* List submissions for a form.
|
|
3227
|
+
*/
|
|
3228
|
+
listSubmissions(slug: string, options?: {
|
|
3229
|
+
status?: SubmissionStatus;
|
|
3230
|
+
limit?: number;
|
|
3231
|
+
offset?: number;
|
|
3232
|
+
}): Promise<PaginatedResult<FormSubmission>>;
|
|
3233
|
+
}
|
|
3234
|
+
/**
|
|
3235
|
+
* Get or create a FormsClient adapter for a CMSClient.
|
|
3236
|
+
*/
|
|
3237
|
+
declare function getFormsClient(client: CMSClient, options?: FormsPluginOptions): FormsClient;
|
|
3238
|
+
//#endregion
|
|
3239
|
+
//#region src/plugins/forms/index.d.ts
|
|
3240
|
+
/**
|
|
3241
|
+
* Built-in Forms & Submissions plugin factory for @azlib/cms.
|
|
3242
|
+
* Equips the CMS engine with dynamic form creation, schema validation,
|
|
3243
|
+
* anti-spam honeypots, submission storage, and custom Web Standard REST routes.
|
|
3244
|
+
*/
|
|
3245
|
+
declare const formsPlugin: (options?: void | FormsPluginOptions | undefined) => CMSPlugin;
|
|
3246
|
+
//#endregion
|
|
3247
|
+
//#region src/plugins/revalidation/types.d.ts
|
|
3248
|
+
type RevalidationEvent = "create" | "update" | "delete" | "publish" | "manual";
|
|
3249
|
+
interface RevalidationEndpoint {
|
|
3250
|
+
url: string;
|
|
3251
|
+
secret?: string;
|
|
3252
|
+
headers?: Record<string, string>;
|
|
3253
|
+
method?: "POST" | "GET";
|
|
3254
|
+
}
|
|
3255
|
+
interface RevalidationPayload {
|
|
3256
|
+
event: RevalidationEvent;
|
|
3257
|
+
collectionSlug?: string;
|
|
3258
|
+
itemId?: string;
|
|
3259
|
+
slug?: string;
|
|
3260
|
+
paths: string[];
|
|
3261
|
+
tags: string[];
|
|
3262
|
+
timestamp: string;
|
|
3263
|
+
}
|
|
3264
|
+
interface RevalidationDeliveryResult {
|
|
3265
|
+
endpoint: string;
|
|
3266
|
+
status: number | "error";
|
|
3267
|
+
success: boolean;
|
|
3268
|
+
durationMs: number;
|
|
3269
|
+
error?: string;
|
|
3270
|
+
}
|
|
3271
|
+
interface RevalidationTriggerInput {
|
|
3272
|
+
paths?: string[];
|
|
3273
|
+
tags?: string[];
|
|
3274
|
+
event?: RevalidationEvent;
|
|
3275
|
+
collectionSlug?: string;
|
|
3276
|
+
itemId?: string;
|
|
3277
|
+
}
|
|
3278
|
+
interface RevalidationPluginOptions {
|
|
3279
|
+
endpoints?: RevalidationEndpoint[];
|
|
3280
|
+
collectionPathMap?: Record<string, (item: ContentItem) => string[] | string>;
|
|
3281
|
+
tagPrefix?: string;
|
|
3282
|
+
enableAutoRevalidate?: boolean;
|
|
3283
|
+
enableRoutes?: boolean;
|
|
3284
|
+
apiPrefix?: string;
|
|
3285
|
+
}
|
|
3286
|
+
//#endregion
|
|
3287
|
+
//#region src/plugins/revalidation/service.d.ts
|
|
3288
|
+
declare class RevalidationService {
|
|
3289
|
+
private engine;
|
|
3290
|
+
private options;
|
|
3291
|
+
private endpoints;
|
|
3292
|
+
private history;
|
|
3293
|
+
private tagPrefix;
|
|
3294
|
+
private fetchFn;
|
|
3295
|
+
constructor(engine: CMSEngine, options?: RevalidationPluginOptions);
|
|
3296
|
+
addEndpoint(endpoint: RevalidationEndpoint): void;
|
|
3297
|
+
getEndpoints(): readonly RevalidationEndpoint[];
|
|
3298
|
+
getHistory(): readonly RevalidationDeliveryResult[];
|
|
3299
|
+
/**
|
|
3300
|
+
* Derive cache tags for a content item.
|
|
3301
|
+
*/
|
|
3302
|
+
deriveTags(collection: string, id?: string, slug?: string): string[];
|
|
3303
|
+
/**
|
|
3304
|
+
* Derive frontend URL paths affected by this content change.
|
|
3305
|
+
*/
|
|
3306
|
+
derivePaths(item: ContentItem): string[];
|
|
3307
|
+
/**
|
|
3308
|
+
* Dispatch revalidation to all configured endpoints.
|
|
3309
|
+
*/
|
|
3310
|
+
revalidate(input: RevalidationTriggerInput): Promise<RevalidationDeliveryResult[]>;
|
|
3311
|
+
private attachHooks;
|
|
3312
|
+
}
|
|
3313
|
+
/**
|
|
3314
|
+
* Retrieve the active RevalidationService instance associated with a CMSEngine.
|
|
3315
|
+
*/
|
|
3316
|
+
declare function getRevalidationService(engine: CMSEngine, options?: RevalidationPluginOptions): RevalidationService;
|
|
3317
|
+
//#endregion
|
|
3318
|
+
//#region src/plugins/revalidation/client.d.ts
|
|
3319
|
+
declare class RevalidationClient {
|
|
3320
|
+
private client;
|
|
3321
|
+
private options;
|
|
3322
|
+
private service?;
|
|
3323
|
+
private prefix;
|
|
3324
|
+
constructor(client: CMSClient, options?: RevalidationPluginOptions);
|
|
3325
|
+
/**
|
|
3326
|
+
* Manually trigger cache invalidation and revalidation for paths or tags.
|
|
3327
|
+
*/
|
|
3328
|
+
revalidate(input: RevalidationTriggerInput): Promise<{
|
|
3329
|
+
success: boolean;
|
|
3330
|
+
results: RevalidationDeliveryResult[];
|
|
3331
|
+
}>;
|
|
3332
|
+
/**
|
|
3333
|
+
* Fetch recent revalidation webhook delivery logs.
|
|
3334
|
+
*/
|
|
3335
|
+
getHistory(): Promise<RevalidationDeliveryResult[]>;
|
|
3336
|
+
}
|
|
3337
|
+
/**
|
|
3338
|
+
* Get or create a RevalidationClient adapter for a CMSClient.
|
|
3339
|
+
*/
|
|
3340
|
+
declare function getRevalidationClient(client: CMSClient, options?: RevalidationPluginOptions): RevalidationClient;
|
|
3341
|
+
//#endregion
|
|
3342
|
+
//#region src/plugins/revalidation/index.d.ts
|
|
3343
|
+
/**
|
|
3344
|
+
* Built-in Frontend Cache & Revalidation plugin factory for @azlib/cms.
|
|
3345
|
+
* Automatically invalidates edge caches and triggers on-demand revalidation
|
|
3346
|
+
* (Next.js, Vercel, Cloudflare, Astro) with HMAC-signed webhooks and manual APIs.
|
|
3347
|
+
*/
|
|
3348
|
+
declare const revalidationPlugin: (options?: void | RevalidationPluginOptions | undefined) => CMSPlugin;
|
|
3349
|
+
//#endregion
|
|
3350
|
+
export { type ActionCallback, ApproveLeaveInput, type ArrayFieldOptions, AttendanceData, AttendanceItem, AttendanceStatus, AuditAction, AuditDiff, AuditEntityType, AuditLogClient, AuditLogEntry, AuditLogPluginOptions, AuditLogQuery, AuditLogService, AuthService, BlockDefinition, type BlocksFieldOptions, type BooleanFieldOptions, CMSApiKeyConfig, CMSAuthConfig, CMSCapability, CMSClient, type CMSClientOptions, CMSConfig, CMSEngine, type CMSPlugin, type CMSPluginContext, CMSRouter, type CMSStorageAdapter, CMSUser, CMSWebhookConfig, CMSWebhookEvent, CartCalculationInput, CartCalculationResult, CartItemInput, CheckInInput, CheckOutInput, type ClientCollectionApi, CollectionConfig, CollectionFieldSummary, type CollectionOptions, CollectionSchemaSummary, type CollectionService, ContentItem, ContentLifecycle, ContentQueryOptions, ContentStatus, type CreateContentInput, CreateDiscountInput, CreateEmployeeInput, CreateEmployerInput, CreateLeaveRequestInput, CreateLeaveTypeInput, CreateOrderInput, CreateProductInput, type CustomRouteHandler, DEFAULT_COLLECTIONS, DEFAULT_ROLE_CAPABILITIES, DataMappingDefinition, type DateFieldOptions, DiscountData, DiscountItem, DiscountStatus, DiscountType, DiscountValidationResult, DiskMediaStorageDriver, type DiskMediaStorageDriverOptions, EcommerceClient, EcommercePluginOptions, EcommerceProductQuery, EcommerceService, type EmailFieldOptions, EmployeeData, EmployeeDocument, EmployeeEmergencyContact, EmployeeItem, EmployeeLeaveBalanceReport, EmployeeStatus, EmployerData, EmployerItem, EmployerStatus, EmployerWorkSchedule, EmploymentType, FieldDefinition, FieldMappingRule, FieldTransformFn, FieldTransformPreset, FieldType, type FilterCallback, FormDefinition, FormFieldRule, FormFieldType, FormSubmission, FormValidationResult, FormsClient, FormsPluginOptions, FormsService, HRMSAttendanceQuery, HRMSClient, HRMSEmployeeQuery, HRMSLeaveQuery, HRMSPluginOptions, HRMSService, HRMS_EMPLOYEE_TRANSFER_PRESET, HRMS_EMPLOYER_TRANSFER_PRESET, type HookEntry, HooksManager, type ImageFieldOptions, InferredFieldType, InspectOptions, type JsonFieldOptions, LeaveBalanceItem, LeaveRequestData, LeaveRequestItem, LeaveRequestStatus, LeaveTypeData, LeaveTypeItem, MappingOptions, MediaItem, MediaManager, MediaStorageDriver, type MediaUploadInput, MemorySearchAdapter, MemoryStorageAdapter, type NumberFieldOptions, OptionItem, OptionsManager, OrderAddress, OrderData, OrderItem, OrderLineItem, OrderStatus, PaginatedResult, ParseExcelResult, ParseSourceOptions, ParsedSourceResult, PersistenceStorageAdapter, type PersistenceStorageAdapterOptions, PreviewManager, type PreviewTokenPayload, ProductData, ProductImage, ProductItem, ProductStatus, ProductVariant, QueryOperatorExpression, RBACManager, RecordAttendanceManualInput, RejectLeaveInput, type RelationshipFieldOptions, type RepeaterFieldOptions, RevalidationClient, RevalidationDeliveryResult, RevalidationEndpoint, RevalidationEvent, RevalidationPayload, RevalidationPluginOptions, RevalidationService, RevalidationTriggerInput, RevisionDiff, RevisionDiffField, RevisionManager, RevisionRecord, type RichTextFieldOptions, RobotsTxtConfig, RobotsTxtPolicy, type RouteContext, SearchAdapterContract, SearchClient, SearchCollectionRule, SearchDocument, SearchPluginOptions, SearchQuery, SearchResultItem, SearchResults, SearchService, type SelectFieldOptions, SelectOption, SeoCheckResult, SeoClient, SeoContentAnalysis, SeoContentAnalysisInput, SeoMetadata, SeoPluginOptions, SeoService, SerializeCsvOptions, SerializeExcelOptions, SerializeJsonOptions, SerializeSourceOptions, SiteConfig, SitemapItem, type SlugFieldOptions, SourceFieldSchema, SourceFormat, SourceInspectionResult, type StoredUserRecord, SubmissionStatus, SubmitFormInput, SuggestedMappingRule, type SyncFilterCallback, TaxonomyConfig, type TaxonomyFieldOptions, TaxonomyManager, TermItem, TermTreeItem, type TextFieldOptions, TransferClient, TransferErrorCode, TransferErrorDetail, TransferExportOptions, TransferExportResult, TransferImportOptions, TransferImportResult, TransferPluginOptions, TransferService, type UpdateContentInput, UpdateEmployeeInput, UpdateEmployerInput, UpdateProductInput, type UrlFieldOptions, UserRole, VALID_STATUS_TRANSITIONS, ValidateTransferOptions, ValidationPreviewRow, ValidationResult, WebhookManager, applyFieldTransform, auditLogPlugin, collection, computeHmacSignature, createAttendanceCollection, createAuditLogCollection, createCMSEngine, createCMSRouter, createCmsClient, createDiscountCollection, createEcommerceTaxonomies, createEmployeeCollection, createEmployerCollection, createFormsCollection, createHRMSTaxonomies, createLeaveRequestCollection, createLeaveTypeCollection, createOrderCollection, createProductCollection, createSeoFieldDefinitions, createSubmissionsCollection, defaultHooks, defineConfig, definePlugin, detectFormat, ecommercePlugin, fields, formsPlugin, generateSuggestedMapping, getAuditLogClient, getAuditLogService, getEcommerceClient, getEcommerceService, getFormsClient, getFormsService, getHRMSClient, getHRMSService, getRevalidationClient, getRevalidationService, getSearchClient, getSearchService, getSeoClient, getSeoService, getTransferClient, getTransferService, hashPassword, hrmsPlugin, inspectSource, mapCmsItemForExport, mapSourceRecord, mergeLocalizedInput, normalizeConfig, parseCsvSource, parseExcelSource, parseJsonSource, parseSource, resolveLocalizedData, resolveUniqueSlug, revalidationPlugin, searchPlugin, seoPlugin, serializeCsv, serializeExcel, serializeJson, serializeSource, signJwt, slugify, summarizeCollection, transferPlugin, validateAndNormalizeData, validateTransferBatch, verifyJwt, verifyPassword };
|
|
2694
3351
|
//# sourceMappingURL=index.d.mts.map
|