@fy-stack/fullstack-construct 0.0.122 → 0.0.124
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApiGatewayConstruct } from '@fy-stack/apigateway-construct';
|
|
1
2
|
import { type AppConstruct } from '@fy-stack/app-construct';
|
|
2
3
|
import { AuthConstruct } from '@fy-stack/auth-construct';
|
|
3
4
|
import { CDNConstruct } from '@fy-stack/cdn-construct';
|
|
@@ -7,7 +8,6 @@ import { SecretsConstruct } from '@fy-stack/secret-construct';
|
|
|
7
8
|
import { StorageConstruct } from '@fy-stack/storage-construct';
|
|
8
9
|
import { Construct } from 'constructs';
|
|
9
10
|
import { FullStackConstructProps } from './types';
|
|
10
|
-
import { ApiGatewayConstruct } from '@fy-stack/apigateway-construct';
|
|
11
11
|
export declare class FullStackConstruct extends Construct {
|
|
12
12
|
auth?: AuthConstruct;
|
|
13
13
|
storage?: StorageConstruct;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fullstack-construct.d.ts","sourceRoot":"","sources":["../../src/lib/fullstack-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"fullstack-construct.d.ts","sourceRoot":"","sources":["../../src/lib/fullstack-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAW,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAU3D,qBAAa,kBAAmB,SAAQ,SAAS;IACxC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpC,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,GAAG,CAAC,EAAE,mBAAmB,CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC;gBAEpB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,uBAAuB;CAwGzE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FullStackConstruct = void 0;
|
|
4
|
-
const
|
|
4
|
+
const apigateway_construct_1 = require("@fy-stack/apigateway-construct");
|
|
5
5
|
const app_construct_1 = require("@fy-stack/app-construct");
|
|
6
6
|
const auth_construct_1 = require("@fy-stack/auth-construct");
|
|
7
7
|
const cdn_construct_1 = require("@fy-stack/cdn-construct");
|
|
@@ -9,14 +9,14 @@ const database_construct_1 = require("@fy-stack/database-construct");
|
|
|
9
9
|
const event_construct_1 = require("@fy-stack/event-construct");
|
|
10
10
|
const secret_construct_1 = require("@fy-stack/secret-construct");
|
|
11
11
|
const storage_construct_1 = require("@fy-stack/storage-construct");
|
|
12
|
-
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
13
12
|
const constructs_1 = require("constructs");
|
|
14
13
|
const types_1 = require("./types");
|
|
15
|
-
const
|
|
14
|
+
const deno_api_construct_1 = require("@fy-stack/app-construct/dist/lib/deno-api-construct");
|
|
16
15
|
const AppBuilds = {
|
|
17
16
|
[types_1.AppType.NEXT_APP_ROUTER]: app_construct_1.NextAppRouterConstruct,
|
|
18
17
|
[types_1.AppType.NEST]: app_construct_1.NestConstruct,
|
|
19
18
|
[types_1.AppType.NEST_API]: app_construct_1.NestApiConstruct,
|
|
19
|
+
[types_1.AppType.DENO_API]: deno_api_construct_1.DenoApiConstruct,
|
|
20
20
|
};
|
|
21
21
|
class FullStackConstruct extends constructs_1.Construct {
|
|
22
22
|
auth;
|
|
@@ -30,42 +30,44 @@ class FullStackConstruct extends constructs_1.Construct {
|
|
|
30
30
|
constructor(scope, id, props) {
|
|
31
31
|
super(scope, id);
|
|
32
32
|
if (props.auth) {
|
|
33
|
-
this.auth = new auth_construct_1.AuthConstruct(this, props.appId + '
|
|
33
|
+
this.auth = new auth_construct_1.AuthConstruct(this, props.appId + 'AuthConstruct', {
|
|
34
34
|
groups: props.auth.groups,
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
if (props.storage) {
|
|
38
|
-
this.storage = new storage_construct_1.StorageConstruct(this, '
|
|
38
|
+
this.storage = new storage_construct_1.StorageConstruct(this, 'StorageConstruct', props.storage);
|
|
39
39
|
}
|
|
40
40
|
/* create secrets for test or production environments */
|
|
41
41
|
if (props.database) {
|
|
42
|
-
this.database = new database_construct_1.DatabaseConstruct(this, '
|
|
43
|
-
new cdk.CfnOutput(this, 'Database Secrets', {
|
|
44
|
-
key: 'dbSecrets',
|
|
45
|
-
value: this.database.dbSecrets.secretName,
|
|
46
|
-
});
|
|
42
|
+
this.database = new database_construct_1.DatabaseConstruct(this, 'DatabaseConstruct');
|
|
47
43
|
}
|
|
48
44
|
if (props.apps) {
|
|
49
45
|
const apps = {};
|
|
50
46
|
Object.assign(apps, Object.fromEntries(Object.entries(props.apps).map(([key, app]) => {
|
|
47
|
+
const AppTypeConstruct = AppBuilds[app.type];
|
|
51
48
|
return [
|
|
52
49
|
key,
|
|
53
|
-
new
|
|
50
|
+
new AppTypeConstruct(this, `${key}App`, {
|
|
54
51
|
queue: app.attachment?.queue,
|
|
55
|
-
output: app.
|
|
56
|
-
buildPaths:
|
|
52
|
+
output: app.path,
|
|
53
|
+
buildPaths: {
|
|
54
|
+
...('clean' in AppTypeConstruct
|
|
55
|
+
? AppTypeConstruct.clean(app.path, key, app.command)
|
|
56
|
+
: {}),
|
|
57
|
+
...app.buildPaths,
|
|
58
|
+
},
|
|
57
59
|
}),
|
|
58
60
|
];
|
|
59
61
|
})));
|
|
60
62
|
this.apps = apps;
|
|
61
63
|
}
|
|
62
64
|
if (props.events) {
|
|
63
|
-
this.event = new event_construct_1.EventConstruct(this, '
|
|
65
|
+
this.event = new event_construct_1.EventConstruct(this, 'EventConstruct', {
|
|
64
66
|
resources: this.apps,
|
|
65
67
|
events: props.events,
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
|
-
this.secret = new secret_construct_1.SecretsConstruct(this, '
|
|
70
|
+
this.secret = new secret_construct_1.SecretsConstruct(this, 'SecretConstruct', {
|
|
69
71
|
resources: {
|
|
70
72
|
auth: this.auth,
|
|
71
73
|
database: this.database,
|
|
@@ -75,44 +77,32 @@ class FullStackConstruct extends constructs_1.Construct {
|
|
|
75
77
|
secrets: props.secrets,
|
|
76
78
|
});
|
|
77
79
|
if (props.cdn) {
|
|
78
|
-
this.cdn = new cdn_construct_1.CDNConstruct(this, '
|
|
80
|
+
this.cdn = new cdn_construct_1.CDNConstruct(this, 'CDNConstruct', {
|
|
79
81
|
routes: props.cdn.routes,
|
|
80
82
|
resources: { ...this.apps, uploads: this.storage },
|
|
81
83
|
});
|
|
82
|
-
new cdk.CfnOutput(this, 'CDN Url', {
|
|
83
|
-
key: 'cdnUrl',
|
|
84
|
-
value: 'https://' + this.cdn.distribution.domainName,
|
|
85
|
-
});
|
|
86
84
|
}
|
|
87
85
|
if (props.api) {
|
|
88
|
-
this.api = new apigateway_construct_1.ApiGatewayConstruct(this, '
|
|
86
|
+
this.api = new apigateway_construct_1.ApiGatewayConstruct(this, 'ApiConstruct', {
|
|
89
87
|
routes: props.api.routes,
|
|
90
88
|
resources: this.apps,
|
|
91
89
|
});
|
|
92
|
-
new cdk.CfnOutput(this, 'Api Url', {
|
|
93
|
-
key: 'apiUrl',
|
|
94
|
-
value: this.api.api.apiEndpoint,
|
|
95
|
-
});
|
|
96
90
|
}
|
|
97
91
|
const resources = {
|
|
98
92
|
storage: this.storage,
|
|
99
93
|
database: this.database,
|
|
100
94
|
auth: this.auth,
|
|
101
95
|
secrets: this.secret,
|
|
102
|
-
event: this.event
|
|
96
|
+
event: this.event,
|
|
103
97
|
};
|
|
104
98
|
for (const i in props.apps) {
|
|
105
99
|
this.apps?.[i]?.attach(Object.fromEntries(Object.entries(props.apps[i]?.attachment ?? {})
|
|
106
100
|
.map(([key]) => [key, resources[key]])
|
|
107
101
|
.filter((v) => !!v)));
|
|
108
102
|
this.apps?.[i]?.grant(...(props.apps[i]?.grant
|
|
109
|
-
?.map(val => resources[val])
|
|
103
|
+
?.map((val) => resources[val])
|
|
110
104
|
.filter((v) => !!v) ?? []));
|
|
111
105
|
}
|
|
112
|
-
new cdk.CfnOutput(this, 'App Secrets', {
|
|
113
|
-
key: 'appSecrets',
|
|
114
|
-
value: this.secret.secrets.secretName,
|
|
115
|
-
});
|
|
116
106
|
}
|
|
117
107
|
}
|
|
118
108
|
exports.FullStackConstruct = FullStackConstruct;
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as events from 'aws-cdk-lib/aws-events';
|
|
|
3
3
|
export declare enum AppType {
|
|
4
4
|
NEST = "nest",
|
|
5
5
|
NEST_API = "nestApi",
|
|
6
|
+
DENO_API = "denoApi",
|
|
6
7
|
NEXT_APP_ROUTER = "nextAppRouter"
|
|
7
8
|
}
|
|
8
9
|
export type AppAttachment = {
|
|
@@ -23,10 +24,11 @@ export declare enum AppGrant {
|
|
|
23
24
|
}
|
|
24
25
|
export type App = {
|
|
25
26
|
type: AppType;
|
|
26
|
-
|
|
27
|
+
path: string;
|
|
27
28
|
attachment?: AppAttachment;
|
|
28
29
|
grant?: AppGrant[];
|
|
29
30
|
command: string;
|
|
31
|
+
buildPaths?: Record<string, string>;
|
|
30
32
|
};
|
|
31
33
|
export type AppRef = {
|
|
32
34
|
$app: string;
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,oBAAY,OAAO;IACjB,IAAI,SAAS;IACb,QAAQ,YAAY;IACpB,eAAe,kBAAkB;CAClC;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAChC,CAAC;AAEF,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,KAA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AAG;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC7B,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;QACxB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;KAAE,CAAC;IAC9C,GAAG,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;KAAE,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC9C,CAAC"}
|
package/dist/lib/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fy-stack/fullstack-construct",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.124",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.0",
|
|
6
|
-
"@fy-stack/auth-construct": "0.0.
|
|
7
|
-
"@fy-stack/storage-construct": "0.0.
|
|
8
|
-
"@fy-stack/database-construct": "0.0.
|
|
9
|
-
"@fy-stack/event-construct": "0.0.
|
|
10
|
-
"@fy-stack/secret-construct": "0.0.
|
|
11
|
-
"@fy-stack/cdn-construct": "0.0.
|
|
12
|
-
"@fy-stack/apigateway-construct": "0.0.
|
|
13
|
-
"@fy-stack/types": "0.0.
|
|
14
|
-
"@fy-stack/app-construct": "0.0.
|
|
6
|
+
"@fy-stack/auth-construct": "0.0.124",
|
|
7
|
+
"@fy-stack/storage-construct": "0.0.124",
|
|
8
|
+
"@fy-stack/database-construct": "0.0.124",
|
|
9
|
+
"@fy-stack/event-construct": "0.0.124",
|
|
10
|
+
"@fy-stack/secret-construct": "0.0.124",
|
|
11
|
+
"@fy-stack/cdn-construct": "0.0.124",
|
|
12
|
+
"@fy-stack/apigateway-construct": "0.0.124",
|
|
13
|
+
"@fy-stack/types": "0.0.124",
|
|
14
|
+
"@fy-stack/app-construct": "0.0.124"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"aws-cdk-lib": "2.164.1",
|