From f83d719f9cf458bced2c499f7e7ffc4c9680c986 Mon Sep 17 00:00:00 2001 From: Yannick Croissant Date: Mon, 16 Mar 2020 16:08:00 +0100 Subject: [PATCH 1/2] fix(types): check for missing type exports at build time --- api-extractor.json | 4 ++++ scripts/build.js | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/api-extractor.json b/api-extractor.json index 2fdfcbc4c..efec6ab10 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -32,6 +32,10 @@ "ae-missing-release-tag": { "logLevel": "none" + }, + + "ae-forgotten-export": { + "logLevel": "error" } }, diff --git a/scripts/build.js b/scripts/build.js index 9126fc293..7fd3a3102 100755 --- a/scripts/build.js +++ b/scripts/build.js @@ -6,6 +6,8 @@ const execa = require('execa'); const targets = fs.readdirSync('packages').filter(f => fs.statSync(`packages/${f}`).isDirectory()); +const bundledPackages = targets.map(target => `@algolia/${target}`); + run(); async function run() { @@ -49,7 +51,12 @@ async function buildDefinition(target, config = '') { pkgDir, `api-extractor${config ? `-${config}` : ''}.json` ); - const extractorConfig = ExtractorConfig.loadFileAndPrepare(extractorConfigPath); + + const extractorConfig = { + ...ExtractorConfig.loadFileAndPrepare(extractorConfigPath), + bundledPackages: target === 'algoliasearch' ? bundledPackages : [], + }; + const result = Extractor.invoke(extractorConfig, { localBuild: true, showVerboseMessages: true, From c8710aec8b7b956ab1a523873f636c903d81e501 Mon Sep 17 00:00:00 2001 From: Yannick Croissant Date: Mon, 16 Mar 2020 16:09:04 +0100 Subject: [PATCH 2/2] fix(types): fix missing type exports --- .../algoliasearch/src/builds/browserLite.ts | 39 +++++ packages/algoliasearch/src/builds/node.ts | 142 ++++++++++++++++++ 2 files changed, 181 insertions(+) diff --git a/packages/algoliasearch/src/builds/browserLite.ts b/packages/algoliasearch/src/builds/browserLite.ts index 699abe764..556ff6b46 100644 --- a/packages/algoliasearch/src/builds/browserLite.ts +++ b/packages/algoliasearch/src/builds/browserLite.ts @@ -26,6 +26,45 @@ import { createUserAgent, RequestOptions } from '@algolia/transporter'; import { AlgoliaSearchOptions } from '../types'; +export { + MultipleQueriesOptions, + MultipleQueriesQuery, + MultipleQueriesResponse, + SearchClient as BaseSearchClient, + SearchClientOptions, + SearchForFacetValuesResponse, + SearchForFacetValuesQueryParams, + SearchIndex as BaseSearchIndex, + SearchOptions, + SearchResponse, + StrategyType, + ObjectWithObjectID, + FacetHit, +} from '@algolia/client-search'; +export { AuthModeType, ClientTransporterOptions } from '@algolia/client-common'; +export { + Headers, + HostOptions, + CallType, + QueryParameters, + Transporter, + TransporterOptions, + RequestOptions, + Timeouts, + UserAgent, + UserAgentOptions, + StatelessHost, + Request as TransporterRequest, +} from '@algolia/transporter'; +export { + Request as RequesterRequest, + Response as RequesterResponse, + Requester, + MethodType, +} from '@algolia/requester-common'; +export { Logger } from '@algolia/logger-common'; +export { Cache, CacheEvents } from '@algolia/cache-common'; + export default function algoliasearch( appId: string, apiKey: string, diff --git a/packages/algoliasearch/src/builds/node.ts b/packages/algoliasearch/src/builds/node.ts index ab7e0d9ee..8f79a2ba1 100644 --- a/packages/algoliasearch/src/builds/node.ts +++ b/packages/algoliasearch/src/builds/node.ts @@ -175,6 +175,148 @@ import { createUserAgent, RequestOptions } from '@algolia/transporter'; import { AlgoliaSearchOptions, InitAnalyticsOptions, InitRecommendationOptions } from '../types'; +export { + GetPersonalizationStrategyResponse, + PersonalizationStrategy, + RecommendationClient as BaseRecommendationClient, + RecommendationClientOptions, + SetPersonalizationStrategyResponse, +} from '@algolia/client-recommendation'; + +export { + ABTest, + AnalyticsClient as BaseAnalyticsClient, + AnalyticsClientOptions, + AddABTestResponse, + GetABTestResponse, + GetABTestsOptions, + GetABTestsResponse, + StopABTestResponse, + DeleteABTestResponse, + Variant, + VariantResponse, +} from '@algolia/client-analytics'; + +export { + RequestOptions, + Transporter, + TransporterOptions, + HostOptions, + Headers, + QueryParameters, + CallType, + Timeouts, + UserAgent, + UserAgentOptions, + StatelessHost, + Request as TransporterRequest, +} from '@algolia/transporter'; + +export { + SearchIndex as BaseSearchIndex, + SearchResponse, + BatchRequest, + BatchResponse, + DeleteResponse, + GetObjectOptions, + ObjectWithObjectID, + GetObjectsOptions, + GetObjectsResponse, + ChunkOptions, + SaveObjectsOptions, + SaveObjectResponse, + ChunkedBatchResponse, + Settings, + SetSettingsResponse, + PartialUpdateObjectsOptions, + PartialUpdateObjectResponse, + DeleteByFiltersOptions, + BrowseOptions, + FindObjectOptions, + FindObjectResponse, + Synonym, + SaveSynonymsOptions, + SaveSynonymResponse, + SaveSynonymsResponse, + SearchSynonymsOptions, + SearchSynonymsResponse, + DeleteSynonymOptions, + ClearSynonymsOptions, + ReplaceAllObjectsOptions, + SearchRulesOptions, + Rule, + SaveRulesOptions, + SaveRuleResponse, + SaveRulesResponse, + ClearRulesOptions, + SearchClient as BaseSearchClient, + MultipleQueriesQuery, + MultipleQueriesOptions, + MultipleQueriesResponse, + SearchForFacetValuesResponse, + SearchForFacetValuesQueryParams, + SearchOptions, + MultipleBatchRequest, + MultipleBatchResponse, + MultipleGetObject, + MultipleGetObjectsResponse, + CopyIndexOptions, + IndexOperationResponse, + ListIndicesResponse, + GetLogsResponse, + ListClustersResponse, + GetApiKeyResponse, + AddApiKeyOptions, + AddApiKeyResponse, + ListApiKeysResponse, + UpdateApiKeyOptions, + UpdateApiKeyResponse, + DeleteApiKeyResponse, + RestoreApiKeyResponse, + AssignUserIDResponse, + AssignUserIDsResponse, + UserIDResponse, + SearchUserIDsOptions, + SearchUserIDsResponse, + ListUserIDsOptions, + ListUserIDsResponse, + GetTopUserIDsResponse, + RemoveUserIDResponse, + HasPendingMappingsOptions, + ScopeType, + Log, + Cluster, + Indice, + HasPendingMappingsResponse, + SecuredApiKeyRestrictions, + BatchActionType, + StrategyType, + Condition, + Consequence, + TimeRange, + FacetHit, + SynonymType, + ConsequenceParams, + ConsequencePromote, + ConsequenceQuery, + AutomaticFacetFilter, + SearchClientOptions, +} from '@algolia/client-search'; + +export { ClientTransporterOptions, AuthModeType, WaitablePromise } from '@algolia/client-common'; + +export { + Destroyable, + Requester, + Request as RequesterRequest, + Response as RequesterResponse, + MethodType, +} from '@algolia/requester-common'; + +export { Cache, CacheEvents } from '@algolia/cache-common'; + +export { Logger } from '@algolia/logger-common'; + export default function algoliasearch( appId: string, apiKey: string,