Skip to content

Commit

Permalink
Merge branch 'master' into renovate/all
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-bompart committed Sep 15, 2023
2 parents 01502a0 + 71f9c0c commit 210f659
Show file tree
Hide file tree
Showing 64 changed files with 1,463 additions and 80 deletions.
7 changes: 5 additions & 2 deletions packages/headless-react/src/search-engine.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import {getSampleSearchEngineConfiguration} from '@coveo/headless';
import {defineResultList, defineSearchBox} from '@coveo/headless/ssr';
import {
getSampleSearchEngineConfiguration,
defineResultList,
defineSearchBox,
} from '@coveo/headless/ssr';
import {render, renderHook, screen} from '@testing-library/react';
import {PropsWithChildren} from 'react';
import {MissingEngineProviderError, defineSearchEngine} from './search-engine';
Expand Down
4 changes: 3 additions & 1 deletion packages/headless-react/src/search-engine.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {Controller, CoreEngine, SearchEngine} from '@coveo/headless';
import {
Controller,
CoreEngine,
SearchEngine,
ControllerDefinitionsMap,
InferControllerFromDefinition,
SearchEngineDefinitionOptions,
Expand Down
4 changes: 1 addition & 3 deletions packages/headless-react/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import {
CoreEngine,
SearchEngine,
SearchEngineOptions,
} from '@coveo/headless';
import {InferControllerFromDefinition} from '@coveo/headless/dist/definitions/app/ssr-engine/types/common';
import {
ControllerDefinitionsMap,
InferControllerFromDefinition,
InferControllersMapFromDefinition,
InferControllerStaticStateMapFromDefinitions,
EngineDefinition,
Expand Down
8 changes: 4 additions & 4 deletions packages/headless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@
"@microsoft/api-extractor": "7.36.4",
"@microsoft/api-extractor-model": "7.27.6",
"@microsoft/tsdoc": "0.14.2",
"jest-fetch-mock": "3.0.3",
"execa": "8.0.1",
"jest": "29.6.4",
"ts-jest": "29.1.1",
"jest-fetch-mock": "3.0.3",
"pad-stream": "^4.0.0",
"ts-node": "10.9.1",
"execa": "8.0.1"
"ts-jest": "29.1.1",
"ts-node": "10.9.1"
},
"engines": {
"node": ">=12"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {SearchEngine} from '../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../app/ssr-engine/types/common';
import {
BreadcrumbManager,
buildBreadcrumbManager,
} from './headless-breadcrumb-manager';

export * from './headless-breadcrumb-manager';

/**
* @internal
*/
export const defineBreadcrumbManager = (): ControllerDefinitionWithoutProps<
SearchEngine,
BreadcrumbManager
> => ({
build: (engine) => buildBreadcrumbManager(engine),
});
15 changes: 15 additions & 0 deletions packages/headless/src/controllers/context/headless-context.ssr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {SearchEngine} from '../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../app/ssr-engine/types/common';
import {Context, buildContext} from './headless-context';

export * from './headless-context';

/**
* @internal
*/
export const defineContext = (): ControllerDefinitionWithoutProps<
SearchEngine,
Context
> => ({
build: (engine) => buildContext(engine),
});
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 {
DictionaryFieldContext,
buildDictionaryFieldContext,
} from './headless-dictionary-field-context';

export * from './headless-dictionary-field-context';

/**
* @internal
*/
export const defineDictionaryFieldContext =
(): ControllerDefinitionWithoutProps<
SearchEngine,
DictionaryFieldContext
> => ({
build: (engine) => buildDictionaryFieldContext(engine),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {SearchEngine} from '../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../app/ssr-engine/types/common';
import {DidYouMean, buildDidYouMean} from './headless-did-you-mean';

export * from './headless-did-you-mean';

/**
* @internal
*/
export const defineDidYouMean = (): ControllerDefinitionWithoutProps<
SearchEngine,
DidYouMean
> => ({
build: (engine) => buildDidYouMean(engine),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {SearchEngine} from '../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../app/ssr-engine/types/common';
import {FacetManager, buildFacetManager} from './headless-facet-manager';

export * from './headless-facet-manager';

/**
* @internal
*/
export const defineFacetManager = (): ControllerDefinitionWithoutProps<
SearchEngine,
FacetManager
> => ({
build: (engine) => buildFacetManager(engine),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {SearchEngine} from '../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../app/ssr-engine/types/common';
import {
AutomaticFacetGenerator,
AutomaticFacetGeneratorProps,
buildAutomaticFacetGenerator,
} from './headless-automatic-facet-generator';

export * from './headless-automatic-facet-generator';

/**
* @internal
*/
export const defineAutomaticFacetGenerator = (
props: AutomaticFacetGeneratorProps
): ControllerDefinitionWithoutProps<SearchEngine, AutomaticFacetGenerator> => ({
build: (engine) => buildAutomaticFacetGenerator(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {SearchEngine} from '../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../app/ssr-engine/types/common';
import {
AutomaticFacet,
AutomaticFacetProps,
buildAutomaticFacet,
} from './headless-automatic-facet';

export * from './headless-automatic-facet';

/**
* @internal
*/
export const defineAutomaticFacet = (
props: AutomaticFacetProps
): ControllerDefinitionWithoutProps<SearchEngine, AutomaticFacet> => ({
build: (engine) => buildAutomaticFacet(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {SearchEngine} from '../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../app/ssr-engine/types/common';
import {
CategoryFacet,
CategoryFacetProps,
buildCategoryFacet,
} from './headless-category-facet';

export * from './headless-category-facet';

/**
* @internal
*/
export const defineCategoryFacet = (
props: CategoryFacetProps
): ControllerDefinitionWithoutProps<SearchEngine, CategoryFacet> => ({
build: (engine) => buildCategoryFacet(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {SearchEngine} from '../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../app/ssr-engine/types/common';
import {Facet, FacetProps, buildFacet} from './headless-facet';

export * from './headless-facet';

/**
* @internal
*/
export const defineFacet = (
props: FacetProps
): ControllerDefinitionWithoutProps<SearchEngine, Facet> => ({
build: (engine) => buildFacet(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {SearchEngine} from '../../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../../app/ssr-engine/types/common';
import {DateFacet, DateFacetProps, buildDateFacet} from './headless-date-facet';

export * from './headless-date-facet';

export {buildDateRange} from './headless-date-facet';

/**
* @internal
*/
export const defineDateFacet = (
props: DateFacetProps
): ControllerDefinitionWithoutProps<SearchEngine, DateFacet> => ({
build: (engine) => buildDateFacet(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {SearchEngine} from '../../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../../app/ssr-engine/types/common';
import {
DateFilter,
DateFilterProps,
buildDateFilter,
} from './headless-date-filter';

export * from './headless-date-filter';

/**
* @internal
*/
export const defineDateFilter = (
props: DateFilterProps
): ControllerDefinitionWithoutProps<SearchEngine, DateFilter> => ({
build: (engine) => buildDateFilter(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {SearchEngine} from '../../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../../app/ssr-engine/types/common';
import {
NumericFacet,
NumericFacetProps,
buildNumericFacet,
} from './headless-numeric-facet';

export * from './headless-numeric-facet';

export {buildNumericRange} from './headless-numeric-facet';

/**
* @internal
*/
export const defineNumericFacet = (
props: NumericFacetProps
): ControllerDefinitionWithoutProps<SearchEngine, NumericFacet> => ({
build: (engine) => buildNumericFacet(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {SearchEngine} from '../../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../../app/ssr-engine/types/common';
import {
NumericFilter,
NumericFilterProps,
buildNumericFilter,
} from './headless-numeric-filter';

export * from './headless-numeric-filter';

/**
* @internal
*/
export const defineNumericFilter = (
props: NumericFilterProps
): ControllerDefinitionWithoutProps<SearchEngine, NumericFilter> => ({
build: (engine) => buildNumericFilter(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {SearchEngine} from '../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../app/ssr-engine/types/common';
import {
CategoryFieldSuggestions,
CategoryFieldSuggestionsProps,
buildCategoryFieldSuggestions,
} from './headless-category-field-suggestions';

export * from './headless-category-field-suggestions';

/**
* @internal
*/
export const defineCategoryFieldSuggestions = (
props: CategoryFieldSuggestionsProps
): ControllerDefinitionWithoutProps<
SearchEngine,
CategoryFieldSuggestions
> => ({
build: (engine) => buildCategoryFieldSuggestions(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {SearchEngine} from '../../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../../app/ssr-engine/types/common';
import {
FieldSuggestions,
FieldSuggestionsProps,
buildFieldSuggestions,
} from './headless-field-suggestions';

export * from './headless-field-suggestions';

/**
* @internal
*/
export const defineFieldSuggestions = (
props: FieldSuggestionsProps
): ControllerDefinitionWithoutProps<SearchEngine, FieldSuggestions> => ({
build: (engine) => buildFieldSuggestions(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {SearchEngine} from '../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../app/ssr-engine/types/common';
import {
FoldedResultList,
FoldedResultListProps,
buildFoldedResultList,
} from './headless-folded-result-list';

export * from './headless-folded-result-list';

/**
* @internal
*/
export const defineFoldedResultList = (
props?: FoldedResultListProps
): ControllerDefinitionWithoutProps<SearchEngine, FoldedResultList> => ({
build: (engine) => buildFoldedResultList(engine, props),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {SearchEngine} from '../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../app/ssr-engine/types/common';
import {HistoryManager, buildHistoryManager} from './headless-history-manager';

export * from './headless-history-manager';

/**
* @internal
*/
export const defineHistoryManager = (): ControllerDefinitionWithoutProps<
SearchEngine,
HistoryManager
> => ({
build: (engine) => buildHistoryManager(engine),
});
2 changes: 1 addition & 1 deletion packages/headless/src/controllers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export type {
SmartSnippetState,
QuestionAnswerDocumentIdentifier,
SmartSnippetCore,
} from './core/smart-snippet/headless-core-smart-snippet';
} from './smart-snippet/headless-smart-snippet';
export {buildSmartSnippet} from './smart-snippet/headless-smart-snippet';

export type {InlineLink} from './smart-snippet/headless-smart-snippet-interactive-inline-links';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {SearchEngine} from '../../app/search-engine/search-engine';
import {ControllerDefinitionWithoutProps} from '../../app/ssr-engine/types/common';
import {
InstantResultProps,
InstantResults,
buildInstantResults,
} from './instant-results';

export * from './instant-results';

/**
* @internal
*/
export const defineInstantResults = (
props: InstantResultProps
): ControllerDefinitionWithoutProps<SearchEngine, InstantResults> => ({
build: (engine) => buildInstantResults(engine, props),
});
Loading

0 comments on commit 210f659

Please sign in to comment.