@anthusai/papyrus 2.0.0-next.8 → 2.0.0-next.9

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.
@@ -71,21 +71,18 @@ export function scopeAssignmentDataAccess(lambda, graphqlApiArn) {
71
71
  if (!roles?.some((role) => JSON.stringify(role) === JSON.stringify(stack.resolve(roleName))))
72
72
  return;
73
73
  const document = stack.resolve(node.policyDocument);
74
- node.policyDocument = {
75
- ...document,
76
- Statement: document.Statement.map((statement) => {
77
- const actions = Array.isArray(statement.Action) ? statement.Action : [statement.Action];
78
- if (actions.includes("*") || actions.includes("appsync:*")) {
79
- throw new Error("Unexpected wildcard assignment action; review permissions before synthesis.");
80
- }
81
- if (!actions.includes("appsync:GraphQL"))
82
- return statement;
83
- if (statement.Effect !== "Allow" || actions.length !== 1 || statement.NotResource) {
84
- throw new Error("Unexpected assignment GraphQL policy; review field scoping before synthesis.");
85
- }
86
- return { ...statement, Resource: resources };
87
- }),
88
- };
74
+ document.Statement.forEach((statement, index) => {
75
+ const actions = Array.isArray(statement.Action) ? statement.Action : [statement.Action];
76
+ if (actions.includes("*") || actions.includes("appsync:*")) {
77
+ throw new Error("Unexpected wildcard assignment action; review permissions before synthesis.");
78
+ }
79
+ if (!actions.includes("appsync:GraphQL"))
80
+ return;
81
+ if (statement.Effect !== "Allow" || actions.length !== 1 || statement.NotResource) {
82
+ throw new Error("Unexpected assignment GraphQL policy; review field scoping before synthesis.");
83
+ }
84
+ node.addPropertyOverride(`PolicyDocument.Statement.${index}.Resource`, resources);
85
+ });
89
86
  },
90
87
  });
91
88
  }
@@ -71,20 +71,17 @@ export function scopeAssignmentDataAccess(lambda: IFunction, graphqlApiArn: stri
71
71
  const roles = stack.resolve(node.roles) as unknown[] | undefined;
72
72
  if (!roles?.some((role) => JSON.stringify(role) === JSON.stringify(stack.resolve(roleName)))) return;
73
73
  const document = stack.resolve(node.policyDocument) as { Statement: Array<Record<string, unknown>> };
74
- node.policyDocument = {
75
- ...document,
76
- Statement: document.Statement.map((statement) => {
77
- const actions = Array.isArray(statement.Action) ? statement.Action : [statement.Action];
78
- if (actions.includes("*") || actions.includes("appsync:*")) {
79
- throw new Error("Unexpected wildcard assignment action; review permissions before synthesis.");
80
- }
81
- if (!actions.includes("appsync:GraphQL")) return statement;
82
- if (statement.Effect !== "Allow" || actions.length !== 1 || statement.NotResource) {
83
- throw new Error("Unexpected assignment GraphQL policy; review field scoping before synthesis.");
84
- }
85
- return { ...statement, Resource: resources };
86
- }),
87
- };
74
+ document.Statement.forEach((statement, index) => {
75
+ const actions = Array.isArray(statement.Action) ? statement.Action : [statement.Action];
76
+ if (actions.includes("*") || actions.includes("appsync:*")) {
77
+ throw new Error("Unexpected wildcard assignment action; review permissions before synthesis.");
78
+ }
79
+ if (!actions.includes("appsync:GraphQL")) return;
80
+ if (statement.Effect !== "Allow" || actions.length !== 1 || statement.NotResource) {
81
+ throw new Error("Unexpected assignment GraphQL policy; review field scoping before synthesis.");
82
+ }
83
+ node.addPropertyOverride(`PolicyDocument.Statement.${index}.Resource`, resources);
84
+ });
88
85
  },
89
86
  });
90
87
  }
package/package.json CHANGED
@@ -395,7 +395,7 @@
395
395
  "optional": true
396
396
  }
397
397
  },
398
- "version": "2.0.0-next.8",
398
+ "version": "2.0.0-next.9",
399
399
  "dependencies": {
400
400
  "@aws-amplify/adapter-nextjs": "^1.7.3",
401
401
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0-next.8",
2
+ "version": "2.0.0-next.9",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",