Skip to content

Commit

Permalink
Exported more functionality including awsRegionsId, getProcessedData …
Browse files Browse the repository at this point in the history
…and more types (#141)

* types: exported all types

* feat: exported more functionality including awsRegionsId, more types and getProcessedData

* Create clever-yaks-behave.md
  • Loading branch information
alireza-sheikholmolouki authored Aug 30, 2024
1 parent 78b25cc commit b31f5be
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/clever-yaks-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@mirohq/cloud-data-import": minor
---

Exported more functionality including awsRegionsId, experimental_getProcessedData() and more types
4 changes: 2 additions & 2 deletions src/aws-app/config/getConfigFromProgramArguments.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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(', ')}`,
Expand Down
4 changes: 2 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down Expand Up @@ -32,4 +32,4 @@ export const awsRegionIds: string[] = [
'sa-east-1',
'us-gov-east-1',
'us-gov-west-1',
]
] as const
19 changes: 18 additions & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
5 changes: 4 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<SQS.GetQueueAttributesResult['Attributes']>

export type AwsRegionId = (typeof awsRegionIds)[number]

export type ResourceDescription =
| Athena.NamedQuery
| AutoScaling.AutoScalingGroup
Expand Down Expand Up @@ -177,7 +180,7 @@ export interface StandardOutputSchema {
provider: 'aws'
docVersion: string
resources: Resources
processed: ProcessedData
processed?: ProcessedData
errors: ScannerError[]
metadata: {
account: string
Expand Down

0 comments on commit b31f5be

Please sign in to comment.