@fy-stack/fullstack-construct 0.0.141 → 0.0.143

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/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { FullStackConstruct } from './lib/fullstack-construct';
2
- export { type AppAttachment, AppGrant, AppType } from "./lib/types";
2
+ export { type AppAttachment, type FullStackConstructProps } from './lib/types';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,KAAK,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppType = exports.AppGrant = exports.FullStackConstruct = void 0;
3
+ exports.FullStackConstruct = void 0;
4
4
  var fullstack_construct_1 = require("./lib/fullstack-construct");
5
5
  Object.defineProperty(exports, "FullStackConstruct", { enumerable: true, get: function () { return fullstack_construct_1.FullStackConstruct; } });
6
- var types_1 = require("./lib/types");
7
- Object.defineProperty(exports, "AppGrant", { enumerable: true, get: function () { return types_1.AppGrant; } });
8
- Object.defineProperty(exports, "AppType", { enumerable: true, get: function () { return types_1.AppType; } });
@@ -1,30 +1,36 @@
1
1
  import { ApiGatewayConstruct } from '@fy-stack/apigateway-construct';
2
- import { type AppConstruct } from '@fy-stack/app-construct';
2
+ import { EcsConstruct, LambdaConstruct, StaticConstruct } from '@fy-stack/app-construct';
3
3
  import { AuthConstruct } from '@fy-stack/auth-construct';
4
4
  import { CDNConstruct } from '@fy-stack/cdn-construct';
5
5
  import { DatabaseConstruct } from '@fy-stack/database-construct';
6
6
  import { EventConstruct } from '@fy-stack/event-construct';
7
7
  import { SecretsConstruct } from '@fy-stack/secret-construct';
8
8
  import { StorageConstruct } from '@fy-stack/storage-construct';
9
- import { TaskConstruct } from '@fy-stack/task-construct';
9
+ import { AppGrant, Attach, Grant } from '@fy-stack/types';
10
10
  import * as ec2 from 'aws-cdk-lib/aws-ec2';
11
+ import * as iam from 'aws-cdk-lib/aws-iam';
11
12
  import { Construct } from 'constructs';
12
- import { FullStackConstructProps } from './types';
13
+ import { AppAttachment, FullStackConstructProps } from './types';
13
14
  /**
14
15
  *
15
16
  */
16
17
  export declare class FullStackConstruct extends Construct {
17
18
  vpc: ec2.IVpc;
19
+ owner?: iam.IUser | iam.IRole;
18
20
  auth?: AuthConstruct;
19
21
  storage?: StorageConstruct;
20
22
  storagePolicy?: string;
21
23
  database?: DatabaseConstruct;
22
24
  event?: EventConstruct;
23
- apps?: Record<string, AppConstruct>;
24
- tasks?: Record<string, TaskConstruct>;
25
+ ecs?: EcsConstruct;
26
+ lambda?: LambdaConstruct;
27
+ static?: StaticConstruct;
25
28
  cdn?: CDNConstruct;
26
29
  api?: ApiGatewayConstruct;
27
30
  secret: SecretsConstruct;
28
31
  constructor(scope: Construct, id: string, props: FullStackConstructProps);
32
+ fromAttachments(attach: Attach, attachment?: AppAttachment): void;
33
+ fromGrants(grant: Grant, grants?: AppGrant[]): void;
34
+ ownerFromArn(ownerArn?: string): iam.IUser | iam.IRole | undefined;
29
35
  }
30
36
  //# sourceMappingURL=fullstack-construct.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fullstack-construct.d.ts","sourceRoot":"","sources":["../../src/lib/fullstack-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,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AAC,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;IAoNxE,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,aAAa;IAU1D,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;IAW5C,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM;CAgB/B"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FullStackConstruct = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const path = tslib_1.__importStar(require("node:path"));
5
6
  const apigateway_construct_1 = require("@fy-stack/apigateway-construct");
6
7
  const app_construct_1 = require("@fy-stack/app-construct");
7
8
  const auth_construct_1 = require("@fy-stack/auth-construct");
@@ -10,37 +11,30 @@ const database_construct_1 = require("@fy-stack/database-construct");
10
11
  const event_construct_1 = require("@fy-stack/event-construct");
11
12
  const secret_construct_1 = require("@fy-stack/secret-construct");
12
13
  const storage_construct_1 = require("@fy-stack/storage-construct");
13
- const task_construct_1 = require("@fy-stack/task-construct");
14
14
  const aws_cdk_lib_1 = require("aws-cdk-lib");
15
15
  const ec2 = tslib_1.__importStar(require("aws-cdk-lib/aws-ec2"));
16
- const ecs = tslib_1.__importStar(require("aws-cdk-lib/aws-ecs"));
16
+ const iam = tslib_1.__importStar(require("aws-cdk-lib/aws-iam"));
17
17
  const constructs_1 = require("constructs");
18
- const types_1 = require("./types");
19
- const AppBuilds = {
20
- [types_1.AppType.NEXT_APP_ROUTER]: app_construct_1.NextAppRouterConstruct,
21
- [types_1.AppType.NEXT_PAGE_EXPORT]: app_construct_1.NextPagesExportConstruct,
22
- [types_1.AppType.NODE_APP]: app_construct_1.NodeAppConstruct,
23
- [types_1.AppType.NODE_API]: app_construct_1.NodeApiConstruct,
24
- [types_1.AppType.IMAGE_APP]: app_construct_1.ImageAppConstruct,
25
- [types_1.AppType.STATIC_WEBSITE]: app_construct_1.StaticWebsiteConstruct,
26
- };
27
18
  /**
28
19
  *
29
20
  */
30
21
  class FullStackConstruct extends constructs_1.Construct {
31
22
  vpc;
23
+ owner;
32
24
  auth;
33
25
  storage;
34
26
  storagePolicy;
35
27
  database;
36
28
  event;
37
- apps;
38
- tasks;
29
+ ecs;
30
+ lambda;
31
+ static;
39
32
  cdn;
40
33
  api;
41
34
  secret;
42
35
  constructor(scope, id, props) {
43
36
  super(scope, id);
37
+ this.owner = this.ownerFromArn(props.ownerArn);
44
38
  this.vpc = ec2.Vpc.fromLookup(this, 'VPC', props.vpcId ? { vpcId: props.vpcId } : { isDefault: true });
45
39
  if (props.auth) {
46
40
  this.auth = new auth_construct_1.AuthConstruct(this, 'AuthConstruct', {
@@ -57,43 +51,6 @@ class FullStackConstruct extends constructs_1.Construct {
57
51
  vpcId: this.vpc.vpcId,
58
52
  });
59
53
  }
60
- if (props.apps) {
61
- const apps = {};
62
- Object.assign(apps, Object.fromEntries(Object.entries(props.apps).map(([key, app]) => {
63
- const AppTypeConstruct = AppBuilds[app.type];
64
- return [
65
- key,
66
- new AppTypeConstruct(this, `${key}App`, {
67
- // @ts-expect-error invalid params
68
- buildParams: AppTypeConstruct.parse(app.buildParams ?? {}),
69
- vpc: this.vpc,
70
- ...app
71
- }),
72
- ];
73
- })));
74
- this.apps = apps;
75
- }
76
- if (props.task) {
77
- const tasks = {};
78
- const cluster = new ecs.Cluster(this, 'AppCluster', { vpc: this.vpc });
79
- Object.assign(tasks, Object.fromEntries(Object.entries(props.task).map(([key, task]) => {
80
- return [
81
- key,
82
- new task_construct_1.TaskConstruct(this, `${key}Task`, {
83
- clusterArn: cluster.clusterArn,
84
- vpc: this.vpc,
85
- ...task
86
- }),
87
- ];
88
- })));
89
- this.tasks = tasks;
90
- }
91
- if (props.events) {
92
- this.event = new event_construct_1.EventConstruct(this, 'EventConstruct', {
93
- resources: { ...this.apps, ...this.tasks },
94
- ...props.events,
95
- });
96
- }
97
54
  this.secret = new secret_construct_1.SecretsConstruct(this, 'SecretConstruct', {
98
55
  resources: {
99
56
  auth: this.auth,
@@ -101,73 +58,169 @@ class FullStackConstruct extends constructs_1.Construct {
101
58
  storage: this.storage,
102
59
  event: this.event,
103
60
  },
104
- secrets: props.secrets,
61
+ secrets: {
62
+ REGION: aws_cdk_lib_1.Stack.of(this).region,
63
+ ENVIRONMENT: props.environment,
64
+ ...props.secret,
65
+ },
105
66
  });
67
+ if (props.outputs) {
68
+ new aws_cdk_lib_1.CfnOutput(this, 'SecretsName', {
69
+ key: 'appSecrets',
70
+ value: this.secret.secrets.secretName,
71
+ });
72
+ }
73
+ if (props.ecs) {
74
+ this.ecs = new app_construct_1.EcsConstruct(this, 'EcsConstruct', {
75
+ vpc: this.vpc,
76
+ environmentPath: path.join('/', props.name, '/', props.environment),
77
+ environment: props.environment,
78
+ ...props.ecs,
79
+ });
80
+ if (this.ecs.server) {
81
+ this.fromGrants(this.ecs.server, props.ecs.server?.grants);
82
+ for (const i in this.ecs.server.apps) {
83
+ if (!props.ecs.server?.apps[i].attachment)
84
+ continue;
85
+ this.fromAttachments(this.ecs.server.apps[i], props.ecs.server.apps[i].attachment);
86
+ }
87
+ }
88
+ for (const i in this.ecs.tasks) {
89
+ if (props.ecs.tasks[i]?.grants) {
90
+ this.fromGrants(this.ecs.tasks[i], props.ecs.tasks[i]?.grants);
91
+ }
92
+ if (props.ecs.tasks[i]?.attachment) {
93
+ this.fromAttachments(this.ecs.tasks[i], props.ecs.tasks[i]?.attachment);
94
+ }
95
+ }
96
+ }
97
+ if (props.lambda) {
98
+ this.lambda = new app_construct_1.LambdaConstruct(this, 'LambdaConstruct', {
99
+ vpc: this.vpc,
100
+ apps: props.lambda,
101
+ });
102
+ for (const i in this.lambda.apps) {
103
+ if (props.lambda[i].attachment) {
104
+ this.fromAttachments(this.lambda.apps[i], props.lambda[i].attachment);
105
+ }
106
+ if (props.lambda[i].grants) {
107
+ this.fromGrants(this.lambda.apps[i], props.lambda[i].grants);
108
+ }
109
+ }
110
+ }
111
+ if (props.static) {
112
+ this.static = new app_construct_1.StaticConstruct(this, 'StaticConstruct', {
113
+ apps: props.static,
114
+ });
115
+ }
116
+ const resources = {
117
+ ...(this.ecs?.server?.apps ?? {}),
118
+ ...(this.lambda?.apps ?? {}),
119
+ ...(this.static?.apps ?? {}),
120
+ };
121
+ if (props.event) {
122
+ this.event = new event_construct_1.EventConstruct(this, 'EventConstruct', {
123
+ resources: {
124
+ ...(this.lambda?.apps ?? {}),
125
+ ...(this.ecs?.tasks ?? {}),
126
+ },
127
+ ...props.event,
128
+ });
129
+ }
106
130
  if (props.cdn) {
107
131
  this.cdn = new cdn_construct_1.CDNConstruct(this, 'CDNConstruct', {
108
132
  routes: props.cdn.routes,
109
133
  domains: props.cdn.domains,
110
- resources: { ...this.apps, storage: this.storage },
111
- });
112
- new aws_cdk_lib_1.CfnOutput(this, 'CDN Url', {
113
- key: 'cdnURl',
114
- value: 'https://' + this.cdn.distribution.domainName,
134
+ resources: {
135
+ ...resources,
136
+ storage: this.storage,
137
+ },
115
138
  });
139
+ if (props.outputs) {
140
+ new aws_cdk_lib_1.CfnOutput(this, 'CDN Url', {
141
+ key: 'cdnURl',
142
+ value: 'https://' + this.cdn.distribution.domainName,
143
+ });
144
+ }
116
145
  }
117
146
  if (props.api) {
118
147
  this.api = new apigateway_construct_1.ApiGatewayConstruct(this, 'ApiConstruct', {
119
148
  routes: props.api.routes,
120
- resources: this.apps,
149
+ resources,
121
150
  });
122
- if (this.api.api.url) {
151
+ if (this.api.api.url && props.outputs) {
123
152
  new aws_cdk_lib_1.CfnOutput(this, 'Api Url', {
124
153
  key: 'apiUrl',
125
154
  value: this.api.api.url,
126
155
  });
127
156
  }
128
157
  }
129
- const resources = {
130
- storage: this.storage,
131
- database: this.database,
132
- auth: this.auth,
133
- secrets: this.secret,
134
- event: this.event,
135
- };
136
158
  if (this.storage && this.cdn) {
137
159
  this.storagePolicy = JSON.stringify(this.storage.cloudfrontPolicy(this.cdn.distribution.distributionId));
138
- new aws_cdk_lib_1.CfnOutput(this, 'StorageBucketCDNPolicy', {
139
- key: 'storageBucketCDNPolicy',
140
- value: this.storagePolicy
141
- });
142
- }
143
- for (const i in props.apps) {
144
- const attachments = Object.entries(props.apps[i]?.attachment ?? {})
145
- .map(([key]) => [key, resources[key]])
146
- .filter((v) => !!v);
147
- if (attachments.length) {
148
- this.apps?.[i]?.attach(Object.fromEntries(attachments));
149
- }
150
- const grants = props.apps[i]?.grant
151
- ?.map((val) => resources[val])
152
- .filter((v) => !!v) ?? [];
153
- if (grants.length) {
154
- this.apps?.[i]?.grant(...grants);
160
+ if (props.outputs) {
161
+ new aws_cdk_lib_1.CfnOutput(this, 'StorageBucketCDNPolicy', {
162
+ key: 'storageBucketCDNPolicy',
163
+ value: this.storagePolicy,
164
+ });
155
165
  }
156
166
  }
157
- for (const i in props.task) {
158
- const attachments = Object.entries(props.task[i]?.attachment ?? {})
159
- .map(([key]) => [key, resources[key]])
160
- .filter((v) => !!v);
161
- if (attachments.length) {
162
- this.tasks?.[i]?.attach(Object.fromEntries(attachments));
163
- }
164
- const grants = props.task[i]?.grant
165
- ?.map((val) => resources[val])
166
- .filter((v) => !!v) ?? [];
167
- if (grants.length) {
168
- this.tasks?.[i]?.grant(...grants);
167
+ aws_cdk_lib_1.Tags.of(this).add('App', props.name);
168
+ aws_cdk_lib_1.Tags.of(this).add('Environment', props.environment);
169
+ if (this.owner) {
170
+ this.owner.addToPrincipalPolicy(new iam.PolicyStatement({
171
+ effect: iam.Effect.ALLOW,
172
+ actions: ['*'],
173
+ resources: ['*'],
174
+ conditions: {
175
+ StringEquals: {
176
+ 'aws:ResourceTag/App': props.name,
177
+ 'aws:ResourceTag/Environment': props.environment,
178
+ },
179
+ },
180
+ }));
181
+ if (this.storage) {
182
+ this.storage.bucket.addToResourcePolicy(new iam.PolicyStatement({
183
+ actions: ['*'],
184
+ resources: [
185
+ 'arn:aws:s3:::' + this.storage.bucket.bucketName + '/*',
186
+ ],
187
+ principals: [this.owner],
188
+ }));
189
+ this.owner.addToPrincipalPolicy(new iam.PolicyStatement({
190
+ actions: ['s3:*'],
191
+ resources: [this.storage.bucket.bucketArn],
192
+ }));
169
193
  }
170
194
  }
171
195
  }
196
+ fromAttachments(attach, attachment) {
197
+ const builtAttachment = Object.entries(attachment ?? {})
198
+ .map(([key]) => [key, this[key]])
199
+ .filter((v) => !!v && !!v[1]);
200
+ if (builtAttachment.length) {
201
+ attach.attach(Object.fromEntries(builtAttachment));
202
+ }
203
+ }
204
+ fromGrants(grant, grants) {
205
+ const builtGrants = grants
206
+ ?.map((val) => this[val])
207
+ .filter((v) => !!v) ?? [];
208
+ if (builtGrants.length) {
209
+ grant.grant(...builtGrants);
210
+ }
211
+ }
212
+ ownerFromArn(ownerArn) {
213
+ if (!ownerArn)
214
+ return;
215
+ const [arn] = ownerArn.split('/');
216
+ const resourceType = arn.split(':').at(-1);
217
+ if (resourceType === 'user') {
218
+ return iam.User.fromUserArn(this, 'Owner', ownerArn);
219
+ }
220
+ if (resourceType === 'role') {
221
+ return iam.Role.fromRoleArn(this, 'Owner', ownerArn);
222
+ }
223
+ return;
224
+ }
172
225
  }
173
226
  exports.FullStackConstruct = FullStackConstruct;
@@ -1,63 +1,51 @@
1
+ import type { EcsConstructProps, LambdaConstructProps, StaticConstructProps } from '@fy-stack/app-construct';
1
2
  import type { CDNConstructProps } from '@fy-stack/cdn-construct';
2
3
  import type { DatabaseConstructProps } from '@fy-stack/database-construct';
3
4
  import type { EventConstructProps } from '@fy-stack/event-construct';
4
5
  import type { StorageConstructProps } from '@fy-stack/storage-construct';
5
- import type { TaskConstructsProps } from '@fy-stack/task-construct';
6
- import type { ResourceRef } from '@fy-stack/types';
7
- export declare enum AppType {
8
- NODE_APP = "nodeApp",
9
- NODE_API = "nestApi",
10
- IMAGE_APP = "imageApp",
11
- NEXT_APP_ROUTER = "nextAppRouter",
12
- NEXT_PAGE_EXPORT = "nextPageExport",
13
- STATIC_WEBSITE = "staticWebsite"
14
- }
6
+ import { AppGrant, type ResourceRef } from '@fy-stack/types';
15
7
  export type AppAttachment = {
16
8
  auth?: boolean;
17
9
  storage?: boolean;
18
10
  database?: boolean;
19
- secrets?: boolean;
20
- queue?: {
21
- batchSize?: number;
22
- };
23
- };
24
- export declare enum AppGrant {
25
- AUTH = "auth",
26
- STORAGE = "storage",
27
- DATABASE = "database",
28
- SECRETS = "secrets",
29
- EVENT = "event"
30
- }
31
- export type App = {
32
- type: AppType;
33
- output: string;
34
- attachment?: AppAttachment;
35
- grant?: AppGrant[];
36
- env?: Record<string, string>;
37
- buildParams?: Record<string, unknown>;
38
- };
39
- export type Task = Omit<TaskConstructsProps, "clusterArn" | "vpc"> & {
40
- attachment?: AppAttachment;
41
- grant?: AppGrant[];
11
+ secret?: boolean;
42
12
  };
43
13
  export type AppMessage = ResourceRef & {
44
14
  messages: string[];
45
15
  };
46
16
  export type FullStackConstructProps = {
17
+ name: string;
18
+ environment: string;
47
19
  vpcId?: string;
48
- appId: string;
49
20
  auth?: {
50
21
  groups?: string[];
51
22
  };
52
23
  storage?: StorageConstructProps;
53
24
  database?: DatabaseConstructProps;
54
- apps?: Record<string, App>;
55
- events?: Omit<EventConstructProps, "resources">;
56
- cdn?: Omit<CDNConstructProps, "resources">;
25
+ ecs?: Omit<EcsConstructProps, 'vpc' | 'environmentPath' | 'server' | 'tasks' | 'environment'> & {
26
+ server: Omit<NonNullable<EcsConstructProps['server']>, 'apps'> & {
27
+ grants?: AppGrant[];
28
+ apps: Record<string, NonNullable<EcsConstructProps['server']>['apps'][string] & {
29
+ attachment?: AppAttachment;
30
+ }>;
31
+ };
32
+ tasks: Record<string, NonNullable<EcsConstructProps['tasks']>[string] & {
33
+ grants?: AppGrant[];
34
+ attachment?: AppAttachment;
35
+ }>;
36
+ };
37
+ lambda?: Record<string, NonNullable<LambdaConstructProps['apps']>[string] & {
38
+ grants?: AppGrant[];
39
+ attachment?: AppAttachment;
40
+ }>;
41
+ static?: StaticConstructProps['apps'];
42
+ event?: Omit<EventConstructProps, 'resources'>;
43
+ cdn?: Omit<CDNConstructProps, 'resources'>;
57
44
  api?: {
58
45
  routes: Record<string, ResourceRef>;
59
46
  };
60
- secrets?: Record<string, string | undefined>;
61
- task?: Record<string, Task>;
47
+ secret?: Record<string, string | undefined>;
48
+ outputs?: boolean;
49
+ ownerArn?: string;
62
50
  };
63
51
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,oBAAY,OAAO;IACjB,QAAQ,YAAY;IACpB,QAAQ,YAAY;IACpB,SAAS,aAAa;IACtB,eAAe,kBAAkB;IACjC,gBAAgB,mBAAmB;IACnC,cAAc,kBAAkB;CACjC;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;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,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
package/dist/lib/types.js CHANGED
@@ -1,20 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppGrant = exports.AppType = void 0;
4
- var AppType;
5
- (function (AppType) {
6
- AppType["NODE_APP"] = "nodeApp";
7
- AppType["NODE_API"] = "nestApi";
8
- AppType["IMAGE_APP"] = "imageApp";
9
- AppType["NEXT_APP_ROUTER"] = "nextAppRouter";
10
- AppType["NEXT_PAGE_EXPORT"] = "nextPageExport";
11
- AppType["STATIC_WEBSITE"] = "staticWebsite";
12
- })(AppType || (exports.AppType = AppType = {}));
13
- var AppGrant;
14
- (function (AppGrant) {
15
- AppGrant["AUTH"] = "auth";
16
- AppGrant["STORAGE"] = "storage";
17
- AppGrant["DATABASE"] = "database";
18
- AppGrant["SECRETS"] = "secrets";
19
- AppGrant["EVENT"] = "event";
20
- })(AppGrant || (exports.AppGrant = AppGrant = {}));
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@fy-stack/fullstack-construct",
3
- "version": "0.0.141",
3
+ "version": "0.0.143",
4
4
  "repository": "https://github.com/festusyuma/fy-stack",
5
5
  "dependencies": {
6
- "@fy-stack/apigateway-construct": "0.0.141",
7
- "@fy-stack/app-construct": "0.0.141",
8
- "@fy-stack/auth-construct": "0.0.141",
9
- "@fy-stack/cdn-construct": "0.0.141",
10
- "@fy-stack/database-construct": "0.0.141",
11
- "@fy-stack/event-construct": "0.0.141",
12
- "@fy-stack/secret-construct": "0.0.141",
13
- "@fy-stack/storage-construct": "0.0.141",
14
- "@fy-stack/task-construct": "0.0.141",
15
- "tslib": "^2.3.0"
6
+ "@fy-stack/apigateway-construct": "0.0.143",
7
+ "@fy-stack/app-construct": "0.0.143",
8
+ "@fy-stack/auth-construct": "0.0.143",
9
+ "@fy-stack/cdn-construct": "0.0.143",
10
+ "@fy-stack/database-construct": "0.0.143",
11
+ "@fy-stack/event-construct": "0.0.143",
12
+ "@fy-stack/secret-construct": "0.0.143",
13
+ "@fy-stack/storage-construct": "0.0.143",
14
+ "tslib": "^2.3.0",
15
+ "@fy-stack/types": "0.0.143"
16
16
  },
17
17
  "peerDependencies": {
18
- "aws-cdk-lib": "^2.174.1",
18
+ "aws-cdk-lib": "^2.198.0",
19
19
  "constructs": "^10.4.2"
20
20
  },
21
21
  "type": "commonjs",