Skip to content

Commit

Permalink
feat: add TypeScript types
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed Jul 13, 2020
1 parent 17bfbe0 commit c9777bc
Showing 6 changed files with 95 additions and 42 deletions.
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
**
!**/*.js
!**/*.js.flow
!**/*.d.ts
!/*.md
!yarn.lock
/src
/test
/coverage
/flow-typed
__tests__
/.*
!/.flowconfig
71 changes: 71 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import AWS from 'aws-sdk'
import { UpsertRecordSetOptions } from 'mindless-route53'

export type GeneratedResourceRecordSet = {
ResourceRecordSet: AWS.Route53.ResourceRecordSet
PrivateZone?: boolean | null | undefined
OutputKey?: string | null | undefined
InstanceId?: string | null | undefined
LoadBalancerArn?: string | null | undefined
}

export function genRecordSetsForECSInstance(options: {
InstanceId: string
DNSName: string
EC2?: AWS.EC2 | null | undefined
TTL?: number | null | undefined
region?: string | null | undefined
log?: ((...args: any) => any) | null | undefined
verbose?: boolean | null | undefined
}): Promise<Array<GeneratedResourceRecordSet>>

export function genRecordSetsForLoadBalancer(options: {
LoadBalancerArn: string
DNSName: string
ELBv2?: AWS.ELBv2 | null | undefined
log?: ((...args: any) => any) | null | undefined
region?: string | null | undefined
verbose?: boolean | null | undefined
}): Promise<Array<GeneratedResourceRecordSet>>

export function genRecordSetsForStackOutputs(options: {
Outputs: Array<AWS.CloudFormation.Output>
DNSName: string
TTL?: number | null | undefined
EC2?: AWS.EC2 | null | undefined
ELBv2?: AWS.ELBv2 | null | undefined
region?: string | null | undefined
log?: ((...args: any) => any) | null | undefined
verbose?: boolean | null | undefined
}): Promise<Array<GeneratedResourceRecordSet>>

export type GenRecordSetsForStackOptions = {
StackName: string
DNSName: string
TTL?: number | null | undefined
interactive?: boolean | null | undefined
CloudFormation?: AWS.CloudFormation | null | undefined
EC2?: AWS.EC2 | null | undefined
ELBv2?: AWS.ELBv2 | null | undefined
region?: string | null | undefined
log?: ((...args: any) => any) | null | undefined
verbose?: boolean | null | undefined
}

export function genRecordSetsForStack(
options: GenRecordSetsForStackOptions
): Promise<Array<GeneratedResourceRecordSet>>

export type UpsertRecordSetsForStackOptions = UpsertRecordSetOptions & {
Comment?: string | null | undefined
Route53?: AWS.Route53 | null | undefined
}

export function upsertRecordSetsForStack(
options: UpsertRecordSetsForStackOptions
): Promise<void>

export function confirmationMessage(options: {
StackName: string
recordSets: Array<GeneratedResourceRecordSet>
}): string
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
"test:watch": "cross-env NODE_ENV=production BABEL_ENV=test mocha --watch $npm_package_config_mocha",
"test:debug": "cross-env NODE_ENV=production BABEL_ENV=test mocha --inspect-brk $npm_package_config_mocha",
"codecov": "nyc report --reporter=text-lcov > coverage.lcov; codecov",
"prepublishOnly": "npm run clean && npm run prettier:check && npm run lint && flow && npm test && npm run build",
"prepublishOnly": "npm run clean && npm run prettier:check && npm run lint && flow && tsc && npm test && npm run build",
"open:coverage": "open coverage/lcov-report/index.html",
"semantic-release": "semantic-release"
},
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ export type GeneratedResourceRecordSet = {
LoadBalancerArn?: ?string,
}

async function genRecordSetsForECSInstance(options: {
export async function genRecordSetsForECSInstance(options: {
InstanceId: string,
DNSName: string,
EC2?: ?AWS.EC2,
@@ -101,7 +101,7 @@ async function genRecordSetsForECSInstance(options: {
return result
}

async function genRecordSetsForLoadBalancer(options: {
export async function genRecordSetsForLoadBalancer(options: {
LoadBalancerArn: string,
DNSName: string,
ELBv2?: ?AWS.ELBv2,
9 changes: 9 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"noEmit": true
}
}
48 changes: 11 additions & 37 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -2484,7 +2484,7 @@ debug@^4.0.1, debug@^4.1.0:
dependencies:
ms "^2.1.1"

debuglog@*, debuglog@^1.0.1:
debuglog@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
@@ -4141,7 +4141,7 @@ import-lazy@^2.1.0:
resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43"
integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=

imurmurhash@*, imurmurhash@^0.1.4:
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
@@ -5226,11 +5226,6 @@ lockfile@^1.0.4:
dependencies:
signal-exit "^3.0.2"

lodash._baseindexof@*:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=

lodash._baseuniq@~4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
@@ -5239,33 +5234,11 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0"
lodash._root "~3.0.0"

lodash._bindcallback@*:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=

lodash._cacheindexof@*:
version "3.0.2"
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=

lodash._createcache@*:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
dependencies:
lodash._getnative "^3.0.0"

lodash._createset@~4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=

lodash._getnative@*, lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=

lodash._reinterpolate@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
@@ -5346,11 +5319,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3"
integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=

lodash.restparam@*:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=

lodash.set@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
@@ -5732,14 +5700,15 @@ mimic-fn@^1.0.0:
integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==

mindless-route53@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/mindless-route53/-/mindless-route53-1.0.1.tgz#39e2076c9ec77443f3240d2a0e5ca9180e273441"
integrity sha512-jFA2o0cAQ0QP8Sfndt3WEoOlYzLTf/4eYBkeXB3NA3+dXT2WSt+uO2kSAYF7A6jswIE28DiCh/wINOsZ/euHbg==
version "1.2.0"
resolved "https://registry.yarnpkg.com/mindless-route53/-/mindless-route53-1.2.0.tgz#57111c67db3173429995fa8851f5a3af5237ad3e"
integrity sha512-wt4/mIIIhjcgPG2SrowC8wbRAjvmSwroa/QCDTXT8n2R9R888V//UBuRiv348IiXmMqMywFw503E8B9ijAap+Q==
dependencies:
"@babel/runtime" "^7.1.5"
aws-sdk "^2.499.0"
flow-runtime "^0.17.0"
is-ip "^3.1.0"
typescript "^3.9.6"
yargs "^13.3.0"

"minimatch@2 || 3", [email protected], minimatch@^3.0.2, minimatch@^3.0.4:
@@ -8447,6 +8416,11 @@ typescript@^2.5.1:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==

typescript@^3.9.6:
version "3.9.6"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.6.tgz#8f3e0198a34c3ae17091b35571d3afd31999365a"
integrity sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw==

uglify-js@^3.1.4:
version "3.6.0"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5"

0 comments on commit c9777bc

Please sign in to comment.