@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,11 +0,0 @@
|
|
|
1
|
-
type CreateDataset = {
|
|
2
|
-
datasetId: string;
|
|
3
|
-
projectId?: string;
|
|
4
|
-
options: object;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Create a Dataset if it doesn't already exist.
|
|
8
|
-
* Returns table instance.
|
|
9
|
-
*/
|
|
10
|
-
declare const createDataset: ({ datasetId, options, projectId }: CreateDataset) => Promise<void>;
|
|
11
|
-
export default createDataset;
|
|
@@ -1,22 +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 getClient_1 = __importDefault(require("./getClient"));
|
|
7
|
-
const isDatasetExists_1 = __importDefault(require("./isDatasetExists"));
|
|
8
|
-
/**
|
|
9
|
-
* Create a Dataset if it doesn't already exist.
|
|
10
|
-
* Returns table instance.
|
|
11
|
-
*/
|
|
12
|
-
const createDataset = async ({ datasetId, options, projectId }) => {
|
|
13
|
-
const datasetExists = await (0, isDatasetExists_1.default)({
|
|
14
|
-
datasetId,
|
|
15
|
-
projectId,
|
|
16
|
-
});
|
|
17
|
-
if (!datasetExists) {
|
|
18
|
-
let client = (0, getClient_1.default)({ projectId });
|
|
19
|
-
await client.createDataset(datasetId, options || {});
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
exports.default = createDataset;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type CreateTable = {
|
|
2
|
-
datasetId: string;
|
|
3
|
-
datasetOptions?: object;
|
|
4
|
-
projectId?: string;
|
|
5
|
-
options?: object;
|
|
6
|
-
tableId: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Create a Table if it doesn't already exist.
|
|
10
|
-
*/
|
|
11
|
-
declare const createTable: ({ datasetId, datasetOptions, options, projectId, tableId }: CreateTable) => Promise<void>;
|
|
12
|
-
export default createTable;
|
|
@@ -1,31 +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 IsTableExists_1 = __importDefault(require("./IsTableExists"));
|
|
7
|
-
const getClient_1 = __importDefault(require("./getClient"));
|
|
8
|
-
const createDataset_1 = __importDefault(require("./createDataset"));
|
|
9
|
-
/**
|
|
10
|
-
* Create a Table if it doesn't already exist.
|
|
11
|
-
*/
|
|
12
|
-
const createTable = async ({ datasetId, datasetOptions, options, projectId, tableId }) => {
|
|
13
|
-
// Create the BigQuery table if it doesn't exist
|
|
14
|
-
await (0, createDataset_1.default)({
|
|
15
|
-
datasetId,
|
|
16
|
-
options: datasetOptions,
|
|
17
|
-
projectId,
|
|
18
|
-
});
|
|
19
|
-
const tableExists = await (0, IsTableExists_1.default)({
|
|
20
|
-
datasetId,
|
|
21
|
-
projectId,
|
|
22
|
-
tableId
|
|
23
|
-
});
|
|
24
|
-
if (!tableExists) {
|
|
25
|
-
let client = (0, getClient_1.default)({ projectId });
|
|
26
|
-
await client
|
|
27
|
-
.dataset(datasetId)
|
|
28
|
-
.createTable(tableId, options || {});
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
exports.default = createTable;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Create a new client if the project id differs from the global.
|
|
5
|
-
*/
|
|
6
|
-
const getClient = (props) => {
|
|
7
|
-
let client = global.googleBigQueryClient;
|
|
8
|
-
if (props?.projectId && props?.projectId !== global.googleBigQueryDefaultProjectId) {
|
|
9
|
-
const { BigQuery } = require('@google-cloud/bigquery');
|
|
10
|
-
client = new BigQuery({
|
|
11
|
-
credentials: global.googleBigQueryDefault.credentials,
|
|
12
|
-
location: props?.location || "europe-west2",
|
|
13
|
-
projectId: props?.projectId,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return client;
|
|
17
|
-
};
|
|
18
|
-
exports.default = getClient;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type GetDatasets = {
|
|
2
|
-
projectId?: string;
|
|
3
|
-
};
|
|
4
|
-
type Datasets = {
|
|
5
|
-
id: string;
|
|
6
|
-
location: string;
|
|
7
|
-
projectId: string;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Retrieve all the Datasets from a given Project.
|
|
11
|
-
*/
|
|
12
|
-
declare const getDatasets: ({ projectId }: GetDatasets) => Promise<Datasets[]>;
|
|
13
|
-
export default getDatasets;
|
|
@@ -1,27 +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 getClient_1 = __importDefault(require("./getClient"));
|
|
7
|
-
/**
|
|
8
|
-
* Retrieve all the Datasets from a given Project.
|
|
9
|
-
*/
|
|
10
|
-
const getDatasets = async ({ projectId }) => {
|
|
11
|
-
let response = [];
|
|
12
|
-
const client = (0, getClient_1.default)({
|
|
13
|
-
projectId,
|
|
14
|
-
});
|
|
15
|
-
const datasets = await client.getDatasets();
|
|
16
|
-
if (datasets?.[0]) {
|
|
17
|
-
for (let i = 0; i < datasets[0].length; i++) {
|
|
18
|
-
response.push({
|
|
19
|
-
id: datasets[0][i].id,
|
|
20
|
-
location: datasets[0][i].location,
|
|
21
|
-
projectId: datasets[0][i].bigQuery.projectId,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return response;
|
|
26
|
-
};
|
|
27
|
-
exports.default = getDatasets;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type GetTables = {
|
|
2
|
-
datasetId?: string;
|
|
3
|
-
projectId?: string;
|
|
4
|
-
};
|
|
5
|
-
type Tables = {
|
|
6
|
-
id: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Retrieve all the Tables from a given Project/Dataset.
|
|
10
|
-
*/
|
|
11
|
-
declare const getTables: (props: GetTables) => Promise<Tables[]>;
|
|
12
|
-
export default getTables;
|
|
@@ -1,25 +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 getClient_1 = __importDefault(require("./getClient"));
|
|
7
|
-
/**
|
|
8
|
-
* Retrieve all the Tables from a given Project/Dataset.
|
|
9
|
-
*/
|
|
10
|
-
const getTables = async (props) => {
|
|
11
|
-
let response = [];
|
|
12
|
-
const client = (0, getClient_1.default)({
|
|
13
|
-
projectId: props.projectId,
|
|
14
|
-
});
|
|
15
|
-
const tables = await client.dataset(props.datasetId).getTables();
|
|
16
|
-
if (tables?.[0]) {
|
|
17
|
-
for (let i = 0; i < tables[0].length; i++) {
|
|
18
|
-
response.push({
|
|
19
|
-
id: tables[0][i].id,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return response;
|
|
24
|
-
};
|
|
25
|
-
exports.default = getTables;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Config } from '../getConfig';
|
|
2
|
-
type InitClient = {
|
|
3
|
-
parameter: Config;
|
|
4
|
-
projectId: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Initialise the Big Query client.
|
|
8
|
-
* It's possible to use multiple clients, so we set one up per project id.
|
|
9
|
-
*/
|
|
10
|
-
declare const initClient: ({ parameter, projectId }: InitClient) => void;
|
|
11
|
-
export default initClient;
|
|
@@ -1,29 +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 getConfig_1 = __importDefault(require("../getConfig"));
|
|
7
|
-
global.googleBigQueryDefault = {
|
|
8
|
-
credentials: null,
|
|
9
|
-
projectId: null,
|
|
10
|
-
};
|
|
11
|
-
global.googleBigQueryClient = null;
|
|
12
|
-
/**
|
|
13
|
-
* Initialise the Big Query client.
|
|
14
|
-
* It's possible to use multiple clients, so we set one up per project id.
|
|
15
|
-
*/
|
|
16
|
-
const initClient = ({ parameter, projectId }) => {
|
|
17
|
-
if (!global.googleBigQueryClient) {
|
|
18
|
-
const { BigQuery } = require('@google-cloud/bigquery');
|
|
19
|
-
const formattedConfig = (0, getConfig_1.default)({ parameter });
|
|
20
|
-
global.googleBigQueryDefault.credentials = formattedConfig;
|
|
21
|
-
global.googleBigQueryDefault.projectId = projectId;
|
|
22
|
-
global.googleBigQueryClient = new BigQuery({
|
|
23
|
-
credentials: global.googleBigQueryDefault.credentials,
|
|
24
|
-
location: "europe-west2",
|
|
25
|
-
projectId: global.googleBigQueryDefault.projectId,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
exports.default = initClient;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type IsDatasetExists = {
|
|
2
|
-
datasetId: string;
|
|
3
|
-
projectId?: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Check to see whether a given BigQuery dataset exists.
|
|
7
|
-
* Based off:
|
|
8
|
-
* https://github.com/googleapis/nodejs-bigquery/blob/main/samples/getDataset.js
|
|
9
|
-
*/
|
|
10
|
-
declare const isDatasetExists: ({ datasetId, projectId }: IsDatasetExists) => Promise<boolean>;
|
|
11
|
-
export default isDatasetExists;
|
|
@@ -1,25 +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 getClient_1 = __importDefault(require("./getClient"));
|
|
7
|
-
/**
|
|
8
|
-
* Check to see whether a given BigQuery dataset exists.
|
|
9
|
-
* Based off:
|
|
10
|
-
* https://github.com/googleapis/nodejs-bigquery/blob/main/samples/getDataset.js
|
|
11
|
-
*/
|
|
12
|
-
const isDatasetExists = async ({ datasetId, projectId }) => {
|
|
13
|
-
let response;
|
|
14
|
-
let client = (0, getClient_1.default)({ projectId });
|
|
15
|
-
try {
|
|
16
|
-
await client.dataset(datasetId)
|
|
17
|
-
.get();
|
|
18
|
-
response = true;
|
|
19
|
-
}
|
|
20
|
-
catch (exception) {
|
|
21
|
-
response = false;
|
|
22
|
-
}
|
|
23
|
-
return response;
|
|
24
|
-
};
|
|
25
|
-
exports.default = isDatasetExists;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
type LoadData = {
|
|
2
|
-
file: {
|
|
3
|
-
bucket: string;
|
|
4
|
-
key: string;
|
|
5
|
-
metadata: object;
|
|
6
|
-
projectId?: string;
|
|
7
|
-
};
|
|
8
|
-
table: {
|
|
9
|
-
projectId?: string;
|
|
10
|
-
datasetId: string;
|
|
11
|
-
tableId: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Load data into a given table.
|
|
16
|
-
*/
|
|
17
|
-
declare const loadData: ({ file, table }: LoadData) => Promise<void>;
|
|
18
|
-
export default loadData;
|
|
@@ -1,32 +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 IsTableExists_1 = __importDefault(require("./IsTableExists"));
|
|
7
|
-
const getClient_1 = __importDefault(require("./getClient"));
|
|
8
|
-
const getClient_2 = __importDefault(require("../storage/getClient"));
|
|
9
|
-
/**
|
|
10
|
-
* Load data into a given table.
|
|
11
|
-
*/
|
|
12
|
-
const loadData = async ({ file, table }) => {
|
|
13
|
-
const tableExists = await (0, IsTableExists_1.default)({
|
|
14
|
-
datasetId: table.datasetId,
|
|
15
|
-
projectId: table.projectId,
|
|
16
|
-
tableId: table.tableId,
|
|
17
|
-
});
|
|
18
|
-
if (tableExists) {
|
|
19
|
-
let bigqueryClient = (0, getClient_1.default)({
|
|
20
|
-
projectId: table.projectId
|
|
21
|
-
});
|
|
22
|
-
let storageClient = (0, getClient_2.default)({
|
|
23
|
-
projectId: file.projectId
|
|
24
|
-
});
|
|
25
|
-
await bigqueryClient
|
|
26
|
-
.dataset(table.datasetId)
|
|
27
|
-
.table(table.tableId)
|
|
28
|
-
.load(storageClient.bucket(file.bucket)
|
|
29
|
-
.file(file.key), file.metadata);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
exports.default = loadData;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://cloud.google.com/bigquery/docs/parameterized-queries
|
|
3
|
-
*/
|
|
4
|
-
export type QueryInput = string | {
|
|
5
|
-
query: string;
|
|
6
|
-
location?: string;
|
|
7
|
-
params: {
|
|
8
|
-
[key: string]: any;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export type Query = {
|
|
12
|
-
input: QueryInput;
|
|
13
|
-
projectId?: string;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Build the query and return the data.
|
|
17
|
-
*/
|
|
18
|
-
declare const query: ({ input, projectId }: Query) => Promise<any>;
|
|
19
|
-
export default query;
|
package/google/bigQuery/query.js
DELETED
|
@@ -1,15 +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 getClient_1 = __importDefault(require("./getClient"));
|
|
7
|
-
/**
|
|
8
|
-
* Build the query and return the data.
|
|
9
|
-
*/
|
|
10
|
-
const query = async ({ input, projectId }) => {
|
|
11
|
-
let client = (0, getClient_1.default)({ projectId });
|
|
12
|
-
const apiResponse = await client.query(input);
|
|
13
|
-
return apiResponse;
|
|
14
|
-
};
|
|
15
|
-
exports.default = query;
|
package/google/getConfig.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type Config = {
|
|
2
|
-
type: string;
|
|
3
|
-
project_id: string;
|
|
4
|
-
private_key_id: string;
|
|
5
|
-
private_key: string;
|
|
6
|
-
client_email: string;
|
|
7
|
-
client_id: string;
|
|
8
|
-
auth_uri: string;
|
|
9
|
-
token_uri: string;
|
|
10
|
-
auth_provider_x509_cert_url: string;
|
|
11
|
-
client_x509_cert_url: string;
|
|
12
|
-
};
|
|
13
|
-
export type GetConfig = {
|
|
14
|
-
parameter: Config;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Using the response from Parameter Store and format it ready to be used with Google API.
|
|
18
|
-
*/
|
|
19
|
-
declare const getConfig: ({ parameter }: GetConfig) => Config;
|
|
20
|
-
export default getConfig;
|
package/google/getConfig.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Using the response from Parameter Store and format it ready to be used with Google API.
|
|
5
|
-
*/
|
|
6
|
-
const getConfig = ({ parameter }) => {
|
|
7
|
-
// Format the private key to be in the same format as required by Google
|
|
8
|
-
const privateKey = parameter['private_key'].replace(/\\n/g, '\n');
|
|
9
|
-
const response = {
|
|
10
|
-
type: parameter['type'],
|
|
11
|
-
project_id: parameter['project_id'],
|
|
12
|
-
private_key_id: parameter['private_key_id'],
|
|
13
|
-
private_key: privateKey,
|
|
14
|
-
client_email: parameter['client_email'],
|
|
15
|
-
client_id: parameter['client_id'],
|
|
16
|
-
auth_uri: parameter['auth_uri'],
|
|
17
|
-
token_uri: parameter['token_uri'],
|
|
18
|
-
auth_provider_x509_cert_url: parameter['auth_provider_x509_cert_url'],
|
|
19
|
-
client_x509_cert_url: parameter['client_x509_cert_url'],
|
|
20
|
-
};
|
|
21
|
-
return response;
|
|
22
|
-
};
|
|
23
|
-
exports.default = getConfig;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
type GetAssociatedData = {
|
|
2
|
-
spreadsheetId: string;
|
|
3
|
-
ranges: [
|
|
4
|
-
format: string,
|
|
5
|
-
defaultRange: string,
|
|
6
|
-
heading: string,
|
|
7
|
-
data: string
|
|
8
|
-
];
|
|
9
|
-
dateTimeRender: 'FORMATTED_STRING' | 'SERIAL_NUMBER';
|
|
10
|
-
valueRender: 'FORMATTED_VALUE' | 'UNFORMATTED_VALUE' | 'FORMULA';
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Make a batch get to Google Sheets to retrieve the data correctly formatted, with default values provided.
|
|
14
|
-
*/
|
|
15
|
-
declare const getAssociatedData: ({ dateTimeRender, ranges, spreadsheetId, valueRender }: GetAssociatedData) => Promise<object[]>;
|
|
16
|
-
export default getAssociatedData;
|
|
@@ -1,53 +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 getBatchData_1 = __importDefault(require("./getBatchData"));
|
|
7
|
-
/**
|
|
8
|
-
* Make a batch get to Google Sheets to retrieve the data correctly formatted, with default values provided.
|
|
9
|
-
*/
|
|
10
|
-
const getAssociatedData = async ({ dateTimeRender, ranges, spreadsheetId, valueRender }) => {
|
|
11
|
-
// Make the API request
|
|
12
|
-
const apiResponse = await (0, getBatchData_1.default)({
|
|
13
|
-
spreadsheetId,
|
|
14
|
-
ranges,
|
|
15
|
-
dateTimeRender,
|
|
16
|
-
valueRender,
|
|
17
|
-
});
|
|
18
|
-
let template = [];
|
|
19
|
-
let response = [];
|
|
20
|
-
// Missing ranges or too many ranges
|
|
21
|
-
if (4 !== apiResponse.valueRanges.length) {
|
|
22
|
-
throw new Error("Associated data response length must be 4.");
|
|
23
|
-
}
|
|
24
|
-
// Get the first data range
|
|
25
|
-
const initialRangeLength = apiResponse.valueRanges[0].values[0].length;
|
|
26
|
-
// Loop through the headings
|
|
27
|
-
for (let i = 0; i < initialRangeLength; i++) {
|
|
28
|
-
template.push({
|
|
29
|
-
format: apiResponse.valueRanges[0].values[0][i],
|
|
30
|
-
default: apiResponse.valueRanges[1].values[0][i],
|
|
31
|
-
heading: apiResponse.valueRanges[2].values[0][i],
|
|
32
|
-
index: i,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
// console.log('template', template);
|
|
36
|
-
// Loop through each row of data
|
|
37
|
-
if (undefined !== apiResponse.valueRanges[3].values) {
|
|
38
|
-
for (let rowIndex = 0; rowIndex < apiResponse.valueRanges[3].values.length; rowIndex++) {
|
|
39
|
-
let row = {};
|
|
40
|
-
// Loop through each column within the row
|
|
41
|
-
for (let columnIndex = 0; columnIndex < apiResponse.valueRanges[3].values[rowIndex].length; columnIndex++) {
|
|
42
|
-
const refValue = apiResponse.valueRanges[3].values[rowIndex][columnIndex];
|
|
43
|
-
const value = ('' === refValue ? template[columnIndex]['default'] : refValue);
|
|
44
|
-
// Add this to our row
|
|
45
|
-
row[template[columnIndex]['heading']] = value;
|
|
46
|
-
}
|
|
47
|
-
// Add the row to our response
|
|
48
|
-
response.push(row);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return response;
|
|
52
|
-
};
|
|
53
|
-
exports.default = getAssociatedData;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
type BatchData = {
|
|
2
|
-
spreadsheetId: string;
|
|
3
|
-
valueRanges: {
|
|
4
|
-
range: string;
|
|
5
|
-
majorDimension: 'rows' | 'dimension';
|
|
6
|
-
values: [
|
|
7
|
-
any[]
|
|
8
|
-
];
|
|
9
|
-
}[];
|
|
10
|
-
};
|
|
11
|
-
type GetBatchData = {
|
|
12
|
-
spreadsheetId: string;
|
|
13
|
-
ranges: string[];
|
|
14
|
-
dateTimeRender?: string;
|
|
15
|
-
valueRender?: string;
|
|
16
|
-
};
|
|
17
|
-
declare const getBatchData: ({ spreadsheetId, ranges, dateTimeRender, valueRender, }: GetBatchData) => Promise<BatchData>;
|
|
18
|
-
export default getBatchData;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const getBatchData = async ({ spreadsheetId, ranges, dateTimeRender = 'FORMATTED_STRING', valueRender = 'UNFORMATTED_VALUE', }) => {
|
|
4
|
-
const googleApisSheets = require('@googleapis/sheets');
|
|
5
|
-
const request = {
|
|
6
|
-
auth: global.googleSheetsClient,
|
|
7
|
-
dateTimeRenderOption: dateTimeRender,
|
|
8
|
-
ranges: ranges,
|
|
9
|
-
spreadsheetId: spreadsheetId,
|
|
10
|
-
valueRenderOption: valueRender,
|
|
11
|
-
};
|
|
12
|
-
// Make the API request
|
|
13
|
-
const apiResponse = (await googleApisSheets.sheets('v4')
|
|
14
|
-
.spreadsheets
|
|
15
|
-
.values
|
|
16
|
-
.batchGet(request));
|
|
17
|
-
return apiResponse.data;
|
|
18
|
-
};
|
|
19
|
-
exports.default = getBatchData;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Config } from '../getConfig';
|
|
2
|
-
type InitClient = {
|
|
3
|
-
parameter: Config;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Initialise the Google Sheets instance using the separate service method.
|
|
7
|
-
* https://github.com/googleapis/google-api-nodejs-client
|
|
8
|
-
* Library: @googleapis/sheets
|
|
9
|
-
*/
|
|
10
|
-
declare const initClient: ({ parameter }: InitClient) => void;
|
|
11
|
-
export default initClient;
|
|
@@ -1,25 +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 getConfig_1 = __importDefault(require("../getConfig"));
|
|
7
|
-
global.googleSheetsClient = null;
|
|
8
|
-
/**
|
|
9
|
-
* Initialise the Google Sheets instance using the separate service method.
|
|
10
|
-
* https://github.com/googleapis/google-api-nodejs-client
|
|
11
|
-
* Library: @googleapis/sheets
|
|
12
|
-
*/
|
|
13
|
-
const initClient = ({ parameter }) => {
|
|
14
|
-
if (!global.googleSheetsClient) {
|
|
15
|
-
const googleApisSheets = require('@googleapis/sheets');
|
|
16
|
-
const formattedConfig = (0, getConfig_1.default)({ parameter });
|
|
17
|
-
global.googleSheetsClient = new googleApisSheets.auth.GoogleAuth({
|
|
18
|
-
credentials: formattedConfig,
|
|
19
|
-
scopes: [
|
|
20
|
-
'https://www.googleapis.com/auth/spreadsheets',
|
|
21
|
-
],
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
exports.default = initClient;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type CopyToCloud = {
|
|
2
|
-
bucket: string;
|
|
3
|
-
localFile: string;
|
|
4
|
-
options?: object;
|
|
5
|
-
projectId?: string;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Copy a local file to Google Cloud Storage.
|
|
9
|
-
*/
|
|
10
|
-
export declare const copyToCloud: ({ bucket, localFile, options, projectId }: CopyToCloud) => Promise<any>;
|
|
11
|
-
export default copyToCloud;
|
|
@@ -1,18 +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
|
-
exports.copyToCloud = void 0;
|
|
7
|
-
const getClient_1 = __importDefault(require("./getClient"));
|
|
8
|
-
/**
|
|
9
|
-
* Copy a local file to Google Cloud Storage.
|
|
10
|
-
*/
|
|
11
|
-
const copyToCloud = async ({ bucket, localFile, options, projectId }) => {
|
|
12
|
-
const bucketInstance = (0, getClient_1.default)({ projectId })
|
|
13
|
-
.bucket(bucket);
|
|
14
|
-
const apiResponse = await bucketInstance.upload(localFile, options);
|
|
15
|
-
return apiResponse;
|
|
16
|
-
};
|
|
17
|
-
exports.copyToCloud = copyToCloud;
|
|
18
|
-
exports.default = exports.copyToCloud;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/**
|
|
4
|
-
* Create a new client if the project id differs from the global.
|
|
5
|
-
*/
|
|
6
|
-
const getClient = ({ projectId }) => {
|
|
7
|
-
let client = global.googleStorageClient;
|
|
8
|
-
if (undefined !== projectId && projectId !== global.googleStorageDefault.projectId) {
|
|
9
|
-
const { Storage } = require('@google-cloud/storage');
|
|
10
|
-
client = new Storage({
|
|
11
|
-
credentials: global.googleStorageDefault.credentials,
|
|
12
|
-
location: "europe-west2",
|
|
13
|
-
projectId: projectId,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return client;
|
|
17
|
-
};
|
|
18
|
-
exports.default = getClient;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Config } from '../getConfig';
|
|
2
|
-
type InitClient = {
|
|
3
|
-
parameter: Config;
|
|
4
|
-
projectId: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Initialise the Google Sheets instance using the separate service method.
|
|
8
|
-
* https://github.com/googleapis/google-api-nodejs-client
|
|
9
|
-
* Library: @googleapis/sheets
|
|
10
|
-
*/
|
|
11
|
-
declare const initClient: ({ parameter, projectId }: InitClient) => void;
|
|
12
|
-
export default initClient;
|