Skip to content

mergeAuthCollections

mergeAuthCollections(props): CollectionConfig<{ }, { }, string, string, ComponentHKT>[]

Defined in: packages/core/src/auth/mergeCollections.ts:30

Merges auth collections with user-defined collections, respecting protected at the collection level and meta.locked on individual fields.

Merge rules:

  1. User collections that match a protected auth slug throw an error.
  2. Iterate remaining user collections in their declared order.
  3. If a user collection’s slug matches an auth collection:
    • Auth fields with meta.locked === true are preserved.
    • All other fields: user field wins (override or extend).
    • Admin config: user collection wins.
    • The merged collection appears at the user’s declared position.
  4. Auth collections with no matching user collection are appended at the end.
  5. User collections with no matching auth collection are added as-is.

— authCollections, userCollections

AuthCollectionConfig[]

— Collections from the auth adapter.

CollectionConfig<{ }, { }, string, string, ComponentHKT>[]

— Collections defined by the user.

CollectionConfig<{ }, { }, string, string, ComponentHKT>[]

Merged collections array for VexConfig.

VexAuthConfigError when users pass a protected collection slug.