@anthusai/papyrus 5.33.0 → 5.33.1

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.
@@ -0,0 +1,20 @@
1
+ import { a } from "@aws-amplify/backend";
2
+ const registered = new Map();
3
+ /** The shared name for a Lambda: stable, alphanumeric, unique per function. */
4
+ export function sharedFunctionName(name) {
5
+ return `Fn${name.charAt(0).toUpperCase()}${name.slice(1)}`;
6
+ }
7
+ /** A schema handler for `fn` that shares one data source with every other field handled by `fn`. */
8
+ export function functionHandler(name, fn) {
9
+ const shared = sharedFunctionName(name);
10
+ const existing = registered.get(shared);
11
+ if (existing !== undefined && existing !== fn) {
12
+ throw new Error(`Two different functions are registered as "${shared}"`);
13
+ }
14
+ registered.set(shared, fn);
15
+ return a.handler.function(shared);
16
+ }
17
+ /** Every function that a schema handler refers to by shared name, for `defineData({ functions })`. */
18
+ export function sharedFunctions() {
19
+ return Object.fromEntries(registered);
20
+ }
@@ -0,0 +1,40 @@
1
+ import { a } from "@aws-amplify/backend";
2
+
3
+ /**
4
+ * One AppSync Lambda data source per Lambda, not one per field.
5
+ *
6
+ * `a.handler.function(fn)` names every field's function `Fn<FieldName>`, and the @function transformer creates a data
7
+ * source, an IAM role, an IAM policy and two function configurations for each distinct name, all in one nested stack
8
+ * (`FunctionDirectiveStack`). CloudFormation allows 500 resources in a stack, and that stack grows by six resources per
9
+ * Lambda-backed field. Giving every field that calls the same Lambda the same name makes them share one data source,
10
+ * role, policy and function configuration, so each extra field costs only its resolver. The Lambda receives the same
11
+ * event as before (`typeName`, `fieldName`, `arguments`, `identity`), so no handler changes.
12
+ *
13
+ * Every function used this way is registered here and handed to `defineData({ functions })`, which is how Amplify
14
+ * resolves a handler given by name.
15
+ */
16
+ /** What `a.handler.function` accepts, and what `defineData({ functions })` takes by name. */
17
+ type HandlerFunction = Exclude<Parameters<typeof a.handler.function>[0], string>;
18
+
19
+ const registered = new Map<string, HandlerFunction>();
20
+
21
+ /** The shared name for a Lambda: stable, alphanumeric, unique per function. */
22
+ export function sharedFunctionName(name: string): string {
23
+ return `Fn${name.charAt(0).toUpperCase()}${name.slice(1)}`;
24
+ }
25
+
26
+ /** A schema handler for `fn` that shares one data source with every other field handled by `fn`. */
27
+ export function functionHandler(name: string, fn: HandlerFunction) {
28
+ const shared = sharedFunctionName(name);
29
+ const existing = registered.get(shared);
30
+ if (existing !== undefined && existing !== fn) {
31
+ throw new Error(`Two different functions are registered as "${shared}"`);
32
+ }
33
+ registered.set(shared, fn);
34
+ return a.handler.function(shared);
35
+ }
36
+
37
+ /** Every function that a schema handler refers to by shared name, for `defineData({ functions })`. */
38
+ export function sharedFunctions(): Record<string, HandlerFunction> {
39
+ return Object.fromEntries(registered);
40
+ }
@@ -14,6 +14,7 @@ import { sesInboundReceive } from "../functions/ses-inbound-receive/resource.js"
14
14
  import { slackDelivery } from "../functions/slack-delivery/resource.js";
15
15
  import { slackEvents } from "../functions/slack-events/resource.js";
16
16
  import { assertKnownModelGroups, schema as leanSchema, schemaExcludingGroups, schemaWithPlugins } from "./schema.js";
17
+ import { functionHandler, sharedFunctions } from "./function-handler.js";
17
18
  const authoringOperations = [
18
19
  "read",
19
20
  "create",
@@ -136,7 +137,7 @@ const schema = a.schema({
136
137
  .query()
137
138
  .returns(a.ref("UserDirectoryResult"))
138
139
  .authorization((allow) => [allow.group(adminGroup)])
139
- .handler(a.handler.function(manageUserRole)),
140
+ .handler(functionHandler("manageUserRole", manageUserRole)),
140
141
  grantUserRole: a
141
142
  .mutation()
142
143
  .arguments({
@@ -147,7 +148,7 @@ const schema = a.schema({
147
148
  })
148
149
  .returns(a.ref("UserRoleMutationResult"))
149
150
  .authorization((allow) => [allow.group(adminGroup)])
150
- .handler(a.handler.function(manageUserRole)),
151
+ .handler(functionHandler("manageUserRole", manageUserRole)),
151
152
  revokeUserRole: a
152
153
  .mutation()
153
154
  .arguments({
@@ -158,7 +159,7 @@ const schema = a.schema({
158
159
  })
159
160
  .returns(a.ref("UserRoleMutationResult"))
160
161
  .authorization((allow) => [allow.group(adminGroup)])
161
- .handler(a.handler.function(manageUserRole)),
162
+ .handler(functionHandler("manageUserRole", manageUserRole)),
162
163
  mergeUserProfiles: a
163
164
  .mutation()
164
165
  .arguments({
@@ -170,12 +171,12 @@ const schema = a.schema({
170
171
  })
171
172
  .returns(a.ref("UserDirectoryEntry"))
172
173
  .authorization((allow) => [allow.group(adminGroup)])
173
- .handler(a.handler.function(manageUserRole)),
174
+ .handler(functionHandler("manageUserRole", manageUserRole)),
174
175
  getReaderSettings: a
175
176
  .query()
176
177
  .returns(a.ref("ReaderSettingsResult"))
177
178
  .authorization((allow) => [allow.authenticated()])
178
- .handler(a.handler.function(readerSettings)),
179
+ .handler(functionHandler("readerSettings", readerSettings)),
179
180
  updateReaderSettings: a
180
181
  .mutation()
181
182
  .arguments({
@@ -183,7 +184,7 @@ const schema = a.schema({
183
184
  })
184
185
  .returns(a.ref("ReaderSettingsResult"))
185
186
  .authorization((allow) => [allow.authenticated()])
186
- .handler(a.handler.function(readerSettings)),
187
+ .handler(functionHandler("readerSettings", readerSettings)),
187
188
  SteeringActionResult: a.customType({
188
189
  ok: a.boolean().required(),
189
190
  action: a.string().required(),
@@ -211,7 +212,7 @@ const schema = a.schema({
211
212
  })
212
213
  .returns(a.ref("SteeringActionResult"))
213
214
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
214
- .handler(a.handler.function(categoryAction)),
215
+ .handler(functionHandler("categoryAction", categoryAction)),
215
216
  CurationDelegationResult: a.customType({
216
217
  ok: a.boolean().required(),
217
218
  delegationId: a.id().required(),
@@ -324,7 +325,7 @@ const schema = a.schema({
324
325
  .authorization((allow) => [
325
326
  allow.groups(categoryWriteGroups),
326
327
  ])
327
- .handler(a.handler.function(categoryAction)),
328
+ .handler(functionHandler("categoryAction", categoryAction)),
328
329
  createCurationDelegation: a
329
330
  .mutation()
330
331
  .arguments({
@@ -335,7 +336,7 @@ const schema = a.schema({
335
336
  .authorization((allow) => [
336
337
  allow.groups(categoryWriteGroups),
337
338
  ])
338
- .handler(a.handler.function(categoryAction)),
339
+ .handler(functionHandler("categoryAction", categoryAction)),
339
340
  revokeCurationDelegation: a
340
341
  .mutation()
341
342
  .arguments({
@@ -345,14 +346,14 @@ const schema = a.schema({
345
346
  .authorization((allow) => [
346
347
  allow.groups(categoryWriteGroups),
347
348
  ])
348
- .handler(a.handler.function(categoryAction)),
349
+ .handler(functionHandler("categoryAction", categoryAction)),
349
350
  listCurationDelegations: a
350
351
  .query()
351
352
  .returns(a.ref("CurationDelegationResult").array())
352
353
  .authorization((allow) => [
353
354
  allow.groups(categoryWriteGroups),
354
355
  ])
355
- .handler(a.handler.function(categoryAction)),
356
+ .handler(functionHandler("categoryAction", categoryAction)),
356
357
  requestCurationDelegation: a
357
358
  .mutation()
358
359
  .arguments({
@@ -365,7 +366,7 @@ const schema = a.schema({
365
366
  .authorization((allow) => [
366
367
  allow.authenticated("identityPool"),
367
368
  ])
368
- .handler(a.handler.function(categoryAction)),
369
+ .handler(functionHandler("categoryAction", categoryAction)),
369
370
  approveCurationDelegation: a
370
371
  .mutation()
371
372
  .arguments({
@@ -375,7 +376,7 @@ const schema = a.schema({
375
376
  .authorization((allow) => [
376
377
  allow.groups(categoryWriteGroups),
377
378
  ])
378
- .handler(a.handler.function(categoryAction)),
379
+ .handler(functionHandler("categoryAction", categoryAction)),
379
380
  denyCurationDelegation: a
380
381
  .mutation()
381
382
  .arguments({
@@ -385,7 +386,7 @@ const schema = a.schema({
385
386
  .authorization((allow) => [
386
387
  allow.groups(categoryWriteGroups),
387
388
  ])
388
- .handler(a.handler.function(categoryAction)),
389
+ .handler(functionHandler("categoryAction", categoryAction)),
389
390
  getCurationDelegationStatus: a
390
391
  .query()
391
392
  .arguments({
@@ -395,7 +396,7 @@ const schema = a.schema({
395
396
  .authorization((allow) => [
396
397
  allow.authenticated("identityPool"),
397
398
  ])
398
- .handler(a.handler.function(categoryAction)),
399
+ .handler(functionHandler("categoryAction", categoryAction)),
399
400
  recordDelegatedCuration: a
400
401
  .mutation()
401
402
  .arguments({
@@ -416,7 +417,7 @@ const schema = a.schema({
416
417
  .authorization((allow) => [
417
418
  allow.authenticated("identityPool"),
418
419
  ])
419
- .handler(a.handler.function(categoryAction)),
420
+ .handler(functionHandler("categoryAction", categoryAction)),
420
421
  setReferenceQualityRating: a
421
422
  .mutation()
422
423
  .arguments({
@@ -430,7 +431,7 @@ const schema = a.schema({
430
431
  .authorization((allow) => [
431
432
  allow.groups(categoryWriteGroups),
432
433
  ])
433
- .handler(a.handler.function(categoryAction)),
434
+ .handler(functionHandler("categoryAction", categoryAction)),
434
435
  createReferenceNote: a
435
436
  .mutation()
436
437
  .arguments({
@@ -444,7 +445,7 @@ const schema = a.schema({
444
445
  .authorization((allow) => [
445
446
  allow.groups(categoryWriteGroups),
446
447
  ])
447
- .handler(a.handler.function(categoryAction)),
448
+ .handler(functionHandler("categoryAction", categoryAction)),
448
449
  moveReferenceCorpus: a
449
450
  .mutation()
450
451
  .arguments({
@@ -458,7 +459,7 @@ const schema = a.schema({
458
459
  .authorization((allow) => [
459
460
  allow.groups(categoryWriteGroups),
460
461
  ])
461
- .handler(a.handler.function(categoryAction)),
462
+ .handler(functionHandler("categoryAction", categoryAction)),
462
463
  startReferenceCuration: a
463
464
  .mutation()
464
465
  .arguments({
@@ -471,7 +472,7 @@ const schema = a.schema({
471
472
  .authorization((allow) => [
472
473
  allow.groups(categoryWriteGroups),
473
474
  ])
474
- .handler(a.handler.function(categoryAction)),
475
+ .handler(functionHandler("categoryAction", categoryAction)),
475
476
  getReferenceCurationStatus: a
476
477
  .query()
477
478
  .arguments({
@@ -481,7 +482,7 @@ const schema = a.schema({
481
482
  .authorization((allow) => [
482
483
  allow.groups(categoryWriteGroups),
483
484
  ])
484
- .handler(a.handler.function(categoryAction)),
485
+ .handler(functionHandler("categoryAction", categoryAction)),
485
486
  createCategorySetDraft: a
486
487
  .mutation()
487
488
  .arguments({
@@ -492,7 +493,7 @@ const schema = a.schema({
492
493
  })
493
494
  .returns(a.ref("CategorySetDraftActionResult"))
494
495
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
495
- .handler(a.handler.function(categoryAction)),
496
+ .handler(functionHandler("categoryAction", categoryAction)),
496
497
  promoteCategorySetDraft: a
497
498
  .mutation()
498
499
  .arguments({
@@ -502,7 +503,7 @@ const schema = a.schema({
502
503
  })
503
504
  .returns(a.ref("CategorySetDraftActionResult"))
504
505
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
505
- .handler(a.handler.function(categoryAction)),
506
+ .handler(functionHandler("categoryAction", categoryAction)),
506
507
  discardCategorySetDraft: a
507
508
  .mutation()
508
509
  .arguments({
@@ -512,7 +513,7 @@ const schema = a.schema({
512
513
  })
513
514
  .returns(a.ref("CategorySetDraftActionResult"))
514
515
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
515
- .handler(a.handler.function(categoryAction)),
516
+ .handler(functionHandler("categoryAction", categoryAction)),
516
517
  createDraftCategory: a
517
518
  .mutation()
518
519
  .arguments({
@@ -527,7 +528,7 @@ const schema = a.schema({
527
528
  })
528
529
  .returns(a.ref("SteeringActionResult"))
529
530
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
530
- .handler(a.handler.function(categoryAction)),
531
+ .handler(functionHandler("categoryAction", categoryAction)),
531
532
  updateDraftCategory: a
532
533
  .mutation()
533
534
  .arguments({
@@ -542,7 +543,7 @@ const schema = a.schema({
542
543
  })
543
544
  .returns(a.ref("SteeringActionResult"))
544
545
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
545
- .handler(a.handler.function(categoryAction)),
546
+ .handler(functionHandler("categoryAction", categoryAction)),
546
547
  archiveDraftCategory: a
547
548
  .mutation()
548
549
  .arguments({
@@ -552,7 +553,7 @@ const schema = a.schema({
552
553
  })
553
554
  .returns(a.ref("SteeringActionResult"))
554
555
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
555
- .handler(a.handler.function(categoryAction)),
556
+ .handler(functionHandler("categoryAction", categoryAction)),
556
557
  reviewReferenceTopicLabel: a
557
558
  .mutation()
558
559
  .arguments({
@@ -565,7 +566,7 @@ const schema = a.schema({
565
566
  })
566
567
  .returns(a.ref("TopicLabelActionResult"))
567
568
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
568
- .handler(a.handler.function(categoryAction)),
569
+ .handler(functionHandler("categoryAction", categoryAction)),
569
570
  NewsroomSummary: a.customType({
570
571
  generatedAt: a.datetime().required(),
571
572
  staleAt: a.datetime(),
@@ -583,49 +584,49 @@ const schema = a.schema({
583
584
  .query()
584
585
  .returns(a.ref("NewsroomSummary"))
585
586
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
586
- .handler(a.handler.function(newsroomSummary)),
587
+ .handler(functionHandler("newsroomSummary", newsroomSummary)),
587
588
  deriveMarkus: a
588
589
  .query()
589
590
  .arguments({ input: a.json().required() })
590
591
  .returns(a.json())
591
592
  .authorization((allow) => [allow.groups(contentWriteGroups)])
592
- .handler(a.handler.function(contentActions)),
593
+ .handler(functionHandler("contentActions", contentActions)),
593
594
  intakePendingReferences: a
594
595
  .mutation()
595
596
  .arguments({ input: a.json().required() })
596
597
  .returns(a.json())
597
598
  .authorization((allow) => [allow.groups(contentWriteGroups)])
598
- .handler(a.handler.function(contentActions)),
599
+ .handler(functionHandler("contentActions", contentActions)),
599
600
  saveItemDraft: a
600
601
  .mutation()
601
602
  .arguments({ input: a.json().required() })
602
603
  .returns(a.json())
603
604
  .authorization((allow) => [allow.groups(contentWriteGroups)])
604
- .handler(a.handler.function(contentActions)),
605
+ .handler(functionHandler("contentActions", contentActions)),
605
606
  publishItem: a
606
607
  .mutation()
607
608
  .arguments({ input: a.json().required() })
608
609
  .returns(a.json())
609
610
  .authorization((allow) => [allow.groups(contentWriteGroups)])
610
- .handler(a.handler.function(contentActions)),
611
+ .handler(functionHandler("contentActions", contentActions)),
611
612
  moveStoryStage: a
612
613
  .mutation()
613
614
  .arguments({ input: a.json().required() })
614
615
  .returns(a.json())
615
616
  .authorization((allow) => [allow.groups(contentWriteGroups)])
616
- .handler(a.handler.function(contentActions)),
617
+ .handler(functionHandler("contentActions", contentActions)),
617
618
  unpublishItem: a
618
619
  .mutation()
619
620
  .arguments({ input: a.json().required() })
620
621
  .returns(a.json())
621
622
  .authorization((allow) => [allow.groups(contentWriteGroups)])
622
- .handler(a.handler.function(contentActions)),
623
+ .handler(functionHandler("contentActions", contentActions)),
623
624
  requestStagingBuild: a
624
625
  .mutation()
625
626
  .arguments({ input: a.json().required() })
626
627
  .returns(a.json())
627
628
  .authorization((allow) => [allow.groups(contentWriteGroups)])
628
- .handler(a.handler.function(contentActions)),
629
+ .handler(functionHandler("contentActions", contentActions)),
629
630
  knowledgeQuery: a
630
631
  .query()
631
632
  .arguments({
@@ -633,7 +634,7 @@ const schema = a.schema({
633
634
  })
634
635
  .returns(a.json())
635
636
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
636
- .handler(a.handler.function(knowledgeQuery)),
637
+ .handler(functionHandler("knowledgeQuery", knowledgeQuery)),
637
638
  updateNewsroomSummary: a
638
639
  .mutation()
639
640
  .arguments({
@@ -643,7 +644,7 @@ const schema = a.schema({
643
644
  })
644
645
  .returns(a.ref("NewsroomSummary"))
645
646
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
646
- .handler(a.handler.function(newsroomSummary)),
647
+ .handler(functionHandler("newsroomSummary", newsroomSummary)),
647
648
  ModelAttachmentUploadSlot: a.customType({
648
649
  ok: a.boolean().required(),
649
650
  uploadId: a.string().required(),
@@ -699,7 +700,7 @@ const schema = a.schema({
699
700
  })
700
701
  .returns(a.ref("ModelAttachmentUploadSlot"))
701
702
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
702
- .handler(a.handler.function(modelAttachmentUpload)),
703
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
703
704
  completeModelAttachmentUpload: a
704
705
  .mutation()
705
706
  .arguments({
@@ -720,7 +721,7 @@ const schema = a.schema({
720
721
  })
721
722
  .returns(a.ref("ModelAttachment"))
722
723
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
723
- .handler(a.handler.function(modelAttachmentUpload)),
724
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
724
725
  abortModelAttachmentUpload: a
725
726
  .mutation()
726
727
  .arguments({
@@ -741,7 +742,7 @@ const schema = a.schema({
741
742
  })
742
743
  .returns(a.ref("ModelAttachmentUploadAbortResult"))
743
744
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
744
- .handler(a.handler.function(modelAttachmentUpload)),
745
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
745
746
  createModelAttachmentDownload: a
746
747
  .mutation()
747
748
  .arguments({
@@ -749,7 +750,7 @@ const schema = a.schema({
749
750
  })
750
751
  .returns(a.ref("ModelAttachmentDownloadSlot"))
751
752
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
752
- .handler(a.handler.function(modelAttachmentUpload)),
753
+ .handler(functionHandler("modelAttachmentUpload", modelAttachmentUpload)),
753
754
  AssignmentActionResult: a.customType({
754
755
  ok: a.boolean().required(),
755
756
  assignmentId: a.id(),
@@ -837,7 +838,7 @@ const schema = a.schema({
837
838
  })
838
839
  .returns(a.ref("AssignmentContext").array().required())
839
840
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
840
- .handler(a.handler.function(assignmentAction)),
841
+ .handler(functionHandler("assignmentAction", assignmentAction)),
841
842
  listAssignmentQueue: a
842
843
  .query()
843
844
  .arguments({
@@ -847,7 +848,7 @@ const schema = a.schema({
847
848
  })
848
849
  .returns(a.ref("AssignmentContext").array().required())
849
850
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
850
- .handler(a.handler.function(assignmentAction)),
851
+ .handler(functionHandler("assignmentAction", assignmentAction)),
851
852
  getEditorialContext: a
852
853
  .query()
853
854
  .arguments({
@@ -860,7 +861,7 @@ const schema = a.schema({
860
861
  })
861
862
  .returns(a.json().required())
862
863
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
863
- .handler(a.handler.function(assignmentAction)),
864
+ .handler(functionHandler("assignmentAction", assignmentAction)),
864
865
  getAssignmentContext: a
865
866
  .query()
866
867
  .arguments({
@@ -868,7 +869,7 @@ const schema = a.schema({
868
869
  })
869
870
  .returns(a.ref("AssignmentContext"))
870
871
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
871
- .handler(a.handler.function(assignmentAction)),
872
+ .handler(functionHandler("assignmentAction", assignmentAction)),
872
873
  claimAssignment: a
873
874
  .mutation()
874
875
  .arguments({
@@ -884,7 +885,7 @@ const schema = a.schema({
884
885
  })
885
886
  .returns(a.ref("AssignmentActionResult"))
886
887
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
887
- .handler(a.handler.function(assignmentAction)),
888
+ .handler(functionHandler("assignmentAction", assignmentAction)),
888
889
  releaseAssignment: a
889
890
  .mutation()
890
891
  .arguments({
@@ -895,7 +896,7 @@ const schema = a.schema({
895
896
  })
896
897
  .returns(a.ref("AssignmentActionResult"))
897
898
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
898
- .handler(a.handler.function(assignmentAction)),
899
+ .handler(functionHandler("assignmentAction", assignmentAction)),
899
900
  completeAssignment: a
900
901
  .mutation()
901
902
  .arguments({
@@ -906,7 +907,7 @@ const schema = a.schema({
906
907
  })
907
908
  .returns(a.ref("AssignmentActionResult"))
908
909
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
909
- .handler(a.handler.function(assignmentAction)),
910
+ .handler(functionHandler("assignmentAction", assignmentAction)),
910
911
  cancelAssignment: a
911
912
  .mutation()
912
913
  .arguments({
@@ -917,7 +918,7 @@ const schema = a.schema({
917
918
  })
918
919
  .returns(a.ref("AssignmentActionResult"))
919
920
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
920
- .handler(a.handler.function(assignmentAction)),
921
+ .handler(functionHandler("assignmentAction", assignmentAction)),
921
922
  reopenAssignment: a
922
923
  .mutation()
923
924
  .arguments({
@@ -928,7 +929,7 @@ const schema = a.schema({
928
929
  })
929
930
  .returns(a.ref("AssignmentActionResult"))
930
931
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
931
- .handler(a.handler.function(assignmentAction)),
932
+ .handler(functionHandler("assignmentAction", assignmentAction)),
932
933
  retryImmediateAssignment: a
933
934
  .mutation()
934
935
  .arguments({
@@ -939,12 +940,12 @@ const schema = a.schema({
939
940
  })
940
941
  .returns(a.ref("AssignmentActionResult"))
941
942
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
942
- .handler(a.handler.function(assignmentAction)),
943
+ .handler(functionHandler("assignmentAction", assignmentAction)),
943
944
  listNewsroomProcedureDefinitions: a
944
945
  .query()
945
946
  .returns(a.json())
946
947
  .authorization((allow) => [allow.group(adminGroup)])
947
- .handler(a.handler.function(procedureAction)),
948
+ .handler(functionHandler("procedureAction", procedureAction)),
948
949
  getNewsroomProcedureDefinition: a
949
950
  .query()
950
951
  .arguments({
@@ -953,7 +954,7 @@ const schema = a.schema({
953
954
  })
954
955
  .returns(a.json())
955
956
  .authorization((allow) => [allow.group(adminGroup)])
956
- .handler(a.handler.function(procedureAction)),
957
+ .handler(functionHandler("procedureAction", procedureAction)),
957
958
  saveNewsroomProcedureDefinition: a
958
959
  .mutation()
959
960
  .arguments({
@@ -961,7 +962,7 @@ const schema = a.schema({
961
962
  })
962
963
  .returns(a.json())
963
964
  .authorization((allow) => [allow.group(adminGroup)])
964
- .handler(a.handler.function(procedureAction)),
965
+ .handler(functionHandler("procedureAction", procedureAction)),
965
966
  saveNewsroomProcedureVersionDraft: a
966
967
  .mutation()
967
968
  .arguments({
@@ -969,7 +970,7 @@ const schema = a.schema({
969
970
  })
970
971
  .returns(a.json())
971
972
  .authorization((allow) => [allow.group(adminGroup)])
972
- .handler(a.handler.function(procedureAction)),
973
+ .handler(functionHandler("procedureAction", procedureAction)),
973
974
  publishNewsroomProcedureVersion: a
974
975
  .mutation()
975
976
  .arguments({
@@ -977,7 +978,7 @@ const schema = a.schema({
977
978
  })
978
979
  .returns(a.json())
979
980
  .authorization((allow) => [allow.group(adminGroup)])
980
- .handler(a.handler.function(procedureAction)),
981
+ .handler(functionHandler("procedureAction", procedureAction)),
981
982
  startNewsroomProcedureRun: a
982
983
  .mutation()
983
984
  .arguments({
@@ -991,7 +992,7 @@ const schema = a.schema({
991
992
  })
992
993
  .returns(a.json())
993
994
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
994
- .handler(a.handler.function(procedureAction)),
995
+ .handler(functionHandler("procedureAction", procedureAction)),
995
996
  getNewsroomProcedureRun: a
996
997
  .query()
997
998
  .arguments({
@@ -999,7 +1000,7 @@ const schema = a.schema({
999
1000
  })
1000
1001
  .returns(a.json())
1001
1002
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
1002
- .handler(a.handler.function(procedureAction)),
1003
+ .handler(functionHandler("procedureAction", procedureAction)),
1003
1004
  listNewsroomProcedureRunsByProcedure: a
1004
1005
  .query()
1005
1006
  .arguments({
@@ -1007,7 +1008,7 @@ const schema = a.schema({
1007
1008
  })
1008
1009
  .returns(a.json())
1009
1010
  .authorization((allow) => [allow.groups(categoryWriteGroups)])
1010
- .handler(a.handler.function(procedureAction)),
1011
+ .handler(functionHandler("procedureAction", procedureAction)),
1011
1012
  Assignment: a
1012
1013
  .model({
1013
1014
  id: a.id().required(),
@@ -2251,6 +2252,7 @@ export function defineSiteData(pluginDefinitions = {}, excludeModelGroups = [])
2251
2252
  const hasPlugins = Object.keys(pluginDefinitions).length > 0;
2252
2253
  return defineData({
2253
2254
  name: "PapyrusCmsApi",
2255
+ functions: sharedFunctions(),
2254
2256
  schema: excludeModelGroups.length > 0
2255
2257
  ? schemaExcludingGroups(excludeModelGroups, pluginDefinitions)
2256
2258
  : hasPlugins ? schemaWithPlugins(pluginDefinitions) : leanSchema,