common-types
Advanced tools
Comparing version 1.21.11 to 1.21.12
@@ -23,4 +23,9 @@ import { AwsRegion } from "./aws-regions"; | ||
*/ | ||
export declare type AwsService = "lambda" | "iam" | "logs" | "states" | "sqs" | "sns" | "dynamodb" | string; | ||
export declare type AwsService = "lambda" | "iam" | "logs" | "states" | "sqs" | "sns" | "dynamodb" | "events" | string; | ||
/** | ||
* AWS _resources_ are found in an ARN and tied to the parent _service_ | ||
* that precedes it in the ARN. | ||
*/ | ||
export declare type AwsResource = "function" | "logs" | "states" | "user" | "group" | "stateMachine" | "event-bus" | string; | ||
/** | ||
* Describes the shape of a fully-qualified AWS **ARN** for a _Lambda function_ | ||
@@ -42,3 +47,8 @@ */ | ||
export declare type AwsIamArn = `arn:${AwsPartition}:iam:${AwsAccountId}:${AwsIamResource}/${string}`; | ||
export declare type AwsEventBridgeResource = "event-bus"; | ||
/** | ||
* Describes the shape of a fully-qualified AWS **ARN** for a _EventBridge event_. | ||
*/ | ||
export declare type AwsEventBridgeArn = `arn:${AwsPartition}:events:${AwsRegion}:${AwsAccountId}:${AwsEventBridgeResource}/${string}`; | ||
/** | ||
* A type alias to indicate a AWS ARN. | ||
@@ -45,0 +55,0 @@ * |
import { IAwsLambdaProxyIntegrationRequestV2, IAwsLambdaProxyIntegrationRequest } from "./aws"; | ||
import { AwsLambdaArn } from "./aws-arn"; | ||
import { AwsArn, AwsEventBridgeArn, AwsLambdaArn, AwsStepFunctionArn } from "./aws-arn"; | ||
import { AwsRegion } from "./aws-regions"; | ||
@@ -22,1 +22,11 @@ import { AwsStage } from "./aws-stage"; | ||
export declare function isAwsStage(stage: string): stage is AwsStage; | ||
/** | ||
* Type guard to ensure a ARN string is EventBridge event | ||
*/ | ||
export declare function isEventBridgeArn(arn: string): arn is AwsEventBridgeArn; | ||
export declare function isStepFunctionArn(arn: string): arn is AwsStepFunctionArn; | ||
/** | ||
* A reasonable strength type guard to validate that a string is in fact | ||
* a fully qualified ARN. | ||
*/ | ||
export declare function isArn(arn: string): arn is AwsArn; |
@@ -75,4 +75,20 @@ 'use strict'; | ||
function isAwsStage(stage) { | ||
return /$(dev|test|prod|stage)^/.test(stage); | ||
return /(dev|test|prod|stage)/.test(stage); | ||
} | ||
/** | ||
* Type guard to ensure a ARN string is EventBridge event | ||
*/ | ||
function isEventBridgeArn(arn) { | ||
return /arn:(.*?):events:/.test(arn); | ||
} | ||
function isStepFunctionArn(arn) { | ||
return /arn:(aws|aws-cn|aws-us-gov):states:.*:stateMachine/.test(arn); | ||
} | ||
/** | ||
* A reasonable strength type guard to validate that a string is in fact | ||
* a fully qualified ARN. | ||
*/ | ||
function isArn(arn) { | ||
return /arn:(aws|aws-cn|aws-us-gov):(.*):/.test(arn); | ||
} | ||
@@ -525,4 +541,6 @@ /** | ||
exports.getBodyFromPossibleLambdaProxyRequest = getBodyFromPossibleLambdaProxyRequest; | ||
exports.isArn = isArn; | ||
exports.isAwsRegion = isAwsRegion; | ||
exports.isAwsStage = isAwsStage; | ||
exports.isEventBridgeArn = isEventBridgeArn; | ||
exports.isLambdaArn = isLambdaArn; | ||
@@ -533,2 +551,3 @@ exports.isLambdaProxyRequest = isLambdaProxyRequest; | ||
exports.isServerlessFunctionImage = isServerlessFunctionImage; | ||
exports.isStepFunctionArn = isStepFunctionArn; | ||
exports.isTypeSubtype = isTypeSubtype; | ||
@@ -535,0 +554,0 @@ exports.parseStack = parseStack; |
@@ -23,4 +23,9 @@ import { AwsRegion } from "./aws-regions"; | ||
*/ | ||
export declare type AwsService = "lambda" | "iam" | "logs" | "states" | "sqs" | "sns" | "dynamodb" | string; | ||
export declare type AwsService = "lambda" | "iam" | "logs" | "states" | "sqs" | "sns" | "dynamodb" | "events" | string; | ||
/** | ||
* AWS _resources_ are found in an ARN and tied to the parent _service_ | ||
* that precedes it in the ARN. | ||
*/ | ||
export declare type AwsResource = "function" | "logs" | "states" | "user" | "group" | "stateMachine" | "event-bus" | string; | ||
/** | ||
* Describes the shape of a fully-qualified AWS **ARN** for a _Lambda function_ | ||
@@ -42,3 +47,8 @@ */ | ||
export declare type AwsIamArn = `arn:${AwsPartition}:iam:${AwsAccountId}:${AwsIamResource}/${string}`; | ||
export declare type AwsEventBridgeResource = "event-bus"; | ||
/** | ||
* Describes the shape of a fully-qualified AWS **ARN** for a _EventBridge event_. | ||
*/ | ||
export declare type AwsEventBridgeArn = `arn:${AwsPartition}:events:${AwsRegion}:${AwsAccountId}:${AwsEventBridgeResource}/${string}`; | ||
/** | ||
* A type alias to indicate a AWS ARN. | ||
@@ -45,0 +55,0 @@ * |
import { IAwsLambdaProxyIntegrationRequestV2, IAwsLambdaProxyIntegrationRequest } from "./aws"; | ||
import { AwsLambdaArn } from "./aws-arn"; | ||
import { AwsArn, AwsEventBridgeArn, AwsLambdaArn, AwsStepFunctionArn } from "./aws-arn"; | ||
import { AwsRegion } from "./aws-regions"; | ||
@@ -22,1 +22,11 @@ import { AwsStage } from "./aws-stage"; | ||
export declare function isAwsStage(stage: string): stage is AwsStage; | ||
/** | ||
* Type guard to ensure a ARN string is EventBridge event | ||
*/ | ||
export declare function isEventBridgeArn(arn: string): arn is AwsEventBridgeArn; | ||
export declare function isStepFunctionArn(arn: string): arn is AwsStepFunctionArn; | ||
/** | ||
* A reasonable strength type guard to validate that a string is in fact | ||
* a fully qualified ARN. | ||
*/ | ||
export declare function isArn(arn: string): arn is AwsArn; |
@@ -71,4 +71,20 @@ /** | ||
function isAwsStage(stage) { | ||
return /$(dev|test|prod|stage)^/.test(stage); | ||
return /(dev|test|prod|stage)/.test(stage); | ||
} | ||
/** | ||
* Type guard to ensure a ARN string is EventBridge event | ||
*/ | ||
function isEventBridgeArn(arn) { | ||
return /arn:(.*?):events:/.test(arn); | ||
} | ||
function isStepFunctionArn(arn) { | ||
return /arn:(aws|aws-cn|aws-us-gov):states:.*:stateMachine/.test(arn); | ||
} | ||
/** | ||
* A reasonable strength type guard to validate that a string is in fact | ||
* a fully qualified ARN. | ||
*/ | ||
function isArn(arn) { | ||
return /arn:(aws|aws-cn|aws-us-gov):(.*):/.test(arn); | ||
} | ||
@@ -517,3 +533,3 @@ /** | ||
export { AWS_REGIONS, AwsRegionName, HttpStatusCodes, LambdaEventParser, StepFunctionMissingDataTreatment, createBindDeploymentConfig, getBodyFromPossibleLambdaProxyRequest, isAwsRegion, isAwsStage, isLambdaArn, isLambdaProxyRequest, isProxyRequestContextV2, isServerlessFunctionHandler, isServerlessFunctionImage, isTypeSubtype, parseStack, wait }; | ||
export { AWS_REGIONS, AwsRegionName, HttpStatusCodes, LambdaEventParser, StepFunctionMissingDataTreatment, createBindDeploymentConfig, getBodyFromPossibleLambdaProxyRequest, isArn, isAwsRegion, isAwsStage, isEventBridgeArn, isLambdaArn, isLambdaProxyRequest, isProxyRequestContextV2, isServerlessFunctionHandler, isServerlessFunctionImage, isStepFunctionArn, isTypeSubtype, parseStack, wait }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "common-types", | ||
"version": "1.21.11", | ||
"version": "1.21.12", | ||
"description": "Common types not included in Typescript", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/lifegadget/common-types", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
343211
8173