@azlib/cms 0.6.0 → 0.7.1

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/dist/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { DatabaseClient, PersistenceConfig } from "@azlib/persistence";
1
2
  //#region src/core/hooks.d.ts
2
3
  /**
3
4
  * @azlib/cms - WordPress-style Action and Filter Hook System
@@ -251,12 +252,33 @@ declare class TaxonomyManager {
251
252
  removeTerms(contentId: string, termIds: string[]): Promise<void>;
252
253
  }
253
254
  //#endregion
255
+ //#region src/media/drivers/driver-contract.d.ts
256
+ /**
257
+ * @azlib/cms - Media Storage Driver Contract
258
+ */
259
+ interface MediaStorageDriver {
260
+ write(input: {
261
+ filename: string;
262
+ buffer: Uint8Array;
263
+ mimeType: string;
264
+ }): Promise<{
265
+ url: string;
266
+ path?: string;
267
+ sizeBytes: number;
268
+ }>;
269
+ read(pathOrUrl: string): Promise<Uint8Array | null>;
270
+ delete(pathOrUrl: string): Promise<boolean>;
271
+ getUrl(path: string): string;
272
+ }
273
+ //#endregion
254
274
  //#region src/media/media-manager.d.ts
255
275
  interface MediaUploadInput {
256
276
  filename: string;
257
277
  mimeType: string;
258
- sizeBytes: number;
278
+ sizeBytes?: number;
279
+ buffer?: Uint8Array;
259
280
  url?: string;
281
+ path?: string;
260
282
  width?: number;
261
283
  height?: number;
262
284
  altText?: string;
@@ -267,8 +289,9 @@ declare class MediaManager {
267
289
  private storage;
268
290
  private hooks?;
269
291
  private publicBaseUrl;
292
+ private driver?;
270
293
  private allowedMimePrefixes;
271
- constructor(storage: CMSStorageAdapter, hooks?: HooksManager | undefined, publicBaseUrl?: string);
294
+ constructor(storage: CMSStorageAdapter, hooks?: HooksManager | undefined, publicBaseUrl?: string, driver?: MediaStorageDriver | undefined);
272
295
  /**
273
296
  * Upload / register a new media item.
274
297
  */
@@ -328,6 +351,101 @@ declare class RBACManager {
328
351
  }): boolean;
329
352
  }
330
353
  //#endregion
354
+ //#region src/auth/auth-service.d.ts
355
+ interface StoredUserRecord extends CMSUser {
356
+ passwordHash: string;
357
+ createdAt: string;
358
+ updatedAt: string;
359
+ }
360
+ declare class AuthService {
361
+ private config;
362
+ private rbac;
363
+ private users;
364
+ private defaultSecret;
365
+ constructor(config: CMSAuthConfig | undefined, rbac: RBACManager);
366
+ get enabled(): boolean;
367
+ /**
368
+ * Register a new user account.
369
+ */
370
+ register(input: {
371
+ username: string;
372
+ email: string;
373
+ password: string;
374
+ displayName?: string;
375
+ role?: UserRole;
376
+ }): Promise<CMSUser>;
377
+ /**
378
+ * Authenticate with email/username and password.
379
+ */
380
+ login(identifier: string, password: string): Promise<{
381
+ user: CMSUser;
382
+ token: string;
383
+ }>;
384
+ /**
385
+ * Extract and authenticate user from Request (Bearer JWT, ApiKey, or X-API-Key).
386
+ */
387
+ authenticateRequest(request: Request): Promise<CMSUser | null>;
388
+ /**
389
+ * Find a user by ID.
390
+ */
391
+ getUserById(id: string): CMSUser | null;
392
+ private sanitizeUser;
393
+ }
394
+ //#endregion
395
+ //#region src/core/webhooks.d.ts
396
+ declare function computeHmacSignature(payload: string, secret: string): Promise<string>;
397
+ declare class WebhookManager {
398
+ private hooks?;
399
+ private webhooks;
400
+ private fetchFn;
401
+ constructor(initialWebhooks?: readonly CMSWebhookConfig[], hooks?: HooksManager | undefined, fetchFn?: typeof globalThis.fetch);
402
+ /**
403
+ * Register a new webhook endpoint.
404
+ */
405
+ registerWebhook(webhook: CMSWebhookConfig): string;
406
+ /**
407
+ * Get all registered webhooks.
408
+ */
409
+ getWebhooks(): CMSWebhookConfig[];
410
+ /**
411
+ * Delete a webhook by ID.
412
+ */
413
+ deleteWebhook(id: string): boolean;
414
+ /**
415
+ * Dispatch an event to all matching webhooks asynchronously.
416
+ */
417
+ dispatch(event: CMSWebhookEvent, data: Record<string, unknown>): Promise<{
418
+ url: string;
419
+ success: boolean;
420
+ status?: number;
421
+ }[]>;
422
+ }
423
+ //#endregion
424
+ //#region src/core/preview.d.ts
425
+ /**
426
+ * @azlib/cms - Draft Preview Mode Engine
427
+ */
428
+ interface PreviewTokenPayload extends Record<string, unknown> {
429
+ contentId: string;
430
+ collection: string;
431
+ scope: "preview";
432
+ }
433
+ declare class PreviewManager {
434
+ private secret;
435
+ constructor(secret?: string);
436
+ /**
437
+ * Mint a signed draft preview token.
438
+ */
439
+ createPreviewToken(contentId: string, collection: string, expiresInSeconds?: number): Promise<string>;
440
+ /**
441
+ * Verify and unpack a draft preview token.
442
+ */
443
+ verifyPreviewToken(token: string): Promise<{
444
+ contentId: string;
445
+ collection: string;
446
+ } | null>;
447
+ }
448
+ //#endregion
331
449
  //#region src/core/engine.d.ts
332
450
  interface CreateContentInput {
333
451
  title?: string;
@@ -350,8 +468,16 @@ interface UpdateContentInput {
350
468
  interface CollectionService<TData extends Record<string, unknown> = Record<string, unknown>> {
351
469
  readonly config: CollectionConfig;
352
470
  create(input: CreateContentInput, authorId?: string | null): Promise<ContentItem<TData>>;
353
- findById(id: string): Promise<ContentItem<TData> | null>;
354
- findBySlug(slug: string): Promise<ContentItem<TData> | null>;
471
+ findById(id: string, options?: {
472
+ populate?: string[];
473
+ select?: string[];
474
+ locale?: string;
475
+ }): Promise<ContentItem<TData> | null>;
476
+ findBySlug(slug: string, options?: {
477
+ populate?: string[];
478
+ select?: string[];
479
+ locale?: string;
480
+ }): Promise<ContentItem<TData> | null>;
355
481
  find(options?: ContentQueryOptions): Promise<PaginatedResult<ContentItem<TData>>>;
356
482
  update(id: string, input: UpdateContentInput, authorId?: string | null, revisionNote?: string): Promise<ContentItem<TData> | null>;
357
483
  delete(id: string): Promise<boolean>;
@@ -370,6 +496,9 @@ declare class CMSEngine {
370
496
  readonly taxonomies: TaxonomyManager;
371
497
  readonly media: MediaManager;
372
498
  readonly rbac: RBACManager;
499
+ readonly auth: AuthService;
500
+ readonly webhooks: WebhookManager;
501
+ readonly preview: PreviewManager;
373
502
  readonly revisions: RevisionManager;
374
503
  readonly lifecycle: ContentLifecycle;
375
504
  private collections;
@@ -520,11 +649,17 @@ declare function definePlugin<TOptions = void>(factory: (options: TOptions) => C
520
649
  //#endregion
521
650
  //#region src/core/types.d.ts
522
651
  type ContentStatus = "draft" | "pending_review" | "scheduled" | "published" | "private" | "trash";
523
- type FieldType = "text" | "slug" | "richText" | "number" | "boolean" | "select" | "image" | "taxonomy" | "relationship" | "date" | "json" | "repeater";
652
+ type FieldType = "text" | "slug" | "richText" | "number" | "boolean" | "select" | "image" | "taxonomy" | "relationship" | "date" | "json" | "repeater" | "blocks" | "email" | "url" | "array";
524
653
  interface SelectOption {
525
654
  readonly label: string;
526
655
  readonly value: string | number;
527
656
  }
657
+ interface BlockDefinition {
658
+ readonly slug: string;
659
+ readonly label: string;
660
+ readonly description?: string;
661
+ readonly fields: readonly FieldDefinition[];
662
+ }
528
663
  interface FieldDefinition<TValue = any> {
529
664
  readonly name: string;
530
665
  readonly type: FieldType;
@@ -538,6 +673,10 @@ interface FieldDefinition<TValue = any> {
538
673
  readonly targetCollection?: string;
539
674
  readonly fromField?: string;
540
675
  readonly fields?: readonly FieldDefinition[];
676
+ readonly blocks?: readonly BlockDefinition[];
677
+ readonly readRoles?: readonly string[];
678
+ readonly writeRoles?: readonly string[];
679
+ readonly localized?: boolean;
541
680
  readonly min?: number;
542
681
  readonly max?: number;
543
682
  readonly pattern?: string;
@@ -559,6 +698,21 @@ interface CollectionConfig {
559
698
  readonly direction: "asc" | "desc";
560
699
  };
561
700
  }
701
+ interface QueryOperatorExpression {
702
+ $eq?: unknown;
703
+ $ne?: unknown;
704
+ $gt?: unknown;
705
+ $gte?: unknown;
706
+ $lt?: unknown;
707
+ $lte?: unknown;
708
+ $in?: unknown[];
709
+ $nin?: unknown[];
710
+ $contains?: string;
711
+ $startsWith?: string;
712
+ $endsWith?: string;
713
+ $between?: [unknown, unknown];
714
+ $exists?: boolean;
715
+ }
562
716
  interface ContentItem<TData extends Record<string, unknown> = Record<string, unknown>> {
563
717
  id: string;
564
718
  collection: string;
@@ -572,8 +726,10 @@ interface ContentItem<TData extends Record<string, unknown> = Record<string, unk
572
726
  createdAt: string;
573
727
  updatedAt: string;
574
728
  version: number;
729
+ locale?: string;
575
730
  data: TData;
576
731
  terms?: Record<string, string[]>;
732
+ populated?: Record<string, unknown>;
577
733
  }
578
734
  interface ContentQueryOptions {
579
735
  status?: ContentStatus | ContentStatus[];
@@ -581,13 +737,17 @@ interface ContentQueryOptions {
581
737
  parentId?: string | null;
582
738
  termIds?: string[];
583
739
  search?: string;
584
- where?: Record<string, unknown>;
740
+ where?: Record<string, unknown | QueryOperatorExpression>;
585
741
  orderBy?: string;
586
742
  orderDirection?: "asc" | "desc";
587
743
  limit?: number;
588
744
  offset?: number;
589
745
  includeRevisions?: boolean;
590
746
  includeTerms?: boolean;
747
+ populate?: string[];
748
+ select?: string[];
749
+ locale?: string;
750
+ fallbackLocale?: string;
591
751
  }
592
752
  interface PaginatedResult<T> {
593
753
  items: T[];
@@ -683,6 +843,44 @@ interface SiteConfig {
683
843
  locale?: string;
684
844
  timezone?: string;
685
845
  }
846
+ interface CMSApiKeyConfig {
847
+ key: string;
848
+ role: UserRole;
849
+ name?: string;
850
+ capabilities?: string[];
851
+ }
852
+ interface CMSAuthConfig {
853
+ enabled?: boolean;
854
+ jwtSecret?: string;
855
+ tokenExpiresIn?: string | number;
856
+ apiKeys?: CMSApiKeyConfig[];
857
+ publicCollections?: string[];
858
+ publicMutations?: boolean;
859
+ }
860
+ type CMSWebhookEvent = "content.created" | "content.updated" | "content.deleted" | "content.published" | "media.uploaded" | "media.deleted" | (string & {});
861
+ interface CMSWebhookConfig {
862
+ id?: string;
863
+ name: string;
864
+ url: string;
865
+ secret?: string;
866
+ events: CMSWebhookEvent[];
867
+ enabled?: boolean;
868
+ headers?: Record<string, string>;
869
+ }
870
+ interface MediaStorageDriver$1 {
871
+ write(input: {
872
+ filename: string;
873
+ buffer: Uint8Array;
874
+ mimeType: string;
875
+ }): Promise<{
876
+ url: string;
877
+ path?: string;
878
+ sizeBytes: number;
879
+ }>;
880
+ read(pathOrUrl: string): Promise<Uint8Array | null>;
881
+ delete(pathOrUrl: string): Promise<boolean>;
882
+ getUrl(path: string): string;
883
+ }
686
884
  interface CMSConfig {
687
885
  site?: SiteConfig;
688
886
  collections: readonly CollectionConfig[];
@@ -692,6 +890,19 @@ interface CMSConfig {
692
890
  route?: string;
693
891
  enableRegistration?: boolean;
694
892
  };
893
+ auth?: CMSAuthConfig;
894
+ webhooks?: readonly CMSWebhookConfig[];
895
+ media?: {
896
+ storageDriver?: MediaStorageDriver$1;
897
+ uploadDir?: string;
898
+ publicBaseUrl?: string;
899
+ maxSizeBytes?: number;
900
+ };
901
+ i18n?: {
902
+ defaultLocale: string;
903
+ locales: readonly string[];
904
+ fallback?: boolean;
905
+ };
695
906
  }
696
907
  //#endregion
697
908
  //#region src/core/config.d.ts
@@ -709,7 +920,12 @@ declare function defineConfig(config: CMSConfig): CMSConfig;
709
920
  declare function normalizeConfig(config: Partial<CMSConfig>): CMSConfig;
710
921
  //#endregion
711
922
  //#region src/content/schema.d.ts
712
- interface TextFieldOptions {
923
+ interface BaseFieldOptions {
924
+ readRoles?: readonly (UserRole | string)[];
925
+ writeRoles?: readonly (UserRole | string)[];
926
+ localized?: boolean;
927
+ }
928
+ interface TextFieldOptions extends BaseFieldOptions {
713
929
  name: string;
714
930
  label?: string;
715
931
  description?: string;
@@ -721,21 +937,21 @@ interface TextFieldOptions {
721
937
  pattern?: string;
722
938
  validate?: (value: string, data: Record<string, unknown>) => string | null | boolean;
723
939
  }
724
- interface SlugFieldOptions {
940
+ interface SlugFieldOptions extends BaseFieldOptions {
725
941
  name?: string;
726
942
  label?: string;
727
943
  from?: string;
728
944
  required?: boolean;
729
945
  unique?: boolean;
730
946
  }
731
- interface RichTextFieldOptions {
947
+ interface RichTextFieldOptions extends BaseFieldOptions {
732
948
  name: string;
733
949
  label?: string;
734
950
  description?: string;
735
951
  required?: boolean;
736
952
  defaultValue?: string;
737
953
  }
738
- interface NumberFieldOptions {
954
+ interface NumberFieldOptions extends BaseFieldOptions {
739
955
  name: string;
740
956
  label?: string;
741
957
  description?: string;
@@ -744,13 +960,13 @@ interface NumberFieldOptions {
744
960
  min?: number;
745
961
  max?: number;
746
962
  }
747
- interface BooleanFieldOptions {
963
+ interface BooleanFieldOptions extends BaseFieldOptions {
748
964
  name: string;
749
965
  label?: string;
750
966
  description?: string;
751
967
  defaultValue?: boolean;
752
968
  }
753
- interface SelectFieldOptions {
969
+ interface SelectFieldOptions extends BaseFieldOptions {
754
970
  name: string;
755
971
  label?: string;
756
972
  description?: string;
@@ -758,40 +974,40 @@ interface SelectFieldOptions {
758
974
  options: readonly (string | SelectOption)[];
759
975
  defaultValue?: string | number;
760
976
  }
761
- interface ImageFieldOptions {
977
+ interface ImageFieldOptions extends BaseFieldOptions {
762
978
  name: string;
763
979
  label?: string;
764
980
  description?: string;
765
981
  required?: boolean;
766
982
  }
767
- interface TaxonomyFieldOptions {
983
+ interface TaxonomyFieldOptions extends BaseFieldOptions {
768
984
  name: string;
769
985
  taxonomy: string;
770
986
  label?: string;
771
987
  required?: boolean;
772
988
  }
773
- interface RelationshipFieldOptions {
989
+ interface RelationshipFieldOptions extends BaseFieldOptions {
774
990
  name: string;
775
991
  targetCollection: string;
776
992
  label?: string;
777
993
  description?: string;
778
994
  required?: boolean;
779
995
  }
780
- interface DateFieldOptions {
996
+ interface DateFieldOptions extends BaseFieldOptions {
781
997
  name: string;
782
998
  label?: string;
783
999
  description?: string;
784
1000
  required?: boolean;
785
1001
  defaultValue?: string;
786
1002
  }
787
- interface JsonFieldOptions {
1003
+ interface JsonFieldOptions extends BaseFieldOptions {
788
1004
  name: string;
789
1005
  label?: string;
790
1006
  description?: string;
791
1007
  required?: boolean;
792
1008
  defaultValue?: unknown;
793
1009
  }
794
- interface RepeaterFieldOptions {
1010
+ interface RepeaterFieldOptions extends BaseFieldOptions {
795
1011
  name: string;
796
1012
  label?: string;
797
1013
  description?: string;
@@ -799,6 +1015,37 @@ interface RepeaterFieldOptions {
799
1015
  min?: number;
800
1016
  max?: number;
801
1017
  }
1018
+ interface BlocksFieldOptions extends BaseFieldOptions {
1019
+ name: string;
1020
+ label?: string;
1021
+ description?: string;
1022
+ required?: boolean;
1023
+ blocks: readonly BlockDefinition[];
1024
+ min?: number;
1025
+ max?: number;
1026
+ }
1027
+ interface EmailFieldOptions extends BaseFieldOptions {
1028
+ name: string;
1029
+ label?: string;
1030
+ description?: string;
1031
+ required?: boolean;
1032
+ defaultValue?: string;
1033
+ unique?: boolean;
1034
+ }
1035
+ interface UrlFieldOptions extends BaseFieldOptions {
1036
+ name: string;
1037
+ label?: string;
1038
+ description?: string;
1039
+ required?: boolean;
1040
+ defaultValue?: string;
1041
+ }
1042
+ interface ArrayFieldOptions extends BaseFieldOptions {
1043
+ name: string;
1044
+ label?: string;
1045
+ description?: string;
1046
+ required?: boolean;
1047
+ defaultValue?: unknown[];
1048
+ }
802
1049
  declare const fields: {
803
1050
  text(options: TextFieldOptions): FieldDefinition<string>;
804
1051
  slug(options?: SlugFieldOptions): FieldDefinition<string>;
@@ -812,6 +1059,13 @@ declare const fields: {
812
1059
  date(options: DateFieldOptions): FieldDefinition<string>;
813
1060
  json(options: JsonFieldOptions): FieldDefinition<unknown>;
814
1061
  repeater(options: RepeaterFieldOptions): FieldDefinition<Record<string, unknown>[]>;
1062
+ blocks(options: BlocksFieldOptions): FieldDefinition<{
1063
+ blockType: string;
1064
+ [key: string]: unknown;
1065
+ }[]>;
1066
+ email(options: EmailFieldOptions): FieldDefinition<string>;
1067
+ url(options: UrlFieldOptions): FieldDefinition<string>;
1068
+ array(options: ArrayFieldOptions): FieldDefinition<unknown[]>;
815
1069
  };
816
1070
  interface CollectionOptions {
817
1071
  slug: string;
@@ -841,6 +1095,16 @@ declare function validateAndNormalizeData(fieldsList: readonly FieldDefinition[]
841
1095
  errors: Record<string, string>;
842
1096
  };
843
1097
  //#endregion
1098
+ //#region src/content/i18n.d.ts
1099
+ /**
1100
+ * Resolve localized fields on a content record for a target locale.
1101
+ */
1102
+ declare function resolveLocalizedData(data: Record<string, unknown>, fieldsList: readonly FieldDefinition[], targetLocale: string, fallbackLocale?: string): Record<string, unknown>;
1103
+ /**
1104
+ * Merge an incoming update for a specific locale into existing localized dictionaries.
1105
+ */
1106
+ declare function mergeLocalizedInput(incomingData: Record<string, unknown>, existingData: Record<string, unknown> | undefined, fieldsList: readonly FieldDefinition[], locale: string): Record<string, unknown>;
1107
+ //#endregion
844
1108
  //#region src/content/slug.d.ts
845
1109
  /**
846
1110
  * @azlib/cms - Slug generation and normalization utility
@@ -854,6 +1118,38 @@ declare function slugify(input: string): string;
854
1118
  */
855
1119
  declare function resolveUniqueSlug(baseSlug: string, isSlugTaken: (slug: string) => Promise<boolean> | boolean, currentId?: string): Promise<string>;
856
1120
  //#endregion
1121
+ //#region src/media/drivers/disk-driver.d.ts
1122
+ interface DiskMediaStorageDriverOptions {
1123
+ uploadDir: string;
1124
+ publicBaseUrl?: string;
1125
+ }
1126
+ declare class DiskMediaStorageDriver implements MediaStorageDriver {
1127
+ private uploadDir;
1128
+ private publicBaseUrl;
1129
+ constructor(options: DiskMediaStorageDriverOptions);
1130
+ write(input: {
1131
+ filename: string;
1132
+ buffer: Uint8Array;
1133
+ mimeType: string;
1134
+ }): Promise<{
1135
+ url: string;
1136
+ path: string;
1137
+ sizeBytes: number;
1138
+ }>;
1139
+ read(pathOrUrl: string): Promise<Uint8Array | null>;
1140
+ delete(pathOrUrl: string): Promise<boolean>;
1141
+ getUrl(filePathOrName: string): string;
1142
+ }
1143
+ //#endregion
1144
+ //#region src/auth/jwt.d.ts
1145
+ /**
1146
+ * @azlib/cms - Universal Web Crypto JWT & Password Hashing
1147
+ */
1148
+ declare function signJwt(payload: Record<string, unknown>, secret: string, expiresInSeconds?: number): Promise<string>;
1149
+ declare function verifyJwt<T extends Record<string, unknown> = Record<string, unknown>>(token: string, secret: string): Promise<T | null>;
1150
+ declare function hashPassword(password: string): Promise<string>;
1151
+ declare function verifyPassword(password: string, storedHash: string): Promise<boolean>;
1152
+ //#endregion
857
1153
  //#region src/storage/memory-adapter.d.ts
858
1154
  declare class MemoryStorageAdapter implements CMSStorageAdapter {
859
1155
  private content;
@@ -868,6 +1164,8 @@ declare class MemoryStorageAdapter implements CMSStorageAdapter {
868
1164
  getContent<T extends Record<string, unknown>>(collection: string, id: string): Promise<ContentItem<T> | null>;
869
1165
  getContentBySlug<T extends Record<string, unknown>>(collection: string, slug: string): Promise<ContentItem<T> | null>;
870
1166
  findContent<T extends Record<string, unknown>>(collection: string, options?: ContentQueryOptions): Promise<PaginatedResult<ContentItem<T>>>;
1167
+ private populateItem;
1168
+ private projectItem;
871
1169
  updateContent<T extends Record<string, unknown>>(collection: string, id: string, updates: Partial<Omit<ContentItem<T>, "id" | "collection" | "createdAt">>): Promise<ContentItem<T> | null>;
872
1170
  deleteContent(collection: string, id: string): Promise<boolean>;
873
1171
  countContent(collection: string, options?: ContentQueryOptions): Promise<number>;
@@ -904,6 +1202,63 @@ declare class MemoryStorageAdapter implements CMSStorageAdapter {
904
1202
  getOptions(namespace?: string): Promise<OptionItem[]>;
905
1203
  }
906
1204
  //#endregion
1205
+ //#region src/storage/persistence-adapter.d.ts
1206
+ interface PersistenceStorageAdapterOptions {
1207
+ client: DatabaseClient;
1208
+ config: PersistenceConfig;
1209
+ autoMigrate?: boolean;
1210
+ }
1211
+ declare class PersistenceStorageAdapter implements CMSStorageAdapter {
1212
+ private client;
1213
+ private config;
1214
+ private autoMigrate;
1215
+ constructor(options: PersistenceStorageAdapterOptions);
1216
+ init(): Promise<void>;
1217
+ close(): Promise<void>;
1218
+ createContent<T extends Record<string, unknown>>(item: Omit<ContentItem<T>, "id" | "createdAt" | "updatedAt" | "version">): Promise<ContentItem<T>>;
1219
+ getContent<T extends Record<string, unknown>>(collection: string, id: string): Promise<ContentItem<T> | null>;
1220
+ getContentBySlug<T extends Record<string, unknown>>(collection: string, slug: string): Promise<ContentItem<T> | null>;
1221
+ findContent<T extends Record<string, unknown>>(collection: string, options?: ContentQueryOptions): Promise<PaginatedResult<ContentItem<T>>>;
1222
+ updateContent<T extends Record<string, unknown>>(collection: string, id: string, updates: Partial<Omit<ContentItem<T>, "id" | "collection" | "createdAt">>): Promise<ContentItem<T> | null>;
1223
+ deleteContent(collection: string, id: string): Promise<boolean>;
1224
+ countContent(collection: string, options?: ContentQueryOptions): Promise<number>;
1225
+ createRevision(contentId: string, collection: string, version: number, snapshot: ContentItem, authorId?: string | null, note?: string): Promise<RevisionRecord>;
1226
+ getRevisions(contentId: string): Promise<RevisionRecord[]>;
1227
+ getRevision(revisionId: string): Promise<RevisionRecord | null>;
1228
+ deleteRevisionsByContentId(contentId: string): Promise<number>;
1229
+ createTerm(term: Omit<TermItem, "id" | "count" | "createdAt" | "updatedAt">): Promise<TermItem>;
1230
+ getTermById(id: string): Promise<TermItem | null>;
1231
+ getTermBySlug(taxonomy: string, slug: string): Promise<TermItem | null>;
1232
+ getTerms(taxonomy: string, options?: {
1233
+ parentId?: string | null;
1234
+ }): Promise<TermItem[]>;
1235
+ updateTerm(id: string, updates: Partial<Omit<TermItem, "id" | "taxonomy" | "createdAt">>): Promise<TermItem | null>;
1236
+ deleteTerm(id: string): Promise<boolean>;
1237
+ assignTermsToContent(contentId: string, termIds: string[]): Promise<void>;
1238
+ getContentTerms(contentId: string, taxonomy?: string): Promise<TermItem[]>;
1239
+ removeTermsFromContent(contentId: string, termIds: string[]): Promise<void>;
1240
+ createMedia(item: Omit<MediaItem, "id" | "createdAt" | "updatedAt">): Promise<MediaItem>;
1241
+ getMedia(id: string): Promise<MediaItem | null>;
1242
+ findMedia(options?: {
1243
+ search?: string;
1244
+ mimeType?: string;
1245
+ authorId?: string;
1246
+ limit?: number;
1247
+ offset?: number;
1248
+ }): Promise<PaginatedResult<MediaItem>>;
1249
+ updateMedia(id: string, updates: Partial<Omit<MediaItem, "id" | "createdAt">>): Promise<MediaItem | null>;
1250
+ deleteMedia(id: string): Promise<boolean>;
1251
+ getOption<T = unknown>(key: string): Promise<OptionItem<T> | null>;
1252
+ setOption<T = unknown>(item: OptionItem<T>): Promise<void>;
1253
+ deleteOption(key: string): Promise<boolean>;
1254
+ getOptions(namespace?: string): Promise<OptionItem[]>;
1255
+ private deserializeContent;
1256
+ private deserializeTerm;
1257
+ private deserializeMedia;
1258
+ private populateItem;
1259
+ private matchesCondition;
1260
+ }
1261
+ //#endregion
907
1262
  //#region src/api/router.d.ts
908
1263
  declare class CMSRouter {
909
1264
  private engine;
@@ -918,10 +1273,12 @@ declare class CMSRouter {
918
1273
  */
919
1274
  handle(request: Request): Promise<Response>;
920
1275
  private handleCustomRoute;
1276
+ private handleAuth;
921
1277
  private handleContent;
922
1278
  private handleTaxonomies;
923
1279
  private handleMedia;
924
1280
  private handleOptions;
1281
+ private filterRestrictedFields;
925
1282
  }
926
1283
  declare function createCMSRouter(engine: CMSEngine): CMSRouter;
927
1284
  //#endregion
@@ -2333,5 +2690,5 @@ declare const transferPlugin: (options?: void | TransferPluginOptions | undefine
2333
2690
  */
2334
2691
  declare function getTransferService(engine: CMSEngine, options?: TransferPluginOptions): TransferService;
2335
2692
  //#endregion
2336
- export { type ActionCallback, ApproveLeaveInput, AttendanceData, AttendanceItem, AttendanceStatus, type BooleanFieldOptions, CMSCapability, CMSClient, type CMSClientOptions, CMSConfig, CMSEngine, type CMSPlugin, type CMSPluginContext, CMSRouter, type CMSStorageAdapter, CMSUser, 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, EcommerceClient, EcommercePluginOptions, EcommerceProductQuery, EcommerceService, EmployeeData, EmployeeDocument, EmployeeEmergencyContact, EmployeeItem, EmployeeLeaveBalanceReport, EmployeeStatus, EmployerData, EmployerItem, EmployerStatus, EmployerWorkSchedule, EmploymentType, FieldDefinition, FieldMappingRule, FieldTransformFn, FieldTransformPreset, FieldType, type FilterCallback, 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, type MediaUploadInput, MemoryStorageAdapter, type NumberFieldOptions, OptionItem, OptionsManager, OrderAddress, OrderData, OrderItem, OrderLineItem, OrderStatus, PaginatedResult, ParseExcelResult, ParseSourceOptions, ParsedSourceResult, ProductData, ProductImage, ProductItem, ProductStatus, ProductVariant, RBACManager, RecordAttendanceManualInput, RejectLeaveInput, type RelationshipFieldOptions, type RepeaterFieldOptions, RevisionDiff, RevisionDiffField, RevisionManager, RevisionRecord, type RichTextFieldOptions, type RouteContext, type SelectFieldOptions, SelectOption, SerializeCsvOptions, SerializeExcelOptions, SerializeJsonOptions, SerializeSourceOptions, SiteConfig, type SlugFieldOptions, SourceFieldSchema, SourceFormat, SourceInspectionResult, 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, UserRole, VALID_STATUS_TRANSITIONS, ValidateTransferOptions, ValidationPreviewRow, ValidationResult, applyFieldTransform, collection, createAttendanceCollection, createCMSEngine, createCMSRouter, createCmsClient, createDiscountCollection, createEcommerceTaxonomies, createEmployeeCollection, createEmployerCollection, createHRMSTaxonomies, createLeaveRequestCollection, createLeaveTypeCollection, createOrderCollection, createProductCollection, defaultHooks, defineConfig, definePlugin, detectFormat, ecommercePlugin, fields, generateSuggestedMapping, getEcommerceClient, getEcommerceService, getHRMSClient, getHRMSService, getTransferClient, getTransferService, hrmsPlugin, inspectSource, mapCmsItemForExport, mapSourceRecord, normalizeConfig, parseCsvSource, parseExcelSource, parseJsonSource, parseSource, resolveUniqueSlug, serializeCsv, serializeExcel, serializeJson, serializeSource, slugify, summarizeCollection, transferPlugin, validateAndNormalizeData, validateTransferBatch };
2693
+ export { type ActionCallback, ApproveLeaveInput, type ArrayFieldOptions, AttendanceData, AttendanceItem, AttendanceStatus, 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, 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, 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, RevisionDiff, RevisionDiffField, RevisionManager, RevisionRecord, type RichTextFieldOptions, type RouteContext, type SelectFieldOptions, SelectOption, SerializeCsvOptions, SerializeExcelOptions, SerializeJsonOptions, SerializeSourceOptions, SiteConfig, type SlugFieldOptions, SourceFieldSchema, SourceFormat, SourceInspectionResult, type StoredUserRecord, 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, collection, computeHmacSignature, createAttendanceCollection, createCMSEngine, createCMSRouter, createCmsClient, createDiscountCollection, createEcommerceTaxonomies, createEmployeeCollection, createEmployerCollection, createHRMSTaxonomies, createLeaveRequestCollection, createLeaveTypeCollection, createOrderCollection, createProductCollection, defaultHooks, defineConfig, definePlugin, detectFormat, ecommercePlugin, fields, generateSuggestedMapping, getEcommerceClient, getEcommerceService, getHRMSClient, getHRMSService, getTransferClient, getTransferService, hashPassword, hrmsPlugin, inspectSource, mapCmsItemForExport, mapSourceRecord, mergeLocalizedInput, normalizeConfig, parseCsvSource, parseExcelSource, parseJsonSource, parseSource, resolveLocalizedData, resolveUniqueSlug, serializeCsv, serializeExcel, serializeJson, serializeSource, signJwt, slugify, summarizeCollection, transferPlugin, validateAndNormalizeData, validateTransferBatch, verifyJwt, verifyPassword };
2337
2694
  //# sourceMappingURL=index.d.mts.map