@anthusai/papyrus 0.0.0 → 1.0.0-next.10

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 (282) hide show
  1. package/LICENSE +21 -0
  2. package/amplify/auth/resource.js +61 -0
  3. package/amplify/auth/resource.ts +65 -0
  4. package/amplify/data/resource.js +2069 -0
  5. package/amplify/data/resource.ts +2185 -0
  6. package/amplify/data/schema.js +1882 -0
  7. package/amplify/data/schema.ts +1990 -0
  8. package/amplify/functions/assignment-action/handler.ts +1416 -0
  9. package/amplify/functions/assignment-action/resource.js +8 -0
  10. package/amplify/functions/assignment-action/resource.ts +9 -0
  11. package/amplify/functions/category-action/handler.ts +2259 -0
  12. package/amplify/functions/category-action/resource.js +8 -0
  13. package/amplify/functions/category-action/resource.ts +9 -0
  14. package/amplify/functions/console-chat-responder/Cargo.lock +3456 -0
  15. package/amplify/functions/console-chat-responder/Cargo.toml +26 -0
  16. package/amplify/functions/console-chat-responder/Dockerfile +19 -0
  17. package/amplify/functions/console-chat-responder/py/execute_tactus_runner.py +116 -0
  18. package/amplify/functions/console-chat-responder/resource.js +153 -0
  19. package/amplify/functions/console-chat-responder/resource.ts +179 -0
  20. package/amplify/functions/console-chat-responder/src/main.rs +3242 -0
  21. package/amplify/functions/content-actions/handler.py +149 -0
  22. package/amplify/functions/content-actions/requirements.txt +4 -0
  23. package/amplify/functions/content-actions/resource.js +40 -0
  24. package/amplify/functions/content-actions/resource.ts +54 -0
  25. package/amplify/functions/email-submission-processor/handler.py +46 -0
  26. package/amplify/functions/email-submission-processor/requirements.txt +2 -0
  27. package/amplify/functions/email-submission-processor/resource.js +56 -0
  28. package/amplify/functions/email-submission-processor/resource.ts +69 -0
  29. package/amplify/functions/graphql-jwt-authorizer/handler.ts +193 -0
  30. package/amplify/functions/graphql-jwt-authorizer/resource.js +14 -0
  31. package/amplify/functions/graphql-jwt-authorizer/resource.ts +15 -0
  32. package/amplify/functions/knowledge-query/handler.py +1 -0
  33. package/amplify/functions/knowledge-query/requirements.txt +3 -0
  34. package/amplify/functions/knowledge-query/resource.js +50 -0
  35. package/amplify/functions/knowledge-query/resource.ts +61 -0
  36. package/amplify/functions/manage-user-role/handler.ts +799 -0
  37. package/amplify/functions/manage-user-role/resource.js +8 -0
  38. package/amplify/functions/manage-user-role/resource.ts +9 -0
  39. package/amplify/functions/model-attachment-upload/handler.ts +387 -0
  40. package/amplify/functions/model-attachment-upload/resource.js +8 -0
  41. package/amplify/functions/model-attachment-upload/resource.ts +9 -0
  42. package/amplify/functions/newsroom-summary/handler.ts +321 -0
  43. package/amplify/functions/newsroom-summary/resource.js +8 -0
  44. package/amplify/functions/newsroom-summary/resource.ts +9 -0
  45. package/amplify/functions/procedure-action/handler.ts +621 -0
  46. package/amplify/functions/procedure-action/resource.js +8 -0
  47. package/amplify/functions/procedure-action/resource.ts +9 -0
  48. package/amplify/functions/reader-settings/handler.ts +322 -0
  49. package/amplify/functions/reader-settings/resource.js +8 -0
  50. package/amplify/functions/reader-settings/resource.ts +9 -0
  51. package/amplify/functions/ses-inbound-receive/handler.ts +493 -0
  52. package/amplify/functions/ses-inbound-receive/resource.js +8 -0
  53. package/amplify/functions/ses-inbound-receive/resource.ts +9 -0
  54. package/amplify/functions/shared/amplify-secrets.ts +65 -0
  55. package/amplify/functions/shared/console-chat-enqueue.ts +117 -0
  56. package/amplify/functions/shared/email-mime-intake.ts +196 -0
  57. package/amplify/functions/shared/email-submission.ts +415 -0
  58. package/amplify/functions/shared/inbound-email-intake.ts +37 -0
  59. package/amplify/functions/shared/lambda-data-client.ts +21 -0
  60. package/amplify/functions/shared/model-payloads.ts +186 -0
  61. package/amplify/functions/shared/python-bundle.js +130 -0
  62. package/amplify/functions/shared/python-bundle.ts +162 -0
  63. package/amplify/functions/shared/slack-events.ts +111 -0
  64. package/amplify/functions/slack-delivery/handler.py +112 -0
  65. package/amplify/functions/slack-delivery/requirements.txt +2 -0
  66. package/amplify/functions/slack-delivery/resource.js +38 -0
  67. package/amplify/functions/slack-delivery/resource.ts +51 -0
  68. package/amplify/functions/slack-events/handler.ts +155 -0
  69. package/amplify/functions/slack-events/resource.js +11 -0
  70. package/amplify/functions/slack-events/resource.ts +12 -0
  71. package/amplify/inbound-email/stack.js +46 -0
  72. package/amplify/inbound-email/stack.ts +61 -0
  73. package/amplify/package.json +3 -0
  74. package/amplify/rebuild-trigger-settings.js +22 -0
  75. package/amplify/rebuild-trigger-settings.ts +42 -0
  76. package/amplify/site-backend-config.js +1 -0
  77. package/amplify/site-backend-config.ts +36 -0
  78. package/amplify/site-backend.js +615 -0
  79. package/amplify/site-backend.ts +739 -0
  80. package/amplify/storage/resource.js +21 -0
  81. package/amplify/storage/resource.ts +22 -0
  82. package/app/%5F_preview/[[...path]]/route.ts +8 -0
  83. package/app/[year]/[month]/[day]/[articleSlug]/page.tsx +62 -0
  84. package/app/[year]/[month]/[day]/edition-route-page.tsx +53 -0
  85. package/app/[year]/[month]/[day]/page/[pageNumber]/page.tsx +32 -0
  86. package/app/[year]/[month]/[day]/page.tsx +22 -0
  87. package/app/[year]/[month]/[day]/section/[sectionKey]/page.tsx +32 -0
  88. package/app/api/archive/editions/route.ts +18 -0
  89. package/app/api/media/[...path]/route.ts +35 -0
  90. package/app/api/revalidate/route.ts +94 -0
  91. package/app/archive/page.tsx +24 -0
  92. package/app/articles/[slug]/page.tsx +35 -0
  93. package/app/globals.css +10345 -0
  94. package/app/layout.tsx +142 -0
  95. package/app/newsroom/[section]/[...selection]/page.tsx +50 -0
  96. package/app/newsroom/[section]/page.tsx +47 -0
  97. package/app/newsroom/articles/[id]/page.tsx +15 -0
  98. package/app/newsroom/articles/page.tsx +13 -0
  99. package/app/newsroom/forum/[threadId]/page.tsx +35 -0
  100. package/app/newsroom/insights/[threadId]/page.tsx +22 -0
  101. package/app/newsroom/insights/page.tsx +14 -0
  102. package/app/newsroom/layout.tsx +12 -0
  103. package/app/newsroom/page.tsx +31 -0
  104. package/app/newsroom/sections/[sectionId]/page.tsx +17 -0
  105. package/app/page.tsx +272 -0
  106. package/app/papyrus-theme.css +11 -0
  107. package/app/robots.ts +11 -0
  108. package/app/settings/page.tsx +14 -0
  109. package/app/tailwind.css +65 -0
  110. package/bin/papyrus-app.mjs +20 -0
  111. package/bin/papyrus-infra.mjs +95 -0
  112. package/components/ai-elements/conversation.tsx +168 -0
  113. package/components/ai-elements/message.tsx +360 -0
  114. package/components/ai-elements/model-selector.tsx +30 -0
  115. package/components/ai-elements/prompt-input.tsx +1461 -0
  116. package/components/ai-elements/shimmer.tsx +76 -0
  117. package/components/ai-elements/suggestion.tsx +54 -0
  118. package/components/ai-elements/tool.tsx +173 -0
  119. package/components/amplify-client-provider.tsx +140 -0
  120. package/components/archive-grid.tsx +89 -0
  121. package/components/archive-shell.tsx +41 -0
  122. package/components/article-video.tsx +156 -0
  123. package/components/blog-page-background.tsx +20 -0
  124. package/components/dev-sandbox-editor-sign-in.tsx +60 -0
  125. package/components/markus-ir-preview.tsx +300 -0
  126. package/components/news-desk-client-provider.tsx +211 -0
  127. package/components/news-desk-page.tsx +116 -0
  128. package/components/news-desk-taxonomy-client.ts +3684 -0
  129. package/components/newspaper.tsx +1929 -0
  130. package/components/newsroom-access-gate.tsx +66 -0
  131. package/components/newsroom-article-editor.tsx +741 -0
  132. package/components/newsroom-articles-view.tsx +129 -0
  133. package/components/newsroom-assignments-view.tsx +664 -0
  134. package/components/newsroom-ops-overview.tsx +226 -0
  135. package/components/newsroom-ops-shell.tsx +321 -0
  136. package/components/newsroom-references-view.tsx +598 -0
  137. package/components/newsroom-topics-view.tsx +425 -0
  138. package/components/papyrus-console-shell.tsx +1912 -0
  139. package/components/pictogram-figure.tsx +65 -0
  140. package/components/presentation-footer.tsx +146 -0
  141. package/components/reader-auth-control.tsx +162 -0
  142. package/components/reader-auth-state.ts +122 -0
  143. package/components/reader-settings.ts +332 -0
  144. package/components/reader-theme-control.tsx +85 -0
  145. package/components/reference-source-preview.tsx +163 -0
  146. package/components/settings-page.tsx +239 -0
  147. package/components/staging-banner.tsx +11 -0
  148. package/components/topic-steering-workspace.tsx +18005 -0
  149. package/components/ui/badge.tsx +30 -0
  150. package/components/ui/button-group.tsx +87 -0
  151. package/components/ui/button.tsx +58 -0
  152. package/components/ui/card.tsx +32 -0
  153. package/components/ui/command.tsx +194 -0
  154. package/components/ui/dialog.tsx +158 -0
  155. package/components/ui/dropdown-menu.tsx +266 -0
  156. package/components/ui/hover-card.tsx +51 -0
  157. package/components/ui/input-group.tsx +158 -0
  158. package/components/ui/input.tsx +20 -0
  159. package/components/ui/scroll-area.tsx +16 -0
  160. package/components/ui/select.tsx +199 -0
  161. package/components/ui/separator.tsx +23 -0
  162. package/components/ui/sheet.tsx +92 -0
  163. package/components/ui/spinner.tsx +10 -0
  164. package/components/ui/tabs.tsx +113 -0
  165. package/components/ui/textarea.tsx +18 -0
  166. package/components/ui/tooltip.tsx +66 -0
  167. package/components/use-resolved-papyrus-theme.ts +47 -0
  168. package/infra/amplify-app-shell.js +234 -0
  169. package/infra/amplify-app-shell.ts +284 -0
  170. package/infra/build-specs.js +85 -0
  171. package/infra/build-specs.ts +131 -0
  172. package/infra/github-oidc-provider.js +24 -0
  173. package/infra/github-oidc-provider.ts +30 -0
  174. package/infra/index.js +15 -0
  175. package/infra/site-config.js +186 -0
  176. package/infra/site-config.ts +235 -0
  177. package/lib/amplify-outputs-guard.ts +24 -0
  178. package/lib/amplify-outputs-path.ts +16 -0
  179. package/lib/amplify-server-runtime.ts +63 -0
  180. package/lib/archive-data.ts +30 -0
  181. package/lib/archive-types.ts +15 -0
  182. package/lib/articles.ts +320 -0
  183. package/lib/cached-content-repository.ts +90 -0
  184. package/lib/category-dashboard.ts +37 -0
  185. package/lib/category-repository.ts +1907 -0
  186. package/lib/console-chat-client.ts +1316 -0
  187. package/lib/console-web-context.ts +118 -0
  188. package/lib/content-actions-client.ts +98 -0
  189. package/lib/content-actions-demo.ts +190 -0
  190. package/lib/content-load-timing.ts +23 -0
  191. package/lib/content-repository.ts +43 -0
  192. package/lib/content-source-context.ts +26 -0
  193. package/lib/content-types.ts +104 -0
  194. package/lib/define-site.js +3 -0
  195. package/lib/define-site.ts +21 -0
  196. package/lib/demo-amplify-outputs.ts +15 -0
  197. package/lib/dev-sandbox-editor-auth.ts +18 -0
  198. package/lib/doctrine.ts +128 -0
  199. package/lib/edition-routes.ts +155 -0
  200. package/lib/edition-sections.ts +111 -0
  201. package/lib/empty-edition-layout-plan.ts +109 -0
  202. package/lib/empty-theme.css +1 -0
  203. package/lib/excerpts.ts +8 -0
  204. package/lib/graphql-content-repository.ts +1140 -0
  205. package/lib/image-url.ts +10 -0
  206. package/lib/layout-plan.ts +981 -0
  207. package/lib/layout-scenarios.ts +564 -0
  208. package/lib/markus-body.ts +168 -0
  209. package/lib/markus-ir.ts +235 -0
  210. package/lib/markus-projection.ts +243 -0
  211. package/lib/markus-to-article.ts +93 -0
  212. package/lib/news-desk-session.ts +160 -0
  213. package/lib/newspaper-layout.ts +3459 -0
  214. package/lib/newsroom-articles.ts +325 -0
  215. package/lib/newsroom-assignments.ts +173 -0
  216. package/lib/newsroom-base-path.ts +48 -0
  217. package/lib/newsroom-card-layout.ts +102 -0
  218. package/lib/newsroom-category-drilldown.ts +133 -0
  219. package/lib/newsroom-demo-articles.ts +90 -0
  220. package/lib/newsroom-demo-dashboard.ts +267 -0
  221. package/lib/newsroom-demo-profile.ts +46 -0
  222. package/lib/newsroom-forum-routes.ts +153 -0
  223. package/lib/newsroom-index-filters.ts +202 -0
  224. package/lib/newsroom-knowledge-query-request.ts +51 -0
  225. package/lib/newsroom-list-selection.ts +42 -0
  226. package/lib/newsroom-media-backend.ts +142 -0
  227. package/lib/newsroom-media.ts +182 -0
  228. package/lib/newsroom-nav.ts +44 -0
  229. package/lib/newsroom-references.ts +116 -0
  230. package/lib/newsroom-sections.ts +52 -0
  231. package/lib/newsroom-topics.ts +118 -0
  232. package/lib/papyrus-object-kinds.ts +24 -0
  233. package/lib/papyrus-web-locations.ts +480 -0
  234. package/lib/pilobol-sample.ts +167 -0
  235. package/lib/presentation-footer.ts +92 -0
  236. package/lib/pretext-layout.ts +179 -0
  237. package/lib/public-placeholder-config.ts +102 -0
  238. package/lib/publication-items.ts +181 -0
  239. package/lib/reader-route-config.ts +1 -0
  240. package/lib/reader-static-params.ts +56 -0
  241. package/lib/reader-storage-url.ts +63 -0
  242. package/lib/reference-display.ts +74 -0
  243. package/lib/reference-policy.ts +97 -0
  244. package/lib/reference-source-preview.ts +175 -0
  245. package/lib/renderer-config.ts +50 -0
  246. package/lib/renderer.ts +87 -0
  247. package/lib/reporting-story-budget.ts +638 -0
  248. package/lib/semantic-graph.ts +554 -0
  249. package/lib/site-brand-tenant.ts +22 -0
  250. package/lib/site-brand.ts +194 -0
  251. package/lib/site-env.ts +52 -0
  252. package/lib/site-renderer.ts +17 -0
  253. package/lib/site-stack.ts +195 -0
  254. package/lib/staging-gate.ts +37 -0
  255. package/lib/staging-preview-object.ts +98 -0
  256. package/lib/themed-image.ts +30 -0
  257. package/lib/utils.ts +6 -0
  258. package/lib/video-mode.ts +42 -0
  259. package/lib/video-script.ts +63 -0
  260. package/middleware.ts +103 -0
  261. package/package.json +318 -1
  262. package/renderers/markus/index.ts +25 -0
  263. package/renderers/markus/stubs.tsx +33 -0
  264. package/renderers/pretext/article-page.tsx +169 -0
  265. package/renderers/pretext/index.ts +30 -0
  266. package/renderers/pretext/layouts.ts +16 -0
  267. package/renderers/pretext/presentation-shell.tsx +470 -0
  268. package/routes.manifest.json +208 -0
  269. package/scripts/fixtures/pilobol-sample.ast.json +234 -0
  270. package/scripts/videoml/build-browser-bundle.mjs +22 -0
  271. package/scripts/videoml/build-preview-bundle.mjs +50 -0
  272. package/scripts/videoml/bundle-common.mjs +129 -0
  273. package/scripts/videoml/preview/preview-entry.tsx +381 -0
  274. package/scripts/videoml/preview/preview-stage-fit.ts +28 -0
  275. package/scripts/videoml/preview/preview-timing.ts +42 -0
  276. package/scripts/videoml/preview.html +77 -0
  277. package/scripts/videoml/standard-entry.tsx +46 -0
  278. package/src/backend.js +1 -0
  279. package/src/backend.ts +3 -0
  280. package/src/sync.mjs +87 -0
  281. package/src/with-papyrus.d.mts +2 -0
  282. package/src/with-papyrus.mjs +60 -0
@@ -0,0 +1,2069 @@
1
+ import { a, defineData } from "@aws-amplify/backend";
2
+ import { assignmentAction } from "../functions/assignment-action/resource.js";
3
+ import { categoryAction } from "../functions/category-action/resource.js";
4
+ import { graphqlJwtAuthorizer } from "../functions/graphql-jwt-authorizer/resource.js";
5
+ import { contentActions } from "../functions/content-actions/resource.js";
6
+ import { knowledgeQuery } from "../functions/knowledge-query/resource.js";
7
+ import { manageUserRole } from "../functions/manage-user-role/resource.js";
8
+ import { modelAttachmentUpload } from "../functions/model-attachment-upload/resource.js";
9
+ import { newsroomSummary } from "../functions/newsroom-summary/resource.js";
10
+ import { procedureAction } from "../functions/procedure-action/resource.js";
11
+ import { readerSettings } from "../functions/reader-settings/resource.js";
12
+ import { emailSubmissionProcessor } from "../functions/email-submission-processor/resource.js";
13
+ import { sesInboundReceive } from "../functions/ses-inbound-receive/resource.js";
14
+ import { slackDelivery } from "../functions/slack-delivery/resource.js";
15
+ import { slackEvents } from "../functions/slack-events/resource.js";
16
+ import { schema as leanSchema } from "./schema.js";
17
+ const authoringOperations = [
18
+ "read",
19
+ "create",
20
+ "update",
21
+ "delete",
22
+ ];
23
+ const contentWriteGroups = ["editor", "admin"];
24
+ const adminGroup = "admin";
25
+ const categoryWriteGroups = ["editor", "admin"];
26
+ const categoryAppendOnlyOperations = ["read", "create"];
27
+ const schema = a.schema({
28
+ UserProfile: a
29
+ .model({
30
+ id: a.id().required(),
31
+ email: a.email(),
32
+ displayName: a.string(),
33
+ avatarUrl: a.url(),
34
+ preferences: a.json(),
35
+ settings: a.json(),
36
+ status: a.string(),
37
+ mergedIntoProfileId: a.id(),
38
+ mergedAt: a.datetime(),
39
+ mergedBy: a.string(),
40
+ mergeReason: a.string(),
41
+ createdAt: a.datetime(),
42
+ updatedAt: a.datetime(),
43
+ })
44
+ .authorization((allow) => [
45
+ allow.owner(),
46
+ allow.group(adminGroup),
47
+ allow.custom().to(["read"]),
48
+ ]),
49
+ UserIdentity: a
50
+ .model({
51
+ id: a.id().required(),
52
+ userProfileId: a.id().required(),
53
+ cognitoSub: a.string().required(),
54
+ provider: a.string(),
55
+ email: a.email(),
56
+ status: a.string().required(),
57
+ linkedAt: a.datetime().required(),
58
+ lastSeenAt: a.datetime(),
59
+ })
60
+ .secondaryIndexes((index) => [
61
+ index("userProfileId").sortKeys(["linkedAt"]).queryField("listUserIdentitiesByProfileAndLinkedAt"),
62
+ index("cognitoSub").queryField("userIdentityByCognitoSub"),
63
+ index("email").sortKeys(["status"]).queryField("listUserIdentitiesByEmailAndStatus"),
64
+ ])
65
+ .authorization((allow) => [
66
+ allow.group(adminGroup),
67
+ allow.custom().to(["read"]),
68
+ ]),
69
+ UserRoleAssignment: a
70
+ .model({
71
+ id: a.id().required(),
72
+ userProfileId: a.id().required(),
73
+ userSub: a.string(),
74
+ email: a.email(),
75
+ role: a.string().required(),
76
+ status: a.string().required(),
77
+ grantedBy: a.string().required(),
78
+ grantedAt: a.datetime().required(),
79
+ revokedAt: a.datetime(),
80
+ notes: a.string(),
81
+ })
82
+ .secondaryIndexes((index) => [
83
+ index("userProfileId").sortKeys(["role"]).queryField("listUserRoleAssignmentsByProfileAndRole"),
84
+ index("userSub").sortKeys(["role"]).queryField("listUserRoleAssignmentsByUserAndRole"),
85
+ index("role").sortKeys(["status"]).queryField("listUserRoleAssignmentsByRoleAndStatus"),
86
+ ])
87
+ .authorization((allow) => [
88
+ allow.group(adminGroup),
89
+ ]),
90
+ UserRoleMutationResult: a.customType({
91
+ ok: a.boolean().required(),
92
+ userProfileId: a.id(),
93
+ userSub: a.string(),
94
+ username: a.string(),
95
+ role: a.string().required(),
96
+ userSubs: a.string().array(),
97
+ usernames: a.string().array(),
98
+ activeRoles: a.string().array().required(),
99
+ }),
100
+ UserDirectoryIdentity: a.customType({
101
+ id: a.id().required(),
102
+ userProfileId: a.id().required(),
103
+ cognitoSub: a.string().required(),
104
+ provider: a.string(),
105
+ email: a.email(),
106
+ status: a.string().required(),
107
+ linkedAt: a.datetime().required(),
108
+ lastSeenAt: a.datetime(),
109
+ }),
110
+ UserDirectoryEntry: a.customType({
111
+ userProfileId: a.id(),
112
+ userSub: a.string(),
113
+ username: a.string(),
114
+ email: a.email(),
115
+ displayName: a.string(),
116
+ provider: a.string(),
117
+ enabled: a.boolean(),
118
+ cognitoStatus: a.string(),
119
+ profileStatus: a.string(),
120
+ mergedIntoProfileId: a.id(),
121
+ identityStatus: a.string(),
122
+ activeRoles: a.string().array().required(),
123
+ identities: a.ref("UserDirectoryIdentity").array().required(),
124
+ }),
125
+ UserDirectoryResult: a.customType({
126
+ entries: a.ref("UserDirectoryEntry").array().required(),
127
+ profileCount: a.integer().required(),
128
+ identityCount: a.integer().required(),
129
+ cognitoUserCount: a.integer().required(),
130
+ }),
131
+ ReaderSettingsResult: a.customType({
132
+ userProfileId: a.id().required(),
133
+ email: a.email(),
134
+ settings: a.json(),
135
+ avatarHash: a.string(),
136
+ }),
137
+ listUserDirectory: a
138
+ .query()
139
+ .returns(a.ref("UserDirectoryResult"))
140
+ .authorization((allow) => [allow.group(adminGroup)])
141
+ .handler(a.handler.function(manageUserRole)),
142
+ grantUserRole: a
143
+ .mutation()
144
+ .arguments({
145
+ userProfileId: a.id(),
146
+ userSub: a.string(),
147
+ cognitoSubs: a.string().array(),
148
+ role: a.string().required(),
149
+ })
150
+ .returns(a.ref("UserRoleMutationResult"))
151
+ .authorization((allow) => [allow.group(adminGroup)])
152
+ .handler(a.handler.function(manageUserRole)),
153
+ revokeUserRole: a
154
+ .mutation()
155
+ .arguments({
156
+ userProfileId: a.id(),
157
+ userSub: a.string(),
158
+ cognitoSubs: a.string().array(),
159
+ role: a.string().required(),
160
+ })
161
+ .returns(a.ref("UserRoleMutationResult"))
162
+ .authorization((allow) => [allow.group(adminGroup)])
163
+ .handler(a.handler.function(manageUserRole)),
164
+ mergeUserProfiles: a
165
+ .mutation()
166
+ .arguments({
167
+ targetUserProfileId: a.id(),
168
+ targetUserSub: a.string(),
169
+ sourceUserProfileId: a.id(),
170
+ sourceUserSub: a.string(),
171
+ reason: a.string(),
172
+ })
173
+ .returns(a.ref("UserDirectoryEntry"))
174
+ .authorization((allow) => [allow.group(adminGroup)])
175
+ .handler(a.handler.function(manageUserRole)),
176
+ getReaderSettings: a
177
+ .query()
178
+ .returns(a.ref("ReaderSettingsResult"))
179
+ .authorization((allow) => [allow.authenticated()])
180
+ .handler(a.handler.function(readerSettings)),
181
+ updateReaderSettings: a
182
+ .mutation()
183
+ .arguments({
184
+ settings: a.json().required(),
185
+ })
186
+ .returns(a.ref("ReaderSettingsResult"))
187
+ .authorization((allow) => [allow.authenticated()])
188
+ .handler(a.handler.function(readerSettings)),
189
+ SteeringActionResult: a.customType({
190
+ ok: a.boolean().required(),
191
+ action: a.string().required(),
192
+ proposalId: a.id(),
193
+ categorySetId: a.id(),
194
+ categoryId: a.id(),
195
+ decisionId: a.id(),
196
+ status: a.string(),
197
+ }),
198
+ reviewSteeringProposal: a
199
+ .mutation()
200
+ .arguments({
201
+ proposalId: a.id().required(),
202
+ action: a.string().required(),
203
+ actorSub: a.string(),
204
+ actorLabel: a.string(),
205
+ note: a.string(),
206
+ displayName: a.string(),
207
+ shortTitle: a.string(),
208
+ subtitle: a.string(),
209
+ description: a.string(),
210
+ aliases: a.string().array(),
211
+ seedItemIds: a.string().array(),
212
+ holdoutItemIds: a.string().array(),
213
+ })
214
+ .returns(a.ref("SteeringActionResult"))
215
+ .authorization((allow) => [allow.groups(categoryWriteGroups)])
216
+ .handler(a.handler.function(categoryAction)),
217
+ ReferenceCurationActionResult: a.customType({
218
+ ok: a.boolean().required(),
219
+ action: a.string().required(),
220
+ referenceId: a.id().required(),
221
+ status: a.string().required(),
222
+ reasonCode: a.string(),
223
+ messageId: a.id(),
224
+ relationId: a.id(),
225
+ }),
226
+ ReferenceQualityActionResult: a.customType({
227
+ ok: a.boolean().required(),
228
+ referenceId: a.id().required(),
229
+ rating: a.integer().required(),
230
+ status: a.string().required(),
231
+ relationId: a.id(),
232
+ }),
233
+ ReferenceInsightActionResult: a.customType({
234
+ ok: a.boolean().required(),
235
+ referenceId: a.id().required(),
236
+ messageId: a.id().required(),
237
+ relationId: a.id().required(),
238
+ status: a.string().required(),
239
+ }),
240
+ ReferenceCorpusMoveActionResult: a.customType({
241
+ ok: a.boolean().required(),
242
+ referenceId: a.id().required(),
243
+ referenceLineageId: a.id().required(),
244
+ previousReferenceId: a.id(),
245
+ previousCorpusId: a.id(),
246
+ corpusId: a.id().required(),
247
+ status: a.string().required(),
248
+ }),
249
+ ReferenceCurationStartResult: a.customType({
250
+ ok: a.boolean().required(),
251
+ referenceId: a.id().required(),
252
+ assignmentId: a.id().required(),
253
+ status: a.string().required(),
254
+ runId: a.string(),
255
+ }),
256
+ ReferenceCurationStatusResult: a.customType({
257
+ ok: a.boolean().required(),
258
+ referenceId: a.id(),
259
+ assignmentId: a.id().required(),
260
+ status: a.string().required(),
261
+ runId: a.string(),
262
+ lifecycleStatus: a.string(),
263
+ stageStatuses: a.json(),
264
+ changedOutputs: a.json(),
265
+ error: a.json(),
266
+ }),
267
+ CategorySetDraftActionResult: a.customType({
268
+ ok: a.boolean().required(),
269
+ action: a.string().required(),
270
+ categorySetId: a.id().required(),
271
+ sourceCategorySetId: a.id(),
272
+ categoryCount: a.integer(),
273
+ status: a.string(),
274
+ }),
275
+ TopicLabelActionResult: a.customType({
276
+ ok: a.boolean().required(),
277
+ action: a.string().required(),
278
+ referenceId: a.id(),
279
+ categoryId: a.id(),
280
+ relationId: a.id(),
281
+ sourceRelationId: a.id(),
282
+ status: a.string(),
283
+ }),
284
+ reviewReferenceCuration: a
285
+ .mutation()
286
+ .arguments({
287
+ referenceId: a.id().required(),
288
+ action: a.string().required(),
289
+ actorSub: a.string(),
290
+ actorLabel: a.string(),
291
+ note: a.string(),
292
+ reasonCode: a.string(),
293
+ })
294
+ .returns(a.ref("ReferenceCurationActionResult"))
295
+ .authorization((allow) => [
296
+ allow.groups(categoryWriteGroups),
297
+ allow.custom(),
298
+ ])
299
+ .handler(a.handler.function(categoryAction)),
300
+ setReferenceQualityRating: a
301
+ .mutation()
302
+ .arguments({
303
+ referenceId: a.id().required(),
304
+ rating: a.integer().required(),
305
+ actorSub: a.string(),
306
+ actorLabel: a.string(),
307
+ note: a.string(),
308
+ })
309
+ .returns(a.ref("ReferenceQualityActionResult"))
310
+ .authorization((allow) => [
311
+ allow.groups(categoryWriteGroups),
312
+ allow.custom(),
313
+ ])
314
+ .handler(a.handler.function(categoryAction)),
315
+ createReferenceInsight: a
316
+ .mutation()
317
+ .arguments({
318
+ referenceId: a.id().required(),
319
+ summary: a.string().required(),
320
+ body: a.string().required(),
321
+ actorSub: a.string(),
322
+ actorLabel: a.string(),
323
+ })
324
+ .returns(a.ref("ReferenceInsightActionResult"))
325
+ .authorization((allow) => [
326
+ allow.groups(categoryWriteGroups),
327
+ allow.custom(),
328
+ ])
329
+ .handler(a.handler.function(categoryAction)),
330
+ moveReferenceCorpus: a
331
+ .mutation()
332
+ .arguments({
333
+ referenceId: a.id().required(),
334
+ corpusId: a.id().required(),
335
+ actorSub: a.string(),
336
+ actorLabel: a.string(),
337
+ note: a.string(),
338
+ })
339
+ .returns(a.ref("ReferenceCorpusMoveActionResult"))
340
+ .authorization((allow) => [
341
+ allow.groups(categoryWriteGroups),
342
+ allow.custom(),
343
+ ])
344
+ .handler(a.handler.function(categoryAction)),
345
+ startReferenceCuration: a
346
+ .mutation()
347
+ .arguments({
348
+ referenceId: a.id().required(),
349
+ actorSub: a.string(),
350
+ actorLabel: a.string(),
351
+ curationPolicy: a.json(),
352
+ })
353
+ .returns(a.ref("ReferenceCurationStartResult"))
354
+ .authorization((allow) => [
355
+ allow.groups(categoryWriteGroups),
356
+ allow.custom(),
357
+ ])
358
+ .handler(a.handler.function(categoryAction)),
359
+ getReferenceCurationStatus: a
360
+ .query()
361
+ .arguments({
362
+ assignmentId: a.id().required(),
363
+ })
364
+ .returns(a.ref("ReferenceCurationStatusResult"))
365
+ .authorization((allow) => [
366
+ allow.groups(categoryWriteGroups),
367
+ allow.custom(),
368
+ ])
369
+ .handler(a.handler.function(categoryAction)),
370
+ createCategorySetDraft: a
371
+ .mutation()
372
+ .arguments({
373
+ sourceCategorySetId: a.id().required(),
374
+ displayName: a.string(),
375
+ actorLabel: a.string(),
376
+ note: a.string(),
377
+ })
378
+ .returns(a.ref("CategorySetDraftActionResult"))
379
+ .authorization((allow) => [allow.groups(categoryWriteGroups)])
380
+ .handler(a.handler.function(categoryAction)),
381
+ promoteCategorySetDraft: a
382
+ .mutation()
383
+ .arguments({
384
+ categorySetId: a.id().required(),
385
+ actorLabel: a.string(),
386
+ note: a.string(),
387
+ })
388
+ .returns(a.ref("CategorySetDraftActionResult"))
389
+ .authorization((allow) => [allow.groups(categoryWriteGroups)])
390
+ .handler(a.handler.function(categoryAction)),
391
+ discardCategorySetDraft: a
392
+ .mutation()
393
+ .arguments({
394
+ categorySetId: a.id().required(),
395
+ actorLabel: a.string(),
396
+ note: a.string(),
397
+ })
398
+ .returns(a.ref("CategorySetDraftActionResult"))
399
+ .authorization((allow) => [allow.groups(categoryWriteGroups)])
400
+ .handler(a.handler.function(categoryAction)),
401
+ createDraftCategory: a
402
+ .mutation()
403
+ .arguments({
404
+ categorySetId: a.id().required(),
405
+ parentCategoryKey: a.string(),
406
+ displayName: a.string().required(),
407
+ shortTitle: a.string(),
408
+ subtitle: a.string(),
409
+ description: a.string(),
410
+ actorLabel: a.string(),
411
+ note: a.string(),
412
+ })
413
+ .returns(a.ref("SteeringActionResult"))
414
+ .authorization((allow) => [allow.groups(categoryWriteGroups)])
415
+ .handler(a.handler.function(categoryAction)),
416
+ updateDraftCategory: a
417
+ .mutation()
418
+ .arguments({
419
+ categoryId: a.id().required(),
420
+ displayName: a.string(),
421
+ shortTitle: a.string(),
422
+ subtitle: a.string(),
423
+ description: a.string(),
424
+ parentCategoryKey: a.string(),
425
+ actorLabel: a.string(),
426
+ note: a.string(),
427
+ })
428
+ .returns(a.ref("SteeringActionResult"))
429
+ .authorization((allow) => [allow.groups(categoryWriteGroups)])
430
+ .handler(a.handler.function(categoryAction)),
431
+ archiveDraftCategory: a
432
+ .mutation()
433
+ .arguments({
434
+ categoryId: a.id().required(),
435
+ actorLabel: a.string(),
436
+ note: a.string(),
437
+ })
438
+ .returns(a.ref("SteeringActionResult"))
439
+ .authorization((allow) => [allow.groups(categoryWriteGroups)])
440
+ .handler(a.handler.function(categoryAction)),
441
+ reviewReferenceTopicLabel: a
442
+ .mutation()
443
+ .arguments({
444
+ referenceId: a.id().required(),
445
+ categoryId: a.id().required(),
446
+ action: a.string().required(),
447
+ sourceRelationId: a.id(),
448
+ actorLabel: a.string(),
449
+ note: a.string(),
450
+ })
451
+ .returns(a.ref("TopicLabelActionResult"))
452
+ .authorization((allow) => [allow.groups(categoryWriteGroups)])
453
+ .handler(a.handler.function(categoryAction)),
454
+ NewsroomSummary: a.customType({
455
+ generatedAt: a.datetime().required(),
456
+ staleAt: a.datetime(),
457
+ source: a.string(),
458
+ latestImportRun: a.json(),
459
+ counts: a.json().required(),
460
+ facets: a.json(),
461
+ assignmentStatusCounts: a.json().required(),
462
+ assignmentTypeCounts: a.json().required(),
463
+ referenceStatusCounts: a.json().required(),
464
+ messageKindCounts: a.json().required(),
465
+ messageDomainCounts: a.json().required(),
466
+ }),
467
+ getNewsroomSummary: a
468
+ .query()
469
+ .returns(a.ref("NewsroomSummary"))
470
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
471
+ .handler(a.handler.function(newsroomSummary)),
472
+ deriveMarkus: a
473
+ .query()
474
+ .arguments({ input: a.json().required() })
475
+ .returns(a.json())
476
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
477
+ .handler(a.handler.function(contentActions)),
478
+ saveItemDraft: a
479
+ .mutation()
480
+ .arguments({ input: a.json().required() })
481
+ .returns(a.json())
482
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
483
+ .handler(a.handler.function(contentActions)),
484
+ publishItem: a
485
+ .mutation()
486
+ .arguments({ input: a.json().required() })
487
+ .returns(a.json())
488
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
489
+ .handler(a.handler.function(contentActions)),
490
+ unpublishItem: a
491
+ .mutation()
492
+ .arguments({ input: a.json().required() })
493
+ .returns(a.json())
494
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
495
+ .handler(a.handler.function(contentActions)),
496
+ requestStagingBuild: a
497
+ .mutation()
498
+ .arguments({ input: a.json().required() })
499
+ .returns(a.json())
500
+ .authorization((allow) => [allow.groups(contentWriteGroups)])
501
+ .handler(a.handler.function(contentActions)),
502
+ knowledgeQuery: a
503
+ .query()
504
+ .arguments({
505
+ input: a.json().required(),
506
+ })
507
+ .returns(a.json())
508
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
509
+ .handler(a.handler.function(knowledgeQuery)),
510
+ updateNewsroomSummary: a
511
+ .mutation()
512
+ .arguments({
513
+ delta: a.json().required(),
514
+ actorLabel: a.string(),
515
+ reason: a.string(),
516
+ })
517
+ .returns(a.ref("NewsroomSummary"))
518
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
519
+ .handler(a.handler.function(newsroomSummary)),
520
+ ModelAttachmentUploadSlot: a.customType({
521
+ ok: a.boolean().required(),
522
+ uploadId: a.string().required(),
523
+ attachmentId: a.id().required(),
524
+ ownerKind: a.string().required(),
525
+ ownerId: a.id().required(),
526
+ role: a.string().required(),
527
+ sortKey: a.string().required(),
528
+ method: a.string().required(),
529
+ uploadUrl: a.string().required(),
530
+ storagePath: a.string().required(),
531
+ mediaType: a.string().required(),
532
+ byteSize: a.integer().required(),
533
+ sha256: a.string(),
534
+ expiresAt: a.datetime().required(),
535
+ requiredHeaders: a.json(),
536
+ }),
537
+ ModelAttachmentDownloadSlot: a.customType({
538
+ ok: a.boolean().required(),
539
+ attachmentId: a.id().required(),
540
+ method: a.string().required(),
541
+ downloadUrl: a.string().required(),
542
+ storagePath: a.string().required(),
543
+ mediaType: a.string().required(),
544
+ byteSize: a.integer().required(),
545
+ sha256: a.string(),
546
+ expiresAt: a.datetime().required(),
547
+ requiredHeaders: a.json(),
548
+ }),
549
+ ModelAttachmentUploadAbortResult: a.customType({
550
+ ok: a.boolean().required(),
551
+ uploadId: a.string().required(),
552
+ attachmentId: a.id().required(),
553
+ storagePath: a.string().required(),
554
+ status: a.string().required(),
555
+ }),
556
+ createModelAttachmentUpload: a
557
+ .mutation()
558
+ .arguments({
559
+ ownerKind: a.string().required(),
560
+ ownerId: a.id().required(),
561
+ ownerLineageId: a.id(),
562
+ ownerVersionNumber: a.integer(),
563
+ ownerVersionKey: a.string(),
564
+ role: a.string().required(),
565
+ sortKey: a.string(),
566
+ filename: a.string().required(),
567
+ mediaType: a.string().required(),
568
+ byteSize: a.integer().required(),
569
+ sha256: a.string(),
570
+ importRunId: a.id(),
571
+ status: a.string(),
572
+ })
573
+ .returns(a.ref("ModelAttachmentUploadSlot"))
574
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
575
+ .handler(a.handler.function(modelAttachmentUpload)),
576
+ completeModelAttachmentUpload: a
577
+ .mutation()
578
+ .arguments({
579
+ uploadId: a.string().required(),
580
+ ownerKind: a.string().required(),
581
+ ownerId: a.id().required(),
582
+ ownerLineageId: a.id(),
583
+ ownerVersionNumber: a.integer(),
584
+ ownerVersionKey: a.string(),
585
+ role: a.string().required(),
586
+ sortKey: a.string(),
587
+ filename: a.string().required(),
588
+ mediaType: a.string().required(),
589
+ byteSize: a.integer().required(),
590
+ sha256: a.string(),
591
+ importRunId: a.id(),
592
+ status: a.string(),
593
+ })
594
+ .returns(a.ref("ModelAttachment"))
595
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
596
+ .handler(a.handler.function(modelAttachmentUpload)),
597
+ abortModelAttachmentUpload: a
598
+ .mutation()
599
+ .arguments({
600
+ uploadId: a.string().required(),
601
+ ownerKind: a.string().required(),
602
+ ownerId: a.id().required(),
603
+ ownerLineageId: a.id(),
604
+ ownerVersionNumber: a.integer(),
605
+ ownerVersionKey: a.string(),
606
+ role: a.string().required(),
607
+ sortKey: a.string(),
608
+ filename: a.string().required(),
609
+ mediaType: a.string().required(),
610
+ byteSize: a.integer().required(),
611
+ sha256: a.string(),
612
+ importRunId: a.id(),
613
+ status: a.string(),
614
+ })
615
+ .returns(a.ref("ModelAttachmentUploadAbortResult"))
616
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
617
+ .handler(a.handler.function(modelAttachmentUpload)),
618
+ createModelAttachmentDownload: a
619
+ .mutation()
620
+ .arguments({
621
+ attachmentId: a.id().required(),
622
+ })
623
+ .returns(a.ref("ModelAttachmentDownloadSlot"))
624
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
625
+ .handler(a.handler.function(modelAttachmentUpload)),
626
+ AssignmentActionResult: a.customType({
627
+ ok: a.boolean().required(),
628
+ assignmentId: a.id(),
629
+ eventId: a.id(),
630
+ status: a.string(),
631
+ action: a.string().required(),
632
+ assigneeKey: a.string(),
633
+ claimExpiresAt: a.datetime(),
634
+ }),
635
+ AssignmentTargetSummary: a.customType({
636
+ kind: a.string().required(),
637
+ id: a.id().required(),
638
+ lineageId: a.id().required(),
639
+ label: a.string(),
640
+ detail: a.string(),
641
+ }),
642
+ AssignmentSummary: a.customType({
643
+ id: a.id().required(),
644
+ assignmentTypeKey: a.string().required(),
645
+ queueKey: a.string().required(),
646
+ queueStatusKey: a.string().required(),
647
+ status: a.string().required(),
648
+ priority: a.integer(),
649
+ title: a.string().required(),
650
+ summary: a.string(),
651
+ assigneeType: a.string(),
652
+ assigneeId: a.string(),
653
+ assigneeKey: a.string(),
654
+ claimedAt: a.datetime(),
655
+ claimExpiresAt: a.datetime(),
656
+ completedAt: a.datetime(),
657
+ canceledAt: a.datetime(),
658
+ corpusId: a.id(),
659
+ categorySetId: a.id(),
660
+ classifierId: a.string(),
661
+ sectionId: a.id(),
662
+ sectionKey: a.string(),
663
+ sectionType: a.string(),
664
+ sectionStatusKey: a.string(),
665
+ sectionQueueStatusKey: a.string(),
666
+ primaryFocusCategoryKey: a.string(),
667
+ topicScopeCategoryKeys: a.string().array(),
668
+ sourceSnapshotId: a.string(),
669
+ importRunId: a.id(),
670
+ createdBy: a.string(),
671
+ createdAt: a.datetime().required(),
672
+ updatedAt: a.datetime().required(),
673
+ }),
674
+ AssignmentEventSummary: a.customType({
675
+ id: a.id().required(),
676
+ assignmentId: a.id().required(),
677
+ assignmentTypeKey: a.string().required(),
678
+ queueKey: a.string().required(),
679
+ eventType: a.string().required(),
680
+ fromStatus: a.string(),
681
+ toStatus: a.string(),
682
+ actorSub: a.string(),
683
+ actorLabel: a.string(),
684
+ note: a.string(),
685
+ createdAt: a.datetime().required(),
686
+ }),
687
+ AssignmentDoctrineSummary: a.customType({
688
+ scope: a.string().required(),
689
+ kind: a.string().required(),
690
+ label: a.string().required(),
691
+ slug: a.string().required(),
692
+ body: a.string().array().required(),
693
+ categoryKey: a.string(),
694
+ categoryLineageId: a.id(),
695
+ }),
696
+ AssignmentContext: a.customType({
697
+ assignment: a.ref("AssignmentSummary"),
698
+ doctrine: a.ref("AssignmentDoctrineSummary").array().required(),
699
+ targets: a.ref("AssignmentTargetSummary").array().required(),
700
+ events: a.ref("AssignmentEventSummary").array().required(),
701
+ }),
702
+ listAssignmentsForObject: a
703
+ .query()
704
+ .arguments({
705
+ objectKind: a.string().required(),
706
+ objectLineageId: a.id().required(),
707
+ status: a.string(),
708
+ limit: a.integer(),
709
+ })
710
+ .returns(a.ref("AssignmentContext").array().required())
711
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
712
+ .handler(a.handler.function(assignmentAction)),
713
+ listAssignmentQueue: a
714
+ .query()
715
+ .arguments({
716
+ queueKey: a.string().required(),
717
+ status: a.string(),
718
+ limit: a.integer(),
719
+ })
720
+ .returns(a.ref("AssignmentContext").array().required())
721
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
722
+ .handler(a.handler.function(assignmentAction)),
723
+ getAssignmentContext: a
724
+ .query()
725
+ .arguments({
726
+ assignmentId: a.id().required(),
727
+ })
728
+ .returns(a.ref("AssignmentContext"))
729
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
730
+ .handler(a.handler.function(assignmentAction)),
731
+ claimAssignment: a
732
+ .mutation()
733
+ .arguments({
734
+ assignmentId: a.id().required(),
735
+ assigneeKey: a.string(),
736
+ assigneeType: a.string(),
737
+ assigneeId: a.string(),
738
+ claimExpiresAt: a.datetime(),
739
+ claimTtlSeconds: a.integer(),
740
+ actorSub: a.string(),
741
+ actorLabel: a.string(),
742
+ note: a.string(),
743
+ })
744
+ .returns(a.ref("AssignmentActionResult"))
745
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
746
+ .handler(a.handler.function(assignmentAction)),
747
+ releaseAssignment: a
748
+ .mutation()
749
+ .arguments({
750
+ assignmentId: a.id().required(),
751
+ actorSub: a.string(),
752
+ actorLabel: a.string(),
753
+ note: a.string(),
754
+ })
755
+ .returns(a.ref("AssignmentActionResult"))
756
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
757
+ .handler(a.handler.function(assignmentAction)),
758
+ completeAssignment: a
759
+ .mutation()
760
+ .arguments({
761
+ assignmentId: a.id().required(),
762
+ actorSub: a.string(),
763
+ actorLabel: a.string(),
764
+ note: a.string(),
765
+ })
766
+ .returns(a.ref("AssignmentActionResult"))
767
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
768
+ .handler(a.handler.function(assignmentAction)),
769
+ cancelAssignment: a
770
+ .mutation()
771
+ .arguments({
772
+ assignmentId: a.id().required(),
773
+ actorSub: a.string(),
774
+ actorLabel: a.string(),
775
+ note: a.string(),
776
+ })
777
+ .returns(a.ref("AssignmentActionResult"))
778
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
779
+ .handler(a.handler.function(assignmentAction)),
780
+ reopenAssignment: a
781
+ .mutation()
782
+ .arguments({
783
+ assignmentId: a.id().required(),
784
+ actorSub: a.string(),
785
+ actorLabel: a.string(),
786
+ note: a.string(),
787
+ })
788
+ .returns(a.ref("AssignmentActionResult"))
789
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
790
+ .handler(a.handler.function(assignmentAction)),
791
+ retryImmediateAssignment: a
792
+ .mutation()
793
+ .arguments({
794
+ assignmentId: a.id().required(),
795
+ actorSub: a.string(),
796
+ actorLabel: a.string(),
797
+ note: a.string(),
798
+ })
799
+ .returns(a.ref("AssignmentActionResult"))
800
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
801
+ .handler(a.handler.function(assignmentAction)),
802
+ listNewsroomProcedureDefinitions: a
803
+ .query()
804
+ .returns(a.json())
805
+ .authorization((allow) => [allow.group(adminGroup)])
806
+ .handler(a.handler.function(procedureAction)),
807
+ getNewsroomProcedureDefinition: a
808
+ .query()
809
+ .arguments({
810
+ id: a.id(),
811
+ procedureKey: a.string(),
812
+ })
813
+ .returns(a.json())
814
+ .authorization((allow) => [allow.group(adminGroup), allow.custom()])
815
+ .handler(a.handler.function(procedureAction)),
816
+ saveNewsroomProcedureDefinition: a
817
+ .mutation()
818
+ .arguments({
819
+ input: a.json().required(),
820
+ })
821
+ .returns(a.json())
822
+ .authorization((allow) => [allow.group(adminGroup)])
823
+ .handler(a.handler.function(procedureAction)),
824
+ saveNewsroomProcedureVersionDraft: a
825
+ .mutation()
826
+ .arguments({
827
+ input: a.json().required(),
828
+ })
829
+ .returns(a.json())
830
+ .authorization((allow) => [allow.group(adminGroup)])
831
+ .handler(a.handler.function(procedureAction)),
832
+ publishNewsroomProcedureVersion: a
833
+ .mutation()
834
+ .arguments({
835
+ versionId: a.id().required(),
836
+ })
837
+ .returns(a.json())
838
+ .authorization((allow) => [allow.group(adminGroup)])
839
+ .handler(a.handler.function(procedureAction)),
840
+ startNewsroomProcedureRun: a
841
+ .mutation()
842
+ .arguments({
843
+ procedureId: a.id(),
844
+ procedureKey: a.string(),
845
+ procedureVersionId: a.id(),
846
+ title: a.string(),
847
+ summary: a.string(),
848
+ input: a.json(),
849
+ actorLabel: a.string(),
850
+ })
851
+ .returns(a.json())
852
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
853
+ .handler(a.handler.function(procedureAction)),
854
+ getNewsroomProcedureRun: a
855
+ .query()
856
+ .arguments({
857
+ id: a.id().required(),
858
+ })
859
+ .returns(a.json())
860
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
861
+ .handler(a.handler.function(procedureAction)),
862
+ listNewsroomProcedureRunsByProcedure: a
863
+ .query()
864
+ .arguments({
865
+ procedureId: a.id().required(),
866
+ })
867
+ .returns(a.json())
868
+ .authorization((allow) => [allow.groups(categoryWriteGroups), allow.custom()])
869
+ .handler(a.handler.function(procedureAction)),
870
+ Assignment: a
871
+ .model({
872
+ id: a.id().required(),
873
+ assignmentTypeKey: a.string().required(),
874
+ queueKey: a.string().required(),
875
+ queueStatusKey: a.string().required(),
876
+ status: a.string().required(),
877
+ priority: a.integer(),
878
+ title: a.string().required(),
879
+ summary: a.string(),
880
+ assigneeType: a.string(),
881
+ assigneeId: a.string(),
882
+ assigneeKey: a.string(),
883
+ claimedAt: a.datetime(),
884
+ claimExpiresAt: a.datetime(),
885
+ completedAt: a.datetime(),
886
+ canceledAt: a.datetime(),
887
+ corpusId: a.id(),
888
+ categorySetId: a.id(),
889
+ classifierId: a.string(),
890
+ sectionId: a.id(),
891
+ sectionKey: a.string(),
892
+ sectionType: a.string(),
893
+ sectionStatusKey: a.string(),
894
+ sectionQueueStatusKey: a.string(),
895
+ primaryFocusCategoryKey: a.string(),
896
+ topicScopeCategoryKeys: a.string().array(),
897
+ sourceSnapshotId: a.string(),
898
+ importRunId: a.id(),
899
+ createdBy: a.string(),
900
+ createdAt: a.datetime().required(),
901
+ updatedAt: a.datetime().required(),
902
+ newsroomFeedKey: a.string(),
903
+ })
904
+ .secondaryIndexes((index) => [
905
+ index("newsroomFeedKey").sortKeys(["createdAt"]).queryField("listAssignmentsByNewsroomFeedAndCreatedAt"),
906
+ index("queueStatusKey").sortKeys(["priority", "createdAt"]).queryField("listAssignmentsByQueueStatusAndPriority"),
907
+ index("assignmentTypeKey").sortKeys(["status", "createdAt"]).queryField("listAssignmentsByTypeStatusAndCreatedAt"),
908
+ index("status").sortKeys(["updatedAt"]).queryField("listAssignmentsByStatusAndUpdatedAt"),
909
+ index("assigneeKey").sortKeys(["status", "updatedAt"]).queryField("listAssignmentsByAssigneeStatusAndUpdatedAt"),
910
+ index("importRunId").sortKeys(["createdAt"]).queryField("listAssignmentsByImportRunAndCreatedAt"),
911
+ index("sectionStatusKey").sortKeys(["priority", "createdAt"]).queryField("listAssignmentsBySectionStatusAndPriority"),
912
+ index("sectionKey").sortKeys(["createdAt"]).queryField("listAssignmentsBySectionAndCreatedAt"),
913
+ index("sectionQueueStatusKey").sortKeys(["priority", "createdAt"]).queryField("listAssignmentsBySectionQueueStatusAndPriority"),
914
+ ])
915
+ .authorization((allow) => [
916
+ allow.groups(categoryWriteGroups).to(categoryAppendOnlyOperations),
917
+ allow.authenticated("identityPool").to(authoringOperations),
918
+ allow.custom().to(authoringOperations),
919
+ ]),
920
+ AssignmentEvent: a
921
+ .model({
922
+ id: a.id().required(),
923
+ assignmentId: a.id().required(),
924
+ assignmentTypeKey: a.string().required(),
925
+ queueKey: a.string().required(),
926
+ eventType: a.string().required(),
927
+ fromStatus: a.string(),
928
+ toStatus: a.string(),
929
+ actorSub: a.string(),
930
+ actorLabel: a.string(),
931
+ note: a.string(),
932
+ createdAt: a.datetime().required(),
933
+ })
934
+ .secondaryIndexes((index) => [
935
+ index("assignmentId").sortKeys(["createdAt"]).queryField("listAssignmentEventsByAssignmentAndCreatedAt"),
936
+ index("eventType").sortKeys(["createdAt"]).queryField("listAssignmentEventsByTypeAndCreatedAt"),
937
+ index("queueKey").sortKeys(["createdAt"]).queryField("listAssignmentEventsByQueueAndCreatedAt"),
938
+ ])
939
+ .authorization((allow) => [
940
+ allow.groups(categoryWriteGroups).to(categoryAppendOnlyOperations),
941
+ allow.custom().to(authoringOperations),
942
+ ]),
943
+ ProcedureDefinition: a
944
+ .model({
945
+ id: a.id().required(),
946
+ procedureKey: a.string().required(),
947
+ title: a.string().required(),
948
+ category: a.string().required(),
949
+ description: a.string(),
950
+ enabled: a.boolean().required(),
951
+ enabledStatus: a.string().required(),
952
+ currentVersionId: a.id(),
953
+ createdBy: a.string(),
954
+ createdAt: a.datetime().required(),
955
+ updatedBy: a.string(),
956
+ updatedAt: a.datetime().required(),
957
+ newsroomFeedKey: a.string(),
958
+ })
959
+ .secondaryIndexes((index) => [
960
+ index("procedureKey").sortKeys(["updatedAt"]).queryField("listProcedureDefinitionsByKeyAndUpdatedAt"),
961
+ index("enabledStatus").sortKeys(["updatedAt"]).queryField("listProcedureDefinitionsByEnabledAndUpdatedAt"),
962
+ index("newsroomFeedKey").sortKeys(["updatedAt"]).queryField("listProcedureDefinitionsByFeedAndUpdatedAt"),
963
+ ])
964
+ .authorization((allow) => [
965
+ allow.group(adminGroup),
966
+ allow.custom().to(authoringOperations),
967
+ ]),
968
+ ProcedureVersion: a
969
+ .model({
970
+ id: a.id().required(),
971
+ procedureId: a.id().required(),
972
+ procedureKey: a.string().required(),
973
+ versionNumber: a.integer().required(),
974
+ status: a.string().required(),
975
+ isCurrent: a.boolean().required(),
976
+ label: a.string(),
977
+ tactusSource: a.string().required(),
978
+ parameterSchema: a.json().required(),
979
+ defaults: a.json(),
980
+ changelog: a.string(),
981
+ createdBy: a.string(),
982
+ createdAt: a.datetime().required(),
983
+ updatedBy: a.string(),
984
+ updatedAt: a.datetime().required(),
985
+ })
986
+ .secondaryIndexes((index) => [
987
+ index("procedureId").sortKeys(["versionNumber"]).queryField("listProcedureVersionsByProcedureAndVersion"),
988
+ index("procedureId").sortKeys(["createdAt"]).queryField("listProcedureVersionsByProcedureAndCreatedAt"),
989
+ index("status").sortKeys(["updatedAt"]).queryField("listProcedureVersionsByStatusAndUpdatedAt"),
990
+ ])
991
+ .authorization((allow) => [
992
+ allow.group(adminGroup),
993
+ allow.custom().to(authoringOperations),
994
+ ]),
995
+ ProcedureRun: a
996
+ .model({
997
+ id: a.id().required(),
998
+ procedureId: a.id().required(),
999
+ procedureKey: a.string().required(),
1000
+ procedureVersionId: a.id().required(),
1001
+ procedureVersionNumber: a.integer(),
1002
+ assignmentId: a.id(),
1003
+ runStatus: a.string().required(),
1004
+ requestedBy: a.string(),
1005
+ requestedAt: a.datetime().required(),
1006
+ startedAt: a.datetime(),
1007
+ finishedAt: a.datetime(),
1008
+ input: a.json(),
1009
+ normalizedInput: a.json(),
1010
+ resultSummary: a.string(),
1011
+ errorSummary: a.string(),
1012
+ output: a.json(),
1013
+ error: a.json(),
1014
+ attempt: a.integer(),
1015
+ newsroomFeedKey: a.string(),
1016
+ })
1017
+ .secondaryIndexes((index) => [
1018
+ index("procedureId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByProcedureAndRequestedAt"),
1019
+ index("assignmentId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByAssignmentAndRequestedAt"),
1020
+ index("runStatus").sortKeys(["requestedAt"]).queryField("listProcedureRunsByStatusAndRequestedAt"),
1021
+ index("newsroomFeedKey").sortKeys(["requestedAt"]).queryField("listProcedureRunsByFeedAndRequestedAt"),
1022
+ ])
1023
+ .authorization((allow) => [
1024
+ allow.group("editor").to(["read"]),
1025
+ allow.group(adminGroup).to(authoringOperations),
1026
+ allow.custom().to(authoringOperations),
1027
+ ]),
1028
+ NewsroomSection: a
1029
+ .model({
1030
+ id: a.id().required(),
1031
+ title: a.string().required(),
1032
+ type: a.string().required(),
1033
+ editorialMission: a.string().required(),
1034
+ editorialPolicy: a.string().required(),
1035
+ enabled: a.boolean().required(),
1036
+ enabledStatus: a.string().required(),
1037
+ sortOrder: a.integer().required(),
1038
+ shortTitle: a.string().required(),
1039
+ defaultArticleTypes: a.string().array(),
1040
+ defaultPageBudget: a.integer(),
1041
+ assignmentGuidance: a.string(),
1042
+ killCriteria: a.string(),
1043
+ visualGuidance: a.string(),
1044
+ createdAt: a.datetime(),
1045
+ updatedAt: a.datetime(),
1046
+ })
1047
+ .secondaryIndexes((index) => [
1048
+ index("sortOrder").sortKeys(["id"]).queryField("listNewsroomSectionsBySortOrder"),
1049
+ index("type").sortKeys(["sortOrder"]).queryField("listNewsroomSectionsByTypeAndSortOrder"),
1050
+ index("enabledStatus").sortKeys(["sortOrder"]).queryField("listNewsroomSectionsByEnabledStatusAndSortOrder"),
1051
+ ])
1052
+ .authorization((allow) => [
1053
+ allow.groups(categoryWriteGroups),
1054
+ allow.custom().to(authoringOperations),
1055
+ ]),
1056
+ KnowledgeCorpus: a
1057
+ .model({
1058
+ id: a.id().required(),
1059
+ name: a.string().required(),
1060
+ role: a.string().required(),
1061
+ itemCount: a.integer(),
1062
+ generatedAt: a.datetime(),
1063
+ latestImportRunId: a.id(),
1064
+ createdAt: a.datetime(),
1065
+ updatedAt: a.datetime(),
1066
+ })
1067
+ .secondaryIndexes((index) => [
1068
+ index("role").sortKeys(["name"]).queryField("listKnowledgeCorporaByRoleAndName"),
1069
+ ])
1070
+ .authorization((allow) => [
1071
+ allow.groups(categoryWriteGroups).to(["read"]),
1072
+ allow.custom().to(authoringOperations),
1073
+ ]),
1074
+ KnowledgeImportRun: a
1075
+ .model({
1076
+ id: a.id().required(),
1077
+ corpusId: a.id().required(),
1078
+ importKind: a.string().required(),
1079
+ corpusImportKindKey: a.string(),
1080
+ classifierId: a.string(),
1081
+ sourceSnapshotId: a.string(),
1082
+ status: a.string().required(),
1083
+ generatedAt: a.datetime(),
1084
+ importedAt: a.datetime().required(),
1085
+ itemCount: a.integer(),
1086
+ categoryCount: a.integer(),
1087
+ proposalCount: a.integer(),
1088
+ artifactCount: a.integer(),
1089
+ referenceCount: a.integer(),
1090
+ relationCount: a.integer(),
1091
+ warningCount: a.integer(),
1092
+ })
1093
+ .secondaryIndexes((index) => [
1094
+ index("corpusId").sortKeys(["importedAt"]).queryField("listKnowledgeImportRunsByCorpusAndImportedAt"),
1095
+ index("importKind").sortKeys(["importedAt"]).queryField("listKnowledgeImportRunsByKindAndImportedAt"),
1096
+ index("corpusImportKindKey").sortKeys(["importedAt"]).queryField("listKnowledgeImportRunsByCorpusKindAndImportedAt"),
1097
+ ])
1098
+ .authorization((allow) => [
1099
+ allow.groups(categoryWriteGroups).to(["read"]),
1100
+ allow.custom().to(authoringOperations),
1101
+ ]),
1102
+ KnowledgeRawPayload: a
1103
+ .model({
1104
+ id: a.id().required(),
1105
+ ownerType: a.string().required(),
1106
+ ownerId: a.id().required(),
1107
+ payloadKind: a.string().required(),
1108
+ importRunId: a.id(),
1109
+ createdAt: a.datetime().required(),
1110
+ updatedAt: a.datetime(),
1111
+ })
1112
+ .secondaryIndexes((index) => [
1113
+ index("ownerId").sortKeys(["payloadKind"]).queryField("listKnowledgeRawPayloadsByOwnerAndKind"),
1114
+ index("importRunId").sortKeys(["ownerType"]).queryField("listKnowledgeRawPayloadsByImportRunAndOwner"),
1115
+ ])
1116
+ .authorization((allow) => [
1117
+ allow.groups(categoryWriteGroups),
1118
+ allow.custom().to(authoringOperations),
1119
+ ]),
1120
+ KnowledgeArtifact: a
1121
+ .model({
1122
+ id: a.id().required(),
1123
+ corpusId: a.id().required(),
1124
+ artifactKind: a.string().required(),
1125
+ artifactId: a.string().required(),
1126
+ snapshotId: a.string(),
1127
+ displayName: a.string(),
1128
+ createdAt: a.datetime(),
1129
+ importRunId: a.id(),
1130
+ })
1131
+ .secondaryIndexes((index) => [
1132
+ index("corpusId").sortKeys(["artifactKind"]).queryField("listKnowledgeArtifactsByCorpusAndKind"),
1133
+ index("artifactKind").sortKeys(["createdAt"]).queryField("listKnowledgeArtifactsByKindAndCreatedAt"),
1134
+ index("importRunId").sortKeys(["artifactKind"]).queryField("listKnowledgeArtifactsByImportRunAndKind"),
1135
+ ])
1136
+ .authorization((allow) => [
1137
+ allow.groups(categoryWriteGroups).to(["read"]),
1138
+ allow.custom().to(authoringOperations),
1139
+ ]),
1140
+ CategorySet: a
1141
+ .model({
1142
+ id: a.id().required(),
1143
+ lineageId: a.id().required(),
1144
+ versionNumber: a.integer().required(),
1145
+ previousVersionId: a.id(),
1146
+ versionState: a.string().required(),
1147
+ versionCreatedAt: a.datetime().required(),
1148
+ versionCreatedBy: a.string(),
1149
+ changeReason: a.string(),
1150
+ contentHash: a.string(),
1151
+ corpusId: a.id().required(),
1152
+ classifierId: a.string().required(),
1153
+ displayName: a.string().required(),
1154
+ description: a.string(),
1155
+ status: a.string().required(),
1156
+ generatedAt: a.datetime(),
1157
+ categoryCount: a.integer(),
1158
+ importRunId: a.id(),
1159
+ })
1160
+ .secondaryIndexes((index) => [
1161
+ index("lineageId").sortKeys(["versionNumber"]).queryField("listCategorySetsByLineageAndVersion"),
1162
+ index("corpusId").sortKeys(["classifierId"]).queryField("listCategorySetsByCorpusAndClassifier"),
1163
+ index("status").sortKeys(["displayName"]).queryField("listCategorySetsByStatusAndName"),
1164
+ index("versionState").sortKeys(["generatedAt"]).queryField("listCategorySetsByVersionStateAndGeneratedAt"),
1165
+ ])
1166
+ .authorization((allow) => [
1167
+ allow.groups(categoryWriteGroups),
1168
+ allow.custom().to(authoringOperations),
1169
+ ]),
1170
+ Category: a
1171
+ .model({
1172
+ id: a.id().required(),
1173
+ lineageId: a.id().required(),
1174
+ versionNumber: a.integer().required(),
1175
+ previousVersionId: a.id(),
1176
+ versionState: a.string().required(),
1177
+ versionCreatedAt: a.datetime().required(),
1178
+ versionCreatedBy: a.string(),
1179
+ changeReason: a.string(),
1180
+ contentHash: a.string(),
1181
+ categorySetId: a.id().required(),
1182
+ corpusId: a.id().required(),
1183
+ categoryKey: a.string().required(),
1184
+ parentCategoryId: a.id(),
1185
+ parentCategoryKey: a.string(),
1186
+ displayName: a.string().required(),
1187
+ shortTitle: a.string(),
1188
+ subtitle: a.string(),
1189
+ description: a.string(),
1190
+ aliases: a.string().array(),
1191
+ status: a.string().required(),
1192
+ seedItemIds: a.string().array(),
1193
+ holdoutItemIds: a.string().array(),
1194
+ rank: a.integer(),
1195
+ depth: a.integer(),
1196
+ isPinned: a.boolean(),
1197
+ importRunId: a.id(),
1198
+ updatedAt: a.datetime(),
1199
+ })
1200
+ .secondaryIndexes((index) => [
1201
+ index("lineageId").sortKeys(["versionNumber"]).queryField("listCategoriesByLineageAndVersion"),
1202
+ index("categorySetId").sortKeys(["categoryKey"]).queryField("listCategoriesBySetAndKey"),
1203
+ index("parentCategoryId").sortKeys(["rank"]).queryField("listCategoriesByParentAndRank"),
1204
+ index("parentCategoryKey").sortKeys(["rank"]).queryField("listCategoriesByParentKeyAndRank"),
1205
+ index("corpusId").sortKeys(["displayName"]).queryField("listCategoriesByCorpusAndName"),
1206
+ index("status").sortKeys(["displayName"]).queryField("listCategoriesByStatusAndName"),
1207
+ ])
1208
+ .authorization((allow) => [
1209
+ allow.groups(categoryWriteGroups),
1210
+ allow.custom().to(authoringOperations),
1211
+ ]),
1212
+ CategoryKeyword: a
1213
+ .model({
1214
+ id: a.id().required(),
1215
+ categorySetId: a.id().required(),
1216
+ corpusId: a.id().required(),
1217
+ categoryKey: a.string().required(),
1218
+ categoryLineageId: a.id(),
1219
+ categoryId: a.id(),
1220
+ keyword: a.string().required(),
1221
+ normalizedKeyword: a.string().required(),
1222
+ weight: a.float(),
1223
+ rank: a.integer(),
1224
+ source: a.string().required(),
1225
+ sourceTopicId: a.string(),
1226
+ importRunId: a.id(),
1227
+ metadata: a.json(),
1228
+ createdAt: a.datetime().required(),
1229
+ updatedAt: a.datetime(),
1230
+ })
1231
+ .secondaryIndexes((index) => [
1232
+ index("categorySetId").sortKeys(["categoryKey", "rank"]).queryField("listCategoryKeywordsBySetKeyAndRank"),
1233
+ index("categoryKey").sortKeys(["rank"]).queryField("listCategoryKeywordsByCategoryKeyAndRank"),
1234
+ index("normalizedKeyword").sortKeys(["categorySetId"]).queryField("listCategoryKeywordsByNormalizedKeywordAndSet"),
1235
+ index("importRunId").sortKeys(["rank"]).queryField("listCategoryKeywordsByImportRunAndRank"),
1236
+ ])
1237
+ .authorization((allow) => [
1238
+ allow.groups(categoryWriteGroups),
1239
+ allow.custom().to(authoringOperations),
1240
+ ]),
1241
+ LexicalSteeringRule: a
1242
+ .model({
1243
+ id: a.id().required(),
1244
+ ruleKind: a.string().required(),
1245
+ term: a.string().required(),
1246
+ normalizedTerm: a.string().required(),
1247
+ scope: a.string().required(),
1248
+ status: a.string().required(),
1249
+ corpusId: a.id(),
1250
+ classifierId: a.string(),
1251
+ categorySetId: a.id(),
1252
+ categoryKey: a.string(),
1253
+ note: a.string(),
1254
+ source: a.string(),
1255
+ createdBy: a.string(),
1256
+ createdAt: a.datetime().required(),
1257
+ updatedAt: a.datetime(),
1258
+ metadata: a.json(),
1259
+ })
1260
+ .secondaryIndexes((index) => [
1261
+ index("status").sortKeys(["normalizedTerm"]).queryField("listLexicalSteeringRulesByStatusAndTerm"),
1262
+ index("scope").sortKeys(["normalizedTerm"]).queryField("listLexicalSteeringRulesByScopeAndTerm"),
1263
+ index("categorySetId").sortKeys(["normalizedTerm"]).queryField("listLexicalSteeringRulesBySetAndTerm"),
1264
+ index("corpusId").sortKeys(["normalizedTerm"]).queryField("listLexicalSteeringRulesByCorpusAndTerm"),
1265
+ ])
1266
+ .authorization((allow) => [
1267
+ allow.groups(categoryWriteGroups),
1268
+ allow.custom().to(authoringOperations),
1269
+ ]),
1270
+ SteeringProposal: a
1271
+ .model({
1272
+ id: a.id().required(),
1273
+ categorySetId: a.id(),
1274
+ corpusId: a.id().required(),
1275
+ importRunId: a.id(),
1276
+ proposalKind: a.string().required(),
1277
+ steeringDomain: a.string().required(),
1278
+ status: a.string().required(),
1279
+ title: a.string().required(),
1280
+ summary: a.string(),
1281
+ categoryKey: a.string(),
1282
+ targetCategoryKey: a.string(),
1283
+ graphEntityId: a.string(),
1284
+ relationshipType: a.string(),
1285
+ displayName: a.string(),
1286
+ shortTitle: a.string(),
1287
+ subtitle: a.string(),
1288
+ description: a.string(),
1289
+ evidenceItemIds: a.string().array(),
1290
+ suggestedSeedItemIds: a.string().array(),
1291
+ suggestedHoldoutItemIds: a.string().array(),
1292
+ sourceSnapshotId: a.string(),
1293
+ proposedAt: a.datetime(),
1294
+ reviewedAt: a.datetime(),
1295
+ reviewedBy: a.string(),
1296
+ updatedAt: a.datetime(),
1297
+ })
1298
+ .secondaryIndexes((index) => [
1299
+ index("status").sortKeys(["proposedAt"]).queryField("listSteeringProposalsByStatusAndProposedAt"),
1300
+ index("categorySetId").sortKeys(["status"]).queryField("listSteeringProposalsBySetAndStatus"),
1301
+ index("corpusId").sortKeys(["proposalKind"]).queryField("listSteeringProposalsByCorpusAndKind"),
1302
+ index("steeringDomain").sortKeys(["status"]).queryField("listSteeringProposalsByDomainAndStatus"),
1303
+ ])
1304
+ .authorization((allow) => [
1305
+ allow.groups(categoryWriteGroups).to(["read"]),
1306
+ allow.custom().to(authoringOperations),
1307
+ ]),
1308
+ SteeringDecision: a
1309
+ .model({
1310
+ id: a.id().required(),
1311
+ proposalId: a.id().required(),
1312
+ categorySetId: a.id(),
1313
+ action: a.string().required(),
1314
+ actorSub: a.string(),
1315
+ actorLabel: a.string(),
1316
+ note: a.string(),
1317
+ selectedCategoryKey: a.string(),
1318
+ createdAt: a.datetime().required(),
1319
+ })
1320
+ .secondaryIndexes((index) => [
1321
+ index("proposalId").sortKeys(["createdAt"]).queryField("listSteeringDecisionsByProposalAndCreatedAt"),
1322
+ index("categorySetId").sortKeys(["createdAt"]).queryField("listSteeringDecisionsBySetAndCreatedAt"),
1323
+ ])
1324
+ .authorization((allow) => [
1325
+ allow.groups(categoryWriteGroups).to(categoryAppendOnlyOperations),
1326
+ allow.custom().to(authoringOperations),
1327
+ ]),
1328
+ Reference: a
1329
+ .model({
1330
+ id: a.id().required(),
1331
+ lineageId: a.id().required(),
1332
+ versionNumber: a.integer().required(),
1333
+ previousVersionId: a.id(),
1334
+ versionState: a.string().required(),
1335
+ versionCreatedAt: a.datetime().required(),
1336
+ versionCreatedBy: a.string(),
1337
+ changeReason: a.string(),
1338
+ contentHash: a.string(),
1339
+ corpusId: a.id().required(),
1340
+ externalItemId: a.string().required(),
1341
+ title: a.string(),
1342
+ authors: a.string().array(),
1343
+ sourceUri: a.string(),
1344
+ storagePath: a.string(),
1345
+ mediaType: a.string(),
1346
+ byteSize: a.integer(),
1347
+ sha256: a.string(),
1348
+ sourcePublishedAt: a.string(),
1349
+ sourceUpdatedAt: a.string(),
1350
+ retrievedAt: a.string(),
1351
+ inboundCitationCount: a.integer(),
1352
+ outboundCitationCount: a.integer(),
1353
+ importRunId: a.id(),
1354
+ importedAt: a.datetime(),
1355
+ createdAt: a.datetime(),
1356
+ curationStatus: a.string(),
1357
+ curationStatusKey: a.string(),
1358
+ curationStatusUpdatedAt: a.datetime(),
1359
+ curationStatusUpdatedBy: a.string(),
1360
+ curationStatusReason: a.string(),
1361
+ newsroomFeedKey: a.string(),
1362
+ reviewedFeedKey: a.string(),
1363
+ updatedAt: a.datetime(),
1364
+ })
1365
+ .secondaryIndexes((index) => [
1366
+ index("newsroomFeedKey").sortKeys(["createdAt"]).queryField("listReferencesByNewsroomFeedAndCreatedAt"),
1367
+ index("newsroomFeedKey").sortKeys(["importedAt"]).queryField("listReferencesByNewsroomFeedAndImportedAt"),
1368
+ index("lineageId").sortKeys(["versionNumber"]).queryField("listReferencesByLineageAndVersion"),
1369
+ index("corpusId").sortKeys(["externalItemId"]).queryField("listReferencesByCorpusAndExternalItem"),
1370
+ index("versionState").sortKeys(["updatedAt"]).queryField("listReferencesByVersionStateAndUpdatedAt"),
1371
+ index("importRunId").sortKeys(["externalItemId"]).queryField("listReferencesByImportRunAndExternalItem"),
1372
+ index("curationStatus").sortKeys(["curationStatusUpdatedAt"]).queryField("listReferencesByCurationStatusAndUpdatedAt"),
1373
+ index("curationStatusKey").sortKeys(["curationStatusUpdatedAt"]).queryField("listReferencesByCurationStatusKeyAndUpdatedAt"),
1374
+ index("reviewedFeedKey").sortKeys(["updatedAt"]).queryField("listReferencesByReviewedFeedAndUpdatedAt"),
1375
+ ])
1376
+ .authorization((allow) => [
1377
+ allow.groups(categoryWriteGroups).to(["read"]),
1378
+ allow.custom().to(authoringOperations),
1379
+ ]),
1380
+ ReferenceAttachment: a
1381
+ .model({
1382
+ id: a.id().required(),
1383
+ referenceId: a.id().required(),
1384
+ referenceLineageId: a.id().required(),
1385
+ referenceVersionNumber: a.integer(),
1386
+ referenceVersionKey: a.string().required(),
1387
+ role: a.string().required(),
1388
+ sortKey: a.string().required(),
1389
+ storagePath: a.string(),
1390
+ sourceUri: a.string(),
1391
+ filename: a.string(),
1392
+ mediaType: a.string(),
1393
+ byteSize: a.integer(),
1394
+ sha256: a.string(),
1395
+ etag: a.string(),
1396
+ importRunId: a.id(),
1397
+ importedAt: a.datetime(),
1398
+ metadata: a.json(),
1399
+ })
1400
+ .secondaryIndexes((index) => [
1401
+ index("referenceVersionKey").sortKeys(["sortKey"]).queryField("listReferenceAttachmentsByReferenceVersionAndSortKey"),
1402
+ index("referenceLineageId").sortKeys(["sortKey"]).queryField("listReferenceAttachmentsByReferenceLineageAndSortKey"),
1403
+ index("storagePath").queryField("referenceAttachmentByStoragePath"),
1404
+ index("importRunId").sortKeys(["sortKey"]).queryField("listReferenceAttachmentsByImportRunAndSortKey"),
1405
+ ])
1406
+ .authorization((allow) => [
1407
+ allow.groups(categoryWriteGroups).to(["read"]),
1408
+ allow.custom().to(authoringOperations),
1409
+ ]),
1410
+ SemanticNode: a
1411
+ .model({
1412
+ id: a.id().required(),
1413
+ lineageId: a.id().required(),
1414
+ versionNumber: a.integer().required(),
1415
+ previousVersionId: a.id(),
1416
+ versionState: a.string().required(),
1417
+ versionCreatedAt: a.datetime().required(),
1418
+ versionCreatedBy: a.string(),
1419
+ changeReason: a.string(),
1420
+ contentHash: a.string(),
1421
+ nodeKey: a.string().required(),
1422
+ nodeKind: a.string().required(),
1423
+ corpusId: a.id(),
1424
+ categorySetId: a.id(),
1425
+ categoryLineageId: a.id(),
1426
+ categoryKey: a.string(),
1427
+ displayName: a.string(),
1428
+ description: a.string(),
1429
+ aliases: a.string().array(),
1430
+ authorityScore: a.float(),
1431
+ authorityRank: a.integer(),
1432
+ acceptedReferenceMentionCount: a.integer(),
1433
+ distinctSourceKindCount: a.integer(),
1434
+ relationCount: a.integer(),
1435
+ status: a.string().required(),
1436
+ importRunId: a.id(),
1437
+ createdAt: a.datetime(),
1438
+ newsroomFeedKey: a.string(),
1439
+ updatedAt: a.datetime(),
1440
+ })
1441
+ .secondaryIndexes((index) => [
1442
+ index("newsroomFeedKey").sortKeys(["createdAt"]).queryField("listSemanticNodesByNewsroomFeedAndCreatedAt"),
1443
+ index("lineageId").sortKeys(["versionNumber"]).queryField("listSemanticNodesByLineageAndVersion"),
1444
+ index("nodeKey").sortKeys(["versionNumber"]).queryField("listSemanticNodesByNodeKeyAndVersion"),
1445
+ index("corpusId").sortKeys(["nodeKey"]).queryField("listSemanticNodesByCorpusAndNodeKey"),
1446
+ index("importRunId").sortKeys(["nodeKey"]).queryField("listSemanticNodesByImportRunAndNodeKey"),
1447
+ index("versionState").sortKeys(["updatedAt"]).queryField("listSemanticNodesByVersionStateAndUpdatedAt"),
1448
+ ])
1449
+ .authorization((allow) => [
1450
+ allow.groups(categoryWriteGroups).to(["read"]),
1451
+ allow.custom().to(authoringOperations),
1452
+ ]),
1453
+ Message: a
1454
+ .model({
1455
+ id: a.id().required(),
1456
+ messageKind: a.string().required(),
1457
+ messageDomain: a.string().required(),
1458
+ status: a.string().required(),
1459
+ summary: a.string(),
1460
+ source: a.string(),
1461
+ importRunId: a.id(),
1462
+ authorSub: a.string(),
1463
+ authorUserProfileId: a.id(),
1464
+ authorLabel: a.string(),
1465
+ threadId: a.id(),
1466
+ parentMessageId: a.id(),
1467
+ sequenceNumber: a.integer(),
1468
+ role: a.string(),
1469
+ messageType: a.string(),
1470
+ content: a.string(),
1471
+ semanticLayer: a.string(),
1472
+ searchVisibility: a.string(),
1473
+ responseTarget: a.string(),
1474
+ responseStatus: a.string(),
1475
+ responseOwner: a.string(),
1476
+ responseStartedAt: a.datetime(),
1477
+ responseCompletedAt: a.datetime(),
1478
+ responseError: a.string(),
1479
+ metadata: a.json(),
1480
+ createdAt: a.datetime().required(),
1481
+ updatedAt: a.datetime().required(),
1482
+ newsroomFeedKey: a.string(),
1483
+ })
1484
+ .secondaryIndexes((index) => [
1485
+ index("newsroomFeedKey").sortKeys(["createdAt"]).queryField("listMessagesByNewsroomFeedAndCreatedAt"),
1486
+ index("status").sortKeys(["createdAt"]).queryField("listMessagesByStatusAndCreatedAt"),
1487
+ index("messageKind").sortKeys(["createdAt"]).queryField("listMessagesByKindAndCreatedAt"),
1488
+ index("messageDomain").sortKeys(["createdAt"]).queryField("listMessagesByDomainAndCreatedAt"),
1489
+ index("authorSub").sortKeys(["createdAt"]).queryField("listMessagesByAuthorSubAndCreatedAt"),
1490
+ index("authorUserProfileId").sortKeys(["createdAt"]).queryField("listMessagesByAuthorProfileAndCreatedAt"),
1491
+ index("importRunId").sortKeys(["createdAt"]).queryField("listMessagesByImportRunAndCreatedAt"),
1492
+ index("threadId").sortKeys(["sequenceNumber"]).name("messagesByThreadSequence").queryField("listMessagesByThreadAndSequence"),
1493
+ index("threadId").sortKeys(["createdAt"]).name("messagesByThreadCreatedAt").queryField("listMessagesByThreadAndCreatedAt"),
1494
+ index("responseTarget").sortKeys(["responseStatus", "createdAt"]).name("messagesByResponseTargetStatusCreatedAt").queryField("listMessagesByResponseTargetStatusAndCreatedAt"),
1495
+ index("semanticLayer").sortKeys(["createdAt"]).name("messagesBySemanticLayerCreatedAt").queryField("listMessagesBySemanticLayerAndCreatedAt"),
1496
+ index("searchVisibility").sortKeys(["createdAt"]).name("messagesBySearchVisibilityCreatedAt").queryField("listMessagesBySearchVisibilityAndCreatedAt"),
1497
+ ])
1498
+ .authorization((allow) => [
1499
+ allow.groups(categoryWriteGroups).to(categoryAppendOnlyOperations),
1500
+ allow.custom().to(authoringOperations),
1501
+ allow.authenticated("identityPool").to(["read", "create", "update"]),
1502
+ ]),
1503
+ MessageThread: a
1504
+ .model({
1505
+ id: a.id().required(),
1506
+ threadKind: a.string().required(),
1507
+ status: a.string().required(),
1508
+ title: a.string().required(),
1509
+ summary: a.string(),
1510
+ primaryAnchorKind: a.string(),
1511
+ primaryAnchorId: a.id(),
1512
+ primaryAnchorLineageId: a.id(),
1513
+ primaryAnchorKey: a.string(),
1514
+ createdBySub: a.string(),
1515
+ createdByUserProfileId: a.id(),
1516
+ createdByLabel: a.string(),
1517
+ messageCount: a.integer(),
1518
+ lastMessageId: a.id(),
1519
+ lastMessageAt: a.datetime(),
1520
+ contextDigest: a.string(),
1521
+ activeResponseMessageId: a.id(),
1522
+ responseLockOwner: a.string(),
1523
+ responseLockExpiresAt: a.datetime(),
1524
+ metadata: a.json(),
1525
+ createdAt: a.datetime().required(),
1526
+ updatedAt: a.datetime().required(),
1527
+ newsroomFeedKey: a.string(),
1528
+ })
1529
+ .secondaryIndexes((index) => [
1530
+ index("newsroomFeedKey").sortKeys(["updatedAt"]).queryField("listMessageThreadsByNewsroomFeedAndUpdatedAt"),
1531
+ index("threadKind").sortKeys(["updatedAt"]).queryField("listMessageThreadsByKindAndUpdatedAt"),
1532
+ index("status").sortKeys(["updatedAt"]).queryField("listMessageThreadsByStatusAndUpdatedAt"),
1533
+ index("primaryAnchorKey").sortKeys(["updatedAt"]).name("messageThreadsByAnchorUpdatedAt").queryField("listMessageThreadsByAnchorAndUpdatedAt"),
1534
+ index("createdBySub").sortKeys(["updatedAt"]).queryField("listMessageThreadsByCreatorAndUpdatedAt"),
1535
+ ])
1536
+ .authorization((allow) => [
1537
+ allow.groups(categoryWriteGroups).to(["read", "create", "update"]),
1538
+ allow.authenticated("identityPool").to(authoringOperations),
1539
+ allow.custom().to(authoringOperations),
1540
+ ]),
1541
+ ModelAttachment: a
1542
+ .model({
1543
+ id: a.id().required(),
1544
+ ownerKind: a.string().required(),
1545
+ ownerId: a.id().required(),
1546
+ ownerLineageId: a.id(),
1547
+ ownerVersionNumber: a.integer(),
1548
+ ownerVersionKey: a.string(),
1549
+ role: a.string().required(),
1550
+ sortKey: a.string().required(),
1551
+ storagePath: a.string().required(),
1552
+ filename: a.string(),
1553
+ mediaType: a.string().required(),
1554
+ byteSize: a.integer(),
1555
+ sha256: a.string(),
1556
+ etag: a.string(),
1557
+ importRunId: a.id(),
1558
+ createdAt: a.datetime().required(),
1559
+ updatedAt: a.datetime(),
1560
+ status: a.string().required(),
1561
+ })
1562
+ .secondaryIndexes((index) => [
1563
+ index("ownerId").sortKeys(["role", "sortKey"]).queryField("listModelAttachmentsByOwnerRoleAndSortKey"),
1564
+ index("ownerVersionKey").sortKeys(["role", "sortKey"]).queryField("listModelAttachmentsByOwnerVersionRoleAndSortKey"),
1565
+ index("storagePath").queryField("modelAttachmentByStoragePath"),
1566
+ index("importRunId").sortKeys(["ownerKind", "role"]).queryField("listModelAttachmentsByImportRunKindAndRole"),
1567
+ index("role").sortKeys(["status", "createdAt"]).queryField("listModelAttachmentsByRoleStatusAndCreatedAt"),
1568
+ ])
1569
+ .authorization((allow) => [
1570
+ allow.groups(categoryWriteGroups).to(["read"]),
1571
+ allow.custom().to(authoringOperations),
1572
+ ]),
1573
+ SemanticRelationType: a
1574
+ .model({
1575
+ id: a.id().required(),
1576
+ key: a.string().required(),
1577
+ label: a.string().required(),
1578
+ inverseLabel: a.string(),
1579
+ description: a.string(),
1580
+ domain: a.string().required(),
1581
+ status: a.string().required(),
1582
+ allowedSubjectKinds: a.string().array(),
1583
+ allowedObjectKinds: a.string().array(),
1584
+ isDirectional: a.boolean(),
1585
+ isSymmetric: a.boolean(),
1586
+ isTransitive: a.boolean(),
1587
+ contextPackTags: a.string().array(),
1588
+ createdAt: a.datetime().required(),
1589
+ updatedAt: a.datetime().required(),
1590
+ metadata: a.json(),
1591
+ })
1592
+ .secondaryIndexes((index) => [
1593
+ index("key").queryField("semanticRelationTypeByKey"),
1594
+ index("domain").sortKeys(["label"]).queryField("listSemanticRelationTypesByDomainAndLabel"),
1595
+ index("status").sortKeys(["label"]).queryField("listSemanticRelationTypesByStatusAndLabel"),
1596
+ ])
1597
+ .authorization((allow) => [
1598
+ allow.groups(categoryWriteGroups),
1599
+ allow.custom().to(authoringOperations),
1600
+ ]),
1601
+ SemanticRelation: a
1602
+ .model({
1603
+ id: a.id().required(),
1604
+ relationState: a.string().required(),
1605
+ predicate: a.string().required(),
1606
+ relationTypeId: a.id(),
1607
+ relationTypeKey: a.string(),
1608
+ relationDomain: a.string(),
1609
+ subjectKind: a.string().required(),
1610
+ subjectId: a.id().required(),
1611
+ subjectLineageId: a.id().required(),
1612
+ subjectVersionNumber: a.integer(),
1613
+ objectKind: a.string().required(),
1614
+ objectId: a.id().required(),
1615
+ objectLineageId: a.id().required(),
1616
+ objectVersionNumber: a.integer(),
1617
+ subjectStateKey: a.string().required(),
1618
+ objectStateKey: a.string().required(),
1619
+ objectSubjectStateKey: a.string().required(),
1620
+ predicateObjectStateKey: a.string().required(),
1621
+ subjectVersionKey: a.string().required(),
1622
+ objectVersionKey: a.string().required(),
1623
+ score: a.float(),
1624
+ confidence: a.float(),
1625
+ rank: a.integer(),
1626
+ classifierId: a.string(),
1627
+ modelVersion: a.string(),
1628
+ reviewRecommended: a.boolean(),
1629
+ sourceSnapshotId: a.string(),
1630
+ importRunId: a.id(),
1631
+ importedAt: a.datetime(),
1632
+ createdAt: a.datetime(),
1633
+ updatedAt: a.datetime(),
1634
+ newsroomFeedKey: a.string(),
1635
+ metadata: a.json(),
1636
+ })
1637
+ .secondaryIndexes((index) => [
1638
+ index("newsroomFeedKey").sortKeys(["createdAt"]).queryField("listSemanticRelationsByNewsroomFeedAndCreatedAt"),
1639
+ index("subjectStateKey").sortKeys(["predicateObjectStateKey"]).queryField("listSemanticRelationsBySubjectState"),
1640
+ index("objectStateKey").sortKeys(["predicate"]).queryField("listSemanticRelationsByObjectState"),
1641
+ index("objectSubjectStateKey").sortKeys(["score"]).queryField("listSemanticRelationsByObjectSubjectStateAndScore"),
1642
+ index("predicateObjectStateKey").sortKeys(["score"]).queryField("listSemanticRelationsByPredicateObjectStateAndScore"),
1643
+ index("subjectVersionKey").sortKeys(["predicateObjectStateKey"]).queryField("listSemanticRelationsBySubjectVersion"),
1644
+ index("importRunId").sortKeys(["importedAt"]).queryField("listSemanticRelationsByImportRunAndImportedAt"),
1645
+ index("relationTypeKey").sortKeys(["importedAt"]).queryField("listSemanticRelationsByTypeAndImportedAt"),
1646
+ index("relationDomain").sortKeys(["importedAt"]).queryField("listSemanticRelationsByDomainAndImportedAt"),
1647
+ ])
1648
+ .authorization((allow) => [
1649
+ allow.groups(categoryWriteGroups).to(categoryAppendOnlyOperations),
1650
+ allow.custom().to(authoringOperations),
1651
+ ]),
1652
+ Item: a
1653
+ .model({
1654
+ id: a.id().required(),
1655
+ lineageId: a.id().required(),
1656
+ versionNumber: a.integer().required(),
1657
+ previousVersionId: a.id(),
1658
+ versionState: a.string().required(),
1659
+ versionCreatedAt: a.datetime().required(),
1660
+ versionCreatedBy: a.string(),
1661
+ changeReason: a.string(),
1662
+ contentHash: a.string(),
1663
+ type: a.string().required(),
1664
+ status: a.string().required(),
1665
+ typeStatus: a.string().required(),
1666
+ slug: a.string().required(),
1667
+ shortSlug: a.string(),
1668
+ section: a.string(),
1669
+ sectionStatus: a.string(),
1670
+ title: a.string(),
1671
+ headline: a.string(),
1672
+ deck: a.string(),
1673
+ body: a.string().array(),
1674
+ bodyMarkus: a.string(),
1675
+ bodyIr: a.json(),
1676
+ aliases: a.string().array(),
1677
+ metadata: a.json(),
1678
+ byline: a.string(),
1679
+ dateline: a.string(),
1680
+ publishedAt: a.datetime(),
1681
+ editionDate: a.string(),
1682
+ sortTitle: a.string(),
1683
+ pullQuotes: a.string().array(),
1684
+ layout: a.json(),
1685
+ editorial: a.json(),
1686
+ updatedAt: a.datetime(),
1687
+ tags: a.hasMany("ItemTag", "itemId"),
1688
+ mediaAssets: a.hasMany("MediaAsset", "itemId"),
1689
+ editionItems: a.hasMany("EditionItem", "itemId"),
1690
+ })
1691
+ .secondaryIndexes((index) => [
1692
+ index("lineageId").sortKeys(["versionNumber"]).queryField("listItemsByLineageAndVersion"),
1693
+ index("slug").queryField("itemBySlug"),
1694
+ index("typeStatus").sortKeys(["publishedAt"]).queryField("listItemsByTypeStatusAndPublishedAt"),
1695
+ index("sectionStatus").sortKeys(["publishedAt"]).queryField("listItemsBySectionStatusAndPublishedAt"),
1696
+ index("versionState").sortKeys(["updatedAt"]).queryField("listItemsByVersionStateAndUpdatedAt"),
1697
+ ])
1698
+ .authorization((allow) => [
1699
+ allow.groups(contentWriteGroups),
1700
+ allow.custom().to(authoringOperations),
1701
+ ]),
1702
+ Tag: a
1703
+ .model({
1704
+ id: a.id().required(),
1705
+ slug: a.string().required(),
1706
+ label: a.string().required(),
1707
+ type: a.string(),
1708
+ description: a.string(),
1709
+ items: a.hasMany("ItemTag", "tagId"),
1710
+ })
1711
+ .secondaryIndexes((index) => [
1712
+ index("slug").queryField("tagBySlug"),
1713
+ index("type").sortKeys(["label"]).queryField("listTagsByTypeAndLabel"),
1714
+ ])
1715
+ .authorization((allow) => [
1716
+ allow.groups(contentWriteGroups),
1717
+ allow.custom().to(authoringOperations),
1718
+ ]),
1719
+ ItemTag: a
1720
+ .model({
1721
+ id: a.id().required(),
1722
+ itemId: a.id().required(),
1723
+ tagId: a.id().required(),
1724
+ itemType: a.string().required(),
1725
+ itemStatus: a.string().required(),
1726
+ tagSlug: a.string().required(),
1727
+ publishedAt: a.datetime(),
1728
+ item: a.belongsTo("Item", "itemId"),
1729
+ tag: a.belongsTo("Tag", "tagId"),
1730
+ })
1731
+ .secondaryIndexes((index) => [
1732
+ index("itemId").sortKeys(["tagSlug"]).queryField("listItemTagsByItemAndTag"),
1733
+ index("tagId").sortKeys(["publishedAt"]).queryField("listItemTagsByTagAndPublishedAt"),
1734
+ ])
1735
+ .authorization((allow) => [
1736
+ allow.groups(contentWriteGroups),
1737
+ allow.custom().to(authoringOperations),
1738
+ ]),
1739
+ MediaAsset: a
1740
+ .model({
1741
+ id: a.id().required(),
1742
+ itemId: a.id().required(),
1743
+ type: a.string().required(),
1744
+ role: a.string().required(),
1745
+ sortKey: a.string().required(),
1746
+ storagePath: a.string(),
1747
+ externalUrl: a.string(),
1748
+ alt: a.string().required(),
1749
+ caption: a.string(),
1750
+ credit: a.string(),
1751
+ width: a.integer(),
1752
+ height: a.integer(),
1753
+ aspectRatio: a.float(),
1754
+ focalX: a.float(),
1755
+ focalY: a.float(),
1756
+ minHeight: a.integer(),
1757
+ preferredHeight: a.integer(),
1758
+ maxHeight: a.integer(),
1759
+ crop: a.string(),
1760
+ wrapsText: a.boolean(),
1761
+ metadata: a.json(),
1762
+ item: a.belongsTo("Item", "itemId"),
1763
+ })
1764
+ .secondaryIndexes((index) => [
1765
+ index("itemId").sortKeys(["sortKey"]).queryField("listMediaAssetsByItemAndSortKey"),
1766
+ index("role").sortKeys(["itemId"]).queryField("listMediaAssetsByRoleAndItem"),
1767
+ ])
1768
+ .authorization((allow) => [
1769
+ allow.groups(contentWriteGroups),
1770
+ allow.custom().to(authoringOperations),
1771
+ ]),
1772
+ Edition: a
1773
+ .model({
1774
+ id: a.id().required(),
1775
+ lineageId: a.id().required(),
1776
+ versionNumber: a.integer().required(),
1777
+ previousVersionId: a.id(),
1778
+ versionState: a.string().required(),
1779
+ versionCreatedAt: a.datetime().required(),
1780
+ versionCreatedBy: a.string(),
1781
+ changeReason: a.string(),
1782
+ contentHash: a.string(),
1783
+ slug: a.string().required(),
1784
+ title: a.string().required(),
1785
+ status: a.string().required(),
1786
+ editionDate: a.string().required(),
1787
+ publishedAt: a.datetime(),
1788
+ description: a.string(),
1789
+ layoutPlan: a.json(),
1790
+ metadata: a.json(),
1791
+ items: a.hasMany("EditionItem", "editionId"),
1792
+ slots: a.hasMany("EditionSlot", "editionId"),
1793
+ })
1794
+ .secondaryIndexes((index) => [
1795
+ index("lineageId").sortKeys(["versionNumber"]).queryField("listEditionsByLineageAndVersion"),
1796
+ index("slug").queryField("editionBySlug"),
1797
+ index("status").sortKeys(["editionDate"]).queryField("listEditionsByStatusAndEditionDate"),
1798
+ index("status").sortKeys(["publishedAt"]).queryField("listEditionsByStatusAndPublishedAt"),
1799
+ index("versionState").sortKeys(["publishedAt"]).queryField("listEditionsByVersionStateAndPublishedAt"),
1800
+ ])
1801
+ .authorization((allow) => [
1802
+ allow.groups(contentWriteGroups),
1803
+ allow.custom().to(authoringOperations),
1804
+ ]),
1805
+ EditionSlot: a
1806
+ .model({
1807
+ id: a.id().required(),
1808
+ editionId: a.id().required(),
1809
+ sectionKey: a.string().required(),
1810
+ slotRank: a.integer().required(),
1811
+ targetType: a.string().required(),
1812
+ targetLengthBand: a.string(),
1813
+ minImageAssets: a.integer(),
1814
+ status: a.string().required(),
1815
+ selectedAssignmentId: a.id(),
1816
+ metadata: a.json(),
1817
+ createdAt: a.datetime().required(),
1818
+ updatedAt: a.datetime().required(),
1819
+ edition: a.belongsTo("Edition", "editionId"),
1820
+ })
1821
+ .secondaryIndexes((index) => [
1822
+ index("editionId").sortKeys(["sectionKey", "slotRank"]).queryField("listEditionSlotsByEditionSectionAndRank"),
1823
+ index("sectionKey").sortKeys(["editionId", "slotRank"]).queryField("listEditionSlotsBySectionEditionAndRank"),
1824
+ index("status").sortKeys(["updatedAt"]).queryField("listEditionSlotsByStatusAndUpdatedAt"),
1825
+ index("selectedAssignmentId").sortKeys(["updatedAt"]).queryField("listEditionSlotsBySelectedAssignmentAndUpdatedAt"),
1826
+ ])
1827
+ .authorization((allow) => [
1828
+ allow.groups(categoryWriteGroups).to(categoryAppendOnlyOperations),
1829
+ allow.custom().to(authoringOperations),
1830
+ ]),
1831
+ EditionItem: a
1832
+ .model({
1833
+ id: a.id().required(),
1834
+ editionId: a.id().required(),
1835
+ editionLineageId: a.id(),
1836
+ itemId: a.id().required(),
1837
+ itemLineageId: a.id(),
1838
+ placementKey: a.string().required(),
1839
+ sortKey: a.string().required(),
1840
+ pageNumber: a.integer(),
1841
+ priority: a.integer(),
1842
+ metadata: a.json(),
1843
+ edition: a.belongsTo("Edition", "editionId"),
1844
+ item: a.belongsTo("Item", "itemId"),
1845
+ })
1846
+ .secondaryIndexes((index) => [
1847
+ index("editionId").sortKeys(["sortKey"]).queryField("listEditionItemsByEditionAndSortKey"),
1848
+ index("itemId").sortKeys(["editionId"]).queryField("listEditionItemsByItemAndEdition"),
1849
+ ])
1850
+ .authorization((allow) => [
1851
+ allow.groups(contentWriteGroups),
1852
+ allow.custom().to(authoringOperations),
1853
+ ]),
1854
+ PublishedItem: a
1855
+ .model({
1856
+ id: a.id().required(),
1857
+ sourceItemId: a.id().required(),
1858
+ itemLineageId: a.id().required(),
1859
+ versionNumber: a.integer().required(),
1860
+ type: a.string().required(),
1861
+ status: a.string().required(),
1862
+ typeStatus: a.string().required(),
1863
+ slug: a.string().required(),
1864
+ shortSlug: a.string(),
1865
+ section: a.string(),
1866
+ sectionStatus: a.string(),
1867
+ title: a.string(),
1868
+ headline: a.string(),
1869
+ deck: a.string(),
1870
+ body: a.string().array(),
1871
+ bodyMarkus: a.string(),
1872
+ bodyIr: a.json(),
1873
+ aliases: a.string().array(),
1874
+ metadata: a.json(),
1875
+ byline: a.string(),
1876
+ dateline: a.string(),
1877
+ publishedAt: a.datetime(),
1878
+ editionDate: a.string(),
1879
+ sortTitle: a.string(),
1880
+ pullQuotes: a.string().array(),
1881
+ layout: a.json(),
1882
+ editorial: a.json(),
1883
+ })
1884
+ .secondaryIndexes((index) => [
1885
+ index("slug").queryField("publishedItemBySlug"),
1886
+ index("typeStatus").sortKeys(["publishedAt"]).queryField("listPublishedItemsByTypeStatusAndPublishedAt"),
1887
+ index("sectionStatus").sortKeys(["publishedAt"]).queryField("listPublishedItemsBySectionStatusAndPublishedAt"),
1888
+ index("itemLineageId").sortKeys(["versionNumber"]).queryField("listPublishedItemsByLineageAndVersion"),
1889
+ ])
1890
+ .authorization((allow) => [
1891
+ allow.guest().to(["read"]),
1892
+ allow.groups(contentWriteGroups),
1893
+ allow.custom().to(authoringOperations),
1894
+ ]),
1895
+ PublishedMediaAsset: a
1896
+ .model({
1897
+ id: a.id().required(),
1898
+ sourceMediaAssetId: a.id().required(),
1899
+ publishedItemId: a.id().required(),
1900
+ sourceItemId: a.id().required(),
1901
+ itemLineageId: a.id().required(),
1902
+ type: a.string().required(),
1903
+ role: a.string().required(),
1904
+ sortKey: a.string().required(),
1905
+ storagePath: a.string(),
1906
+ externalUrl: a.string(),
1907
+ alt: a.string().required(),
1908
+ caption: a.string(),
1909
+ credit: a.string(),
1910
+ width: a.integer(),
1911
+ height: a.integer(),
1912
+ aspectRatio: a.float(),
1913
+ focalX: a.float(),
1914
+ focalY: a.float(),
1915
+ minHeight: a.integer(),
1916
+ preferredHeight: a.integer(),
1917
+ maxHeight: a.integer(),
1918
+ crop: a.string(),
1919
+ wrapsText: a.boolean(),
1920
+ metadata: a.json(),
1921
+ })
1922
+ .secondaryIndexes((index) => [
1923
+ index("publishedItemId").sortKeys(["sortKey"]).queryField("listPublishedMediaAssetsByItemAndSortKey"),
1924
+ index("role").sortKeys(["publishedItemId"]).queryField("listPublishedMediaAssetsByRoleAndItem"),
1925
+ ])
1926
+ .authorization((allow) => [
1927
+ allow.guest().to(["read"]),
1928
+ allow.groups(contentWriteGroups),
1929
+ allow.custom().to(authoringOperations),
1930
+ ]),
1931
+ PublishedEdition: a
1932
+ .model({
1933
+ id: a.id().required(),
1934
+ sourceEditionId: a.id().required(),
1935
+ editionLineageId: a.id().required(),
1936
+ versionNumber: a.integer().required(),
1937
+ slug: a.string().required(),
1938
+ title: a.string().required(),
1939
+ status: a.string().required(),
1940
+ editionDate: a.string().required(),
1941
+ publishedAt: a.datetime(),
1942
+ description: a.string(),
1943
+ layoutPlan: a.json(),
1944
+ metadata: a.json(),
1945
+ })
1946
+ .secondaryIndexes((index) => [
1947
+ index("slug").queryField("publishedEditionBySlug"),
1948
+ index("status").sortKeys(["editionDate"]).queryField("listPublishedEditionsByStatusAndEditionDate"),
1949
+ index("status").sortKeys(["publishedAt"]).queryField("listPublishedEditionsByStatusAndPublishedAt"),
1950
+ index("editionLineageId").sortKeys(["versionNumber"]).queryField("listPublishedEditionsByLineageAndVersion"),
1951
+ ])
1952
+ .authorization((allow) => [
1953
+ allow.guest().to(["read"]),
1954
+ allow.groups(contentWriteGroups),
1955
+ allow.custom().to(authoringOperations),
1956
+ ]),
1957
+ PublishedEditionItem: a
1958
+ .model({
1959
+ id: a.id().required(),
1960
+ publishedEditionId: a.id().required(),
1961
+ publishedItemId: a.id().required(),
1962
+ sourceEditionItemId: a.id().required(),
1963
+ sourceEditionId: a.id().required(),
1964
+ sourceItemId: a.id().required(),
1965
+ editionLineageId: a.id().required(),
1966
+ itemLineageId: a.id().required(),
1967
+ placementKey: a.string().required(),
1968
+ sortKey: a.string().required(),
1969
+ pageNumber: a.integer(),
1970
+ priority: a.integer(),
1971
+ metadata: a.json(),
1972
+ })
1973
+ .secondaryIndexes((index) => [
1974
+ index("publishedEditionId").sortKeys(["sortKey"]).queryField("listPublishedEditionItemsByEditionAndSortKey"),
1975
+ index("publishedItemId").sortKeys(["publishedEditionId"]).queryField("listPublishedEditionItemsByItemAndEdition"),
1976
+ ])
1977
+ .authorization((allow) => [
1978
+ allow.guest().to(["read"]),
1979
+ allow.groups(contentWriteGroups),
1980
+ allow.custom().to(authoringOperations),
1981
+ ]),
1982
+ PublishedCategorySet: a
1983
+ .model({
1984
+ id: a.id().required(),
1985
+ sourceCategorySetId: a.id().required(),
1986
+ categorySetLineageId: a.id().required(),
1987
+ versionNumber: a.integer().required(),
1988
+ corpusId: a.id().required(),
1989
+ classifierId: a.string().required(),
1990
+ displayName: a.string().required(),
1991
+ description: a.string(),
1992
+ status: a.string().required(),
1993
+ generatedAt: a.datetime(),
1994
+ publishedAt: a.datetime(),
1995
+ categoryCount: a.integer(),
1996
+ metadata: a.json(),
1997
+ })
1998
+ .secondaryIndexes((index) => [
1999
+ index("status").sortKeys(["displayName"]).queryField("listPublishedCategorySetsByStatusAndName"),
2000
+ index("classifierId").sortKeys(["displayName"]).queryField("listPublishedCategorySetsByClassifierAndName"),
2001
+ index("categorySetLineageId").sortKeys(["versionNumber"]).queryField("listPublishedCategorySetsByLineageAndVersion"),
2002
+ ])
2003
+ .authorization((allow) => [
2004
+ allow.guest().to(["read"]),
2005
+ allow.groups(contentWriteGroups),
2006
+ allow.custom().to(authoringOperations),
2007
+ ]),
2008
+ PublishedCategory: a
2009
+ .model({
2010
+ id: a.id().required(),
2011
+ sourceCategoryId: a.id().required(),
2012
+ publishedCategorySetId: a.id().required(),
2013
+ categoryLineageId: a.id().required(),
2014
+ categorySetLineageId: a.id().required(),
2015
+ versionNumber: a.integer().required(),
2016
+ corpusId: a.id().required(),
2017
+ categoryKey: a.string().required(),
2018
+ parentCategoryId: a.id(),
2019
+ parentCategoryKey: a.string(),
2020
+ displayName: a.string().required(),
2021
+ shortTitle: a.string(),
2022
+ subtitle: a.string(),
2023
+ description: a.string(),
2024
+ aliases: a.string().array(),
2025
+ status: a.string().required(),
2026
+ seedItemIds: a.string().array(),
2027
+ holdoutItemIds: a.string().array(),
2028
+ rank: a.integer(),
2029
+ depth: a.integer(),
2030
+ isPinned: a.boolean(),
2031
+ metadata: a.json(),
2032
+ })
2033
+ .secondaryIndexes((index) => [
2034
+ index("publishedCategorySetId").sortKeys(["categoryKey"]).queryField("listPublishedCategoriesBySetAndKey"),
2035
+ index("parentCategoryId").sortKeys(["rank"]).queryField("listPublishedCategoriesByParentAndRank"),
2036
+ index("parentCategoryKey").sortKeys(["rank"]).queryField("listPublishedCategoriesByParentKeyAndRank"),
2037
+ index("categoryKey").sortKeys(["publishedCategorySetId"]).queryField("listPublishedCategoriesByKeyAndSet"),
2038
+ ])
2039
+ .authorization((allow) => [
2040
+ allow.guest().to(["read"]),
2041
+ allow.groups(contentWriteGroups),
2042
+ allow.custom().to(authoringOperations),
2043
+ ]),
2044
+ }).authorization((allow) => [
2045
+ allow.resource(categoryAction),
2046
+ allow.resource(contentActions),
2047
+ allow.resource(manageUserRole),
2048
+ allow.resource(modelAttachmentUpload),
2049
+ allow.resource(newsroomSummary),
2050
+ allow.resource(procedureAction),
2051
+ allow.resource(sesInboundReceive),
2052
+ allow.resource(emailSubmissionProcessor),
2053
+ allow.resource(slackEvents),
2054
+ allow.resource(slackDelivery),
2055
+ ]);
2056
+ export const data = defineData({
2057
+ name: "PapyrusCmsApi",
2058
+ schema: leanSchema,
2059
+ authorizationModes: {
2060
+ defaultAuthorizationMode: "userPool",
2061
+ apiKeyAuthorizationMode: {
2062
+ expiresInDays: 365,
2063
+ },
2064
+ lambdaAuthorizationMode: {
2065
+ function: graphqlJwtAuthorizer,
2066
+ timeToLiveInSeconds: 300,
2067
+ },
2068
+ },
2069
+ });