Skip to content

Commit

Permalink
style(headless): moved ssr files next to their csr counterparts (#3150)
Browse files Browse the repository at this point in the history
  • Loading branch information
btaillon-coveo authored Sep 8, 2023
1 parent 4d3c39d commit 8f1490b
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 74 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {buildResultList} from '../../controllers';
import {getSampleSearchEngineConfiguration} from '../search-engine/search-engine';
import {defineSearchEngine} from './ssr-engine';
import {SearchEngineDefinition} from './types/search-engine';
import {getSampleSearchEngineConfiguration} from './search-engine';
import {SearchEngineDefinition, defineSearchEngine} from './search-engine.ssr';

describe('SSR', () => {
describe('define search engine', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,38 @@
import {Middleware} from '@reduxjs/toolkit';
import {Controller} from '../../controllers';
import {mapObject} from '../../utils/utils';
import {
SearchEngine,
SearchEngineOptions,
buildSearchEngine,
} from '../search-engine/search-engine';
import {EngineDefinitionBuildOptionsWithProps} from './types/build';
import {EngineDefinitionBuildOptionsWithProps} from '../ssr-engine/types/build';
import {
ControllerDefinitionsMap,
ControllersMap,
EngineSSRState,
InferControllerSSRStateMapFromDefinitions,
InferControllersMapFromDefinition,
OptionsExtender,
} from './types/common';
} from '../ssr-engine/types/common';
import {
SearchEngineDefinition,
SearchEngineDefinitionOptions,
} from './types/search-engine';
EngineDefinition,
EngineDefinitionOptions,
} from '../ssr-engine/types/core-engine';
import {
SearchEngine,
SearchEngineOptions,
buildSearchEngine,
} from './search-engine';

/**
* @internal
*/
export type SearchEngineDefinition<
TControllers extends ControllerDefinitionsMap<SearchEngine, Controller>
> = EngineDefinition<SearchEngine, TControllers, SearchEngineOptions>;

/**
* @internal
*/
export type SearchEngineDefinitionOptions<
TControllers extends ControllerDefinitionsMap<SearchEngine, Controller>
> = EngineDefinitionOptions<SearchEngineOptions, TControllers>;

/**
* @internal
Expand Down
18 changes: 0 additions & 18 deletions packages/headless/src/app/ssr-engine/types/search-engine.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {SearchEngine} from '../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../app/ssr-engine/types/common';
import {SearchEngine} from '../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../app/ssr-engine/types/common';
import {
ResultList,
ResultListProps,
buildResultList,
} from '../../result-list/headless-result-list';
} from './headless-result-list';

export type {
ResultListOptions,
ResultListProps,
ResultListState,
ResultList,
} from '../../result-list/headless-result-list';
} from './headless-result-list';

/**
* @internal
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {SearchEngine} from '../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../app/ssr-engine/types/common';
import {SearchBox, SearchBoxProps, buildSearchBox} from './headless-search-box';

export type {
SearchBoxOptions,
SearchBoxProps,
SearchBoxState,
SearchBox,
} from './headless-search-box';

/**
* @internal
*/
export const defineSearchBox = (
props?: SearchBoxProps
): ControllerDefinitionWithoutProps<SearchEngine, SearchBox> => ({
build: (engine) => buildSearchBox(engine, props),
});
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {SearchEngine} from '../../../app/search-engine/search-engine';
import {ControllerDefinitionWithProps} from '../../../app/ssr-engine/types/common';
import {SearchEngine} from '../../app/search-engine/search-engine';
import {ControllerDefinitionWithProps} from '../../app/ssr-engine/types/common';
import {
SearchParameterManager,
SearchParameterManagerInitialState,
buildSearchParameterManager,
} from '../../search-parameter-manager/headless-search-parameter-manager';
} from './headless-search-parameter-manager';

export type {
SearchParameterManagerInitialState,
SearchParameterManagerState,
SearchParameterManager,
} from '../../search-parameter-manager/headless-search-parameter-manager';
} from './headless-search-parameter-manager';

/**
* @internal
Expand Down

This file was deleted.

23 changes: 12 additions & 11 deletions packages/headless/src/ssr.index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,37 @@ export type {
InferControllerSSRStateMapFromDefinitions,
} from './app/ssr-engine/types/common';

export type {SearchEngineDefinitionOptions} from './app/ssr-engine/types/search-engine';

export type {
EngineDefinition,
InferSSRState,
InferCSRState,
} from './app/ssr-engine/types/core-engine';

export type {
SearchEngineDefinition,
SearchEngineDefinitionOptions,
} from './app/search-engine/search-engine.ssr';
export {defineSearchEngine} from './app/search-engine/search-engine.ssr';

export type {
SearchBox,
SearchBoxOptions,
SearchBoxProps,
SearchBoxState,
} from './controllers/ssr/search-box/headless-ssr-search-box';
export {defineSearchBox} from './controllers/ssr/search-box/headless-ssr-search-box';

} from './controllers/search-box/headless-search-box.ssr';
export {defineSearchBox} from './controllers/search-box/headless-search-box.ssr';
export type {
ResultList,
ResultListOptions,
ResultListProps,
ResultListState,
} from './controllers/ssr/result-list/headless-ssr-result-list';
export {defineResultList} from './controllers/ssr/result-list/headless-ssr-result-list';
} from './controllers/result-list/headless-result-list.ssr';
export {defineResultList} from './controllers/result-list/headless-result-list.ssr';

export type {
SearchParameterManager,
SearchParameterManagerInitialState,
SearchParameterManagerBuildProps,
SearchParameterManagerState,
} from './controllers/ssr/search-parameter-manager/headless-ssr-search-parameter-manager';
export {defineSearchParameterManager} from './controllers/ssr/search-parameter-manager/headless-ssr-search-parameter-manager';

export {defineSearchEngine} from './app/ssr-engine/ssr-engine';
} from './controllers/search-parameter-manager/headless-search-parameter-manager.ssr';
export {defineSearchParameterManager} from './controllers/search-parameter-manager/headless-search-parameter-manager.ssr';
7 changes: 6 additions & 1 deletion packages/samples/headless-ssr/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"extends": "next/core-web-vitals",
"root": true
"root": true,
"settings": {
"next": {
"rootDir": "packages/samples/headless-ssr"
}
}
}

0 comments on commit 8f1490b

Please sign in to comment.