Skip to content

Commit

Permalink
Merge branch 'main' into chore/stop-generation
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp authored Apr 25, 2022
2 parents acd1ee9 + aedf57f commit 735d04f
Show file tree
Hide file tree
Showing 46 changed files with 29 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Type of operation.
*/

export type Action =
| 'addObject'
| 'clear'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Whether the pattern parameter must match the beginning or the end of the query string, or both, or none.
*/

export type Anchoring = 'contains' | 'endsWith' | 'is' | 'startsWith';
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import type { AroundRadiusAll } from './aroundRadiusAll';

/**
* Define the maximum radius for a geo search (in meters).
*/
export type AroundRadius = AroundRadiusAll | number;
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* The operation to apply on the attribute.
*/

export type BuiltInOperationType =
| 'Add'
| 'AddUnique'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Actions to perform.
*/

export type DictionaryAction = 'addEntry' | 'deleteEntry';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* The state of the dictionary entry.
*/

export type DictionaryEntryState = 'disabled' | 'enabled';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Controls how the exact ranking criterion is computed when the query contains only one word.
*/

export type ExactOnSingleWordQuery = 'attribute' | 'none' | 'word';
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { BaseIndexSettings } from './baseIndexSettings';
import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams';

/**
* The Algolia index settings.
*/
export type IndexSettings = BaseIndexSettings & IndexSettingsAsSearchParams;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Indicates how well the attribute matched the search query.
*/

export type MatchLevel = 'full' | 'none' | 'partial';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Perform a search query with `default`, will search for facet values if `facet` is given.
*/

export type MultipleQueriesType = 'default' | 'facet';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Type of operation to perform (move or copy).
*/

export type OperationType = 'copy' | 'move';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Controls if and how query words are interpreted as prefixes.
*/

export type QueryType = 'prefixAll' | 'prefixLast' | 'prefixNone';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Selects a strategy to remove words from the query when it doesn\'t match any hits.
*/

export type RemoveWordsIfNoResults =
| 'allOptional'
| 'firstWords'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Type of the synonym object.
*/

export type SynonymType =
| 'altcorrection1'
| 'altcorrection2'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Controls whether typo tolerance is enabled and how it is applied.
*/

export type TypoTolerance = 'false' | 'min' | 'strict' | 'true';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* An eventType can be a click, a conversion, or a view.
*/

export type EventType = 'click' | 'conversion' | 'view';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Type of the record, can be one of three values (INFO, SKIP or ERROR).
*/

export type LogLevel = 'ERROR' | 'INFO' | 'SKIP';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Type of operation.
*/

export type Action =
| 'addObject'
| 'clear'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Whether the pattern parameter must match the beginning or the end of the query string, or both, or none.
*/

export type Anchoring = 'contains' | 'endsWith' | 'is' | 'startsWith';
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import type { AroundRadiusAll } from './aroundRadiusAll';

/**
* Define the maximum radius for a geo search (in meters).
*/
export type AroundRadius = AroundRadiusAll | number;
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* The operation to apply on the attribute.
*/

export type BuiltInOperationType =
| 'Add'
| 'AddUnique'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Actions to perform.
*/

export type DictionaryAction = 'addEntry' | 'deleteEntry';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* The state of the dictionary entry.
*/

export type DictionaryEntryState = 'disabled' | 'enabled';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Controls how the exact ranking criterion is computed when the query contains only one word.
*/

export type ExactOnSingleWordQuery = 'attribute' | 'none' | 'word';
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import type { BaseIndexSettings } from './baseIndexSettings';
import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams';

/**
* The Algolia index settings.
*/
export type IndexSettings = BaseIndexSettings & IndexSettingsAsSearchParams;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Indicates how well the attribute matched the search query.
*/

export type MatchLevel = 'full' | 'none' | 'partial';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Perform a search query with `default`, will search for facet values if `facet` is given.
*/

export type MultipleQueriesType = 'default' | 'facet';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Type of operation to perform (move or copy).
*/

export type OperationType = 'copy' | 'move';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Controls if and how query words are interpreted as prefixes.
*/

export type QueryType = 'prefixAll' | 'prefixLast' | 'prefixNone';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Selects a strategy to remove words from the query when it doesn\'t match any hits.
*/

export type RemoveWordsIfNoResults =
| 'allOptional'
| 'firstWords'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Type of the synonym object.
*/

export type SynonymType =
| 'altcorrection1'
| 'altcorrection2'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Controls whether typo tolerance is enabled and how it is applied.
*/

export type TypoTolerance = 'false' | 'min' | 'strict' | 'true';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* The type of authentication to use.
*/

export type AuthenticationType = 'basic';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* The HTTP method that will be used to fetch the URL.
*/

export type Method = 'GET' | 'POST';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* The type of operation to execute.
*/

export type OperationType = 'replace';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* The product to target.
*/

export type ProductType = 'search';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* The type of the task executed.
*/

export type TaskType = 'csv';
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import type { AroundRadiusAll } from './aroundRadiusAll';

/**
* Define the maximum radius for a geo search (in meters).
*/
export type AroundRadius = AroundRadiusAll | number;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Controls how the exact ranking criterion is computed when the query contains only one word.
*/

export type ExactOnSingleWordQuery = 'attribute' | 'none' | 'word';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Indicates how well the attribute matched the search query.
*/

export type MatchLevel = 'full' | 'none' | 'partial';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Controls if and how query words are interpreted as prefixes.
*/

export type QueryType = 'prefixAll' | 'prefixLast' | 'prefixNone';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* The recommendation model to use.
*/

export type RecommendationModels = 'bought-together' | 'related-products';
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Selects a strategy to remove words from the query when it doesn\'t match any hits.
*/

export type RemoveWordsIfNoResults =
| 'allOptional'
| 'firstWords'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* The trending model to use.
*/

export type TrendingModels = 'trending-facets' | 'trending-items';
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/**
* Controls whether typo tolerance is enabled and how it is applied.
*/

export type TypoTolerance = 'false' | 'min' | 'strict' | 'true';
46 changes: 14 additions & 32 deletions templates/javascript/model.mustache
Original file line number Diff line number Diff line change
@@ -1,47 +1,29 @@
{{#models}}
{{#model}}
{{#models}}{{#model}}
{{#tsImports}}
import { {{classname}} } from '{{filename}}';
{{/tsImports}}

{{! We handle types that depend on other interfaces }}
{{#interfaces.size}}
export type {{classname}} = {{#oneOf}}{{.}} {{^-last}}|{{/-last}} {{/oneOf}}{{#allOf}}{{.}} {{^-last}}&{{/-last}} {{/allOf}};
{{/interfaces.size}}

{{^interfaces}}
{{#description}}
/**
* {{{description}}}
*/
{{/description}}
{{^isEnum}}
export type {{classname}} = {{#parent}} {{{.}}} & {{/parent}} {
{{#vars}}
*/{{/description}}
export type {{classname}} = {{#oneOf}}{{{.}}} {{^-last}}|{{/-last}} {{/oneOf}}{{#allOf}}{{{.}}} {{^-last}}&{{/-last}} {{/allOf}};
{{/interfaces.size}}{{^interfaces.size}}
{{#description}}
/**
* {{{description}}}
*/{{/description}}{{^isEnum}}
export type {{classname}} = {{#parent}} {{{.}}} & {{/parent}} {
{{#vars}}{{#description}}
/**
* {{{description}}}
*/
{{/description}}
{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{classname}}{{{nameInCamelCase}}}{{#isArray}}[]{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};
{{/vars}}
*/{{/description}}
{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{classname}}{{{nameInCamelCase}}}{{#isArray}}[]{{/isArray}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{#isNullable}} | null{{/isNullable}}{{/isEnum}};{{/vars}}
}

{{#hasEnums}}
{{#vars}}
{{#isEnum}}
export type {{classname}}{{nameInCamelCase}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}|{{/-last}}{{/enumVars}}{{/allowableValues}}

{{/isEnum}}
{{/vars}}
{{/hasEnums}}
{{/isEnum}}

{{#isEnum}}
export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}|{{/-last}}{{/enumVars}}{{/allowableValues}}

{{/isEnum}}
{{#hasEnums}}{{#vars}}{{#isEnum}}export type {{classname}}{{nameInCamelCase}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}|{{/-last}}{{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}}{{/hasEnums}}
{{#isEnum}}export type {{classname}} = {{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}|{{/-last}}{{/enumVars}}{{/allowableValues}}{{/isEnum}}

{{/interfaces}}
{{/model}}
{{/models}}
{{/interfaces.size}}{{/model}}{{/models}}

0 comments on commit 735d04f

Please sign in to comment.