@anthusai/papyrus 2.0.0-next.7 → 2.0.0-next.70

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