diff --git a/packages/gatsby/src/redux/actions/__tests__/restricted.js b/packages/gatsby/src/redux/actions/__tests__/restricted.js index b4be6ebb6dc19..fff7ccc78c205 100644 --- a/packages/gatsby/src/redux/actions/__tests__/restricted.js +++ b/packages/gatsby/src/redux/actions/__tests__/restricted.js @@ -14,7 +14,7 @@ const dispatchWithThunk = actionOrThunk => describe(`Restricted actions`, () => { it(`handles actions allowed in API`, () => { const action = dispatchWithThunk( - availableActionsByAPI.sourceNodes.createTypes() + availableActionsByAPI.createSchemaCustomization.createTypes() ) expect(action).toEqual({ type: `CREATE_TYPES` }) expect(report.warn).not.toHaveBeenCalled() @@ -22,12 +22,17 @@ describe(`Restricted actions`, () => { }) it(`handles actions deprecated in API`, () => { - const action = dispatchWithThunk( + let action = dispatchWithThunk( availableActionsByAPI.onPreBootstrap.createTypes() ) expect(action).toEqual({ type: `CREATE_TYPES` }) expect(report.warn).toHaveBeenCalled() expect(report.error).not.toHaveBeenCalled() + + action = dispatchWithThunk(availableActionsByAPI.sourceNodes.createTypes()) + expect(action).toEqual({ type: `CREATE_TYPES` }) + expect(report.warn).toHaveBeenCalled() + expect(report.error).not.toHaveBeenCalled() }) it(`handles actions forbidden in API`, () => { diff --git a/packages/gatsby/src/redux/actions/restricted.ts b/packages/gatsby/src/redux/actions/restricted.ts index 533498cd42256..4c01c88586dae 100644 --- a/packages/gatsby/src/redux/actions/restricted.ts +++ b/packages/gatsby/src/redux/actions/restricted.ts @@ -522,18 +522,19 @@ const mapAvailableActionsToAPIs = ( export const availableActionsByAPI = mapAvailableActionsToAPIs({ createFieldExtension: { - [ALLOWED_IN]: [`sourceNodes`, `createSchemaCustomization`], + [ALLOWED_IN]: [`createSchemaCustomization`], + [DEPRECATED_IN]: [`sourceNodes`], }, createTypes: { - [ALLOWED_IN]: [`sourceNodes`, `createSchemaCustomization`], - [DEPRECATED_IN]: [`onPreInit`, `onPreBootstrap`], + [ALLOWED_IN]: [`createSchemaCustomization`], + [DEPRECATED_IN]: [`onPreInit`, `onPreBootstrap`, `sourceNodes`], }, createResolverContext: { [ALLOWED_IN]: [`createSchemaCustomization`], }, addThirdPartySchema: { - [ALLOWED_IN]: [`sourceNodes`, `createSchemaCustomization`], - [DEPRECATED_IN]: [`onPreInit`, `onPreBootstrap`], + [ALLOWED_IN]: [`createSchemaCustomization`], + [DEPRECATED_IN]: [`onPreInit`, `onPreBootstrap`, `sourceNodes`], }, printTypeDefinitions: { [ALLOWED_IN]: [`createSchemaCustomization`],