@8ms/helpers 1.39.0 → 2.0.1
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 +29 -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/_class/BaseClass.d.ts +18 -0
- package/_class/BaseClass.js +53 -0
- package/_class/BaseNamespace.d.ts +9 -0
- package/_class/BaseNamespace.js +27 -0
- package/_class/index.d.ts +2 -0
- package/_class/index.js +7 -0
- package/adverity/getJobs.d.ts +15 -0
- package/adverity/getJobs.js +30 -0
- package/adverity/index.d.ts +112 -0
- package/adverity/index.js +61 -0
- package/api/ApiResponseClass.d.ts +35 -0
- package/api/ApiResponseClass.js +97 -0
- package/api/index.d.ts +14 -1
- package/api/index.js +41 -10
- package/array/index.d.ts +8 -0
- package/array/{getArray.js → index.js} +8 -2
- package/atInternet/index.d.ts +16 -0
- package/atInternet/index.js +18 -0
- package/aws/athenaExpress/AwsAthenaNamespace.d.ts +8 -0
- package/aws/athenaExpress/AwsAthenaNamespace.js +82 -0
- package/aws/athenaExpress/index.d.ts +10 -0
- package/aws/athenaExpress/index.js +40 -0
- package/aws/ec2/AwsEc2Namespace.d.ts +10 -0
- package/aws/ec2/AwsEc2Namespace.js +78 -0
- package/aws/ec2/index.d.ts +3 -0
- package/aws/ec2/index.js +16 -0
- package/aws/ecs/AwsEcsNamespace.d.ts +53 -0
- package/aws/ecs/AwsEcsNamespace.js +159 -0
- package/aws/ecs/index.d.ts +3 -0
- package/aws/ecs/index.js +16 -0
- package/aws/glue/AwsGlueNamespace.d.ts +12 -0
- package/aws/glue/AwsGlueNamespace.js +70 -0
- package/aws/glue/index.d.ts +3 -0
- package/aws/glue/index.js +16 -0
- package/aws/index.d.ts +9 -0
- package/aws/index.js +34 -0
- package/aws/isResponse200.d.ts +1 -4
- package/aws/isResponse200.js +5 -11
- package/aws/lambda/AwsLambdaNamespace.d.ts +21 -0
- package/aws/lambda/AwsLambdaNamespace.js +110 -0
- package/aws/lambda/index.d.ts +4 -0
- package/aws/lambda/index.js +21 -0
- package/aws/s3/AwsS3Namespace.d.ts +60 -0
- package/aws/s3/AwsS3Namespace.js +401 -0
- package/aws/s3/index.d.ts +25 -0
- package/aws/s3/index.js +36 -0
- package/aws/s3/payload.d.ts +42 -0
- package/aws/s3/payload.js +46 -0
- package/aws/ses/AwsSesNamespace.d.ts +18 -0
- package/{date/getYesterday.js → aws/ses/AwsSesNamespace.js} +34 -17
- package/aws/ses/SimpleEmail.d.ts +38 -33
- package/aws/ses/SimpleEmail.js +77 -85
- package/aws/ses/index.d.ts +4 -0
- package/aws/ses/index.js +18 -0
- package/aws/sqs/AwsSqsNamespace.d.ts +34 -0
- package/aws/sqs/AwsSqsNamespace.js +96 -0
- package/aws/sqs/index.d.ts +3 -0
- package/aws/sqs/index.js +16 -0
- package/aws/ssm/AwsSsmNamespace.d.ts +11 -0
- package/aws/ssm/AwsSsmNamespace.js +89 -0
- package/aws/ssm/index.d.ts +3 -0
- package/aws/ssm/index.js +16 -0
- package/axios/deleteRequest.d.ts +6 -0
- package/axios/{delete.js → deleteRequest.js} +10 -16
- package/axios/get.d.ts +2 -7
- package/axios/get.js +8 -15
- package/axios/index.d.ts +3 -0
- package/axios/index.js +9 -0
- package/axios/post.d.ts +2 -8
- package/axios/post.js +8 -14
- package/boolean/getBoolean.d.ts +1 -4
- package/boolean/getBoolean.js +10 -3
- package/boolean/index.d.ts +1 -0
- package/boolean/index.js +5 -0
- package/brightData/index.d.ts +15 -0
- package/brightData/index.js +20 -0
- package/brightData/serpApi/buildGoogleSerpUrl.d.ts +2 -2
- package/brightData/serpApi/buildGoogleSerpUrl.js +2 -1
- package/brightData/serpApi/buildGoogleTrendsUrl.d.ts +2 -2
- package/brightData/serpApi/buildGoogleTrendsUrl.js +2 -1
- package/brightData/serpApi/getAsyncRequestId.d.ts +3 -9
- package/brightData/serpApi/getAsyncRequestId.js +14 -28
- package/brightData/serpApi/getAsyncResults.d.ts +3 -8
- package/brightData/serpApi/getAsyncResults.js +14 -28
- package/brightData/serpApi/getRealtime.d.ts +2 -7
- package/brightData/serpApi/getRealtime.js +13 -18
- package/brightData/serpApi/index.d.ts +14 -0
- package/brightData/serpApi/index.js +23 -0
- package/brightData/webScraperIde/getBatch.d.ts +2 -9
- package/brightData/webScraperIde/getBatch.js +12 -18
- package/brightData/webScraperIde/getRealtime.d.ts +2 -8
- package/brightData/webScraperIde/getRealtime.js +18 -33
- package/brightData/webScraperIde/index.d.ts +2 -0
- package/brightData/webScraperIde/index.js +7 -0
- package/cache/index.d.ts +2 -0
- package/cache/index.js +48 -0
- package/cache/test/cache.test.js +10 -0
- package/crud/index.d.ts +1 -1
- package/crud/index.js +8 -8
- package/crypto/getDecrypt.d.ts +1 -6
- package/crypto/getDecrypt.js +37 -3
- package/crypto/getEncrypt.d.ts +1 -6
- package/crypto/getEncrypt.js +37 -3
- package/crypto/getRandom.d.ts +1 -5
- package/crypto/getRandom.js +3 -3
- package/crypto/getSha256.d.ts +1 -4
- package/crypto/getSha256.js +39 -8
- package/crypto/index.d.ts +4 -0
- package/crypto/index.js +11 -0
- package/date/calculation.d.ts +75 -0
- package/date/calculation.js +207 -0
- package/date/financialYear.d.ts +19 -0
- package/date/financialYear.js +85 -0
- package/date/format.d.ts +66 -8
- package/date/format.js +148 -19
- package/date/index.d.ts +28 -48
- package/date/index.js +53 -32
- package/environment/index.d.ts +23 -0
- package/environment/index.js +79 -1
- package/eskimi/getAgeGroup.d.ts +1 -4
- package/eskimi/getAgeGroup.js +6 -8
- package/eskimi/getData.d.ts +1 -5
- package/eskimi/getData.js +9 -15
- package/eskimi/getDevice.d.ts +1 -4
- package/eskimi/getDevice.js +6 -8
- package/eskimi/getGender.d.ts +1 -4
- package/eskimi/getGender.js +6 -8
- package/eskimi/index.d.ts +49 -0
- package/eskimi/index.js +96 -0
- package/file/createDirectory.d.ts +1 -5
- package/file/createDirectory.js +38 -4
- package/file/index.d.ts +1 -0
- package/file/index.js +5 -0
- package/geo/countries.d.ts +12 -0
- package/geo/countries.js +222 -0
- package/geo/index.d.ts +2 -0
- package/geo/index.js +7 -0
- package/geo/languages.d.ts +9 -0
- package/geo/languages.js +58 -0
- package/google/bigQuery/GoogleBigQueryNamespace.d.ts +51 -0
- package/google/bigQuery/GoogleBigQueryNamespace.js +165 -0
- package/google/bigQuery/index.d.ts +5 -0
- package/google/bigQuery/index.js +37 -0
- package/google/bigQuery/loadData.d.ts +6 -5
- package/google/bigQuery/loadData.js +8 -22
- package/google/{getConfig.d.ts → index.d.ts} +13 -6
- package/google/index.js +24 -0
- package/google/sheets/GoogleSheetsNamespace.d.ts +16 -0
- package/google/sheets/GoogleSheetsNamespace.js +81 -0
- package/google/sheets/getAssociatedData.d.ts +5 -11
- package/google/sheets/getAssociatedData.js +13 -23
- package/google/sheets/index.d.ts +8 -0
- package/google/sheets/index.js +37 -0
- package/google/storage/GoogleCloudStorageNamespace.d.ts +20 -0
- package/google/storage/GoogleCloudStorageNamespace.js +108 -0
- package/google/storage/index.d.ts +3 -0
- package/google/storage/index.js +30 -0
- package/googleAds/GoogleAdsNamespace.d.ts +11 -0
- package/googleAds/GoogleAdsNamespace.js +73 -0
- package/googleAds/index.d.ts +11 -0
- package/googleAds/index.js +30 -0
- package/googleAds/keywordPlanner/index.d.ts +36 -234
- package/googleAds/keywordPlanner/index.js +52 -237
- package/googlePageSpeed/GooglePageSpeedNamespace.d.ts +11 -0
- package/googlePageSpeed/GooglePageSpeedNamespace.js +35 -0
- package/googlePageSpeed/index.d.ts +17 -0
- package/googlePageSpeed/index.js +44 -0
- package/googleSearchIncidents/index.d.ts +69 -0
- package/googleSearchIncidents/index.js +46 -0
- package/greenDomain/index.d.ts +21 -0
- package/greenDomain/index.js +41 -0
- package/inngest/index.d.ts +6 -0
- package/inngest/index.js +10 -0
- package/json/getJsonNewline.d.ts +1 -5
- package/json/getJsonNewline.js +5 -9
- package/json/index.d.ts +2 -0
- package/json/index.js +7 -0
- package/json/isJson.d.ts +1 -8
- package/json/isJson.js +18 -12
- package/littleWarden/LittleWardenNamespace.d.ts +11 -0
- package/littleWarden/LittleWardenNamespace.js +38 -0
- package/littleWarden/getUrlStatus.d.ts +1 -6
- package/littleWarden/getUrlStatus.js +8 -13
- package/littleWarden/index.d.ts +25 -1
- package/littleWarden/index.js +72 -7
- package/lumar/api/buildRequest.d.ts +3 -5
- package/lumar/api/buildRequest.js +40 -43
- package/lumar/api/getData.d.ts +2 -3
- package/lumar/api/getData.js +6 -11
- package/lumar/api/index.d.ts +36 -0
- package/lumar/api/index.js +33 -0
- package/lumar/api/initClient.d.ts +1 -8
- package/lumar/api/initClient.js +17 -29
- package/lumar/graphql/columns.d.ts +1 -2
- package/lumar/graphql/columns.js +2 -2
- package/lumar/graphql/getData.d.ts +1 -9
- package/lumar/graphql/getData.js +13 -19
- package/lumar/graphql/index.d.ts +29 -0
- package/lumar/graphql/index.js +39 -0
- package/lumar/graphql/initClient.d.ts +1 -8
- package/lumar/graphql/initClient.js +17 -30
- package/lumar/graphql/queries/getReportDifferences.js +2 -5
- package/lumar/graphql/reportTemplates.d.ts +1 -2
- package/lumar/graphql/reportTemplates.js +2 -2
- package/myTarget/request.d.ts +2 -6
- package/myTarget/request.js +8 -14
- package/nextAuth/index.d.ts +2 -1
- package/nextAuth/index.js +9 -7
- package/nextAuth/isSessionReady.d.ts +1 -4
- package/nextAuth/isSessionReady.js +3 -2
- package/nextJs/getIp.d.ts +1 -2
- package/nextJs/getIp.js +2 -1
- package/nextJs/getUserAgent.d.ts +1 -2
- package/nextJs/getUserAgent.js +2 -1
- package/nextJs/index.d.ts +2 -0
- package/nextJs/index.js +7 -0
- package/number/format.d.ts +4 -3
- package/number/format.js +12 -15
- package/number/{getCurrency.d.ts → formatCurrency.d.ts} +1 -6
- package/number/{getCurrency.js → formatCurrency.js} +7 -6
- package/number/getDecimal.d.ts +1 -6
- package/number/getDecimal.js +6 -10
- package/number/getNumber.d.ts +1 -5
- package/number/getNumber.js +30 -33
- package/number/getPercentIncrease.d.ts +1 -7
- package/number/getPercentIncrease.js +6 -12
- package/number/{getDivide.d.ts → getSafeDivide.d.ts} +3 -3
- package/number/getSafeDivide.js +20 -0
- package/number/index.d.ts +6 -0
- package/number/index.js +15 -0
- package/object/index.d.ts +1 -0
- package/object/index.js +5 -0
- package/object/replaceKeys.d.ts +1 -6
- package/object/replaceKeys.js +5 -10
- package/onePassword/OnePasswordNamespace.d.ts +13 -0
- package/onePassword/OnePasswordNamespace.js +81 -0
- package/onePassword/index.d.ts +7 -0
- package/onePassword/index.js +25 -0
- package/openAi/OpenAiNamespace.d.ts +11 -0
- package/openAi/OpenAiNamespace.js +44 -0
- package/openAi/index.d.ts +5 -0
- package/openAi/index.js +30 -0
- package/package.json +175 -46
- package/prisma/PrismaNamespace.d.ts +8 -0
- package/prisma/PrismaNamespace.js +79 -0
- package/prisma/getDecimal.d.ts +1 -6
- package/prisma/getDecimal.js +8 -10
- package/prisma/index.d.ts +8 -0
- package/prisma/index.js +29 -0
- package/snapchat/SnapchatNamespace.d.ts +15 -0
- package/snapchat/SnapchatNamespace.js +30 -0
- package/snapchat/index.d.ts +7 -0
- package/snapchat/index.js +30 -0
- package/sorting/byNumberAscending.d.ts +1 -5
- package/sorting/byNumberAscending.js +11 -9
- package/sorting/byNumberDescending.d.ts +1 -5
- package/sorting/byNumberDescending.js +13 -8
- package/sorting/byStringAscending.d.ts +1 -5
- package/sorting/byStringAscending.js +6 -11
- package/sorting/byStringDescending.d.ts +1 -5
- package/sorting/byStringDescending.js +6 -11
- package/sorting/index.d.ts +4 -0
- package/sorting/index.js +11 -0
- package/stream/index.d.ts +1 -0
- package/stream/index.js +5 -0
- package/stream/sort.d.ts +2 -3
- package/stream/sort.js +3 -2
- package/string/getCapitalised.d.ts +1 -6
- package/string/getCapitalised.js +5 -4
- package/string/getClean.d.ts +3 -3
- package/string/getClean.js +30 -44
- package/string/getFolder.d.ts +1 -5
- package/string/getFolder.js +4 -3
- package/string/getProperCase.d.ts +4 -4
- package/string/getProperCase.js +10 -12
- package/string/getString.d.ts +1 -4
- package/string/getString.js +8 -8
- package/string/getStringFromStream.d.ts +1 -4
- package/string/getStringFromStream.js +7 -6
- package/string/{getDecoded.d.ts → getUnescaped.d.ts} +1 -5
- package/string/{getDecoded.js → getUnescaped.js} +5 -5
- package/string/getWithoutAccents.d.ts +1 -5
- package/string/getWithoutAccents.js +4 -7
- package/string/getWithoutHtmlTags.d.ts +1 -5
- package/string/getWithoutHtmlTags.js +5 -8
- package/string/getWithoutPunctuation.d.ts +1 -5
- package/string/getWithoutPunctuation.js +6 -9
- package/string/getWithoutUnderscores.d.ts +1 -5
- package/string/getWithoutUnderscores.js +5 -8
- package/string/getWithoutWhitespaces.d.ts +1 -5
- package/string/getWithoutWhitespaces.js +5 -8
- package/string/index.d.ts +12 -0
- package/string/index.js +27 -0
- package/swr/index.d.ts +42 -0
- package/swr/index.js +59 -0
- package/upTimeRobot/UpTimeRobotNamespace.d.ts +31 -0
- package/upTimeRobot/UpTimeRobotNamespace.js +52 -0
- package/upTimeRobot/index.d.ts +38 -0
- package/upTimeRobot/index.js +63 -0
- package/url/index.d.ts +19 -0
- package/url/index.js +70 -0
- package/url/writeUrlContents.d.ts +1 -6
- package/url/writeUrlContents.js +41 -9
- package/util/defaultTo.d.ts +1 -7
- package/util/defaultTo.js +10 -9
- package/util/getBrotliCompressed.d.ts +2 -6
- package/util/getBrotliCompressed.js +10 -6
- package/util/getBrotliDecompressed.d.ts +2 -6
- package/util/getBrotliDecompressed.js +9 -5
- package/util/getClean.d.ts +3 -3
- package/util/getClean.js +12 -17
- package/util/getGzipCompressed.d.ts +2 -6
- package/util/getGzipCompressed.js +10 -6
- package/util/getGzipDecompressed.d.ts +2 -6
- package/util/getGzipDecompressed.js +11 -7
- package/util/getWithoutHash.d.ts +1 -5
- package/util/getWithoutHash.js +5 -4
- package/util/getWithoutParameter.d.ts +1 -5
- package/util/getWithoutParameter.js +5 -4
- package/util/index.d.ts +11 -0
- package/util/index.js +25 -0
- package/util/isUndefined.d.ts +1 -6
- package/util/isUndefined.js +6 -12
- package/util/promiseChunks.d.ts +1 -6
- package/util/promiseChunks.js +4 -3
- package/util/sleep.d.ts +1 -5
- package/util/sleep.js +4 -3
- package/webWorker/index.d.ts +1 -1
- package/webWorker/index.js +7 -7
- package/xml/getXml.d.ts +1 -5
- package/xml/getXml.js +5 -9
- package/api/ApiResponse.d.ts +0 -50
- package/api/ApiResponse.js +0 -94
- 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/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/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/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.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/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/type.d.ts +0 -11
- package/brightData/serpApi/type.js +0 -14
- package/class/BaseClass.d.ts +0 -31
- package/class/BaseClass.js +0 -50
- 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/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/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/getCampaignIds.d.ts +0 -7
- package/eskimi/getCampaignIds.js +0 -12
- 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/query.d.ts +0 -19
- package/google/bigQuery/query.js +0 -15
- package/google/getConfig.js +0 -23
- 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/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/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/filter.d.ts +0 -5
- package/lumar/api/filter.js +0 -2
- 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/getReportKey.d.ts +0 -9
- package/lumar/graphql/getReportKey.js +0 -9
- package/lumar/graphql/operands.d.ts +0 -16
- package/lumar/graphql/operands.js +0 -18
- 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/number/getDivide.js +0 -26
- 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/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/{aws/sqs/isEventSqs.d.ts → cache/test/cache.test.d.ts} +0 -0
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
type GetCurrency = {
|
|
2
|
-
currency: string;
|
|
3
|
-
input: any;
|
|
4
|
-
};
|
|
5
1
|
/**
|
|
6
2
|
* Use the International number formatting to return the currency value.
|
|
7
3
|
* https://www.freecodecamp.org/news/how-to-format-number-as-currency-in-javascript-one-line-of-code/
|
|
8
4
|
*/
|
|
9
|
-
declare const
|
|
10
|
-
export default getCurrency;
|
|
5
|
+
export declare const formatCurrency: (input: any, locale?: string, currency?: string) => string;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatCurrency = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* Use the International number formatting to return the currency value.
|
|
5
6
|
* https://www.freecodecamp.org/news/how-to-format-number-as-currency-in-javascript-one-line-of-code/
|
|
6
7
|
*/
|
|
7
|
-
const
|
|
8
|
+
const formatCurrency = (input, locale = "en-GB", currency = "GBP") => {
|
|
8
9
|
const value = Number(input);
|
|
9
10
|
const currencyClean = currency.toUpperCase()
|
|
10
11
|
.trim();
|
|
11
|
-
let formatted = new Intl.NumberFormat(
|
|
12
|
-
style:
|
|
12
|
+
let formatted = new Intl.NumberFormat(locale, {
|
|
13
|
+
style: "currency",
|
|
13
14
|
currency: currencyClean,
|
|
14
15
|
}).format(value);
|
|
15
|
-
if (
|
|
16
|
-
formatted = formatted.replace(
|
|
16
|
+
if ("USD" === currencyClean) {
|
|
17
|
+
formatted = formatted.replace("US$", "$");
|
|
17
18
|
}
|
|
18
19
|
return formatted;
|
|
19
20
|
};
|
|
20
|
-
exports.
|
|
21
|
+
exports.formatCurrency = formatCurrency;
|
package/number/getDecimal.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
type GetDecimal = {
|
|
2
|
-
dp?: number;
|
|
3
|
-
input: any;
|
|
4
|
-
};
|
|
5
1
|
/**
|
|
6
2
|
* Return a decimal number after rounding.
|
|
7
3
|
*/
|
|
8
|
-
declare const getDecimal: (
|
|
9
|
-
export default getDecimal;
|
|
4
|
+
export declare const getDecimal: (input: any, dp?: number) => number;
|
package/number/getDecimal.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
3
|
+
exports.getDecimal = void 0;
|
|
4
|
+
const getNumber_1 = require("./getNumber");
|
|
7
5
|
/**
|
|
8
6
|
* Return a decimal number after rounding.
|
|
9
7
|
*/
|
|
10
|
-
const getDecimal = (
|
|
11
|
-
const number = (0, getNumber_1.
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
return Number(number.toFixed(props?.dp || 2));
|
|
8
|
+
const getDecimal = (input, dp = 2) => {
|
|
9
|
+
const number = (0, getNumber_1.getNumber)(input);
|
|
10
|
+
return Number(number.toFixed(dp));
|
|
15
11
|
};
|
|
16
|
-
exports.
|
|
12
|
+
exports.getDecimal = getDecimal;
|
package/number/getNumber.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Take an input and return a number.
|
|
3
3
|
*/
|
|
4
|
-
declare const getNumber: (
|
|
5
|
-
defaultValue?: number;
|
|
6
|
-
input: any;
|
|
7
|
-
}) => number;
|
|
8
|
-
export default getNumber;
|
|
4
|
+
export declare const getNumber: (input: any, defaultValue?: number) => number;
|
package/number/getNumber.js
CHANGED
|
@@ -1,51 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
3
|
+
exports.getNumber = void 0;
|
|
4
|
+
const json_1 = require("../json");
|
|
7
5
|
/**
|
|
8
6
|
* Take an input and return a number.
|
|
9
7
|
*/
|
|
10
|
-
const getNumber = (
|
|
11
|
-
|
|
8
|
+
const getNumber = (input, defaultValue = 0) => {
|
|
9
|
+
// Handle null/undefined inputs
|
|
10
|
+
if (input == null) {
|
|
11
|
+
return defaultValue;
|
|
12
|
+
}
|
|
12
13
|
let response = input;
|
|
13
|
-
// JSON - Decode the value
|
|
14
|
-
if ((0,
|
|
15
|
-
|
|
16
|
-
if ('string' === typeof input) {
|
|
14
|
+
// JSON - Decode the value if it's a JSON string
|
|
15
|
+
if (typeof input === "string" && (0, json_1.isJson)(input)) {
|
|
16
|
+
try {
|
|
17
17
|
response = JSON.parse(input);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
catch {
|
|
20
|
+
// If parsing fails, continue with original input
|
|
21
21
|
response = input;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
// Already a number
|
|
25
|
-
if (
|
|
26
|
-
response
|
|
25
|
+
if (typeof response === "number") {
|
|
26
|
+
return isNaN(response) ? defaultValue : response;
|
|
27
27
|
}
|
|
28
28
|
// String input
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
if (typeof response === "string") {
|
|
30
|
+
// First, try direct conversion
|
|
31
|
+
const directConversion = Number(response.trim());
|
|
32
|
+
if (!isNaN(directConversion)) {
|
|
33
|
+
return directConversion;
|
|
34
|
+
}
|
|
35
|
+
// If that fails, try extracting numbers from the string
|
|
36
|
+
const match = response.match(/^\D*([0-9]*\.?[0-9]+)\D*$/);
|
|
37
|
+
if (match && match[1]) {
|
|
38
|
+
const extracted = Number(match[1]);
|
|
39
|
+
if (!isNaN(extracted)) {
|
|
40
|
+
return extracted;
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
// Trouble converting the number, use default value
|
|
46
|
-
if (isNaN(response)) {
|
|
47
|
-
response = actualDefaultValue;
|
|
48
|
-
}
|
|
49
|
-
return response;
|
|
44
|
+
// For other types, attempt direct conversion
|
|
45
|
+
const converted = Number(response);
|
|
46
|
+
return isNaN(converted) ? defaultValue : converted;
|
|
50
47
|
};
|
|
51
|
-
exports.
|
|
48
|
+
exports.getNumber = getNumber;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
type GetPercentageIncrease = {
|
|
2
|
-
comparison: any;
|
|
3
|
-
current: any;
|
|
4
|
-
defaultValue: number;
|
|
5
|
-
};
|
|
6
1
|
/**
|
|
7
2
|
* Formula to work out the percentage increase/decrease.
|
|
8
3
|
*/
|
|
9
|
-
declare const
|
|
10
|
-
export default getPercentageIncrease;
|
|
4
|
+
export declare const getPercentIncrease: (current: any, comparison: any, defaultValue: number) => number;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
3
|
+
exports.getPercentIncrease = void 0;
|
|
4
|
+
const getNumber_1 = require("./getNumber");
|
|
7
5
|
/**
|
|
8
6
|
* Formula to work out the percentage increase/decrease.
|
|
9
7
|
*/
|
|
10
|
-
const
|
|
11
|
-
const currentValue = (0, getNumber_1.
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
const comparisonValue = (0, getNumber_1.default)({
|
|
15
|
-
input: comparison
|
|
16
|
-
});
|
|
8
|
+
const getPercentIncrease = (current, comparison, defaultValue) => {
|
|
9
|
+
const currentValue = (0, getNumber_1.getNumber)(current);
|
|
10
|
+
const comparisonValue = (0, getNumber_1.getNumber)(comparison);
|
|
17
11
|
if (0 === comparisonValue) {
|
|
18
12
|
return defaultValue;
|
|
19
13
|
}
|
|
20
14
|
return (currentValue - comparisonValue) / comparisonValue * 100;
|
|
21
15
|
};
|
|
22
|
-
exports.
|
|
16
|
+
exports.getPercentIncrease = getPercentIncrease;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type GetSafeDivideProps = {
|
|
2
2
|
defaultValue?: number;
|
|
3
3
|
dp?: number;
|
|
4
4
|
divisor: any;
|
|
@@ -7,5 +7,5 @@ type GetDivide = {
|
|
|
7
7
|
/**
|
|
8
8
|
* Shorthand function to divide number, but fallback if the divisor is 0.
|
|
9
9
|
*/
|
|
10
|
-
declare const
|
|
11
|
-
export
|
|
10
|
+
export declare const getSafeDivide: (props: GetSafeDivideProps) => number;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSafeDivide = void 0;
|
|
4
|
+
const getNumber_1 = require("./getNumber");
|
|
5
|
+
const getDecimal_1 = require("./getDecimal");
|
|
6
|
+
/**
|
|
7
|
+
* Shorthand function to divide number, but fallback if the divisor is 0.
|
|
8
|
+
*/
|
|
9
|
+
const getSafeDivide = (props) => {
|
|
10
|
+
const numeratorInt = (0, getNumber_1.getNumber)(props.numerator);
|
|
11
|
+
if (numeratorInt === 0) {
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
const divisorInt = (0, getNumber_1.getNumber)(props.divisor);
|
|
15
|
+
if (divisorInt === 0 || !Number.isFinite(divisorInt)) {
|
|
16
|
+
return props?.defaultValue ?? 0;
|
|
17
|
+
}
|
|
18
|
+
return (0, getDecimal_1.getDecimal)(numeratorInt / divisorInt, props?.dp);
|
|
19
|
+
};
|
|
20
|
+
exports.getSafeDivide = getSafeDivide;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { format } from "./format";
|
|
2
|
+
export { formatCurrency } from "./formatCurrency";
|
|
3
|
+
export { getDecimal } from "./getDecimal";
|
|
4
|
+
export { getSafeDivide } from "./getSafeDivide";
|
|
5
|
+
export { getNumber } from "./getNumber";
|
|
6
|
+
export { getPercentIncrease } from "./getPercentIncrease";
|
package/number/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPercentIncrease = exports.getNumber = exports.getSafeDivide = exports.getDecimal = exports.formatCurrency = exports.format = void 0;
|
|
4
|
+
var format_1 = require("./format");
|
|
5
|
+
Object.defineProperty(exports, "format", { enumerable: true, get: function () { return format_1.format; } });
|
|
6
|
+
var formatCurrency_1 = require("./formatCurrency");
|
|
7
|
+
Object.defineProperty(exports, "formatCurrency", { enumerable: true, get: function () { return formatCurrency_1.formatCurrency; } });
|
|
8
|
+
var getDecimal_1 = require("./getDecimal");
|
|
9
|
+
Object.defineProperty(exports, "getDecimal", { enumerable: true, get: function () { return getDecimal_1.getDecimal; } });
|
|
10
|
+
var getSafeDivide_1 = require("./getSafeDivide");
|
|
11
|
+
Object.defineProperty(exports, "getSafeDivide", { enumerable: true, get: function () { return getSafeDivide_1.getSafeDivide; } });
|
|
12
|
+
var getNumber_1 = require("./getNumber");
|
|
13
|
+
Object.defineProperty(exports, "getNumber", { enumerable: true, get: function () { return getNumber_1.getNumber; } });
|
|
14
|
+
var getPercentIncrease_1 = require("./getPercentIncrease");
|
|
15
|
+
Object.defineProperty(exports, "getPercentIncrease", { enumerable: true, get: function () { return getPercentIncrease_1.getPercentIncrease; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { replaceKeys } from "./replaceKeys";
|
package/object/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceKeys = void 0;
|
|
4
|
+
var replaceKeys_1 = require("./replaceKeys");
|
|
5
|
+
Object.defineProperty(exports, "replaceKeys", { enumerable: true, get: function () { return replaceKeys_1.replaceKeys; } });
|
package/object/replaceKeys.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
type ReplaceKeys = {
|
|
2
|
-
instance: any;
|
|
3
|
-
getNewKey: Function;
|
|
4
|
-
};
|
|
5
1
|
/**
|
|
6
2
|
* Iteratively replace all the keys in an object.
|
|
7
3
|
* https://www.techighness.com/post/replace-all-keys-of-deeply-nested-objects-or-array-of-objects/
|
|
8
4
|
*/
|
|
9
|
-
declare const replaceKeys: (
|
|
10
|
-
export default replaceKeys;
|
|
5
|
+
export declare const replaceKeys: (instance: any, getNewKey: Function) => object;
|
package/object/replaceKeys.js
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceKeys = void 0;
|
|
3
4
|
/**
|
|
4
5
|
* Iteratively replace all the keys in an object.
|
|
5
6
|
* https://www.techighness.com/post/replace-all-keys-of-deeply-nested-objects-or-array-of-objects/
|
|
6
7
|
*/
|
|
7
|
-
const replaceKeys = (
|
|
8
|
+
const replaceKeys = (instance, getNewKey) => {
|
|
8
9
|
let response = instance;
|
|
9
10
|
if (Array.isArray(instance)) {
|
|
10
11
|
response = [];
|
|
11
12
|
for (let i = 0; i < instance.length; i++) {
|
|
12
|
-
response[i] = replaceKeys(
|
|
13
|
-
instance: instance[i],
|
|
14
|
-
getNewKey,
|
|
15
|
-
});
|
|
13
|
+
response[i] = (0, exports.replaceKeys)(instance[i], getNewKey);
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
16
|
else if ("object" === typeof instance) {
|
|
19
17
|
response = {};
|
|
20
18
|
for (const key in instance) {
|
|
21
19
|
const newKey = getNewKey(key);
|
|
22
|
-
response[newKey] = replaceKeys(
|
|
23
|
-
instance: instance[key],
|
|
24
|
-
getNewKey,
|
|
25
|
-
});
|
|
20
|
+
response[newKey] = (0, exports.replaceKeys)(instance[key], getNewKey);
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
23
|
return response;
|
|
29
24
|
};
|
|
30
|
-
exports.
|
|
25
|
+
exports.replaceKeys = replaceKeys;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OnePasswordConfig } from "./index";
|
|
2
|
+
import { BaseNamespace } from "../_class";
|
|
3
|
+
import type { Client } from "@1password/sdk";
|
|
4
|
+
export declare class OnePasswordNamespace extends BaseNamespace {
|
|
5
|
+
client: Client | null;
|
|
6
|
+
config: OnePasswordConfig;
|
|
7
|
+
constructor(key: string, config: OnePasswordConfig);
|
|
8
|
+
ensureInit: () => Promise<void>;
|
|
9
|
+
listVaults: () => Promise<import("@1password/sdk").VaultOverview[]>;
|
|
10
|
+
getItem: (vaultId: string, itemId: string) => Promise<import("@1password/sdk").Item>;
|
|
11
|
+
getJsonNote: (vaultId: string, itemId: string) => Promise<any>;
|
|
12
|
+
listItems: (vaultId: string) => Promise<import("@1password/sdk").ItemOverview[]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.OnePasswordNamespace = void 0;
|
|
37
|
+
const _class_1 = require("../_class");
|
|
38
|
+
class OnePasswordNamespace extends _class_1.BaseNamespace {
|
|
39
|
+
constructor(key, config) {
|
|
40
|
+
super(key, config);
|
|
41
|
+
this.client = null;
|
|
42
|
+
// Async setup to only initialise where required
|
|
43
|
+
this.ensureInit = async () => {
|
|
44
|
+
if (!this.client) {
|
|
45
|
+
try {
|
|
46
|
+
const { createClient } = await Promise.resolve().then(() => __importStar(require("@1password/sdk")));
|
|
47
|
+
this.client = await createClient({
|
|
48
|
+
auth: this.config.serviceAccountToken,
|
|
49
|
+
integrationName: this.config.integrationName || "8MS Helper TS",
|
|
50
|
+
integrationVersion: this.config.integrationVersion || "v1.0.0",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
throw new Error("1Password SDK not installed");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
this.listVaults = async () => {
|
|
59
|
+
await this.ensureInit();
|
|
60
|
+
return this.client.vaults.list();
|
|
61
|
+
};
|
|
62
|
+
this.getItem = async (vaultId, itemId) => {
|
|
63
|
+
await this.ensureInit();
|
|
64
|
+
return this.client.items.get(vaultId, itemId);
|
|
65
|
+
};
|
|
66
|
+
this.getJsonNote = async (vaultId, itemId) => {
|
|
67
|
+
let response = null;
|
|
68
|
+
const item = await this.getItem(vaultId, itemId);
|
|
69
|
+
if (item && "undefined" !== typeof item.notes) {
|
|
70
|
+
response = JSON.parse(item.notes);
|
|
71
|
+
}
|
|
72
|
+
return response;
|
|
73
|
+
};
|
|
74
|
+
this.listItems = async (vaultId) => {
|
|
75
|
+
await this.ensureInit();
|
|
76
|
+
return this.client.items.list(vaultId);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
;
|
|
80
|
+
}
|
|
81
|
+
exports.OnePasswordNamespace = OnePasswordNamespace;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OnePasswordNamespace } from "./OnePasswordNamespace";
|
|
2
|
+
export type OnePasswordConfig = {
|
|
3
|
+
serviceAccountToken: string;
|
|
4
|
+
integrationName?: string;
|
|
5
|
+
integrationVersion?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const onePasswordClient: (key?: string, config?: OnePasswordConfig) => Promise<OnePasswordNamespace>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onePasswordClient = void 0;
|
|
4
|
+
const OnePasswordNamespace_1 = require("./OnePasswordNamespace");
|
|
5
|
+
const onePasswordNamespaces = new Map();
|
|
6
|
+
// Main client that is used by system
|
|
7
|
+
const onePasswordClient = async (key = "default", config) => {
|
|
8
|
+
if (onePasswordNamespaces.has(key)) {
|
|
9
|
+
return onePasswordNamespaces.get(key);
|
|
10
|
+
}
|
|
11
|
+
if (!config) {
|
|
12
|
+
if (key === "default") {
|
|
13
|
+
config = {
|
|
14
|
+
serviceAccountToken: process.env.ONEPASSWORD_SERVICE_TOKEN
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
throw new Error(`Config required for namespace '${key}'`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const namespace = new OnePasswordNamespace_1.OnePasswordNamespace(key, config);
|
|
22
|
+
onePasswordNamespaces.set(key, namespace);
|
|
23
|
+
return namespace;
|
|
24
|
+
};
|
|
25
|
+
exports.onePasswordClient = onePasswordClient;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OpenAiConfig } from "./index";
|
|
2
|
+
import { BaseNamespace } from "../_class";
|
|
3
|
+
export declare class OpenAiNamespace extends BaseNamespace {
|
|
4
|
+
client: boolean | null;
|
|
5
|
+
config: OpenAiConfig | null;
|
|
6
|
+
/**
|
|
7
|
+
* Renew the access token as it expires every 3 hours.
|
|
8
|
+
*/
|
|
9
|
+
ensureInit: () => Promise<void>;
|
|
10
|
+
completion: (prompt: string, temperature?: number, maxTokens?: number, model?: string) => Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenAiNamespace = void 0;
|
|
4
|
+
const _class_1 = require("../_class");
|
|
5
|
+
const axios_1 = require("../axios");
|
|
6
|
+
class OpenAiNamespace extends _class_1.BaseNamespace {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.client = null;
|
|
10
|
+
this.config = null;
|
|
11
|
+
/**
|
|
12
|
+
* Renew the access token as it expires every 3 hours.
|
|
13
|
+
*/
|
|
14
|
+
this.ensureInit = async () => {
|
|
15
|
+
if (!this.client) {
|
|
16
|
+
this.client = true;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
this.completion = async (prompt, temperature = 1, maxTokens = null, model = "gpt-3.5-turbo") => {
|
|
20
|
+
let response = null;
|
|
21
|
+
// Make the API request
|
|
22
|
+
const apiResponse = await (0, axios_1.post)(`https://api.openai.com/v1/chat/completions`, {
|
|
23
|
+
max_tokens: maxTokens,
|
|
24
|
+
model,
|
|
25
|
+
messages: [
|
|
26
|
+
{
|
|
27
|
+
role: "user",
|
|
28
|
+
content: prompt,
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
temperature: 1,
|
|
32
|
+
}, {
|
|
33
|
+
headers: {
|
|
34
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
if (apiResponse.isSuccess()) {
|
|
38
|
+
response = apiResponse.getBody();
|
|
39
|
+
}
|
|
40
|
+
return response;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.OpenAiNamespace = OpenAiNamespace;
|
package/openAi/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.openAiClient = void 0;
|
|
4
|
+
const OpenAiNamespace_1 = require("./OpenAiNamespace");
|
|
5
|
+
const onePassword_1 = require("../onePassword");
|
|
6
|
+
const openAiNamespaces = new Map();
|
|
7
|
+
const openAiClient = async (key = "default", config, vaultId, itemId) => {
|
|
8
|
+
if (openAiNamespaces.has(key)) {
|
|
9
|
+
return openAiNamespaces.get(key);
|
|
10
|
+
}
|
|
11
|
+
let instanceConfig;
|
|
12
|
+
if (config) {
|
|
13
|
+
instanceConfig = config;
|
|
14
|
+
}
|
|
15
|
+
else if (vaultId && itemId) {
|
|
16
|
+
instanceConfig = await (await (0, onePassword_1.onePasswordClient)())
|
|
17
|
+
.getJsonNote(vaultId, itemId);
|
|
18
|
+
}
|
|
19
|
+
else if ("default" === key && process.env.OPEN_AI_VAULT_ID && process.env.OPEN_AI_ITEM_ID) {
|
|
20
|
+
instanceConfig = await (await (0, onePassword_1.onePasswordClient)())
|
|
21
|
+
.getJsonNote(process.env.OPEN_AI_VAULT_ID, process.env.OPEN_AI_ITEM_ID);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
throw new Error(`Config required for namespace '${key}'`);
|
|
25
|
+
}
|
|
26
|
+
const namespace = new OpenAiNamespace_1.OpenAiNamespace(key, instanceConfig);
|
|
27
|
+
openAiNamespaces.set(key, namespace);
|
|
28
|
+
return namespace;
|
|
29
|
+
};
|
|
30
|
+
exports.openAiClient = openAiClient;
|