@anthusai/papyrus 2.0.0-next.75 → 2.0.0-next.77
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/amplify/data/function-handler.js +20 -0
- package/amplify/data/function-handler.ts +40 -0
- package/amplify/data/resource.js +62 -60
- package/amplify/data/resource.ts +62 -60
- package/amplify/data/schema.js +57 -56
- package/amplify/data/schema.ts +57 -56
- package/amplify/functions/automation-view/schema.js +3 -2
- package/amplify/functions/automation-view/schema.ts +3 -2
- package/amplify/functions/editorial-checks/schema.js +9 -8
- package/amplify/functions/editorial-checks/schema.ts +9 -8
- package/amplify/functions/monitoring-view/schema.js +2 -1
- package/amplify/functions/monitoring-view/schema.ts +2 -1
- package/amplify/plugins/newsletter/schema.js +2 -1
- package/amplify/plugins/newsletter/schema.ts +2 -1
- package/amplify/plugins/reader-steering/schema.js +4 -3
- package/amplify/plugins/reader-steering/schema.ts +4 -3
- package/amplify/plugins/signup/schema.js +2 -1
- package/amplify/plugins/signup/schema.ts +2 -1
- package/package.json +1 -1
- package/routes.manifest.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a } from "@aws-amplify/backend";
|
|
2
2
|
import { monitoringView } from "./resource";
|
|
3
|
+
import { functionHandler } from "../../data/function-handler";
|
|
3
4
|
|
|
4
5
|
const editors = ["editor", "admin"];
|
|
5
6
|
|
|
@@ -14,5 +15,5 @@ export const monitoringViewSchemaDefinitions = {
|
|
|
14
15
|
.arguments({ scope: a.string() })
|
|
15
16
|
.returns(a.json())
|
|
16
17
|
.authorization((allow) => [allow.groups(editors)])
|
|
17
|
-
.handler(
|
|
18
|
+
.handler(functionHandler("monitoringView", monitoringView)),
|
|
18
19
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a } from "@aws-amplify/backend";
|
|
2
2
|
import { newsletterOps } from "./ops/resource.js";
|
|
3
|
+
import { functionHandler } from "../../data/function-handler.js";
|
|
3
4
|
const staff = ["editor", "admin"];
|
|
4
5
|
const admins = ["admin"];
|
|
5
6
|
/** The newsroom's newsletter operations, all JSON in and out. The function checks the groups again from the identity claims. */
|
|
@@ -46,7 +47,7 @@ export const NEWSLETTER_OPERATION_GROUPS = {
|
|
|
46
47
|
* table, never readable through the content API. It adds fourteen operations for the newsroom's Newsletter panel.
|
|
47
48
|
*/
|
|
48
49
|
export function newsletterSchemaDefinitions() {
|
|
49
|
-
const handler =
|
|
50
|
+
const handler = functionHandler("newsletterOps", newsletterOps);
|
|
50
51
|
const query = (name) => a.query().arguments({ input: a.json() }).returns(a.json()).authorization((allow) => [allow.groups(NEWSLETTER_OPERATION_GROUPS[name])]).handler(handler);
|
|
51
52
|
const mutation = (name) => a.mutation().arguments({ input: a.json() }).returns(a.json()).authorization((allow) => [allow.groups(NEWSLETTER_OPERATION_GROUPS[name])]).handler(handler);
|
|
52
53
|
return {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a } from "@aws-amplify/backend";
|
|
2
2
|
import { newsletterOps } from "./ops/resource";
|
|
3
|
+
import { functionHandler } from "../../data/function-handler";
|
|
3
4
|
|
|
4
5
|
const staff = ["editor", "admin"];
|
|
5
6
|
const admins = ["admin"];
|
|
@@ -49,7 +50,7 @@ export const NEWSLETTER_OPERATION_GROUPS: Record<string, string[]> = {
|
|
|
49
50
|
* table, never readable through the content API. It adds fourteen operations for the newsroom's Newsletter panel.
|
|
50
51
|
*/
|
|
51
52
|
export function newsletterSchemaDefinitions(): Record<string, unknown> {
|
|
52
|
-
const handler =
|
|
53
|
+
const handler = functionHandler("newsletterOps", newsletterOps);
|
|
53
54
|
const query = (name: string) =>
|
|
54
55
|
a.query().arguments({ input: a.json() }).returns(a.json()).authorization((allow) => [allow.groups(NEWSLETTER_OPERATION_GROUPS[name])]).handler(handler);
|
|
55
56
|
const mutation = (name: string) =>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a } from "@aws-amplify/backend";
|
|
2
2
|
import { readerActions } from "./function/resource.js";
|
|
3
|
+
import { functionHandler } from "../../data/function-handler.js";
|
|
3
4
|
/**
|
|
4
5
|
* Staff and IAM only: no guest, API key or reader rule on any model. The reader-actions function writes the
|
|
5
6
|
* tables directly with its own role, and editors may list them; admins may delete. `id` is the lookup key:
|
|
@@ -170,7 +171,7 @@ export function readerSteeringSchemaDefinitions() {
|
|
|
170
171
|
})
|
|
171
172
|
.returns(a.ref("ProposalReceipt"))
|
|
172
173
|
.authorization((allow) => [allow.group("editor"), allow.group("admin")])
|
|
173
|
-
.handler(
|
|
174
|
+
.handler(functionHandler("readerActions", readerActions)),
|
|
174
175
|
transitionProposal: a
|
|
175
176
|
.mutation()
|
|
176
177
|
.arguments({
|
|
@@ -181,7 +182,7 @@ export function readerSteeringSchemaDefinitions() {
|
|
|
181
182
|
})
|
|
182
183
|
.returns(a.ref("ProposalReceipt"))
|
|
183
184
|
.authorization((allow) => [allow.group("editor"), allow.group("admin")])
|
|
184
|
-
.handler(
|
|
185
|
+
.handler(functionHandler("readerActions", readerActions)),
|
|
185
186
|
ModerationReceipt: a.customType({
|
|
186
187
|
status: a.string().required(),
|
|
187
188
|
id: a.string(),
|
|
@@ -199,6 +200,6 @@ export function readerSteeringSchemaDefinitions() {
|
|
|
199
200
|
})
|
|
200
201
|
.returns(a.ref("ModerationReceipt"))
|
|
201
202
|
.authorization((allow) => [allow.group("editor"), allow.group("admin")])
|
|
202
|
-
.handler(
|
|
203
|
+
.handler(functionHandler("readerActions", readerActions)),
|
|
203
204
|
};
|
|
204
205
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a } from "@aws-amplify/backend";
|
|
2
2
|
import { readerActions } from "./function/resource";
|
|
3
|
+
import { functionHandler } from "../../data/function-handler";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Staff and IAM only: no guest, API key or reader rule on any model. The reader-actions function writes the
|
|
@@ -172,7 +173,7 @@ export function readerSteeringSchemaDefinitions() {
|
|
|
172
173
|
})
|
|
173
174
|
.returns(a.ref("ProposalReceipt"))
|
|
174
175
|
.authorization((allow) => [allow.group("editor"), allow.group("admin")])
|
|
175
|
-
.handler(
|
|
176
|
+
.handler(functionHandler("readerActions", readerActions)),
|
|
176
177
|
transitionProposal: a
|
|
177
178
|
.mutation()
|
|
178
179
|
.arguments({
|
|
@@ -183,7 +184,7 @@ export function readerSteeringSchemaDefinitions() {
|
|
|
183
184
|
})
|
|
184
185
|
.returns(a.ref("ProposalReceipt"))
|
|
185
186
|
.authorization((allow) => [allow.group("editor"), allow.group("admin")])
|
|
186
|
-
.handler(
|
|
187
|
+
.handler(functionHandler("readerActions", readerActions)),
|
|
187
188
|
ModerationReceipt: a.customType({
|
|
188
189
|
status: a.string().required(),
|
|
189
190
|
id: a.string(),
|
|
@@ -201,6 +202,6 @@ export function readerSteeringSchemaDefinitions() {
|
|
|
201
202
|
})
|
|
202
203
|
.returns(a.ref("ModerationReceipt"))
|
|
203
204
|
.authorization((allow) => [allow.group("editor"), allow.group("admin")])
|
|
204
|
-
.handler(
|
|
205
|
+
.handler(functionHandler("readerActions", readerActions)),
|
|
205
206
|
};
|
|
206
207
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a } from "@aws-amplify/backend";
|
|
2
2
|
import { signupSubmit } from "./function/resource.js";
|
|
3
|
+
import { functionHandler } from "../../data/function-handler.js";
|
|
3
4
|
/**
|
|
4
5
|
* SignupEntry is never guest-readable and has no create rule for anyone: only the
|
|
5
6
|
* submitSignup function (IAM) writes it. Editors and admins list it; admins delete.
|
|
@@ -35,6 +36,6 @@ export function signupSchemaDefinitions() {
|
|
|
35
36
|
})
|
|
36
37
|
.returns(a.ref("SignupReceipt"))
|
|
37
38
|
.authorization((allow) => [allow.guest()])
|
|
38
|
-
.handler(
|
|
39
|
+
.handler(functionHandler("signupSubmit", signupSubmit)),
|
|
39
40
|
};
|
|
40
41
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a } from "@aws-amplify/backend";
|
|
2
2
|
import { signupSubmit } from "./function/resource";
|
|
3
|
+
import { functionHandler } from "../../data/function-handler";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* SignupEntry is never guest-readable and has no create rule for anyone: only the
|
|
@@ -36,6 +37,6 @@ export function signupSchemaDefinitions() {
|
|
|
36
37
|
})
|
|
37
38
|
.returns(a.ref("SignupReceipt"))
|
|
38
39
|
.authorization((allow) => [allow.guest()])
|
|
39
|
-
.handler(
|
|
40
|
+
.handler(functionHandler("signupSubmit", signupSubmit)),
|
|
40
41
|
};
|
|
41
42
|
}
|
package/package.json
CHANGED
package/routes.manifest.json
CHANGED