@webiny/project 6.4.5-beta.0 → 6.6.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ProjectSdk.d.ts +6 -5
- package/ProjectSdk.js +10 -6
- package/ProjectSdk.js.map +1 -1
- package/abstractions/features/DeployApp.d.ts +2 -2
- package/abstractions/features/DeployApp.js.map +1 -1
- package/abstractions/features/DestroyApp.d.ts +4 -4
- package/abstractions/features/DestroyApp.js.map +1 -1
- package/abstractions/features/GetAppOutput.d.ts +2 -2
- package/abstractions/features/GetAppOutput.js.map +1 -1
- package/abstractions/features/RefreshApp.d.ts +2 -2
- package/abstractions/features/RefreshApp.js.map +1 -1
- package/abstractions/features/RunPulumiCommand.d.ts +2 -2
- package/abstractions/features/RunPulumiCommand.js.map +1 -1
- package/abstractions/features/Serve.d.ts +27 -0
- package/abstractions/features/Serve.js +5 -0
- package/abstractions/features/Serve.js.map +1 -0
- package/abstractions/features/Watch.d.ts +8 -0
- package/abstractions/features/Watch.js.map +1 -1
- package/abstractions/features/index.d.ts +1 -0
- package/abstractions/features/index.js +1 -0
- package/abstractions/services/index.d.ts +0 -1
- package/abstractions/services/index.js +0 -1
- package/createProjectSdkContainer.d.ts +1 -1
- package/createProjectSdkContainer.js +6 -33
- package/createProjectSdkContainer.js.map +1 -1
- package/decorators/index.d.ts +0 -1
- package/decorators/index.js +0 -1
- package/extensions/AdminApiUrl.d.ts +10 -0
- package/extensions/AdminApiUrl.js +21 -0
- package/extensions/AdminApiUrl.js.map +1 -0
- package/extensions/AdminWebsocketsUrl.d.ts +12 -0
- package/extensions/AdminWebsocketsUrl.js +21 -0
- package/extensions/AdminWebsocketsUrl.js.map +1 -0
- package/extensions/ApiBuildParam.js +2 -2
- package/extensions/ApiBuildParam.js.map +1 -1
- package/extensions/ApiExtension.js +2 -2
- package/extensions/ApiExtension.js.map +1 -1
- package/extensions/Project.js +1 -17
- package/extensions/Project.js.map +1 -1
- package/extensions/index.d.ts +30 -9
- package/extensions/index.js +10 -2
- package/extensions/index.js.map +1 -1
- package/extensions/infra/Encryption.d.ts +10 -0
- package/extensions/infra/Encryption.js +36 -0
- package/extensions/infra/Encryption.js.map +1 -0
- package/extensions/infra/Hashing.d.ts +5 -0
- package/extensions/infra/Hashing.js +27 -0
- package/extensions/infra/Hashing.js.map +1 -0
- package/features/DestroyApp/DestroyApp.d.ts +1 -1
- package/features/GetAppOutput/GetAppOutput.d.ts +1 -1
- package/features/RefreshApp/RefreshApp.d.ts +1 -1
- package/features/RunPulumiCommand/RunPulumiCommand.d.ts +1 -1
- package/features/Serve/Serve.d.ts +10 -0
- package/features/Serve/Serve.js +15 -0
- package/features/Serve/Serve.js.map +1 -0
- package/features/Serve/index.d.ts +1 -0
- package/features/Serve/index.js +1 -0
- package/features/Watch/Watch.d.ts +3 -16
- package/features/Watch/Watch.js +4 -86
- package/features/Watch/Watch.js.map +1 -1
- package/features/Watch/watchers/ServersWatcher.d.ts +36 -0
- package/features/Watch/watchers/ServersWatcher.js +38 -0
- package/features/Watch/watchers/ServersWatcher.js.map +1 -0
- package/features/index.d.ts +1 -0
- package/features/index.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +16 -19
- package/services/BuildAppWorkspaceService/BuildAppWorkspaceService.d.ts +2 -3
- package/services/BuildAppWorkspaceService/BuildAppWorkspaceService.js +11 -44
- package/services/BuildAppWorkspaceService/BuildAppWorkspaceService.js.map +1 -1
- package/services/BuildProjectWorkspaceService/BuildProjectWorkspaceService.js +4 -6
- package/services/BuildProjectWorkspaceService/BuildProjectWorkspaceService.js.map +1 -1
- package/services/GetProjectConfigService/renderConfigWorker.js +2 -8
- package/services/GetProjectConfigService/renderConfigWorker.js.map +1 -1
- package/services/InitProjectSdkService/InitProjectSdkService.js +1 -7
- package/services/InitProjectSdkService/InitProjectSdkService.js.map +1 -1
- package/services/ProjectInfoService/GetPulumiVersionService.js +3 -3
- package/services/ProjectInfoService/GetPulumiVersionService.js.map +1 -1
- package/services/PulumiExportService/PulumiExportService.js.map +1 -1
- package/services/PulumiGetStackOutputService/PulumiGetStackOutputService.d.ts +11 -3
- package/services/PulumiGetStackOutputService/PulumiGetStackOutputService.js +64 -7
- package/services/PulumiGetStackOutputService/PulumiGetStackOutputService.js.map +1 -1
- package/services/PulumiSelectStackService/PulumiSelectStackService.js.map +1 -1
- package/services/index.d.ts +0 -2
- package/services/index.js +0 -2
- package/utils/apiRuntimeEnv.d.ts +20 -0
- package/utils/apiRuntimeEnv.js +51 -0
- package/utils/apiRuntimeEnv.js.map +1 -0
- package/utils/index.d.ts +1 -1
- package/utils/index.js +1 -1
- package/abstractions/services/StackOutputCacheService.d.ts +0 -10
- package/abstractions/services/StackOutputCacheService.js +0 -5
- package/abstractions/services/StackOutputCacheService.js.map +0 -1
- package/decorators/DestroyAppClearStackOutputCache.d.ts +0 -25
- package/decorators/DestroyAppClearStackOutputCache.js +0 -29
- package/decorators/DestroyAppClearStackOutputCache.js.map +0 -1
- package/extensions/Project/EnsureApiDeployedBeforeAdminBuild.d.ts +0 -11
- package/extensions/Project/EnsureApiDeployedBeforeAdminBuild.js +0 -30
- package/extensions/Project/EnsureApiDeployedBeforeAdminBuild.js.map +0 -1
- package/extensions/Project/EnsureApiDeployedBeforeAdminWatch.d.ts +0 -11
- package/extensions/Project/EnsureApiDeployedBeforeAdminWatch.js +0 -30
- package/extensions/Project/EnsureApiDeployedBeforeAdminWatch.js.map +0 -1
- package/extensions/Project/EnsureApiDeployedBeforeWatch.d.ts +0 -11
- package/extensions/Project/EnsureApiDeployedBeforeWatch.js +0 -30
- package/extensions/Project/EnsureApiDeployedBeforeWatch.js.map +0 -1
- package/extensions/Project/EnsureCoreDeployedBeforeApiDeploy.d.ts +0 -11
- package/extensions/Project/EnsureCoreDeployedBeforeApiDeploy.js +0 -31
- package/extensions/Project/EnsureCoreDeployedBeforeApiDeploy.js.map +0 -1
- package/extensions/Project/EnsureTelemetryEnabledForOss.d.ts +0 -13
- package/extensions/Project/EnsureTelemetryEnabledForOss.js +0 -34
- package/extensions/Project/EnsureTelemetryEnabledForOss.js.map +0 -1
- package/extensions/Project/TelemetryNoLongerNewUser.d.ts +0 -8
- package/extensions/Project/TelemetryNoLongerNewUser.js +0 -14
- package/extensions/Project/TelemetryNoLongerNewUser.js.map +0 -1
- package/extensions/Project/ValidateEncryptionBeforeDeploy.d.ts +0 -12
- package/extensions/Project/ValidateEncryptionBeforeDeploy.js +0 -31
- package/extensions/Project/ValidateEncryptionBeforeDeploy.js.map +0 -1
- package/extensions/Project/ValidateProductionPulumiState.d.ts +0 -12
- package/extensions/Project/ValidateProductionPulumiState.js +0 -33
- package/extensions/Project/ValidateProductionPulumiState.js.map +0 -1
- package/features/Watch/getIotEndpoint.d.ts +0 -2
- package/features/Watch/getIotEndpoint.js +0 -18
- package/features/Watch/getIotEndpoint.js.map +0 -1
- package/features/Watch/replaceLambdaFunctions.d.ts +0 -19
- package/features/Watch/replaceLambdaFunctions.js +0 -72
- package/features/Watch/replaceLambdaFunctions.js.map +0 -1
- package/services/GetPulumiService/GetPulumiService.d.ts +0 -9
- package/services/GetPulumiService/GetPulumiService.js +0 -44
- package/services/GetPulumiService/GetPulumiService.js.map +0 -1
- package/services/GetPulumiService/index.d.ts +0 -1
- package/services/GetPulumiService/index.js +0 -1
- package/services/StackOutputCacheService/StackOutputCacheService.d.ts +0 -18
- package/services/StackOutputCacheService/StackOutputCacheService.js +0 -89
- package/services/StackOutputCacheService/StackOutputCacheService.js.map +0 -1
- package/services/StackOutputCacheService/index.d.ts +0 -1
- package/services/StackOutputCacheService/index.js +0 -1
- package/utils/getTemplatesFolderPath.d.ts +0 -1
- package/utils/getTemplatesFolderPath.js +0 -11
- package/utils/getTemplatesFolderPath.js.map +0 -1
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { AdminBeforeBuild, GetAppStackOutput, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
import { GracefulError } from "../../index.js";
|
|
3
|
-
const NO_DEPLOYMENT_CHECKS_FLAG_NAME = "--no-deployment-checks";
|
|
4
|
-
class EnsureApiDeployedBeforeAdminBuildImpl {
|
|
5
|
-
constructor(getAppStackOutput, projectSdkParamsService){
|
|
6
|
-
this.getAppStackOutput = getAppStackOutput;
|
|
7
|
-
this.projectSdkParamsService = projectSdkParamsService;
|
|
8
|
-
}
|
|
9
|
-
async execute(params) {
|
|
10
|
-
if (false === params.deploymentChecks) return;
|
|
11
|
-
const output = await this.getAppStackOutput.execute("api");
|
|
12
|
-
const apiDeployed = output && Object.keys(output).length > 0;
|
|
13
|
-
if (apiDeployed) return;
|
|
14
|
-
const sdkParams = this.projectSdkParamsService.get();
|
|
15
|
-
const cmd = `yarn webiny deploy api --env ${sdkParams.env}`;
|
|
16
|
-
const error = new Error("Cannot build Admin before deploying API.");
|
|
17
|
-
const message = "Before building %s, please build %s first by running: %s. If you think this is a mistake, you can also try skipping deployment checks by appending the %s flag. Learn more: https://webiny.link/deployment-checks";
|
|
18
|
-
throw GracefulError.from(error, message, "Admin", "API", cmd, NO_DEPLOYMENT_CHECKS_FLAG_NAME);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const EnsureApiDeployedBeforeAdminBuild = AdminBeforeBuild.createImplementation({
|
|
22
|
-
implementation: EnsureApiDeployedBeforeAdminBuildImpl,
|
|
23
|
-
dependencies: [
|
|
24
|
-
GetAppStackOutput,
|
|
25
|
-
ProjectSdkParamsService
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
export { EnsureApiDeployedBeforeAdminBuild };
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=EnsureApiDeployedBeforeAdminBuild.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/Project/EnsureApiDeployedBeforeAdminBuild.js","sources":["../../../src/extensions/Project/EnsureApiDeployedBeforeAdminBuild.ts"],"sourcesContent":["import {\n AdminBeforeBuild,\n GetAppStackOutput,\n ProjectSdkParamsService\n} from \"~/abstractions/index.js\";\nimport { GracefulError } from \"~/index.js\";\n\nconst NO_DEPLOYMENT_CHECKS_FLAG_NAME = \"--no-deployment-checks\";\n\nclass EnsureApiDeployedBeforeAdminBuildImpl implements AdminBeforeBuild.Interface {\n constructor(\n private getAppStackOutput: GetAppStackOutput.Interface,\n private projectSdkParamsService: ProjectSdkParamsService.Interface\n ) {}\n\n async execute(params: AdminBeforeBuild.Params) {\n // Just in case, we want to allow users to skip the system requirements check.\n if (params.deploymentChecks === false) {\n return;\n }\n\n const output = await this.getAppStackOutput.execute(\"api\");\n const apiDeployed = output && Object.keys(output).length > 0;\n if (apiDeployed) {\n return;\n }\n\n const sdkParams = this.projectSdkParamsService.get();\n const cmd = `yarn webiny deploy api --env ${sdkParams.env}`;\n\n const error = new Error(\"Cannot build Admin before deploying API.\");\n const message = [\n `Before building %s, please build %s first by running: %s.`,\n `If you think this is a mistake, you can also try skipping`,\n `deployment checks by appending the %s flag.`,\n `Learn more: https://webiny.link/deployment-checks`\n ].join(\" \");\n\n throw GracefulError.from(\n error,\n message,\n \"Admin\",\n \"API\",\n cmd,\n NO_DEPLOYMENT_CHECKS_FLAG_NAME\n );\n }\n}\n\nexport const EnsureApiDeployedBeforeAdminBuild = AdminBeforeBuild.createImplementation({\n implementation: EnsureApiDeployedBeforeAdminBuildImpl,\n dependencies: [GetAppStackOutput, ProjectSdkParamsService]\n});\n"],"names":["NO_DEPLOYMENT_CHECKS_FLAG_NAME","EnsureApiDeployedBeforeAdminBuildImpl","getAppStackOutput","projectSdkParamsService","params","output","apiDeployed","Object","sdkParams","cmd","error","Error","message","GracefulError","EnsureApiDeployedBeforeAdminBuild","AdminBeforeBuild","GetAppStackOutput","ProjectSdkParamsService"],"mappings":";;AAOA,MAAMA,iCAAiC;AAEvC,MAAMC;IACF,YACYC,iBAA8C,EAC9CC,uBAA0D,CACpE;aAFUD,iBAAiB,GAAjBA;aACAC,uBAAuB,GAAvBA;IACT;IAEH,MAAM,QAAQC,MAA+B,EAAE;QAE3C,IAAIA,AAA4B,UAA5BA,OAAO,gBAAgB,EACvB;QAGJ,MAAMC,SAAS,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;QACpD,MAAMC,cAAcD,UAAUE,OAAO,IAAI,CAACF,QAAQ,MAAM,GAAG;QAC3D,IAAIC,aACA;QAGJ,MAAME,YAAY,IAAI,CAAC,uBAAuB,CAAC,GAAG;QAClD,MAAMC,MAAM,CAAC,6BAA6B,EAAED,UAAU,GAAG,EAAE;QAE3D,MAAME,QAAQ,IAAIC,MAAM;QACxB,MAAMC,UAAU;QAOhB,MAAMC,cAAc,IAAI,CACpBH,OACAE,SACA,SACA,OACAH,KACAT;IAER;AACJ;AAEO,MAAMc,oCAAoCC,iBAAiB,oBAAoB,CAAC;IACnF,gBAAgBd;IAChB,cAAc;QAACe;QAAmBC;KAAwB;AAC9D"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AdminBeforeWatch, GetAppStackOutput, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
declare class EnsureApiDeployedBeforeAdminWatchImpl implements AdminBeforeWatch.Interface {
|
|
3
|
-
private getAppStackOutput;
|
|
4
|
-
private projectSdkParamsService;
|
|
5
|
-
constructor(getAppStackOutput: GetAppStackOutput.Interface, projectSdkParamsService: ProjectSdkParamsService.Interface);
|
|
6
|
-
execute(params: AdminBeforeWatch.Params): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
export declare const EnsureApiDeployedBeforeAdminWatch: typeof EnsureApiDeployedBeforeAdminWatchImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("~/abstractions/index.js").IAdminBeforeWatch>;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { AdminBeforeWatch, GetAppStackOutput, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
import { GracefulError } from "../../index.js";
|
|
3
|
-
const NO_DEPLOYMENT_CHECKS_FLAG_NAME = "--no-deployment-checks";
|
|
4
|
-
class EnsureApiDeployedBeforeAdminWatchImpl {
|
|
5
|
-
constructor(getAppStackOutput, projectSdkParamsService){
|
|
6
|
-
this.getAppStackOutput = getAppStackOutput;
|
|
7
|
-
this.projectSdkParamsService = projectSdkParamsService;
|
|
8
|
-
}
|
|
9
|
-
async execute(params) {
|
|
10
|
-
if (false === params.deploymentChecks) return;
|
|
11
|
-
const output = await this.getAppStackOutput.execute("api");
|
|
12
|
-
const apiDeployed = output && Object.keys(output).length > 0;
|
|
13
|
-
if (apiDeployed) return;
|
|
14
|
-
const sdkParams = this.projectSdkParamsService.get();
|
|
15
|
-
const cmd = `yarn webiny deploy api --env ${sdkParams.env}`;
|
|
16
|
-
const error = new Error("Cannot watch Admin before deploying API.");
|
|
17
|
-
const message = "Before watching %s, please build %s first by running: %s. If you think this is a mistake, you can also try skipping deployment checks by appending the %s flag. Learn more: https://webiny.link/deployment-checks";
|
|
18
|
-
throw GracefulError.from(error, message, "Admin", "API", cmd, NO_DEPLOYMENT_CHECKS_FLAG_NAME);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const EnsureApiDeployedBeforeAdminWatch = AdminBeforeWatch.createImplementation({
|
|
22
|
-
implementation: EnsureApiDeployedBeforeAdminWatchImpl,
|
|
23
|
-
dependencies: [
|
|
24
|
-
GetAppStackOutput,
|
|
25
|
-
ProjectSdkParamsService
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
export { EnsureApiDeployedBeforeAdminWatch };
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=EnsureApiDeployedBeforeAdminWatch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/Project/EnsureApiDeployedBeforeAdminWatch.js","sources":["../../../src/extensions/Project/EnsureApiDeployedBeforeAdminWatch.ts"],"sourcesContent":["import {\n AdminBeforeWatch,\n GetAppStackOutput,\n ProjectSdkParamsService\n} from \"~/abstractions/index.js\";\nimport { GracefulError } from \"~/index.js\";\n\nconst NO_DEPLOYMENT_CHECKS_FLAG_NAME = \"--no-deployment-checks\";\n\nclass EnsureApiDeployedBeforeAdminWatchImpl implements AdminBeforeWatch.Interface {\n constructor(\n private getAppStackOutput: GetAppStackOutput.Interface,\n private projectSdkParamsService: ProjectSdkParamsService.Interface\n ) {}\n\n async execute(params: AdminBeforeWatch.Params) {\n // Just in case, we want to allow users to skip the system requirements check.\n if (params.deploymentChecks === false) {\n return;\n }\n\n const output = await this.getAppStackOutput.execute(\"api\");\n const apiDeployed = output && Object.keys(output).length > 0;\n if (apiDeployed) {\n return;\n }\n\n const sdkParams = this.projectSdkParamsService.get();\n const cmd = `yarn webiny deploy api --env ${sdkParams.env}`;\n\n const error = new Error(`Cannot watch Admin before deploying API.`);\n const message = [\n `Before watching %s, please build %s first by running: %s.`,\n `If you think this is a mistake, you can also try skipping`,\n `deployment checks by appending the %s flag.`,\n `Learn more: https://webiny.link/deployment-checks`\n ].join(\" \");\n\n throw GracefulError.from(\n error,\n message,\n \"Admin\",\n \"API\",\n cmd,\n NO_DEPLOYMENT_CHECKS_FLAG_NAME\n );\n }\n}\n\nexport const EnsureApiDeployedBeforeAdminWatch = AdminBeforeWatch.createImplementation({\n implementation: EnsureApiDeployedBeforeAdminWatchImpl,\n dependencies: [GetAppStackOutput, ProjectSdkParamsService]\n});\n"],"names":["NO_DEPLOYMENT_CHECKS_FLAG_NAME","EnsureApiDeployedBeforeAdminWatchImpl","getAppStackOutput","projectSdkParamsService","params","output","apiDeployed","Object","sdkParams","cmd","error","Error","message","GracefulError","EnsureApiDeployedBeforeAdminWatch","AdminBeforeWatch","GetAppStackOutput","ProjectSdkParamsService"],"mappings":";;AAOA,MAAMA,iCAAiC;AAEvC,MAAMC;IACF,YACYC,iBAA8C,EAC9CC,uBAA0D,CACpE;aAFUD,iBAAiB,GAAjBA;aACAC,uBAAuB,GAAvBA;IACT;IAEH,MAAM,QAAQC,MAA+B,EAAE;QAE3C,IAAIA,AAA4B,UAA5BA,OAAO,gBAAgB,EACvB;QAGJ,MAAMC,SAAS,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;QACpD,MAAMC,cAAcD,UAAUE,OAAO,IAAI,CAACF,QAAQ,MAAM,GAAG;QAC3D,IAAIC,aACA;QAGJ,MAAME,YAAY,IAAI,CAAC,uBAAuB,CAAC,GAAG;QAClD,MAAMC,MAAM,CAAC,6BAA6B,EAAED,UAAU,GAAG,EAAE;QAE3D,MAAME,QAAQ,IAAIC,MAAM;QACxB,MAAMC,UAAU;QAOhB,MAAMC,cAAc,IAAI,CACpBH,OACAE,SACA,SACA,OACAH,KACAT;IAER;AACJ;AAEO,MAAMc,oCAAoCC,iBAAiB,oBAAoB,CAAC;IACnF,gBAAgBd;IAChB,cAAc;QAACe;QAAmBC;KAAwB;AAC9D"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ApiBeforeWatch, GetAppStackOutput, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
declare class EnsureApiDeployedBeforeWatchImpl implements ApiBeforeWatch.Interface {
|
|
3
|
-
private getAppStackOutput;
|
|
4
|
-
private projectSdkParamsService;
|
|
5
|
-
constructor(getAppStackOutput: GetAppStackOutput.Interface, projectSdkParamsService: ProjectSdkParamsService.Interface);
|
|
6
|
-
execute(params: ApiBeforeWatch.Params): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
export declare const EnsureApiDeployedBeforeWatch: typeof EnsureApiDeployedBeforeWatchImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("~/abstractions/index.js").IApiBeforeWatch>;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ApiBeforeWatch, GetAppStackOutput, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
import { GracefulError } from "../../index.js";
|
|
3
|
-
const NO_DEPLOYMENT_CHECKS_FLAG_NAME = "--no-deployment-checks";
|
|
4
|
-
class EnsureApiDeployedBeforeWatchImpl {
|
|
5
|
-
constructor(getAppStackOutput, projectSdkParamsService){
|
|
6
|
-
this.getAppStackOutput = getAppStackOutput;
|
|
7
|
-
this.projectSdkParamsService = projectSdkParamsService;
|
|
8
|
-
}
|
|
9
|
-
async execute(params) {
|
|
10
|
-
if (false === params.deploymentChecks) return;
|
|
11
|
-
const output = await this.getAppStackOutput.execute("api");
|
|
12
|
-
const apiDeployed = output && Object.keys(output).length > 0;
|
|
13
|
-
if (apiDeployed) return;
|
|
14
|
-
const error = new Error("Cannot watch API before deploying it.");
|
|
15
|
-
const sdkParams = this.projectSdkParamsService.get();
|
|
16
|
-
const cmd = `yarn webiny deploy api --env ${sdkParams.env}`;
|
|
17
|
-
const message = "Before watching %s, please deploy it first by running: %s. If you think this is a mistake, you can also try skipping deployment checks by appending the %s flag. Learn more: https://webiny.link/deployment-checks";
|
|
18
|
-
throw GracefulError.from(error, message, "API", cmd, NO_DEPLOYMENT_CHECKS_FLAG_NAME);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const EnsureApiDeployedBeforeWatch = ApiBeforeWatch.createImplementation({
|
|
22
|
-
implementation: EnsureApiDeployedBeforeWatchImpl,
|
|
23
|
-
dependencies: [
|
|
24
|
-
GetAppStackOutput,
|
|
25
|
-
ProjectSdkParamsService
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
export { EnsureApiDeployedBeforeWatch };
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=EnsureApiDeployedBeforeWatch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/Project/EnsureApiDeployedBeforeWatch.js","sources":["../../../src/extensions/Project/EnsureApiDeployedBeforeWatch.ts"],"sourcesContent":["import {\n ApiBeforeWatch,\n GetAppStackOutput,\n ProjectSdkParamsService\n} from \"~/abstractions/index.js\";\nimport { GracefulError } from \"~/index.js\";\n\nconst NO_DEPLOYMENT_CHECKS_FLAG_NAME = \"--no-deployment-checks\";\n\nclass EnsureApiDeployedBeforeWatchImpl implements ApiBeforeWatch.Interface {\n constructor(\n private getAppStackOutput: GetAppStackOutput.Interface,\n private projectSdkParamsService: ProjectSdkParamsService.Interface\n ) {}\n\n async execute(params: ApiBeforeWatch.Params) {\n // Just in case, we want to allow users to skip the system requirements check.\n if (params.deploymentChecks === false) {\n return;\n }\n\n const output = await this.getAppStackOutput.execute(\"api\");\n const apiDeployed = output && Object.keys(output).length > 0;\n if (apiDeployed) {\n return;\n }\n\n const error = new Error(`Cannot watch API before deploying it.`);\n const sdkParams = this.projectSdkParamsService.get();\n const cmd = `yarn webiny deploy api --env ${sdkParams.env}`;\n\n const message = [\n `Before watching %s, please deploy it first by running: %s.`,\n `If you think this is a mistake, you can also try skipping`,\n `deployment checks by appending the %s flag.`,\n `Learn more: https://webiny.link/deployment-checks`\n ].join(\" \");\n\n throw GracefulError.from(error, message, \"API\", cmd, NO_DEPLOYMENT_CHECKS_FLAG_NAME);\n }\n}\n\nexport const EnsureApiDeployedBeforeWatch = ApiBeforeWatch.createImplementation({\n implementation: EnsureApiDeployedBeforeWatchImpl,\n dependencies: [GetAppStackOutput, ProjectSdkParamsService]\n});\n"],"names":["NO_DEPLOYMENT_CHECKS_FLAG_NAME","EnsureApiDeployedBeforeWatchImpl","getAppStackOutput","projectSdkParamsService","params","output","apiDeployed","Object","error","Error","sdkParams","cmd","message","GracefulError","EnsureApiDeployedBeforeWatch","ApiBeforeWatch","GetAppStackOutput","ProjectSdkParamsService"],"mappings":";;AAOA,MAAMA,iCAAiC;AAEvC,MAAMC;IACF,YACYC,iBAA8C,EAC9CC,uBAA0D,CACpE;aAFUD,iBAAiB,GAAjBA;aACAC,uBAAuB,GAAvBA;IACT;IAEH,MAAM,QAAQC,MAA6B,EAAE;QAEzC,IAAIA,AAA4B,UAA5BA,OAAO,gBAAgB,EACvB;QAGJ,MAAMC,SAAS,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;QACpD,MAAMC,cAAcD,UAAUE,OAAO,IAAI,CAACF,QAAQ,MAAM,GAAG;QAC3D,IAAIC,aACA;QAGJ,MAAME,QAAQ,IAAIC,MAAM;QACxB,MAAMC,YAAY,IAAI,CAAC,uBAAuB,CAAC,GAAG;QAClD,MAAMC,MAAM,CAAC,6BAA6B,EAAED,UAAU,GAAG,EAAE;QAE3D,MAAME,UAAU;QAOhB,MAAMC,cAAc,IAAI,CAACL,OAAOI,SAAS,OAAOD,KAAKX;IACzD;AACJ;AAEO,MAAMc,+BAA+BC,eAAe,oBAAoB,CAAC;IAC5E,gBAAgBd;IAChB,cAAc;QAACe;QAAmBC;KAAwB;AAC9D"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ApiBeforeDeploy, GetAppStackOutput, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
declare class EnsureCoreDeployedBeforeApiDeployImpl implements ApiBeforeDeploy.Interface {
|
|
3
|
-
private getAppStackOutput;
|
|
4
|
-
private projectSdkParamsService;
|
|
5
|
-
constructor(getAppStackOutput: GetAppStackOutput.Interface, projectSdkParamsService: ProjectSdkParamsService.Interface);
|
|
6
|
-
execute(): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
export declare const EnsureCoreDeployedBeforeApiDeploy: typeof EnsureCoreDeployedBeforeApiDeployImpl & {
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<import("~/abstractions/index.js").IApiBeforeDeploy>;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ApiBeforeDeploy, GetAppStackOutput, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
import { GracefulError } from "../../index.js";
|
|
3
|
-
class EnsureCoreDeployedBeforeApiDeployImpl {
|
|
4
|
-
constructor(getAppStackOutput, projectSdkParamsService){
|
|
5
|
-
this.getAppStackOutput = getAppStackOutput;
|
|
6
|
-
this.projectSdkParamsService = projectSdkParamsService;
|
|
7
|
-
}
|
|
8
|
-
async execute() {
|
|
9
|
-
const output = await this.getAppStackOutput.execute("core");
|
|
10
|
-
const coreDeployed = output && Object.keys(output).length > 0;
|
|
11
|
-
if (coreDeployed) return;
|
|
12
|
-
const sdkParams = this.projectSdkParamsService.get();
|
|
13
|
-
const { variant, env } = sdkParams;
|
|
14
|
-
let variantCmd = "";
|
|
15
|
-
if (variant) variantCmd = ` --variant ${variant}`;
|
|
16
|
-
const error = new Error("Cannot deploy API before deploying Core.");
|
|
17
|
-
const message = "Before deploying %s, please deploy %s first by running: %s.";
|
|
18
|
-
const cmd = `yarn webiny deploy core --env ${env}${variantCmd}`;
|
|
19
|
-
throw GracefulError.from(error, message, "API", "Core", cmd);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const EnsureCoreDeployedBeforeApiDeploy = ApiBeforeDeploy.createImplementation({
|
|
23
|
-
implementation: EnsureCoreDeployedBeforeApiDeployImpl,
|
|
24
|
-
dependencies: [
|
|
25
|
-
GetAppStackOutput,
|
|
26
|
-
ProjectSdkParamsService
|
|
27
|
-
]
|
|
28
|
-
});
|
|
29
|
-
export { EnsureCoreDeployedBeforeApiDeploy };
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=EnsureCoreDeployedBeforeApiDeploy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/Project/EnsureCoreDeployedBeforeApiDeploy.js","sources":["../../../src/extensions/Project/EnsureCoreDeployedBeforeApiDeploy.ts"],"sourcesContent":["import {\n ApiBeforeDeploy,\n GetAppStackOutput,\n ProjectSdkParamsService\n} from \"~/abstractions/index.js\";\nimport { GracefulError } from \"~/index.js\";\n\nclass EnsureCoreDeployedBeforeApiDeployImpl implements ApiBeforeDeploy.Interface {\n constructor(\n private getAppStackOutput: GetAppStackOutput.Interface,\n private projectSdkParamsService: ProjectSdkParamsService.Interface\n ) {}\n\n async execute() {\n const output = await this.getAppStackOutput.execute(\"core\");\n\n const coreDeployed = output && Object.keys(output).length > 0;\n if (coreDeployed) {\n return;\n }\n\n const sdkParams = this.projectSdkParamsService.get();\n const { variant, env } = sdkParams;\n\n let variantCmd = \"\";\n if (variant) {\n variantCmd = ` --variant ${variant}`;\n }\n\n const error = new Error(`Cannot deploy API before deploying Core.`);\n\n const message = [`Before deploying %s, please`, `deploy %s first by running: %s.`].join(\n \" \"\n );\n\n const cmd = `yarn webiny deploy core --env ${env}${variantCmd}`;\n throw GracefulError.from(error, message, \"API\", \"Core\", cmd);\n }\n}\n\nexport const EnsureCoreDeployedBeforeApiDeploy = ApiBeforeDeploy.createImplementation({\n implementation: EnsureCoreDeployedBeforeApiDeployImpl,\n dependencies: [GetAppStackOutput, ProjectSdkParamsService]\n});\n"],"names":["EnsureCoreDeployedBeforeApiDeployImpl","getAppStackOutput","projectSdkParamsService","output","coreDeployed","Object","sdkParams","variant","env","variantCmd","error","Error","message","cmd","GracefulError","EnsureCoreDeployedBeforeApiDeploy","ApiBeforeDeploy","GetAppStackOutput","ProjectSdkParamsService"],"mappings":";;AAOA,MAAMA;IACF,YACYC,iBAA8C,EAC9CC,uBAA0D,CACpE;aAFUD,iBAAiB,GAAjBA;aACAC,uBAAuB,GAAvBA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,SAAS,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;QAEpD,MAAMC,eAAeD,UAAUE,OAAO,IAAI,CAACF,QAAQ,MAAM,GAAG;QAC5D,IAAIC,cACA;QAGJ,MAAME,YAAY,IAAI,CAAC,uBAAuB,CAAC,GAAG;QAClD,MAAM,EAAEC,OAAO,EAAEC,GAAG,EAAE,GAAGF;QAEzB,IAAIG,aAAa;QACjB,IAAIF,SACAE,aAAa,CAAC,WAAW,EAAEF,SAAS;QAGxC,MAAMG,QAAQ,IAAIC,MAAM;QAExB,MAAMC,UAAU;QAIhB,MAAMC,MAAM,CAAC,8BAA8B,EAAEL,MAAMC,YAAY;QAC/D,MAAMK,cAAc,IAAI,CAACJ,OAAOE,SAAS,OAAO,QAAQC;IAC5D;AACJ;AAEO,MAAME,oCAAoCC,gBAAgB,oBAAoB,CAAC;IAClF,gBAAgBhB;IAChB,cAAc;QAACiB;QAAmBC;KAAwB;AAC9D"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BeforeDeploy, IsCi, IsTelemetryEnabled, IsWcpEnabled, IsWebinyJsRepo } from "../../abstractions/index.js";
|
|
2
|
-
declare class EnsureTelemetryEnabledForOssImpl implements BeforeDeploy.Interface {
|
|
3
|
-
private isTelemetryEnabled;
|
|
4
|
-
private isWcpEnabled;
|
|
5
|
-
private isWebinyJsRepo;
|
|
6
|
-
private isCi;
|
|
7
|
-
constructor(isTelemetryEnabled: IsTelemetryEnabled.Interface, isWcpEnabled: IsWcpEnabled.Interface, isWebinyJsRepo: IsWebinyJsRepo.Interface, isCi: IsCi.Interface);
|
|
8
|
-
execute(): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
export declare const EnsureTelemetryEnabledForOss: typeof EnsureTelemetryEnabledForOssImpl & {
|
|
11
|
-
__abstraction: import("@webiny/di").Abstraction<import("~/abstractions/index.js").IBeforeDeploy>;
|
|
12
|
-
};
|
|
13
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { BeforeDeploy, IsCi, IsTelemetryEnabled, IsWcpEnabled, IsWebinyJsRepo } from "../../abstractions/index.js";
|
|
2
|
-
import { GracefulError } from "../../index.js";
|
|
3
|
-
class EnsureTelemetryEnabledForOssImpl {
|
|
4
|
-
constructor(isTelemetryEnabled, isWcpEnabled, isWebinyJsRepo, isCi){
|
|
5
|
-
this.isTelemetryEnabled = isTelemetryEnabled;
|
|
6
|
-
this.isWcpEnabled = isWcpEnabled;
|
|
7
|
-
this.isWebinyJsRepo = isWebinyJsRepo;
|
|
8
|
-
this.isCi = isCi;
|
|
9
|
-
}
|
|
10
|
-
async execute() {
|
|
11
|
-
if (this.isCi.execute()) return;
|
|
12
|
-
const isDevRepo = this.isWebinyJsRepo.execute();
|
|
13
|
-
if (isDevRepo) return;
|
|
14
|
-
const telemetryEnabled = await this.isTelemetryEnabled.execute();
|
|
15
|
-
const wcpEnabled = await this.isWcpEnabled.execute();
|
|
16
|
-
if (!telemetryEnabled && !wcpEnabled) {
|
|
17
|
-
const message = "You are trying to deploy your project, but telemetry is currently disabled. The open-source edition of Webiny requires telemetry to be enabled. To proceed with the deployment, please re-enable telemetry or upgrade your project via https://www.webiny.com/pricing. Learn more: https://webiny.link/telemetry-oss";
|
|
18
|
-
const error = new Error("Cannot deploy with telemetry disabled in OSS edition.");
|
|
19
|
-
throw GracefulError.from(error, message);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const EnsureTelemetryEnabledForOss = BeforeDeploy.createImplementation({
|
|
24
|
-
implementation: EnsureTelemetryEnabledForOssImpl,
|
|
25
|
-
dependencies: [
|
|
26
|
-
IsTelemetryEnabled,
|
|
27
|
-
IsWcpEnabled,
|
|
28
|
-
IsWebinyJsRepo,
|
|
29
|
-
IsCi
|
|
30
|
-
]
|
|
31
|
-
});
|
|
32
|
-
export { EnsureTelemetryEnabledForOss };
|
|
33
|
-
|
|
34
|
-
//# sourceMappingURL=EnsureTelemetryEnabledForOss.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/Project/EnsureTelemetryEnabledForOss.js","sources":["../../../src/extensions/Project/EnsureTelemetryEnabledForOss.ts"],"sourcesContent":["import {\n BeforeDeploy,\n IsCi,\n IsTelemetryEnabled,\n IsWcpEnabled,\n IsWebinyJsRepo\n} from \"~/abstractions/index.js\";\nimport { GracefulError } from \"~/index.js\";\n\nclass EnsureTelemetryEnabledForOssImpl implements BeforeDeploy.Interface {\n constructor(\n private isTelemetryEnabled: IsTelemetryEnabled.Interface,\n private isWcpEnabled: IsWcpEnabled.Interface,\n private isWebinyJsRepo: IsWebinyJsRepo.Interface,\n private isCi: IsCi.Interface\n ) {}\n\n async execute() {\n // Skip telemetry checks in CI environments\n if (this.isCi.execute()) {\n return;\n }\n\n // Don't enforce telemetry validation in the webiny-js development repository\n const isDevRepo = this.isWebinyJsRepo.execute();\n if (isDevRepo) {\n return;\n }\n\n const telemetryEnabled = await this.isTelemetryEnabled.execute();\n const wcpEnabled = await this.isWcpEnabled.execute();\n\n // If telemetry is disabled and WCP is not connected, throw an error\n if (!telemetryEnabled && !wcpEnabled) {\n const message = [\n `You are trying to deploy your project, but telemetry is currently disabled.`,\n `The open-source edition of Webiny requires telemetry to be enabled.`,\n `To proceed with the deployment, please re-enable telemetry or upgrade your project via https://www.webiny.com/pricing.`,\n `Learn more: https://webiny.link/telemetry-oss`\n ].join(\" \");\n\n const error = new Error(\"Cannot deploy with telemetry disabled in OSS edition.\");\n\n throw GracefulError.from(error, message);\n }\n }\n}\n\nexport const EnsureTelemetryEnabledForOss = BeforeDeploy.createImplementation({\n implementation: EnsureTelemetryEnabledForOssImpl,\n dependencies: [IsTelemetryEnabled, IsWcpEnabled, IsWebinyJsRepo, IsCi]\n});\n"],"names":["EnsureTelemetryEnabledForOssImpl","isTelemetryEnabled","isWcpEnabled","isWebinyJsRepo","isCi","isDevRepo","telemetryEnabled","wcpEnabled","message","error","Error","GracefulError","EnsureTelemetryEnabledForOss","BeforeDeploy","IsTelemetryEnabled","IsWcpEnabled","IsWebinyJsRepo","IsCi"],"mappings":";;AASA,MAAMA;IACF,YACYC,kBAAgD,EAChDC,YAAoC,EACpCC,cAAwC,EACxCC,IAAoB,CAC9B;aAJUH,kBAAkB,GAAlBA;aACAC,YAAY,GAAZA;aACAC,cAAc,GAAdA;aACAC,IAAI,GAAJA;IACT;IAEH,MAAM,UAAU;QAEZ,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,IACjB;QAIJ,MAAMC,YAAY,IAAI,CAAC,cAAc,CAAC,OAAO;QAC7C,IAAIA,WACA;QAGJ,MAAMC,mBAAmB,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO;QAC9D,MAAMC,aAAa,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO;QAGlD,IAAI,CAACD,oBAAoB,CAACC,YAAY;YAClC,MAAMC,UAAU;YAOhB,MAAMC,QAAQ,IAAIC,MAAM;YAExB,MAAMC,cAAc,IAAI,CAACF,OAAOD;QACpC;IACJ;AACJ;AAEO,MAAMI,+BAA+BC,aAAa,oBAAoB,CAAC;IAC1E,gBAAgBb;IAChB,cAAc;QAACc;QAAoBC;QAAcC;QAAgBC;KAAK;AAC1E"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AdminAfterDeploy } from "../../abstractions/index.js";
|
|
2
|
-
declare class TelemetryNoLongerNewUserImpl implements AdminAfterDeploy.Interface {
|
|
3
|
-
execute(): Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
export declare const TelemetryNoLongerNewUser: typeof TelemetryNoLongerNewUserImpl & {
|
|
6
|
-
__abstraction: import("@webiny/di").Abstraction<import("~/abstractions/index.js").IAdminAfterDeploy>;
|
|
7
|
-
};
|
|
8
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AdminAfterDeploy } from "../../abstractions/index.js";
|
|
2
|
-
import { globalConfig } from "@webiny/global-config";
|
|
3
|
-
class TelemetryNoLongerNewUserImpl {
|
|
4
|
-
async execute() {
|
|
5
|
-
globalConfig.set("newUser", false);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
const TelemetryNoLongerNewUser = AdminAfterDeploy.createImplementation({
|
|
9
|
-
implementation: TelemetryNoLongerNewUserImpl,
|
|
10
|
-
dependencies: []
|
|
11
|
-
});
|
|
12
|
-
export { TelemetryNoLongerNewUser };
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=TelemetryNoLongerNewUser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/Project/TelemetryNoLongerNewUser.js","sources":["../../../src/extensions/Project/TelemetryNoLongerNewUser.ts"],"sourcesContent":["import { AdminAfterDeploy } from \"~/abstractions/index.js\";\nimport { globalConfig } from \"@webiny/global-config\";\n\nclass TelemetryNoLongerNewUserImpl implements AdminAfterDeploy.Interface {\n async execute() {\n // Mark the user as no longer new.\n globalConfig.set(\"newUser\", false);\n }\n}\n\nexport const TelemetryNoLongerNewUser = AdminAfterDeploy.createImplementation({\n implementation: TelemetryNoLongerNewUserImpl,\n dependencies: []\n});\n"],"names":["TelemetryNoLongerNewUserImpl","globalConfig","TelemetryNoLongerNewUser","AdminAfterDeploy"],"mappings":";;AAGA,MAAMA;IACF,MAAM,UAAU;QAEZC,aAAa,GAAG,CAAC,WAAW;IAChC;AACJ;AAEO,MAAMC,2BAA2BC,iBAAiB,oBAAoB,CAAC;IAC1E,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { BeforeDeploy, GetProductionEnvironments, GetProjectConfig, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
declare class ValidateEncryptionBeforeDeployImpl implements BeforeDeploy.Interface {
|
|
3
|
-
private getProductionEnvironments;
|
|
4
|
-
private projectSdkParamsService;
|
|
5
|
-
private getProjectConfig;
|
|
6
|
-
constructor(getProductionEnvironments: GetProductionEnvironments.Interface, projectSdkParamsService: ProjectSdkParamsService.Interface, getProjectConfig: GetProjectConfig.Interface);
|
|
7
|
-
execute(): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
export declare const ValidateEncryptionBeforeDeploy: typeof ValidateEncryptionBeforeDeployImpl & {
|
|
10
|
-
__abstraction: import("@webiny/di").Abstraction<import("~/abstractions/index.js").IBeforeDeploy>;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { BeforeDeploy, GetProductionEnvironments, GetProjectConfig, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
import { GracefulError } from "../../index.js";
|
|
3
|
-
class ValidateEncryptionBeforeDeployImpl {
|
|
4
|
-
constructor(getProductionEnvironments, projectSdkParamsService, getProjectConfig){
|
|
5
|
-
this.getProductionEnvironments = getProductionEnvironments;
|
|
6
|
-
this.projectSdkParamsService = projectSdkParamsService;
|
|
7
|
-
this.getProjectConfig = getProjectConfig;
|
|
8
|
-
}
|
|
9
|
-
async execute() {
|
|
10
|
-
const { env } = this.projectSdkParamsService.get();
|
|
11
|
-
const prodEnvs = await this.getProductionEnvironments.execute();
|
|
12
|
-
if (!prodEnvs.includes(env)) return;
|
|
13
|
-
const projectConfig = await this.getProjectConfig.execute();
|
|
14
|
-
const [encryption] = projectConfig.extensionsByType("Infra/Encryption");
|
|
15
|
-
if (encryption) return;
|
|
16
|
-
const error = new Error("Encryption is not configured for production environment.");
|
|
17
|
-
const message = "Deploying to a production environment requires encryption to be configured. Set the %s environment variable and add %s to your project config. Learn more: https://webiny.link/encryption";
|
|
18
|
-
throw GracefulError.from(error, message, "WEBINY_ENCRYPTION_PASSPHRASE", "<Infra.Encryption>");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
const ValidateEncryptionBeforeDeploy = BeforeDeploy.createImplementation({
|
|
22
|
-
implementation: ValidateEncryptionBeforeDeployImpl,
|
|
23
|
-
dependencies: [
|
|
24
|
-
GetProductionEnvironments,
|
|
25
|
-
ProjectSdkParamsService,
|
|
26
|
-
GetProjectConfig
|
|
27
|
-
]
|
|
28
|
-
});
|
|
29
|
-
export { ValidateEncryptionBeforeDeploy };
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=ValidateEncryptionBeforeDeploy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/Project/ValidateEncryptionBeforeDeploy.js","sources":["../../../src/extensions/Project/ValidateEncryptionBeforeDeploy.ts"],"sourcesContent":["import {\n BeforeDeploy,\n GetProductionEnvironments,\n GetProjectConfig,\n ProjectSdkParamsService\n} from \"~/abstractions/index.js\";\nimport { GracefulError } from \"~/index.js\";\n\nclass ValidateEncryptionBeforeDeployImpl implements BeforeDeploy.Interface {\n constructor(\n private getProductionEnvironments: GetProductionEnvironments.Interface,\n private projectSdkParamsService: ProjectSdkParamsService.Interface,\n private getProjectConfig: GetProjectConfig.Interface\n ) {}\n\n async execute() {\n const { env } = this.projectSdkParamsService.get();\n const prodEnvs = await this.getProductionEnvironments.execute();\n\n if (!prodEnvs.includes(env)) {\n return;\n }\n\n const projectConfig = await this.getProjectConfig.execute();\n const [encryption] = projectConfig.extensionsByType(\"Infra/Encryption\");\n\n if (encryption) {\n return;\n }\n\n const error = new Error(\"Encryption is not configured for production environment.\");\n\n const message = [\n \"Deploying to a production environment requires encryption to be configured.\",\n \"Set the %s environment variable and add %s to your project config.\",\n \"Learn more: https://webiny.link/encryption\"\n ].join(\" \");\n\n throw GracefulError.from(\n error,\n message,\n \"WEBINY_ENCRYPTION_PASSPHRASE\",\n \"<Infra.Encryption>\"\n );\n }\n}\n\nexport const ValidateEncryptionBeforeDeploy = BeforeDeploy.createImplementation({\n implementation: ValidateEncryptionBeforeDeployImpl,\n dependencies: [GetProductionEnvironments, ProjectSdkParamsService, GetProjectConfig]\n});\n"],"names":["ValidateEncryptionBeforeDeployImpl","getProductionEnvironments","projectSdkParamsService","getProjectConfig","env","prodEnvs","projectConfig","encryption","error","Error","message","GracefulError","ValidateEncryptionBeforeDeploy","BeforeDeploy","GetProductionEnvironments","ProjectSdkParamsService","GetProjectConfig"],"mappings":";;AAQA,MAAMA;IACF,YACYC,yBAA8D,EAC9DC,uBAA0D,EAC1DC,gBAA4C,CACtD;aAHUF,yBAAyB,GAAzBA;aACAC,uBAAuB,GAAvBA;aACAC,gBAAgB,GAAhBA;IACT;IAEH,MAAM,UAAU;QACZ,MAAM,EAAEC,GAAG,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,GAAG;QAChD,MAAMC,WAAW,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO;QAE7D,IAAI,CAACA,SAAS,QAAQ,CAACD,MACnB;QAGJ,MAAME,gBAAgB,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO;QACzD,MAAM,CAACC,WAAW,GAAGD,cAAc,gBAAgB,CAAC;QAEpD,IAAIC,YACA;QAGJ,MAAMC,QAAQ,IAAIC,MAAM;QAExB,MAAMC,UAAU;QAMhB,MAAMC,cAAc,IAAI,CACpBH,OACAE,SACA,gCACA;IAER;AACJ;AAEO,MAAME,iCAAiCC,aAAa,oBAAoB,CAAC;IAC5E,gBAAgBb;IAChB,cAAc;QAACc;QAA2BC;QAAyBC;KAAiB;AACxF"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CoreBeforeDeploy, GetProductionEnvironments, IsRemotePulumiBackendService, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
declare class ValidateProductionPulumiStateImpl implements CoreBeforeDeploy.Interface {
|
|
3
|
-
private isRemotePulumiBackendService;
|
|
4
|
-
private projectSdkParamsService;
|
|
5
|
-
private getProductionEnvironments;
|
|
6
|
-
constructor(isRemotePulumiBackendService: IsRemotePulumiBackendService.Interface, projectSdkParamsService: ProjectSdkParamsService.Interface, getProductionEnvironments: GetProductionEnvironments.Interface);
|
|
7
|
-
execute(params: CoreBeforeDeploy.Params): Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
export declare const ValidateProductionPulumiState: typeof ValidateProductionPulumiStateImpl & {
|
|
10
|
-
__abstraction: import("@webiny/di").Abstraction<import("~/abstractions/index.js").ICoreBeforeDeploy>;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CoreBeforeDeploy, GetProductionEnvironments, IsRemotePulumiBackendService, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
2
|
-
import { GracefulError } from "../../index.js";
|
|
3
|
-
class ValidateProductionPulumiStateImpl {
|
|
4
|
-
constructor(isRemotePulumiBackendService, projectSdkParamsService, getProductionEnvironments){
|
|
5
|
-
this.isRemotePulumiBackendService = isRemotePulumiBackendService;
|
|
6
|
-
this.projectSdkParamsService = projectSdkParamsService;
|
|
7
|
-
this.getProductionEnvironments = getProductionEnvironments;
|
|
8
|
-
}
|
|
9
|
-
async execute(params) {
|
|
10
|
-
const sdkParams = this.projectSdkParamsService.get();
|
|
11
|
-
const { env } = sdkParams;
|
|
12
|
-
const { allowLocalStateFiles } = params;
|
|
13
|
-
const prodEnvs = await this.getProductionEnvironments.execute();
|
|
14
|
-
const isProdEnv = prodEnvs.includes(env);
|
|
15
|
-
if (!isProdEnv) return;
|
|
16
|
-
if (this.isRemotePulumiBackendService.execute()) return;
|
|
17
|
-
if (allowLocalStateFiles) return;
|
|
18
|
-
const error = new Error("Cannot deploy to production with local state files.");
|
|
19
|
-
const message = "Use the %s flag to continue with local Pulumi state files, or configure a remote backend for production deployments. Learn more: https://webiny.link/state-files-production.";
|
|
20
|
-
throw GracefulError.from(error, message, "--allow-local-state-files");
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const ValidateProductionPulumiState = CoreBeforeDeploy.createImplementation({
|
|
24
|
-
implementation: ValidateProductionPulumiStateImpl,
|
|
25
|
-
dependencies: [
|
|
26
|
-
IsRemotePulumiBackendService,
|
|
27
|
-
ProjectSdkParamsService,
|
|
28
|
-
GetProductionEnvironments
|
|
29
|
-
]
|
|
30
|
-
});
|
|
31
|
-
export { ValidateProductionPulumiState };
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=ValidateProductionPulumiState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/Project/ValidateProductionPulumiState.js","sources":["../../../src/extensions/Project/ValidateProductionPulumiState.ts"],"sourcesContent":["import {\n CoreBeforeDeploy,\n GetProductionEnvironments,\n IsRemotePulumiBackendService,\n ProjectSdkParamsService\n} from \"~/abstractions/index.js\";\nimport { GracefulError } from \"~/index.js\";\n\nclass ValidateProductionPulumiStateImpl implements CoreBeforeDeploy.Interface {\n constructor(\n private isRemotePulumiBackendService: IsRemotePulumiBackendService.Interface,\n private projectSdkParamsService: ProjectSdkParamsService.Interface,\n private getProductionEnvironments: GetProductionEnvironments.Interface\n ) {}\n\n async execute(params: CoreBeforeDeploy.Params) {\n const sdkParams = this.projectSdkParamsService.get();\n const { env } = sdkParams;\n const { allowLocalStateFiles } = params;\n\n const prodEnvs = await this.getProductionEnvironments.execute();\n const isProdEnv = prodEnvs.includes(env);\n\n if (!isProdEnv) {\n return;\n }\n\n if (this.isRemotePulumiBackendService.execute()) {\n return;\n }\n\n if (allowLocalStateFiles) {\n return;\n }\n\n const error = new Error(\"Cannot deploy to production with local state files.\");\n\n const message = [\n \"Use the %s flag to continue with local Pulumi state files,\",\n \"or configure a remote backend for production deployments.\",\n \"Learn more: https://webiny.link/state-files-production.\"\n ].join(\" \");\n\n throw GracefulError.from(error, message, \"--allow-local-state-files\");\n }\n}\n\nexport const ValidateProductionPulumiState = CoreBeforeDeploy.createImplementation({\n implementation: ValidateProductionPulumiStateImpl,\n dependencies: [IsRemotePulumiBackendService, ProjectSdkParamsService, GetProductionEnvironments]\n});\n"],"names":["ValidateProductionPulumiStateImpl","isRemotePulumiBackendService","projectSdkParamsService","getProductionEnvironments","params","sdkParams","env","allowLocalStateFiles","prodEnvs","isProdEnv","error","Error","message","GracefulError","ValidateProductionPulumiState","CoreBeforeDeploy","IsRemotePulumiBackendService","ProjectSdkParamsService","GetProductionEnvironments"],"mappings":";;AAQA,MAAMA;IACF,YACYC,4BAAoE,EACpEC,uBAA0D,EAC1DC,yBAA8D,CACxE;aAHUF,4BAA4B,GAA5BA;aACAC,uBAAuB,GAAvBA;aACAC,yBAAyB,GAAzBA;IACT;IAEH,MAAM,QAAQC,MAA+B,EAAE;QAC3C,MAAMC,YAAY,IAAI,CAAC,uBAAuB,CAAC,GAAG;QAClD,MAAM,EAAEC,GAAG,EAAE,GAAGD;QAChB,MAAM,EAAEE,oBAAoB,EAAE,GAAGH;QAEjC,MAAMI,WAAW,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO;QAC7D,MAAMC,YAAYD,SAAS,QAAQ,CAACF;QAEpC,IAAI,CAACG,WACD;QAGJ,IAAI,IAAI,CAAC,4BAA4B,CAAC,OAAO,IACzC;QAGJ,IAAIF,sBACA;QAGJ,MAAMG,QAAQ,IAAIC,MAAM;QAExB,MAAMC,UAAU;QAMhB,MAAMC,cAAc,IAAI,CAACH,OAAOE,SAAS;IAC7C;AACJ;AAEO,MAAME,gCAAgCC,iBAAiB,oBAAoB,CAAC;IAC/E,gBAAgBf;IAChB,cAAc;QAACgB;QAA8BC;QAAyBC;KAA0B;AACpG"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DescribeEndpointCommand, IoTClient } from "@webiny/aws-sdk/client-iot/index.js";
|
|
2
|
-
const getIotEndpoint = (coreStackOutput)=>{
|
|
3
|
-
const iotClient = new IoTClient();
|
|
4
|
-
return iotClient.send(new DescribeEndpointCommand({
|
|
5
|
-
endpointType: "iot:Data-ATS"
|
|
6
|
-
})).then(({ endpointAddress })=>{
|
|
7
|
-
const watchTopic = `webiny-watch-${coreStackOutput.deploymentId}`;
|
|
8
|
-
const iotAuthorizerName = coreStackOutput.iotAuthorizerName;
|
|
9
|
-
const queryParams = [
|
|
10
|
-
`x-amz-customauthorizer-name=${iotAuthorizerName}`,
|
|
11
|
-
`x-webiny-watch-command-topic=${watchTopic}`
|
|
12
|
-
].join("&");
|
|
13
|
-
return `wss://${endpointAddress}/mqtt?${queryParams}`;
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
export { getIotEndpoint };
|
|
17
|
-
|
|
18
|
-
//# sourceMappingURL=getIotEndpoint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/Watch/getIotEndpoint.js","sources":["../../../src/features/Watch/getIotEndpoint.ts"],"sourcesContent":["import { DescribeEndpointCommand, IoTClient } from \"@webiny/aws-sdk/client-iot/index.js\";\nimport { type ICoreStackOutput } from \"~/abstractions/features/GetAppStackOutput.js\";\n\nexport const getIotEndpoint = (coreStackOutput: ICoreStackOutput): Promise<string> => {\n const iotClient = new IoTClient();\n\n return iotClient\n .send(\n new DescribeEndpointCommand({\n endpointType: \"iot:Data-ATS\"\n })\n )\n .then(({ endpointAddress }) => {\n const watchTopic = `webiny-watch-${coreStackOutput.deploymentId}`;\n const iotAuthorizerName = coreStackOutput.iotAuthorizerName;\n\n const queryParams = [\n `x-amz-customauthorizer-name=${iotAuthorizerName}`,\n `x-webiny-watch-command-topic=${watchTopic}`\n ].join(\"&\");\n\n return `wss://${endpointAddress}/mqtt?${queryParams}`;\n });\n};\n"],"names":["getIotEndpoint","coreStackOutput","iotClient","IoTClient","DescribeEndpointCommand","endpointAddress","watchTopic","iotAuthorizerName","queryParams"],"mappings":";AAGO,MAAMA,iBAAiB,CAACC;IAC3B,MAAMC,YAAY,IAAIC;IAEtB,OAAOD,UACF,IAAI,CACD,IAAIE,wBAAwB;QACxB,cAAc;IAClB,IAEH,IAAI,CAAC,CAAC,EAAEC,eAAe,EAAE;QACtB,MAAMC,aAAa,CAAC,aAAa,EAAEL,gBAAgB,YAAY,EAAE;QACjE,MAAMM,oBAAoBN,gBAAgB,iBAAiB;QAE3D,MAAMO,cAAc;YAChB,CAAC,4BAA4B,EAAED,mBAAmB;YAClD,CAAC,6BAA6B,EAAED,YAAY;SAC/C,CAAC,IAAI,CAAC;QAEP,OAAO,CAAC,MAAM,EAAED,gBAAgB,MAAM,EAAEG,aAAa;IACzD;AACR"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type ListAppLambdaFunctionsService, type LoggerService, type PulumiExportService, type WatchedLambdaFunctionsService, type UiService } from "../../abstractions/index.js";
|
|
2
|
-
import { type AppModel } from "../../models/index.js";
|
|
3
|
-
export interface IReplaceLambdaFunctionsParams {
|
|
4
|
-
app: AppModel;
|
|
5
|
-
deploymentId: string | undefined;
|
|
6
|
-
iotEndpoint: string;
|
|
7
|
-
iotEndpointTopic: string;
|
|
8
|
-
sessionId: number;
|
|
9
|
-
functionsList: ListAppLambdaFunctionsService.Result;
|
|
10
|
-
increaseTimeout?: number;
|
|
11
|
-
localExecutionHandshakeTimeout?: number;
|
|
12
|
-
dependencies: {
|
|
13
|
-
uiService: UiService.Interface;
|
|
14
|
-
loggerService: LoggerService.Interface;
|
|
15
|
-
pulumiExportService: PulumiExportService.Interface;
|
|
16
|
-
watchedLambdaFunctionsService: WatchedLambdaFunctionsService.Interface;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export declare const replaceLambdaFunctions: ({ app, deploymentId, iotEndpoint, iotEndpointTopic, sessionId, functionsList, increaseTimeout, localExecutionHandshakeTimeout, dependencies }: IReplaceLambdaFunctionsParams) => Promise<void[]>;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import p_retry from "p-retry";
|
|
3
|
-
import { GetFunctionConfigurationCommand, LambdaClient, UpdateFunctionCodeCommand, UpdateFunctionConfigurationCommand } from "@webiny/aws-sdk/client-lambda/index.js";
|
|
4
|
-
const WATCH_MODE_NOTE_IN_DESCRIPTION = " (💡 local development mode, redeploy to remove)";
|
|
5
|
-
const DEFAULT_INCREASE_TIMEOUT = 120;
|
|
6
|
-
const replaceLambdaFunctions = async ({ app, deploymentId, iotEndpoint, iotEndpointTopic, sessionId, functionsList, increaseTimeout, localExecutionHandshakeTimeout, dependencies })=>{
|
|
7
|
-
const { loggerService: logger, pulumiExportService: exportStackState, watchedLambdaFunctionsService } = dependencies;
|
|
8
|
-
const stackExport = await exportStackState.execute(app);
|
|
9
|
-
if (!stackExport) {
|
|
10
|
-
logger.info("No AWS Lambda functions to replace.");
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
const functionNamesToUpdate = functionsList.list.map((fn)=>fn.name);
|
|
14
|
-
const replacedFunctionUrns = [];
|
|
15
|
-
if (stackExport.deployment?.resources) {
|
|
16
|
-
for (const resource of stackExport.deployment.resources)if ("aws:lambda/function:Function" === resource.type) {
|
|
17
|
-
const functionName = resource.inputs?.name;
|
|
18
|
-
if (functionName && functionNamesToUpdate.includes(functionName)) {
|
|
19
|
-
replacedFunctionUrns.push(resource.urn);
|
|
20
|
-
logger.debug(`Will replace Lambda function: ${functionName} (${resource.urn})`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (replacedFunctionUrns.length > 0) {
|
|
25
|
-
watchedLambdaFunctionsService.markDirty({
|
|
26
|
-
name: app.name,
|
|
27
|
-
deploymentId
|
|
28
|
-
}, replacedFunctionUrns);
|
|
29
|
-
logger.info(`Marked ${replacedFunctionUrns.length} Lambda function(s) for replacement on next deployment.`);
|
|
30
|
-
}
|
|
31
|
-
logger.info("replacing %s AWS Lambda function(s).", functionsList.meta.count);
|
|
32
|
-
const lambdaClient = new LambdaClient();
|
|
33
|
-
const replacementsPromises = functionsList.list.map(async (fn)=>{
|
|
34
|
-
const getFnConfigCmd = new GetFunctionConfigurationCommand({
|
|
35
|
-
FunctionName: fn.name
|
|
36
|
-
});
|
|
37
|
-
const lambdaFnConfiguration = await lambdaClient.send(getFnConfigCmd);
|
|
38
|
-
const updateFnCodeCmd = new UpdateFunctionCodeCommand({
|
|
39
|
-
FunctionName: fn.name,
|
|
40
|
-
ZipFile: fs.readFileSync(import.meta.dirname + "/handler/handler.zip")
|
|
41
|
-
});
|
|
42
|
-
await lambdaClient.send(updateFnCodeCmd);
|
|
43
|
-
let Description = lambdaFnConfiguration.Description || "";
|
|
44
|
-
if (!Description.endsWith(WATCH_MODE_NOTE_IN_DESCRIPTION)) Description += WATCH_MODE_NOTE_IN_DESCRIPTION;
|
|
45
|
-
const Timeout = increaseTimeout || DEFAULT_INCREASE_TIMEOUT;
|
|
46
|
-
await p_retry(()=>lambdaClient.send(new UpdateFunctionConfigurationCommand({
|
|
47
|
-
FunctionName: fn.name,
|
|
48
|
-
Timeout,
|
|
49
|
-
Description,
|
|
50
|
-
Environment: {
|
|
51
|
-
Variables: {
|
|
52
|
-
...lambdaFnConfiguration.Environment?.Variables,
|
|
53
|
-
WEBINY_WATCH: JSON.stringify({
|
|
54
|
-
enabled: true,
|
|
55
|
-
localExecutionHandshakeTimeout,
|
|
56
|
-
sessionId,
|
|
57
|
-
iotEndpoint,
|
|
58
|
-
iotEndpointTopic,
|
|
59
|
-
functionName: fn.name
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
})));
|
|
64
|
-
});
|
|
65
|
-
return Promise.all(replacementsPromises).then((res)=>{
|
|
66
|
-
logger.info("%s AWS Lambda function(s) replaced.", functionsList.meta.count);
|
|
67
|
-
return res;
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
export { replaceLambdaFunctions };
|
|
71
|
-
|
|
72
|
-
//# sourceMappingURL=replaceLambdaFunctions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/Watch/replaceLambdaFunctions.js","sources":["../../../src/features/Watch/replaceLambdaFunctions.ts"],"sourcesContent":["import fs from \"fs\";\nimport pRetry from \"p-retry\";\nimport {\n GetFunctionConfigurationCommand,\n LambdaClient,\n UpdateFunctionCodeCommand,\n UpdateFunctionConfigurationCommand\n} from \"@webiny/aws-sdk/client-lambda/index.js\";\nimport {\n type ListAppLambdaFunctionsService,\n type LoggerService,\n type PulumiExportService,\n type WatchedLambdaFunctionsService,\n type UiService\n} from \"~/abstractions/index.js\";\nimport { type AppModel } from \"~/models/index.js\";\n\nconst WATCH_MODE_NOTE_IN_DESCRIPTION = \" (💡 local development mode, redeploy to remove)\";\nconst DEFAULT_INCREASE_TIMEOUT = 120;\n\nexport interface IReplaceLambdaFunctionsParams {\n app: AppModel;\n deploymentId: string | undefined;\n iotEndpoint: string;\n iotEndpointTopic: string;\n sessionId: number;\n functionsList: ListAppLambdaFunctionsService.Result;\n increaseTimeout?: number;\n localExecutionHandshakeTimeout?: number;\n dependencies: {\n uiService: UiService.Interface;\n loggerService: LoggerService.Interface;\n pulumiExportService: PulumiExportService.Interface;\n watchedLambdaFunctionsService: WatchedLambdaFunctionsService.Interface;\n };\n}\n\nexport const replaceLambdaFunctions = async ({\n app,\n deploymentId,\n iotEndpoint,\n iotEndpointTopic,\n sessionId,\n functionsList,\n increaseTimeout,\n localExecutionHandshakeTimeout,\n dependencies\n}: IReplaceLambdaFunctionsParams) => {\n const {\n loggerService: logger,\n pulumiExportService: exportStackState,\n watchedLambdaFunctionsService\n } = dependencies;\n\n const stackExport = await exportStackState.execute(app);\n if (!stackExport) {\n // If no stack export is found, return an empty array. This is a valid scenario.\n // For example, watching the Admin app locally, but not deploying it.\n logger.info(\"No AWS Lambda functions to replace.\");\n return [];\n }\n\n // Find the URNs of Lambda functions that will be replaced\n const functionNamesToUpdate = functionsList.list.map(fn => fn.name);\n const replacedFunctionUrns: string[] = [];\n\n if (stackExport.deployment?.resources) {\n for (const resource of stackExport.deployment.resources) {\n if (resource.type === \"aws:lambda/function:Function\") {\n const functionName = resource.inputs?.name;\n if (functionName && functionNamesToUpdate.includes(functionName)) {\n replacedFunctionUrns.push(resource.urn);\n logger.debug(`Will replace Lambda function: ${functionName} (${resource.urn})`);\n }\n }\n }\n }\n\n // Mark these functions as needing replacement on next deployment\n if (replacedFunctionUrns.length > 0) {\n watchedLambdaFunctionsService.markDirty(\n { name: app.name, deploymentId },\n replacedFunctionUrns\n );\n logger.info(\n `Marked ${replacedFunctionUrns.length} Lambda function(s) for replacement on next deployment.`\n );\n }\n\n logger.info(\"replacing %s AWS Lambda function(s).\", functionsList.meta.count);\n const lambdaClient = new LambdaClient();\n\n const replacementsPromises = functionsList.list.map(async fn => {\n const getFnConfigCmd = new GetFunctionConfigurationCommand({ FunctionName: fn.name });\n const lambdaFnConfiguration = await lambdaClient.send(getFnConfigCmd);\n\n const updateFnCodeCmd = new UpdateFunctionCodeCommand({\n FunctionName: fn.name,\n ZipFile: fs.readFileSync(import.meta.dirname + \"/handler/handler.zip\")\n });\n\n await lambdaClient.send(updateFnCodeCmd);\n\n let Description = lambdaFnConfiguration.Description || \"\";\n if (!Description.endsWith(WATCH_MODE_NOTE_IN_DESCRIPTION)) {\n Description += WATCH_MODE_NOTE_IN_DESCRIPTION;\n }\n\n const Timeout = increaseTimeout || DEFAULT_INCREASE_TIMEOUT;\n\n await pRetry(() =>\n lambdaClient.send(\n new UpdateFunctionConfigurationCommand({\n FunctionName: fn.name,\n Timeout,\n Description,\n Environment: {\n Variables: {\n ...lambdaFnConfiguration.Environment?.Variables,\n WEBINY_WATCH: JSON.stringify({\n enabled: true,\n localExecutionHandshakeTimeout,\n sessionId,\n iotEndpoint,\n iotEndpointTopic,\n functionName: fn.name\n })\n }\n }\n })\n )\n );\n });\n\n return Promise.all(replacementsPromises).then(res => {\n logger.info(\"%s AWS Lambda function(s) replaced.\", functionsList.meta.count);\n return res;\n });\n};\n"],"names":["WATCH_MODE_NOTE_IN_DESCRIPTION","DEFAULT_INCREASE_TIMEOUT","replaceLambdaFunctions","app","deploymentId","iotEndpoint","iotEndpointTopic","sessionId","functionsList","increaseTimeout","localExecutionHandshakeTimeout","dependencies","logger","exportStackState","watchedLambdaFunctionsService","stackExport","functionNamesToUpdate","fn","replacedFunctionUrns","resource","functionName","lambdaClient","LambdaClient","replacementsPromises","getFnConfigCmd","GetFunctionConfigurationCommand","lambdaFnConfiguration","updateFnCodeCmd","UpdateFunctionCodeCommand","fs","Description","Timeout","pRetry","UpdateFunctionConfigurationCommand","JSON","Promise","res"],"mappings":";;;AAiBA,MAAMA,iCAAiC;AACvC,MAAMC,2BAA2B;AAmB1B,MAAMC,yBAAyB,OAAO,EACzCC,GAAG,EACHC,YAAY,EACZC,WAAW,EACXC,gBAAgB,EAChBC,SAAS,EACTC,aAAa,EACbC,eAAe,EACfC,8BAA8B,EAC9BC,YAAY,EACgB;IAC5B,MAAM,EACF,eAAeC,MAAM,EACrB,qBAAqBC,gBAAgB,EACrCC,6BAA6B,EAChC,GAAGH;IAEJ,MAAMI,cAAc,MAAMF,iBAAiB,OAAO,CAACV;IACnD,IAAI,CAACY,aAAa;QAGdH,OAAO,IAAI,CAAC;QACZ,OAAO,EAAE;IACb;IAGA,MAAMI,wBAAwBR,cAAc,IAAI,CAAC,GAAG,CAACS,CAAAA,KAAMA,GAAG,IAAI;IAClE,MAAMC,uBAAiC,EAAE;IAEzC,IAAIH,YAAY,UAAU,EAAE,WACxB;QAAA,KAAK,MAAMI,YAAYJ,YAAY,UAAU,CAAC,SAAS,CACnD,IAAII,AAAkB,mCAAlBA,SAAS,IAAI,EAAqC;YAClD,MAAMC,eAAeD,SAAS,MAAM,EAAE;YACtC,IAAIC,gBAAgBJ,sBAAsB,QAAQ,CAACI,eAAe;gBAC9DF,qBAAqB,IAAI,CAACC,SAAS,GAAG;gBACtCP,OAAO,KAAK,CAAC,CAAC,8BAA8B,EAAEQ,aAAa,EAAE,EAAED,SAAS,GAAG,CAAC,CAAC,CAAC;YAClF;QACJ;IACJ;IAIJ,IAAID,qBAAqB,MAAM,GAAG,GAAG;QACjCJ,8BAA8B,SAAS,CACnC;YAAE,MAAMX,IAAI,IAAI;YAAEC;QAAa,GAC/Bc;QAEJN,OAAO,IAAI,CACP,CAAC,OAAO,EAAEM,qBAAqB,MAAM,CAAC,uDAAuD,CAAC;IAEtG;IAEAN,OAAO,IAAI,CAAC,wCAAwCJ,cAAc,IAAI,CAAC,KAAK;IAC5E,MAAMa,eAAe,IAAIC;IAEzB,MAAMC,uBAAuBf,cAAc,IAAI,CAAC,GAAG,CAAC,OAAMS;QACtD,MAAMO,iBAAiB,IAAIC,gCAAgC;YAAE,cAAcR,GAAG,IAAI;QAAC;QACnF,MAAMS,wBAAwB,MAAML,aAAa,IAAI,CAACG;QAEtD,MAAMG,kBAAkB,IAAIC,0BAA0B;YAClD,cAAcX,GAAG,IAAI;YACrB,SAASY,GAAG,YAAY,CAAC,YAAY,OAAO,GAAG;QACnD;QAEA,MAAMR,aAAa,IAAI,CAACM;QAExB,IAAIG,cAAcJ,sBAAsB,WAAW,IAAI;QACvD,IAAI,CAACI,YAAY,QAAQ,CAAC9B,iCACtB8B,eAAe9B;QAGnB,MAAM+B,UAAUtB,mBAAmBR;QAEnC,MAAM+B,QAAO,IACTX,aAAa,IAAI,CACb,IAAIY,mCAAmC;gBACnC,cAAchB,GAAG,IAAI;gBACrBc;gBACAD;gBACA,aAAa;oBACT,WAAW;wBACP,GAAGJ,sBAAsB,WAAW,EAAE,SAAS;wBAC/C,cAAcQ,KAAK,SAAS,CAAC;4BACzB,SAAS;4BACTxB;4BACAH;4BACAF;4BACAC;4BACA,cAAcW,GAAG,IAAI;wBACzB;oBACJ;gBACJ;YACJ;IAGZ;IAEA,OAAOkB,QAAQ,GAAG,CAACZ,sBAAsB,IAAI,CAACa,CAAAA;QAC1CxB,OAAO,IAAI,CAAC,uCAAuCJ,cAAc,IAAI,CAAC,KAAK;QAC3E,OAAO4B;IACX;AACJ"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Pulumi } from "@webiny/pulumi-sdk";
|
|
2
|
-
import { GetProjectService, GetPulumiService, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
3
|
-
export declare class DefaultGetPulumiService implements GetPulumiService.Interface {
|
|
4
|
-
private readonly getProjectService;
|
|
5
|
-
private readonly projectSdkParamsService;
|
|
6
|
-
constructor(getProjectService: GetProjectService.Interface, projectSdkParamsService: ProjectSdkParamsService.Interface);
|
|
7
|
-
execute(params?: GetPulumiService.Params): Promise<Pulumi>;
|
|
8
|
-
}
|
|
9
|
-
export declare const getPulumiService: import("@webiny/di").Implementation<typeof DefaultGetPulumiService>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Pulumi } from "@webiny/pulumi-sdk";
|
|
2
|
-
import { createImplementation } from "@webiny/di";
|
|
3
|
-
import { GetProjectService, GetPulumiService, ProjectSdkParamsService } from "../../abstractions/index.js";
|
|
4
|
-
import { WBY_PROJECT_SDK_CONTEXT, serializeProjectSdkContext } from "../../utils/index.js";
|
|
5
|
-
class DefaultGetPulumiService {
|
|
6
|
-
constructor(getProjectService, projectSdkParamsService){
|
|
7
|
-
this.getProjectService = getProjectService;
|
|
8
|
-
this.projectSdkParamsService = projectSdkParamsService;
|
|
9
|
-
}
|
|
10
|
-
async execute(params = {}) {
|
|
11
|
-
const project = this.getProjectService.execute();
|
|
12
|
-
const { app, pulumiOptions = {} } = params;
|
|
13
|
-
let cwd;
|
|
14
|
-
if (app) cwd = app.paths.workspaceFolder.toString();
|
|
15
|
-
const sdkParams = this.projectSdkParamsService.get();
|
|
16
|
-
const contextEnv = {
|
|
17
|
-
[WBY_PROJECT_SDK_CONTEXT]: serializeProjectSdkContext(sdkParams)
|
|
18
|
-
};
|
|
19
|
-
const mergedExeca = {
|
|
20
|
-
...pulumiOptions.execa,
|
|
21
|
-
cwd,
|
|
22
|
-
env: {
|
|
23
|
-
...pulumiOptions.execa?.env,
|
|
24
|
-
...contextEnv
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
return Pulumi.create({
|
|
28
|
-
...pulumiOptions,
|
|
29
|
-
execa: mergedExeca,
|
|
30
|
-
pulumiFolder: project.paths.dotWebinyFolder.toString()
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const getPulumiService = createImplementation({
|
|
35
|
-
abstraction: GetPulumiService,
|
|
36
|
-
implementation: DefaultGetPulumiService,
|
|
37
|
-
dependencies: [
|
|
38
|
-
GetProjectService,
|
|
39
|
-
ProjectSdkParamsService
|
|
40
|
-
]
|
|
41
|
-
});
|
|
42
|
-
export { DefaultGetPulumiService, getPulumiService };
|
|
43
|
-
|
|
44
|
-
//# sourceMappingURL=GetPulumiService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"services/GetPulumiService/GetPulumiService.js","sources":["../../../src/services/GetPulumiService/GetPulumiService.ts"],"sourcesContent":["import { Pulumi } from \"@webiny/pulumi-sdk\";\nimport { createImplementation } from \"@webiny/di\";\nimport {\n GetProjectService,\n GetPulumiService,\n ProjectSdkParamsService\n} from \"~/abstractions/index.js\";\nimport { serializeProjectSdkContext, WBY_PROJECT_SDK_CONTEXT } from \"~/utils/index.js\";\n\nexport class DefaultGetPulumiService implements GetPulumiService.Interface {\n constructor(\n private readonly getProjectService: GetProjectService.Interface,\n private readonly projectSdkParamsService: ProjectSdkParamsService.Interface\n ) {}\n\n async execute(params: GetPulumiService.Params = {}) {\n const project = this.getProjectService.execute();\n const { app, pulumiOptions = {} } = params;\n\n let cwd;\n if (app) {\n cwd = app.paths.workspaceFolder.toString();\n }\n\n // Get the current SDK params to pass to child processes\n const sdkParams = this.projectSdkParamsService.get();\n const contextEnv = {\n [WBY_PROJECT_SDK_CONTEXT]: serializeProjectSdkContext(sdkParams)\n };\n\n // Merge the context env with any existing env vars from pulumiOptions\n const mergedExeca = {\n ...pulumiOptions.execa,\n cwd,\n env: {\n ...pulumiOptions.execa?.env,\n ...contextEnv\n }\n };\n\n return Pulumi.create({\n ...pulumiOptions,\n execa: mergedExeca,\n pulumiFolder: project.paths.dotWebinyFolder.toString()\n });\n }\n}\n\nexport const getPulumiService = createImplementation({\n abstraction: GetPulumiService,\n implementation: DefaultGetPulumiService,\n dependencies: [GetProjectService, ProjectSdkParamsService]\n});\n"],"names":["DefaultGetPulumiService","getProjectService","projectSdkParamsService","params","project","app","pulumiOptions","cwd","sdkParams","contextEnv","WBY_PROJECT_SDK_CONTEXT","serializeProjectSdkContext","mergedExeca","Pulumi","getPulumiService","createImplementation","GetPulumiService","GetProjectService","ProjectSdkParamsService"],"mappings":";;;;AASO,MAAMA;IACT,YACqBC,iBAA8C,EAC9CC,uBAA0D,CAC7E;aAFmBD,iBAAiB,GAAjBA;aACAC,uBAAuB,GAAvBA;IAClB;IAEH,MAAM,QAAQC,SAAkC,CAAC,CAAC,EAAE;QAChD,MAAMC,UAAU,IAAI,CAAC,iBAAiB,CAAC,OAAO;QAC9C,MAAM,EAAEC,GAAG,EAAEC,gBAAgB,CAAC,CAAC,EAAE,GAAGH;QAEpC,IAAII;QACJ,IAAIF,KACAE,MAAMF,IAAI,KAAK,CAAC,eAAe,CAAC,QAAQ;QAI5C,MAAMG,YAAY,IAAI,CAAC,uBAAuB,CAAC,GAAG;QAClD,MAAMC,aAAa;YACf,CAACC,wBAAwB,EAAEC,2BAA2BH;QAC1D;QAGA,MAAMI,cAAc;YAChB,GAAGN,cAAc,KAAK;YACtBC;YACA,KAAK;gBACD,GAAGD,cAAc,KAAK,EAAE,GAAG;gBAC3B,GAAGG,UAAU;YACjB;QACJ;QAEA,OAAOI,OAAO,MAAM,CAAC;YACjB,GAAGP,aAAa;YAChB,OAAOM;YACP,cAAcR,QAAQ,KAAK,CAAC,eAAe,CAAC,QAAQ;QACxD;IACJ;AACJ;AAEO,MAAMU,mBAAmBC,qBAAqB;IACjD,aAAaC;IACb,gBAAgBhB;IAChB,cAAc;QAACiB;QAAmBC;KAAwB;AAC9D"}
|