@8ms/helpers 1.40.0 → 1.40.2
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/ApiResponse.d.mts +73 -0
- package/dist/api/ApiResponse.mjs +91 -0
- package/dist/api/index.d.mts +1 -11
- package/dist/api/isError.d.mts +9 -0
- package/dist/api/isError.mjs +7 -0
- package/dist/api/isSuccess.d.mts +9 -0
- package/dist/api/isSuccess.mjs +7 -0
- package/dist/api/response.d.mts +2 -0
- package/dist/api/response.mjs +9 -0
- package/dist/array/contains.d.mts +11 -0
- package/dist/array/contains.mjs +7 -0
- package/dist/array/getArray.d.mts +10 -0
- package/dist/array/getArray.mjs +8 -0
- package/dist/atInternet/request.d.mts +31 -0
- package/dist/atInternet/request.mjs +1 -0
- package/dist/aws/athenaExpress/initClient.d.mts +15 -0
- package/dist/aws/athenaExpress/initClient.mjs +28 -0
- package/dist/aws/athenaExpress/query.d.mts +10 -0
- package/dist/aws/athenaExpress/query.mjs +13 -0
- package/dist/aws/ec2/initClient.d.mts +14 -0
- package/dist/aws/ec2/initClient.mjs +18 -0
- package/dist/aws/ec2/startInstances.d.mts +13 -0
- package/dist/aws/ec2/startInstances.mjs +17 -0
- package/dist/aws/ec2/stopInstances.d.mts +14 -0
- package/dist/aws/ec2/stopInstances.mjs +18 -0
- package/dist/aws/ecs/getClusters.d.mts +11 -0
- package/dist/aws/ecs/getClusters.mjs +23 -0
- package/dist/aws/ecs/getTaskDefinitions.d.mts +16 -0
- package/dist/aws/ecs/getTaskDefinitions.mjs +26 -0
- package/dist/aws/ecs/getTasks.d.mts +19 -0
- package/dist/aws/ecs/getTasks.mjs +29 -0
- package/dist/aws/ecs/initClient.d.mts +14 -0
- package/dist/aws/ecs/initClient.mjs +18 -0
- package/dist/aws/ecs/runTask.d.mts +19 -0
- package/dist/aws/ecs/runTask.mjs +24 -0
- package/dist/aws/getConfig.d.mts +18 -0
- package/dist/aws/getConfig.mjs +17 -0
- package/dist/aws/glue/initClient.d.mts +13 -0
- package/dist/aws/glue/initClient.mjs +17 -0
- package/dist/aws/glue/invoke.d.mts +11 -0
- package/dist/aws/glue/invoke.mjs +14 -0
- package/dist/aws/isResponse200.d.mts +11 -0
- package/dist/aws/isResponse200.mjs +16 -0
- package/dist/aws/lambda/getHandlerPath.d.mts +7 -0
- package/dist/aws/lambda/getHandlerPath.mjs +6 -0
- package/dist/aws/lambda/initClient.d.mts +13 -0
- package/dist/aws/lambda/initClient.mjs +17 -0
- package/dist/aws/lambda/invoke.d.mts +15 -0
- package/dist/aws/lambda/invoke.mjs +31 -0
- package/dist/aws/s3/copyFile.d.mts +18 -0
- package/dist/aws/s3/copyFile.mjs +15 -0
- package/dist/aws/s3/deleteFile.d.mts +14 -0
- package/dist/aws/s3/deleteFile.mjs +14 -0
- package/dist/aws/s3/deleteFiles.d.mts +14 -0
- package/dist/aws/s3/deleteFiles.mjs +14 -0
- package/dist/aws/s3/deleteFolder.d.mts +14 -0
- package/dist/aws/s3/deleteFolder.mjs +26 -0
- package/dist/aws/s3/getGlueJson.d.mts +12 -0
- package/dist/aws/s3/getGlueJson.mjs +8 -0
- package/dist/aws/s3/getPresignedPost.d.mts +28 -0
- package/dist/aws/s3/getPresignedPost.mjs +19 -0
- package/dist/aws/s3/getSignedUrl.d.mts +19 -0
- package/dist/aws/s3/getSignedUrl.mjs +17 -0
- package/dist/aws/s3/initClient.d.mts +15 -0
- package/dist/aws/s3/initClient.mjs +17 -0
- package/dist/aws/s3/isFileExists.d.mts +11 -0
- package/dist/aws/s3/isFileExists.mjs +21 -0
- package/dist/aws/s3/listFiles.d.mts +14 -0
- package/dist/aws/s3/listFiles.mjs +27 -0
- package/dist/aws/s3/listFilesIteratively.d.mts +11 -0
- package/dist/aws/s3/listFilesIteratively.mjs +40 -0
- package/dist/aws/s3/listFolders.d.mts +14 -0
- package/dist/aws/s3/listFolders.mjs +23 -0
- package/dist/aws/s3/moveFile.d.mts +16 -0
- package/dist/aws/s3/moveFile.mjs +18 -0
- package/dist/aws/s3/readBrotli.d.mts +18 -0
- package/dist/aws/s3/readBrotli.mjs +20 -0
- package/dist/aws/s3/readBuffer.d.mts +19 -0
- package/dist/aws/s3/readBuffer.mjs +29 -0
- package/dist/aws/s3/readFile.d.mts +38 -0
- package/dist/aws/s3/readFile.mjs +64 -0
- package/dist/aws/s3/readGzip.d.mts +18 -0
- package/dist/aws/s3/readGzip.mjs +20 -0
- package/dist/aws/s3/writeBrotli.d.mts +20 -0
- package/dist/aws/s3/writeBrotli.mjs +18 -0
- package/dist/aws/s3/writeFile.d.mts +18 -0
- package/dist/aws/s3/writeFile.mjs +16 -0
- package/dist/aws/s3/writeGzip.d.mts +20 -0
- package/dist/aws/s3/writeGzip.mjs +18 -0
- package/dist/aws/s3/writePresignedPost.d.mts +24 -0
- package/dist/aws/s3/writePresignedPost.mjs +28 -0
- package/dist/aws/s3/writeUrlContents.d.mts +16 -0
- package/dist/aws/s3/writeUrlContents.mjs +19 -0
- package/dist/aws/s3cache/getCache.d.mts +19 -0
- package/dist/aws/s3cache/getCache.mjs +25 -0
- package/dist/aws/s3cache/getKey.d.mts +15 -0
- package/dist/aws/s3cache/getKey.mjs +15 -0
- package/dist/aws/s3cache/index.d.mts +1 -1
- package/dist/aws/s3cache/saveCache.d.mts +16 -0
- package/dist/aws/s3cache/saveCache.mjs +14 -0
- package/dist/aws/s3cache/updateCache.d.mts +18 -0
- package/dist/aws/s3cache/updateCache.mjs +26 -0
- package/dist/aws/ses/SimpleEmail.d.mts +79 -0
- package/dist/aws/ses/SimpleEmail.mjs +122 -0
- package/dist/aws/ses/initClient.d.mts +15 -0
- package/dist/aws/ses/initClient.mjs +17 -0
- package/dist/aws/sqs/addToQueue.d.mts +35 -0
- package/dist/aws/sqs/addToQueue.mjs +20 -0
- package/dist/aws/sqs/deleteFromQueue.d.mts +16 -0
- package/dist/aws/sqs/deleteFromQueue.mjs +15 -0
- package/dist/aws/sqs/index.d.mts +18 -0
- package/dist/aws/sqs/initClient.d.mts +15 -0
- package/dist/aws/sqs/initClient.mjs +17 -0
- package/dist/aws/sqs/isEventSqs.d.mts +1 -0
- package/dist/aws/sqs/isEventSqs.mjs +1 -0
- package/dist/aws/ssm/getParameter.d.mts +16 -0
- package/dist/aws/ssm/getParameter.mjs +22 -0
- package/dist/aws/ssm/initClient.d.mts +15 -0
- package/dist/aws/ssm/initClient.mjs +17 -0
- package/dist/axios/delete.d.mts +14 -0
- package/dist/axios/delete.mjs +25 -0
- package/dist/axios/get.d.mts +16 -0
- package/dist/axios/get.mjs +24 -0
- package/dist/axios/post.d.mts +18 -0
- package/dist/axios/post.mjs +25 -0
- package/dist/boolean/getBoolean.d.mts +11 -0
- package/dist/boolean/getBoolean.mjs +11 -0
- package/dist/brightData/getCustomerId.d.mts +13 -0
- package/dist/brightData/getCustomerId.mjs +10 -0
- package/dist/brightData/getZone.d.mts +12 -0
- package/dist/brightData/getZone.mjs +10 -0
- package/dist/brightData/param.d.mts +11 -0
- package/dist/brightData/param.mjs +4 -0
- package/dist/brightData/serpApi/buildGoogleSerpUrl.d.mts +34 -0
- package/dist/brightData/serpApi/buildGoogleSerpUrl.mjs +100 -0
- package/dist/brightData/serpApi/buildGoogleTrendsUrl.d.mts +24 -0
- package/dist/brightData/serpApi/buildGoogleTrendsUrl.mjs +51 -0
- package/dist/brightData/serpApi/getAsyncRequestId.d.mts +17 -0
- package/dist/brightData/serpApi/getAsyncRequestId.mjs +35 -0
- package/dist/brightData/serpApi/getAsyncResults.d.mts +15 -0
- package/dist/brightData/serpApi/getAsyncResults.mjs +25 -0
- package/dist/brightData/serpApi/getRealtime.d.mts +13 -0
- package/dist/brightData/serpApi/getRealtime.mjs +25 -0
- package/dist/brightData/serpApi/type.d.mts +13 -0
- package/dist/brightData/serpApi/type.mjs +14 -0
- package/dist/brightData/webScraperIde/getBatch.d.mts +17 -0
- package/dist/brightData/webScraperIde/getBatch.mjs +22 -0
- package/dist/brightData/webScraperIde/getRealtime.d.mts +16 -0
- package/dist/brightData/webScraperIde/getRealtime.mjs +44 -0
- package/dist/chunk-y_GBKt04.mjs +5 -0
- package/dist/class/BaseClass.d.mts +45 -0
- package/dist/class/BaseClass.mjs +46 -0
- package/dist/crypto/getDecrypt.d.mts +16 -0
- package/dist/crypto/getDecrypt.mjs +13 -0
- package/dist/crypto/getEncrypt.d.mts +16 -0
- package/dist/crypto/getEncrypt.mjs +13 -0
- package/dist/crypto/getRandom.d.mts +12 -0
- package/dist/crypto/getRandom.mjs +10 -0
- package/dist/crypto/getSha256.d.mts +12 -0
- package/dist/crypto/getSha256.mjs +13 -0
- package/dist/date/format.d.mts +13 -0
- package/dist/date/format.mjs +17 -0
- package/dist/date/getDate.d.mts +17 -0
- package/dist/date/getDate.mjs +107 -0
- package/dist/date/getDatesBetween.d.mts +16 -0
- package/dist/date/getDatesBetween.mjs +37 -0
- package/dist/date/getDurationHours.d.mts +11 -0
- package/dist/date/getDurationHours.mjs +24 -0
- package/dist/date/getDurationMinutes.d.mts +11 -0
- package/dist/date/getDurationMinutes.mjs +22 -0
- package/dist/date/getFinancialYear.d.mts +12 -0
- package/dist/date/getFinancialYear.mjs +31 -0
- package/dist/date/getFinancialYearToDate.d.mts +10 -0
- package/dist/date/getFinancialYearToDate.mjs +15 -0
- package/dist/date/getFinancialYearToYesterday.d.mts +10 -0
- package/dist/date/getFinancialYearToYesterday.mjs +15 -0
- package/dist/date/getFinancialYearWeeks.d.mts +12 -0
- package/dist/date/getFinancialYearWeeks.mjs +23 -0
- package/dist/date/getLastWeek.d.mts +16 -0
- package/dist/date/getLastWeek.mjs +30 -0
- package/dist/date/getMax.d.mts +16 -0
- package/dist/date/getMax.mjs +21 -0
- package/dist/date/getMidnight.d.mts +2 -0
- package/dist/date/getMidnight.mjs +11 -0
- package/dist/date/getMin.d.mts +16 -0
- package/dist/date/getMin.mjs +21 -0
- package/dist/date/getMonday.d.mts +18 -0
- package/dist/date/getMonday.mjs +31 -0
- package/dist/date/getNumber.d.mts +10 -0
- package/dist/date/getNumber.mjs +17 -0
- package/dist/date/getPredefinedTimeframe.d.mts +13 -0
- package/dist/date/getPredefinedTimeframe.mjs +15 -0
- package/dist/date/getSunday.d.mts +18 -0
- package/dist/date/getSunday.mjs +27 -0
- package/dist/date/getThisWeek.d.mts +16 -0
- package/dist/date/getThisWeek.mjs +36 -0
- package/dist/date/getTimeZoned.d.mts +2 -0
- package/dist/date/getTimeZoned.mjs +53 -0
- package/dist/date/getToday.d.mts +12 -0
- package/dist/date/getToday.mjs +21 -0
- package/dist/date/getTodayYmd.d.mts +7 -0
- package/dist/date/getTodayYmd.mjs +16 -0
- package/dist/date/getTodayYmdhis.d.mts +7 -0
- package/dist/date/getTodayYmdhis.mjs +16 -0
- package/dist/date/getTwoWeeksAgo.d.mts +16 -0
- package/dist/date/getTwoWeeksAgo.mjs +36 -0
- package/dist/date/getWeeksAgo.d.mts +22 -0
- package/dist/date/getWeeksAgo.mjs +22 -0
- package/dist/date/getYesterday.d.mts +15 -0
- package/dist/date/getYesterday.mjs +24 -0
- package/dist/date/index.d.mts +1 -57
- package/dist/date/isDateValid.d.mts +11 -0
- package/dist/date/isDateValid.mjs +16 -0
- package/dist/date/isLastWeek.d.mts +12 -0
- package/dist/date/isLastWeek.mjs +11 -0
- package/dist/date/isThisWeek.d.mts +12 -0
- package/dist/date/isThisWeek.mjs +11 -0
- package/dist/date/parseExcelDate.d.mts +12 -0
- package/dist/date/parseExcelDate.mjs +18 -0
- package/dist/environment/getEnvironment.d.mts +9 -0
- package/dist/environment/getEnvironment.mjs +27 -0
- package/dist/environment/isAws.d.mts +7 -0
- package/dist/environment/isAws.mjs +8 -0
- package/dist/environment/isDevelopment.d.mts +4 -0
- package/dist/environment/isDevelopment.mjs +6 -0
- package/dist/environment/isLocalhost.d.mts +7 -0
- package/dist/environment/isLocalhost.mjs +15 -0
- package/dist/environment/isProduction.d.mts +4 -0
- package/dist/environment/isProduction.mjs +6 -0
- package/dist/environment/isStaging.d.mts +4 -0
- package/dist/environment/isStaging.mjs +6 -0
- package/dist/environment/isVercel.d.mts +7 -0
- package/dist/environment/isVercel.mjs +7 -0
- package/dist/eskimi/ageGroups.d.mts +7 -0
- package/dist/eskimi/ageGroups.mjs +41 -0
- package/dist/eskimi/campaign.d.mts +22 -0
- package/dist/eskimi/campaign.mjs +1 -0
- package/dist/eskimi/devices.d.mts +7 -0
- package/dist/eskimi/devices.mjs +10 -0
- package/dist/eskimi/endpoints.d.mts +18 -0
- package/dist/eskimi/endpoints.mjs +16 -0
- package/dist/eskimi/genders.d.mts +7 -0
- package/dist/eskimi/genders.mjs +10 -0
- package/dist/eskimi/getAccessToken.d.mts +14 -0
- package/dist/eskimi/getAccessToken.mjs +19 -0
- package/dist/eskimi/getAgeGroup.d.mts +11 -0
- package/dist/eskimi/getAgeGroup.mjs +12 -0
- package/dist/eskimi/getCampaignIds.d.mts +11 -0
- package/dist/eskimi/getCampaignIds.mjs +9 -0
- package/dist/eskimi/getData.d.mts +13 -0
- package/dist/eskimi/getData.mjs +20 -0
- package/dist/eskimi/getDevice.d.mts +11 -0
- package/dist/eskimi/getDevice.mjs +12 -0
- package/dist/eskimi/getGender.d.mts +11 -0
- package/dist/eskimi/getGender.mjs +12 -0
- package/dist/file/createDirectory.d.mts +13 -0
- package/dist/file/createDirectory.mjs +16 -0
- package/dist/file/writeFile.d.mts +1 -0
- package/dist/file/writeFile.mjs +1 -0
- package/dist/getMidnight-Cr5sAuOj.d.mts +12 -0
- package/dist/getTimeZoned-D7uY_mE6.d.mts +15 -0
- package/dist/global/forceUpdate.d.mts +12 -0
- package/dist/global/forceUpdate.mjs +16 -0
- package/dist/global/init.d.mts +16 -0
- package/dist/global/init.mjs +16 -0
- package/dist/global/isSet.d.mts +12 -0
- package/dist/global/isSet.mjs +9 -0
- package/dist/global/maxCache.d.mts +12 -0
- package/dist/global/maxCache.mjs +15 -0
- package/dist/global/read.d.mts +12 -0
- package/dist/global/read.mjs +15 -0
- package/dist/global.d.mts +42 -0
- package/dist/google/bigQuery/IsTableExists.d.mts +17 -0
- package/dist/google/bigQuery/IsTableExists.mjs +19 -0
- package/dist/google/bigQuery/createDataset.d.mts +17 -0
- package/dist/google/bigQuery/createDataset.mjs +15 -0
- package/dist/google/bigQuery/createTable.d.mts +20 -0
- package/dist/google/bigQuery/createTable.mjs +21 -0
- package/dist/google/bigQuery/getClient.d.mts +11 -0
- package/dist/google/bigQuery/getClient.mjs +19 -0
- package/dist/google/bigQuery/getDatasets.d.mts +17 -0
- package/dist/google/bigQuery/getDatasets.mjs +17 -0
- package/dist/google/bigQuery/getTables.d.mts +14 -0
- package/dist/google/bigQuery/getTables.mjs +13 -0
- package/dist/google/bigQuery/initClient.d.mts +17 -0
- package/dist/google/bigQuery/initClient.mjs +27 -0
- package/dist/google/bigQuery/isDatasetExists.d.mts +16 -0
- package/dist/google/bigQuery/isDatasetExists.mjs +20 -0
- package/dist/google/bigQuery/loadData.d.mts +23 -0
- package/dist/google/bigQuery/loadData.mjs +20 -0
- package/dist/google/bigQuery/query.d.mts +24 -0
- package/dist/google/bigQuery/query.mjs +10 -0
- package/dist/google/getConfig.d.mts +24 -0
- package/dist/google/getConfig.mjs +21 -0
- package/dist/google/sheets/getAssociatedData.d.mts +18 -0
- package/dist/google/sheets/getAssociatedData.mjs +35 -0
- package/dist/google/sheets/getBatchData.d.mts +23 -0
- package/dist/google/sheets/getBatchData.mjs +15 -0
- package/dist/google/sheets/initClient.d.mts +16 -0
- package/dist/google/sheets/initClient.mjs +21 -0
- package/dist/google/sheets/isCellNa.d.mts +11 -0
- package/dist/google/sheets/isCellNa.mjs +7 -0
- package/dist/google/storage/copyToCloud.d.mts +18 -0
- package/dist/google/storage/copyToCloud.mjs +10 -0
- package/dist/google/storage/getClient.d.mts +12 -0
- package/dist/google/storage/getClient.mjs +19 -0
- package/dist/google/storage/initClient.d.mts +18 -0
- package/dist/google/storage/initClient.mjs +27 -0
- package/dist/google/storage/isFileExists.d.mts +12 -0
- package/dist/google/storage/isFileExists.mjs +11 -0
- package/dist/google/storage/writeFile.d.mts +13 -0
- package/dist/google/storage/writeFile.mjs +28 -0
- package/dist/googleAds/getCustomer.d.mts +12 -0
- package/dist/googleAds/getCustomer.mjs +13 -0
- package/dist/googleAds/initClient.d.mts +20 -0
- package/dist/googleAds/initClient.mjs +25 -0
- package/dist/googleAds/keywordPlanner/request.d.mts +21 -0
- package/dist/googleAds/keywordPlanner/request.mjs +13 -0
- package/dist/googleAds/keywordPlanner/response.d.mts +28 -0
- package/dist/googleAds/keywordPlanner/response.mjs +1 -0
- package/dist/index-CiGy7MyK.d.mts +58 -0
- package/dist/index-gGQBTUJU.d.mts +12 -0
- package/dist/initClients.d.mts +46 -0
- package/dist/initClients.mjs +56 -0
- package/dist/json/getJsonNewline.d.mts +9 -0
- package/dist/json/getJsonNewline.mjs +7 -0
- package/dist/json/isJson.d.mts +12 -0
- package/dist/json/isJson.mjs +17 -0
- package/dist/littleWarden/getUrlStatus.d.mts +14 -0
- package/dist/littleWarden/getUrlStatus.mjs +16 -0
- package/dist/littleWarden/isAllGood.d.mts +11 -0
- package/dist/littleWarden/isAllGood.mjs +12 -0
- package/dist/littleWarden/isDanger.d.mts +11 -0
- package/dist/littleWarden/isDanger.mjs +12 -0
- package/dist/littleWarden/isWarning.d.mts +11 -0
- package/dist/littleWarden/isWarning.mjs +12 -0
- package/dist/lumar/api/buildRequest.d.mts +28 -0
- package/dist/lumar/api/buildRequest.mjs +58 -0
- package/dist/lumar/api/filter.d.mts +8 -0
- package/dist/lumar/api/filter.mjs +1 -0
- package/dist/lumar/api/getData.d.mts +11 -0
- package/dist/lumar/api/getData.mjs +10 -0
- package/dist/lumar/api/initClient.d.mts +17 -0
- package/dist/lumar/api/initClient.mjs +28 -0
- package/dist/lumar/api/operands.d.mts +13 -0
- package/dist/lumar/api/operands.mjs +13 -0
- package/dist/lumar/api/orders.d.mts +11 -0
- package/dist/lumar/api/orders.mjs +7 -0
- package/dist/lumar/api/reports.d.mts +13 -0
- package/dist/lumar/api/reports.mjs +13 -0
- package/dist/lumar/graphql/columns.d.mts +31 -0
- package/dist/lumar/graphql/columns.mjs +31 -0
- package/dist/lumar/graphql/getData.d.mts +15 -0
- package/dist/lumar/graphql/getData.mjs +18 -0
- package/dist/lumar/graphql/getReportKey.d.mts +14 -0
- package/dist/lumar/graphql/getReportKey.mjs +9 -0
- package/dist/lumar/graphql/initClient.d.mts +16 -0
- package/dist/lumar/graphql/initClient.mjs +34 -0
- package/dist/lumar/graphql/operands.d.mts +18 -0
- package/dist/lumar/graphql/operands.mjs +18 -0
- package/dist/lumar/graphql/queries/crawl.d.mts +8 -0
- package/dist/lumar/graphql/queries/crawl.mjs +1 -0
- package/dist/lumar/graphql/queries/getCrawls.d.mts +23 -0
- package/dist/lumar/graphql/queries/getCrawls.mjs +33 -0
- package/dist/lumar/graphql/queries/getReportDifferences.d.mts +30 -0
- package/dist/lumar/graphql/queries/getReportDifferences.mjs +37 -0
- package/dist/lumar/graphql/queries/getRows.d.mts +50 -0
- package/dist/lumar/graphql/queries/getRows.mjs +57 -0
- package/dist/lumar/graphql/queries/getTotals.d.mts +33 -0
- package/dist/lumar/graphql/queries/getTotals.mjs +40 -0
- package/dist/lumar/graphql/queries/row.d.mts +159 -0
- package/dist/lumar/graphql/queries/row.mjs +1 -0
- package/dist/lumar/graphql/reportTemplates.d.mts +70 -0
- package/dist/lumar/graphql/reportTemplates.mjs +70 -0
- package/dist/lumar/graphql/reportTypes.d.mts +9 -0
- package/dist/lumar/graphql/reportTypes.mjs +9 -0
- package/dist/myTarget/getAccessToken.d.mts +14 -0
- package/dist/myTarget/getAccessToken.mjs +19 -0
- package/dist/myTarget/request.d.mts +15 -0
- package/dist/myTarget/request.mjs +17 -0
- package/dist/nextAuth/isSessionReady.d.mts +8 -0
- package/dist/nextAuth/isSessionReady.mjs +10 -0
- package/dist/nextJs/getIp.d.mts +11 -0
- package/dist/nextJs/getIp.mjs +11 -0
- package/dist/nextJs/getUserAgent.d.mts +11 -0
- package/dist/nextJs/getUserAgent.mjs +7 -0
- package/dist/number/format.d.mts +13 -0
- package/dist/number/format.mjs +16 -0
- package/dist/number/getCurrency.d.mts +15 -0
- package/dist/number/getCurrency.mjs +17 -0
- package/dist/number/getDecimal.d.mts +11 -0
- package/dist/number/getDecimal.mjs +11 -0
- package/dist/number/getDivide.d.mts +13 -0
- package/dist/number/getDivide.mjs +17 -0
- package/dist/number/getNumber.d.mts +13 -0
- package/dist/number/getNumber.mjs +23 -0
- package/dist/number/getPercentIncrease.d.mts +16 -0
- package/dist/number/getPercentIncrease.mjs +13 -0
- package/dist/object/replaceKeys.d.mts +15 -0
- package/dist/object/replaceKeys.mjs +27 -0
- package/dist/prisma/getDecimal.d.mts +11 -0
- package/dist/prisma/getDecimal.mjs +17 -0
- package/dist/prisma/initClient.d.mts +8 -0
- package/dist/prisma/initClient.mjs +25 -0
- package/dist/response-CKsarnP-.d.mts +11 -0
- package/dist/snapchat/getAccessToken.d.mts +14 -0
- package/dist/snapchat/getAccessToken.mjs +29 -0
- package/dist/sorting/byNumberAscending.d.mts +13 -0
- package/dist/sorting/byNumberAscending.mjs +13 -0
- package/dist/sorting/byNumberDescending.d.mts +13 -0
- package/dist/sorting/byNumberDescending.mjs +13 -0
- package/dist/sorting/byStringAscending.d.mts +13 -0
- package/dist/sorting/byStringAscending.mjs +13 -0
- package/dist/sorting/byStringDescending.d.mts +13 -0
- package/dist/sorting/byStringDescending.mjs +13 -0
- package/dist/stream/sort.d.mts +16 -0
- package/dist/stream/sort.mjs +46 -0
- package/dist/string/getCapitalised.d.mts +15 -0
- package/dist/string/getCapitalised.mjs +13 -0
- package/dist/string/getClean.d.mts +32 -0
- package/dist/string/getClean.mjs +28 -0
- package/dist/string/getDecoded.d.mts +14 -0
- package/dist/string/getDecoded.mjs +19 -0
- package/dist/string/getFolder.d.mts +12 -0
- package/dist/string/getFolder.mjs +10 -0
- package/dist/string/getProperCase.d.mts +13 -0
- package/dist/string/getProperCase.mjs +14 -0
- package/dist/string/getString.d.mts +11 -0
- package/dist/string/getString.mjs +18 -0
- package/dist/string/getStringFromStream.d.mts +12 -0
- package/dist/string/getStringFromStream.mjs +15 -0
- package/dist/string/getWithoutAccents.d.mts +13 -0
- package/dist/string/getWithoutAccents.mjs +11 -0
- package/dist/string/getWithoutHtmlTags.d.mts +13 -0
- package/dist/string/getWithoutHtmlTags.mjs +11 -0
- package/dist/string/getWithoutPunctuation.d.mts +13 -0
- package/dist/string/getWithoutPunctuation.mjs +11 -0
- package/dist/string/getWithoutUnderscores.d.mts +12 -0
- package/dist/string/getWithoutUnderscores.mjs +10 -0
- package/dist/string/getWithoutWhitespaces.d.mts +13 -0
- package/dist/string/getWithoutWhitespaces.mjs +11 -0
- package/dist/swr/isAllData.d.mts +11 -0
- package/dist/swr/isAllData.mjs +12 -0
- package/dist/swr/isAnyError.d.mts +11 -0
- package/dist/swr/isAnyError.mjs +12 -0
- package/dist/swr/isAnyLoading.d.mts +11 -0
- package/dist/swr/isAnyLoading.mjs +12 -0
- package/dist/swr/isData.d.mts +11 -0
- package/dist/swr/isData.mjs +7 -0
- package/dist/swr/isError.d.mts +11 -0
- package/dist/swr/isError.mjs +7 -0
- package/dist/swr/isLoading.d.mts +11 -0
- package/dist/swr/isLoading.mjs +9 -0
- package/dist/upTimeRobot/getMonitors.d.mts +1 -0
- package/dist/upTimeRobot/getMonitors.mjs +3 -0
- package/dist/upTimeRobot/logTypes.d.mts +9 -0
- package/dist/upTimeRobot/logTypes.mjs +9 -0
- package/dist/upTimeRobot/monitorStatuses.d.mts +10 -0
- package/dist/upTimeRobot/monitorStatuses.mjs +10 -0
- package/dist/upTimeRobot/monitorSubTypes.d.mts +12 -0
- package/dist/upTimeRobot/monitorSubTypes.mjs +12 -0
- package/dist/upTimeRobot/monitorTypes.d.mts +10 -0
- package/dist/upTimeRobot/monitorTypes.mjs +10 -0
- package/dist/upTimeRobot/requestStatuses.d.mts +7 -0
- package/dist/upTimeRobot/requestStatuses.mjs +7 -0
- package/dist/url/buildParameters.d.mts +13 -0
- package/dist/url/buildParameters.mjs +17 -0
- package/dist/url/buildRelative.d.mts +13 -0
- package/dist/url/buildRelative.mjs +13 -0
- package/dist/url/buildUrl.d.mts +16 -0
- package/dist/url/buildUrl.mjs +18 -0
- package/dist/url/isAbsolute.d.mts +11 -0
- package/dist/url/isAbsolute.mjs +14 -0
- package/dist/url/isRelative.d.mts +11 -0
- package/dist/url/isRelative.mjs +7 -0
- package/dist/url/url.d.mts +9 -0
- package/dist/url/url.mjs +1 -0
- package/dist/url/writeUrlContents.d.mts +16 -0
- package/dist/url/writeUrlContents.mjs +30 -0
- package/dist/util/defaultTo.d.mts +12 -0
- package/dist/util/defaultTo.mjs +20 -0
- package/dist/util/getBrotliCompressed.d.mts +14 -0
- package/dist/util/getBrotliCompressed.mjs +15 -0
- package/dist/util/getBrotliDecompressed.d.mts +14 -0
- package/dist/util/getBrotliDecompressed.mjs +17 -0
- package/dist/util/getClean.d.mts +18 -0
- package/dist/util/getClean.mjs +15 -0
- package/dist/util/getGzipCompressed.d.mts +14 -0
- package/dist/util/getGzipCompressed.mjs +15 -0
- package/dist/util/getGzipDecompressed.d.mts +14 -0
- package/dist/util/getGzipDecompressed.mjs +17 -0
- package/dist/util/getWithoutHash.d.mts +12 -0
- package/dist/util/getWithoutHash.mjs +14 -0
- package/dist/util/getWithoutParameter.d.mts +12 -0
- package/dist/util/getWithoutParameter.mjs +14 -0
- package/dist/util/isUndefined.d.mts +14 -0
- package/dist/util/isUndefined.mjs +15 -0
- package/dist/util/promiseChunks.d.mts +12 -0
- package/dist/util/promiseChunks.mjs +18 -0
- package/dist/util/sleep.d.mts +7 -0
- package/dist/util/sleep.mjs +6 -0
- package/dist/xml/getXml.d.mts +7 -0
- package/dist/xml/getXml.mjs +14 -0
- package/package.json +247 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Param } from "./param.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/brightData/getCustomerId.d.ts
|
|
4
|
+
type GetCustomerId = {
|
|
5
|
+
auth: Param;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Return the customer Id based on the username.
|
|
10
|
+
*/
|
|
11
|
+
declare const getCustomerId: (props: GetCustomerId) => string;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { getCustomerId as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/brightData/getCustomerId.ts
|
|
2
|
+
/**
|
|
3
|
+
* Return the customer Id based on the username.
|
|
4
|
+
*/
|
|
5
|
+
const getCustomerId = (props) => {
|
|
6
|
+
const customerId = props.auth.username.split("-")[2][2].replace("hl_", "");
|
|
7
|
+
return (props?.prefix || "") + customerId;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getCustomerId as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Param } from "./param.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/brightData/getZone.d.ts
|
|
4
|
+
type GetZone = {
|
|
5
|
+
auth: Param;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Return the Zone based on the username.
|
|
9
|
+
*/
|
|
10
|
+
declare const getZone: (props: GetZone) => string;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getZone as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/brightData/getZone.ts
|
|
2
|
+
/**
|
|
3
|
+
* Return the Zone based on the username.
|
|
4
|
+
*/
|
|
5
|
+
const getZone = (props) => {
|
|
6
|
+
const segments = props.auth.username.split("-");
|
|
7
|
+
return segments[segments.length - 1];
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { getZone as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/brightData/serpApi/buildGoogleSerpUrl.d.ts
|
|
2
|
+
type BuildGoogleSerpUrl = {
|
|
3
|
+
country?: string;
|
|
4
|
+
device?: "mobile" | "android" | "androidTablet" | "iphone" | "ipad";
|
|
5
|
+
language?: string;
|
|
6
|
+
geoLocation?: string;
|
|
7
|
+
hotel?: {
|
|
8
|
+
dates?: string;
|
|
9
|
+
occupancy?: number;
|
|
10
|
+
};
|
|
11
|
+
pagination?: {
|
|
12
|
+
offset?: number;
|
|
13
|
+
perPage?: number;
|
|
14
|
+
};
|
|
15
|
+
searchType?: "images" | "jobs" | "news" | "shopping" | "video";
|
|
16
|
+
query: string;
|
|
17
|
+
googleDomain: string;
|
|
18
|
+
output?: "html" | "json";
|
|
19
|
+
returnType: "url" | "json";
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Construct the Google SERP url using Bright Data's API:
|
|
23
|
+
* https://brightdata.com/cp/serp_api/api/google/search?id=c_2cef083f
|
|
24
|
+
*
|
|
25
|
+
* For geolocation use value from:
|
|
26
|
+
* https://developers.google.com/google-ads/api/data/geotargets
|
|
27
|
+
*/
|
|
28
|
+
declare const buildGoogleSerpUrl: (props: BuildGoogleSerpUrl) => string | {
|
|
29
|
+
query: {
|
|
30
|
+
q: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { buildGoogleSerpUrl as default };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//#region src/brightData/serpApi/buildGoogleSerpUrl.ts
|
|
2
|
+
/**
|
|
3
|
+
* Construct the Google SERP url using Bright Data's API:
|
|
4
|
+
* https://brightdata.com/cp/serp_api/api/google/search?id=c_2cef083f
|
|
5
|
+
*
|
|
6
|
+
* For geolocation use value from:
|
|
7
|
+
* https://developers.google.com/google-ads/api/data/geotargets
|
|
8
|
+
*/
|
|
9
|
+
const buildGoogleSerpUrl = (props) => {
|
|
10
|
+
let url = new URL(`https://www.${props.googleDomain}/search`);
|
|
11
|
+
let params = { query: { q: props.query } };
|
|
12
|
+
url.searchParams.append("q", props.query);
|
|
13
|
+
if (props?.country) {
|
|
14
|
+
params.query["gl"] = props.country;
|
|
15
|
+
url.searchParams.append("gl", props.country);
|
|
16
|
+
}
|
|
17
|
+
switch (props?.device) {
|
|
18
|
+
case "mobile":
|
|
19
|
+
params.query["brd_mobile"] = "1";
|
|
20
|
+
url.searchParams.append("brd_mobile", "1");
|
|
21
|
+
break;
|
|
22
|
+
case "android":
|
|
23
|
+
params.query["brd_mobile"] = "android";
|
|
24
|
+
url.searchParams.append("brd_mobile", "android");
|
|
25
|
+
break;
|
|
26
|
+
case "androidTablet":
|
|
27
|
+
params.query["brd_mobile"] = "android_tablet";
|
|
28
|
+
url.searchParams.append("brd_mobile", "android_tablet");
|
|
29
|
+
break;
|
|
30
|
+
case "ipad":
|
|
31
|
+
params.query["brd_mobile"] = "ipad";
|
|
32
|
+
url.searchParams.append("brd_mobile", "ipad");
|
|
33
|
+
break;
|
|
34
|
+
case "iphone":
|
|
35
|
+
params.query["brd_mobile"] = "ios";
|
|
36
|
+
url.searchParams.append("brd_mobile", "ios");
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
if (props?.geoLocation) {
|
|
40
|
+
params.query["uule"] = props.geoLocation;
|
|
41
|
+
url.searchParams.append("uule", props.geoLocation);
|
|
42
|
+
}
|
|
43
|
+
if (props?.hotel) {
|
|
44
|
+
if (props.hotel?.dates) {
|
|
45
|
+
params.query["hotel_dates"] = props.hotel.dates.toString();
|
|
46
|
+
url.searchParams.append("hotel_dates", props.hotel.dates);
|
|
47
|
+
}
|
|
48
|
+
if (props.hotel?.occupancy) {
|
|
49
|
+
params.query["hotel_occupancy"] = props.hotel.occupancy.toString();
|
|
50
|
+
url.searchParams.append("hotel_occupancy", props.hotel.occupancy.toString());
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (props?.language) {
|
|
54
|
+
params.query["uule"] = props.language;
|
|
55
|
+
url.searchParams.append("hl", props.language);
|
|
56
|
+
}
|
|
57
|
+
switch (props?.searchType) {
|
|
58
|
+
case "images":
|
|
59
|
+
params.query["tbm"] = "isch";
|
|
60
|
+
url.searchParams.append("tbm", "isch");
|
|
61
|
+
break;
|
|
62
|
+
case "jobs":
|
|
63
|
+
params.query["ibp"] = "htl;jobs";
|
|
64
|
+
url.searchParams.append("ibp", "htl;jobs");
|
|
65
|
+
break;
|
|
66
|
+
case "news":
|
|
67
|
+
params.query["tbm"] = "nws";
|
|
68
|
+
url.searchParams.append("tbm", "nws");
|
|
69
|
+
break;
|
|
70
|
+
case "shopping":
|
|
71
|
+
params.query["tbm"] = "shop";
|
|
72
|
+
url.searchParams.append("tbm", "shop");
|
|
73
|
+
break;
|
|
74
|
+
case "video":
|
|
75
|
+
params.query["tbm"] = "vid";
|
|
76
|
+
url.searchParams.append("tbm", "vid");
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
if (props?.pagination) {
|
|
80
|
+
if (props.pagination?.offset) {
|
|
81
|
+
params.query["start"] = props.pagination.offset.toString();
|
|
82
|
+
url.searchParams.append("start", props.pagination.offset.toString());
|
|
83
|
+
}
|
|
84
|
+
if (props.pagination?.perPage) {
|
|
85
|
+
params.query["num"] = props.pagination.offset.toString();
|
|
86
|
+
url.searchParams.append("num", props.pagination.perPage.toString());
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if ("json" === props.output) {
|
|
90
|
+
params["brd_json"] = "1";
|
|
91
|
+
url.searchParams.append("brn_json", "1");
|
|
92
|
+
} else {
|
|
93
|
+
params["brd_json"] = "html";
|
|
94
|
+
url.searchParams.append("brn_json", "html");
|
|
95
|
+
}
|
|
96
|
+
if ("json" === props.returnType) return params;
|
|
97
|
+
return url.toString();
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
export { buildGoogleSerpUrl as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/brightData/serpApi/buildGoogleTrendsUrl.d.ts
|
|
2
|
+
type BuildGoogleTrendsUrl = {
|
|
3
|
+
country?: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
category?: string;
|
|
6
|
+
date?: string;
|
|
7
|
+
searchType?: "images" | "news" | "shopping" | "youtube";
|
|
8
|
+
query: string;
|
|
9
|
+
returnType: "url" | "json";
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Construct the Google Trends url using Bright Data's API:
|
|
13
|
+
* https://brightdata.com/cp/serp_api/api/google/trends?id=c_2cef083f
|
|
14
|
+
*
|
|
15
|
+
* For category use value from:
|
|
16
|
+
* https://trends.google.com/trends/api/explore/pickers/category?lang=en-US&tz=240
|
|
17
|
+
*/
|
|
18
|
+
declare const buildGoogleTrendsUrl: (props: BuildGoogleTrendsUrl) => string | {
|
|
19
|
+
query: {
|
|
20
|
+
q: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { buildGoogleTrendsUrl as default };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/brightData/serpApi/buildGoogleTrendsUrl.ts
|
|
2
|
+
/**
|
|
3
|
+
* Construct the Google Trends url using Bright Data's API:
|
|
4
|
+
* https://brightdata.com/cp/serp_api/api/google/trends?id=c_2cef083f
|
|
5
|
+
*
|
|
6
|
+
* For category use value from:
|
|
7
|
+
* https://trends.google.com/trends/api/explore/pickers/category?lang=en-US&tz=240
|
|
8
|
+
*/
|
|
9
|
+
const buildGoogleTrendsUrl = (props) => {
|
|
10
|
+
let url = new URL(`http://trends.google.com/trends/explore`);
|
|
11
|
+
url.searchParams.append("q", props.query);
|
|
12
|
+
let params = { query: { q: props.query } };
|
|
13
|
+
if (props?.country) {
|
|
14
|
+
params.query["geo"] = props.country;
|
|
15
|
+
url.searchParams.append("geo", props.country);
|
|
16
|
+
}
|
|
17
|
+
if (props?.language) {
|
|
18
|
+
params.query["hl"] = props.language;
|
|
19
|
+
url.searchParams.append("hl", props.language);
|
|
20
|
+
}
|
|
21
|
+
if (props?.category) {
|
|
22
|
+
params.query["cat"] = props.category;
|
|
23
|
+
url.searchParams.append("cat", props.category);
|
|
24
|
+
}
|
|
25
|
+
if (props?.date) {
|
|
26
|
+
params.query["date"] = props.date;
|
|
27
|
+
url.searchParams.append("date", props.date);
|
|
28
|
+
}
|
|
29
|
+
switch (props?.searchType) {
|
|
30
|
+
case "images":
|
|
31
|
+
params.query["group"] = "images";
|
|
32
|
+
url.searchParams.append("gprop", "images");
|
|
33
|
+
break;
|
|
34
|
+
case "news":
|
|
35
|
+
params.query["group"] = "news";
|
|
36
|
+
url.searchParams.append("gprop", "news");
|
|
37
|
+
break;
|
|
38
|
+
case "shopping":
|
|
39
|
+
params.query["group"] = "froogle";
|
|
40
|
+
url.searchParams.append("gprop", "froogle");
|
|
41
|
+
break;
|
|
42
|
+
case "youtube":
|
|
43
|
+
params.query["group"] = "youtube";
|
|
44
|
+
url.searchParams.append("gprop", "youtube");
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
if ("json" === props.returnType) return params;
|
|
48
|
+
return url.toString();
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { buildGoogleTrendsUrl as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Param } from "../param.mjs";
|
|
2
|
+
import { Type } from "./type.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/brightData/serpApi/getAsyncRequestId.d.ts
|
|
5
|
+
type GetAsyncRequestId = {
|
|
6
|
+
auth: Param;
|
|
7
|
+
data: object;
|
|
8
|
+
type: Type;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Make an async request to the SERP API using the Bright Data proxy.
|
|
12
|
+
* Returns a request ID used with getAsyncResults
|
|
13
|
+
* https://docs.brightdata.com/scraping-automation/serp-api/asynchronous-requests
|
|
14
|
+
*/
|
|
15
|
+
declare const getAsyncRequestId: (props: GetAsyncRequestId) => Promise<string>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { getAsyncRequestId as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import post from "../../axios/post.mjs";
|
|
2
|
+
import getCustomerId from "../getCustomerId.mjs";
|
|
3
|
+
import getZone from "../getZone.mjs";
|
|
4
|
+
import { Type } from "./type.mjs";
|
|
5
|
+
//#region src/brightData/serpApi/getAsyncRequestId.ts
|
|
6
|
+
/**
|
|
7
|
+
* Make an async request to the SERP API using the Bright Data proxy.
|
|
8
|
+
* Returns a request ID used with getAsyncResults
|
|
9
|
+
* https://docs.brightdata.com/scraping-automation/serp-api/asynchronous-requests
|
|
10
|
+
*/
|
|
11
|
+
const getAsyncRequestId = async (props) => {
|
|
12
|
+
let url = "";
|
|
13
|
+
let response = "";
|
|
14
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
15
|
+
const customerId = getCustomerId({ auth: props.auth });
|
|
16
|
+
const zone = getZone({ auth: props.auth });
|
|
17
|
+
switch (props.type) {
|
|
18
|
+
case Type.GOOGLE_TRENDS:
|
|
19
|
+
url = `https://api.brightdata.com/serp/trends?customer=${customerId}&zone=${zone}`;
|
|
20
|
+
break;
|
|
21
|
+
default: url = `https://api.brightdata.com/serp/req?customer=${customerId}&zone=${zone}`;
|
|
22
|
+
}
|
|
23
|
+
const requestResponse = await post({
|
|
24
|
+
config: { headers: { Authorization: `Bearer ${props.auth.apiKey}` } },
|
|
25
|
+
data: props?.data || {},
|
|
26
|
+
url
|
|
27
|
+
});
|
|
28
|
+
if (requestResponse.isSuccess()) response = requestResponse.getBodyDefaultTo({
|
|
29
|
+
defaultValue: "",
|
|
30
|
+
keys: ["response_id"]
|
|
31
|
+
});
|
|
32
|
+
return response;
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { getAsyncRequestId as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import ApiResponse from "../../api/ApiResponse.mjs";
|
|
2
|
+
import { Param } from "../param.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/brightData/serpApi/getAsyncResults.d.ts
|
|
5
|
+
type GetAsync = {
|
|
6
|
+
auth: Param;
|
|
7
|
+
requestId: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Using the request ID from getAsyncRequestId fetch to see if the data is available.
|
|
11
|
+
* https://docs.brightdata.com/scraping-automation/serp-api/asynchronous-requests
|
|
12
|
+
*/
|
|
13
|
+
declare const getAsyncResults: (props: GetAsync) => Promise<ApiResponse>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getAsyncResults as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import ApiResponse from "../../api/ApiResponse.mjs";
|
|
2
|
+
import get from "../../axios/get.mjs";
|
|
3
|
+
import getCustomerId from "../getCustomerId.mjs";
|
|
4
|
+
import getZone from "../getZone.mjs";
|
|
5
|
+
//#region src/brightData/serpApi/getAsyncResults.ts
|
|
6
|
+
/**
|
|
7
|
+
* Using the request ID from getAsyncRequestId fetch to see if the data is available.
|
|
8
|
+
* https://docs.brightdata.com/scraping-automation/serp-api/asynchronous-requests
|
|
9
|
+
*/
|
|
10
|
+
const getAsyncResults = async (props) => {
|
|
11
|
+
let response = new ApiResponse();
|
|
12
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
13
|
+
const customerId = getCustomerId({ auth: props.auth });
|
|
14
|
+
const zone = getZone({ auth: props.auth });
|
|
15
|
+
const requestResponse = await get({
|
|
16
|
+
config: { headers: { Authorization: `Bearer ${props.auth.apiKey}` } },
|
|
17
|
+
url: `https://api.brightdata.com/serp/get_result?customer=${customerId}&zone=${zone}&response_id=${props.requestId}`
|
|
18
|
+
});
|
|
19
|
+
if (requestResponse.isSuccess()) if ("Request is pending" === requestResponse.getBody()) response.setToPending();
|
|
20
|
+
else response.setToSuccess({ body: requestResponse.getBody() });
|
|
21
|
+
else response.setToError({ error: "Error in request" });
|
|
22
|
+
return response;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { getAsyncResults as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Param } from "../param.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/brightData/serpApi/getRealtime.d.ts
|
|
4
|
+
type GetRealtime = {
|
|
5
|
+
auth: Param;
|
|
6
|
+
url: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Make a request to the SERP API using the Bright Data proxy
|
|
10
|
+
*/
|
|
11
|
+
declare const getRealtime: (props: GetRealtime) => Promise<{}>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { getRealtime as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import get from "../../axios/get.mjs";
|
|
2
|
+
//#region src/brightData/serpApi/getRealtime.ts
|
|
3
|
+
/**
|
|
4
|
+
* Make a request to the SERP API using the Bright Data proxy
|
|
5
|
+
*/
|
|
6
|
+
const getRealtime = async (props) => {
|
|
7
|
+
let response = {};
|
|
8
|
+
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
9
|
+
const apiResponse = await get({
|
|
10
|
+
config: { proxy: {
|
|
11
|
+
protocol: "http",
|
|
12
|
+
host: props.auth.host,
|
|
13
|
+
port: props.auth.port,
|
|
14
|
+
auth: {
|
|
15
|
+
username: props.auth.username,
|
|
16
|
+
password: props.auth.password
|
|
17
|
+
}
|
|
18
|
+
} },
|
|
19
|
+
url: props.url
|
|
20
|
+
});
|
|
21
|
+
if (apiResponse.isSuccess()) response = apiResponse.getBody();
|
|
22
|
+
return response;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { getRealtime as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/brightData/serpApi/type.d.ts
|
|
2
|
+
declare enum Type {
|
|
3
|
+
GOOGLE_FLIGHTS = "GOOGLE_FLIGHTS",
|
|
4
|
+
GOOGLE_HOTELS = "GOOGLE_HOTELS",
|
|
5
|
+
GOOGLE_LENS = "GOOGLE_LENS",
|
|
6
|
+
GOOGLE_MAPS = "GOOGLE_MAPS",
|
|
7
|
+
GOOGLE_REVIEWS = "GOOGLE_REVIEWS",
|
|
8
|
+
GOOGLE_SEARCH = "GOOGLE_SEARCH",
|
|
9
|
+
GOOGLE_TRENDS = "GOOGLE_TRENDS"
|
|
10
|
+
}
|
|
11
|
+
declare const _default: {};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Type, _default as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/brightData/serpApi/type.ts
|
|
2
|
+
let Type = /* @__PURE__ */ function(Type) {
|
|
3
|
+
Type["GOOGLE_FLIGHTS"] = "GOOGLE_FLIGHTS";
|
|
4
|
+
Type["GOOGLE_HOTELS"] = "GOOGLE_HOTELS";
|
|
5
|
+
Type["GOOGLE_LENS"] = "GOOGLE_LENS";
|
|
6
|
+
Type["GOOGLE_MAPS"] = "GOOGLE_MAPS";
|
|
7
|
+
Type["GOOGLE_REVIEWS"] = "GOOGLE_REVIEWS";
|
|
8
|
+
Type["GOOGLE_SEARCH"] = "GOOGLE_SEARCH";
|
|
9
|
+
Type["GOOGLE_TRENDS"] = "GOOGLE_TRENDS";
|
|
10
|
+
return Type;
|
|
11
|
+
}({});
|
|
12
|
+
var type_default = {};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Type, type_default as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Param } from "../param.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/brightData/webScraperIde/getBatch.d.ts
|
|
4
|
+
type GetBatch = {
|
|
5
|
+
auth: Param;
|
|
6
|
+
data?: object;
|
|
7
|
+
scraperId: string;
|
|
8
|
+
isDev?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Depends on the Scraper setup!
|
|
12
|
+
*
|
|
13
|
+
* Make the request to trigger the scraper and let it do its job.
|
|
14
|
+
*/
|
|
15
|
+
declare const getBatch: (props: GetBatch) => Promise<boolean>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { getBatch as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import post from "../../axios/post.mjs";
|
|
2
|
+
//#region src/brightData/webScraperIde/getBatch.ts
|
|
3
|
+
/**
|
|
4
|
+
* Depends on the Scraper setup!
|
|
5
|
+
*
|
|
6
|
+
* Make the request to trigger the scraper and let it do its job.
|
|
7
|
+
*/
|
|
8
|
+
const getBatch = async (props) => {
|
|
9
|
+
let response = false;
|
|
10
|
+
const requestUrl = new URL("https://api.brightdata.com/dca/trigger");
|
|
11
|
+
requestUrl.searchParams.append("collector", props.scraperId);
|
|
12
|
+
requestUrl.searchParams.append("queue_next", "1");
|
|
13
|
+
if (props.isDev) requestUrl.searchParams.append("version", "dev");
|
|
14
|
+
if ((await post({
|
|
15
|
+
config: { headers: { Authorization: `Bearer ${props.auth.apiKey}` } },
|
|
16
|
+
data: props?.data || {},
|
|
17
|
+
url: requestUrl.toString()
|
|
18
|
+
})).isSuccess()) response = true;
|
|
19
|
+
return response;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { getBatch as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Param } from "../param.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/brightData/webScraperIde/getRealtime.d.ts
|
|
4
|
+
type GetRealtime = {
|
|
5
|
+
auth: Param;
|
|
6
|
+
data?: object;
|
|
7
|
+
scraperId: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Depends on the Scraper setup!
|
|
11
|
+
*
|
|
12
|
+
* Make the request and pool the response until the data is available.
|
|
13
|
+
*/
|
|
14
|
+
declare const getRealtime: (props: GetRealtime) => Promise<{}>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { getRealtime as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { State } from "../../api/index.mjs";
|
|
2
|
+
import post from "../../axios/post.mjs";
|
|
3
|
+
import get from "../../axios/get.mjs";
|
|
4
|
+
import sleep from "../../util/sleep.mjs";
|
|
5
|
+
//#region src/brightData/webScraperIde/getRealtime.ts
|
|
6
|
+
/**
|
|
7
|
+
* Depends on the Scraper setup!
|
|
8
|
+
*
|
|
9
|
+
* Make the request and pool the response until the data is available.
|
|
10
|
+
*/
|
|
11
|
+
const getRealtime = async (props) => {
|
|
12
|
+
let response = {};
|
|
13
|
+
const requestUrl = `https://api.brightdata.com/dca/trigger_immediate?collector=${props.scraperId}`;
|
|
14
|
+
const requestResponse = await post({
|
|
15
|
+
config: { headers: { Authorization: `Bearer ${props.auth.apiKey}` } },
|
|
16
|
+
data: props?.data || {},
|
|
17
|
+
url: requestUrl
|
|
18
|
+
});
|
|
19
|
+
if (requestResponse.isSuccess()) {
|
|
20
|
+
const responseId = requestResponse.getBodyDefaultTo({
|
|
21
|
+
defaultValue: "",
|
|
22
|
+
keys: ["response_id"]
|
|
23
|
+
});
|
|
24
|
+
if ("" !== responseId) {
|
|
25
|
+
let state = State.PENDING;
|
|
26
|
+
while (State.PENDING === state) {
|
|
27
|
+
const resultUrl = `https://api.brightdata.com/dca/get_result?response_id=${responseId}`;
|
|
28
|
+
const resultResponse = await get({
|
|
29
|
+
config: { headers: { Authorization: `Bearer ${props.auth.apiKey}` } },
|
|
30
|
+
url: resultUrl
|
|
31
|
+
});
|
|
32
|
+
if (resultResponse.isSuccess()) if (void 0 !== resultResponse.body.pending && true === resultResponse.body.pending) state = State.PENDING;
|
|
33
|
+
else {
|
|
34
|
+
state = State.SUCCESS;
|
|
35
|
+
response = resultResponse.getBody();
|
|
36
|
+
}
|
|
37
|
+
await sleep({ seconds: 1 });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return response;
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { getRealtime as default };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/class/BaseClass.d.ts
|
|
2
|
+
declare class BaseClass {
|
|
3
|
+
/**
|
|
4
|
+
* Shortcut to set a value to an array and return the instance.
|
|
5
|
+
*/
|
|
6
|
+
protected _setArray({
|
|
7
|
+
input,
|
|
8
|
+
fields
|
|
9
|
+
}: {
|
|
10
|
+
input: any | any[];
|
|
11
|
+
fields: any | any[];
|
|
12
|
+
}): this;
|
|
13
|
+
/**
|
|
14
|
+
* Shortcut to set a value and return the instance.
|
|
15
|
+
*/
|
|
16
|
+
protected _setValue({
|
|
17
|
+
input,
|
|
18
|
+
fields
|
|
19
|
+
}: {
|
|
20
|
+
input: any;
|
|
21
|
+
fields: any | any[];
|
|
22
|
+
}): this;
|
|
23
|
+
/**
|
|
24
|
+
* Shortcut to add a value to an existing array.
|
|
25
|
+
*/
|
|
26
|
+
protected _push({
|
|
27
|
+
input,
|
|
28
|
+
fields
|
|
29
|
+
}: {
|
|
30
|
+
input: any | any[];
|
|
31
|
+
fields: any | any[];
|
|
32
|
+
}): this;
|
|
33
|
+
/**
|
|
34
|
+
* Shortcut to get a value, but default if the fields don't exist.
|
|
35
|
+
*/
|
|
36
|
+
protected _get({
|
|
37
|
+
defaultValue,
|
|
38
|
+
fields
|
|
39
|
+
}: {
|
|
40
|
+
defaultValue: any;
|
|
41
|
+
fields: any | any[];
|
|
42
|
+
}): any;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { BaseClass as default };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import defaultTo from "../util/defaultTo.mjs";
|
|
2
|
+
import isArray from "lodash/isArray.js";
|
|
3
|
+
import set from "lodash/set.js";
|
|
4
|
+
//#region src/class/BaseClass.ts
|
|
5
|
+
var BaseClass = class {
|
|
6
|
+
/**
|
|
7
|
+
* Shortcut to set a value to an array and return the instance.
|
|
8
|
+
*/
|
|
9
|
+
_setArray({ input, fields }) {
|
|
10
|
+
if (isArray(input)) set(this, fields, input);
|
|
11
|
+
else set(this, fields, [input]);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Shortcut to set a value and return the instance.
|
|
16
|
+
*/
|
|
17
|
+
_setValue({ input, fields }) {
|
|
18
|
+
set(this, fields, input);
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Shortcut to add a value to an existing array.
|
|
23
|
+
*/
|
|
24
|
+
_push({ input, fields }) {
|
|
25
|
+
let temp = this._get({
|
|
26
|
+
defaultValue: [],
|
|
27
|
+
fields
|
|
28
|
+
});
|
|
29
|
+
if (isArray(input)) temp = temp.concat(input);
|
|
30
|
+
else temp = temp.push(input);
|
|
31
|
+
set(this, fields, temp);
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Shortcut to get a value, but default if the fields don't exist.
|
|
36
|
+
*/
|
|
37
|
+
_get({ defaultValue, fields }) {
|
|
38
|
+
return defaultTo({
|
|
39
|
+
defaultValue,
|
|
40
|
+
instance: this,
|
|
41
|
+
keys: fields
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { BaseClass as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/crypto/getDecrypt.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Decrypt an encoding string using a salt
|
|
4
|
+
* Library: crypto-js
|
|
5
|
+
*/
|
|
6
|
+
declare const getDecrypt: ({
|
|
7
|
+
appSalt,
|
|
8
|
+
input,
|
|
9
|
+
salt
|
|
10
|
+
}: {
|
|
11
|
+
appSalt: string;
|
|
12
|
+
input: string;
|
|
13
|
+
salt: string;
|
|
14
|
+
}) => string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { getDecrypt as default };
|