[algoliasearch] change module format (#37284)

* [algoliasearch] change module format

TBH I'm not really sure what the difference is, but this doesn't break any tests on my repositories. It was needed to work with `/// reference` imports (cc @samuelbodin)

I also had to remove the Omit type for some reason to rely on the builtin one, I guess that's not too big of a deal?

* update algoliasearch-helper too

* more updates 🙈

* modern module format & revert TS version changes

* Update types/react-instantsearch/index.d.ts
This commit is contained in:
Haroen Viaene 2019-08-06 17:52:38 +02:00 committed by Nathan Shively-Sanders
parent 7590b34f8f
commit 43a6d3c3c9
3 changed files with 29 additions and 18 deletions

View File

@ -9,8 +9,9 @@ import {
Response,
IndexSettings,
QueryParameters,
Client
Client,
} from 'algoliasearch';
import * as algoliasearchLite from 'algoliasearch/lite';
let _algoliaResponse: Response = {
hits: [{}, {}],
@ -141,14 +142,14 @@ let _algoliaQueryParameters: QueryParameters = {
removeStopWords: [''],
disableExactOnAttributes: [''],
exactOnSingleWordQuery: 'attribute',
alternativesAsExact: ["ignorePlurals"],
alternativesAsExact: ['ignorePlurals'],
distinct: 0,
getRankingInfo: false,
numericAttributesToIndex: [''],
numericAttributesForFiltering: [''],
numericFilters: [''],
tagFilters: [''],
facetFilters: ['',['']],
facetFilters: ['', ['']],
analytics: false,
clickAnalytics: true,
analyticsTags: [''],
@ -177,14 +178,14 @@ index.partialUpdateObjects([{}], false, () => {});
index.partialUpdateObjects([{}]).then(() => {});
index.partialUpdateObjects([{}], false).then(() => {});
let indexName : string = index.indexName;
let indexName: string = index.indexName;
// complete copy
client.copyIndex('from', 'to').then(()=>{});
client.copyIndex('from', 'to', ()=> {});
client.copyIndex('from', 'to').then(() => {});
client.copyIndex('from', 'to', () => {});
// with scope
client.copyIndex('from', 'to', ['settings']).then(()=>{});
client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {});
client.copyIndex('from', 'to', ['settings']).then(() => {});
client.copyIndex('from', 'to', ['synonyms', 'rules'], () => {});
// Browsing
const browser = index.browseAll();
@ -200,7 +201,7 @@ browser.on('result', function onResult(content) {
});
browser.on('end', function onEnd() {
const _message = `We got ${hits.length} hits`
const _message = `We got ${hits.length} hits`;
});
browser.on('error', function onError(err) {
@ -209,14 +210,23 @@ browser.on('error', function onError(err) {
browser.stop();
index.setSettings({ hitsPerPage: 10 }, () => {})
index.setSettings({ hitsPerPage: 10 }, { forwardToReplicas: true }, () => {})
index.setSettings({ hitsPerPage: 10 }).then(() => {})
index.setSettings({ hitsPerPage: 10 }, { forwardToReplicas: true }).then(() => {})
index.setSettings({ hitsPerPage: 10 }, () => {});
index.setSettings({ hitsPerPage: 10 }, { forwardToReplicas: true }, () => {});
index.setSettings({ hitsPerPage: 10 }).then(() => {});
index
.setSettings({ hitsPerPage: 10 }, { forwardToReplicas: true })
.then(() => {});
index.browse("", {
index.browse('', {
advancedSyntax: false,
attributesToRetrieve: ['dogs']
attributesToRetrieve: ['dogs'],
});
client.copyIndex('from', 'to', ['settings']).then(()=>{});
client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {});
client.copyIndex('from', 'to', ['settings']).then(() => {});
client.copyIndex('from', 'to', ['synonyms', 'rules'], () => {});
const liteClient: algoliasearchLite.Client = algoliasearchLite('', '');
liteClient.search([], (err: Error, res: algoliasearch.MultiResponse) => {});
liteClient.search([]).then((res: algoliasearch.MultiResponse) => {});
type Res = { zipzop: true };
liteClient.search<Res>([]).then((res: algoliasearch.MultiResponse<Res>) => {});

View File

@ -2100,3 +2100,4 @@ interface AlgoliaStatic extends AlgoliasearchInstance {
declare const algoliasearch: AlgoliaStatic;
export = algoliasearch;
export as namespace algoliasearch;

View File

@ -18,7 +18,7 @@ import {
Response,
BrowseParameters,
BrowseResponse
} from '../index';
} from 'algoliasearch';
declare namespace algoliasearch {
/**