@flipboxlabs/aws-audit-cdk 1.3.0 → 1.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../../../src/rest-api/resources/app/resources/objects/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,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,2BAA2B;IAC3B,MAAM,EAAE;QACN,8CAA8C;QAC9C,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;KAChC,CAAC;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAChC,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACxB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CA4DvD"}
1
+ {"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../../../../src/rest-api/resources/app/resources/objects/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,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC;IAC3B,2BAA2B;IAC3B,MAAM,EAAE;QACN,8CAA8C;QAC9C,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;KAChC,CAAC;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,UAAU,CAAC,SAAS,CAAC;KAChC,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,OAAO,MAAO,SAAQ,SAAS;gBACxB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAkEvD"}
@@ -33,6 +33,11 @@ export default class extends Construct {
33
33
  .addResource(`{${API_RESOURCE.RESOURCE_WILDCARD}}`);
34
34
  const ITEM_RESOURCE = RESOURCE.addResource(`{${API_RESOURCE.RESOURCE_WILDCARD_ITEM}}`);
35
35
  const AUDIT_RESOURCE = ITEM_RESOURCE.addResource(`{${API_RESOURCE.RESOURCE_WILDCARD_ITEM_AUDIT}}`);
36
+ // /apps/{app}/objects/{object}
37
+ RESOURCE.addMethod("GET", integration, {
38
+ apiKeyRequired: true,
39
+ operationName: "List audit object items",
40
+ });
36
41
  // /apps/{app}/objects/{object}/{item}
37
42
  ITEM_RESOURCE.addMethod("GET", integration, {
38
43
  apiKeyRequired: true,
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../../../src/rest-api/resources/app/resources/objects/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAkG1C,eAAO,MAAM,OAAO,GAAU,OAAO,OAAO,EAAE,SAAS,OAAO,KAAG,OAAO,CAAC,OAAO,CACnD,CAAC"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../../../src/rest-api/resources/app/resources/objects/handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AA6I1C,eAAO,MAAM,OAAO,GAAU,OAAO,OAAO,EAAE,SAAS,OAAO,KAAG,OAAO,CAAC,OAAO,CACnD,CAAC"}
@@ -4,7 +4,7 @@ import { AuditService } from "@flipboxlabs/aws-audit-sdk";
4
4
  import { auditConfig } from "../../../../../audit-config.js";
5
5
  import { API_RESOURCE as BASE_API_RESOURCE } from "../../constants.js";
6
6
  import { API_RESOURCE } from "./constants.js";
7
- import { DetailPathSchema, ResponseDetailSchema, PathSchema, QuerySchema, ResponseCollectionSchema, } from "./schema.js";
7
+ import { DetailPathSchema, ObjectPathSchema, PathSchema, QuerySchema, ResponseCollectionSchema, ResponseDetailSchema, } from "./schema.js";
8
8
  import { ResponseValidationMiddleware } from "../../../../http/response-validation.js";
9
9
  const logger = new Logger({
10
10
  logRecordOrder: ["level", "message"],
@@ -12,6 +12,33 @@ const logger = new Logger({
12
12
  const app = new Router();
13
13
  app.use(ResponseValidationMiddleware());
14
14
  const audits = new AuditService(logger, auditConfig);
15
+ app.get(`/${BASE_API_RESOURCE.RESOURCE}/:${BASE_API_RESOURCE.RESOURCE_WILDCARD}/${API_RESOURCE.RESOURCE}/:${API_RESOURCE.RESOURCE_WILDCARD}`, async (reqCtx) => {
16
+ const { [BASE_API_RESOURCE.RESOURCE_WILDCARD]: appId, [API_RESOURCE.RESOURCE_WILDCARD]: objectType, } = reqCtx.valid.req.path;
17
+ const query = reqCtx.valid.req.query;
18
+ const pagination = query["pagination[pageSize]"] || query["pagination[nextToken]"]
19
+ ? {
20
+ pageSize: query["pagination[pageSize]"],
21
+ nextToken: query["pagination[nextToken]"],
22
+ }
23
+ : undefined;
24
+ const collection = await audits.listObjects({
25
+ resource: {
26
+ type: objectType,
27
+ },
28
+ app: appId,
29
+ }, pagination);
30
+ return Response.json(collection, { status: 200 });
31
+ }, {
32
+ validation: {
33
+ req: {
34
+ path: ObjectPathSchema,
35
+ query: QuerySchema,
36
+ },
37
+ res: {
38
+ body: ResponseCollectionSchema,
39
+ },
40
+ },
41
+ });
15
42
  app.get(`/${BASE_API_RESOURCE.RESOURCE}/:${BASE_API_RESOURCE.RESOURCE_WILDCARD}/${API_RESOURCE.RESOURCE}/:${API_RESOURCE.RESOURCE_WILDCARD}/:${API_RESOURCE.RESOURCE_WILDCARD_ITEM}`, async (reqCtx) => {
16
43
  const { [BASE_API_RESOURCE.RESOURCE_WILDCARD]: appId, [API_RESOURCE.RESOURCE_WILDCARD]: objectType, [API_RESOURCE.RESOURCE_WILDCARD_ITEM]: itemId, } = reqCtx.valid.req.path;
17
44
  const query = reqCtx.valid.req.query;
@@ -1,9 +1,12 @@
1
1
  import { z } from "zod";
2
- export declare const PathSchema: z.ZodObject<{
3
- [x: string]: z.ZodString | z.ZodEnum<{
2
+ export declare const ObjectPathSchema: z.ZodObject<{
3
+ [x: string]: z.ZodEnum<{
4
4
  [x: string]: string;
5
5
  }>;
6
6
  }, z.core.$strip>;
7
+ export declare const PathSchema: z.ZodObject<{
8
+ [x: string]: z.ZodString;
9
+ }, z.core.$strip>;
7
10
  export declare const DetailPathSchema: z.ZodObject<{
8
11
  [x: string]: z.ZodString;
9
12
  }, z.core.$strip>;
@@ -40,7 +43,7 @@ export declare const ResponseCollectionSchema: z.ZodObject<{
40
43
  [key: string]: string | number | boolean | /*elided*/ any;
41
44
  }, unknown>>>>;
42
45
  operation: z.ZodString;
43
- message: z.ZodOptional<z.ZodString>;
46
+ message: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>, z.ZodTransform<string | undefined, string | null | undefined>>;
44
47
  rerunable: z.ZodOptional<z.ZodBoolean>;
45
48
  trace: z.ZodOptional<z.ZodString>;
46
49
  event: z.ZodOptional<z.ZodObject<{
@@ -95,7 +98,7 @@ export declare const ResponseDetailSchema: z.ZodObject<{
95
98
  [key: string]: string | number | boolean | /*elided*/ any;
96
99
  }, unknown>>>>;
97
100
  operation: z.ZodString;
98
- message: z.ZodOptional<z.ZodString>;
101
+ message: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>, z.ZodTransform<string | undefined, string | null | undefined>>;
99
102
  rerunable: z.ZodOptional<z.ZodBoolean>;
100
103
  trace: z.ZodOptional<z.ZodString>;
101
104
  event: z.ZodOptional<z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../../src/rest-api/resources/app/resources/objects/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,UAAU;;;;iBAIrB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC;AAGH,eAAO,MAAM,WAAW;;;iBAGtB,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAiD,CAAC;AACvF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE3E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAqB,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../../src/rest-api/resources/app/resources/objects/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,gBAAgB;;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,UAAU;;iBAErB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAC;AAGH,eAAO,MAAM,WAAW;;;iBAGtB,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAiD,CAAC;AACvF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE3E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAqB,CAAC;AACvD,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -3,9 +3,11 @@ import { z } from "zod";
3
3
  import { auditConfig } from "../../../../../audit-config.js";
4
4
  import { API_RESOURCE as BASE_API_RESOURCE } from "../../constants.js";
5
5
  import { API_RESOURCE } from "./constants.js";
6
- export const PathSchema = z.object({
6
+ export const ObjectPathSchema = z.object({
7
7
  [BASE_API_RESOURCE.RESOURCE_WILDCARD]: auditConfig.schemas.app,
8
8
  [API_RESOURCE.RESOURCE_WILDCARD]: auditConfig.schemas.resourceType,
9
+ });
10
+ export const PathSchema = ObjectPathSchema.extend({
9
11
  [API_RESOURCE.RESOURCE_WILDCARD_ITEM]: z.string(),
10
12
  });
11
13
  export const DetailPathSchema = PathSchema.extend({
@@ -43,7 +43,7 @@ export declare const ResponseCollectionSchema: z.ZodObject<{
43
43
  [key: string]: string | number | boolean | /*elided*/ any;
44
44
  }, unknown>>>>;
45
45
  operation: z.ZodString;
46
- message: z.ZodOptional<z.ZodString>;
46
+ message: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>, z.ZodTransform<string | undefined, string | null | undefined>>;
47
47
  rerunable: z.ZodOptional<z.ZodBoolean>;
48
48
  trace: z.ZodOptional<z.ZodString>;
49
49
  event: z.ZodOptional<z.ZodObject<{
@@ -38,7 +38,7 @@ export declare const ResponseCollectionSchema: z.ZodObject<{
38
38
  [key: string]: string | number | boolean | /*elided*/ any;
39
39
  }, unknown>>>>;
40
40
  operation: z.ZodString;
41
- message: z.ZodOptional<z.ZodString>;
41
+ message: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>, z.ZodTransform<string | undefined, string | null | undefined>>;
42
42
  rerunable: z.ZodOptional<z.ZodBoolean>;
43
43
  trace: z.ZodOptional<z.ZodString>;
44
44
  event: z.ZodOptional<z.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipboxlabs/aws-audit-cdk",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "AWS Audit CDK - CDK constructs for AWS audit infrastructure",
5
5
  "keywords": [
6
6
  "audit",
@@ -62,7 +62,7 @@
62
62
  "@middy/core": "^6.4.5",
63
63
  "qs": "^6.14.0",
64
64
  "zod": "^4.0.0",
65
- "@flipboxlabs/aws-audit-sdk": "^1.4.0"
65
+ "@flipboxlabs/aws-audit-sdk": "^1.5.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@tsconfig/node22": "^22.0.1",