Files
payloadcms/test/fields-relationship/payload-types.ts
Jacob Fletcher 694c76d51a test: cleans up fields-relationship test suite (#11003)
The `fields-relationship` test suite is disorganized to the point of
being unusable. This makes it very difficult to digest at a high level
and add new tests.

This PR cleans it up in the following ways:

- Moves collection configs to their own standalone files
- Moves the seed function to its own file
- Consolidates collection slugs in their own file
- Uses generated types instead of defining them statically
- Wraps the `filterOptions` e2e tests within a describe block

Related, there are three distinct test suites where we manage
relationships: `relationships`, `fields-relationship`, and `fields >
relationships`. In the future we ought to consolidate at least two of
these. IMO the `fields > relationship` suite should remain in place for
general _component level_ UI tests for the field itself, whereas the
other suite could run the integration tests and test the more complex UI
patterns that exist outside of the field component.
2025-02-05 17:03:35 -05:00

648 lines
17 KiB
TypeScript

/* tslint:disable */
/* eslint-disable */
/**
* This file was automatically generated by Payload.
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
* and re-run `payload generate:types` to regenerate this file.
*/
export interface Config {
auth: {
users: UserAuthOperations;
};
collections: {
'fields-relationship': FieldsRelationship;
'relation-filter-false': RelationFilterFalse;
'relation-filter-true': RelationFilterTrue;
'relation-one': RelationOne;
'relation-two': RelationTwo;
'relation-restricted': RelationRestricted;
'relation-with-title': RelationWithTitle;
'relation-updated-externally': RelationUpdatedExternally;
'collection-1': Collection1;
'collection-2': Collection2;
videos: Video;
podcasts: Podcast;
'mixed-media': MixedMedia;
'versioned-relationship-field': VersionedRelationshipField;
users: User;
'payload-locked-documents': PayloadLockedDocument;
'payload-preferences': PayloadPreference;
'payload-migrations': PayloadMigration;
};
collectionsJoins: {};
collectionsSelect: {
'fields-relationship': FieldsRelationshipSelect<false> | FieldsRelationshipSelect<true>;
'relation-filter-false': RelationFilterFalseSelect<false> | RelationFilterFalseSelect<true>;
'relation-filter-true': RelationFilterTrueSelect<false> | RelationFilterTrueSelect<true>;
'relation-one': RelationOneSelect<false> | RelationOneSelect<true>;
'relation-two': RelationTwoSelect<false> | RelationTwoSelect<true>;
'relation-restricted': RelationRestrictedSelect<false> | RelationRestrictedSelect<true>;
'relation-with-title': RelationWithTitleSelect<false> | RelationWithTitleSelect<true>;
'relation-updated-externally': RelationUpdatedExternallySelect<false> | RelationUpdatedExternallySelect<true>;
'collection-1': Collection1Select<false> | Collection1Select<true>;
'collection-2': Collection2Select<false> | Collection2Select<true>;
videos: VideosSelect<false> | VideosSelect<true>;
podcasts: PodcastsSelect<false> | PodcastsSelect<true>;
'mixed-media': MixedMediaSelect<false> | MixedMediaSelect<true>;
'versioned-relationship-field': VersionedRelationshipFieldSelect<false> | VersionedRelationshipFieldSelect<true>;
users: UsersSelect<false> | UsersSelect<true>;
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
};
db: {
defaultIDType: string;
};
globals: {};
globalsSelect: {};
locale: 'en';
user: User & {
collection: 'users';
};
jobs: {
tasks: unknown;
workflows: unknown;
};
}
export interface UserAuthOperations {
forgotPassword: {
email: string;
password: string;
};
login: {
email: string;
password: string;
};
registerFirstUser: {
email: string;
password: string;
};
unlock: {
email: string;
password: string;
};
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "fields-relationship".
*/
export interface FieldsRelationship {
id: string;
relationship?: (string | null) | RelationOne;
relationshipHasMany?: (string | RelationOne)[] | null;
relationshipMultiple?:
| ({
relationTo: 'relation-one';
value: string | RelationOne;
} | null)
| ({
relationTo: 'relation-two';
value: string | RelationTwo;
} | null);
relationshipHasManyMultiple?:
| (
| {
relationTo: 'relation-one';
value: string | RelationOne;
}
| {
relationTo: 'relation-two';
value: string | RelationTwo;
}
)[]
| null;
relationshipRestricted?: (string | null) | RelationRestricted;
relationshipWithTitle?: (string | null) | RelationWithTitle;
/**
* This will filter the relationship options based on id, which is the same as the relationship field in this document
*/
relationshipFilteredByID?: (string | null) | RelationOne;
/**
* This will filter the relationship options if the filter field in this document is set to "Include me"
*/
relationshipFilteredByField?: (string | null) | RelationOne;
relationshipFilteredAsync?: (string | null) | RelationOne;
relationshipManyFiltered?:
| (
| {
relationTo: 'relation-with-title';
value: string | RelationWithTitle;
}
| {
relationTo: 'relation-filter-false';
value: string | RelationFilterFalse;
}
| {
relationTo: 'relation-filter-true';
value: string | RelationFilterTrue;
}
| {
relationTo: 'relation-one';
value: string | RelationOne;
}
)[]
| null;
filter?: string | null;
relationshipReadOnly?: (string | null) | RelationOne;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-one".
*/
export interface RelationOne {
id: string;
name?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-two".
*/
export interface RelationTwo {
id: string;
name?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-restricted".
*/
export interface RelationRestricted {
id: string;
name?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-with-title".
*/
export interface RelationWithTitle {
id: string;
name?: string | null;
meta?: {
title?: string | null;
};
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-filter-false".
*/
export interface RelationFilterFalse {
id: string;
name?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-filter-true".
*/
export interface RelationFilterTrue {
id: string;
name?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-updated-externally".
*/
export interface RelationUpdatedExternally {
id: string;
relationPrePopulate?: (string | null) | Collection1;
relationHasMany?: (string | Collection1)[] | null;
relationToManyHasMany?:
| (
| {
relationTo: 'collection-1';
value: string | Collection1;
}
| {
relationTo: 'collection-2';
value: string | Collection2;
}
)[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "collection-1".
*/
export interface Collection1 {
id: string;
name?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "collection-2".
*/
export interface Collection2 {
id: string;
name?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "videos".
*/
export interface Video {
id: number;
title?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "podcasts".
*/
export interface Podcast {
id: number;
title?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "mixed-media".
*/
export interface MixedMedia {
id: string;
relatedMedia?:
| (
| {
relationTo: 'videos';
value: number | Video;
}
| {
relationTo: 'podcasts';
value: number | Podcast;
}
)[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "versioned-relationship-field".
*/
export interface VersionedRelationshipField {
id: string;
title: string;
relationshipField?:
| {
relationTo: 'collection-1';
value: string | Collection1;
}[]
| null;
updatedAt: string;
createdAt: string;
_status?: ('draft' | 'published') | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users".
*/
export interface User {
id: string;
updatedAt: string;
createdAt: string;
email: string;
resetPasswordToken?: string | null;
resetPasswordExpiration?: string | null;
salt?: string | null;
hash?: string | null;
loginAttempts?: number | null;
lockUntil?: string | null;
password?: string | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-locked-documents".
*/
export interface PayloadLockedDocument {
id: string;
document?:
| ({
relationTo: 'fields-relationship';
value: string | FieldsRelationship;
} | null)
| ({
relationTo: 'relation-filter-false';
value: string | RelationFilterFalse;
} | null)
| ({
relationTo: 'relation-filter-true';
value: string | RelationFilterTrue;
} | null)
| ({
relationTo: 'relation-one';
value: string | RelationOne;
} | null)
| ({
relationTo: 'relation-two';
value: string | RelationTwo;
} | null)
| ({
relationTo: 'relation-restricted';
value: string | RelationRestricted;
} | null)
| ({
relationTo: 'relation-with-title';
value: string | RelationWithTitle;
} | null)
| ({
relationTo: 'relation-updated-externally';
value: string | RelationUpdatedExternally;
} | null)
| ({
relationTo: 'collection-1';
value: string | Collection1;
} | null)
| ({
relationTo: 'collection-2';
value: string | Collection2;
} | null)
| ({
relationTo: 'videos';
value: number | Video;
} | null)
| ({
relationTo: 'podcasts';
value: number | Podcast;
} | null)
| ({
relationTo: 'mixed-media';
value: string | MixedMedia;
} | null)
| ({
relationTo: 'versioned-relationship-field';
value: string | VersionedRelationshipField;
} | null)
| ({
relationTo: 'users';
value: string | User;
} | null);
globalSlug?: string | null;
user: {
relationTo: 'users';
value: string | User;
};
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-preferences".
*/
export interface PayloadPreference {
id: string;
user: {
relationTo: 'users';
value: string | User;
};
key?: string | null;
value?:
| {
[k: string]: unknown;
}
| unknown[]
| string
| number
| boolean
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-migrations".
*/
export interface PayloadMigration {
id: string;
name?: string | null;
batch?: number | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "fields-relationship_select".
*/
export interface FieldsRelationshipSelect<T extends boolean = true> {
relationship?: T;
relationshipHasMany?: T;
relationshipMultiple?: T;
relationshipHasManyMultiple?: T;
relationshipRestricted?: T;
relationshipWithTitle?: T;
relationshipFilteredByID?: T;
relationshipFilteredByField?: T;
relationshipFilteredAsync?: T;
relationshipManyFiltered?: T;
filter?: T;
relationshipReadOnly?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-filter-false_select".
*/
export interface RelationFilterFalseSelect<T extends boolean = true> {
name?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-filter-true_select".
*/
export interface RelationFilterTrueSelect<T extends boolean = true> {
name?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-one_select".
*/
export interface RelationOneSelect<T extends boolean = true> {
name?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-two_select".
*/
export interface RelationTwoSelect<T extends boolean = true> {
name?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-restricted_select".
*/
export interface RelationRestrictedSelect<T extends boolean = true> {
name?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-with-title_select".
*/
export interface RelationWithTitleSelect<T extends boolean = true> {
name?: T;
meta?:
| T
| {
title?: T;
};
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relation-updated-externally_select".
*/
export interface RelationUpdatedExternallySelect<T extends boolean = true> {
relationPrePopulate?: T;
relationHasMany?: T;
relationToManyHasMany?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "collection-1_select".
*/
export interface Collection1Select<T extends boolean = true> {
name?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "collection-2_select".
*/
export interface Collection2Select<T extends boolean = true> {
name?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "videos_select".
*/
export interface VideosSelect<T extends boolean = true> {
id?: T;
title?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "podcasts_select".
*/
export interface PodcastsSelect<T extends boolean = true> {
id?: T;
title?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "mixed-media_select".
*/
export interface MixedMediaSelect<T extends boolean = true> {
relatedMedia?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "versioned-relationship-field_select".
*/
export interface VersionedRelationshipFieldSelect<T extends boolean = true> {
title?: T;
relationshipField?: T;
updatedAt?: T;
createdAt?: T;
_status?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users_select".
*/
export interface UsersSelect<T extends boolean = true> {
updatedAt?: T;
createdAt?: T;
email?: T;
resetPasswordToken?: T;
resetPasswordExpiration?: T;
salt?: T;
hash?: T;
loginAttempts?: T;
lockUntil?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-locked-documents_select".
*/
export interface PayloadLockedDocumentsSelect<T extends boolean = true> {
document?: T;
globalSlug?: T;
user?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-preferences_select".
*/
export interface PayloadPreferencesSelect<T extends boolean = true> {
user?: T;
key?: T;
value?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-migrations_select".
*/
export interface PayloadMigrationsSelect<T extends boolean = true> {
name?: T;
batch?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "auth".
*/
export interface Auth {
[k: string]: unknown;
}
declare module 'payload' {
// @ts-ignore
export interface GeneratedTypes extends Config {}
}