@fy-stack/app-construct 0.0.126 → 0.0.127
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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/lib/image-app-construct.js +1 -1
- package/dist/lib/next-app-router-construct.d.ts.map +1 -1
- package/dist/lib/next-app-router-construct.js +2 -2
- package/dist/lib/node-api-construct.d.ts.map +1 -1
- package/dist/lib/node-api-construct.js +3 -3
- package/dist/lib/node-app-construct.d.ts +2 -2
- package/dist/lib/node-app-construct.d.ts.map +1 -1
- package/dist/lib/utils/lambda-api.d.ts +1 -1
- package/dist/lib/utils/lambda-api.d.ts.map +1 -1
- package/dist/lib/utils/lambda-api.js +1 -1
- package/package.json +2 -2
- package/dist/lib/deno-api-construct.d.ts +0 -19
- package/dist/lib/deno-api-construct.d.ts.map +0 -1
- package/dist/lib/deno-api-construct.js +0 -72
- package/dist/lib/nest-api-construct.d.ts +0 -10
- package/dist/lib/nest-api-construct.d.ts.map +0 -1
- package/dist/lib/nest-api-construct.js +0 -31
- package/dist/lib/nest-construct.d.ts +0 -37
- package/dist/lib/nest-construct.d.ts.map +0 -1
- package/dist/lib/nest-construct.js +0 -103
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export { ImageAppConstruct } from './lib/image-app-construct';
|
|
2
|
+
export { NextAppRouterConstruct } from './lib/next-app-router-construct';
|
|
1
3
|
export { NodeApiConstruct } from './lib/node-api-construct';
|
|
2
4
|
export { NodeAppConstruct } from './lib/node-app-construct';
|
|
3
|
-
export { NextAppRouterConstruct } from './lib/next-app-router-construct';
|
|
4
|
-
export { ImageAppConstruct } from './lib/image-app-construct';
|
|
5
5
|
export type { AppConstruct, AppProperties } from "./lib/types";
|
|
6
6
|
export { lambdaAttach } from "./lib/utils/lambda-attach";
|
|
7
7
|
export { lambdaGrant } from "./lib/utils/lambda-grant";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lambdaGrant = exports.lambdaAttach = exports.
|
|
3
|
+
exports.lambdaGrant = exports.lambdaAttach = exports.NodeAppConstruct = exports.NodeApiConstruct = exports.NextAppRouterConstruct = exports.ImageAppConstruct = void 0;
|
|
4
|
+
var image_app_construct_1 = require("./lib/image-app-construct");
|
|
5
|
+
Object.defineProperty(exports, "ImageAppConstruct", { enumerable: true, get: function () { return image_app_construct_1.ImageAppConstruct; } });
|
|
6
|
+
var next_app_router_construct_1 = require("./lib/next-app-router-construct");
|
|
7
|
+
Object.defineProperty(exports, "NextAppRouterConstruct", { enumerable: true, get: function () { return next_app_router_construct_1.NextAppRouterConstruct; } });
|
|
4
8
|
var node_api_construct_1 = require("./lib/node-api-construct");
|
|
5
9
|
Object.defineProperty(exports, "NodeApiConstruct", { enumerable: true, get: function () { return node_api_construct_1.NodeApiConstruct; } });
|
|
6
10
|
var node_app_construct_1 = require("./lib/node-app-construct");
|
|
7
11
|
Object.defineProperty(exports, "NodeAppConstruct", { enumerable: true, get: function () { return node_app_construct_1.NodeAppConstruct; } });
|
|
8
|
-
var next_app_router_construct_1 = require("./lib/next-app-router-construct");
|
|
9
|
-
Object.defineProperty(exports, "NextAppRouterConstruct", { enumerable: true, get: function () { return next_app_router_construct_1.NextAppRouterConstruct; } });
|
|
10
|
-
var image_app_construct_1 = require("./lib/image-app-construct");
|
|
11
|
-
Object.defineProperty(exports, "ImageAppConstruct", { enumerable: true, get: function () { return image_app_construct_1.ImageAppConstruct; } });
|
|
12
12
|
var lambda_attach_1 = require("./lib/utils/lambda-attach");
|
|
13
13
|
Object.defineProperty(exports, "lambdaAttach", { enumerable: true, get: function () { return lambda_attach_1.lambdaAttach; } });
|
|
14
14
|
var lambda_grant_1 = require("./lib/utils/lambda-grant");
|
|
@@ -10,9 +10,9 @@ const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources
|
|
|
10
10
|
const aws_sns_subscriptions_1 = require("aws-cdk-lib/aws-sns-subscriptions");
|
|
11
11
|
const aws_sqs_1 = require("aws-cdk-lib/aws-sqs");
|
|
12
12
|
const constructs_1 = require("constructs");
|
|
13
|
+
const lambda_api_1 = require("./utils/lambda-api");
|
|
13
14
|
const lambda_attach_1 = require("./utils/lambda-attach");
|
|
14
15
|
const lambda_grant_1 = require("./utils/lambda-grant");
|
|
15
|
-
const lambda_api_1 = require("./utils/lambda-api");
|
|
16
16
|
class ImageAppConstruct extends constructs_1.Construct {
|
|
17
17
|
function;
|
|
18
18
|
queue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-app-router-construct.d.ts","sourceRoot":"","sources":["../../src/lib/next-app-router-construct.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"next-app-router-construct.d.ts","sourceRoot":"","sources":["../../src/lib/next-app-router-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AACnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAGzE,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAIjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAItD,qBAAa,sBAAuB,SAAQ,SAAU,YAAW,YAAY;IACpE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;IAEpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;gBAEvB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IAiE9D,UAAU,CAAC,IAAI,EAAE,MAAM;;;IAwCvB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAIvD,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,IAAI,kBAAkB;CAGnC"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NextAppRouterConstruct = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("node:fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
5
7
|
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
6
8
|
const cloudfront = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront"));
|
|
7
9
|
const cloudfrontOrigin = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront-origins"));
|
|
@@ -12,8 +14,6 @@ const s3Deploy = tslib_1.__importStar(require("aws-cdk-lib/aws-s3-deployment"));
|
|
|
12
14
|
const constructs_1 = require("constructs");
|
|
13
15
|
const lambda_attach_1 = require("./utils/lambda-attach");
|
|
14
16
|
const lambda_grant_1 = require("./utils/lambda-grant");
|
|
15
|
-
const path = tslib_1.__importStar(require("node:path"));
|
|
16
|
-
const fs = tslib_1.__importStar(require("node:fs"));
|
|
17
17
|
class NextAppRouterConstruct extends constructs_1.Construct {
|
|
18
18
|
function;
|
|
19
19
|
queue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-api-construct.d.ts","sourceRoot":"","sources":["../../src/lib/node-api-construct.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node-api-construct.d.ts","sourceRoot":"","sources":["../../src/lib/node-api-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAKtD,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,YAAY;IAC9D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAExB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IAgD9D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB;IAI1D,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;IAqBvB,GAAG,CAAC,IAAI,EAAE,MAAM;;;CAGjB"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NodeApiConstruct = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
6
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
5
7
|
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
6
8
|
const cloudfront = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront"));
|
|
7
9
|
const cloudfrontOrigin = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront-origins"));
|
|
@@ -9,11 +11,9 @@ const lambda = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda"));
|
|
|
9
11
|
const lambdaEventSource = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda-event-sources"));
|
|
10
12
|
const sqs = tslib_1.__importStar(require("aws-cdk-lib/aws-sqs"));
|
|
11
13
|
const constructs_1 = require("constructs");
|
|
14
|
+
const lambda_api_1 = require("./utils/lambda-api");
|
|
12
15
|
const lambda_attach_1 = require("./utils/lambda-attach");
|
|
13
16
|
const lambda_grant_1 = require("./utils/lambda-grant");
|
|
14
|
-
const lambda_api_1 = require("./utils/lambda-api");
|
|
15
|
-
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
16
|
-
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
17
17
|
class NodeApiConstruct extends constructs_1.Construct {
|
|
18
18
|
function;
|
|
19
19
|
queue;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Attachable, Grantable } from '@fy-stack/types';
|
|
2
|
+
import type { HttpRouteIntegration } from 'aws-cdk-lib/aws-apigatewayv2';
|
|
3
|
+
import { BehaviorOptions } from 'aws-cdk-lib/aws-cloudfront';
|
|
2
4
|
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
3
5
|
import { ITopicSubscription, SubscriptionProps } from 'aws-cdk-lib/aws-sns';
|
|
4
6
|
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
5
7
|
import { Construct } from 'constructs';
|
|
6
8
|
import { AppConstruct, AppProperties } from './types';
|
|
7
|
-
import { BehaviorOptions } from 'aws-cdk-lib/aws-cloudfront';
|
|
8
|
-
import type { HttpRouteIntegration } from 'aws-cdk-lib/aws-apigatewayv2';
|
|
9
9
|
export declare class NodeAppConstruct extends Construct implements AppConstruct {
|
|
10
10
|
function: lambda.Function;
|
|
11
11
|
queue: sqs.Queue | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-app-construct.d.ts","sourceRoot":"","sources":["../../src/lib/node-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"node-app-construct.d.ts","sourceRoot":"","sources":["../../src/lib/node-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAItD,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,YAAY;IAC9D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAExB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IA8B9D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB;IAO1D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAIzD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;CAGxD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Function } from 'aws-cdk-lib/aws-lambda';
|
|
2
1
|
import { HttpUrlIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
|
|
2
|
+
import { Function } from 'aws-cdk-lib/aws-lambda';
|
|
3
3
|
export declare function lambdaApi(func: Function, path: string): {
|
|
4
4
|
[x: string]: HttpUrlIntegration;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda-api.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/lambda-api.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"lambda-api.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/lambda-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAG,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM;;EAarD"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lambdaApi = lambdaApi;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const lambda = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda"));
|
|
6
5
|
const aws_apigatewayv2_integrations_1 = require("aws-cdk-lib/aws-apigatewayv2-integrations");
|
|
6
|
+
const lambda = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda"));
|
|
7
7
|
function lambdaApi(func, path) {
|
|
8
8
|
const apiUrl = func.addFunctionUrl({
|
|
9
9
|
authType: lambda.FunctionUrlAuthType.NONE,
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Attachable, Grantable } from '@fy-stack/types';
|
|
2
|
-
import type { HttpRouteIntegration } from 'aws-cdk-lib/aws-apigatewayv2';
|
|
3
|
-
import { BehaviorOptions } from 'aws-cdk-lib/aws-cloudfront';
|
|
4
|
-
import { Function } from 'aws-cdk-lib/aws-lambda';
|
|
5
|
-
import { ITopicSubscription, SubscriptionProps } from 'aws-cdk-lib/aws-sns';
|
|
6
|
-
import { Queue } from 'aws-cdk-lib/aws-sqs';
|
|
7
|
-
import { Construct } from 'constructs';
|
|
8
|
-
import { AppConstruct, AppProperties } from './types';
|
|
9
|
-
export declare class DenoApiConstruct extends Construct implements AppConstruct {
|
|
10
|
-
function: Function;
|
|
11
|
-
queue: Queue | undefined;
|
|
12
|
-
constructor(scope: Construct, id: string, props: AppProperties);
|
|
13
|
-
attach(attachable: Record<string, Attachable>): void;
|
|
14
|
-
grant(...grantables: Grantable[]): void;
|
|
15
|
-
subscription(props: SubscriptionProps): ITopicSubscription;
|
|
16
|
-
cloudfront(path: string): Record<string, BehaviorOptions>;
|
|
17
|
-
api(path: string): Record<string, HttpRouteIntegration>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=deno-api-construct.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deno-api-construct.d.ts","sourceRoot":"","sources":["../../src/lib/deno-api-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAG,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAEL,eAAe,EAKhB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAEL,QAAQ,EAIT,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAKtD,qBAAa,gBACX,SAAQ,SACR,YAAW,YAAY;IAEhB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;gBAEpB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IA2B9D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAIpD,KAAK,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI;IAIvC,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB;IAQ1D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAqBzD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;CAGxD"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DenoApiConstruct = void 0;
|
|
4
|
-
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
|
-
const aws_cloudfront_1 = require("aws-cdk-lib/aws-cloudfront");
|
|
6
|
-
const aws_cloudfront_origins_1 = require("aws-cdk-lib/aws-cloudfront-origins");
|
|
7
|
-
const aws_ecr_assets_1 = require("aws-cdk-lib/aws-ecr-assets");
|
|
8
|
-
const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
|
|
9
|
-
const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources");
|
|
10
|
-
const aws_sns_subscriptions_1 = require("aws-cdk-lib/aws-sns-subscriptions");
|
|
11
|
-
const aws_sqs_1 = require("aws-cdk-lib/aws-sqs");
|
|
12
|
-
const constructs_1 = require("constructs");
|
|
13
|
-
const lambda_attach_1 = require("./utils/lambda-attach");
|
|
14
|
-
const lambda_grant_1 = require("./utils/lambda-grant");
|
|
15
|
-
const lambda_api_1 = require("./utils/lambda-api");
|
|
16
|
-
class DenoApiConstruct extends constructs_1.Construct {
|
|
17
|
-
function;
|
|
18
|
-
queue;
|
|
19
|
-
constructor(scope, id, props) {
|
|
20
|
-
super(scope, id);
|
|
21
|
-
this.function = new aws_lambda_1.Function(this, `AppFunction`, {
|
|
22
|
-
memorySize: 512,
|
|
23
|
-
timeout: aws_cdk_lib_1.Duration.seconds(30),
|
|
24
|
-
code: aws_lambda_1.Code.fromAssetImage(props.output, {
|
|
25
|
-
file: props.buildPaths.dockerFile,
|
|
26
|
-
platform: aws_ecr_assets_1.Platform.LINUX_AMD64,
|
|
27
|
-
}),
|
|
28
|
-
handler: aws_lambda_1.Handler.FROM_IMAGE,
|
|
29
|
-
runtime: aws_lambda_1.Runtime.FROM_IMAGE,
|
|
30
|
-
});
|
|
31
|
-
if (props.queue) {
|
|
32
|
-
this.queue = new aws_sqs_1.Queue(this, 'AppQueue', {
|
|
33
|
-
visibilityTimeout: aws_cdk_lib_1.Duration.seconds(59),
|
|
34
|
-
});
|
|
35
|
-
this.function.addEventSource(new aws_lambda_event_sources_1.SqsEventSource(this.queue, {
|
|
36
|
-
batchSize: props.queue.batchSize,
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
attach(attachable) {
|
|
41
|
-
return (0, lambda_attach_1.lambdaAttach)(this.function, attachable);
|
|
42
|
-
}
|
|
43
|
-
grant(...grantables) {
|
|
44
|
-
return (0, lambda_grant_1.lambdaGrant)(this.function, grantables);
|
|
45
|
-
}
|
|
46
|
-
subscription(props) {
|
|
47
|
-
if (this.queue) {
|
|
48
|
-
return new aws_sns_subscriptions_1.SqsSubscription(this.queue, props);
|
|
49
|
-
}
|
|
50
|
-
return new aws_sns_subscriptions_1.LambdaSubscription(this.function, props);
|
|
51
|
-
}
|
|
52
|
-
cloudfront(path) {
|
|
53
|
-
this.function.addEnvironment('BASE_PATH', path);
|
|
54
|
-
const apiUrl = this.function.addFunctionUrl({
|
|
55
|
-
authType: aws_lambda_1.FunctionUrlAuthType.NONE,
|
|
56
|
-
});
|
|
57
|
-
const apiBehavior = {
|
|
58
|
-
origin: new aws_cloudfront_origins_1.FunctionUrlOrigin(apiUrl),
|
|
59
|
-
cachePolicy: aws_cloudfront_1.CachePolicy.CACHING_DISABLED,
|
|
60
|
-
allowedMethods: aws_cloudfront_1.AllowedMethods.ALLOW_ALL,
|
|
61
|
-
compress: true,
|
|
62
|
-
viewerProtocolPolicy: aws_cloudfront_1.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
63
|
-
originRequestPolicy: aws_cloudfront_1.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER,
|
|
64
|
-
responseHeadersPolicy: aws_cloudfront_1.ResponseHeadersPolicy.CORS_ALLOW_ALL_ORIGINS_WITH_PREFLIGHT_AND_SECURITY_HEADERS,
|
|
65
|
-
};
|
|
66
|
-
return { [`${path}/*`]: apiBehavior };
|
|
67
|
-
}
|
|
68
|
-
api(path) {
|
|
69
|
-
return (0, lambda_api_1.lambdaApi)(this.function, path);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.DenoApiConstruct = DenoApiConstruct;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Construct } from 'constructs';
|
|
2
|
-
import { NestConstruct } from './nest-construct';
|
|
3
|
-
import { AppProperties } from './types';
|
|
4
|
-
export declare class NestApiConstruct extends NestConstruct {
|
|
5
|
-
constructor(scope: Construct, id: string, props: AppProperties);
|
|
6
|
-
static clean(output: string, name: string, command: string): {
|
|
7
|
-
serverOutput: string;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=nest-api-construct.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nest-api-construct.d.ts","sourceRoot":"","sources":["../../src/lib/nest-api-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,qBAAa,gBAAiB,SAAQ,aAAa;gBACrC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;WAI9C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;CA0BpE"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NestApiConstruct = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const node_child_process_1 = tslib_1.__importDefault(require("node:child_process"));
|
|
6
|
-
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
7
|
-
const nest_construct_1 = require("./nest-construct");
|
|
8
|
-
class NestApiConstruct extends nest_construct_1.NestConstruct {
|
|
9
|
-
constructor(scope, id, props) {
|
|
10
|
-
super(scope, id, { ...props, webLayer: true });
|
|
11
|
-
}
|
|
12
|
-
static clean(output, name, command) {
|
|
13
|
-
const destination = `./dist/${name}`;
|
|
14
|
-
/** Delete previous cleaned files */
|
|
15
|
-
node_fs_1.default.rmSync(destination, { recursive: true, force: true });
|
|
16
|
-
/** Create server and static folders for deployment */
|
|
17
|
-
node_fs_1.default.mkdirSync(destination, { recursive: true });
|
|
18
|
-
/** copy compiled code to be deployed to the server */
|
|
19
|
-
node_fs_1.default.cpSync(output, destination, { recursive: true });
|
|
20
|
-
/** copy start command to script */
|
|
21
|
-
node_fs_1.default.writeFileSync(`${destination}/run.sh`, command);
|
|
22
|
-
console.log(node_child_process_1.default
|
|
23
|
-
.execSync(`npm ci`, {
|
|
24
|
-
stdio: 'pipe',
|
|
25
|
-
cwd: destination,
|
|
26
|
-
})
|
|
27
|
-
.toString());
|
|
28
|
-
return { serverOutput: destination };
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.NestApiConstruct = NestApiConstruct;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Attachable, Grantable } from '@fy-stack/types';
|
|
2
|
-
import * as cdk from 'aws-cdk-lib';
|
|
3
|
-
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
4
|
-
import { ITopicSubscription, SubscriptionProps } from 'aws-cdk-lib/aws-sns';
|
|
5
|
-
import * as sqs from 'aws-cdk-lib/aws-sqs';
|
|
6
|
-
import { Construct } from 'constructs';
|
|
7
|
-
import { AppConstruct, AppProperties } from './types';
|
|
8
|
-
interface Props extends AppProperties {
|
|
9
|
-
webLayer?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare class NestConstruct extends Construct implements AppConstruct {
|
|
12
|
-
function: lambda.Function;
|
|
13
|
-
queue: sqs.Queue | undefined;
|
|
14
|
-
constructor(scope: Construct, id: string, props: Props);
|
|
15
|
-
attach(attachable: Record<string, Attachable>): void;
|
|
16
|
-
grant(...grants: Grantable[]): void;
|
|
17
|
-
subscription(props: SubscriptionProps): ITopicSubscription;
|
|
18
|
-
cloudfront(path: string): {
|
|
19
|
-
[x: string]: {
|
|
20
|
-
origin: cdk.aws_cloudfront_origins.FunctionUrlOrigin;
|
|
21
|
-
cachePolicy: cdk.aws_cloudfront.ICachePolicy;
|
|
22
|
-
allowedMethods: cdk.aws_cloudfront.AllowedMethods;
|
|
23
|
-
compress: boolean;
|
|
24
|
-
viewerProtocolPolicy: cdk.aws_cloudfront.ViewerProtocolPolicy;
|
|
25
|
-
originRequestPolicy: cdk.aws_cloudfront.IOriginRequestPolicy;
|
|
26
|
-
responseHeadersPolicy: cdk.aws_cloudfront.IResponseHeadersPolicy;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
api(path: string): {
|
|
30
|
-
[x: string]: cdk.aws_apigatewayv2_integrations.HttpUrlIntegration;
|
|
31
|
-
};
|
|
32
|
-
static clean(output: string, name: string, command: string): {
|
|
33
|
-
serverOutput: string;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export {};
|
|
37
|
-
//# sourceMappingURL=nest-construct.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nest-construct.d.ts","sourceRoot":"","sources":["../../src/lib/nest-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAKtD,UAAU,KAAM,SAAQ,aAAa;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,aAAc,SAAQ,SAAU,YAAW,YAAY;IAC3D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAExB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;IAqDtD,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB;IAO1D,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;IAqBvB,GAAG,CAAC,IAAI,EAAE,MAAM;;;IAIhB,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;CAuB3D"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NestConstruct = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const child_process = tslib_1.__importStar(require("node:child_process"));
|
|
6
|
-
const fs = tslib_1.__importStar(require("node:fs"));
|
|
7
|
-
const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
|
|
8
|
-
const cloudfront = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront"));
|
|
9
|
-
const cloudfrontOrigin = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront-origins"));
|
|
10
|
-
const lambda = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda"));
|
|
11
|
-
const lambdaEventSource = tslib_1.__importStar(require("aws-cdk-lib/aws-lambda-event-sources"));
|
|
12
|
-
const snsSubscriptions = tslib_1.__importStar(require("aws-cdk-lib/aws-sns-subscriptions"));
|
|
13
|
-
const sqs = tslib_1.__importStar(require("aws-cdk-lib/aws-sqs"));
|
|
14
|
-
const constructs_1 = require("constructs");
|
|
15
|
-
const lambda_attach_1 = require("./utils/lambda-attach");
|
|
16
|
-
const lambda_grant_1 = require("./utils/lambda-grant");
|
|
17
|
-
const lambda_api_1 = require("./utils/lambda-api");
|
|
18
|
-
class NestConstruct extends constructs_1.Construct {
|
|
19
|
-
function;
|
|
20
|
-
queue;
|
|
21
|
-
constructor(scope, id, props) {
|
|
22
|
-
super(scope, id);
|
|
23
|
-
const region = cdk.Stack.of(this).region;
|
|
24
|
-
const { serverOutput } = props.buildPaths;
|
|
25
|
-
if (!serverOutput)
|
|
26
|
-
throw new Error('asset not found');
|
|
27
|
-
const environment = {};
|
|
28
|
-
Object.assign(environment, props.env);
|
|
29
|
-
const layers = [];
|
|
30
|
-
if (props.webLayer) {
|
|
31
|
-
layers.push(lambda.LayerVersion.fromLayerVersionArn(this, 'WebAdapterLayer', `arn:aws:lambda:${region}:753240598075:layer:LambdaAdapterLayerX86:16`));
|
|
32
|
-
Object.assign(environment, {
|
|
33
|
-
AWS_LAMBDA_EXEC_WRAPPER: '/opt/bootstrap',
|
|
34
|
-
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
|
|
35
|
-
PORT: '8080',
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
this.function = new lambda.Function(this, `AppFunction`, {
|
|
39
|
-
runtime: lambda.Runtime.NODEJS_20_X,
|
|
40
|
-
memorySize: 512,
|
|
41
|
-
handler: props.webLayer ? 'run.sh' : 'main.handler',
|
|
42
|
-
layers,
|
|
43
|
-
timeout: cdk.Duration.seconds(30),
|
|
44
|
-
code: lambda.Code.fromAsset(serverOutput),
|
|
45
|
-
environment,
|
|
46
|
-
});
|
|
47
|
-
if (props.queue) {
|
|
48
|
-
this.queue = new sqs.Queue(this, 'AppQueue', {
|
|
49
|
-
visibilityTimeout: cdk.Duration.seconds(59),
|
|
50
|
-
});
|
|
51
|
-
this.function.addEventSource(new lambdaEventSource.SqsEventSource(this.queue, {
|
|
52
|
-
batchSize: props.queue.batchSize,
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
attach(attachable) {
|
|
57
|
-
return (0, lambda_attach_1.lambdaAttach)(this.function, attachable);
|
|
58
|
-
}
|
|
59
|
-
grant(...grants) {
|
|
60
|
-
return (0, lambda_grant_1.lambdaGrant)(this.function, grants);
|
|
61
|
-
}
|
|
62
|
-
subscription(props) {
|
|
63
|
-
if (this.queue)
|
|
64
|
-
return new snsSubscriptions.SqsSubscription(this.queue, props);
|
|
65
|
-
return new snsSubscriptions.LambdaSubscription(this.function, props);
|
|
66
|
-
}
|
|
67
|
-
cloudfront(path) {
|
|
68
|
-
const apiUrl = this.function.addFunctionUrl({
|
|
69
|
-
authType: lambda.FunctionUrlAuthType.NONE,
|
|
70
|
-
});
|
|
71
|
-
const apiBehavior = {
|
|
72
|
-
origin: new cloudfrontOrigin.FunctionUrlOrigin(apiUrl),
|
|
73
|
-
cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED,
|
|
74
|
-
allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,
|
|
75
|
-
compress: true,
|
|
76
|
-
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
77
|
-
originRequestPolicy: cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER,
|
|
78
|
-
responseHeadersPolicy: cloudfront.ResponseHeadersPolicy
|
|
79
|
-
.CORS_ALLOW_ALL_ORIGINS_WITH_PREFLIGHT_AND_SECURITY_HEADERS,
|
|
80
|
-
};
|
|
81
|
-
return { [`${path}/*`]: apiBehavior };
|
|
82
|
-
}
|
|
83
|
-
api(path) {
|
|
84
|
-
return (0, lambda_api_1.lambdaApi)(this.function, path);
|
|
85
|
-
}
|
|
86
|
-
static clean(output, name, command) {
|
|
87
|
-
const destination = `./dist/${name}`;
|
|
88
|
-
/* Delete previous cleaned files */
|
|
89
|
-
fs.rmSync(destination, { recursive: true, force: true });
|
|
90
|
-
/* Create server and static folders for deployment */
|
|
91
|
-
fs.mkdirSync(destination, { recursive: true });
|
|
92
|
-
/* copy compiled code to be deployed to the server */
|
|
93
|
-
fs.cpSync(output, destination, { recursive: true });
|
|
94
|
-
console.log(child_process
|
|
95
|
-
.execSync(`npm ci`, {
|
|
96
|
-
stdio: 'pipe',
|
|
97
|
-
cwd: destination,
|
|
98
|
-
})
|
|
99
|
-
.toString());
|
|
100
|
-
return { serverOutput: destination };
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.NestConstruct = NestConstruct;
|