@lustre/sdk 2.0.1-dev.3 → 2.0.1-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/FetchOptions.js +2 -2
- package/dist/api/QueryError.js +54 -54
- package/dist/api/QueryResolver.js +98 -98
- package/dist/api/WrappedQuery.js +2 -2
- package/dist/api/fast1a64utf.js +135 -135
- package/dist/api/fetchEntity.js +41 -41
- package/dist/api/fetchQuery.js +31 -31
- package/dist/api/getHash.js +27 -27
- package/dist/api/getQueryHash.js +9 -9
- package/dist/index.js +39 -39
- package/dist/schema/builtins.js +433 -433
- package/dist/schema/entities/alias.js +2 -2
- package/dist/schema/entities/brand.js +2 -2
- package/dist/schema/entities/category.js +2 -2
- package/dist/schema/entities/crawl.js +2 -2
- package/dist/schema/entities/index.js +29 -29
- package/dist/schema/entities/media.js +2 -2
- package/dist/schema/entities/offer.js +2 -2
- package/dist/schema/entities/productConfiguration.js +2 -2
- package/dist/schema/entities/productFamily.js +2 -2
- package/dist/schema/entities/productGeneration.js +2 -2
- package/dist/schema/entities/productType.js +2 -2
- package/dist/schema/entities/rating.js +2 -2
- package/dist/schema/entities/source.js +2 -2
- package/dist/schema/entities/spec.js +2 -2
- package/dist/schema/entities/specType.js +2 -2
- package/dist/schema/entities/specTypeChoice.js +2 -2
- package/dist/schema/entities/storePage.js +2 -2
- package/dist/schema/entities/storePageQueueGroup.js +2 -2
- package/dist/schema/entities/user.js +2 -2
- package/dist/schema/index.js +29 -29
- package/dist/schema/mutations/createBrand.js +2 -2
- package/dist/schema/mutations/createCategory.js +2 -2
- package/dist/schema/mutations/createProductConfiguration.js +2 -2
- package/dist/schema/mutations/createProductFamily.js +2 -2
- package/dist/schema/mutations/createProductGeneration.js +2 -2
- package/dist/schema/mutations/createProductType.js +2 -2
- package/dist/schema/mutations/createUser.js +2 -2
- package/dist/schema/mutations/storePageQueueClaimById.js +2 -2
- package/dist/schema/mutations/storePageQueueClaimNext.js +2 -2
- package/dist/schema/mutations/storePageQueueHandle.js +2 -2
- package/dist/schema/mutations/storePageQueueHandleStorePageIdSet.js +2 -2
- package/dist/schema/mutations/updateAlias.js +2 -2
- package/dist/schema/mutations/updateBrand.js +2 -2
- package/dist/schema/mutations/updateCategory.js +2 -2
- package/dist/schema/mutations/updateOffer.js +2 -2
- package/dist/schema/mutations/updateProductConfiguration.js +2 -2
- package/dist/schema/mutations/updateProductConfigurationProductType.js +2 -2
- package/dist/schema/mutations/updateProductFamily.js +2 -2
- package/dist/schema/mutations/updateProductFamilyBrand.js +2 -2
- package/dist/schema/mutations/updateProductGeneration.js +2 -2
- package/dist/schema/mutations/updateProductGenerationProductFamily.js +2 -2
- package/dist/schema/mutations/updateProductType.js +2 -2
- package/dist/schema/mutations/updateProductTypeProductGeneration.js +2 -2
- package/dist/schema/mutations/updateSource.js +2 -2
- package/dist/schema/mutations/updateStorePage.js +2 -2
- package/dist/schema/queries/affiliateUrl.js +2 -2
- package/dist/schema/queries/aliasIdListBySomeId.js +2 -2
- package/dist/schema/queries/analyticsTrack.js +2 -2
- package/dist/schema/queries/appliedCategoryIdListBySomeId.js +2 -2
- package/dist/schema/queries/baseScore.js +2 -2
- package/dist/schema/queries/baseScoreRatingIdList.js +2 -2
- package/dist/schema/queries/baseScoresByCategoryId.js +2 -2
- package/dist/schema/queries/bestInClass.js +2 -2
- package/dist/schema/queries/brandAliasResolution.js +2 -2
- package/dist/schema/queries/brandCategoryRankings.js +2 -2
- package/dist/schema/queries/brandIdBySomeId.js +2 -2
- package/dist/schema/queries/brandIdList.js +2 -2
- package/dist/schema/queries/brandIdListBySearch.js +2 -2
- package/dist/schema/queries/brandSocialMediaPostList.js +2 -2
- package/dist/schema/queries/categoryAliasResolution.js +2 -2
- package/dist/schema/queries/categoryDisplayMode.js +2 -2
- package/dist/schema/queries/categoryIdByUrlSlug.js +2 -2
- package/dist/schema/queries/categoryIdList.js +2 -2
- package/dist/schema/queries/categoryIdListBySomeId.js +2 -2
- package/dist/schema/queries/categoryIdListBySourceId.js +2 -2
- package/dist/schema/queries/categoryModifierSearchList.js +2 -2
- package/dist/schema/queries/categoryRankings.js +2 -2
- package/dist/schema/queries/categorySearchList.js +2 -2
- package/dist/schema/queries/categoryStatusList.js +2 -2
- package/dist/schema/queries/crawlIdList.js +2 -2
- package/dist/schema/queries/crawlIdListByUrl.js +2 -2
- package/dist/schema/queries/descriptionMarkdown.js +2 -2
- package/dist/schema/queries/entityType.js +2 -2
- package/dist/schema/queries/fallbackPriceByProductTypeId.js +2 -2
- package/dist/schema/queries/inputLayerVersion.js +2 -2
- package/dist/schema/queries/latestRatingIdList.js +2 -2
- package/dist/schema/queries/latestRatingIdListBySomeId.js +2 -2
- package/dist/schema/queries/mediaIdListBySomeId.js +2 -2
- package/dist/schema/queries/mlCategoryDisplayMode.js +2 -2
- package/dist/schema/queries/noteMarkdown.js +2 -2
- package/dist/schema/queries/offerIdListByStorePageId.js +2 -2
- package/dist/schema/queries/possibleAliasIdListBySomeId.js +2 -2
- package/dist/schema/queries/possibleStorePageIdListBySomeId.js +2 -2
- package/dist/schema/queries/preferredCategoryIdListByProductId.js +2 -2
- package/dist/schema/queries/preferredLatestRatingIdListBySomeId.js +2 -2
- package/dist/schema/queries/preferredStorePageList.js +2 -2
- package/dist/schema/queries/priceHistoryLookup.js +2 -2
- package/dist/schema/queries/pricePointCompetitors.js +2 -2
- package/dist/schema/queries/priceRangeByCategoryId.js +2 -2
- package/dist/schema/queries/productConfigurationIdListBySomeId.js +2 -2
- package/dist/schema/queries/productDealList.js +2 -2
- package/dist/schema/queries/productDocumentByStoreUrl.js +2 -2
- package/dist/schema/queries/productDocumentsByProductIds.js +2 -2
- package/dist/schema/queries/productFamilyIdBySomeId.js +2 -2
- package/dist/schema/queries/productFamilyIdListBySomeId.js +2 -2
- package/dist/schema/queries/productGenerationIdBySomeId.js +2 -2
- package/dist/schema/queries/productGenerationIdListBySomeId.js +2 -2
- package/dist/schema/queries/productListSort.js +2 -2
- package/dist/schema/queries/productPricePointList.js +2 -2
- package/dist/schema/queries/productSearchList.js +2 -2
- package/dist/schema/queries/productTypeIdBySomeId.js +2 -2
- package/dist/schema/queries/productTypeIdByStoreUrl.js +2 -2
- package/dist/schema/queries/productTypeIdListByCategoryId.js +2 -2
- package/dist/schema/queries/productTypeIdListByModifiers.js +2 -2
- package/dist/schema/queries/productTypeIdListBySomeId.js +2 -2
- package/dist/schema/queries/saleMetrics.js +2 -2
- package/dist/schema/queries/searchSuggestionList.js +2 -2
- package/dist/schema/queries/sectionDataByCrawlId.js +2 -2
- package/dist/schema/queries/sourceIdList.js +2 -2
- package/dist/schema/queries/specIdListBySomeId.js +2 -2
- package/dist/schema/queries/specTypeIdList.js +2 -2
- package/dist/schema/queries/specTypeValidValues.js +2 -2
- package/dist/schema/queries/specValueRangeListByCategoryId.js +2 -2
- package/dist/schema/queries/stablePriceByProductId.js +2 -2
- package/dist/schema/queries/stablePriceByProductIdAndStoreName.js +2 -2
- package/dist/schema/queries/stablePriceByStorePageId.js +2 -2
- package/dist/schema/queries/storePageFetchData.js +2 -2
- package/dist/schema/queries/storePageIdByUrl.js +2 -2
- package/dist/schema/queries/storePageIdListBySomeId.js +2 -2
- package/dist/schema/queries/storePageInfo.js +2 -2
- package/dist/schema/queries/storePageInfoBySku.js +2 -2
- package/dist/schema/queries/storePageScrapeData.js +2 -2
- package/dist/schema/queries/subCategoryIdListByCategoryId.js +2 -2
- package/dist/schema/queries/subsetModifierDataByModifiers.js +2 -2
- package/dist/schema/queries/topProductDocumentList.js +2 -2
- package/dist/schema/queries/unstableMediaIdListByCategoryId.js +2 -2
- package/dist/schema/queries/unstableSourceTrust.js +2 -2
- package/dist/schema/queries/userIdList.js +2 -2
- package/dist/schema/queries/userPermissionsByUserId.js +2 -2
- package/dist/schema/queries/userRestictedData.js +2 -2
- package/dist/schema/queries/userReviewAnalysis.js +2 -2
- package/dist/schema/queries/whoAmI.js +2 -2
- package/dist/schema/queries.js +2 -2
- package/dist/schema/responses.js +2 -2
- package/package.json +1 -1
- package/types/api/FetchOptions.d.ts +5 -5
- package/types/api/QueryError.d.ts +29 -29
- package/types/api/QueryResolver.d.ts +31 -31
- package/types/api/WrappedQuery.d.ts +8 -8
- package/types/api/fast1a64utf.d.ts +2 -2
- package/types/api/fetchEntity.d.ts +6 -6
- package/types/api/fetchQuery.d.ts +6 -6
- package/types/api/getHash.d.ts +6 -6
- package/types/api/getQueryHash.d.ts +2 -2
- package/types/index.d.ts +10 -10
- package/types/schema/builtins.d.ts +123 -123
- package/types/schema/entities/alias.d.ts +5 -5
- package/types/schema/entities/brand.d.ts +4 -4
- package/types/schema/entities/category.d.ts +6 -6
- package/types/schema/entities/crawl.d.ts +11 -11
- package/types/schema/entities/index.d.ts +17 -17
- package/types/schema/entities/media.d.ts +5 -5
- package/types/schema/entities/offer.d.ts +10 -10
- package/types/schema/entities/productConfiguration.d.ts +4 -4
- package/types/schema/entities/productFamily.d.ts +4 -4
- package/types/schema/entities/productGeneration.d.ts +4 -4
- package/types/schema/entities/productType.d.ts +4 -4
- package/types/schema/entities/rating.d.ts +52 -52
- package/types/schema/entities/source.d.ts +7 -7
- package/types/schema/entities/spec.d.ts +21 -21
- package/types/schema/entities/specType.d.ts +5 -5
- package/types/schema/entities/specTypeChoice.d.ts +6 -6
- package/types/schema/entities/storePage.d.ts +7 -7
- package/types/schema/entities/storePageQueueGroup.d.ts +5 -5
- package/types/schema/entities/user.d.ts +4 -4
- package/types/schema/index.d.ts +259 -261
- package/types/schema/index.d.ts.map +1 -1
- package/types/schema/mutations/createBrand.d.ts +8 -8
- package/types/schema/mutations/createCategory.d.ts +8 -8
- package/types/schema/mutations/createProductConfiguration.d.ts +9 -9
- package/types/schema/mutations/createProductFamily.d.ts +9 -9
- package/types/schema/mutations/createProductGeneration.d.ts +9 -9
- package/types/schema/mutations/createProductType.d.ts +9 -9
- package/types/schema/mutations/createUser.d.ts +9 -9
- package/types/schema/mutations/storePageQueueClaimById.d.ts +16 -16
- package/types/schema/mutations/storePageQueueClaimNext.d.ts +14 -14
- package/types/schema/mutations/storePageQueueHandle.d.ts +14 -14
- package/types/schema/mutations/storePageQueueHandleStorePageIdSet.d.ts +14 -14
- package/types/schema/mutations/updateAlias.d.ts +7 -7
- package/types/schema/mutations/updateBrand.d.ts +7 -7
- package/types/schema/mutations/updateCategory.d.ts +9 -9
- package/types/schema/mutations/updateOffer.d.ts +7 -7
- package/types/schema/mutations/updateProductConfiguration.d.ts +7 -7
- package/types/schema/mutations/updateProductConfigurationProductType.d.ts +7 -7
- package/types/schema/mutations/updateProductFamily.d.ts +7 -7
- package/types/schema/mutations/updateProductFamilyBrand.d.ts +7 -7
- package/types/schema/mutations/updateProductGeneration.d.ts +7 -7
- package/types/schema/mutations/updateProductGenerationProductFamily.d.ts +7 -7
- package/types/schema/mutations/updateProductType.d.ts +7 -7
- package/types/schema/mutations/updateProductTypeProductGeneration.d.ts +7 -7
- package/types/schema/mutations/updateSource.d.ts +9 -9
- package/types/schema/mutations/updateStorePage.d.ts +7 -7
- package/types/schema/queries/affiliateUrl.d.ts +11 -11
- package/types/schema/queries/aliasIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/analyticsTrack.d.ts +5 -5
- package/types/schema/queries/appliedCategoryIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/baseScore.d.ts +8 -8
- package/types/schema/queries/baseScoreRatingIdList.d.ts +7 -7
- package/types/schema/queries/baseScoresByCategoryId.d.ts +11 -11
- package/types/schema/queries/bestInClass.d.ts +19 -19
- package/types/schema/queries/brandAliasResolution.d.ts +10 -10
- package/types/schema/queries/brandCategoryRankings.d.ts +36 -29
- package/types/schema/queries/brandCategoryRankings.d.ts.map +1 -1
- package/types/schema/queries/brandIdBySomeId.d.ts +5 -5
- package/types/schema/queries/brandIdList.d.ts +8 -8
- package/types/schema/queries/brandIdListBySearch.d.ts +6 -6
- package/types/schema/queries/brandSocialMediaPostList.d.ts +21 -21
- package/types/schema/queries/categoryAliasResolution.d.ts +12 -12
- package/types/schema/queries/categoryDisplayMode.d.ts +10 -10
- package/types/schema/queries/categoryIdByUrlSlug.d.ts +5 -5
- package/types/schema/queries/categoryIdList.d.ts +8 -8
- package/types/schema/queries/categoryIdListBySomeId.d.ts +10 -10
- package/types/schema/queries/categoryIdListBySourceId.d.ts +6 -6
- package/types/schema/queries/categoryModifierSearchList.d.ts +21 -21
- package/types/schema/queries/categoryRankings.d.ts +13 -13
- package/types/schema/queries/categorySearchList.d.ts +16 -16
- package/types/schema/queries/categoryStatusList.d.ts +9 -9
- package/types/schema/queries/crawlIdList.d.ts +11 -11
- package/types/schema/queries/crawlIdListByUrl.d.ts +6 -6
- package/types/schema/queries/descriptionMarkdown.d.ts +5 -5
- package/types/schema/queries/entityType.d.ts +54 -54
- package/types/schema/queries/fallbackPriceByProductTypeId.d.ts +6 -6
- package/types/schema/queries/inputLayerVersion.d.ts +5 -5
- package/types/schema/queries/latestRatingIdList.d.ts +6 -6
- package/types/schema/queries/latestRatingIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/mediaIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/mlCategoryDisplayMode.d.ts +8 -8
- package/types/schema/queries/noteMarkdown.d.ts +5 -5
- package/types/schema/queries/offerIdListByStorePageId.d.ts +12 -12
- package/types/schema/queries/possibleAliasIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/possibleStorePageIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/preferredCategoryIdListByProductId.d.ts +6 -6
- package/types/schema/queries/preferredLatestRatingIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/preferredStorePageList.d.ts +11 -11
- package/types/schema/queries/priceHistoryLookup.d.ts +16 -16
- package/types/schema/queries/pricePointCompetitors.d.ts +16 -16
- package/types/schema/queries/priceRangeByCategoryId.d.ts +10 -10
- package/types/schema/queries/productConfigurationIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/productDealList.d.ts +13 -13
- package/types/schema/queries/productDocumentByStoreUrl.d.ts +7 -7
- package/types/schema/queries/productDocumentsByProductIds.d.ts +6 -6
- package/types/schema/queries/productFamilyIdBySomeId.d.ts +5 -5
- package/types/schema/queries/productFamilyIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/productGenerationIdBySomeId.d.ts +5 -5
- package/types/schema/queries/productGenerationIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/productListSort.d.ts +9 -9
- package/types/schema/queries/productPricePointList.d.ts +13 -13
- package/types/schema/queries/productSearchList.d.ts +39 -39
- package/types/schema/queries/productTypeIdBySomeId.d.ts +5 -5
- package/types/schema/queries/productTypeIdByStoreUrl.d.ts +6 -6
- package/types/schema/queries/productTypeIdListByCategoryId.d.ts +10 -10
- package/types/schema/queries/productTypeIdListByModifiers.d.ts +7 -7
- package/types/schema/queries/productTypeIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/saleMetrics.d.ts +8 -8
- package/types/schema/queries/searchSuggestionList.d.ts +9 -9
- package/types/schema/queries/sectionDataByCrawlId.d.ts +19 -19
- package/types/schema/queries/sourceIdList.d.ts +4 -4
- package/types/schema/queries/specIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/specTypeIdList.d.ts +12 -12
- package/types/schema/queries/specTypeValidValues.d.ts +15 -15
- package/types/schema/queries/specValueRangeListByCategoryId.d.ts +36 -36
- package/types/schema/queries/stablePriceByProductId.d.ts +6 -6
- package/types/schema/queries/stablePriceByProductIdAndStoreName.d.ts +7 -7
- package/types/schema/queries/stablePriceByStorePageId.d.ts +6 -6
- package/types/schema/queries/storePageFetchData.d.ts +12 -12
- package/types/schema/queries/storePageIdByUrl.d.ts +6 -6
- package/types/schema/queries/storePageIdListBySomeId.d.ts +6 -6
- package/types/schema/queries/storePageInfo.d.ts +11 -11
- package/types/schema/queries/storePageInfoBySku.d.ts +20 -20
- package/types/schema/queries/storePageScrapeData.d.ts +9 -9
- package/types/schema/queries/subCategoryIdListByCategoryId.d.ts +6 -6
- package/types/schema/queries/subsetModifierDataByModifiers.d.ts +12 -12
- package/types/schema/queries/topProductDocumentList.d.ts +8 -8
- package/types/schema/queries/unstableMediaIdListByCategoryId.d.ts +6 -6
- package/types/schema/queries/unstableSourceTrust.d.ts +9 -9
- package/types/schema/queries/userIdList.d.ts +4 -4
- package/types/schema/queries/userPermissionsByUserId.d.ts +7 -7
- package/types/schema/queries/userRestictedData.d.ts +10 -10
- package/types/schema/queries/userReviewAnalysis.d.ts +37 -37
- package/types/schema/queries/whoAmI.d.ts +5 -5
- package/types/schema/queries.d.ts +82 -83
- package/types/schema/queries.d.ts.map +1 -1
- package/types/schema/responses.d.ts +82 -83
- package/types/schema/responses.d.ts.map +1 -1
- package/dist/schema/queries/competitorsAnalysis.js +0 -3
- package/dist/schema/queries/competitorsAnalysis.js.map +0 -1
- package/types/schema/queries/competitorsAnalysis.d.ts +0 -35
- package/types/schema/queries/competitorsAnalysis.d.ts.map +0 -1
package/dist/api/fetchEntity.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchEntity = void 0;
|
|
4
|
-
const getQueryHash_1 = require("./getQueryHash");
|
|
5
|
-
const QueryError_1 = require("./QueryError");
|
|
6
|
-
const QueryResolver_1 = require("./QueryResolver");
|
|
7
|
-
const fetchEntity = (type, id, options = {}) => {
|
|
8
|
-
const { queryResolver = QueryResolver_1._getDefaultQueryResolver(), batchKey = type } = options;
|
|
9
|
-
const name = `entity-${type}`;
|
|
10
|
-
const body = { id };
|
|
11
|
-
const query = { name, body };
|
|
12
|
-
const promise = queryResolver.addQueryToQueue(query, { batchKey }).then((response) => {
|
|
13
|
-
var _a, _b, _c, _d, _e, _f;
|
|
14
|
-
const queryHash = getQueryHash_1.getQueryHash(query);
|
|
15
|
-
const entity = (_b = (_a = response.entities) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b[id];
|
|
16
|
-
const queryResponse = (_d = (_c = response.responses) === null || _c === void 0 ? void 0 : _c[query.name]) === null || _d === void 0 ? void 0 : _d[queryHash];
|
|
17
|
-
if (queryResponse === null) {
|
|
18
|
-
const queryError = (_f = (_e = response.errors) === null || _e === void 0 ? void 0 : _e[query.name]) === null || _f === void 0 ? void 0 : _f[queryHash];
|
|
19
|
-
if (queryError) {
|
|
20
|
-
throw new QueryError_1.QueryResponseError(query, queryError);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
throw new QueryError_1.QueryReferenceError(query, "Query error is not defined");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (queryResponse === undefined) {
|
|
27
|
-
throw new QueryError_1.QueryReferenceError(query, "Query is not defined");
|
|
28
|
-
}
|
|
29
|
-
if (queryResponse !== true) {
|
|
30
|
-
throw new QueryError_1.QueryValidationError(query, "Entities query did not return true");
|
|
31
|
-
}
|
|
32
|
-
if (!entity) {
|
|
33
|
-
throw new QueryError_1.QueryReferenceError(query, "Entity is not defined");
|
|
34
|
-
}
|
|
35
|
-
return entity;
|
|
36
|
-
}, (error) => {
|
|
37
|
-
throw error;
|
|
38
|
-
});
|
|
39
|
-
return promise;
|
|
40
|
-
};
|
|
41
|
-
exports.fetchEntity = fetchEntity;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchEntity = void 0;
|
|
4
|
+
const getQueryHash_1 = require("./getQueryHash");
|
|
5
|
+
const QueryError_1 = require("./QueryError");
|
|
6
|
+
const QueryResolver_1 = require("./QueryResolver");
|
|
7
|
+
const fetchEntity = (type, id, options = {}) => {
|
|
8
|
+
const { queryResolver = QueryResolver_1._getDefaultQueryResolver(), batchKey = type } = options;
|
|
9
|
+
const name = `entity-${type}`;
|
|
10
|
+
const body = { id };
|
|
11
|
+
const query = { name, body };
|
|
12
|
+
const promise = queryResolver.addQueryToQueue(query, { batchKey }).then((response) => {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14
|
+
const queryHash = getQueryHash_1.getQueryHash(query);
|
|
15
|
+
const entity = (_b = (_a = response.entities) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b[id];
|
|
16
|
+
const queryResponse = (_d = (_c = response.responses) === null || _c === void 0 ? void 0 : _c[query.name]) === null || _d === void 0 ? void 0 : _d[queryHash];
|
|
17
|
+
if (queryResponse === null) {
|
|
18
|
+
const queryError = (_f = (_e = response.errors) === null || _e === void 0 ? void 0 : _e[query.name]) === null || _f === void 0 ? void 0 : _f[queryHash];
|
|
19
|
+
if (queryError) {
|
|
20
|
+
throw new QueryError_1.QueryResponseError(query, queryError);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
throw new QueryError_1.QueryReferenceError(query, "Query error is not defined");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (queryResponse === undefined) {
|
|
27
|
+
throw new QueryError_1.QueryReferenceError(query, "Query is not defined");
|
|
28
|
+
}
|
|
29
|
+
if (queryResponse !== true) {
|
|
30
|
+
throw new QueryError_1.QueryValidationError(query, "Entities query did not return true");
|
|
31
|
+
}
|
|
32
|
+
if (!entity) {
|
|
33
|
+
throw new QueryError_1.QueryReferenceError(query, "Entity is not defined");
|
|
34
|
+
}
|
|
35
|
+
return entity;
|
|
36
|
+
}, (error) => {
|
|
37
|
+
throw error;
|
|
38
|
+
});
|
|
39
|
+
return promise;
|
|
40
|
+
};
|
|
41
|
+
exports.fetchEntity = fetchEntity;
|
|
42
42
|
//# sourceMappingURL=fetchEntity.js.map
|
package/dist/api/fetchQuery.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchQuery = void 0;
|
|
4
|
-
const getQueryHash_1 = require("./getQueryHash");
|
|
5
|
-
const QueryError_1 = require("./QueryError");
|
|
6
|
-
const QueryResolver_1 = require("./QueryResolver");
|
|
7
|
-
const fetchQuery = (name, body, options = {}) => {
|
|
8
|
-
const { queryResolver = QueryResolver_1._getDefaultQueryResolver(), batchKey = name } = options;
|
|
9
|
-
const query = { name, body };
|
|
10
|
-
const promise = queryResolver.addQueryToQueue(query, { batchKey }).then((response) => {
|
|
11
|
-
var _a, _b, _c, _d;
|
|
12
|
-
const queryResponse = (_b = (_a = response.responses) === null || _a === void 0 ? void 0 : _a[query.name]) === null || _b === void 0 ? void 0 : _b[getQueryHash_1.getQueryHash(query)];
|
|
13
|
-
if (queryResponse === null) {
|
|
14
|
-
const queryError = (_d = (_c = response.errors) === null || _c === void 0 ? void 0 : _c[query.name]) === null || _d === void 0 ? void 0 : _d[getQueryHash_1.getQueryHash(query)];
|
|
15
|
-
if (queryError) {
|
|
16
|
-
throw new QueryError_1.QueryResponseError(query, queryError);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
throw new QueryError_1.QueryReferenceError(query, "Query error is not defined");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (queryResponse === undefined) {
|
|
23
|
-
throw new QueryError_1.QueryReferenceError(query, "Query is not defined");
|
|
24
|
-
}
|
|
25
|
-
return queryResponse;
|
|
26
|
-
}, (error) => {
|
|
27
|
-
throw error;
|
|
28
|
-
});
|
|
29
|
-
return promise;
|
|
30
|
-
};
|
|
31
|
-
exports.fetchQuery = fetchQuery;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchQuery = void 0;
|
|
4
|
+
const getQueryHash_1 = require("./getQueryHash");
|
|
5
|
+
const QueryError_1 = require("./QueryError");
|
|
6
|
+
const QueryResolver_1 = require("./QueryResolver");
|
|
7
|
+
const fetchQuery = (name, body, options = {}) => {
|
|
8
|
+
const { queryResolver = QueryResolver_1._getDefaultQueryResolver(), batchKey = name } = options;
|
|
9
|
+
const query = { name, body };
|
|
10
|
+
const promise = queryResolver.addQueryToQueue(query, { batchKey }).then((response) => {
|
|
11
|
+
var _a, _b, _c, _d;
|
|
12
|
+
const queryResponse = (_b = (_a = response.responses) === null || _a === void 0 ? void 0 : _a[query.name]) === null || _b === void 0 ? void 0 : _b[getQueryHash_1.getQueryHash(query)];
|
|
13
|
+
if (queryResponse === null) {
|
|
14
|
+
const queryError = (_d = (_c = response.errors) === null || _c === void 0 ? void 0 : _c[query.name]) === null || _d === void 0 ? void 0 : _d[getQueryHash_1.getQueryHash(query)];
|
|
15
|
+
if (queryError) {
|
|
16
|
+
throw new QueryError_1.QueryResponseError(query, queryError);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
throw new QueryError_1.QueryReferenceError(query, "Query error is not defined");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (queryResponse === undefined) {
|
|
23
|
+
throw new QueryError_1.QueryReferenceError(query, "Query is not defined");
|
|
24
|
+
}
|
|
25
|
+
return queryResponse;
|
|
26
|
+
}, (error) => {
|
|
27
|
+
throw error;
|
|
28
|
+
});
|
|
29
|
+
return promise;
|
|
30
|
+
};
|
|
31
|
+
exports.fetchQuery = fetchQuery;
|
|
32
32
|
//# sourceMappingURL=fetchQuery.js.map
|
package/dist/api/getHash.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.objectToString = void 0;
|
|
7
|
-
const fast1a64utf_1 = __importDefault(require("./fast1a64utf"));
|
|
8
|
-
const escape = (value) => value.replace(/\\/g, "\\\\").replace(/\"/g, '\\"');
|
|
9
|
-
const objectToString = (data) => {
|
|
10
|
-
return ("{" +
|
|
11
|
-
Object.keys(data)
|
|
12
|
-
.sort()
|
|
13
|
-
.map((key) => {
|
|
14
|
-
const value = data[key];
|
|
15
|
-
return value != null && typeof value === "object"
|
|
16
|
-
? `"${escape(key)}":${exports.objectToString(value)}`
|
|
17
|
-
: typeof value === "string"
|
|
18
|
-
? `"${escape(key)}":"${escape(value)}"`
|
|
19
|
-
:
|
|
20
|
-
`"${escape(key)}":${value}`;
|
|
21
|
-
})
|
|
22
|
-
.join() +
|
|
23
|
-
"}");
|
|
24
|
-
};
|
|
25
|
-
exports.objectToString = objectToString;
|
|
26
|
-
const getHash = (object) => fast1a64utf_1.default(exports.objectToString(object));
|
|
27
|
-
exports.default = getHash;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.objectToString = void 0;
|
|
7
|
+
const fast1a64utf_1 = __importDefault(require("./fast1a64utf"));
|
|
8
|
+
const escape = (value) => value.replace(/\\/g, "\\\\").replace(/\"/g, '\\"');
|
|
9
|
+
const objectToString = (data) => {
|
|
10
|
+
return ("{" +
|
|
11
|
+
Object.keys(data)
|
|
12
|
+
.sort()
|
|
13
|
+
.map((key) => {
|
|
14
|
+
const value = data[key];
|
|
15
|
+
return value != null && typeof value === "object"
|
|
16
|
+
? `"${escape(key)}":${exports.objectToString(value)}`
|
|
17
|
+
: typeof value === "string"
|
|
18
|
+
? `"${escape(key)}":"${escape(value)}"`
|
|
19
|
+
:
|
|
20
|
+
`"${escape(key)}":${value}`;
|
|
21
|
+
})
|
|
22
|
+
.join() +
|
|
23
|
+
"}");
|
|
24
|
+
};
|
|
25
|
+
exports.objectToString = objectToString;
|
|
26
|
+
const getHash = (object) => fast1a64utf_1.default(exports.objectToString(object));
|
|
27
|
+
exports.default = getHash;
|
|
28
28
|
//# sourceMappingURL=getHash.js.map
|
package/dist/api/getQueryHash.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getQueryHash = void 0;
|
|
7
|
-
const getHash_1 = __importDefault(require("./getHash"));
|
|
8
|
-
const getQueryHash = (query) => getHash_1.default(query);
|
|
9
|
-
exports.getQueryHash = getQueryHash;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getQueryHash = void 0;
|
|
7
|
+
const getHash_1 = __importDefault(require("./getHash"));
|
|
8
|
+
const getQueryHash = (query) => getHash_1.default(query);
|
|
9
|
+
exports.getQueryHash = getQueryHash;
|
|
10
10
|
//# sourceMappingURL=getQueryHash.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports._setDefaultQueryResolver = exports._getDefaultQueryResolver = exports.QueryResolver = exports.getQueryHash = exports.fetchEntity = exports.fetchQuery = exports.ALL_COUNTRY_CODES = exports.ALL_CURRENCY_CODES = void 0;
|
|
26
|
-
var builtins_1 = require("./schema/builtins");
|
|
27
|
-
Object.defineProperty(exports, "ALL_CURRENCY_CODES", { enumerable: true, get: function () { return builtins_1.ALL_CURRENCY_CODES; } });
|
|
28
|
-
Object.defineProperty(exports, "ALL_COUNTRY_CODES", { enumerable: true, get: function () { return builtins_1.ALL_COUNTRY_CODES; } });
|
|
29
|
-
var fetchQuery_1 = require("./api/fetchQuery");
|
|
30
|
-
Object.defineProperty(exports, "fetchQuery", { enumerable: true, get: function () { return fetchQuery_1.fetchQuery; } });
|
|
31
|
-
var fetchEntity_1 = require("./api/fetchEntity");
|
|
32
|
-
Object.defineProperty(exports, "fetchEntity", { enumerable: true, get: function () { return fetchEntity_1.fetchEntity; } });
|
|
33
|
-
var getQueryHash_1 = require("./api/getQueryHash");
|
|
34
|
-
Object.defineProperty(exports, "getQueryHash", { enumerable: true, get: function () { return getQueryHash_1.getQueryHash; } });
|
|
35
|
-
const QueryResolver_1 = __importStar(require("./api/QueryResolver"));
|
|
36
|
-
exports.QueryResolver = QueryResolver_1.default;
|
|
37
|
-
Object.defineProperty(exports, "_getDefaultQueryResolver", { enumerable: true, get: function () { return QueryResolver_1._getDefaultQueryResolver; } });
|
|
38
|
-
Object.defineProperty(exports, "_setDefaultQueryResolver", { enumerable: true, get: function () { return QueryResolver_1._setDefaultQueryResolver; } });
|
|
39
|
-
__exportStar(require("./api/QueryError"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports._setDefaultQueryResolver = exports._getDefaultQueryResolver = exports.QueryResolver = exports.getQueryHash = exports.fetchEntity = exports.fetchQuery = exports.ALL_COUNTRY_CODES = exports.ALL_CURRENCY_CODES = void 0;
|
|
26
|
+
var builtins_1 = require("./schema/builtins");
|
|
27
|
+
Object.defineProperty(exports, "ALL_CURRENCY_CODES", { enumerable: true, get: function () { return builtins_1.ALL_CURRENCY_CODES; } });
|
|
28
|
+
Object.defineProperty(exports, "ALL_COUNTRY_CODES", { enumerable: true, get: function () { return builtins_1.ALL_COUNTRY_CODES; } });
|
|
29
|
+
var fetchQuery_1 = require("./api/fetchQuery");
|
|
30
|
+
Object.defineProperty(exports, "fetchQuery", { enumerable: true, get: function () { return fetchQuery_1.fetchQuery; } });
|
|
31
|
+
var fetchEntity_1 = require("./api/fetchEntity");
|
|
32
|
+
Object.defineProperty(exports, "fetchEntity", { enumerable: true, get: function () { return fetchEntity_1.fetchEntity; } });
|
|
33
|
+
var getQueryHash_1 = require("./api/getQueryHash");
|
|
34
|
+
Object.defineProperty(exports, "getQueryHash", { enumerable: true, get: function () { return getQueryHash_1.getQueryHash; } });
|
|
35
|
+
const QueryResolver_1 = __importStar(require("./api/QueryResolver"));
|
|
36
|
+
exports.QueryResolver = QueryResolver_1.default;
|
|
37
|
+
Object.defineProperty(exports, "_getDefaultQueryResolver", { enumerable: true, get: function () { return QueryResolver_1._getDefaultQueryResolver; } });
|
|
38
|
+
Object.defineProperty(exports, "_setDefaultQueryResolver", { enumerable: true, get: function () { return QueryResolver_1._setDefaultQueryResolver; } });
|
|
39
|
+
__exportStar(require("./api/QueryError"), exports);
|
|
40
40
|
//# sourceMappingURL=index.js.map
|