@flipboxlabs/aws-audit-cdk 1.1.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.
Files changed (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/dist/audit-config.d.ts +59 -0
  4. package/dist/audit-config.d.ts.map +1 -0
  5. package/dist/audit-config.js +27 -0
  6. package/dist/cloudwatch/construct.d.ts +20 -0
  7. package/dist/cloudwatch/construct.d.ts.map +1 -0
  8. package/dist/cloudwatch/construct.js +46 -0
  9. package/dist/cloudwatch/subscription.handler.d.ts +6 -0
  10. package/dist/cloudwatch/subscription.handler.d.ts.map +1 -0
  11. package/dist/cloudwatch/subscription.handler.js +34 -0
  12. package/dist/constants.d.ts +9 -0
  13. package/dist/constants.d.ts.map +1 -0
  14. package/dist/constants.js +1 -0
  15. package/dist/dynamodb/audit.d.ts +10 -0
  16. package/dist/dynamodb/audit.d.ts.map +1 -0
  17. package/dist/dynamodb/audit.js +114 -0
  18. package/dist/dynamodb/construct.d.ts +10 -0
  19. package/dist/dynamodb/construct.d.ts.map +1 -0
  20. package/dist/dynamodb/construct.js +10 -0
  21. package/dist/eventbridge/construct.d.ts +10 -0
  22. package/dist/eventbridge/construct.d.ts.map +1 -0
  23. package/dist/eventbridge/construct.js +13 -0
  24. package/dist/index.d.ts +53 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +52 -0
  27. package/dist/lib/index.d.ts +53 -0
  28. package/dist/lib/index.d.ts.map +1 -0
  29. package/dist/lib/index.js +52 -0
  30. package/dist/lib/nodejs.function.d.ts +6 -0
  31. package/dist/lib/nodejs.function.d.ts.map +1 -0
  32. package/dist/lib/nodejs.function.js +48 -0
  33. package/dist/rest-api/construct.d.ts +18 -0
  34. package/dist/rest-api/construct.d.ts.map +1 -0
  35. package/dist/rest-api/construct.js +34 -0
  36. package/dist/rest-api/index.d.ts +3 -0
  37. package/dist/rest-api/index.d.ts.map +1 -0
  38. package/dist/rest-api/index.js +2 -0
  39. package/dist/rest-api/resources/app/constants.d.ts +5 -0
  40. package/dist/rest-api/resources/app/constants.d.ts.map +1 -0
  41. package/dist/rest-api/resources/app/constants.js +4 -0
  42. package/dist/rest-api/resources/app/construct.d.ts +18 -0
  43. package/dist/rest-api/resources/app/construct.d.ts.map +1 -0
  44. package/dist/rest-api/resources/app/construct.js +18 -0
  45. package/dist/rest-api/resources/app/resources/objects/constants.d.ts +7 -0
  46. package/dist/rest-api/resources/app/resources/objects/constants.d.ts.map +1 -0
  47. package/dist/rest-api/resources/app/resources/objects/constants.js +6 -0
  48. package/dist/rest-api/resources/app/resources/objects/construct.d.ts +18 -0
  49. package/dist/rest-api/resources/app/resources/objects/construct.d.ts.map +1 -0
  50. package/dist/rest-api/resources/app/resources/objects/construct.js +48 -0
  51. package/dist/rest-api/resources/app/resources/objects/handler.d.ts +3 -0
  52. package/dist/rest-api/resources/app/resources/objects/handler.d.ts.map +1 -0
  53. package/dist/rest-api/resources/app/resources/objects/handler.js +40 -0
  54. package/dist/rest-api/resources/app/resources/objects/resources/rerun/constants.d.ts +4 -0
  55. package/dist/rest-api/resources/app/resources/objects/resources/rerun/constants.d.ts.map +1 -0
  56. package/dist/rest-api/resources/app/resources/objects/resources/rerun/constants.js +3 -0
  57. package/dist/rest-api/resources/app/resources/objects/resources/rerun/construct.d.ts +18 -0
  58. package/dist/rest-api/resources/app/resources/objects/resources/rerun/construct.d.ts.map +1 -0
  59. package/dist/rest-api/resources/app/resources/objects/resources/rerun/construct.js +38 -0
  60. package/dist/rest-api/resources/app/resources/objects/resources/rerun/handler.d.ts +3 -0
  61. package/dist/rest-api/resources/app/resources/objects/resources/rerun/handler.d.ts.map +1 -0
  62. package/dist/rest-api/resources/app/resources/objects/resources/rerun/handler.js +44 -0
  63. package/dist/rest-api/resources/app/resources/objects/resources/rerun/schema.d.ts +7 -0
  64. package/dist/rest-api/resources/app/resources/objects/resources/rerun/schema.d.ts.map +1 -0
  65. package/dist/rest-api/resources/app/resources/objects/resources/rerun/schema.js +10 -0
  66. package/dist/rest-api/resources/app/resources/objects/schema.d.ts +64 -0
  67. package/dist/rest-api/resources/app/resources/objects/schema.d.ts.map +1 -0
  68. package/dist/rest-api/resources/app/resources/objects/schema.js +16 -0
  69. package/dist/rest-api/resources/construct.d.ts +18 -0
  70. package/dist/rest-api/resources/construct.d.ts.map +1 -0
  71. package/dist/rest-api/resources/construct.js +10 -0
  72. package/dist/rest-api/resources/trace/constants.d.ts +4 -0
  73. package/dist/rest-api/resources/trace/constants.d.ts.map +1 -0
  74. package/dist/rest-api/resources/trace/constants.js +3 -0
  75. package/dist/rest-api/resources/trace/construct.d.ts +16 -0
  76. package/dist/rest-api/resources/trace/construct.d.ts.map +1 -0
  77. package/dist/rest-api/resources/trace/construct.js +38 -0
  78. package/dist/rest-api/resources/trace/handler.d.ts +3 -0
  79. package/dist/rest-api/resources/trace/handler.d.ts.map +1 -0
  80. package/dist/rest-api/resources/trace/handler.js +36 -0
  81. package/dist/rest-api/resources/trace/schema.d.ts +65 -0
  82. package/dist/rest-api/resources/trace/schema.d.ts.map +1 -0
  83. package/dist/rest-api/resources/trace/schema.js +14 -0
  84. package/dist/rest-api/utils.d.ts +7 -0
  85. package/dist/rest-api/utils.d.ts.map +1 -0
  86. package/dist/rest-api/utils.js +7 -0
  87. package/dist/test-config.d.ts +56 -0
  88. package/dist/test-config.d.ts.map +1 -0
  89. package/dist/test-config.js +24 -0
  90. package/package.json +102 -0
@@ -0,0 +1,18 @@
1
+ import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
2
+ import type * as apigateway from "aws-cdk-lib/aws-apigateway";
3
+ import type * as dynamodb from "aws-cdk-lib/aws-dynamodb";
4
+ import type * as events from "aws-cdk-lib/aws-events";
5
+ import { Construct } from "constructs";
6
+ interface Props {
7
+ config: CDKConfig;
8
+ table: dynamodb.ITable;
9
+ eventBus: events.IEventBus;
10
+ restApi: {
11
+ resource: apigateway.IResource;
12
+ };
13
+ }
14
+ export declare class RestApiResourcesConstruct extends Construct {
15
+ constructor(scope: Construct, id: string, props: Props);
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=construct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../src/rest-api/resources/construct.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,UAAU,KAAK;IACd,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAE/B,CAAC;CACF;AAED,qBAAa,yBAA0B,SAAQ,SAAS;gBAC3C,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAOtD"}
@@ -0,0 +1,10 @@
1
+ import { Construct } from "constructs";
2
+ import App from "./app/construct.js";
3
+ import Trace from "./trace/construct.js";
4
+ export class RestApiResourcesConstruct extends Construct {
5
+ constructor(scope, id, props) {
6
+ super(scope, id);
7
+ new Trace(this, "Trace", props);
8
+ new App(this, "App", props);
9
+ }
10
+ }
@@ -0,0 +1,4 @@
1
+ export declare const API_RESOURCE: {
2
+ RESOURCE: string;
3
+ };
4
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/rest-api/resources/trace/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;CAExB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export const API_RESOURCE = {
2
+ RESOURCE: "trace",
3
+ };
@@ -0,0 +1,16 @@
1
+ import type { CDKConfig } from "@flipboxlabs/aws-audit-cdk";
2
+ import * as apigateway from "aws-cdk-lib/aws-apigateway";
3
+ import type * as dynamodb from "aws-cdk-lib/aws-dynamodb";
4
+ import { Construct } from "constructs";
5
+ type Props = {
6
+ config: CDKConfig;
7
+ table: dynamodb.ITable;
8
+ restApi: {
9
+ resource: apigateway.IResource;
10
+ };
11
+ };
12
+ export default class extends Construct {
13
+ constructor(scope: Construct, id: string, props: Props);
14
+ }
15
+ export {};
16
+ //# sourceMappingURL=construct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../src/rest-api/resources/trace/construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,KAAK,QAAQ,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,KAAK,KAAK,GAAG;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,OAAO,EAAE;QACR,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAC/B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACzB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAwCtD"}
@@ -0,0 +1,38 @@
1
+ import * as url from "node:url";
2
+ import * as apigateway from "aws-cdk-lib/aws-apigateway";
3
+ import { Construct } from "constructs";
4
+ import { ESMNodeFunctionFactory } from "../../../lib/index.js";
5
+ import { API_RESOURCE } from "./constants.js";
6
+ export default class extends Construct {
7
+ constructor(scope, id, props) {
8
+ super(scope, id);
9
+ const ref = [
10
+ props.config.env.toUpperCase(),
11
+ "REST-API",
12
+ props.config.service,
13
+ "Trace",
14
+ ].join("-");
15
+ // Lambda
16
+ const lambda = ESMNodeFunctionFactory(props.config)(this, "NodeFunction", {
17
+ functionName: ref,
18
+ entry: url.fileURLToPath(new URL("handler.ts", import.meta.url).toString()),
19
+ currentVersionOptions: {
20
+ retryAttempts: 1,
21
+ },
22
+ });
23
+ // Logger / Metrics / Tracing
24
+ lambda.addEnvironment("POWERTOOLS_SERVICE_NAME", "Trace");
25
+ // DynamoDB
26
+ props.table.grantReadWriteData(lambda);
27
+ // Integration
28
+ const integration = new apigateway.LambdaIntegration(lambda);
29
+ const RESOURCE = props.restApi.resource
30
+ .addResource(API_RESOURCE.RESOURCE)
31
+ .addResource(`{${API_RESOURCE.RESOURCE}}`);
32
+ // /trace/{trace}
33
+ RESOURCE.addMethod("GET", integration, {
34
+ apiKeyRequired: true,
35
+ operationName: "Retrieve items by trace identifier",
36
+ });
37
+ }
38
+ }
@@ -0,0 +1,3 @@
1
+ import type { Context } from "aws-lambda";
2
+ export declare const handler: (event: unknown, context: Context) => Promise<unknown>;
3
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/rest-api/resources/trace/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAgD1C,eAAO,MAAM,OAAO,GACnB,OAAO,OAAO,EACd,SAAS,OAAO,KACd,OAAO,CAAC,OAAO,CAAgC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { Router } from "@aws-lambda-powertools/event-handler/http";
2
+ import { Logger } from "@aws-lambda-powertools/logger";
3
+ import { AuditService } from "@flipboxlabs/aws-audit-sdk";
4
+ import { auditConfig } from "../../../audit-config.js";
5
+ import { API_RESOURCE } from "./constants.js";
6
+ import { PathSchema, QuerySchema, ResponseSchema } from "./schema.js";
7
+ const logger = new Logger({
8
+ logRecordOrder: ["level", "message"],
9
+ });
10
+ const app = new Router();
11
+ const audits = new AuditService(logger, auditConfig);
12
+ app.get(`/${API_RESOURCE.RESOURCE}/:${API_RESOURCE.RESOURCE}`, async (reqCtx) => {
13
+ const { [API_RESOURCE.RESOURCE]: traceId } = reqCtx.valid.req.path;
14
+ const query = reqCtx.valid.req.query;
15
+ const pagination = query["pagination[pageSize]"] || query["pagination[nextToken]"]
16
+ ? {
17
+ pageSize: query["pagination[pageSize]"],
18
+ nextToken: query["pagination[nextToken]"],
19
+ }
20
+ : undefined;
21
+ return audits.listTraceItems({
22
+ trace: traceId,
23
+ app: query["filter[app]"],
24
+ }, pagination);
25
+ }, {
26
+ validation: {
27
+ req: {
28
+ path: PathSchema,
29
+ query: QuerySchema,
30
+ },
31
+ res: {
32
+ body: ResponseSchema,
33
+ },
34
+ },
35
+ });
36
+ export const handler = async (event, context) => app.resolve(event, context);
@@ -0,0 +1,65 @@
1
+ import { z } from "zod";
2
+ export declare const PathSchema: z.ZodObject<{
3
+ [x: string]: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export declare const QuerySchema: z.ZodObject<{
6
+ "pagination[pageSize]": z.ZodOptional<z.ZodCoercedNumber<unknown>>;
7
+ "pagination[nextToken]": z.ZodOptional<z.ZodString>;
8
+ "filter[app]": z.ZodOptional<z.ZodEnum<{
9
+ [x: string]: string;
10
+ }>>;
11
+ }, z.core.$strip>;
12
+ export declare const ResponseSchema: z.ZodObject<{
13
+ items: z.ZodArray<z.ZodObject<{
14
+ id: z.ZodString;
15
+ tenantId: z.ZodOptional<z.ZodString>;
16
+ status: z.ZodEnum<{
17
+ success: "success";
18
+ warn: "warn";
19
+ fail: "fail";
20
+ skip: "skip";
21
+ }>;
22
+ tier: z.ZodDefault<z.ZodNumber>;
23
+ target: z.ZodObject<{
24
+ app: z.ZodString;
25
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
26
+ type: z.ZodString;
27
+ }, z.core.$strip>;
28
+ source: z.ZodOptional<z.ZodObject<{
29
+ app: z.ZodString;
30
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
31
+ type: z.ZodString;
32
+ }, z.core.$strip>>;
33
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<string | number | boolean | {
34
+ [key: string]: string | number | boolean | /*elided*/ any;
35
+ }, unknown, z.core.$ZodTypeInternals<string | number | boolean | {
36
+ [key: string]: string | number | boolean | /*elided*/ any;
37
+ }, unknown>>>>;
38
+ operation: z.ZodString;
39
+ message: z.ZodOptional<z.ZodString>;
40
+ rerunable: z.ZodOptional<z.ZodBoolean>;
41
+ trace: z.ZodOptional<z.ZodString>;
42
+ event: z.ZodOptional<z.ZodObject<{
43
+ source: z.ZodOptional<z.ZodString>;
44
+ "detail-type": z.ZodOptional<z.ZodString>;
45
+ detail: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodTransform<string | undefined, string | Record<string, any> | undefined>>;
46
+ }, z.core.$strip>>;
47
+ error: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodPipe<z.ZodCustom<Error, Error>, z.ZodTransform<any, Error>>, z.ZodRecord<z.ZodAny, z.ZodAny>]>>;
48
+ attempts: z.ZodOptional<z.ZodArray<z.ZodObject<{
49
+ number: z.ZodNumber;
50
+ status: z.ZodEnum<{
51
+ success: "success";
52
+ warn: "warn";
53
+ fail: "fail";
54
+ skip: "skip";
55
+ }>;
56
+ error: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodPipe<z.ZodCustom<Error, Error>, z.ZodTransform<any, Error>>, z.ZodRecord<z.ZodAny, z.ZodAny>]>>;
57
+ at: z.ZodDefault<z.ZodPipe<z.ZodUnion<readonly [z.ZodISODateTime, z.ZodCustom<Date, Date>]>, z.ZodTransform<string, string | Date>>>;
58
+ }, z.core.$strip>>>;
59
+ }, z.core.$strip>>;
60
+ pagination: z.ZodOptional<z.ZodObject<{
61
+ pageSize: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
62
+ nextToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
+ }, z.core.$strip>>;
64
+ }, z.core.$strip>;
65
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/rest-api/resources/trace/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU;;iBAErB,CAAC;AAGH,eAAO,MAAM,WAAW;;;;;;iBAItB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAiD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { AuditPayloadSchema, PaginationCollectionSchema, } from "@flipboxlabs/aws-audit-sdk";
2
+ import { z } from "zod";
3
+ import { auditConfig } from "../../../audit-config.js";
4
+ import { API_RESOURCE } from "./constants.js";
5
+ export const PathSchema = z.object({
6
+ [API_RESOURCE.RESOURCE]: z.string(),
7
+ });
8
+ // Query params use flat keys matching API Gateway's bracket notation
9
+ export const QuerySchema = z.object({
10
+ "pagination[pageSize]": z.coerce.number().optional(),
11
+ "pagination[nextToken]": z.string().optional(),
12
+ "filter[app]": auditConfig.schemas.app.optional(),
13
+ });
14
+ export const ResponseSchema = PaginationCollectionSchema(AuditPayloadSchema);
@@ -0,0 +1,7 @@
1
+ import type { APIGatewayProxyEventQueryStringParameters } from "aws-lambda";
2
+ interface KeyValue {
3
+ [key: string]: unknown | undefined | string | string[] | KeyValue | KeyValue[];
4
+ }
5
+ export declare function extractNestedQueryStringParameters(params: APIGatewayProxyEventQueryStringParameters | null): KeyValue | null;
6
+ export {};
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/rest-api/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,YAAY,CAAC;AAG5E,UAAU,QAAQ;IACjB,CAAC,GAAG,EAAE,MAAM,GACT,OAAO,GACP,SAAS,GACT,MAAM,GACN,MAAM,EAAE,GACR,QAAQ,GACR,QAAQ,EAAE,CAAC;CACd;AAED,wBAAgB,kCAAkC,CACjD,MAAM,EAAE,yCAAyC,GAAG,IAAI,GACtD,QAAQ,GAAG,IAAI,CAMjB"}
@@ -0,0 +1,7 @@
1
+ import { parse } from "qs";
2
+ export function extractNestedQueryStringParameters(params) {
3
+ if (!params) {
4
+ return null;
5
+ }
6
+ return parse(params);
7
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Test configuration for CDK tests.
3
+ * Provides sample apps and resource types for testing.
4
+ */
5
+ export declare const testConfig: {
6
+ service: string | undefined;
7
+ } & {
8
+ readonly apps: readonly ["App1", "TestApp"];
9
+ readonly resourceTypes: readonly ["Unknown", "User", "Order"];
10
+ } & {
11
+ schemas: {
12
+ app: import("zod").ZodEnum<{
13
+ [x: string]: string;
14
+ }>;
15
+ resourceType: import("zod").ZodEnum<{
16
+ [x: string]: string;
17
+ }>;
18
+ resourceReference: import("zod").ZodObject<{
19
+ app: import("zod").ZodEnum<{
20
+ [x: string]: string;
21
+ }>;
22
+ type: import("zod").ZodEnum<{
23
+ [x: string]: string;
24
+ }>;
25
+ id: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>>;
26
+ }, import("zod/v4/core").$strip>;
27
+ };
28
+ _types: {
29
+ App: "App1" | "TestApp";
30
+ ResourceType: "Unknown" | "User" | "Order";
31
+ };
32
+ };
33
+ /**
34
+ * Type alias for the App union type from the test config.
35
+ */
36
+ export type App = (typeof testConfig)["_types"]["App"];
37
+ /**
38
+ * Type alias for the ResourceType union type from the test config.
39
+ */
40
+ export type ResourceType = (typeof testConfig)["_types"]["ResourceType"];
41
+ /**
42
+ * Enum-like object for App values in tests.
43
+ */
44
+ export declare const App: {
45
+ readonly App1: "App1";
46
+ readonly TestApp: "TestApp";
47
+ };
48
+ /**
49
+ * Enum-like object for ResourceType values in tests.
50
+ */
51
+ export declare const ResourceType: {
52
+ readonly UNKNOWN: "Unknown";
53
+ readonly USER: "User";
54
+ readonly ORDER: "Order";
55
+ };
56
+ //# sourceMappingURL=test-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-config.d.ts","sourceRoot":"","sources":["../src/test-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGrB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,GAAG;;;CAGN,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;CAIf,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { defineAuditConfig } from "@flipboxlabs/aws-audit-sdk";
2
+ /**
3
+ * Test configuration for CDK tests.
4
+ * Provides sample apps and resource types for testing.
5
+ */
6
+ export const testConfig = defineAuditConfig({
7
+ apps: ["App1", "TestApp"],
8
+ resourceTypes: ["Unknown", "User", "Order"],
9
+ });
10
+ /**
11
+ * Enum-like object for App values in tests.
12
+ */
13
+ export const App = {
14
+ App1: "App1",
15
+ TestApp: "TestApp",
16
+ };
17
+ /**
18
+ * Enum-like object for ResourceType values in tests.
19
+ */
20
+ export const ResourceType = {
21
+ UNKNOWN: "Unknown",
22
+ USER: "User",
23
+ ORDER: "Order",
24
+ };
package/package.json ADDED
@@ -0,0 +1,102 @@
1
+ {
2
+ "name": "@flipboxlabs/aws-audit-cdk",
3
+ "version": "1.1.0",
4
+ "description": "AWS Audit CDK - CDK constructs for AWS audit infrastructure",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ },
12
+ "./lib": {
13
+ "types": "./dist/lib/index.d.ts",
14
+ "import": "./dist/lib/index.js"
15
+ },
16
+ "./cloudwatch": {
17
+ "types": "./dist/cloudwatch/construct.d.ts",
18
+ "import": "./dist/cloudwatch/construct.js"
19
+ },
20
+ "./dynamodb": {
21
+ "types": "./dist/dynamodb/construct.d.ts",
22
+ "import": "./dist/dynamodb/construct.js"
23
+ },
24
+ "./eventbridge": {
25
+ "types": "./dist/eventbridge/construct.d.ts",
26
+ "import": "./dist/eventbridge/construct.js"
27
+ },
28
+ "./rest-api": {
29
+ "types": "./dist/rest-api/index.d.ts",
30
+ "import": "./dist/rest-api/index.js"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "README.md"
36
+ ],
37
+ "dependencies": {
38
+ "@aws-lambda-powertools/event-handler": "^2.32.0",
39
+ "@aws-lambda-powertools/jmespath": "^2.32.0",
40
+ "@aws-lambda-powertools/logger": "^2.32.0",
41
+ "@aws-sdk/client-eventbridge": "^3.750.0",
42
+ "@middy/core": "^6.4.5",
43
+ "qs": "^6.14.0",
44
+ "zod": "^4.0.0",
45
+ "@flipboxlabs/aws-audit-sdk": "^1.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@tsconfig/node22": "^22.0.1",
49
+ "@types/aws-lambda": "^8.10.156",
50
+ "@types/node": "^22.15.0",
51
+ "@types/qs": "^6.9.18",
52
+ "@vitest/coverage-v8": "^2.1.1",
53
+ "aws-cdk-lib": "2.135.0",
54
+ "constructs": "^10.3.0",
55
+ "esbuild": "^0.23.1",
56
+ "ts-node": "^10.9.2",
57
+ "typescript": "^5.9.3",
58
+ "vitest": "^2.1.1"
59
+ },
60
+ "engines": {
61
+ "node": ">=24"
62
+ },
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "git+https://github.com/flipboxlabs/aws-audit.git",
66
+ "directory": "cdk"
67
+ },
68
+ "bugs": {
69
+ "url": "https://github.com/flipboxlabs/aws-audit/issues"
70
+ },
71
+ "homepage": "https://github.com/flipboxlabs/aws-audit#readme",
72
+ "license": "MIT",
73
+ "keywords": [
74
+ "aws",
75
+ "audit",
76
+ "cdk",
77
+ "infrastructure",
78
+ "cloudwatch",
79
+ "dynamodb",
80
+ "eventbridge",
81
+ "serverless"
82
+ ],
83
+ "peerDependencies": {
84
+ "aws-cdk-lib": "^2.135.0",
85
+ "constructs": "^10.3.0"
86
+ },
87
+ "scripts": {
88
+ "build": "tsc -p ./tsconfig.build.json",
89
+ "check-types": "tsc --noEmit -p ./tsconfig.json",
90
+ "lint": "npx biome lint",
91
+ "lint:fix": "npx biome lint --fix",
92
+ "format": "npx biome format",
93
+ "format:fix": "npx biome format --fix",
94
+ "pre-commit": "pnpm run check-types && pnpm run format && pnpm run lint",
95
+ "test": "vitest run",
96
+ "test:watch": "vitest",
97
+ "test:coverage": "vitest run --coverage",
98
+ "cdk:synth": "cdk synth --app 'npx tsx bin/app.ts'",
99
+ "cdk:deploy": "cdk deploy --app 'npx tsx bin/app.ts' --require-approval never"
100
+ },
101
+ "types": "./dist/index.d.ts"
102
+ }