@webiny/project-aws 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.7c2def32a7
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/_templates/appTemplates/api/graphql/package.json +3 -11
- package/_templates/appTemplates/api/graphql/src/index.ts +19 -78
- package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +17 -92
- package/_templates/extensions/OpenSearch/coreDdbToEsHandler/dynamoToElastic/src/index.ts +19 -12
- package/abstractions/ApiGqlClient.js +1 -1
- package/abstractions/ApiGqlClient.js.map +1 -1
- package/abstractions/InvokeLambdaFunction.js +1 -1
- package/abstractions/InvokeLambdaFunction.js.map +1 -1
- package/abstractions/features/pulumi/SetAdminCustomDomains.d.ts +9 -0
- package/abstractions/features/pulumi/SetAdminCustomDomains.js +5 -0
- package/abstractions/features/pulumi/SetAdminCustomDomains.js.map +1 -0
- package/abstractions/features/pulumi/SetApiCustomDomains.d.ts +9 -0
- package/abstractions/features/pulumi/SetApiCustomDomains.js +5 -0
- package/abstractions/features/pulumi/SetApiCustomDomains.js.map +1 -0
- package/abstractions/features/pulumi/index.d.ts +2 -0
- package/abstractions/features/pulumi/index.js +2 -0
- package/abstractions/services/ApiStackOutputService.d.ts +14 -1
- package/abstractions/services/ApiStackOutputService.js.map +1 -1
- package/admin.d.ts +6 -0
- package/admin.js +4 -2
- package/admin.js.map +1 -1
- package/api.d.ts +7 -4
- package/api.js +2 -0
- package/api.js.map +1 -1
- package/apps/createAdminApp.d.ts +1 -1
- package/apps/createApiApp.d.ts +8 -0
- package/apps/createCoreApp.d.ts +13 -13
- package/exports/infra/admin.d.ts +1 -0
- package/exports/infra/admin.js +1 -0
- package/exports/infra/api.d.ts +1 -0
- package/exports/infra/api.js +1 -0
- package/extensions/ApiRoute.d.ts +5 -5
- package/extensions/ApiRoute.js +16 -30
- package/extensions/ApiRoute.js.map +1 -1
- package/extensions/BackgroundTasks.d.ts +4 -0
- package/extensions/BackgroundTasks.js +24 -0
- package/extensions/BackgroundTasks.js.map +1 -0
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +1 -1
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +1 -2
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
- package/extensions/ProjectAws/BuildAppWorkspace.d.ts +3 -2
- package/extensions/ProjectAws/BuildAppWorkspace.js +38 -11
- package/extensions/ProjectAws/BuildAppWorkspace.js.map +1 -1
- package/extensions/ProjectAws/BuildProjectWorkspace.d.ts +12 -0
- package/extensions/ProjectAws/BuildProjectWorkspace.js +30 -0
- package/extensions/ProjectAws/BuildProjectWorkspace.js.map +1 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.d.ts +11 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.js +30 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.js.map +1 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.d.ts +11 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.js +30 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.js.map +1 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.d.ts +11 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.js +30 -0
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.js.map +1 -0
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js +1 -1
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js.map +1 -1
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.d.ts +11 -0
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js +31 -0
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js.map +1 -0
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.d.ts +13 -0
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.js +34 -0
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.js.map +1 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js +2 -3
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js.map +1 -1
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.d.ts +8 -0
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.js +14 -0
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.js.map +1 -0
- package/extensions/ProjectAws/UploadAdminAppToS3.js +1 -1
- package/extensions/ProjectAws/UploadAdminAppToS3.js.map +1 -1
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.d.ts +12 -0
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.js +31 -0
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.js.map +1 -0
- package/extensions/ProjectAws/ValidateProductionPulumiState.d.ts +12 -0
- package/extensions/ProjectAws/ValidateProductionPulumiState.js +33 -0
- package/extensions/ProjectAws/ValidateProductionPulumiState.js.map +1 -0
- package/extensions/ProjectAws/definitions.js +1 -3
- package/extensions/ProjectAws/definitions.js.map +1 -1
- package/extensions/ProjectAws.js +18 -4
- package/extensions/ProjectAws.js.map +1 -1
- package/extensions/RegisterRoutesPulumi.js +3 -6
- package/extensions/RegisterRoutesPulumi.js.map +1 -1
- package/extensions/definitions.js +0 -2
- package/extensions/definitions.js.map +1 -1
- package/extensions/index.d.ts +0 -1
- package/extensions/index.js +0 -1
- package/extensions/routePath.d.ts +20 -0
- package/extensions/routePath.js +13 -0
- package/extensions/routePath.js.map +1 -0
- package/features/InvokeLambdaFunction.js +1 -1
- package/features/InvokeLambdaFunction.js.map +1 -1
- package/features/Watch/AwsWatch.d.ts +17 -0
- package/features/Watch/AwsWatch.js +108 -0
- package/features/Watch/AwsWatch.js.map +1 -0
- package/features/Watch/getIotEndpoint.d.ts +2 -0
- package/features/Watch/getIotEndpoint.js +18 -0
- package/features/Watch/getIotEndpoint.js.map +1 -0
- package/features/Watch/handler/handler.zip +0 -0
- package/features/Watch/replaceLambdaFunctions.d.ts +19 -0
- package/features/Watch/replaceLambdaFunctions.js +72 -0
- package/features/Watch/replaceLambdaFunctions.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/infra.d.ts +33 -0
- package/infra.js +5 -2
- package/infra.js.map +1 -1
- package/package.json +20 -17
- package/project.d.ts +27 -11
- package/project.js +3 -2
- package/project.js.map +1 -1
- package/pulumi/apps/admin/createAdminPulumiApp.d.ts +1 -1
- package/pulumi/apps/admin/createAdminPulumiApp.js +10 -5
- package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
- package/pulumi/apps/api/ApiBackgroundTask.js +13 -13
- package/pulumi/apps/api/ApiCloudfront.js +106 -3
- package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
- package/pulumi/apps/api/ApiFileManager.js +2 -2
- package/pulumi/apps/api/ApiGateway.js +6 -6
- package/pulumi/apps/api/ApiGraphql.js +14 -14
- package/pulumi/apps/api/ApiGraphqlStream.d.ts +29 -0
- package/pulumi/apps/api/ApiGraphqlStream.js +58 -0
- package/pulumi/apps/api/ApiGraphqlStream.js.map +1 -0
- package/pulumi/apps/api/ApiOutput.d.ts +6 -6
- package/pulumi/apps/api/ApiOutput.js +1 -1
- package/pulumi/apps/api/ApiOutput.js.map +1 -1
- package/pulumi/apps/api/ApiScheduler.js +7 -7
- package/pulumi/apps/api/ApiWebsocket.js +15 -15
- package/pulumi/apps/api/backgroundTask/policy.js +2 -2
- package/pulumi/apps/api/backgroundTask/role.js +3 -3
- package/pulumi/apps/api/createApiPulumiApp.d.ts +8 -0
- package/pulumi/apps/api/createApiPulumiApp.js +42 -31
- package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
- package/pulumi/apps/api/handleGuardDutyEvents.js +5 -5
- package/pulumi/apps/api/index.d.ts +1 -0
- package/pulumi/apps/api/index.js +1 -0
- package/pulumi/apps/awsUtils.d.ts +1 -1
- package/pulumi/apps/awsUtils.js +5 -5
- package/pulumi/apps/awsUtils.js.map +1 -1
- package/pulumi/apps/blueGreen/BlueGreenRouterApiGateway.js +3 -3
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFront.js +3 -3
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFrontStore.js +2 -2
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontDefaultCacheBehaviorPolicies.js +3 -3
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js +6 -6
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js.map +1 -1
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.js +1 -1
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.js.map +1 -1
- package/pulumi/apps/blueGreen/types.d.ts +0 -3
- package/pulumi/apps/common/CoreOutput.d.ts +2 -1
- package/pulumi/apps/common/CoreOutput.js +2 -2
- package/pulumi/apps/common/CoreOutput.js.map +1 -1
- package/pulumi/apps/core/CoreAuditLogsDynamo.js +2 -2
- package/pulumi/apps/core/CoreCognito.d.ts +1 -0
- package/pulumi/apps/core/CoreCognito.js +7 -4
- package/pulumi/apps/core/CoreCognito.js.map +1 -1
- package/pulumi/apps/core/CoreDynamo.js +2 -2
- package/pulumi/apps/core/CoreEventBus.js +2 -2
- package/pulumi/apps/core/CoreFileManager.js +7 -7
- package/pulumi/apps/core/CoreOpenSearch.d.ts +1 -1
- package/pulumi/apps/core/CoreOpenSearch.js +24 -24
- package/pulumi/apps/core/CoreVpc.js +16 -16
- package/pulumi/apps/core/WatchCommand.js +12 -12
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js +13 -5
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
- package/pulumi/apps/core/configureS3BucketMalwareProtection.js +20 -20
- package/pulumi/apps/core/createCorePulumiApp.d.ts +13 -13
- package/pulumi/apps/core/createCorePulumiApp.js +41 -25
- package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
- package/pulumi/apps/core/webinyWatchCommand/handler.d.ts +1 -1
- package/pulumi/apps/createAppBucket.js +12 -12
- package/pulumi/apps/customDomain.d.ts +15 -0
- package/pulumi/apps/customDomain.js +14 -2
- package/pulumi/apps/customDomain.js.map +1 -1
- package/pulumi/apps/extensions/getVpcConfigFromExtension.d.ts +4 -4
- package/pulumi/apps/extensions/isVpcEnabled.d.ts +14 -0
- package/pulumi/apps/extensions/isVpcEnabled.js +8 -0
- package/pulumi/apps/extensions/isVpcEnabled.js.map +1 -0
- package/pulumi/apps/lambdaUtils.js +8 -8
- package/pulumi/apps/react/createReactPulumiApp.d.ts +1 -1
- package/pulumi/apps/react/createReactPulumiApp.js +9 -9
- package/pulumi/apps/react/createReactPulumiApp.js.map +1 -1
- package/pulumi/apps/syncSystem/SyncSystemDynamo.js +2 -2
- package/pulumi/apps/syncSystem/SyncSystemDynamoDb.js +2 -2
- package/pulumi/apps/syncSystem/SyncSystemEventBus.js +8 -8
- package/pulumi/apps/syncSystem/SyncSystemLambda.d.ts +1 -1
- package/pulumi/apps/syncSystem/SyncSystemLambda.js +12 -12
- package/pulumi/apps/syncSystem/SyncSystemLambda.js.map +1 -1
- package/pulumi/apps/syncSystem/SyncSystemResolverLambda.js +3 -3
- package/pulumi/apps/syncSystem/SyncSystemSQS.js +2 -2
- package/pulumi/apps/syncSystem/SyncSystemWorkerLambda.js +4 -4
- package/pulumi/apps/syncSystem/addTableItems.js +5 -5
- package/pulumi/apps/syncSystem/api/attachCognitoPermissions.js +4 -4
- package/pulumi/apps/syncSystem/api/attachDynamoDbPermissions.js +3 -3
- package/pulumi/apps/syncSystem/api/attachEventBusPermissions.js +3 -3
- package/pulumi/apps/syncSystem/api/attachS3Permissions.js +4 -4
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js +9 -9
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js.map +1 -1
- package/pulumi/apps/syncSystem/getSyncSystemOutput.d.ts +1 -1
- package/pulumi/apps/syncSystem/getSyncSystemOutput.js +1 -1
- package/pulumi/apps/syncSystem/getSyncSystemOutput.js.map +1 -1
- package/pulumi/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.js +2 -2
- package/pulumi/extensions/AdminCustomDomains.d.ts +9 -0
- package/pulumi/extensions/AdminCustomDomains.js +3 -1
- package/pulumi/extensions/AdminCustomDomains.js.map +1 -1
- package/pulumi/extensions/ApiCustomDomains.d.ts +9 -0
- package/pulumi/extensions/ApiCustomDomains.js +3 -1
- package/pulumi/extensions/ApiCustomDomains.js.map +1 -1
- package/pulumi/extensions/index.d.ts +25 -16
- package/pulumi/features/DefaultSetAdminCustomDomains.d.ts +8 -0
- package/pulumi/features/DefaultSetAdminCustomDomains.js +12 -0
- package/pulumi/features/DefaultSetAdminCustomDomains.js.map +1 -0
- package/pulumi/features/DefaultSetApiCustomDomains.d.ts +8 -0
- package/pulumi/features/DefaultSetApiCustomDomains.js +12 -0
- package/pulumi/features/DefaultSetApiCustomDomains.js.map +1 -0
- package/pulumi/features/index.d.ts +2 -0
- package/pulumi/features/index.js +2 -0
- package/pulumi/getAwsProjectSdk.d.ts +12 -0
- package/pulumi/getAwsProjectSdk.js +6 -0
- package/pulumi/getAwsProjectSdk.js.map +1 -0
- package/pulumi/getStackOutput.d.ts +7 -0
- package/pulumi/getStackOutput.js +8 -0
- package/pulumi/getStackOutput.js.map +1 -0
- package/pulumi/types.d.ts +2 -1
- package/pulumi/utils/addDomainsUrlsOutputs.js +3 -3
- package/pulumi/utils/addServiceManifestTableItem.js +4 -4
- package/pulumi/utils/createAssetArchive.js +3 -3
- package/pulumi/utils/getDistributionUrl.d.ts +9 -0
- package/pulumi/utils/getDistributionUrl.js +8 -0
- package/pulumi/utils/getDistributionUrl.js.map +1 -0
- package/pulumi/utils/index.d.ts +1 -0
- package/pulumi/utils/index.js +1 -0
- package/pulumi/utils/lambdaEnvVariables.js +6 -18
- package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
- package/pulumi/utils/tagResources.js +2 -2
- package/registerAwsProjectFeatures.d.ts +8 -0
- package/registerAwsProjectFeatures.js +55 -0
- package/registerAwsProjectFeatures.js.map +1 -0
- package/services/GetPulumiService/GetPulumiService.d.ts +8 -0
- package/services/GetPulumiService/GetPulumiService.js +44 -0
- package/services/GetPulumiService/GetPulumiService.js.map +1 -0
- package/utils/getPulumiBaseTemplatesFolderPath.d.ts +1 -0
- package/utils/getPulumiBaseTemplatesFolderPath.js +10 -0
- package/utils/getPulumiBaseTemplatesFolderPath.js.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/_templates/appTemplates/api/graphql/src/security.ts +0 -43
- package/extensions/Encryption.d.ts +0 -10
- package/extensions/Encryption.js +0 -36
- package/extensions/Encryption.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js","sources":["../../../src/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.ts"],"sourcesContent":["import { BeforeDeploy, LoggerService } from \"@webiny/project/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\
|
|
1
|
+
{"version":3,"file":"extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js","sources":["../../../src/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.ts"],"sourcesContent":["import { BeforeDeploy, LoggerService } from \"@webiny/project/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\n\nclass EnsureAwsCredentialsBeforeDeployImpl implements BeforeDeploy.Interface {\n constructor(private loggerService: LoggerService.Interface) {}\n\n async execute() {\n // Loaded here rather than at the top of the file. Validating the project config imports this\n // hook on every command, and only a deploy needs the STS client.\n const { STS } = await import(\"@webiny/aws-sdk/client-sts/index.js\");\n\n process.env.AWS_SDK_LOAD_CONFIG = \"true\";\n const sts = new STS({});\n\n try {\n await sts.getCallerIdentity({});\n } catch (err) {\n this.loggerService.debug({ err }, \"AWS credentials error.\");\n throw GracefulError.from(\n new Error(\"AWS credentials are not configured correctly.\"),\n 'No valid AWS credentials were found. Run \"aws configure\" or set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables before deploying. Learn more: https://webiny.link/aws-credentials'\n );\n }\n\n const region = await sts.config.region();\n if (!region) {\n throw GracefulError.from(\n new Error(\"AWS region is not defined.\"),\n \"No AWS region is set. Define the AWS_REGION environment variable or set a default region in your AWS profile. Learn more: https://webiny.link/aws-region\"\n );\n }\n\n process.env.AWS_REGION = region;\n\n const { accessKeyId } = await sts.config.credentials();\n const profile = process.env.AWS_PROFILE;\n\n if (profile) {\n this.loggerService.info(`Using profile \"${profile}\" in \"${region}\" region.`);\n } else {\n this.loggerService.info(`Using access key ID \"${accessKeyId}\" in \"${region}\" region.`);\n }\n }\n}\n\nexport const EnsureAwsCredentialsBeforeDeploy = BeforeDeploy.createImplementation({\n implementation: EnsureAwsCredentialsBeforeDeployImpl,\n dependencies: [LoggerService]\n});\n"],"names":["EnsureAwsCredentialsBeforeDeployImpl","loggerService","STS","process","sts","err","GracefulError","Error","region","accessKeyId","profile","EnsureAwsCredentialsBeforeDeploy","BeforeDeploy","LoggerService"],"mappings":";;AAGA,MAAMA;IACF,YAAoBC,aAAsC,CAAE;aAAxCA,aAAa,GAAbA;IAAyC;IAE7D,MAAM,UAAU;QAGZ,MAAM,EAAEC,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC;QAE7BC,QAAQ,GAAG,CAAC,mBAAmB,GAAG;QAClC,MAAMC,MAAM,IAAIF,IAAI,CAAC;QAErB,IAAI;YACA,MAAME,IAAI,iBAAiB,CAAC,CAAC;QACjC,EAAE,OAAOC,KAAK;YACV,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;gBAAEA;YAAI,GAAG;YAClC,MAAMC,cAAc,IAAI,CACpB,IAAIC,MAAM,kDACV;QAER;QAEA,MAAMC,SAAS,MAAMJ,IAAI,MAAM,CAAC,MAAM;QACtC,IAAI,CAACI,QACD,MAAMF,cAAc,IAAI,CACpB,IAAIC,MAAM,+BACV;QAIRJ,QAAQ,GAAG,CAAC,UAAU,GAAGK;QAEzB,MAAM,EAAEC,WAAW,EAAE,GAAG,MAAML,IAAI,MAAM,CAAC,WAAW;QACpD,MAAMM,UAAUP,QAAQ,GAAG,CAAC,WAAW;QAEvC,IAAIO,SACA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,eAAe,EAAEA,QAAQ,MAAM,EAAEF,OAAO,SAAS,CAAC;aAE3E,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAEC,YAAY,MAAM,EAAED,OAAO,SAAS,CAAC;IAE7F;AACJ;AAEO,MAAMG,mCAAmCC,aAAa,oBAAoB,CAAC;IAC9E,gBAAgBZ;IAChB,cAAc;QAACa;KAAc;AACjC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ApiBeforeDeploy, GetAppStackOutput, ProjectSdkParamsService } from "@webiny/project/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("@webiny/project/abstractions/features").IApiBeforeDeploy>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ApiBeforeDeploy, GetAppStackOutput, ProjectSdkParamsService } from "@webiny/project/abstractions/index.js";
|
|
2
|
+
import { GracefulError } from "@webiny/project";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js","sources":["../../../src/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.ts"],"sourcesContent":["import {\n ApiBeforeDeploy,\n GetAppStackOutput,\n ProjectSdkParamsService\n} from \"@webiny/project/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BeforeDeploy, IsCi, IsTelemetryEnabled, IsWcpEnabled, IsWebinyJsRepo } from "@webiny/project/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("@webiny/project/abstractions/features").IBeforeDeploy>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BeforeDeploy, IsCi, IsTelemetryEnabled, IsWcpEnabled, IsWebinyJsRepo } from "@webiny/project/abstractions/index.js";
|
|
2
|
+
import { GracefulError } from "@webiny/project";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions/ProjectAws/EnsureTelemetryEnabledForOss.js","sources":["../../../src/extensions/ProjectAws/EnsureTelemetryEnabledForOss.ts"],"sourcesContent":["import {\n BeforeDeploy,\n IsCi,\n IsTelemetryEnabled,\n IsWcpEnabled,\n IsWebinyJsRepo\n} from \"@webiny/project/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\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"}
|
|
@@ -16,11 +16,10 @@ class SetAdminEnvVars {
|
|
|
16
16
|
const apiOutput = await apiStackOutputService.execute();
|
|
17
17
|
if (apiOutput) {
|
|
18
18
|
process.env.REACT_APP_USER_POOL_REGION = apiOutput.region;
|
|
19
|
-
process.env.
|
|
20
|
-
process.env.REACT_APP_API_URL = apiOutput.apiUrl;
|
|
19
|
+
process.env.WEBINY_ADMIN_API_URL = apiOutput.apiUrl;
|
|
21
20
|
process.env.REACT_APP_USER_POOL_ID = apiOutput.cognitoUserPoolId;
|
|
22
21
|
process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID = apiOutput.cognitoAppClientId;
|
|
23
|
-
process.env.
|
|
22
|
+
process.env.WEBINY_ADMIN_PASSWORD_POLICY = JSON.stringify(apiOutput.cognitoUserPoolPasswordPolicy);
|
|
24
23
|
process.env.REACT_APP_WEBSOCKET_URL = apiOutput.websocketApiUrl;
|
|
25
24
|
}
|
|
26
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js","sources":["../../../../src/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.ts"],"sourcesContent":["import { ProjectSdkParamsService } from \"@webiny/project/abstractions/index.js\";\nimport { CoreStackOutputService, ApiStackOutputService } from \"../../../abstractions/index.js\";\n\ninterface ISetAdminEnvVarsDi {\n projectSdkParamsService: ProjectSdkParamsService.Interface;\n coreStackOutputService: CoreStackOutputService.Interface;\n apiStackOutputService: ApiStackOutputService.Interface;\n}\n\nexport class SetAdminEnvVars {\n di: ISetAdminEnvVarsDi;\n\n constructor(di: ISetAdminEnvVarsDi) {\n this.di = di;\n }\n\n async execute() {\n const { projectSdkParamsService, coreStackOutputService, apiStackOutputService } = this.di;\n const sdkParams = projectSdkParamsService.get();\n\n // Set basic admin env vars\n process.env.PORT = process.env.PORT || \"3001\";\n process.env.WEBINY_ADMIN_ENV = sdkParams.env;\n process.env.WEBINY_ADMIN_TRASH_BIN_RETENTION_PERIOD_DAYS =\n process.env.WEBINY_TRASH_BIN_RETENTION_PERIOD_DAYS || \"\";\n\n // Load Core app stack output (automatically uses env/variant/region from ProjectSdkParamsService)\n const coreOutput = await coreStackOutputService.execute<{\n deploymentId: string;\n cognitoUserPoolDomain?: string;\n }>();\n\n if (coreOutput) {\n process.env.WEBINY_ADMIN_DEPLOYMENT_ID = coreOutput.deploymentId;\n\n // Set Cognito user pool domain if available\n if (coreOutput.cognitoUserPoolDomain) {\n process.env.REACT_APP_USER_POOL_DOMAIN = coreOutput.cognitoUserPoolDomain;\n }\n }\n\n // Load API app stack output (automatically uses env/variant/region from ProjectSdkParamsService)\n const apiOutput = await apiStackOutputService.execute<{\n region: string;\n apiUrl: string;\n cognitoUserPoolId: string;\n cognitoAppClientId: string;\n cognitoUserPoolPasswordPolicy:
|
|
1
|
+
{"version":3,"file":"extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js","sources":["../../../../src/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.ts"],"sourcesContent":["import { ProjectSdkParamsService } from \"@webiny/project/abstractions/index.js\";\nimport { CoreStackOutputService, ApiStackOutputService } from \"../../../abstractions/index.js\";\nimport type { IApiStackOutputPasswordPolicy } from \"../../../abstractions/index.js\";\n\ninterface ISetAdminEnvVarsDi {\n projectSdkParamsService: ProjectSdkParamsService.Interface;\n coreStackOutputService: CoreStackOutputService.Interface;\n apiStackOutputService: ApiStackOutputService.Interface;\n}\n\nexport class SetAdminEnvVars {\n di: ISetAdminEnvVarsDi;\n\n constructor(di: ISetAdminEnvVarsDi) {\n this.di = di;\n }\n\n async execute() {\n const { projectSdkParamsService, coreStackOutputService, apiStackOutputService } = this.di;\n const sdkParams = projectSdkParamsService.get();\n\n // Set basic admin env vars\n process.env.PORT = process.env.PORT || \"3001\";\n process.env.WEBINY_ADMIN_ENV = sdkParams.env;\n process.env.WEBINY_ADMIN_TRASH_BIN_RETENTION_PERIOD_DAYS =\n process.env.WEBINY_TRASH_BIN_RETENTION_PERIOD_DAYS || \"\";\n\n // Load Core app stack output (automatically uses env/variant/region from ProjectSdkParamsService)\n const coreOutput = await coreStackOutputService.execute<{\n deploymentId: string;\n cognitoUserPoolDomain?: string;\n }>();\n\n if (coreOutput) {\n process.env.WEBINY_ADMIN_DEPLOYMENT_ID = coreOutput.deploymentId;\n\n // Set Cognito user pool domain if available\n if (coreOutput.cognitoUserPoolDomain) {\n process.env.REACT_APP_USER_POOL_DOMAIN = coreOutput.cognitoUserPoolDomain;\n }\n }\n\n // Load API app stack output (automatically uses env/variant/region from ProjectSdkParamsService)\n const apiOutput = await apiStackOutputService.execute<{\n region: string;\n apiUrl: string;\n cognitoUserPoolId: string;\n cognitoAppClientId: string;\n cognitoUserPoolPasswordPolicy: IApiStackOutputPasswordPolicy;\n websocketApiUrl: string;\n }>();\n\n if (apiOutput) {\n process.env.REACT_APP_USER_POOL_REGION = apiOutput.region;\n // Admin API URL, read by createRootContainer / Admin.tsx / playgrounds / api-info.\n process.env.WEBINY_ADMIN_API_URL = apiOutput.apiUrl;\n process.env.REACT_APP_USER_POOL_ID = apiOutput.cognitoUserPoolId;\n process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID = apiOutput.cognitoAppClientId;\n // Read by app-admin's readPasswordPolicyRules, for every form that sets a password.\n process.env.WEBINY_ADMIN_PASSWORD_POLICY = JSON.stringify(\n apiOutput.cognitoUserPoolPasswordPolicy\n );\n process.env.REACT_APP_WEBSOCKET_URL = apiOutput.websocketApiUrl;\n }\n }\n}\n"],"names":["SetAdminEnvVars","di","projectSdkParamsService","coreStackOutputService","apiStackOutputService","sdkParams","process","coreOutput","apiOutput","JSON"],"mappings":"AAUO,MAAMA;IAGT,YAAYC,EAAsB,CAAE;QAChC,IAAI,CAAC,EAAE,GAAGA;IACd;IAEA,MAAM,UAAU;QACZ,MAAM,EAAEC,uBAAuB,EAAEC,sBAAsB,EAAEC,qBAAqB,EAAE,GAAG,IAAI,CAAC,EAAE;QAC1F,MAAMC,YAAYH,wBAAwB,GAAG;QAG7CI,QAAQ,GAAG,CAAC,IAAI,GAAGA,QAAQ,GAAG,CAAC,IAAI,IAAI;QACvCA,QAAQ,GAAG,CAAC,gBAAgB,GAAGD,UAAU,GAAG;QAC5CC,QAAQ,GAAG,CAAC,4CAA4C,GACpDA,QAAQ,GAAG,CAAC,sCAAsC,IAAI;QAG1D,MAAMC,aAAa,MAAMJ,uBAAuB,OAAO;QAKvD,IAAII,YAAY;YACZD,QAAQ,GAAG,CAAC,0BAA0B,GAAGC,WAAW,YAAY;YAGhE,IAAIA,WAAW,qBAAqB,EAChCD,QAAQ,GAAG,CAAC,0BAA0B,GAAGC,WAAW,qBAAqB;QAEjF;QAGA,MAAMC,YAAY,MAAMJ,sBAAsB,OAAO;QASrD,IAAII,WAAW;YACXF,QAAQ,GAAG,CAAC,0BAA0B,GAAGE,UAAU,MAAM;YAEzDF,QAAQ,GAAG,CAAC,oBAAoB,GAAGE,UAAU,MAAM;YACnDF,QAAQ,GAAG,CAAC,sBAAsB,GAAGE,UAAU,iBAAiB;YAChEF,QAAQ,GAAG,CAAC,iCAAiC,GAAGE,UAAU,kBAAkB;YAE5EF,QAAQ,GAAG,CAAC,4BAA4B,GAAGG,KAAK,SAAS,CACrDD,UAAU,6BAA6B;YAE3CF,QAAQ,GAAG,CAAC,uBAAuB,GAAGE,UAAU,eAAe;QACnE;IACJ;AACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AdminAfterDeploy } from "@webiny/project/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("@webiny/project/abstractions/features").IAdminAfterDeploy>;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AdminAfterDeploy } from "@webiny/project/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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions/ProjectAws/TelemetryNoLongerNewUser.js","sources":["../../../src/extensions/ProjectAws/TelemetryNoLongerNewUser.ts"],"sourcesContent":["import { AdminAfterDeploy } from \"@webiny/project/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,6 +1,5 @@
|
|
|
1
1
|
import { AdminAfterDeploy, GetApp, UiService } from "@webiny/project/abstractions/index.js";
|
|
2
2
|
import fs from "fs";
|
|
3
|
-
import { uploadFolderToS3 } from "../../pulumi/index.js";
|
|
4
3
|
import { AdminStackOutputService } from "../../abstractions/index.js";
|
|
5
4
|
class UploadAdminAppToS3Impl {
|
|
6
5
|
constructor(ui, getApp, adminStackOutputService){
|
|
@@ -18,6 +17,7 @@ class UploadAdminAppToS3Impl {
|
|
|
18
17
|
const start = new Date().getTime();
|
|
19
18
|
const appOutput = await this.adminStackOutputService.execute();
|
|
20
19
|
if (!appOutput) throw new Error("Missing app stack output.");
|
|
20
|
+
const { uploadFolderToS3 } = await import("../../pulumi/utils/uploadFolderToS3.js");
|
|
21
21
|
await uploadFolderToS3({
|
|
22
22
|
path: buildFolderPath,
|
|
23
23
|
bucket: appOutput.appStorage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/ProjectAws/UploadAdminAppToS3.js","sources":["../../../src/extensions/ProjectAws/UploadAdminAppToS3.ts"],"sourcesContent":["import { AdminAfterDeploy, GetApp, UiService } from \"@webiny/project/abstractions/index.js\";\nimport fs from \"fs\";\nimport {
|
|
1
|
+
{"version":3,"file":"extensions/ProjectAws/UploadAdminAppToS3.js","sources":["../../../src/extensions/ProjectAws/UploadAdminAppToS3.ts"],"sourcesContent":["import { AdminAfterDeploy, GetApp, UiService } from \"@webiny/project/abstractions/index.js\";\nimport fs from \"fs\";\nimport { type IDefaultStackOutput } from \"~/pulumi/types.js\";\nimport { AdminStackOutputService } from \"~/abstractions/index.js\";\n\nclass UploadAdminAppToS3Impl implements AdminAfterDeploy.Interface {\n constructor(\n private ui: UiService.Interface,\n private getApp: GetApp.Interface,\n private adminStackOutputService: AdminStackOutputService.Interface\n ) {}\n\n async execute(params: AdminAfterDeploy.Params) {\n // No need to upload the app if we're doing a preview.\n if (params.preview) {\n return;\n }\n\n const ui = this.ui;\n ui.info(\"Uploading React application...\");\n\n const app = this.getApp.execute(params.app);\n\n const buildFolderPath = app.paths.workspaceFolder.join(\"build\").toString();\n if (!fs.existsSync(buildFolderPath)) {\n throw new Error(\"Cannot continue, build folder not found.\");\n }\n\n const start = new Date().getTime();\n const appOutput = await this.adminStackOutputService.execute<IDefaultStackOutput>();\n if (!appOutput) {\n throw new Error(\"Missing app stack output.\");\n }\n\n // Imported here rather than at the top of the file. Every CLI command imports this hook when\n // the project SDK registers its extensions, even `webiny --help`, and a top-level import used\n // to come through the `~/pulumi` barrel, which loads all of Pulumi and the AWS SDK: about\n // 2,700 modules. The upload is the only thing that needs it, so the upload pays for it.\n const { uploadFolderToS3 } = await import(\"~/pulumi/utils/uploadFolderToS3.js\");\n\n await uploadFolderToS3({\n path: buildFolderPath,\n bucket: appOutput.appStorage,\n acl: \"private\",\n cacheControl: [\n {\n pattern: /index\\.html/,\n value: \"no-cache, no-store, must-revalidate\"\n },\n {\n pattern: /robots\\.txt/,\n value: \"no-cache, no-store, must-revalidate\"\n },\n {\n pattern: /.*/,\n value: \"max-age=31536000\"\n }\n ],\n onFileUploadSuccess: ({ paths }) => {\n ui.success(paths.relative);\n },\n onFileUploadError: ({ paths, error }) => {\n ui.error(\"Failed to upload %s\", paths.relative);\n ui.text(error.message);\n },\n onFileUploadSkip: ({ paths }) => {\n ui.info(`Skipping %s, already exists.`, paths.relative);\n }\n });\n\n const duration = (new Date().getTime() - start) / 1000;\n\n ui.success(`React application successfully uploaded in %ss.`, duration);\n }\n}\n\nexport const UploadAdminAppToS3 = AdminAfterDeploy.createImplementation({\n implementation: UploadAdminAppToS3Impl,\n dependencies: [UiService, GetApp, AdminStackOutputService]\n});\n"],"names":["UploadAdminAppToS3Impl","ui","getApp","adminStackOutputService","params","app","buildFolderPath","fs","Error","start","Date","appOutput","uploadFolderToS3","paths","error","duration","UploadAdminAppToS3","AdminAfterDeploy","UiService","GetApp","AdminStackOutputService"],"mappings":";;;AAKA,MAAMA;IACF,YACYC,EAAuB,EACvBC,MAAwB,EACxBC,uBAA0D,CACpE;aAHUF,EAAE,GAAFA;aACAC,MAAM,GAANA;aACAC,uBAAuB,GAAvBA;IACT;IAEH,MAAM,QAAQC,MAA+B,EAAE;QAE3C,IAAIA,OAAO,OAAO,EACd;QAGJ,MAAMH,KAAK,IAAI,CAAC,EAAE;QAClBA,GAAG,IAAI,CAAC;QAER,MAAMI,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAACD,OAAO,GAAG;QAE1C,MAAME,kBAAkBD,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,QAAQ;QACxE,IAAI,CAACE,GAAG,UAAU,CAACD,kBACf,MAAM,IAAIE,MAAM;QAGpB,MAAMC,QAAQ,IAAIC,OAAO,OAAO;QAChC,MAAMC,YAAY,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO;QAC5D,IAAI,CAACA,WACD,MAAM,IAAIH,MAAM;QAOpB,MAAM,EAAEI,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC;QAE1C,MAAMA,iBAAiB;YACnB,MAAMN;YACN,QAAQK,UAAU,UAAU;YAC5B,KAAK;YACL,cAAc;gBACV;oBACI,SAAS;oBACT,OAAO;gBACX;gBACA;oBACI,SAAS;oBACT,OAAO;gBACX;gBACA;oBACI,SAAS;oBACT,OAAO;gBACX;aACH;YACD,qBAAqB,CAAC,EAAEE,KAAK,EAAE;gBAC3BZ,GAAG,OAAO,CAACY,MAAM,QAAQ;YAC7B;YACA,mBAAmB,CAAC,EAAEA,KAAK,EAAEC,KAAK,EAAE;gBAChCb,GAAG,KAAK,CAAC,uBAAuBY,MAAM,QAAQ;gBAC9CZ,GAAG,IAAI,CAACa,MAAM,OAAO;YACzB;YACA,kBAAkB,CAAC,EAAED,KAAK,EAAE;gBACxBZ,GAAG,IAAI,CAAC,gCAAgCY,MAAM,QAAQ;YAC1D;QACJ;QAEA,MAAME,WAAY,KAAIL,OAAO,OAAO,KAAKD,KAAI,IAAK;QAElDR,GAAG,OAAO,CAAC,mDAAmDc;IAClE;AACJ;AAEO,MAAMC,qBAAqBC,iBAAiB,oBAAoB,CAAC;IACpE,gBAAgBjB;IAChB,cAAc;QAACkB;QAAWC;QAAQC;KAAwB;AAC9D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BeforeDeploy, GetProductionEnvironments, GetProjectConfig, ProjectSdkParamsService } from "@webiny/project/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("@webiny/project/abstractions/features").IBeforeDeploy>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BeforeDeploy, GetProductionEnvironments, GetProjectConfig, ProjectSdkParamsService } from "@webiny/project/abstractions/index.js";
|
|
2
|
+
import { GracefulError } from "@webiny/project";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions/ProjectAws/ValidateEncryptionBeforeDeploy.js","sources":["../../../src/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.ts"],"sourcesContent":["import {\n BeforeDeploy,\n GetProductionEnvironments,\n GetProjectConfig,\n ProjectSdkParamsService\n} from \"@webiny/project/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CoreBeforeDeploy, GetProductionEnvironments, IsRemotePulumiBackendService, ProjectSdkParamsService } from "@webiny/project/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("@webiny/project/abstractions/features").ICoreBeforeDeploy>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CoreBeforeDeploy, GetProductionEnvironments, IsRemotePulumiBackendService, ProjectSdkParamsService } from "@webiny/project/abstractions/index.js";
|
|
2
|
+
import { GracefulError } from "@webiny/project";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions/ProjectAws/ValidateProductionPulumiState.js","sources":["../../../src/extensions/ProjectAws/ValidateProductionPulumiState.ts"],"sourcesContent":["import {\n CoreBeforeDeploy,\n GetProductionEnvironments,\n IsRemotePulumiBackendService,\n ProjectSdkParamsService\n} from \"@webiny/project/abstractions/index.js\";\nimport { GracefulError } from \"@webiny/project\";\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,13 +1,11 @@
|
|
|
1
1
|
import { definitions } from "@webiny/project/extensions/index.js";
|
|
2
2
|
import { definitions as index_js_definitions } from "@webiny/cli-core/extensions/index.js";
|
|
3
|
-
import { definitions as extensions_index_js_definitions } from "
|
|
4
|
-
import { definitions as external_pulumi_extensions_index_js_definitions } from "../../pulumi/extensions/index.js";
|
|
3
|
+
import { definitions as extensions_index_js_definitions } from "../../pulumi/extensions/index.js";
|
|
5
4
|
import { AutoInstall } from "./AutoInstall.js";
|
|
6
5
|
const definitions_definitions = [
|
|
7
6
|
...index_js_definitions,
|
|
8
7
|
...definitions,
|
|
9
8
|
...extensions_index_js_definitions,
|
|
10
|
-
...external_pulumi_extensions_index_js_definitions,
|
|
11
9
|
AutoInstall.def
|
|
12
10
|
];
|
|
13
11
|
const ProjectAws_definitions = definitions_definitions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/ProjectAws/definitions.js","sources":["../../../src/extensions/ProjectAws/definitions.ts"],"sourcesContent":["import {\n definitions as projectDefinitions,\n type ExtensionDefinitionModel\n} from \"@webiny/project/extensions/index.js\";\nimport { definitions as cliDefinitions } from \"@webiny/cli-core/extensions/index.js\";\nimport { definitions as
|
|
1
|
+
{"version":3,"file":"extensions/ProjectAws/definitions.js","sources":["../../../src/extensions/ProjectAws/definitions.ts"],"sourcesContent":["import {\n definitions as projectDefinitions,\n type ExtensionDefinitionModel\n} from \"@webiny/project/extensions/index.js\";\nimport { definitions as cliDefinitions } from \"@webiny/cli-core/extensions/index.js\";\nimport { definitions as projectAws } from \"~/pulumi/extensions/index.js\";\nimport { AutoInstall } from \"./AutoInstall.js\";\n\nconst definitions = [\n ...cliDefinitions,\n ...projectDefinitions,\n ...projectAws,\n AutoInstall.def\n] as unknown as ExtensionDefinitionModel<any>[];\n\nexport default definitions;\n"],"names":["definitions","cliDefinitions","projectDefinitions","projectAws","AutoInstall"],"mappings":";;;;AAQA,MAAMA,0BAAc;OACbC;OACAC;OACAC;IACHC,YAAY,GAAG;CAClB;AAED,+BAAeJ"}
|
package/extensions/ProjectAws.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
import { AdminAfterDeploy, AdminBeforeBuild, AdminBeforeWatch, AfterDeploy, ApiAfterDeploy, BeforeDeploy, DatabaseSetup, ExtensionDefinitions, Project,
|
|
2
|
+
import { AdminAfterDeploy, AdminBeforeBuild, AdminBeforeWatch, AfterDeploy, ApiAfterDeploy, ApiBeforeDeploy, ApiBeforeWatch, BeforeDeploy, CoreBeforeDeploy, DatabaseSetup, ExtensionDefinitions, Project, ProjectImplementation } from "@webiny/project/extensions/index.js";
|
|
3
3
|
import { createPathResolver } from "@webiny/project";
|
|
4
4
|
import { CliCommand } from "@webiny/cli-core/extensions/index.js";
|
|
5
5
|
import { CorePulumi } from "../pulumi/extensions/CorePulumi.js";
|
|
6
6
|
const p = createPathResolver(import.meta.dirname);
|
|
7
|
-
const ProjectAws = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Project, null), /*#__PURE__*/ react.createElement(
|
|
8
|
-
src: p("ProjectAws/BuildAppWorkspace.js")
|
|
9
|
-
}), /*#__PURE__*/ react.createElement(DatabaseSetup, {
|
|
7
|
+
const ProjectAws = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Project, null), /*#__PURE__*/ react.createElement(DatabaseSetup, {
|
|
10
8
|
setupName: "ddb"
|
|
11
9
|
}), /*#__PURE__*/ react.createElement(CorePulumi, {
|
|
12
10
|
src: p("ProjectAws/SetDatabaseSetupOutput.js")
|
|
@@ -37,6 +35,22 @@ const ProjectAws = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /
|
|
|
37
35
|
src: p("ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js")
|
|
38
36
|
}), /*#__PURE__*/ react.createElement(AdminBeforeWatch, {
|
|
39
37
|
src: p("ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js")
|
|
38
|
+
}), /*#__PURE__*/ react.createElement(ApiBeforeWatch, {
|
|
39
|
+
src: p("ProjectAws/EnsureApiDeployedBeforeWatch.js")
|
|
40
|
+
}), /*#__PURE__*/ react.createElement(AdminBeforeBuild, {
|
|
41
|
+
src: p("ProjectAws/EnsureApiDeployedBeforeAdminBuild.js")
|
|
42
|
+
}), /*#__PURE__*/ react.createElement(AdminBeforeWatch, {
|
|
43
|
+
src: p("ProjectAws/EnsureApiDeployedBeforeAdminWatch.js")
|
|
44
|
+
}), /*#__PURE__*/ react.createElement(ApiBeforeDeploy, {
|
|
45
|
+
src: p("ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js")
|
|
46
|
+
}), /*#__PURE__*/ react.createElement(CoreBeforeDeploy, {
|
|
47
|
+
src: p("ProjectAws/ValidateProductionPulumiState.js")
|
|
48
|
+
}), /*#__PURE__*/ react.createElement(BeforeDeploy, {
|
|
49
|
+
src: p("ProjectAws/EnsureTelemetryEnabledForOss.js")
|
|
50
|
+
}), /*#__PURE__*/ react.createElement(BeforeDeploy, {
|
|
51
|
+
src: p("ProjectAws/ValidateEncryptionBeforeDeploy.js")
|
|
52
|
+
}), /*#__PURE__*/ react.createElement(AdminAfterDeploy, {
|
|
53
|
+
src: p("ProjectAws/TelemetryNoLongerNewUser.js")
|
|
40
54
|
}), /*#__PURE__*/ react.createElement(BeforeDeploy, {
|
|
41
55
|
src: p("ProjectAws/EnsureAwsCredentialsBeforeDeploy.js")
|
|
42
56
|
}), /*#__PURE__*/ react.createElement(CliCommand, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/ProjectAws.js","sources":["../../src/extensions/ProjectAws.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n AdminAfterDeploy,\n AdminBeforeBuild,\n AdminBeforeWatch,\n AfterDeploy,\n ApiAfterDeploy,\n BeforeDeploy,\n DatabaseSetup,\n ExtensionDefinitions,\n Project,\n
|
|
1
|
+
{"version":3,"file":"extensions/ProjectAws.js","sources":["../../src/extensions/ProjectAws.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n AdminAfterDeploy,\n AdminBeforeBuild,\n AdminBeforeWatch,\n AfterDeploy,\n ApiAfterDeploy,\n ApiBeforeDeploy,\n ApiBeforeWatch,\n BeforeDeploy,\n CoreBeforeDeploy,\n DatabaseSetup,\n ExtensionDefinitions,\n Project,\n ProjectImplementation\n} from \"@webiny/project/extensions/index.js\";\nimport { createPathResolver } from \"@webiny/project\";\nimport { CliCommand } from \"@webiny/cli-core/extensions/index.js\";\nimport { CorePulumi } from \"~/pulumi/extensions/CorePulumi.js\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nexport const ProjectAws = () => {\n return (\n <>\n <Project />\n\n {/* Database Setup - default to DynamoDB only */}\n <DatabaseSetup setupName=\"ddb\" />\n\n {/* Set database setup output value in Core stack */}\n <CorePulumi src={p(\"ProjectAws/SetDatabaseSetupOutput.js\")} />\n\n {/* Stack Output Services */}\n <ProjectImplementation src={p(\"ProjectAws/CoreStackOutputService.js\")} singleton />\n <ProjectImplementation src={p(\"ProjectAws/ApiStackOutputService.js\")} singleton />\n <ProjectImplementation src={p(\"ProjectAws/AdminStackOutputService.js\")} singleton />\n\n <ProjectImplementation src={p(\"../features/InvokeLambdaFunction.js\")} singleton />\n <ProjectImplementation src={p(\"../features/ApiGqlClient.js\")} singleton />\n\n <AdminAfterDeploy src={p(\"ProjectAws/UploadAdminAppToS3.js\")} />\n\n <ApiAfterDeploy src={p(\"ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js\")} />\n <ExtensionDefinitions src={p(\"definitions.js\")} />\n <ExtensionDefinitions src={p(\"ProjectAws/definitions.js\")} />\n\n {/* Admin env vars */}\n <AdminBeforeBuild src={p(\"ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js\")} />\n <AdminBeforeWatch src={p(\"ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js\")} />\n\n {/* Deployment gates — AWS-only (there is no Pulumi stack output to check off-AWS) */}\n <ApiBeforeWatch src={p(\"ProjectAws/EnsureApiDeployedBeforeWatch.js\")} />\n <AdminBeforeBuild src={p(\"ProjectAws/EnsureApiDeployedBeforeAdminBuild.js\")} />\n <AdminBeforeWatch src={p(\"ProjectAws/EnsureApiDeployedBeforeAdminWatch.js\")} />\n <ApiBeforeDeploy src={p(\"ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js\")} />\n <CoreBeforeDeploy src={p(\"ProjectAws/ValidateProductionPulumiState.js\")} />\n\n {/* Deploy-time hooks — standalone hosting type has no deploy command, so these are AWS-only */}\n <BeforeDeploy src={p(\"ProjectAws/EnsureTelemetryEnabledForOss.js\")} />\n <BeforeDeploy src={p(\"ProjectAws/ValidateEncryptionBeforeDeploy.js\")} />\n <AdminAfterDeploy src={p(\"ProjectAws/TelemetryNoLongerNewUser.js\")} />\n\n {/* AWS credentials check */}\n <BeforeDeploy src={p(\"ProjectAws/EnsureAwsCredentialsBeforeDeploy.js\")} />\n\n {/* Blue-green */}\n <CliCommand src={p(\"ProjectAws/BlueGreenDeployments/SetPrimaryVariantCliCommand.js\")} />\n <BeforeDeploy src={p(\"ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js\")} />\n <AfterDeploy\n src={p(\"ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js\")}\n />\n </>\n );\n};\n"],"names":["p","createPathResolver","ProjectAws","Project","DatabaseSetup","CorePulumi","ProjectImplementation","AdminAfterDeploy","ApiAfterDeploy","ExtensionDefinitions","AdminBeforeBuild","AdminBeforeWatch","ApiBeforeWatch","ApiBeforeDeploy","CoreBeforeDeploy","BeforeDeploy","CliCommand","AfterDeploy"],"mappings":";;;;;AAoBA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO;AAEzC,MAAMC,aAAa,IACf,WAAP,GACI,wDACI,oBAACC,SAAOA,OAAAA,WAAAA,GAGR,oBAACC,eAAaA;QAAC,WAAU;sBAGzB,oBAACC,YAAUA;QAAC,KAAKL,EAAE;sBAGnB,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAyC;sBACvE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAwC;sBACtE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAA0C;sBAExE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAwC;sBACtE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAgC;sBAE9D,oBAACO,kBAAgBA;QAAC,KAAKP,EAAE;sBAEzB,oBAACQ,gBAAcA;QAAC,KAAKR,EAAE;sBACvB,oBAACS,sBAAoBA;QAAC,KAAKT,EAAE;sBAC7B,oBAACS,sBAAoBA;QAAC,KAAKT,EAAE;sBAG7B,oBAACU,kBAAgBA;QAAC,KAAKV,EAAE;sBACzB,oBAACW,kBAAgBA;QAAC,KAAKX,EAAE;sBAGzB,oBAACY,gBAAcA;QAAC,KAAKZ,EAAE;sBACvB,oBAACU,kBAAgBA;QAAC,KAAKV,EAAE;sBACzB,oBAACW,kBAAgBA;QAAC,KAAKX,EAAE;sBACzB,oBAACa,iBAAeA;QAAC,KAAKb,EAAE;sBACxB,oBAACc,kBAAgBA;QAAC,KAAKd,EAAE;sBAGzB,oBAACe,cAAYA;QAAC,KAAKf,EAAE;sBACrB,oBAACe,cAAYA;QAAC,KAAKf,EAAE;sBACrB,oBAACO,kBAAgBA;QAAC,KAAKP,EAAE;sBAGzB,oBAACe,cAAYA;QAAC,KAAKf,EAAE;sBAGrB,oBAACgB,YAAUA;QAAC,KAAKhB,EAAE;sBACnB,oBAACe,cAAYA;QAAC,KAAKf,EAAE;sBACrB,oBAACiB,aAAWA;QACR,KAAKjB,EAAE"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { GetProjectConfigService } from "@webiny/project/abstractions/index.js";
|
|
2
2
|
import { ApiPulumi } from "../abstractions/features/pulumi/index.js";
|
|
3
3
|
import { ApiRoute } from "./ApiRoute.js";
|
|
4
|
-
import {
|
|
5
|
-
function deriveRouteName(routePath, method) {
|
|
6
|
-
const pathPart = routePath.replace(/^\//, "").replace(/\{[^}]*\}/g, "").replace(/\/+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
|
|
7
|
-
return `${pathPart}-${method.toLowerCase()}`;
|
|
8
|
-
}
|
|
4
|
+
import { deriveRouteName, toApiGatewayPath } from "./routePath.js";
|
|
9
5
|
class RegisterRoutesPulumiImpl {
|
|
10
6
|
constructor(getProjectConfigService){
|
|
11
7
|
this.getProjectConfigService = getProjectConfigService;
|
|
@@ -14,13 +10,14 @@ class RegisterRoutesPulumiImpl {
|
|
|
14
10
|
const projectConfig = await this.getProjectConfigService.execute();
|
|
15
11
|
const routeExtensions = projectConfig.extensionsByType(ApiRoute);
|
|
16
12
|
if (!routeExtensions.length) return;
|
|
13
|
+
const { ApiGraphql } = await import("../pulumi/apps/api/ApiGraphql.js");
|
|
17
14
|
const graphqlModule = app.getModule(ApiGraphql);
|
|
18
15
|
for (const ext of routeExtensions){
|
|
19
16
|
const { path: routePath, method, routeName } = ext.params;
|
|
20
17
|
const name = routeName ?? deriveRouteName(routePath, method);
|
|
21
18
|
graphqlModule.addRoute({
|
|
22
19
|
name,
|
|
23
|
-
path: routePath,
|
|
20
|
+
path: toApiGatewayPath(routePath),
|
|
24
21
|
method
|
|
25
22
|
});
|
|
26
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/RegisterRoutesPulumi.js","sources":["../../src/extensions/RegisterRoutesPulumi.ts"],"sourcesContent":["import { GetProjectConfigService } from \"@webiny/project/abstractions/index.js\";\nimport { ApiPulumi } from \"~/abstractions/features/pulumi/index.js\";\nimport type { ApiPulumiApp } from \"~/pulumi/apps/api/createApiPulumiApp.js\";\nimport { ApiRoute } from \"./ApiRoute.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"extensions/RegisterRoutesPulumi.js","sources":["../../src/extensions/RegisterRoutesPulumi.ts"],"sourcesContent":["import { GetProjectConfigService } from \"@webiny/project/abstractions/index.js\";\nimport { ApiPulumi } from \"~/abstractions/features/pulumi/index.js\";\nimport type { ApiPulumiApp } from \"~/pulumi/apps/api/createApiPulumiApp.js\";\nimport { ApiRoute } from \"./ApiRoute.js\";\nimport { deriveRouteName, toApiGatewayPath } from \"./routePath.js\";\n\nclass RegisterRoutesPulumiImpl implements ApiPulumi.Interface {\n constructor(private getProjectConfigService: GetProjectConfigService.Interface) {}\n\n async execute(app: ApiPulumiApp): Promise<void> {\n // No tags filter — finds ApiRestRoute extensions regardless of their runtimeContext.\n const projectConfig = await this.getProjectConfigService.execute();\n const routeExtensions = projectConfig.extensionsByType(ApiRoute);\n\n if (!routeExtensions.length) {\n return;\n }\n\n // Imported here rather than at the top of the file. Every CLI command imports this extension\n // when the project SDK registers it, even `webiny --help`, and `ApiGraphql` pulls in all of\n // Pulumi and the AWS SDK: about 2,700 modules. By the time `execute` runs we are inside a\n // Pulumi program that has already loaded all of that, so importing it here costs nothing.\n const { ApiGraphql } = await import(\"~/pulumi/apps/api/ApiGraphql.js\");\n\n const graphqlModule = app.getModule(ApiGraphql);\n\n for (const ext of routeExtensions) {\n const { path: routePath, method, routeName } = ext.params;\n const name = routeName ?? deriveRouteName(routePath, method);\n graphqlModule.addRoute({\n name,\n // The prop accepts `:id` too; API Gateway only understands `{id}`.\n path: toApiGatewayPath(routePath) as `/${string}`,\n method\n });\n }\n }\n}\n\nexport const RegisterRoutesPulumi = ApiPulumi.createImplementation({\n implementation: RegisterRoutesPulumiImpl,\n dependencies: [GetProjectConfigService]\n});\n"],"names":["RegisterRoutesPulumiImpl","getProjectConfigService","app","projectConfig","routeExtensions","ApiRoute","ApiGraphql","graphqlModule","ext","routePath","method","routeName","name","deriveRouteName","toApiGatewayPath","RegisterRoutesPulumi","ApiPulumi","GetProjectConfigService"],"mappings":";;;;AAMA,MAAMA;IACF,YAAoBC,uBAA0D,CAAE;aAA5DA,uBAAuB,GAAvBA;IAA6D;IAEjF,MAAM,QAAQC,GAAiB,EAAiB;QAE5C,MAAMC,gBAAgB,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO;QAChE,MAAMC,kBAAkBD,cAAc,gBAAgB,CAACE;QAEvD,IAAI,CAACD,gBAAgB,MAAM,EACvB;QAOJ,MAAM,EAAEE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC;QAEpC,MAAMC,gBAAgBL,IAAI,SAAS,CAACI;QAEpC,KAAK,MAAME,OAAOJ,gBAAiB;YAC/B,MAAM,EAAE,MAAMK,SAAS,EAAEC,MAAM,EAAEC,SAAS,EAAE,GAAGH,IAAI,MAAM;YACzD,MAAMI,OAAOD,aAAaE,gBAAgBJ,WAAWC;YACrDH,cAAc,QAAQ,CAAC;gBACnBK;gBAEA,MAAME,iBAAiBL;gBACvBC;YACJ;QACJ;IACJ;AACJ;AAEO,MAAMK,uBAAuBC,UAAU,oBAAoB,CAAC;IAC/D,gBAAgBhB;IAChB,cAAc;QAACiB;KAAwB;AAC3C"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { ApiLambdaFunction } from "./ApiLambdaFunction.js";
|
|
2
2
|
import { ApiRoute } from "./ApiRoute.js";
|
|
3
3
|
import { OpenSearch } from "./OpenSearch.js";
|
|
4
|
-
import { Encryption } from "./Encryption.js";
|
|
5
4
|
import { Smtp } from "./Mailer/Smtp.js";
|
|
6
5
|
const definitions = [
|
|
7
6
|
ApiLambdaFunction.def,
|
|
8
7
|
ApiRoute.def,
|
|
9
8
|
OpenSearch.def,
|
|
10
|
-
Encryption.def,
|
|
11
9
|
Smtp.def
|
|
12
10
|
];
|
|
13
11
|
const extensions_definitions = definitions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensions/definitions.js","sources":["../../src/extensions/definitions.ts"],"sourcesContent":["import { ApiLambdaFunction } from \"./ApiLambdaFunction.js\";\nimport { ApiRoute } from \"./ApiRoute.js\";\nimport { OpenSearch } from \"./OpenSearch.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"extensions/definitions.js","sources":["../../src/extensions/definitions.ts"],"sourcesContent":["import { ApiLambdaFunction } from \"./ApiLambdaFunction.js\";\nimport { ApiRoute } from \"./ApiRoute.js\";\nimport { OpenSearch } from \"./OpenSearch.js\";\nimport { Smtp as MailerSmtp } from \"./Mailer/Smtp.js\";\nimport { type ExtensionDefinitionModel } from \"@webiny/project/defineExtension\";\n\nconst definitions = [\n ApiLambdaFunction.def,\n ApiRoute.def,\n OpenSearch.def,\n MailerSmtp.def\n] as unknown as ExtensionDefinitionModel<any>[];\n\nexport default definitions;\n"],"names":["definitions","ApiLambdaFunction","ApiRoute","OpenSearch","MailerSmtp"],"mappings":";;;;AAMA,MAAMA,cAAc;IAChBC,kBAAkB,GAAG;IACrBC,SAAS,GAAG;IACZC,WAAW,GAAG;IACdC,KAAAA,GAAc;CACjB;AAED,+BAAeJ"}
|
package/extensions/index.d.ts
CHANGED
package/extensions/index.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `path` prop on `<Api.Route>` feeds two consumers that spell path parameters differently:
|
|
3
|
+
* API Gateway wants `{orderId}`, the DI `HttpRouter` wants `:orderId`. Rather than pick a winner and
|
|
4
|
+
* break whichever projects already used the other, accept both and convert per consumer.
|
|
5
|
+
*
|
|
6
|
+
* Wildcards are left alone. `HttpRouter` matches a trailing `/*`, API Gateway spells the same thing
|
|
7
|
+
* `{proxy+}`, and translating between them changes what the route captures — so a wildcard route
|
|
8
|
+
* has to be written for the target it's aimed at.
|
|
9
|
+
*/
|
|
10
|
+
/** `/orders/:orderId` → `/orders/{orderId}`. Already-braced segments pass through. */
|
|
11
|
+
export declare function toApiGatewayPath(path: string): string;
|
|
12
|
+
/** `/orders/{orderId}` → `/orders/:orderId`. Already-colon segments pass through. */
|
|
13
|
+
export declare function toRouterPath(path: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* `/asd/{id}/xs` + POST → `asd-xs-post`. Handles either parameter syntax.
|
|
16
|
+
*
|
|
17
|
+
* Used for BOTH the Pulumi resource name and the route's DI name, so the name a decorator matches
|
|
18
|
+
* on is the same one that shows up in infrastructure.
|
|
19
|
+
*/
|
|
20
|
+
export declare function deriveRouteName(routePath: string, method: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function toApiGatewayPath(path) {
|
|
2
|
+
return path.replace(/(^|\/):([^/]+)/g, (_match, prefix, name)=>`${prefix}{${name}}`);
|
|
3
|
+
}
|
|
4
|
+
function toRouterPath(path) {
|
|
5
|
+
return path.replace(/\{([^}]+)\}/g, (_match, name)=>`:${name}`);
|
|
6
|
+
}
|
|
7
|
+
function deriveRouteName(routePath, method) {
|
|
8
|
+
const pathPart = routePath.replace(/^\//, "").replace(/\{[^}]*\}/g, "").replace(/(^|\/):[^/]+/g, "$1").replace(/\/+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
|
|
9
|
+
return `${pathPart}-${method.toLowerCase()}`;
|
|
10
|
+
}
|
|
11
|
+
export { deriveRouteName, toApiGatewayPath, toRouterPath };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=routePath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions/routePath.js","sources":["../../src/extensions/routePath.ts"],"sourcesContent":["/**\n * The `path` prop on `<Api.Route>` feeds two consumers that spell path parameters differently:\n * API Gateway wants `{orderId}`, the DI `HttpRouter` wants `:orderId`. Rather than pick a winner and\n * break whichever projects already used the other, accept both and convert per consumer.\n *\n * Wildcards are left alone. `HttpRouter` matches a trailing `/*`, API Gateway spells the same thing\n * `{proxy+}`, and translating between them changes what the route captures — so a wildcard route\n * has to be written for the target it's aimed at.\n */\n\n/** `/orders/:orderId` → `/orders/{orderId}`. Already-braced segments pass through. */\nexport function toApiGatewayPath(path: string): string {\n return path.replace(/(^|\\/):([^/]+)/g, (_match, prefix: string, name: string) => {\n return `${prefix}{${name}}`;\n });\n}\n\n/** `/orders/{orderId}` → `/orders/:orderId`. Already-colon segments pass through. */\nexport function toRouterPath(path: string): string {\n return path.replace(/\\{([^}]+)\\}/g, (_match, name: string) => {\n return `:${name}`;\n });\n}\n\n/**\n * `/asd/{id}/xs` + POST → `asd-xs-post`. Handles either parameter syntax.\n *\n * Used for BOTH the Pulumi resource name and the route's DI name, so the name a decorator matches\n * on is the same one that shows up in infrastructure.\n */\nexport function deriveRouteName(routePath: string, method: string): string {\n // /asd/{id}/xs + POST → asd-xs-post. Strips parameters in either syntax.\n const pathPart = routePath\n .replace(/^\\//, \"\")\n .replace(/\\{[^}]*\\}/g, \"\")\n .replace(/(^|\\/):[^/]+/g, \"$1\")\n .replace(/\\/+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .toLowerCase();\n\n return `${pathPart}-${method.toLowerCase()}`;\n}\n"],"names":["toApiGatewayPath","path","_match","prefix","name","toRouterPath","deriveRouteName","routePath","method","pathPart"],"mappings":"AAWO,SAASA,iBAAiBC,IAAY;IACzC,OAAOA,KAAK,OAAO,CAAC,mBAAmB,CAACC,QAAQC,QAAgBC,OACrD,GAAGD,OAAO,CAAC,EAAEC,KAAK,CAAC,CAAC;AAEnC;AAGO,SAASC,aAAaJ,IAAY;IACrC,OAAOA,KAAK,OAAO,CAAC,gBAAgB,CAACC,QAAQE,OAClC,CAAC,CAAC,EAAEA,MAAM;AAEzB;AAQO,SAASE,gBAAgBC,SAAiB,EAAEC,MAAc;IAE7D,MAAMC,WAAWF,UACZ,OAAO,CAAC,OAAO,IACf,OAAO,CAAC,cAAc,IACtB,OAAO,CAAC,iBAAiB,MACzB,OAAO,CAAC,QAAQ,KAChB,OAAO,CAAC,YAAY,IACpB,WAAW;IAEhB,OAAO,GAAGE,SAAS,CAAC,EAAED,OAAO,WAAW,IAAI;AAChD"}
|