@xube/kit-aws-infrastructure 0.0.60 → 0.0.61
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/api/rest-api.d.ts +17 -0
- package/dist/api/rest-api.js +33 -0
- package/dist/cognito/pool.d.ts +18 -0
- package/dist/cognito/pool.js +37 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +17 -0
- package/package.json +4 -4
- package/src/api/rest-api.ts +48 -0
- package/src/cognito/pool.ts +52 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RestApi } from "aws-cdk-lib/aws-apigateway";
|
|
2
|
+
import { Construct } from "constructs";
|
|
3
|
+
import { CorsOptions, IAuthorizer, IDomainName } from "aws-cdk-lib/aws-apigateway";
|
|
4
|
+
import { ICertificate } from "aws-cdk-lib/aws-certificatemanager";
|
|
5
|
+
export interface XubeRestAPIProps {
|
|
6
|
+
name?: string;
|
|
7
|
+
domainName?: IDomainName;
|
|
8
|
+
certificate?: ICertificate;
|
|
9
|
+
authorizer?: IAuthorizer;
|
|
10
|
+
basePath?: string;
|
|
11
|
+
stage?: string;
|
|
12
|
+
corsOptions?: CorsOptions;
|
|
13
|
+
}
|
|
14
|
+
export declare class XubeRestAPI extends Construct {
|
|
15
|
+
restAPI: RestApi;
|
|
16
|
+
constructor(scope: Construct, id: string, props: XubeRestAPIProps);
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XubeRestAPI = void 0;
|
|
4
|
+
const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway");
|
|
5
|
+
const constructs_1 = require("constructs");
|
|
6
|
+
class XubeRestAPI extends constructs_1.Construct {
|
|
7
|
+
restAPI;
|
|
8
|
+
constructor(scope, id, props) {
|
|
9
|
+
super(scope, id);
|
|
10
|
+
this.restAPI = new aws_apigateway_1.RestApi(this, id + "-api", {
|
|
11
|
+
defaultCorsPreflightOptions: props.corsOptions ?? {
|
|
12
|
+
allowOrigins: ["*"],
|
|
13
|
+
allowCredentials: true,
|
|
14
|
+
allowHeaders: ["*"],
|
|
15
|
+
allowMethods: ["*"],
|
|
16
|
+
},
|
|
17
|
+
domainName: props.domainName &&
|
|
18
|
+
props.certificate && {
|
|
19
|
+
domainName: props.domainName.domainName,
|
|
20
|
+
certificate: props.certificate,
|
|
21
|
+
basePath: props.basePath ?? "webhooks",
|
|
22
|
+
},
|
|
23
|
+
restApiName: props.name,
|
|
24
|
+
defaultMethodOptions: {
|
|
25
|
+
authorizer: props.authorizer,
|
|
26
|
+
},
|
|
27
|
+
deployOptions: {
|
|
28
|
+
stageName: props.stage ?? "production",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.XubeRestAPI = XubeRestAPI;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PasswordPolicy, UserPool } from "aws-cdk-lib/aws-cognito";
|
|
2
|
+
import { IFunction } from "aws-cdk-lib/aws-lambda";
|
|
3
|
+
import { Construct } from "constructs";
|
|
4
|
+
export interface XubeUserPoolProps {
|
|
5
|
+
name: string;
|
|
6
|
+
verification: {
|
|
7
|
+
emailSubject: string;
|
|
8
|
+
};
|
|
9
|
+
autoVerify?: {
|
|
10
|
+
email: boolean;
|
|
11
|
+
};
|
|
12
|
+
passwordPolicy: PasswordPolicy;
|
|
13
|
+
presignup?: IFunction;
|
|
14
|
+
}
|
|
15
|
+
export declare class XubeUserPool extends Construct {
|
|
16
|
+
userPool: UserPool;
|
|
17
|
+
constructor(scope: Construct, id: string, props: XubeUserPoolProps);
|
|
18
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XubeUserPool = void 0;
|
|
4
|
+
const aws_cognito_1 = require("aws-cdk-lib/aws-cognito");
|
|
5
|
+
const constructs_1 = require("constructs");
|
|
6
|
+
class XubeUserPool extends constructs_1.Construct {
|
|
7
|
+
userPool;
|
|
8
|
+
constructor(scope, id, props) {
|
|
9
|
+
super(scope, id);
|
|
10
|
+
this.userPool = new aws_cognito_1.UserPool(this, id + "-pool", {
|
|
11
|
+
userPoolName: props.name,
|
|
12
|
+
userVerification: {
|
|
13
|
+
emailStyle: aws_cognito_1.VerificationEmailStyle.LINK,
|
|
14
|
+
emailSubject: props.verification.emailSubject,
|
|
15
|
+
},
|
|
16
|
+
autoVerify: props.autoVerify,
|
|
17
|
+
deviceTracking: {
|
|
18
|
+
challengeRequiredOnNewDevice: false,
|
|
19
|
+
deviceOnlyRememberedOnUserPrompt: false,
|
|
20
|
+
},
|
|
21
|
+
accountRecovery: aws_cognito_1.AccountRecovery.EMAIL_ONLY,
|
|
22
|
+
passwordPolicy: props.passwordPolicy,
|
|
23
|
+
selfSignUpEnabled: true,
|
|
24
|
+
signInAliases: {
|
|
25
|
+
email: true,
|
|
26
|
+
phone: false,
|
|
27
|
+
username: false,
|
|
28
|
+
preferredUsername: false,
|
|
29
|
+
},
|
|
30
|
+
signInCaseSensitive: false,
|
|
31
|
+
lambdaTriggers: {
|
|
32
|
+
preSignUp: props.presignup,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.XubeUserPool = XubeUserPool;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api/rest-api"), exports);
|
|
18
|
+
__exportStar(require("./cognito/pool"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xube/kit-aws-infrastructure",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.61",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"homepage": "https://github.com/XubeLtd/dev-kit#readme",
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/aws-lambda": "^8.10.119",
|
|
21
|
-
"@xube/kit-build": "^0.0.
|
|
21
|
+
"@xube/kit-build": "^0.0.61",
|
|
22
22
|
"aws-cdk": "^2.100.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@xube/kit-log": "^0.0.
|
|
26
|
-
"@xube/kit-request": "^0.0.
|
|
25
|
+
"@xube/kit-log": "^0.0.61",
|
|
26
|
+
"@xube/kit-request": "^0.0.61",
|
|
27
27
|
"aws-cdk-lib": "^2.100.0",
|
|
28
28
|
"aws-lambda": "^1.0.7",
|
|
29
29
|
"constructs": "^10.3.0"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { RestApi } from "aws-cdk-lib/aws-apigateway";
|
|
2
|
+
import { Construct } from "constructs";
|
|
3
|
+
import {
|
|
4
|
+
CorsOptions,
|
|
5
|
+
IAuthorizer,
|
|
6
|
+
IDomainName,
|
|
7
|
+
} from "aws-cdk-lib/aws-apigateway";
|
|
8
|
+
import { ICertificate } from "aws-cdk-lib/aws-certificatemanager";
|
|
9
|
+
|
|
10
|
+
export interface XubeRestAPIProps {
|
|
11
|
+
name?: string;
|
|
12
|
+
domainName?: IDomainName;
|
|
13
|
+
certificate?: ICertificate;
|
|
14
|
+
authorizer?: IAuthorizer;
|
|
15
|
+
basePath?: string;
|
|
16
|
+
stage?: string;
|
|
17
|
+
corsOptions?: CorsOptions;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class XubeRestAPI extends Construct {
|
|
21
|
+
restAPI: RestApi;
|
|
22
|
+
|
|
23
|
+
constructor(scope: Construct, id: string, props: XubeRestAPIProps) {
|
|
24
|
+
super(scope, id);
|
|
25
|
+
|
|
26
|
+
this.restAPI = new RestApi(this, id + "-api", {
|
|
27
|
+
defaultCorsPreflightOptions: props.corsOptions ?? {
|
|
28
|
+
allowOrigins: ["*"],
|
|
29
|
+
allowCredentials: true,
|
|
30
|
+
allowHeaders: ["*"],
|
|
31
|
+
allowMethods: ["*"],
|
|
32
|
+
},
|
|
33
|
+
domainName: props.domainName &&
|
|
34
|
+
props.certificate && {
|
|
35
|
+
domainName: props.domainName.domainName,
|
|
36
|
+
certificate: props.certificate,
|
|
37
|
+
basePath: props.basePath ?? "webhooks",
|
|
38
|
+
},
|
|
39
|
+
restApiName: props.name,
|
|
40
|
+
defaultMethodOptions: {
|
|
41
|
+
authorizer: props.authorizer,
|
|
42
|
+
},
|
|
43
|
+
deployOptions: {
|
|
44
|
+
stageName: props.stage ?? "production",
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AccountRecovery,
|
|
3
|
+
PasswordPolicy,
|
|
4
|
+
UserPool,
|
|
5
|
+
VerificationEmailStyle,
|
|
6
|
+
} from "aws-cdk-lib/aws-cognito";
|
|
7
|
+
import { IFunction } from "aws-cdk-lib/aws-lambda";
|
|
8
|
+
import { Construct } from "constructs";
|
|
9
|
+
|
|
10
|
+
export interface XubeUserPoolProps {
|
|
11
|
+
name: string;
|
|
12
|
+
verification: {
|
|
13
|
+
emailSubject: string;
|
|
14
|
+
};
|
|
15
|
+
autoVerify?: {
|
|
16
|
+
email: boolean;
|
|
17
|
+
};
|
|
18
|
+
passwordPolicy: PasswordPolicy;
|
|
19
|
+
presignup?: IFunction;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class XubeUserPool extends Construct {
|
|
23
|
+
userPool: UserPool;
|
|
24
|
+
constructor(scope: Construct, id: string, props: XubeUserPoolProps) {
|
|
25
|
+
super(scope, id);
|
|
26
|
+
this.userPool = new UserPool(this, id + "-pool", {
|
|
27
|
+
userPoolName: props.name,
|
|
28
|
+
userVerification: {
|
|
29
|
+
emailStyle: VerificationEmailStyle.LINK,
|
|
30
|
+
emailSubject: props.verification.emailSubject,
|
|
31
|
+
},
|
|
32
|
+
autoVerify: props.autoVerify,
|
|
33
|
+
deviceTracking: {
|
|
34
|
+
challengeRequiredOnNewDevice: false,
|
|
35
|
+
deviceOnlyRememberedOnUserPrompt: false,
|
|
36
|
+
},
|
|
37
|
+
accountRecovery: AccountRecovery.EMAIL_ONLY,
|
|
38
|
+
passwordPolicy: props.passwordPolicy,
|
|
39
|
+
selfSignUpEnabled: true,
|
|
40
|
+
signInAliases: {
|
|
41
|
+
email: true,
|
|
42
|
+
phone: false,
|
|
43
|
+
username: false,
|
|
44
|
+
preferredUsername: false,
|
|
45
|
+
},
|
|
46
|
+
signInCaseSensitive: false,
|
|
47
|
+
lambdaTriggers: {
|
|
48
|
+
preSignUp: props.presignup,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
package/src/index.ts
CHANGED