@webiny/pulumi-aws 5.25.0 → 5.26.0-beta.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/apps/admin/AdminApp.d.ts +14 -0
- package/apps/admin/AdminApp.js +134 -0
- package/apps/admin/AdminApp.js.map +1 -0
- package/apps/admin/AdminUpload.d.ts +6 -0
- package/apps/admin/AdminUpload.js +50 -0
- package/apps/admin/AdminUpload.js.map +1 -0
- package/apps/api/ApiApp.d.ts +66 -0
- package/apps/api/ApiApp.js +223 -0
- package/apps/api/ApiApp.js.map +1 -0
- package/apps/api/ApiApwScheduler.d.ts +23 -0
- package/apps/api/ApiApwScheduler.js +240 -0
- package/apps/api/ApiApwScheduler.js.map +1 -0
- package/apps/api/ApiCloudfront.d.ts +4 -0
- package/apps/api/ApiCloudfront.js +103 -0
- package/apps/api/ApiCloudfront.js.map +1 -0
- package/apps/api/ApiFileManager.d.ts +18 -0
- package/apps/api/ApiFileManager.js +168 -0
- package/apps/api/ApiFileManager.js.map +1 -0
- package/apps/api/ApiGateway.d.ts +19 -0
- package/apps/api/ApiGateway.js +90 -0
- package/apps/api/ApiGateway.js.map +1 -0
- package/apps/api/ApiGraphql.d.ts +27 -0
- package/apps/api/ApiGraphql.js +128 -0
- package/apps/api/ApiGraphql.js.map +1 -0
- package/apps/api/ApiHeadlessCMS.d.ts +18 -0
- package/apps/api/ApiHeadlessCMS.js +90 -0
- package/apps/api/ApiHeadlessCMS.js.map +1 -0
- package/apps/api/ApiLambdaUtils.d.ts +11 -0
- package/apps/api/ApiLambdaUtils.js +45 -0
- package/apps/api/ApiLambdaUtils.js.map +1 -0
- package/apps/api/ApiPageBuilder.d.ts +40 -0
- package/apps/api/ApiPageBuilder.js +289 -0
- package/apps/api/ApiPageBuilder.js.map +1 -0
- package/apps/api/ApiPrerendering.d.ts +24 -0
- package/apps/api/ApiPrerendering.js +200 -0
- package/apps/api/ApiPrerendering.js.map +1 -0
- package/apps/api/ApiVpc.d.ts +10 -0
- package/apps/api/ApiVpc.js +129 -0
- package/apps/api/ApiVpc.js.map +1 -0
- package/apps/api/index.d.ts +8 -0
- package/apps/api/index.js +109 -0
- package/apps/api/index.js.map +1 -0
- package/apps/awsUtils.d.ts +3 -0
- package/apps/awsUtils.js +25 -0
- package/apps/awsUtils.js.map +1 -0
- package/apps/createAppBucket.d.ts +13 -0
- package/apps/createAppBucket.js +107 -0
- package/apps/createAppBucket.js.map +1 -0
- package/apps/customDomain.d.ts +9 -0
- package/apps/customDomain.js +14 -0
- package/apps/customDomain.js.map +1 -0
- package/apps/getStorageOutput.d.ts +13 -0
- package/apps/getStorageOutput.js +29 -0
- package/apps/getStorageOutput.js.map +1 -0
- package/apps/index.d.ts +5 -0
- package/apps/index.js +72 -0
- package/apps/index.js.map +1 -0
- package/apps/storage/StorageApp.d.ts +16 -0
- package/apps/storage/StorageApp.js +90 -0
- package/apps/storage/StorageApp.js.map +1 -0
- package/apps/storage/StorageCognito.d.ts +11 -0
- package/apps/storage/StorageCognito.js +102 -0
- package/apps/storage/StorageCognito.js.map +1 -0
- package/apps/storage/StorageDynamo.d.ts +6 -0
- package/apps/storage/StorageDynamo.js +53 -0
- package/apps/storage/StorageDynamo.js.map +1 -0
- package/apps/storage/StorageFileManager.d.ts +6 -0
- package/apps/storage/StorageFileManager.js +40 -0
- package/apps/storage/StorageFileManager.js.map +1 -0
- package/apps/storage/index.d.ts +4 -0
- package/apps/storage/index.js +57 -0
- package/apps/storage/index.js.map +1 -0
- package/apps/website/WebsiteApp.d.ts +22 -0
- package/apps/website/WebsiteApp.js +206 -0
- package/apps/website/WebsiteApp.js.map +1 -0
- package/apps/website/WebsiteHookRender.d.ts +1 -0
- package/apps/website/WebsiteHookRender.js +65 -0
- package/apps/website/WebsiteHookRender.js.map +1 -0
- package/apps/website/WebsiteHookUpdatePbSettings.d.ts +5 -0
- package/apps/website/WebsiteHookUpdatePbSettings.js +80 -0
- package/apps/website/WebsiteHookUpdatePbSettings.js.map +1 -0
- package/apps/website/WebsiteHookUpload.d.ts +1 -0
- package/apps/website/WebsiteHookUpload.js +65 -0
- package/apps/website/WebsiteHookUpload.js.map +1 -0
- package/components/tenantRouter/functions/origin/request.js +54 -8
- package/components/tenantRouter/functions/origin/request.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +18 -1
- package/index.js.map +1 -1
- package/package.json +10 -6
- package/types.d.ts +2 -0
- package/types.js +5 -0
- package/types.js.map +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as aws from "@pulumi/aws";
|
|
2
|
+
import { ApplicationContext, ApplicationConfig } from "@webiny/pulumi-sdk";
|
|
3
|
+
import { CustomDomainParams } from "../customDomain";
|
|
4
|
+
export interface AdminAppConfig {
|
|
5
|
+
/** Custom domain configuration */
|
|
6
|
+
domain?(ctx: ApplicationContext): CustomDomainParams;
|
|
7
|
+
}
|
|
8
|
+
export declare const AdminApp: new (ctx: ApplicationContext) => import("@webiny/pulumi-sdk").PulumiApp<AdminAppConfig> & {
|
|
9
|
+
cloudfront: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.cloudfront.Distribution>;
|
|
10
|
+
bucket: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.s3.Bucket>;
|
|
11
|
+
origin: aws.types.input.cloudfront.DistributionOrigin;
|
|
12
|
+
};
|
|
13
|
+
export declare type AdminApp = InstanceType<typeof AdminApp>;
|
|
14
|
+
export declare function createAdminApp(config?: AdminAppConfig & ApplicationConfig<AdminApp>): import("@webiny/pulumi-sdk").ApplicationBuilderGeneric;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.AdminApp = void 0;
|
|
9
|
+
exports.createAdminApp = createAdminApp;
|
|
10
|
+
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
var aws = _interopRequireWildcard(require("@pulumi/aws"));
|
|
14
|
+
|
|
15
|
+
var _pulumiSdk = require("@webiny/pulumi-sdk");
|
|
16
|
+
|
|
17
|
+
var _createAppBucket = require("../createAppBucket");
|
|
18
|
+
|
|
19
|
+
var _customDomain = require("../customDomain");
|
|
20
|
+
|
|
21
|
+
var _AdminUpload = require("./AdminUpload");
|
|
22
|
+
|
|
23
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
|
+
|
|
25
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
|
+
|
|
27
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
28
|
+
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
30
|
+
|
|
31
|
+
const AdminApp = (0, _pulumiSdk.defineApp)({
|
|
32
|
+
name: "Admin",
|
|
33
|
+
|
|
34
|
+
config(app, config) {
|
|
35
|
+
var _config$domain;
|
|
36
|
+
|
|
37
|
+
const bucket = (0, _createAppBucket.createPublicAppBucket)(app, "admin-app");
|
|
38
|
+
const cloudfront = app.addResource(aws.cloudfront.Distribution, {
|
|
39
|
+
name: "admin-app-cdn",
|
|
40
|
+
config: {
|
|
41
|
+
enabled: true,
|
|
42
|
+
waitForDeployment: false,
|
|
43
|
+
origins: [bucket.origin],
|
|
44
|
+
defaultRootObject: "index.html",
|
|
45
|
+
defaultCacheBehavior: {
|
|
46
|
+
compress: true,
|
|
47
|
+
targetOriginId: bucket.origin.originId,
|
|
48
|
+
viewerProtocolPolicy: "redirect-to-https",
|
|
49
|
+
allowedMethods: ["GET", "HEAD", "OPTIONS"],
|
|
50
|
+
cachedMethods: ["GET", "HEAD", "OPTIONS"],
|
|
51
|
+
forwardedValues: {
|
|
52
|
+
cookies: {
|
|
53
|
+
forward: "none"
|
|
54
|
+
},
|
|
55
|
+
queryString: false
|
|
56
|
+
},
|
|
57
|
+
// MinTTL <= DefaultTTL <= MaxTTL
|
|
58
|
+
minTtl: 0,
|
|
59
|
+
defaultTtl: 600,
|
|
60
|
+
maxTtl: 600
|
|
61
|
+
},
|
|
62
|
+
priceClass: "PriceClass_100",
|
|
63
|
+
customErrorResponses: [{
|
|
64
|
+
errorCode: 404,
|
|
65
|
+
responseCode: 404,
|
|
66
|
+
responsePagePath: "/index.html"
|
|
67
|
+
}],
|
|
68
|
+
restrictions: {
|
|
69
|
+
geoRestriction: {
|
|
70
|
+
restrictionType: "none"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
viewerCertificate: {
|
|
74
|
+
cloudfrontDefaultCertificate: true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const domain = (_config$domain = config.domain) === null || _config$domain === void 0 ? void 0 : _config$domain.call(config, app.ctx);
|
|
79
|
+
|
|
80
|
+
if (domain) {
|
|
81
|
+
(0, _customDomain.applyCustomDomain)(cloudfront, domain);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
app.addOutputs({
|
|
85
|
+
appStorage: bucket.bucket.output.id,
|
|
86
|
+
appDomain: cloudfront.output.domainName,
|
|
87
|
+
appUrl: cloudfront.output.domainName.apply(value => `https://${value}`)
|
|
88
|
+
});
|
|
89
|
+
app.onAfterDeploy(async ({
|
|
90
|
+
outputs
|
|
91
|
+
}) => {
|
|
92
|
+
await (0, _AdminUpload.adminUpload)({
|
|
93
|
+
appDir: app.ctx.appDir,
|
|
94
|
+
bucket: outputs["appStorage"]
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
return _objectSpread(_objectSpread({}, bucket), {}, {
|
|
98
|
+
cloudfront
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
});
|
|
103
|
+
exports.AdminApp = AdminApp;
|
|
104
|
+
|
|
105
|
+
function createAdminApp(config) {
|
|
106
|
+
return (0, _pulumiSdk.createGenericApplication)({
|
|
107
|
+
id: "admin",
|
|
108
|
+
name: "admin",
|
|
109
|
+
description: "Your project's admin area.",
|
|
110
|
+
cli: {
|
|
111
|
+
// Default args for the "yarn webiny watch ..." command (we don't need deploy option while developing).
|
|
112
|
+
watch: {
|
|
113
|
+
deploy: false
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
async app(ctx) {
|
|
118
|
+
var _config$config;
|
|
119
|
+
|
|
120
|
+
// Create the app instance.
|
|
121
|
+
const app = new AdminApp(ctx); // Run the default application setup.
|
|
122
|
+
|
|
123
|
+
await app.setup(config || {}); // Run the custom user config.
|
|
124
|
+
|
|
125
|
+
await (config === null || config === void 0 ? void 0 : (_config$config = config.config) === null || _config$config === void 0 ? void 0 : _config$config.call(config, app, ctx));
|
|
126
|
+
return app;
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
onBeforeBuild: config === null || config === void 0 ? void 0 : config.onBeforeBuild,
|
|
130
|
+
onAfterBuild: config === null || config === void 0 ? void 0 : config.onAfterBuild,
|
|
131
|
+
onBeforeDeploy: config === null || config === void 0 ? void 0 : config.onBeforeDeploy,
|
|
132
|
+
onAfterDeploy: config === null || config === void 0 ? void 0 : config.onAfterDeploy
|
|
133
|
+
});
|
|
134
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["AdminApp.ts"],"names":["AdminApp","name","config","app","bucket","cloudfront","addResource","aws","Distribution","enabled","waitForDeployment","origins","origin","defaultRootObject","defaultCacheBehavior","compress","targetOriginId","originId","viewerProtocolPolicy","allowedMethods","cachedMethods","forwardedValues","cookies","forward","queryString","minTtl","defaultTtl","maxTtl","priceClass","customErrorResponses","errorCode","responseCode","responsePagePath","restrictions","geoRestriction","restrictionType","viewerCertificate","cloudfrontDefaultCertificate","domain","ctx","addOutputs","appStorage","output","id","appDomain","domainName","appUrl","apply","value","onAfterDeploy","outputs","appDir","createAdminApp","description","cli","watch","deploy","setup","onBeforeBuild","onAfterBuild","onBeforeDeploy"],"mappings":";;;;;;;;;;;;AAAA;;AAEA;;AAOA;;AACA;;AACA;;;;;;;;;;AAOO,MAAMA,QAAQ,GAAG,0BAAU;AAC9BC,EAAAA,IAAI,EAAE,OADwB;;AAE9BC,EAAAA,MAAM,CAACC,GAAD,EAAMD,MAAN,EAA8B;AAAA;;AAChC,UAAME,MAAM,GAAG,4CAAsBD,GAAtB,EAA2B,WAA3B,CAAf;AAEA,UAAME,UAAU,GAAG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,IAAI,EAApB,CAAN,CAJW,CAKX;;AACA,aAAMA,MAAN,aAAMA,MAAN,yCAAMA,MAAM,CAAEA,MAAd,mDAAM,oBAAAA,MAAM,EAAWC,GAAX,EAAgBoC,GAAhB,CAAZ;AACA,aAAOpC,GAAP;AACH,KAlB2B;;AAmB5BuD,IAAAA,aAAa,EAAExD,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEwD,aAnBK;AAoB5BC,IAAAA,YAAY,EAAEzD,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEyD,YApBM;AAqB5BC,IAAAA,cAAc,EAAE1D,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAE0D,cArBI;AAsB5BX,IAAAA,aAAa,EAAE/C,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAE+C;AAtBK,GAAzB,CAAP;AAwBH","sourcesContent":["import * as aws from \"@pulumi/aws\";\n\nimport {\n defineApp,\n createGenericApplication,\n ApplicationContext,\n ApplicationConfig\n} from \"@webiny/pulumi-sdk\";\n\nimport { createPublicAppBucket } from \"../createAppBucket\";\nimport { applyCustomDomain, CustomDomainParams } from \"../customDomain\";\nimport { adminUpload } from \"./AdminUpload\";\n\nexport interface AdminAppConfig {\n /** Custom domain configuration */\n domain?(ctx: ApplicationContext): CustomDomainParams;\n}\n\nexport const AdminApp = defineApp({\n name: \"Admin\",\n config(app, config: AdminAppConfig) {\n const bucket = createPublicAppBucket(app, \"admin-app\");\n\n const cloudfront = app.addResource(aws.cloudfront.Distribution, {\n name: \"admin-app-cdn\",\n config: {\n enabled: true,\n waitForDeployment: false,\n origins: [bucket.origin],\n defaultRootObject: \"index.html\",\n defaultCacheBehavior: {\n compress: true,\n targetOriginId: bucket.origin.originId,\n viewerProtocolPolicy: \"redirect-to-https\",\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: { forward: \"none\" },\n queryString: false\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 600,\n maxTtl: 600\n },\n priceClass: \"PriceClass_100\",\n customErrorResponses: [\n { errorCode: 404, responseCode: 404, responsePagePath: \"/index.html\" }\n ],\n restrictions: {\n geoRestriction: {\n restrictionType: \"none\"\n }\n },\n viewerCertificate: {\n cloudfrontDefaultCertificate: true\n }\n }\n });\n\n const domain = config.domain?.(app.ctx);\n if (domain) {\n applyCustomDomain(cloudfront, domain);\n }\n\n app.addOutputs({\n appStorage: bucket.bucket.output.id,\n appDomain: cloudfront.output.domainName,\n appUrl: cloudfront.output.domainName.apply(value => `https://${value}`)\n });\n\n app.onAfterDeploy(async ({ outputs }) => {\n await adminUpload({\n appDir: app.ctx.appDir,\n bucket: outputs[\"appStorage\"]\n });\n });\n\n return {\n ...bucket,\n cloudfront\n };\n }\n});\n\nexport type AdminApp = InstanceType<typeof AdminApp>;\n\nexport function createAdminApp(config?: AdminAppConfig & ApplicationConfig<AdminApp>) {\n return createGenericApplication({\n id: \"admin\",\n name: \"admin\",\n description: \"Your project's admin area.\",\n cli: {\n // Default args for the \"yarn webiny watch ...\" command (we don't need deploy option while developing).\n watch: {\n deploy: false\n }\n },\n async app(ctx) {\n // Create the app instance.\n const app = new AdminApp(ctx);\n // Run the default application setup.\n await app.setup(config || {});\n // Run the custom user config.\n await config?.config?.(app, ctx);\n return app;\n },\n onBeforeBuild: config?.onBeforeBuild,\n onAfterBuild: config?.onAfterBuild,\n onBeforeDeploy: config?.onBeforeDeploy,\n onAfterDeploy: config?.onAfterDeploy\n });\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.adminUpload = adminUpload;
|
|
9
|
+
|
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
|
11
|
+
|
|
12
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
13
|
+
|
|
14
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
15
|
+
|
|
16
|
+
var _uploadFolderToS = _interopRequireDefault(require("@webiny/cli-plugin-deploy-pulumi/utils/aws/uploadFolderToS3"));
|
|
17
|
+
|
|
18
|
+
async function adminUpload(params) {
|
|
19
|
+
console.info("Uploading React application...");
|
|
20
|
+
|
|
21
|
+
const buildFolderPath = _path.default.join(params.appDir, "code", "build");
|
|
22
|
+
|
|
23
|
+
if (!_fs.default.existsSync(buildFolderPath)) {
|
|
24
|
+
throw new Error("Cannot continue, build folder not found.");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const start = new Date().getTime();
|
|
28
|
+
await (0, _uploadFolderToS.default)({
|
|
29
|
+
path: buildFolderPath,
|
|
30
|
+
bucket: params.bucket,
|
|
31
|
+
acl: "public-read",
|
|
32
|
+
|
|
33
|
+
onFileUploadSuccess(args) {
|
|
34
|
+
// TODO console.success(args.paths.relative);
|
|
35
|
+
console.log(`Uploaded ${_chalk.default.green(args.paths.relative)}`);
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
onFileUploadError(args) {
|
|
39
|
+
console.error("Failed to upload " + _chalk.default.red(args.paths.relative));
|
|
40
|
+
console.log(args.error);
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
onFileUploadSkip(args) {
|
|
44
|
+
console.info(`Skipping ${_chalk.default.blue(args.paths.relative)}, already exists.`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
});
|
|
48
|
+
const duration = (new Date().getTime() - start) / 1000;
|
|
49
|
+
console.log(`React application successfully uploaded in ${_chalk.default.green(duration)}s.`);
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["AdminUpload.ts"],"names":["adminUpload","params","console","info","buildFolderPath","path","join","appDir","fs","existsSync","Error","start","Date","getTime","bucket","acl","onFileUploadSuccess","args","log","chalk","green","paths","relative","onFileUploadError","error","red","onFileUploadSkip","blue","duration"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAOO,eAAeA,WAAf,CAA2BC,MAA3B,EAAsD;AACzDC,EAAAA,OAAO,CAACC,IAAR,CAAa,gCAAb;;AAEA,QAAMC,eAAe,GAAGC,cAAKC,IAAL,CAAUL,MAAM,CAACM,MAAjB,EAAyB,MAAzB,EAAiC,OAAjC,CAAxB;;AACA,MAAI,CAACC,YAAGC,UAAH,CAAcL,eAAd,CAAL,EAAqC;AACjC,UAAM,IAAIM,KAAJ,CAAU,0CAAV,CAAN;AACH;;AAED,QAAMC,KAAK,GAAG,IAAIC,IAAJ,GAAWC,OAAX,EAAd;AAEA,QAAM,8BAAiB;AACnBR,IAAAA,IAAI,EAAED,eADa;AAEnBU,IAAAA,MAAM,EAAEb,MAAM,CAACa,MAFI;AAGnBC,IAAAA,GAAG,EAAE,aAHc;;AAInBC,IAAAA,mBAAmB,CAACC,IAAD,EAAY;AAC3B;AACAf,MAAAA,OAAO,CAACgB,GAAR,CAAa,YAAWC,eAAMC,KAAN,CAAYH,IAAI,CAACI,KAAL,CAAWC,QAAvB,CAAiC,EAAzD;AACH,KAPkB;;AAQnBC,IAAAA,iBAAiB,CAACN,IAAD,EAAY;AACzBf,MAAAA,OAAO,CAACsB,KAAR,CAAc,sBAAsBL,eAAMM,GAAN,CAAUR,IAAI,CAACI,KAAL,CAAWC,QAArB,CAApC;AACApB,MAAAA,OAAO,CAACgB,GAAR,CAAYD,IAAI,CAACO,KAAjB;AACH,KAXkB;;AAYnBE,IAAAA,gBAAgB,CAACT,IAAD,EAAY;AACxBf,MAAAA,OAAO,CAACC,IAAR,CAAc,YAAWgB,eAAMQ,IAAN,CAAWV,IAAI,CAACI,KAAL,CAAWC,QAAtB,CAAgC,mBAAzD;AACH;;AAdkB,GAAjB,CAAN;AAiBA,QAAMM,QAAQ,GAAG,CAAC,IAAIhB,IAAJ,GAAWC,OAAX,KAAuBF,KAAxB,IAAiC,IAAlD;AAEAT,EAAAA,OAAO,CAACgB,GAAR,CAAa,8CAA6CC,eAAMC,KAAN,CAAYQ,QAAZ,CAAsB,IAAhF;AACH","sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport chalk from \"chalk\";\n\nimport uploadFolderToS3 from \"@webiny/cli-plugin-deploy-pulumi/utils/aws/uploadFolderToS3\";\n\ninterface AdminUploadParams {\n bucket: string;\n appDir: string;\n}\n\nexport async function adminUpload(params: AdminUploadParams) {\n console.info(\"Uploading React application...\");\n\n const buildFolderPath = path.join(params.appDir, \"code\", \"build\");\n if (!fs.existsSync(buildFolderPath)) {\n throw new Error(\"Cannot continue, build folder not found.\");\n }\n\n const start = new Date().getTime();\n\n await uploadFolderToS3({\n path: buildFolderPath,\n bucket: params.bucket,\n acl: \"public-read\",\n onFileUploadSuccess(args: any) {\n // TODO console.success(args.paths.relative);\n console.log(`Uploaded ${chalk.green(args.paths.relative)}`);\n },\n onFileUploadError(args: any) {\n console.error(\"Failed to upload \" + chalk.red(args.paths.relative));\n console.log(args.error);\n },\n onFileUploadSkip(args: any) {\n console.info(`Skipping ${chalk.blue(args.paths.relative)}, already exists.`);\n }\n });\n\n const duration = (new Date().getTime() - start) / 1000;\n\n console.log(`React application successfully uploaded in ${chalk.green(duration)}s.`);\n}\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ApplicationContext, PulumiApp, ApplicationConfig } from "@webiny/pulumi-sdk";
|
|
2
|
+
import { Vpc } from "./ApiVpc";
|
|
3
|
+
export interface ApiAppConfig {
|
|
4
|
+
vpc?(app: PulumiApp, ctx: ApplicationContext): boolean | Vpc;
|
|
5
|
+
}
|
|
6
|
+
export declare const ApiApp: new (ctx: ApplicationContext) => PulumiApp<ApiAppConfig> & {
|
|
7
|
+
fileManager: {
|
|
8
|
+
functions: {
|
|
9
|
+
transform: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
10
|
+
manage: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
11
|
+
download: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
12
|
+
};
|
|
13
|
+
bucketNotification: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/s3").BucketNotification>;
|
|
14
|
+
};
|
|
15
|
+
prerenderingService: {
|
|
16
|
+
functions: {
|
|
17
|
+
render: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
18
|
+
flush: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
19
|
+
queue: {
|
|
20
|
+
add: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
21
|
+
process: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
graphql: {
|
|
26
|
+
role: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/iam").Role>;
|
|
27
|
+
policy: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/iam").Policy>;
|
|
28
|
+
functions: {
|
|
29
|
+
graphql: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
headlessCms: {
|
|
33
|
+
role: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/iam").Role>;
|
|
34
|
+
policy: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/iam").Policy>;
|
|
35
|
+
functions: {
|
|
36
|
+
graphql: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
apiGateway: {
|
|
40
|
+
api: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2").Api>;
|
|
41
|
+
stage: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2").Stage>;
|
|
42
|
+
routes: Record<string, {
|
|
43
|
+
integration: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2").Integration>;
|
|
44
|
+
route: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2").Route>;
|
|
45
|
+
permission: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Permission>;
|
|
46
|
+
}>;
|
|
47
|
+
addRoute: (name: string, params: import("./ApiGateway").ApiRouteParams) => void;
|
|
48
|
+
};
|
|
49
|
+
cloudfront: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/cloudfront").Distribution>;
|
|
50
|
+
apwScheduler: {
|
|
51
|
+
executeAction: {
|
|
52
|
+
role: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/iam").Role>;
|
|
53
|
+
policy: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/iam").Policy>;
|
|
54
|
+
lambda: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
55
|
+
};
|
|
56
|
+
scheduleAction: {
|
|
57
|
+
role: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/iam").Role>;
|
|
58
|
+
policy: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/iam").Policy>;
|
|
59
|
+
lambda: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/lambda").Function>;
|
|
60
|
+
};
|
|
61
|
+
eventRule: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch").EventRule>;
|
|
62
|
+
eventTarget: import("@webiny/pulumi-sdk").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch").EventTarget>;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export declare type ApiApp = InstanceType<typeof ApiApp>;
|
|
66
|
+
export declare function createApiApp(config?: ApiAppConfig & ApplicationConfig<ApiApp>): import("@webiny/pulumi-sdk").ApplicationBuilderGeneric;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ApiApp = void 0;
|
|
7
|
+
exports.createApiApp = createApiApp;
|
|
8
|
+
|
|
9
|
+
var _pulumiSdk = require("@webiny/pulumi-sdk");
|
|
10
|
+
|
|
11
|
+
var _ApiGraphql = require("./ApiGraphql");
|
|
12
|
+
|
|
13
|
+
var _ApiVpc = require("./ApiVpc");
|
|
14
|
+
|
|
15
|
+
var _ApiPrerendering = require("./ApiPrerendering");
|
|
16
|
+
|
|
17
|
+
var _ApiFileManager = require("./ApiFileManager");
|
|
18
|
+
|
|
19
|
+
var _ApiPageBuilder = require("./ApiPageBuilder");
|
|
20
|
+
|
|
21
|
+
var _ApiHeadlessCMS = require("./ApiHeadlessCMS");
|
|
22
|
+
|
|
23
|
+
var _ApiGateway = require("./ApiGateway");
|
|
24
|
+
|
|
25
|
+
var _ApiCloudfront = require("./ApiCloudfront");
|
|
26
|
+
|
|
27
|
+
var _getStorageOutput = require("../getStorageOutput");
|
|
28
|
+
|
|
29
|
+
var _awsUtils = require("../awsUtils");
|
|
30
|
+
|
|
31
|
+
var _ApiApwScheduler = require("./ApiApwScheduler");
|
|
32
|
+
|
|
33
|
+
const ApiApp = (0, _pulumiSdk.defineApp)({
|
|
34
|
+
name: "Api",
|
|
35
|
+
|
|
36
|
+
async config(app, config) {
|
|
37
|
+
var _config$vpc;
|
|
38
|
+
|
|
39
|
+
// Among other things, this determines the amount of information we reveal on runtime errors.
|
|
40
|
+
// https://www.webiny.com/docs/how-to-guides/environment-variables/#debug-environment-variable
|
|
41
|
+
const DEBUG = String(process.env.DEBUG); // Enables logs forwarding.
|
|
42
|
+
// https://www.webiny.com/docs/how-to-guides/use-watch-command#enabling-logs-forwarding
|
|
43
|
+
|
|
44
|
+
const WEBINY_LOGS_FORWARD_URL = String(process.env.WEBINY_LOGS_FORWARD_URL);
|
|
45
|
+
const vpcConfig = ((_config$vpc = config.vpc) === null || _config$vpc === void 0 ? void 0 : _config$vpc.call(config, app, app.ctx)) ?? app.ctx.env !== "dev";
|
|
46
|
+
const vpc = vpcConfig === true ? (0, _ApiVpc.createVpc)(app) : vpcConfig === false ? undefined : vpcConfig;
|
|
47
|
+
const storage = (0, _getStorageOutput.getStorageOutput)(app);
|
|
48
|
+
const awsAccountId = (0, _awsUtils.getAwsAccountId)(app);
|
|
49
|
+
const awsRegion = (0, _awsUtils.getAwsRegion)(app);
|
|
50
|
+
const pageBuilder = app.addModule(_ApiPageBuilder.ApiPageBuilder, {
|
|
51
|
+
env: {
|
|
52
|
+
COGNITO_REGION: String(process.env.AWS_REGION),
|
|
53
|
+
COGNITO_USER_POOL_ID: storage.cognitoUserPoolId,
|
|
54
|
+
DB_TABLE: storage.primaryDynamodbTableName,
|
|
55
|
+
S3_BUCKET: storage.fileManagerBucketId,
|
|
56
|
+
DEBUG,
|
|
57
|
+
WEBINY_LOGS_FORWARD_URL
|
|
58
|
+
},
|
|
59
|
+
awsRegion,
|
|
60
|
+
awsAccountId,
|
|
61
|
+
fileManagerBucketId: storage.fileManagerBucketId,
|
|
62
|
+
primaryDynamodbTableArn: storage.primaryDynamodbTableArn,
|
|
63
|
+
cognitoUserPoolArn: storage.cognitoUserPoolArn,
|
|
64
|
+
vpc
|
|
65
|
+
});
|
|
66
|
+
const fileManager = app.addModule(_ApiFileManager.ApiFileManager, {
|
|
67
|
+
fileManagerBucketId: storage.fileManagerBucketId,
|
|
68
|
+
vpc
|
|
69
|
+
});
|
|
70
|
+
const prerenderingService = (0, _ApiPrerendering.createPrerenderingService)(app, {
|
|
71
|
+
env: {
|
|
72
|
+
DB_TABLE: storage.primaryDynamodbTableName,
|
|
73
|
+
DEBUG
|
|
74
|
+
},
|
|
75
|
+
awsRegion,
|
|
76
|
+
awsAccountId,
|
|
77
|
+
primaryDynamodbTableArn: storage.primaryDynamodbTableArn,
|
|
78
|
+
fileManagerBucketId: storage.fileManagerBucketId,
|
|
79
|
+
cognitoUserPoolArn: storage.cognitoUserPoolArn,
|
|
80
|
+
vpc
|
|
81
|
+
});
|
|
82
|
+
const apwScheduler = app.addModule(_ApiApwScheduler.ApiApwScheduler, {
|
|
83
|
+
primaryDynamodbTableArn: storage.primaryDynamodbTableArn,
|
|
84
|
+
env: {
|
|
85
|
+
COGNITO_REGION: String(process.env.AWS_REGION),
|
|
86
|
+
COGNITO_USER_POOL_ID: storage.cognitoUserPoolId,
|
|
87
|
+
DB_TABLE: storage.primaryDynamodbTableName,
|
|
88
|
+
S3_BUCKET: storage.fileManagerBucketId,
|
|
89
|
+
DEBUG,
|
|
90
|
+
WEBINY_LOGS_FORWARD_URL
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const graphql = app.addModule(_ApiGraphql.ApiGraphql, {
|
|
94
|
+
env: {
|
|
95
|
+
COGNITO_REGION: String(process.env.AWS_REGION),
|
|
96
|
+
COGNITO_USER_POOL_ID: storage.cognitoUserPoolId,
|
|
97
|
+
DB_TABLE: storage.primaryDynamodbTableName,
|
|
98
|
+
S3_BUCKET: storage.fileManagerBucketId,
|
|
99
|
+
PRERENDERING_RENDER_HANDLER: prerenderingService.functions.render.output.arn,
|
|
100
|
+
PRERENDERING_FLUSH_HANDLER: prerenderingService.functions.flush.output.arn,
|
|
101
|
+
PRERENDERING_QUEUE_ADD_HANDLER: prerenderingService.functions.queue.add.output.arn,
|
|
102
|
+
PRERENDERING_QUEUE_PROCESS_HANDLER: prerenderingService.functions.queue.process.output.arn,
|
|
103
|
+
IMPORT_PAGES_CREATE_HANDLER: pageBuilder.importPages.functions.create.output.arn,
|
|
104
|
+
EXPORT_PAGES_PROCESS_HANDLER: pageBuilder.exportPages.functions.process.output.arn,
|
|
105
|
+
// TODO: move to okta plugin
|
|
106
|
+
OKTA_ISSUER: process.env["OKTA_ISSUER"],
|
|
107
|
+
DEBUG,
|
|
108
|
+
WEBINY_LOGS_FORWARD_URL
|
|
109
|
+
},
|
|
110
|
+
awsRegion,
|
|
111
|
+
awsAccountId,
|
|
112
|
+
primaryDynamodbTableArn: storage.primaryDynamodbTableArn,
|
|
113
|
+
primaryDynamodbTableName: storage.primaryDynamodbTableName,
|
|
114
|
+
primaryDynamodbTableHashKey: storage.primaryDynamodbTableHashKey,
|
|
115
|
+
primaryDynamodbTableRangeKey: storage.primaryDynamodbTableRangeKey,
|
|
116
|
+
fileManagerBucketId: storage.fileManagerBucketId,
|
|
117
|
+
cognitoUserPoolArn: storage.cognitoUserPoolArn,
|
|
118
|
+
apwSchedulerEventRule: apwScheduler.eventRule.output,
|
|
119
|
+
apwSchedulerEventTarget: apwScheduler.eventTarget.output,
|
|
120
|
+
vpc
|
|
121
|
+
});
|
|
122
|
+
const headlessCms = app.addModule(_ApiHeadlessCMS.ApiHeadlessCMS, {
|
|
123
|
+
env: {
|
|
124
|
+
COGNITO_REGION: String(process.env.AWS_REGION),
|
|
125
|
+
COGNITO_USER_POOL_ID: storage.cognitoUserPoolId,
|
|
126
|
+
DB_TABLE: storage.primaryDynamodbTableName,
|
|
127
|
+
S3_BUCKET: storage.fileManagerBucketId,
|
|
128
|
+
// TODO: move to okta plugin
|
|
129
|
+
OKTA_ISSUER: process.env["OKTA_ISSUER"],
|
|
130
|
+
DEBUG,
|
|
131
|
+
WEBINY_LOGS_FORWARD_URL
|
|
132
|
+
},
|
|
133
|
+
primaryDynamodbTableArn: storage.primaryDynamodbTableArn,
|
|
134
|
+
vpc
|
|
135
|
+
});
|
|
136
|
+
const apiGateway = app.addModule(_ApiGateway.ApiGateway, {
|
|
137
|
+
"graphql-post": {
|
|
138
|
+
path: "/graphql",
|
|
139
|
+
method: "POST",
|
|
140
|
+
function: graphql.functions.graphql.output.arn
|
|
141
|
+
},
|
|
142
|
+
"graphql-options": {
|
|
143
|
+
path: "/graphql",
|
|
144
|
+
method: "OPTIONS",
|
|
145
|
+
function: graphql.functions.graphql.output.arn
|
|
146
|
+
},
|
|
147
|
+
"files-any": {
|
|
148
|
+
path: "/files/{path}",
|
|
149
|
+
method: "ANY",
|
|
150
|
+
function: fileManager.functions.download.output.arn
|
|
151
|
+
},
|
|
152
|
+
"cms-post": {
|
|
153
|
+
path: "/cms/{key+}",
|
|
154
|
+
method: "POST",
|
|
155
|
+
function: headlessCms.functions.graphql.output.arn
|
|
156
|
+
},
|
|
157
|
+
"cms-options": {
|
|
158
|
+
path: "/cms/{key+}",
|
|
159
|
+
method: "OPTIONS",
|
|
160
|
+
function: headlessCms.functions.graphql.output.arn
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
const cloudfront = app.addModule(_ApiCloudfront.ApiCloudfront);
|
|
164
|
+
app.addOutputs({
|
|
165
|
+
region: process.env.AWS_REGION,
|
|
166
|
+
apiUrl: cloudfront.output.domainName.apply(value => `https://${value}`),
|
|
167
|
+
cognitoUserPoolId: storage.cognitoUserPoolId,
|
|
168
|
+
cognitoAppClientId: storage.cognitoAppClientId,
|
|
169
|
+
cognitoUserPoolPasswordPolicy: storage.cognitoUserPoolPasswordPolicy,
|
|
170
|
+
updatePbSettingsFunction: pageBuilder.updateSettings.functions.update.output.arn,
|
|
171
|
+
psQueueAdd: prerenderingService.functions.queue.add.output.arn,
|
|
172
|
+
psQueueProcess: prerenderingService.functions.queue.process.output.arn,
|
|
173
|
+
apwSchedulerScheduleAction: apwScheduler.scheduleAction.lambda.output.arn,
|
|
174
|
+
apwSchedulerExecuteAction: apwScheduler.executeAction.lambda.output.arn,
|
|
175
|
+
apwSchedulerEventRule: apwScheduler.eventRule.output.name,
|
|
176
|
+
apwSchedulerEventTargetId: apwScheduler.eventTarget.output.targetId,
|
|
177
|
+
dynamoDbTable: storage.primaryDynamodbTableName
|
|
178
|
+
});
|
|
179
|
+
return {
|
|
180
|
+
fileManager,
|
|
181
|
+
prerenderingService,
|
|
182
|
+
graphql,
|
|
183
|
+
headlessCms,
|
|
184
|
+
apiGateway,
|
|
185
|
+
cloudfront,
|
|
186
|
+
apwScheduler
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
});
|
|
191
|
+
exports.ApiApp = ApiApp;
|
|
192
|
+
|
|
193
|
+
function createApiApp(config) {
|
|
194
|
+
return (0, _pulumiSdk.createGenericApplication)({
|
|
195
|
+
id: "api",
|
|
196
|
+
name: "api",
|
|
197
|
+
description: "Represents cloud infrastructure needed for supporting your project's (GraphQL) API.",
|
|
198
|
+
cli: {
|
|
199
|
+
// Default args for the "yarn webiny watch ..." command.
|
|
200
|
+
watch: {
|
|
201
|
+
// Watch five levels of dependencies, starting from this project application.
|
|
202
|
+
depth: 5
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
async app(ctx) {
|
|
207
|
+
var _config$config;
|
|
208
|
+
|
|
209
|
+
// Create the app instance.
|
|
210
|
+
const app = new ApiApp(ctx); // Run the default application setup.
|
|
211
|
+
|
|
212
|
+
await app.setup(config || {}); // Run the custom user config.
|
|
213
|
+
|
|
214
|
+
await (config === null || config === void 0 ? void 0 : (_config$config = config.config) === null || _config$config === void 0 ? void 0 : _config$config.call(config, app, ctx));
|
|
215
|
+
return app;
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
onBeforeBuild: config === null || config === void 0 ? void 0 : config.onBeforeBuild,
|
|
219
|
+
onAfterBuild: config === null || config === void 0 ? void 0 : config.onAfterBuild,
|
|
220
|
+
onBeforeDeploy: config === null || config === void 0 ? void 0 : config.onBeforeDeploy,
|
|
221
|
+
onAfterDeploy: config === null || config === void 0 ? void 0 : config.onAfterDeploy
|
|
222
|
+
});
|
|
223
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ApiApp.ts"],"names":["ApiApp","name","config","app","DEBUG","String","process","env","WEBINY_LOGS_FORWARD_URL","vpcConfig","vpc","ctx","undefined","storage","awsAccountId","awsRegion","pageBuilder","addModule","ApiPageBuilder","COGNITO_REGION","AWS_REGION","COGNITO_USER_POOL_ID","cognitoUserPoolId","DB_TABLE","primaryDynamodbTableName","S3_BUCKET","fileManagerBucketId","primaryDynamodbTableArn","cognitoUserPoolArn","fileManager","ApiFileManager","prerenderingService","apwScheduler","ApiApwScheduler","graphql","ApiGraphql","PRERENDERING_RENDER_HANDLER","functions","render","output","arn","PRERENDERING_FLUSH_HANDLER","flush","PRERENDERING_QUEUE_ADD_HANDLER","queue","add","PRERENDERING_QUEUE_PROCESS_HANDLER","IMPORT_PAGES_CREATE_HANDLER","importPages","create","EXPORT_PAGES_PROCESS_HANDLER","exportPages","OKTA_ISSUER","primaryDynamodbTableHashKey","primaryDynamodbTableRangeKey","apwSchedulerEventRule","eventRule","apwSchedulerEventTarget","eventTarget","headlessCms","ApiHeadlessCMS","apiGateway","ApiGateway","path","method","function","download","cloudfront","ApiCloudfront","addOutputs","region","apiUrl","domainName","apply","value","cognitoAppClientId","cognitoUserPoolPasswordPolicy","updatePbSettingsFunction","updateSettings","update","psQueueAdd","psQueueProcess","apwSchedulerScheduleAction","scheduleAction","lambda","apwSchedulerExecuteAction","executeAction","apwSchedulerEventTargetId","targetId","dynamoDbTable","createApiApp","id","description","cli","watch","depth","setup","onBeforeBuild","onAfterBuild","onBeforeDeploy","onAfterDeploy"],"mappings":";;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMO,MAAMA,MAAM,GAAG,0BAAU;AAC5BC,EAAAA,IAAI,EAAE,KADsB;;AAE5B,QAAMC,MAAN,CAAaC,GAAb,EAAkBD,M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AWC,GAAX,EAAgBQ,GAAhB,CAAZ;AACA,aAAOR,GAAP;AACH,KApB2B;;AAqB5B8F,IAAAA,aAAa,EAAE/F,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAE+F,aArBK;AAsB5BC,IAAAA,YAAY,EAAEhG,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEgG,YAtBM;AAuB5BC,IAAAA,cAAc,EAAEjG,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEiG,cAvBI;AAwB5BC,IAAAA,aAAa,EAAElG,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAEkG;AAxBK,GAAzB,CAAP;AA0BH","sourcesContent":["import {\n defineApp,\n createGenericApplication,\n ApplicationContext,\n PulumiApp,\n ApplicationConfig\n} from \"@webiny/pulumi-sdk\";\n\nimport { ApiGraphql } from \"./ApiGraphql\";\nimport { createVpc, Vpc } from \"./ApiVpc\";\nimport { createPrerenderingService } from \"./ApiPrerendering\";\nimport { ApiFileManager } from \"./ApiFileManager\";\nimport { ApiPageBuilder } from \"./ApiPageBuilder\";\nimport { ApiHeadlessCMS } from \"./ApiHeadlessCMS\";\nimport { ApiGateway } from \"./ApiGateway\";\nimport { ApiCloudfront } from \"./ApiCloudfront\";\nimport { getStorageOutput } from \"../getStorageOutput\";\nimport { getAwsAccountId, getAwsRegion } from \"../awsUtils\";\nimport { ApiApwScheduler } from \"./ApiApwScheduler\";\n\nexport interface ApiAppConfig {\n vpc?(app: PulumiApp, ctx: ApplicationContext): boolean | Vpc;\n}\n\nexport const ApiApp = defineApp({\n name: \"Api\",\n async config(app, config: ApiAppConfig) {\n // Among other things, this determines the amount of information we reveal on runtime errors.\n // https://www.webiny.com/docs/how-to-guides/environment-variables/#debug-environment-variable\n const DEBUG = String(process.env.DEBUG);\n\n // Enables logs forwarding.\n // https://www.webiny.com/docs/how-to-guides/use-watch-command#enabling-logs-forwarding\n const WEBINY_LOGS_FORWARD_URL = String(process.env.WEBINY_LOGS_FORWARD_URL);\n\n const vpcConfig = config.vpc?.(app, app.ctx) ?? app.ctx.env !== \"dev\";\n const vpc =\n vpcConfig === true ? createVpc(app) : vpcConfig === false ? undefined : vpcConfig;\n\n const storage = getStorageOutput(app);\n const awsAccountId = getAwsAccountId(app);\n const awsRegion = getAwsRegion(app);\n\n const pageBuilder = app.addModule(ApiPageBuilder, {\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: storage.cognitoUserPoolId,\n DB_TABLE: storage.primaryDynamodbTableName,\n S3_BUCKET: storage.fileManagerBucketId,\n DEBUG,\n WEBINY_LOGS_FORWARD_URL\n },\n awsRegion,\n awsAccountId,\n fileManagerBucketId: storage.fileManagerBucketId,\n primaryDynamodbTableArn: storage.primaryDynamodbTableArn,\n cognitoUserPoolArn: storage.cognitoUserPoolArn,\n vpc\n });\n\n const fileManager = app.addModule(ApiFileManager, {\n fileManagerBucketId: storage.fileManagerBucketId,\n vpc\n });\n\n const prerenderingService = createPrerenderingService(app, {\n env: {\n DB_TABLE: storage.primaryDynamodbTableName,\n DEBUG\n },\n awsRegion,\n awsAccountId,\n primaryDynamodbTableArn: storage.primaryDynamodbTableArn,\n fileManagerBucketId: storage.fileManagerBucketId,\n cognitoUserPoolArn: storage.cognitoUserPoolArn,\n vpc\n });\n\n const apwScheduler = app.addModule(ApiApwScheduler, {\n primaryDynamodbTableArn: storage.primaryDynamodbTableArn,\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: storage.cognitoUserPoolId,\n DB_TABLE: storage.primaryDynamodbTableName,\n S3_BUCKET: storage.fileManagerBucketId,\n DEBUG,\n WEBINY_LOGS_FORWARD_URL\n }\n });\n\n const graphql = app.addModule(ApiGraphql, {\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: storage.cognitoUserPoolId,\n DB_TABLE: storage.primaryDynamodbTableName,\n S3_BUCKET: storage.fileManagerBucketId,\n\n PRERENDERING_RENDER_HANDLER: prerenderingService.functions.render.output.arn,\n PRERENDERING_FLUSH_HANDLER: prerenderingService.functions.flush.output.arn,\n PRERENDERING_QUEUE_ADD_HANDLER: prerenderingService.functions.queue.add.output.arn,\n PRERENDERING_QUEUE_PROCESS_HANDLER:\n prerenderingService.functions.queue.process.output.arn,\n IMPORT_PAGES_CREATE_HANDLER: pageBuilder.importPages.functions.create.output.arn,\n EXPORT_PAGES_PROCESS_HANDLER: pageBuilder.exportPages.functions.process.output.arn,\n // TODO: move to okta plugin\n OKTA_ISSUER: process.env[\"OKTA_ISSUER\"],\n DEBUG,\n WEBINY_LOGS_FORWARD_URL\n },\n awsRegion,\n awsAccountId,\n primaryDynamodbTableArn: storage.primaryDynamodbTableArn,\n primaryDynamodbTableName: storage.primaryDynamodbTableName,\n primaryDynamodbTableHashKey: storage.primaryDynamodbTableHashKey,\n primaryDynamodbTableRangeKey: storage.primaryDynamodbTableRangeKey,\n fileManagerBucketId: storage.fileManagerBucketId,\n cognitoUserPoolArn: storage.cognitoUserPoolArn,\n apwSchedulerEventRule: apwScheduler.eventRule.output,\n apwSchedulerEventTarget: apwScheduler.eventTarget.output,\n vpc\n });\n\n const headlessCms = app.addModule(ApiHeadlessCMS, {\n env: {\n COGNITO_REGION: String(process.env.AWS_REGION),\n COGNITO_USER_POOL_ID: storage.cognitoUserPoolId,\n DB_TABLE: storage.primaryDynamodbTableName,\n S3_BUCKET: storage.fileManagerBucketId,\n // TODO: move to okta plugin\n OKTA_ISSUER: process.env[\"OKTA_ISSUER\"],\n DEBUG,\n WEBINY_LOGS_FORWARD_URL\n },\n primaryDynamodbTableArn: storage.primaryDynamodbTableArn,\n vpc\n });\n\n const apiGateway = app.addModule(ApiGateway, {\n \"graphql-post\": {\n path: \"/graphql\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"graphql-options\": {\n path: \"/graphql\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-any\": {\n path: \"/files/{path}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"cms-post\": {\n path: \"/cms/{key+}\",\n method: \"POST\",\n function: headlessCms.functions.graphql.output.arn\n },\n \"cms-options\": {\n path: \"/cms/{key+}\",\n method: \"OPTIONS\",\n function: headlessCms.functions.graphql.output.arn\n }\n });\n\n const cloudfront = app.addModule(ApiCloudfront);\n\n app.addOutputs({\n region: process.env.AWS_REGION,\n apiUrl: cloudfront.output.domainName.apply(value => `https://${value}`),\n cognitoUserPoolId: storage.cognitoUserPoolId,\n cognitoAppClientId: storage.cognitoAppClientId,\n cognitoUserPoolPasswordPolicy: storage.cognitoUserPoolPasswordPolicy,\n updatePbSettingsFunction: pageBuilder.updateSettings.functions.update.output.arn,\n psQueueAdd: prerenderingService.functions.queue.add.output.arn,\n psQueueProcess: prerenderingService.functions.queue.process.output.arn,\n apwSchedulerScheduleAction: apwScheduler.scheduleAction.lambda.output.arn,\n apwSchedulerExecuteAction: apwScheduler.executeAction.lambda.output.arn,\n apwSchedulerEventRule: apwScheduler.eventRule.output.name,\n apwSchedulerEventTargetId: apwScheduler.eventTarget.output.targetId,\n dynamoDbTable: storage.primaryDynamodbTableName\n });\n\n return {\n fileManager,\n prerenderingService,\n graphql,\n headlessCms,\n apiGateway,\n cloudfront,\n apwScheduler\n };\n }\n});\n\nexport type ApiApp = InstanceType<typeof ApiApp>;\n\nexport function createApiApp(config?: ApiAppConfig & ApplicationConfig<ApiApp>) {\n return createGenericApplication({\n id: \"api\",\n name: \"api\",\n description:\n \"Represents cloud infrastructure needed for supporting your project's (GraphQL) API.\",\n cli: {\n // Default args for the \"yarn webiny watch ...\" command.\n watch: {\n // Watch five levels of dependencies, starting from this project application.\n depth: 5\n }\n },\n async app(ctx) {\n // Create the app instance.\n const app = new ApiApp(ctx);\n // Run the default application setup.\n await app.setup(config || {});\n // Run the custom user config.\n await config?.config?.(app, ctx);\n return app;\n },\n onBeforeBuild: config?.onBeforeBuild,\n onAfterBuild: config?.onAfterBuild,\n onBeforeDeploy: config?.onBeforeDeploy,\n onAfterDeploy: config?.onAfterDeploy\n });\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
|
+
import * as aws from "@pulumi/aws";
|
|
3
|
+
import { PulumiAppModule } from "@webiny/pulumi-sdk";
|
|
4
|
+
interface ScheduleActionParams {
|
|
5
|
+
env: Record<string, any>;
|
|
6
|
+
primaryDynamodbTableArn: pulumi.Input<string>;
|
|
7
|
+
}
|
|
8
|
+
export declare type ApiApwScheduler = PulumiAppModule<typeof ApiApwScheduler>;
|
|
9
|
+
export declare const ApiApwScheduler: import("@webiny/pulumi-sdk").PulumiAppModuleDefinition<{
|
|
10
|
+
executeAction: {
|
|
11
|
+
role: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.iam.Role>;
|
|
12
|
+
policy: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.iam.Policy>;
|
|
13
|
+
lambda: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.lambda.Function>;
|
|
14
|
+
};
|
|
15
|
+
scheduleAction: {
|
|
16
|
+
role: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.iam.Role>;
|
|
17
|
+
policy: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.iam.Policy>;
|
|
18
|
+
lambda: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.lambda.Function>;
|
|
19
|
+
};
|
|
20
|
+
eventRule: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.cloudwatch.EventRule>;
|
|
21
|
+
eventTarget: import("@webiny/pulumi-sdk").PulumiAppResource<typeof aws.cloudwatch.EventTarget>;
|
|
22
|
+
}, ScheduleActionParams>;
|
|
23
|
+
export {};
|