diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ff340de2fa..406968ff14 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,6 +37,9 @@ jobs: - name: Integraion Tests run: yarn test:int + - name: Generate Payload Types + run: yarn dev:generate-types fields + # - name: Install Playwright Browsers # run: npx playwright install --with-deps # - name: E2E Tests diff --git a/package.json b/package.json index 84bc7f7673..39e5a4b6b3 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "build": "yarn copyfiles && yarn build:tsc && yarn build:components", "build:watch": "nodemon --watch 'src/**' --ext 'ts,tsx' --exec 'yarn build:tsc'", "dev": "nodemon", - "dev:generatetypes": "node ./test/generateTypes.js", + "dev:generate-types": "node ./test/generateTypes.js", "pretest": "yarn build", "test": "yarn test:int && yarn test:components", "test:int": "cross-env NODE_ENV=test DISABLE_LOGGING=true jest --forceExit --detectOpenHandles", diff --git a/test/access-control/payload-types.ts b/test/access-control/payload-types.ts index 545c3ef3f1..95c8bba8ed 100644 --- a/test/access-control/payload-types.ts +++ b/test/access-control/payload-types.ts @@ -8,10 +8,40 @@ export interface Config {} /** * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "slugname". + * via the `definition` "access-controls". */ -export interface Slugname { +export interface AccessControl { id: string; + restrictedField?: string; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "restricted". + */ +export interface Restricted { + id: string; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "read-only-collection". + */ +export interface ReadOnlyCollection { + id: string; + name?: string; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "restricted-versions". + */ +export interface RestrictedVersion { + id: string; + name?: string; createdAt: string; updatedAt: string; } diff --git a/test/fields/payload-types.ts b/test/fields/payload-types.ts index 4b96e25ed5..d13e5e8a23 100644 --- a/test/fields/payload-types.ts +++ b/test/fields/payload-types.ts @@ -68,6 +68,65 @@ export interface BlockField { export interface CollapsibleField { id: string; text: string; + group?: { + textWithinGroup?: string; + subGroup?: { + textWithinSubGroup?: string; + }; + }; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "conditional-logic". + */ +export interface ConditionalLogic { + id: string; + text: string; + toggleField?: boolean; + fieldToToggle: string; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "group-fields". + */ +export interface GroupField { + id: string; + group?: { + text: string; + subGroup?: { + textWithinGroup?: string; + }; + }; + createdAt: string; + updatedAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "point-fields". + */ +export interface PointField { + id: string; + /** + * @minItems 2 + * @maxItems 2 + */ + point: [number, number]; + /** + * @minItems 2 + * @maxItems 2 + */ + localized?: [number, number]; + group?: { + /** + * @minItems 2 + * @maxItems 2 + */ + point?: [number, number]; + }; createdAt: string; updatedAt: string; } @@ -77,6 +136,7 @@ export interface CollapsibleField { */ export interface RichTextField { id: string; + selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[]; richText: { [k: string]: unknown; }[]; @@ -104,8 +164,44 @@ export interface TabsField { text: string; id?: string; }[]; - text: string; - number: number; + blocks: ( + | { + text: string; + id?: string; + blockName?: string; + blockType: 'text'; + } + | { + number: number; + id?: string; + blockName?: string; + blockType: 'number'; + } + | { + subBlocks?: ( + | { + text: string; + id?: string; + blockName?: string; + blockType: 'text'; + } + | { + number: number; + id?: string; + blockName?: string; + blockType: 'number'; + } + )[]; + id?: string; + blockName?: string; + blockType: 'subBlocks'; + } + )[]; + group?: { + number: number; + }; + textarea?: string; + anotherText: string; createdAt: string; updatedAt: string; } @@ -119,6 +215,20 @@ export interface TextField { createdAt: string; updatedAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "uploads". + */ +export interface Upload { + id: string; + url?: string; + filename?: string; + mimeType?: string; + filesize?: number; + text?: string; + createdAt: string; + updatedAt: string; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "users".