@8ms/helpers 1.38.0 → 2.0.0
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/.github/workflows/deploy_npmjs.yml +22 -14
- package/.yarn/install-state.gz +0 -0
- package/.yarn/releases/yarn-4.9.2.cjs +942 -0
- package/.yarnrc.yml +2 -0
- package/README.md +12 -0
- package/package.json +175 -46
- package/api/ApiResponse.d.ts +0 -50
- package/api/ApiResponse.js +0 -94
- package/api/index.d.ts +0 -9
- package/api/index.js +0 -13
- package/api/isError.d.ts +0 -6
- package/api/isError.js +0 -7
- package/api/isSuccess.d.ts +0 -6
- package/api/isSuccess.js +0 -7
- package/api/response.d.ts +0 -8
- package/api/response.js +0 -9
- package/array/contains.d.ts +0 -9
- package/array/contains.js +0 -7
- package/array/getArray.d.ts +0 -8
- package/array/getArray.js +0 -11
- package/atInternet/request.d.ts +0 -30
- package/atInternet/request.js +0 -2
- package/aws/athenaExpress/initClient.d.ts +0 -12
- package/aws/athenaExpress/initClient.js +0 -31
- package/aws/athenaExpress/query.d.ts +0 -8
- package/aws/athenaExpress/query.js +0 -16
- package/aws/ec2/initClient.d.ts +0 -11
- package/aws/ec2/initClient.js +0 -23
- package/aws/ec2/startInstances.d.ts +0 -11
- package/aws/ec2/startInstances.js +0 -18
- package/aws/ec2/stopInstances.d.ts +0 -12
- package/aws/ec2/stopInstances.js +0 -19
- package/aws/ecs/getClusters.d.ts +0 -9
- package/aws/ecs/getClusters.js +0 -32
- package/aws/ecs/getTaskDefinitions.d.ts +0 -13
- package/aws/ecs/getTaskDefinitions.js +0 -35
- package/aws/ecs/getTasks.d.ts +0 -16
- package/aws/ecs/getTasks.js +0 -38
- package/aws/ecs/initClient.d.ts +0 -11
- package/aws/ecs/initClient.js +0 -23
- package/aws/ecs/runTask.d.ts +0 -16
- package/aws/ecs/runTask.js +0 -30
- package/aws/getConfig.d.ts +0 -13
- package/aws/getConfig.js +0 -27
- package/aws/glue/initClient.d.ts +0 -10
- package/aws/glue/initClient.js +0 -21
- package/aws/glue/invoke.d.ts +0 -9
- package/aws/glue/invoke.js +0 -23
- package/aws/isResponse200.d.ts +0 -7
- package/aws/isResponse200.js +0 -22
- package/aws/lambda/getHandlerPath.d.ts +0 -5
- package/aws/lambda/getHandlerPath.js +0 -7
- package/aws/lambda/initClient.d.ts +0 -10
- package/aws/lambda/initClient.js +0 -21
- package/aws/lambda/invoke.d.ts +0 -13
- package/aws/lambda/invoke.js +0 -61
- package/aws/s3/copyFile.d.ts +0 -13
- package/aws/s3/copyFile.js +0 -14
- package/aws/s3/deleteFile.d.ts +0 -9
- package/aws/s3/deleteFile.js +0 -13
- package/aws/s3/deleteFiles.d.ts +0 -9
- package/aws/s3/deleteFiles.js +0 -17
- package/aws/s3/deleteFolder.d.ts +0 -9
- package/aws/s3/deleteFolder.js +0 -36
- package/aws/s3/getGlueJson.d.ts +0 -8
- package/aws/s3/getGlueJson.js +0 -11
- package/aws/s3/getPresignedPost.d.ts +0 -20
- package/aws/s3/getPresignedPost.js +0 -19
- package/aws/s3/getSignedUrl.d.ts +0 -12
- package/aws/s3/getSignedUrl.js +0 -17
- package/aws/s3/initClient.d.ts +0 -10
- package/aws/s3/initClient.js +0 -19
- package/aws/s3/isFileExists.d.ts +0 -9
- package/aws/s3/isFileExists.js +0 -27
- package/aws/s3/listFiles.d.ts +0 -9
- package/aws/s3/listFiles.js +0 -33
- package/aws/s3/listFilesIteratively.d.ts +0 -9
- package/aws/s3/listFilesIteratively.js +0 -44
- package/aws/s3/listFolders.d.ts +0 -9
- package/aws/s3/listFolders.js +0 -32
- package/aws/s3/moveFile.d.ts +0 -10
- package/aws/s3/moveFile.js +0 -21
- package/aws/s3/readBrotli.d.ts +0 -11
- package/aws/s3/readBrotli.js +0 -28
- package/aws/s3/readBuffer.d.ts +0 -13
- package/aws/s3/readBuffer.js +0 -39
- package/aws/s3/readFile.d.ts +0 -31
- package/aws/s3/readFile.js +0 -83
- package/aws/s3/readGzip.d.ts +0 -11
- package/aws/s3/readGzip.js +0 -28
- package/aws/s3/writeBrotli.d.ts +0 -12
- package/aws/s3/writeBrotli.js +0 -28
- package/aws/s3/writeFile.d.ts +0 -11
- package/aws/s3/writeFile.js +0 -16
- package/aws/s3/writeGzip.d.ts +0 -12
- package/aws/s3/writeGzip.js +0 -28
- package/aws/s3/writePresignedPost.d.ts +0 -14
- package/aws/s3/writePresignedPost.js +0 -31
- package/aws/s3/writeUrlContents.d.ts +0 -10
- package/aws/s3/writeUrlContents.js +0 -26
- package/aws/s3cache/getCache.d.ts +0 -11
- package/aws/s3cache/getCache.js +0 -37
- package/aws/s3cache/getKey.d.ts +0 -10
- package/aws/s3cache/getKey.js +0 -18
- package/aws/s3cache/index.d.ts +0 -6
- package/aws/s3cache/index.js +0 -2
- package/aws/s3cache/saveCache.d.ts +0 -10
- package/aws/s3cache/saveCache.js +0 -17
- package/aws/s3cache/updateCache.d.ts +0 -10
- package/aws/s3cache/updateCache.js +0 -24
- package/aws/ses/SimpleEmail.d.ts +0 -51
- package/aws/ses/SimpleEmail.js +0 -114
- package/aws/ses/initClient.d.ts +0 -10
- package/aws/ses/initClient.js +0 -19
- package/aws/sqs/addToQueue.d.ts +0 -27
- package/aws/sqs/addToQueue.js +0 -26
- package/aws/sqs/deleteFromQueue.d.ts +0 -10
- package/aws/sqs/deleteFromQueue.js +0 -15
- package/aws/sqs/initClient.d.ts +0 -10
- package/aws/sqs/initClient.js +0 -19
- package/aws/sqs/isEventSqs.d.ts +0 -1
- package/aws/sqs/isEventSqs.js +0 -13
- package/aws/ssm/getParameter.d.ts +0 -10
- package/aws/ssm/getParameter.js +0 -40
- package/aws/ssm/initClient.d.ts +0 -10
- package/aws/ssm/initClient.js +0 -19
- package/axios/delete.d.ts +0 -11
- package/axios/delete.js +0 -39
- package/axios/get.d.ts +0 -10
- package/axios/get.js +0 -38
- package/axios/post.d.ts +0 -11
- package/axios/post.js +0 -38
- package/boolean/getBoolean.d.ts +0 -7
- package/boolean/getBoolean.js +0 -16
- package/brightData/getCustomerId.d.ts +0 -10
- package/brightData/getCustomerId.js +0 -11
- package/brightData/getZone.d.ts +0 -9
- package/brightData/getZone.js +0 -10
- package/brightData/param.d.ts +0 -9
- package/brightData/param.js +0 -3
- package/brightData/serpApi/buildGoogleSerpUrl.d.ts +0 -32
- package/brightData/serpApi/buildGoogleSerpUrl.js +0 -115
- package/brightData/serpApi/buildGoogleTrendsUrl.d.ts +0 -22
- package/brightData/serpApi/buildGoogleTrendsUrl.js +0 -60
- package/brightData/serpApi/getAsyncRequestId.d.ts +0 -14
- package/brightData/serpApi/getAsyncRequestId.js +0 -50
- package/brightData/serpApi/getAsyncResults.d.ts +0 -12
- package/brightData/serpApi/getAsyncResults.js +0 -49
- package/brightData/serpApi/getRealtime.d.ts +0 -10
- package/brightData/serpApi/getRealtime.js +0 -35
- package/brightData/serpApi/type.d.ts +0 -11
- package/brightData/serpApi/type.js +0 -14
- package/brightData/webScraperIde/getBatch.d.ts +0 -14
- package/brightData/webScraperIde/getBatch.js +0 -34
- package/brightData/webScraperIde/getRealtime.d.ts +0 -13
- package/brightData/webScraperIde/getRealtime.js +0 -64
- package/class/BaseClass.d.ts +0 -31
- package/class/BaseClass.js +0 -50
- package/crud/index.d.ts +0 -6
- package/crud/index.js +0 -10
- package/crypto/getDecrypt.d.ts +0 -10
- package/crypto/getDecrypt.js +0 -13
- package/crypto/getEncrypt.d.ts +0 -10
- package/crypto/getEncrypt.js +0 -13
- package/crypto/getRandom.d.ts +0 -8
- package/crypto/getRandom.js +0 -12
- package/crypto/getSha256.d.ts +0 -8
- package/crypto/getSha256.js +0 -17
- package/date/format.d.ts +0 -10
- package/date/format.js +0 -21
- package/date/getDate.d.ts +0 -14
- package/date/getDate.js +0 -138
- package/date/getDatesBetween.d.ts +0 -13
- package/date/getDatesBetween.js +0 -54
- package/date/getDurationHours.d.ts +0 -9
- package/date/getDurationHours.js +0 -24
- package/date/getDurationMinutes.d.ts +0 -9
- package/date/getDurationMinutes.js +0 -22
- package/date/getFinancialYear.d.ts +0 -9
- package/date/getFinancialYear.js +0 -52
- package/date/getFinancialYearToDate.d.ts +0 -7
- package/date/getFinancialYearToDate.js +0 -20
- package/date/getFinancialYearToYesterday.d.ts +0 -7
- package/date/getFinancialYearToYesterday.js +0 -20
- package/date/getFinancialYearWeeks.d.ts +0 -9
- package/date/getFinancialYearWeeks.js +0 -33
- package/date/getLastWeek.d.ts +0 -10
- package/date/getLastWeek.js +0 -34
- package/date/getMax.d.ts +0 -13
- package/date/getMax.js +0 -24
- package/date/getMidnight.d.ts +0 -10
- package/date/getMidnight.js +0 -13
- package/date/getMin.d.ts +0 -13
- package/date/getMin.js +0 -24
- package/date/getMonday.d.ts +0 -15
- package/date/getMonday.js +0 -46
- package/date/getNumber.d.ts +0 -7
- package/date/getNumber.js +0 -20
- package/date/getPredefinedTimeframe.d.ts +0 -8
- package/date/getPredefinedTimeframe.js +0 -24
- package/date/getSunday.d.ts +0 -15
- package/date/getSunday.js +0 -42
- package/date/getThisWeek.d.ts +0 -10
- package/date/getThisWeek.js +0 -36
- package/date/getTimeZoned.d.ts +0 -13
- package/date/getTimeZoned.js +0 -55
- package/date/getToday.d.ts +0 -9
- package/date/getToday.js +0 -24
- package/date/getTodayYmd.d.ts +0 -5
- package/date/getTodayYmd.js +0 -21
- package/date/getTodayYmdhis.d.ts +0 -5
- package/date/getTodayYmdhis.js +0 -21
- package/date/getTwoWeeksAgo.d.ts +0 -10
- package/date/getTwoWeeksAgo.js +0 -36
- package/date/getWeeksAgo.d.ts +0 -13
- package/date/getWeeksAgo.js +0 -25
- package/date/getYesterday.d.ts +0 -9
- package/date/getYesterday.js +0 -52
- package/date/index.d.ts +0 -55
- package/date/index.js +0 -36
- package/date/isDateValid.d.ts +0 -7
- package/date/isDateValid.js +0 -20
- package/date/isLastWeek.d.ts +0 -6
- package/date/isLastWeek.js +0 -14
- package/date/isThisWeek.d.ts +0 -6
- package/date/isThisWeek.js +0 -14
- package/date/parseExcelDate.d.ts +0 -8
- package/date/parseExcelDate.js +0 -19
- package/environment/getEnvironment.d.ts +0 -6
- package/environment/getEnvironment.js +0 -43
- package/environment/index.d.ts +0 -9
- package/environment/index.js +0 -14
- package/environment/isAws.d.ts +0 -5
- package/environment/isAws.js +0 -8
- package/environment/isDevelopment.d.ts +0 -2
- package/environment/isDevelopment.js +0 -9
- package/environment/isLocalhost.d.ts +0 -5
- package/environment/isLocalhost.js +0 -25
- package/environment/isProduction.d.ts +0 -2
- package/environment/isProduction.js +0 -9
- package/environment/isStaging.d.ts +0 -2
- package/environment/isStaging.js +0 -9
- package/environment/isVercel.d.ts +0 -5
- package/environment/isVercel.js +0 -7
- package/eskimi/ageGroups.d.ts +0 -5
- package/eskimi/ageGroups.js +0 -41
- package/eskimi/campaign.d.ts +0 -19
- package/eskimi/campaign.js +0 -2
- package/eskimi/devices.d.ts +0 -5
- package/eskimi/devices.js +0 -13
- package/eskimi/endpoints.d.ts +0 -16
- package/eskimi/endpoints.js +0 -18
- package/eskimi/genders.d.ts +0 -5
- package/eskimi/genders.js +0 -13
- package/eskimi/getAccessToken.d.ts +0 -9
- package/eskimi/getAccessToken.js +0 -23
- package/eskimi/getAgeGroup.d.ts +0 -7
- package/eskimi/getAgeGroup.js +0 -17
- package/eskimi/getCampaignIds.d.ts +0 -7
- package/eskimi/getCampaignIds.js +0 -12
- package/eskimi/getData.d.ts +0 -8
- package/eskimi/getData.js +0 -23
- package/eskimi/getDevice.d.ts +0 -7
- package/eskimi/getDevice.js +0 -17
- package/eskimi/getGender.d.ts +0 -7
- package/eskimi/getGender.js +0 -17
- package/file/createDirectory.d.ts +0 -9
- package/file/createDirectory.js +0 -16
- package/file/writeFile.d.ts +0 -1
- package/file/writeFile.js +0 -2
- package/global/forceUpdate.d.ts +0 -8
- package/global/forceUpdate.js +0 -25
- package/global/init.d.ts +0 -10
- package/global/init.js +0 -18
- package/global/isSet.d.ts +0 -8
- package/global/isSet.js +0 -9
- package/global/maxCache.d.ts +0 -8
- package/global/maxCache.js +0 -17
- package/global/read.d.ts +0 -8
- package/global/read.js +0 -30
- package/google/bigQuery/IsTableExists.d.ts +0 -11
- package/google/bigQuery/IsTableExists.js +0 -25
- package/google/bigQuery/createDataset.d.ts +0 -11
- package/google/bigQuery/createDataset.js +0 -22
- package/google/bigQuery/createTable.d.ts +0 -12
- package/google/bigQuery/createTable.js +0 -31
- package/google/bigQuery/getClient.d.ts +0 -9
- package/google/bigQuery/getClient.js +0 -18
- package/google/bigQuery/getDatasets.d.ts +0 -13
- package/google/bigQuery/getDatasets.js +0 -27
- package/google/bigQuery/getTables.d.ts +0 -12
- package/google/bigQuery/getTables.js +0 -25
- package/google/bigQuery/initClient.d.ts +0 -11
- package/google/bigQuery/initClient.js +0 -29
- package/google/bigQuery/isDatasetExists.d.ts +0 -11
- package/google/bigQuery/isDatasetExists.js +0 -25
- package/google/bigQuery/loadData.d.ts +0 -18
- package/google/bigQuery/loadData.js +0 -32
- package/google/bigQuery/query.d.ts +0 -19
- package/google/bigQuery/query.js +0 -15
- package/google/getConfig.d.ts +0 -20
- package/google/getConfig.js +0 -23
- package/google/sheets/getAssociatedData.d.ts +0 -16
- package/google/sheets/getAssociatedData.js +0 -53
- package/google/sheets/getBatchData.d.ts +0 -18
- package/google/sheets/getBatchData.js +0 -19
- package/google/sheets/initClient.d.ts +0 -11
- package/google/sheets/initClient.js +0 -25
- package/google/sheets/isCellNa.d.ts +0 -7
- package/google/sheets/isCellNa.js +0 -7
- package/google/storage/copyToCloud.d.ts +0 -11
- package/google/storage/copyToCloud.js +0 -18
- package/google/storage/getClient.d.ts +0 -8
- package/google/storage/getClient.js +0 -18
- package/google/storage/initClient.d.ts +0 -12
- package/google/storage/initClient.js +0 -29
- package/google/storage/isFileExists.d.ts +0 -10
- package/google/storage/isFileExists.js +0 -19
- package/google/storage/writeFile.d.ts +0 -11
- package/google/storage/writeFile.js +0 -37
- package/googleAds/getCustomer.d.ts +0 -8
- package/googleAds/getCustomer.js +0 -14
- package/googleAds/initClient.d.ts +0 -16
- package/googleAds/initClient.js +0 -25
- package/googleAds/keywordPlanner/index.d.ts +0 -238
- package/googleAds/keywordPlanner/index.js +0 -244
- package/googleAds/keywordPlanner/request.d.ts +0 -18
- package/googleAds/keywordPlanner/request.js +0 -13
- package/googleAds/keywordPlanner/response.d.ts +0 -25
- package/googleAds/keywordPlanner/response.js +0 -2
- package/initClients.d.ts +0 -43
- package/initClients.js +0 -131
- package/json/getJsonNewline.d.ts +0 -5
- package/json/getJsonNewline.js +0 -17
- package/json/isJson.d.ts +0 -8
- package/json/isJson.js +0 -20
- package/littleWarden/getUrlStatus.d.ts +0 -9
- package/littleWarden/getUrlStatus.js +0 -21
- package/littleWarden/index.d.ts +0 -5
- package/littleWarden/index.js +0 -9
- package/littleWarden/isAllGood.d.ts +0 -7
- package/littleWarden/isAllGood.js +0 -15
- package/littleWarden/isDanger.d.ts +0 -7
- package/littleWarden/isDanger.js +0 -15
- package/littleWarden/isWarning.d.ts +0 -7
- package/littleWarden/isWarning.js +0 -15
- package/lumar/api/buildRequest.d.ts +0 -15
- package/lumar/api/buildRequest.js +0 -83
- package/lumar/api/filter.d.ts +0 -5
- package/lumar/api/filter.js +0 -2
- package/lumar/api/getData.d.ts +0 -6
- package/lumar/api/getData.js +0 -18
- package/lumar/api/initClient.d.ts +0 -13
- package/lumar/api/initClient.js +0 -38
- package/lumar/api/operands.d.ts +0 -11
- package/lumar/api/operands.js +0 -13
- package/lumar/api/orders.d.ts +0 -9
- package/lumar/api/orders.js +0 -7
- package/lumar/api/reports.d.ts +0 -11
- package/lumar/api/reports.js +0 -13
- package/lumar/graphql/columns.d.ts +0 -29
- package/lumar/graphql/columns.js +0 -31
- package/lumar/graphql/getData.d.ts +0 -9
- package/lumar/graphql/getData.js +0 -26
- package/lumar/graphql/getReportKey.d.ts +0 -9
- package/lumar/graphql/getReportKey.js +0 -9
- package/lumar/graphql/initClient.d.ts +0 -12
- package/lumar/graphql/initClient.js +0 -38
- package/lumar/graphql/operands.d.ts +0 -16
- package/lumar/graphql/operands.js +0 -18
- package/lumar/graphql/queries/crawl.d.ts +0 -5
- package/lumar/graphql/queries/crawl.js +0 -2
- package/lumar/graphql/queries/getCrawls.d.ts +0 -18
- package/lumar/graphql/queries/getCrawls.js +0 -33
- package/lumar/graphql/queries/getReportDifferences.d.ts +0 -24
- package/lumar/graphql/queries/getReportDifferences.js +0 -40
- package/lumar/graphql/queries/getRows.d.ts +0 -38
- package/lumar/graphql/queries/getRows.js +0 -57
- package/lumar/graphql/queries/getTotals.d.ts +0 -25
- package/lumar/graphql/queries/getTotals.js +0 -40
- package/lumar/graphql/queries/row.d.ts +0 -157
- package/lumar/graphql/queries/row.js +0 -2
- package/lumar/graphql/reportTemplates.d.ts +0 -68
- package/lumar/graphql/reportTemplates.js +0 -70
- package/lumar/graphql/reportTypes.d.ts +0 -7
- package/lumar/graphql/reportTypes.js +0 -9
- package/myTarget/getAccessToken.d.ts +0 -9
- package/myTarget/getAccessToken.js +0 -23
- package/myTarget/request.d.ts +0 -9
- package/myTarget/request.js +0 -23
- package/nextAuth/index.d.ts +0 -5
- package/nextAuth/index.js +0 -9
- package/nextAuth/isSessionReady.d.ts +0 -4
- package/nextAuth/isSessionReady.js +0 -12
- package/nextJs/getIp.d.ts +0 -7
- package/nextJs/getIp.js +0 -13
- package/nextJs/getUserAgent.d.ts +0 -7
- package/nextJs/getUserAgent.js +0 -7
- package/number/format.d.ts +0 -11
- package/number/format.js +0 -23
- package/number/getCurrency.d.ts +0 -10
- package/number/getCurrency.js +0 -20
- package/number/getDecimal.d.ts +0 -9
- package/number/getDecimal.js +0 -16
- package/number/getDivide.d.ts +0 -11
- package/number/getDivide.js +0 -26
- package/number/getNumber.d.ts +0 -8
- package/number/getNumber.js +0 -51
- package/number/getPercentIncrease.d.ts +0 -10
- package/number/getPercentIncrease.js +0 -22
- package/object/replaceKeys.d.ts +0 -10
- package/object/replaceKeys.js +0 -30
- package/prisma/getDecimal.d.ts +0 -9
- package/prisma/getDecimal.js +0 -18
- package/prisma/initClient.d.ts +0 -6
- package/prisma/initClient.js +0 -36
- package/snapchat/getAccessToken.d.ts +0 -9
- package/snapchat/getAccessToken.js +0 -35
- package/sorting/byNumberAscending.d.ts +0 -8
- package/sorting/byNumberAscending.js +0 -17
- package/sorting/byNumberDescending.d.ts +0 -8
- package/sorting/byNumberDescending.js +0 -17
- package/sorting/byStringAscending.d.ts +0 -8
- package/sorting/byStringAscending.js +0 -21
- package/sorting/byStringDescending.d.ts +0 -8
- package/sorting/byStringDescending.js +0 -21
- package/stream/sort.d.ts +0 -14
- package/stream/sort.js +0 -50
- package/string/getCapitalised.d.ts +0 -10
- package/string/getCapitalised.js +0 -17
- package/string/getClean.d.ts +0 -18
- package/string/getClean.js +0 -65
- package/string/getDecoded.d.ts +0 -10
- package/string/getDecoded.js +0 -26
- package/string/getFolder.d.ts +0 -8
- package/string/getFolder.js +0 -14
- package/string/getProperCase.d.ts +0 -11
- package/string/getProperCase.js +0 -27
- package/string/getString.d.ts +0 -7
- package/string/getString.js +0 -34
- package/string/getStringFromStream.d.ts +0 -8
- package/string/getStringFromStream.js +0 -16
- package/string/getWithoutAccents.d.ts +0 -9
- package/string/getWithoutAccents.js +0 -16
- package/string/getWithoutHtmlTags.d.ts +0 -9
- package/string/getWithoutHtmlTags.js +0 -15
- package/string/getWithoutPunctuation.d.ts +0 -9
- package/string/getWithoutPunctuation.js +0 -16
- package/string/getWithoutUnderscores.d.ts +0 -8
- package/string/getWithoutUnderscores.js +0 -14
- package/string/getWithoutWhitespaces.d.ts +0 -9
- package/string/getWithoutWhitespaces.js +0 -16
- package/swr/isAllData.d.ts +0 -7
- package/swr/isAllData.js +0 -19
- package/swr/isAnyError.d.ts +0 -7
- package/swr/isAnyError.js +0 -19
- package/swr/isAnyLoading.d.ts +0 -7
- package/swr/isAnyLoading.js +0 -21
- package/swr/isData.d.ts +0 -7
- package/swr/isData.js +0 -9
- package/swr/isError.d.ts +0 -7
- package/swr/isError.js +0 -7
- package/swr/isLoading.d.ts +0 -7
- package/swr/isLoading.js +0 -12
- package/upTimeRobot/getMonitors.d.ts +0 -1
- package/upTimeRobot/getMonitors.js +0 -33
- package/upTimeRobot/logTypes.d.ts +0 -7
- package/upTimeRobot/logTypes.js +0 -9
- package/upTimeRobot/monitorStatuses.d.ts +0 -8
- package/upTimeRobot/monitorStatuses.js +0 -10
- package/upTimeRobot/monitorSubTypes.d.ts +0 -10
- package/upTimeRobot/monitorSubTypes.js +0 -12
- package/upTimeRobot/monitorTypes.d.ts +0 -8
- package/upTimeRobot/monitorTypes.js +0 -10
- package/upTimeRobot/requestStatuses.d.ts +0 -5
- package/upTimeRobot/requestStatuses.js +0 -7
- package/url/buildParameters.d.ts +0 -8
- package/url/buildParameters.js +0 -22
- package/url/buildRelative.d.ts +0 -8
- package/url/buildRelative.js +0 -13
- package/url/buildUrl.d.ts +0 -10
- package/url/buildUrl.js +0 -29
- package/url/isAbsolute.d.ts +0 -7
- package/url/isAbsolute.js +0 -15
- package/url/isRelative.d.ts +0 -7
- package/url/isRelative.js +0 -8
- package/url/url.d.ts +0 -6
- package/url/url.js +0 -2
- package/url/writeUrlContents.d.ts +0 -11
- package/url/writeUrlContents.js +0 -43
- package/util/defaultTo.d.ts +0 -10
- package/util/defaultTo.js +0 -43
- package/util/getBrotliCompressed.d.ts +0 -9
- package/util/getBrotliCompressed.js +0 -19
- package/util/getBrotliDecompressed.d.ts +0 -9
- package/util/getBrotliDecompressed.js +0 -20
- package/util/getClean.d.ts +0 -11
- package/util/getClean.js +0 -28
- package/util/getGzipCompressed.d.ts +0 -9
- package/util/getGzipCompressed.js +0 -19
- package/util/getGzipDecompressed.d.ts +0 -9
- package/util/getGzipDecompressed.js +0 -20
- package/util/getWithoutHash.d.ts +0 -8
- package/util/getWithoutHash.js +0 -17
- package/util/getWithoutParameter.d.ts +0 -8
- package/util/getWithoutParameter.js +0 -17
- package/util/isUndefined.d.ts +0 -9
- package/util/isUndefined.js +0 -19
- package/util/promiseChunks.d.ts +0 -10
- package/util/promiseChunks.js +0 -18
- package/util/sleep.d.ts +0 -5
- package/util/sleep.js +0 -6
- package/webWorker/index.d.ts +0 -5
- package/webWorker/index.js +0 -9
- package/xml/getXml.d.ts +0 -5
- package/xml/getXml.js +0 -22
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
const get_1 = __importDefault(require("../../axios/get"));
|
|
7
|
-
const getCustomerId_1 = __importDefault(require("../getCustomerId"));
|
|
8
|
-
const getZone_1 = __importDefault(require("../getZone"));
|
|
9
|
-
const ApiResponse_1 = __importDefault(require("../../api/ApiResponse"));
|
|
10
|
-
/**
|
|
11
|
-
* Using the request ID from getAsyncRequestId fetch to see if the data is available.
|
|
12
|
-
* https://docs.brightdata.com/scraping-automation/serp-api/asynchronous-requests
|
|
13
|
-
*/
|
|
14
|
-
const getAsyncResults = async (props) => {
|
|
15
|
-
let response = (new ApiResponse_1.default());
|
|
16
|
-
// Prevent auth requests getting blocked
|
|
17
|
-
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
18
|
-
const customerId = (0, getCustomerId_1.default)({
|
|
19
|
-
auth: props.auth,
|
|
20
|
-
});
|
|
21
|
-
const zone = (0, getZone_1.default)({
|
|
22
|
-
auth: props.auth,
|
|
23
|
-
});
|
|
24
|
-
const requestResponse = await (0, get_1.default)({
|
|
25
|
-
config: {
|
|
26
|
-
headers: {
|
|
27
|
-
Authorization: `Bearer ${props.auth.apiKey}`
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
url: `https://api.brightdata.com/serp/get_result?customer=${customerId}&zone=${zone}&response_id=${props.requestId}`,
|
|
31
|
-
});
|
|
32
|
-
if (requestResponse.isSuccess()) {
|
|
33
|
-
if ("Request is pending" === requestResponse.getBody()) {
|
|
34
|
-
response.setToPending();
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
response.setToSuccess({
|
|
38
|
-
body: requestResponse.getBody(),
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
response.setToError({
|
|
44
|
-
error: "Error in request",
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
return response;
|
|
48
|
-
};
|
|
49
|
-
exports.default = getAsyncResults;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Param } from "../param";
|
|
2
|
-
type GetRealtime = {
|
|
3
|
-
auth: Param;
|
|
4
|
-
url: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Make a request to the SERP API using the Bright Data proxy
|
|
8
|
-
*/
|
|
9
|
-
declare const getRealtime: (props: GetRealtime) => Promise<{}>;
|
|
10
|
-
export default getRealtime;
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
const get_1 = __importDefault(require("../../axios/get"));
|
|
7
|
-
/**
|
|
8
|
-
* Make a request to the SERP API using the Bright Data proxy
|
|
9
|
-
*/
|
|
10
|
-
const getRealtime = async (props) => {
|
|
11
|
-
let response = {};
|
|
12
|
-
// Prevent auth requests getting blocked
|
|
13
|
-
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
14
|
-
// Use fetch with the agent option to make an HTTP request through the proxy
|
|
15
|
-
// Replace <target_url> with the URL you want to request
|
|
16
|
-
const apiResponse = await (0, get_1.default)({
|
|
17
|
-
config: {
|
|
18
|
-
proxy: {
|
|
19
|
-
protocol: "http",
|
|
20
|
-
host: props.auth.host,
|
|
21
|
-
port: props.auth.port,
|
|
22
|
-
auth: {
|
|
23
|
-
username: props.auth.username,
|
|
24
|
-
password: props.auth.password,
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
url: props.url,
|
|
29
|
-
});
|
|
30
|
-
if (apiResponse.isSuccess()) {
|
|
31
|
-
response = apiResponse.getBody();
|
|
32
|
-
}
|
|
33
|
-
return response;
|
|
34
|
-
};
|
|
35
|
-
exports.default = getRealtime;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare enum Type {
|
|
2
|
-
GOOGLE_FLIGHTS = "GOOGLE_FLIGHTS",
|
|
3
|
-
GOOGLE_HOTELS = "GOOGLE_HOTELS",
|
|
4
|
-
GOOGLE_LENS = "GOOGLE_LENS",
|
|
5
|
-
GOOGLE_MAPS = "GOOGLE_MAPS",
|
|
6
|
-
GOOGLE_REVIEWS = "GOOGLE_REVIEWS",
|
|
7
|
-
GOOGLE_SEARCH = "GOOGLE_SEARCH",
|
|
8
|
-
GOOGLE_TRENDS = "GOOGLE_TRENDS"
|
|
9
|
-
}
|
|
10
|
-
declare const _default: {};
|
|
11
|
-
export default _default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Type = void 0;
|
|
4
|
-
var Type;
|
|
5
|
-
(function (Type) {
|
|
6
|
-
Type["GOOGLE_FLIGHTS"] = "GOOGLE_FLIGHTS";
|
|
7
|
-
Type["GOOGLE_HOTELS"] = "GOOGLE_HOTELS";
|
|
8
|
-
Type["GOOGLE_LENS"] = "GOOGLE_LENS";
|
|
9
|
-
Type["GOOGLE_MAPS"] = "GOOGLE_MAPS";
|
|
10
|
-
Type["GOOGLE_REVIEWS"] = "GOOGLE_REVIEWS";
|
|
11
|
-
Type["GOOGLE_SEARCH"] = "GOOGLE_SEARCH";
|
|
12
|
-
Type["GOOGLE_TRENDS"] = "GOOGLE_TRENDS";
|
|
13
|
-
})(Type || (exports.Type = Type = {}));
|
|
14
|
-
exports.default = {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Param } from "../param";
|
|
2
|
-
type GetBatch = {
|
|
3
|
-
auth: Param;
|
|
4
|
-
data?: object;
|
|
5
|
-
scraperId: string;
|
|
6
|
-
isDev?: boolean;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Depends on the Scraper setup!
|
|
10
|
-
*
|
|
11
|
-
* Make the request to trigger the scraper and let it do its job.
|
|
12
|
-
*/
|
|
13
|
-
declare const getBatch: (props: GetBatch) => Promise<boolean>;
|
|
14
|
-
export default getBatch;
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
const post_1 = __importDefault(require("../../axios/post"));
|
|
7
|
-
/**
|
|
8
|
-
* Depends on the Scraper setup!
|
|
9
|
-
*
|
|
10
|
-
* Make the request to trigger the scraper and let it do its job.
|
|
11
|
-
*/
|
|
12
|
-
const getBatch = async (props) => {
|
|
13
|
-
let response = false;
|
|
14
|
-
const requestUrl = new URL('https://api.brightdata.com/dca/trigger');
|
|
15
|
-
requestUrl.searchParams.append('collector', props.scraperId);
|
|
16
|
-
requestUrl.searchParams.append('queue_next', '1');
|
|
17
|
-
if (props.isDev) {
|
|
18
|
-
requestUrl.searchParams.append('version', 'dev');
|
|
19
|
-
}
|
|
20
|
-
const requestResponse = await (0, post_1.default)({
|
|
21
|
-
config: {
|
|
22
|
-
headers: {
|
|
23
|
-
Authorization: `Bearer ${props.auth.apiKey}`
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
data: props?.data || {},
|
|
27
|
-
url: requestUrl.toString(),
|
|
28
|
-
});
|
|
29
|
-
if (requestResponse.isSuccess()) {
|
|
30
|
-
response = true;
|
|
31
|
-
}
|
|
32
|
-
return response;
|
|
33
|
-
};
|
|
34
|
-
exports.default = getBatch;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Param } from "../param";
|
|
2
|
-
type GetRealtime = {
|
|
3
|
-
auth: Param;
|
|
4
|
-
data?: object;
|
|
5
|
-
scraperId: string;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Depends on the Scraper setup!
|
|
9
|
-
*
|
|
10
|
-
* Make the request and pool the response until the data is available.
|
|
11
|
-
*/
|
|
12
|
-
declare const getRealtime: (props: GetRealtime) => Promise<{}>;
|
|
13
|
-
export default getRealtime;
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
const post_1 = __importDefault(require("../../axios/post"));
|
|
7
|
-
const api_1 = require("../../api");
|
|
8
|
-
const get_1 = __importDefault(require("../../axios/get"));
|
|
9
|
-
const sleep_1 = __importDefault(require("../../util/sleep"));
|
|
10
|
-
/**
|
|
11
|
-
* Depends on the Scraper setup!
|
|
12
|
-
*
|
|
13
|
-
* Make the request and pool the response until the data is available.
|
|
14
|
-
*/
|
|
15
|
-
const getRealtime = async (props) => {
|
|
16
|
-
let response = {};
|
|
17
|
-
const requestUrl = `https://api.brightdata.com/dca/trigger_immediate?collector=${props.scraperId}`;
|
|
18
|
-
const requestResponse = await (0, post_1.default)({
|
|
19
|
-
config: {
|
|
20
|
-
headers: {
|
|
21
|
-
Authorization: `Bearer ${props.auth.apiKey}`
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
data: props?.data || {},
|
|
25
|
-
url: requestUrl,
|
|
26
|
-
});
|
|
27
|
-
if (requestResponse.isSuccess()) {
|
|
28
|
-
const responseId = requestResponse.getBodyDefaultTo({
|
|
29
|
-
defaultValue: "",
|
|
30
|
-
keys: ["response_id"],
|
|
31
|
-
});
|
|
32
|
-
if ("" !== responseId) {
|
|
33
|
-
let state = api_1.State.PENDING;
|
|
34
|
-
while (api_1.State.PENDING === state) {
|
|
35
|
-
const resultUrl = `https://api.brightdata.com/dca/get_result?response_id=${responseId}`;
|
|
36
|
-
// Use fetch with the agent option to make an HTTP request through the proxy
|
|
37
|
-
// Replace <target_url> with the URL you want to request
|
|
38
|
-
const resultResponse = await (0, get_1.default)({
|
|
39
|
-
config: {
|
|
40
|
-
headers: {
|
|
41
|
-
Authorization: `Bearer ${props.auth.apiKey}`
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
url: resultUrl,
|
|
45
|
-
});
|
|
46
|
-
if (resultResponse.isSuccess()) {
|
|
47
|
-
if (undefined !== resultResponse.body.pending &&
|
|
48
|
-
true === resultResponse.body.pending) {
|
|
49
|
-
state = api_1.State.PENDING;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
state = api_1.State.SUCCESS;
|
|
53
|
-
response = resultResponse.getBody();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
await (0, sleep_1.default)({
|
|
57
|
-
seconds: 1
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return response;
|
|
63
|
-
};
|
|
64
|
-
exports.default = getRealtime;
|
package/class/BaseClass.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
declare class BaseClass {
|
|
2
|
-
/**
|
|
3
|
-
* Shortcut to set a value to an array and return the instance.
|
|
4
|
-
*/
|
|
5
|
-
protected _setArray({ input, fields }: {
|
|
6
|
-
input: any | any[];
|
|
7
|
-
fields: any | any[];
|
|
8
|
-
}): this;
|
|
9
|
-
/**
|
|
10
|
-
* Shortcut to set a value and return the instance.
|
|
11
|
-
*/
|
|
12
|
-
protected _setValue({ input, fields }: {
|
|
13
|
-
input: any;
|
|
14
|
-
fields: any | any[];
|
|
15
|
-
}): this;
|
|
16
|
-
/**
|
|
17
|
-
* Shortcut to add a value to an existing array.
|
|
18
|
-
*/
|
|
19
|
-
protected _push({ input, fields }: {
|
|
20
|
-
input: any | any[];
|
|
21
|
-
fields: any | any[];
|
|
22
|
-
}): this;
|
|
23
|
-
/**
|
|
24
|
-
* Shortcut to get a value, but default if the fields don't exist.
|
|
25
|
-
*/
|
|
26
|
-
protected _get({ defaultValue, fields }: {
|
|
27
|
-
defaultValue: any;
|
|
28
|
-
fields: any | any[];
|
|
29
|
-
}): any;
|
|
30
|
-
}
|
|
31
|
-
export default BaseClass;
|
package/class/BaseClass.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
7
|
-
const set_1 = __importDefault(require("lodash/set"));
|
|
8
|
-
const defaultTo_1 = __importDefault(require("../util/defaultTo"));
|
|
9
|
-
class BaseClass {
|
|
10
|
-
/**
|
|
11
|
-
* Shortcut to set a value to an array and return the instance.
|
|
12
|
-
*/
|
|
13
|
-
_setArray({ input, fields }) {
|
|
14
|
-
if ((0, isArray_1.default)(input)) {
|
|
15
|
-
(0, set_1.default)(this, fields, input);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
(0, set_1.default)(this, fields, [input]);
|
|
19
|
-
}
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Shortcut to set a value and return the instance.
|
|
24
|
-
*/
|
|
25
|
-
_setValue({ input, fields }) {
|
|
26
|
-
(0, set_1.default)(this, fields, input);
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Shortcut to add a value to an existing array.
|
|
31
|
-
*/
|
|
32
|
-
_push({ input, fields }) {
|
|
33
|
-
let temp = this._get({ defaultValue: [], fields });
|
|
34
|
-
if ((0, isArray_1.default)(input)) {
|
|
35
|
-
temp = temp.concat(input);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
temp = temp.push(input);
|
|
39
|
-
}
|
|
40
|
-
(0, set_1.default)(this, fields, temp);
|
|
41
|
-
return this;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Shortcut to get a value, but default if the fields don't exist.
|
|
45
|
-
*/
|
|
46
|
-
_get({ defaultValue, fields }) {
|
|
47
|
-
return (0, defaultTo_1.default)({ defaultValue, instance: this, keys: fields });
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.default = BaseClass;
|
package/crud/index.d.ts
DELETED
package/crud/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Action = void 0;
|
|
4
|
-
var Action;
|
|
5
|
-
(function (Action) {
|
|
6
|
-
Action["CREATE"] = "CREATE";
|
|
7
|
-
Action["READ"] = "READ";
|
|
8
|
-
Action["UPDATE"] = "UPDATE";
|
|
9
|
-
Action["DELETE"] = "DELETE";
|
|
10
|
-
})(Action || (exports.Action = Action = {}));
|
package/crypto/getDecrypt.d.ts
DELETED
package/crypto/getDecrypt.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Decrypt an encoding string using a salt
|
|
5
|
-
* Library: crypto-js
|
|
6
|
-
*/
|
|
7
|
-
const getDecrypt = ({ appSalt, input, salt }) => {
|
|
8
|
-
const { AES, enc } = require('crypto-js');
|
|
9
|
-
const customSalt = `${appSalt}-${salt}`;
|
|
10
|
-
return AES.decrypt(input, customSalt)
|
|
11
|
-
.toString(enc.Utf8);
|
|
12
|
-
};
|
|
13
|
-
exports.default = getDecrypt;
|
package/crypto/getEncrypt.d.ts
DELETED
package/crypto/getEncrypt.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Encrypt an encoding string using a salt
|
|
5
|
-
* Library: crypto-js
|
|
6
|
-
*/
|
|
7
|
-
const getEncrypt = ({ appSalt, input, salt }) => {
|
|
8
|
-
const { AES } = require('crypto-js');
|
|
9
|
-
const customSalt = `${appSalt}-${salt}`;
|
|
10
|
-
return AES.encrypt(input, customSalt)
|
|
11
|
-
.toString();
|
|
12
|
-
};
|
|
13
|
-
exports.default = getEncrypt;
|
package/crypto/getRandom.d.ts
DELETED
package/crypto/getRandom.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Create a random string and return a number of characters from it.
|
|
5
|
-
* Library: crypto-js
|
|
6
|
-
*/
|
|
7
|
-
const getRandom = ({ length }) => {
|
|
8
|
-
return Math.random()
|
|
9
|
-
.toString(36)
|
|
10
|
-
.substr(0, length);
|
|
11
|
-
};
|
|
12
|
-
exports.default = getRandom;
|
package/crypto/getSha256.d.ts
DELETED
package/crypto/getSha256.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
const getString_1 = __importDefault(require("../string/getString"));
|
|
7
|
-
/**
|
|
8
|
-
* Encrypt a string using sha256
|
|
9
|
-
* Library: crypto-js
|
|
10
|
-
*/
|
|
11
|
-
const getSha256 = ({ input }) => {
|
|
12
|
-
const { SHA256 } = require('crypto-js');
|
|
13
|
-
const inputString = (0, getString_1.default)({ input });
|
|
14
|
-
return SHA256(inputString)
|
|
15
|
-
.toString();
|
|
16
|
-
};
|
|
17
|
-
exports.default = getSha256;
|
package/date/format.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { GetDate } from "./getDate";
|
|
2
|
-
type Format = GetDate & {
|
|
3
|
-
dateFormat?: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Convert a (number | string | Date) into a "yyyy-MM-dd" string or a specified format.
|
|
7
|
-
* As the user would be providing the input we don't want to change the timezone typically.
|
|
8
|
-
*/
|
|
9
|
-
declare const format: (props: Format) => string;
|
|
10
|
-
export default format;
|
package/date/format.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
const date_fns_1 = require("date-fns");
|
|
7
|
-
const getDate_1 = __importDefault(require("./getDate"));
|
|
8
|
-
/**
|
|
9
|
-
* Convert a (number | string | Date) into a "yyyy-MM-dd" string or a specified format.
|
|
10
|
-
* As the user would be providing the input we don't want to change the timezone typically.
|
|
11
|
-
*/
|
|
12
|
-
const format = (props) => {
|
|
13
|
-
const dateInstance = (0, getDate_1.default)({
|
|
14
|
-
input: props.input,
|
|
15
|
-
isUtc: props.isUtc,
|
|
16
|
-
setMidnight: props?.setMidnight,
|
|
17
|
-
setTimeZone: props?.setTimeZone,
|
|
18
|
-
});
|
|
19
|
-
return (0, date_fns_1.format)(dateInstance, props?.dateFormat || "yyyy-MM-dd");
|
|
20
|
-
};
|
|
21
|
-
exports.default = format;
|
package/date/getDate.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DateType } from "./";
|
|
2
|
-
import { GetMidnight } from "./getMidnight";
|
|
3
|
-
import { GetTimeZoned } from "./getTimeZoned";
|
|
4
|
-
export type GetDate = GetTimeZoned & GetMidnight & {
|
|
5
|
-
input: DateType;
|
|
6
|
-
isUtc?: boolean;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Convert a (number | string | Date) into a Date object.
|
|
10
|
-
* As the user would be providing the input we don't want to change the timezone typically.
|
|
11
|
-
* By default assumption is that the input is UTC, however it can be switched to timezoned time.
|
|
12
|
-
*/
|
|
13
|
-
declare const getDate: (props: GetDate) => Date;
|
|
14
|
-
export default getDate;
|
package/date/getDate.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
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
|
-
const getMidnight_1 = __importDefault(require("./getMidnight"));
|
|
7
|
-
/**
|
|
8
|
-
* Convert a (number | string | Date) into a Date object.
|
|
9
|
-
* As the user would be providing the input we don't want to change the timezone typically.
|
|
10
|
-
* By default assumption is that the input is UTC, however it can be switched to timezoned time.
|
|
11
|
-
*/
|
|
12
|
-
const getDate = (props) => {
|
|
13
|
-
let date;
|
|
14
|
-
let isUtc = undefined === props?.isUtc ? true : props.isUtc;
|
|
15
|
-
// Already date instance - no change
|
|
16
|
-
if (props.input instanceof Date) {
|
|
17
|
-
date = new Date(props.input.valueOf());
|
|
18
|
-
}
|
|
19
|
-
else if ("string" === typeof props.input || "number" === typeof props.input) {
|
|
20
|
-
// Convert the input into string
|
|
21
|
-
const dateString = props.input.toString();
|
|
22
|
-
const regexes = {
|
|
23
|
-
ymdDash: new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}$"),
|
|
24
|
-
ymdNumber: new RegExp("^[0-9]{8}$"),
|
|
25
|
-
ymdHisDash: new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$"),
|
|
26
|
-
ymdHisNumber: new RegExp("^[0-9]{14}$"),
|
|
27
|
-
};
|
|
28
|
-
// console.log('regexes.ymdHisDash.test(dateString) ',regexes.ymdHisDash.test(dateString));
|
|
29
|
-
// 20220412
|
|
30
|
-
if (regexes.ymdNumber.test(dateString)) {
|
|
31
|
-
const year = Number(dateString.substring(0, 4));
|
|
32
|
-
const month = Number(dateString.substring(4, 6)) - 1;
|
|
33
|
-
const day = Number(dateString.substring(6, 8));
|
|
34
|
-
date = new Date();
|
|
35
|
-
// Reset the date to the 1st initially at 1am
|
|
36
|
-
date.setUTCDate(1);
|
|
37
|
-
date.setUTCHours(1, 0, 0, 0);
|
|
38
|
-
if (isUtc) {
|
|
39
|
-
date.setUTCFullYear(year);
|
|
40
|
-
date.setUTCMonth(month);
|
|
41
|
-
date.setUTCDate(day);
|
|
42
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
date.setFullYear(year);
|
|
46
|
-
date.setMonth(month);
|
|
47
|
-
date.setDate(day);
|
|
48
|
-
date.setHours(0, 0, 0, 0);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// 2022-04-12
|
|
52
|
-
else if (regexes.ymdDash.test(dateString)) {
|
|
53
|
-
const year = Number(dateString.substring(0, 4));
|
|
54
|
-
const month = Number(dateString.substring(5, 7)) - 1;
|
|
55
|
-
const day = Number(dateString.substring(8, 10));
|
|
56
|
-
date = new Date();
|
|
57
|
-
// Reset the date to the 1st initially at 1am
|
|
58
|
-
date.setUTCDate(1);
|
|
59
|
-
date.setUTCHours(1, 0, 0, 0);
|
|
60
|
-
// Finalise date
|
|
61
|
-
if (isUtc) {
|
|
62
|
-
date.setUTCFullYear(year);
|
|
63
|
-
date.setUTCMonth(month);
|
|
64
|
-
date.setUTCDate(day);
|
|
65
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
date.setFullYear(year);
|
|
69
|
-
date.setMonth(month);
|
|
70
|
-
date.setDate(day);
|
|
71
|
-
date.setHours(0, 0, 0, 0);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
// 2022-04-12 01:01:01
|
|
75
|
-
else if (regexes.ymdHisDash.test(dateString)) {
|
|
76
|
-
const year = Number(dateString.substring(0, 4));
|
|
77
|
-
const month = Number(dateString.substring(5, 7)) - 1;
|
|
78
|
-
const day = Number(dateString.substring(8, 10));
|
|
79
|
-
const hours = Number(dateString.substring(11, 13));
|
|
80
|
-
const minutes = Number(dateString.substring(14, 16));
|
|
81
|
-
const seconds = Number(dateString.substring(17, 19));
|
|
82
|
-
date = new Date();
|
|
83
|
-
// Reset the date to the 1st initially at 1am
|
|
84
|
-
date.setUTCDate(1);
|
|
85
|
-
date.setUTCHours(1, 0, 0, 0);
|
|
86
|
-
// Finalise date
|
|
87
|
-
if (isUtc) {
|
|
88
|
-
date.setUTCFullYear(year);
|
|
89
|
-
date.setUTCMonth(month);
|
|
90
|
-
date.setUTCDate(day);
|
|
91
|
-
date.setUTCHours(hours, minutes, seconds);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
date.setFullYear(year);
|
|
95
|
-
date.setMonth(month);
|
|
96
|
-
date.setDate(day);
|
|
97
|
-
date.setHours(hours, minutes, seconds);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
// 20220412010101
|
|
101
|
-
else if (regexes.ymdHisNumber.test(dateString)) {
|
|
102
|
-
const year = Number(dateString.substring(0, 4));
|
|
103
|
-
const month = Number(dateString.substring(4, 6)) - 1;
|
|
104
|
-
const day = Number(dateString.substring(6, 8));
|
|
105
|
-
const hours = Number(dateString.substring(8, 10));
|
|
106
|
-
const minutes = Number(dateString.substring(10, 12));
|
|
107
|
-
const seconds = Number(dateString.substring(12, 14));
|
|
108
|
-
date = new Date();
|
|
109
|
-
// Reset the date to the 1st initially at 1am
|
|
110
|
-
date.setUTCDate(1);
|
|
111
|
-
date.setUTCHours(1, 0, 0, 0);
|
|
112
|
-
// Finalise date
|
|
113
|
-
if (isUtc) {
|
|
114
|
-
date.setUTCFullYear(year);
|
|
115
|
-
date.setUTCMonth(month);
|
|
116
|
-
date.setUTCDate(day);
|
|
117
|
-
date.setUTCHours(hours, minutes, seconds);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
date.setFullYear(year);
|
|
121
|
-
date.setMonth(month);
|
|
122
|
-
date.setDate(day);
|
|
123
|
-
date.setHours(hours, minutes, seconds);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// Unsure date format, try anything
|
|
127
|
-
else {
|
|
128
|
-
date = new Date(dateString);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
// Reset to midnight
|
|
132
|
-
date = (0, getMidnight_1.default)({
|
|
133
|
-
input: date,
|
|
134
|
-
setMidnight: props?.setMidnight,
|
|
135
|
-
});
|
|
136
|
-
return date;
|
|
137
|
-
};
|
|
138
|
-
exports.default = getDate;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DateType } from "./";
|
|
2
|
-
type GetDatesBetween = {
|
|
3
|
-
end: DateType;
|
|
4
|
-
start: DateType;
|
|
5
|
-
isUtc?: boolean;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Similar to date-fns' eachDayOfInterval, however the timezone messes this function up.
|
|
9
|
-
* https://date-fns.org/v2.28.0/docs/eachDayOfInterval
|
|
10
|
-
* https://www.gov.uk/when-do-the-clocks-change
|
|
11
|
-
*/
|
|
12
|
-
declare const getDatesBetween: (props: GetDatesBetween) => Date[];
|
|
13
|
-
export default getDatesBetween;
|