diff --git a/.changeset/clever-yaks-behave.md b/.changeset/clever-yaks-behave.md new file mode 100644 index 0000000..a0dbc64 --- /dev/null +++ b/.changeset/clever-yaks-behave.md @@ -0,0 +1,5 @@ +--- +"@mirohq/cloud-data-import": minor +--- + +Exported more functionality including awsRegionsId, experimental_getProcessedData() and more types diff --git a/src/aws-app/config/getConfigFromProgramArguments.ts b/src/aws-app/config/getConfigFromProgramArguments.ts index 0271062..d09f8fb 100644 --- a/src/aws-app/config/getConfigFromProgramArguments.ts +++ b/src/aws-app/config/getConfigFromProgramArguments.ts @@ -1,4 +1,4 @@ -import {Config} from '@/types' +import {AwsRegionId, Config} from '@/types' import {awsRegionIds} from '@/constants' import {getDefaultOutputName} from './getDefaultOutputName' import {SUPPORTED_ENV_VARS, getEnvConfig} from './getEnvConfig' @@ -28,7 +28,7 @@ export const getConfigFromProgramArguments = (): Config => { return awsRegionIds } - const invalidRegions = arg.filter((region) => !awsRegionIds.includes(region)) + const invalidRegions = arg.filter((region) => !awsRegionIds.includes(region as AwsRegionId)) if (invalidRegions.length) { throw new Error( `[ERROR] Invalid region(s): ${invalidRegions.join(', ')}. Valid regions are: ${awsRegionIds.join(', ')}`, diff --git a/src/constants.ts b/src/constants.ts index c233519..f0352ab 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,6 +1,6 @@ // This list is extracted from https://docs.aws.amazon.com/general/latest/gr/rande.html // Tip: check git history to see when was the last time this list was updated -export const awsRegionIds: string[] = [ +export const awsRegionIds = [ 'us-east-2', 'us-east-1', 'us-west-1', @@ -32,4 +32,4 @@ export const awsRegionIds: string[] = [ 'sa-east-1', 'us-gov-east-1', 'us-gov-west-1', -] +] as const diff --git a/src/lib/index.ts b/src/lib/index.ts index 7d6bae0..224ece7 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,7 +1,10 @@ +import {getProcessedData} from '@/aws-app/process' import {createRateLimiter, getAwsScanners} from '@/scanners' export type {GetAwsScannersArguments} from '@/scanners' -export type {Scanner, ScannerError, ScannerResult, ScannerLifecycleHook} from '@/types' +export type * from '@/types' + +export {awsRegionIds} from '@/constants' /** * @public @@ -30,3 +33,17 @@ export const experimental_createRateLimiter = createRateLimiter * - If you depend on this feature, consider pinning your package version to avoid unexpected breaks. */ export const experimental_getAwsScanner = getAwsScanners + +/** + * @public + * @experimental This export is experimental and may change or be removed in future versions. + * Use with caution. + * @remarks + * WARNING: This is an experimental API. It may undergo significant changes or be removed entirely in non-major version updates. + * Before using this in production, please consider the following: + * - This API is not covered by semantic versioning guarantees. + * - Breaking changes may occur in minor or patch releases. + * - Always check the changelog before updating, even for non-major versions. + * - If you depend on this feature, consider pinning your package version to avoid unexpected breaks. + */ +export const experimental_getProcessedData = getProcessedData diff --git a/src/types.ts b/src/types.ts index 8f4081d..c939c42 100644 --- a/src/types.ts +++ b/src/types.ts @@ -21,9 +21,12 @@ import type * as Athena from '@aws-sdk/client-athena' import type {RateLimiter} from './scanners/common/RateLimiter' import type {AwsCredentialIdentity} from '@aws-sdk/types' +import {awsRegionIds} from './constants' export type SQSQueue = NonNullable +export type AwsRegionId = (typeof awsRegionIds)[number] + export type ResourceDescription = | Athena.NamedQuery | AutoScaling.AutoScalingGroup @@ -177,7 +180,7 @@ export interface StandardOutputSchema { provider: 'aws' docVersion: string resources: Resources - processed: ProcessedData + processed?: ProcessedData errors: ScannerError[] metadata: { account: string