-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move interfaces to their own file and inforce type imports
- Loading branch information
1 parent
1d78b0a
commit 6653909
Showing
26 changed files
with
141 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { PolicyStatement } from "../CloudFormation"; | ||
|
||
/** | ||
* Defines which methods a Lift construct must expose. | ||
*/ | ||
export interface ConstructInterface { | ||
/** | ||
* Values shown in the CLI output. | ||
*/ | ||
outputs?(): Record<string, () => Promise<string | undefined>>; | ||
|
||
/** | ||
* serverless.yml variables | ||
*/ | ||
variables?(): Record<string, unknown>; | ||
|
||
/** | ||
* Post-CloudFormation deployment | ||
*/ | ||
postDeploy?(): Promise<void>; | ||
|
||
/** | ||
* Pre-CloudFormation deletion | ||
*/ | ||
preRemove?(): Promise<void>; | ||
|
||
/** | ||
* IAM permissions to add to Lambda functions of the stack | ||
*/ | ||
permissions?(): PolicyStatement[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { ConstructInterface } from "@lift/constructs"; | ||
import type { ProviderInterface } from "@lift/providers"; | ||
import type { CliOptions } from "../types/serverless"; | ||
|
||
/** | ||
* Defines which static properties and methods a Lift construct must expose. | ||
*/ | ||
export interface StaticConstructInterface { | ||
type: string; | ||
schema: { | ||
type: "object"; | ||
[k: string]: unknown; | ||
}; | ||
commands?: ConstructCommands; | ||
create(provider: ProviderInterface, id: string, configuration: Record<string, unknown>): ConstructInterface; | ||
} | ||
|
||
export type ConstructCommands = Record<string, ConstructCommandDefinition>; | ||
type ConstructCommandDefinition = { | ||
usage: string; | ||
handler: (options: CliOptions) => void | Promise<void>; | ||
options?: { | ||
[name: string]: { | ||
usage: string; | ||
type: string; | ||
required?: boolean; | ||
shortcut?: string; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,2 @@ | ||
import { ProviderInterface } from "@lift/providers"; | ||
import { PolicyStatement } from "../CloudFormation"; | ||
import { CliOptions } from "../types/serverless"; | ||
|
||
/** | ||
* Defines which methods a Lift construct must expose. | ||
*/ | ||
export interface ConstructInterface { | ||
/** | ||
* Values shown in the CLI output. | ||
*/ | ||
outputs?(): Record<string, () => Promise<string | undefined>>; | ||
|
||
/** | ||
* serverless.yml variables | ||
*/ | ||
variables?(): Record<string, unknown>; | ||
|
||
/** | ||
* Post-CloudFormation deployment | ||
*/ | ||
postDeploy?(): Promise<void>; | ||
|
||
/** | ||
* Pre-CloudFormation deletion | ||
*/ | ||
preRemove?(): Promise<void>; | ||
|
||
/** | ||
* IAM permissions to add to Lambda functions of the stack | ||
*/ | ||
permissions?(): PolicyStatement[]; | ||
} | ||
|
||
/** | ||
* Defines which static properties and methods a Lift construct must expose. | ||
*/ | ||
export interface StaticConstructInterface { | ||
type: string; | ||
schema: { | ||
type: "object"; | ||
[k: string]: unknown; | ||
}; | ||
commands?: ConstructCommands; | ||
create(provider: ProviderInterface, id: string, configuration: Record<string, unknown>): ConstructInterface; | ||
} | ||
|
||
export type ConstructCommands = Record<string, ConstructCommandDefinition>; | ||
type ConstructCommandDefinition = { | ||
usage: string; | ||
handler: (options: CliOptions) => void | Promise<void>; | ||
options?: { | ||
[name: string]: { | ||
usage: string; | ||
type: string; | ||
required?: boolean; | ||
shortcut?: string; | ||
}; | ||
}; | ||
}; | ||
export type { ConstructInterface } from "./ConstructInterface"; | ||
export type { StaticConstructInterface, ConstructCommands } from "./StaticConstructInterface"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { ConstructInterface } from "@lift/constructs"; | ||
|
||
export interface ProviderInterface { | ||
create(type: string, id: string): ConstructInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { StaticConstructInterface } from "@lift/constructs"; | ||
|
||
export interface StaticProviderInterface { | ||
getConstructClass(type: string): StaticConstructInterface | undefined; | ||
getAllConstructClasses(): StaticConstructInterface[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,5 @@ | ||
import { ConstructInterface, StaticConstructInterface } from "@lift/constructs"; | ||
export type { ProviderInterface } from "./ProviderInterface"; | ||
export type { StaticProviderInterface } from "./StaticProviderInterface"; | ||
|
||
export { AwsProvider } from "./AwsProvider"; | ||
export { StripeProvider } from "./StripeProvider"; | ||
|
||
export interface ProviderInterface { | ||
create(type: string, id: string): ConstructInterface; | ||
} | ||
|
||
export interface StaticProviderInterface { | ||
getConstructClass(type: string): StaticConstructInterface | undefined; | ||
getAllConstructClasses(): StaticConstructInterface[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.