@anthusai/papyrus 5.21.0 → 5.22.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.
- package/amplify/data/schema.js +11 -25
- package/amplify/data/schema.ts +13 -26
- package/package.json +1 -1
- package/routes.manifest.json +1 -1
package/amplify/data/schema.js
CHANGED
|
@@ -2033,19 +2033,9 @@ export function baseModelNames(excludedGroups = []) {
|
|
|
2033
2033
|
return Object.keys(buildBaseDefinitions(!excludedGroups.includes("editions")));
|
|
2034
2034
|
}
|
|
2035
2035
|
const baseDefinitions = buildBaseDefinitions(true);
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
allow.resource(contentActions),
|
|
2040
|
-
allow.resource(manageUserRole),
|
|
2041
|
-
allow.resource(modelAttachmentUpload),
|
|
2042
|
-
allow.resource(newsroomSummary),
|
|
2043
|
-
allow.resource(procedureAction),
|
|
2044
|
-
allow.resource(publicForms).to(["mutate"]),
|
|
2045
|
-
]);
|
|
2046
|
-
/** The deployed schema of a site that enables plugins: the base definitions plus what each plugin contributes (docs/plugins.md). */
|
|
2047
|
-
export function schemaWithPlugins(pluginDefinitions) {
|
|
2048
|
-
return a.schema({ ...baseDefinitions, ...pluginDefinitions }).authorization((allow) => [
|
|
2036
|
+
/** Schema-level function grants shared by every deployed schema, with or without plugins, so none can drop one. */
|
|
2037
|
+
function functionGrants(allow) {
|
|
2038
|
+
return [
|
|
2049
2039
|
allow.resource(assignmentAction).to(["query", "mutate"]),
|
|
2050
2040
|
allow.resource(categoryAction),
|
|
2051
2041
|
allow.resource(contentActions),
|
|
@@ -2053,20 +2043,16 @@ export function schemaWithPlugins(pluginDefinitions) {
|
|
|
2053
2043
|
allow.resource(modelAttachmentUpload),
|
|
2054
2044
|
allow.resource(newsroomSummary),
|
|
2055
2045
|
allow.resource(procedureAction),
|
|
2056
|
-
|
|
2046
|
+
allow.resource(publicForms).to(["mutate"]),
|
|
2047
|
+
];
|
|
2048
|
+
}
|
|
2049
|
+
export const schema = a.schema(baseDefinitions).authorization(functionGrants);
|
|
2050
|
+
/** The deployed schema of a site that enables plugins: the base definitions plus what each plugin contributes (docs/plugins.md). */
|
|
2051
|
+
export function schemaWithPlugins(pluginDefinitions) {
|
|
2052
|
+
return a.schema({ ...baseDefinitions, ...pluginDefinitions }).authorization(functionGrants);
|
|
2057
2053
|
}
|
|
2058
2054
|
/** The schema of a site that leaves optional model groups out of its first deploy. */
|
|
2059
2055
|
export function schemaExcludingGroups(excludedGroups, pluginDefinitions = {}) {
|
|
2060
2056
|
const definitions = buildBaseDefinitions(!excludedGroups.includes("editions"));
|
|
2061
|
-
|
|
2062
|
-
return a.schema({ ...definitions, ...pluginDefinitions }).authorization((allow) => [
|
|
2063
|
-
allow.resource(assignmentAction).to(["query", "mutate"]),
|
|
2064
|
-
allow.resource(categoryAction),
|
|
2065
|
-
allow.resource(contentActions),
|
|
2066
|
-
allow.resource(manageUserRole),
|
|
2067
|
-
allow.resource(modelAttachmentUpload),
|
|
2068
|
-
allow.resource(newsroomSummary),
|
|
2069
|
-
allow.resource(procedureAction),
|
|
2070
|
-
...(hasPlugins ? [] : [allow.resource(publicForms).to(["mutate"])]),
|
|
2071
|
-
]);
|
|
2057
|
+
return a.schema({ ...definitions, ...pluginDefinitions }).authorization(functionGrants);
|
|
2072
2058
|
}
|
package/amplify/data/schema.ts
CHANGED
|
@@ -2159,20 +2159,9 @@ export function baseModelNames(excludedGroups: readonly OptionalModelGroup[] = [
|
|
|
2159
2159
|
|
|
2160
2160
|
const baseDefinitions = buildBaseDefinitions(true);
|
|
2161
2161
|
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
allow.resource(contentActions),
|
|
2166
|
-
allow.resource(manageUserRole),
|
|
2167
|
-
allow.resource(modelAttachmentUpload),
|
|
2168
|
-
allow.resource(newsroomSummary),
|
|
2169
|
-
allow.resource(procedureAction),
|
|
2170
|
-
allow.resource(publicForms).to(["mutate"]),
|
|
2171
|
-
]);
|
|
2172
|
-
|
|
2173
|
-
/** The deployed schema of a site that enables plugins: the base definitions plus what each plugin contributes (docs/plugins.md). */
|
|
2174
|
-
export function schemaWithPlugins(pluginDefinitions: Record<string, any>) {
|
|
2175
|
-
return a.schema({ ...baseDefinitions, ...pluginDefinitions } as typeof baseDefinitions).authorization((allow) => [
|
|
2162
|
+
/** Schema-level function grants shared by every deployed schema, with or without plugins, so none can drop one. */
|
|
2163
|
+
function functionGrants(allow: any) {
|
|
2164
|
+
return [
|
|
2176
2165
|
allow.resource(assignmentAction).to(["query", "mutate"]),
|
|
2177
2166
|
allow.resource(categoryAction),
|
|
2178
2167
|
allow.resource(contentActions),
|
|
@@ -2180,23 +2169,21 @@ export function schemaWithPlugins(pluginDefinitions: Record<string, any>) {
|
|
|
2180
2169
|
allow.resource(modelAttachmentUpload),
|
|
2181
2170
|
allow.resource(newsroomSummary),
|
|
2182
2171
|
allow.resource(procedureAction),
|
|
2183
|
-
|
|
2172
|
+
allow.resource(publicForms).to(["mutate"]),
|
|
2173
|
+
];
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
export const schema = a.schema(baseDefinitions).authorization(functionGrants);
|
|
2177
|
+
|
|
2178
|
+
/** The deployed schema of a site that enables plugins: the base definitions plus what each plugin contributes (docs/plugins.md). */
|
|
2179
|
+
export function schemaWithPlugins(pluginDefinitions: Record<string, any>) {
|
|
2180
|
+
return a.schema({ ...baseDefinitions, ...pluginDefinitions } as typeof baseDefinitions).authorization(functionGrants);
|
|
2184
2181
|
}
|
|
2185
2182
|
|
|
2186
2183
|
/** The schema of a site that leaves optional model groups out of its first deploy. */
|
|
2187
2184
|
export function schemaExcludingGroups(excludedGroups: readonly OptionalModelGroup[], pluginDefinitions: Record<string, any> = {}) {
|
|
2188
2185
|
const definitions = buildBaseDefinitions(!excludedGroups.includes("editions")) as unknown as typeof baseDefinitions;
|
|
2189
|
-
|
|
2190
|
-
return a.schema({ ...definitions, ...pluginDefinitions } as typeof baseDefinitions).authorization((allow) => [
|
|
2191
|
-
allow.resource(assignmentAction).to(["query", "mutate"]),
|
|
2192
|
-
allow.resource(categoryAction),
|
|
2193
|
-
allow.resource(contentActions),
|
|
2194
|
-
allow.resource(manageUserRole),
|
|
2195
|
-
allow.resource(modelAttachmentUpload),
|
|
2196
|
-
allow.resource(newsroomSummary),
|
|
2197
|
-
allow.resource(procedureAction),
|
|
2198
|
-
...(hasPlugins ? [] : [allow.resource(publicForms).to(["mutate"])]),
|
|
2199
|
-
]);
|
|
2186
|
+
return a.schema({ ...definitions, ...pluginDefinitions } as typeof baseDefinitions).authorization(functionGrants);
|
|
2200
2187
|
}
|
|
2201
2188
|
|
|
2202
2189
|
export type Schema = ClientSchema<typeof schema>;
|
package/package.json
CHANGED
package/routes.manifest.json
CHANGED