@backstage/plugin-notifications-backend 0.6.5-next.1 → 0.6.6-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,961 @@
1
+ 'use strict';
2
+
3
+ var backendOpenapiUtils = require('@backstage/backend-openapi-utils');
4
+
5
+ const spec = {
6
+ openapi: "3.1.0",
7
+ info: {
8
+ title: "notifications",
9
+ version: "1",
10
+ description: "The Backstage backend plugin that powers user notifications.",
11
+ license: {
12
+ name: "Apache-2.0",
13
+ url: "http://www.apache.org/licenses/LICENSE-2.0.html"
14
+ },
15
+ contact: {}
16
+ },
17
+ servers: [
18
+ {
19
+ url: "/"
20
+ }
21
+ ],
22
+ components: {
23
+ examples: {},
24
+ headers: {},
25
+ parameters: {
26
+ notificationId: {
27
+ name: "id",
28
+ in: "path",
29
+ required: true,
30
+ schema: {
31
+ type: "string"
32
+ }
33
+ },
34
+ offset: {
35
+ name: "offset",
36
+ in: "query",
37
+ required: false,
38
+ allowReserved: true,
39
+ schema: {
40
+ type: "integer",
41
+ minimum: 0
42
+ }
43
+ },
44
+ limit: {
45
+ name: "limit",
46
+ in: "query",
47
+ required: false,
48
+ allowReserved: true,
49
+ schema: {
50
+ type: "integer",
51
+ minimum: 0
52
+ }
53
+ },
54
+ orderField: {
55
+ name: "orderField",
56
+ in: "query",
57
+ required: false,
58
+ allowReserved: true,
59
+ description: 'One or more "field,direction" pairs. Direction is "asc" or "desc". Pass multiple to express compound sorts.',
60
+ schema: {
61
+ $ref: "#/components/schemas/OrderField"
62
+ }
63
+ },
64
+ topic: {
65
+ name: "topic",
66
+ in: "query",
67
+ required: false,
68
+ allowReserved: true,
69
+ schema: {
70
+ type: "string"
71
+ }
72
+ },
73
+ search: {
74
+ name: "search",
75
+ in: "query",
76
+ required: false,
77
+ allowReserved: true,
78
+ schema: {
79
+ type: "string"
80
+ }
81
+ },
82
+ read: {
83
+ name: "read",
84
+ in: "query",
85
+ required: false,
86
+ allowReserved: true,
87
+ schema: {
88
+ type: "string",
89
+ enum: ["true", "false"]
90
+ }
91
+ },
92
+ saved: {
93
+ name: "saved",
94
+ in: "query",
95
+ required: false,
96
+ allowReserved: true,
97
+ schema: {
98
+ type: "string",
99
+ enum: ["true", "false"]
100
+ }
101
+ },
102
+ createdAfter: {
103
+ name: "createdAfter",
104
+ in: "query",
105
+ required: false,
106
+ allowReserved: true,
107
+ description: "ISO 8601 date-time string. Validated by the handler.",
108
+ schema: {
109
+ type: "string"
110
+ }
111
+ },
112
+ minimumSeverity: {
113
+ name: "minimumSeverity",
114
+ in: "query",
115
+ required: false,
116
+ allowReserved: true,
117
+ schema: {
118
+ $ref: "#/components/schemas/NotificationSeverity"
119
+ }
120
+ }
121
+ },
122
+ requestBodies: {},
123
+ responses: {
124
+ ErrorResponse: {
125
+ description: "An error response from the backend.",
126
+ content: {
127
+ "application/json; charset=utf-8": {
128
+ schema: {
129
+ $ref: "#/components/schemas/Error"
130
+ }
131
+ }
132
+ }
133
+ }
134
+ },
135
+ schemas: {
136
+ NotificationSeverity: {
137
+ type: "string",
138
+ enum: ["critical", "high", "normal", "low"]
139
+ },
140
+ NotificationPayload: {
141
+ type: "object",
142
+ required: ["title"],
143
+ properties: {
144
+ title: {
145
+ type: "string",
146
+ description: "Notification title"
147
+ },
148
+ description: {
149
+ type: "string",
150
+ description: "Optional longer description for the notification"
151
+ },
152
+ link: {
153
+ type: "string",
154
+ description: "Optional link where the notification is pointing to"
155
+ },
156
+ severity: {
157
+ $ref: "#/components/schemas/NotificationSeverity"
158
+ },
159
+ topic: {
160
+ type: "string",
161
+ description: "Optional notification topic"
162
+ },
163
+ scope: {
164
+ type: "string",
165
+ description: "Notification scope, can be used to re-send same notifications in case the scope and origin matches."
166
+ },
167
+ icon: {
168
+ type: "string",
169
+ description: "Optional notification icon"
170
+ },
171
+ metadata: {
172
+ type: "object",
173
+ description: "Optional additional customizable metadata.",
174
+ additionalProperties: true
175
+ }
176
+ }
177
+ },
178
+ NotificationResponsePayload: {
179
+ description: "Response variant of NotificationPayload. Optional string fields may be returned as null when unset.",
180
+ type: "object",
181
+ required: ["title"],
182
+ properties: {
183
+ title: {
184
+ type: "string"
185
+ },
186
+ description: {
187
+ type: ["string", "null"]
188
+ },
189
+ link: {
190
+ type: ["string", "null"]
191
+ },
192
+ severity: {
193
+ $ref: "#/components/schemas/NotificationSeverity"
194
+ },
195
+ topic: {
196
+ type: ["string", "null"]
197
+ },
198
+ scope: {
199
+ type: ["string", "null"]
200
+ },
201
+ icon: {
202
+ type: ["string", "null"]
203
+ },
204
+ metadata: {
205
+ type: "object",
206
+ additionalProperties: true
207
+ }
208
+ }
209
+ },
210
+ Notification: {
211
+ type: "object",
212
+ required: ["id", "user", "created", "origin", "payload"],
213
+ properties: {
214
+ id: {
215
+ type: "string",
216
+ description: "Unique identifier for the notification."
217
+ },
218
+ user: {
219
+ type: ["string", "null"],
220
+ description: "User entity reference, or null for broadcast notifications."
221
+ },
222
+ created: {
223
+ type: "string",
224
+ format: "date-time"
225
+ },
226
+ saved: {
227
+ type: ["string", "null"],
228
+ format: "date-time"
229
+ },
230
+ read: {
231
+ type: ["string", "null"],
232
+ format: "date-time"
233
+ },
234
+ updated: {
235
+ type: ["string", "null"],
236
+ format: "date-time"
237
+ },
238
+ origin: {
239
+ type: "string",
240
+ description: "Origin of the notification (the sender's reference)."
241
+ },
242
+ payload: {
243
+ $ref: "#/components/schemas/NotificationResponsePayload"
244
+ }
245
+ }
246
+ },
247
+ NotificationStatus: {
248
+ type: "object",
249
+ required: ["unread", "read"],
250
+ properties: {
251
+ unread: {
252
+ type: "integer"
253
+ },
254
+ read: {
255
+ type: "integer"
256
+ }
257
+ }
258
+ },
259
+ TopicSetting: {
260
+ type: "object",
261
+ required: ["id", "enabled"],
262
+ properties: {
263
+ id: {
264
+ type: "string"
265
+ },
266
+ enabled: {
267
+ type: "boolean"
268
+ }
269
+ }
270
+ },
271
+ OriginSetting: {
272
+ type: "object",
273
+ required: ["id", "enabled"],
274
+ properties: {
275
+ id: {
276
+ type: "string"
277
+ },
278
+ enabled: {
279
+ type: "boolean"
280
+ },
281
+ topics: {
282
+ type: "array",
283
+ items: {
284
+ $ref: "#/components/schemas/TopicSetting"
285
+ }
286
+ }
287
+ }
288
+ },
289
+ ChannelSetting: {
290
+ type: "object",
291
+ required: ["id", "origins"],
292
+ properties: {
293
+ id: {
294
+ type: "string"
295
+ },
296
+ enabled: {
297
+ type: "boolean"
298
+ },
299
+ origins: {
300
+ type: "array",
301
+ items: {
302
+ $ref: "#/components/schemas/OriginSetting"
303
+ }
304
+ }
305
+ }
306
+ },
307
+ NotificationSettings: {
308
+ type: "object",
309
+ required: ["channels"],
310
+ properties: {
311
+ channels: {
312
+ type: "array",
313
+ items: {
314
+ $ref: "#/components/schemas/ChannelSetting"
315
+ }
316
+ }
317
+ }
318
+ },
319
+ EntityRef: {
320
+ description: "A single entity ref, or a list of entity refs.",
321
+ oneOf: [
322
+ {
323
+ type: "string"
324
+ },
325
+ {
326
+ type: "array",
327
+ items: {
328
+ type: "string"
329
+ }
330
+ }
331
+ ]
332
+ },
333
+ OrderField: {
334
+ description: 'One or more "field,direction" pairs, given as a single string or an array of strings.',
335
+ oneOf: [
336
+ {
337
+ type: "string"
338
+ },
339
+ {
340
+ type: "array",
341
+ items: {
342
+ type: "string"
343
+ }
344
+ }
345
+ ]
346
+ },
347
+ NotificationRecipients: {
348
+ oneOf: [
349
+ {
350
+ type: "object",
351
+ required: ["type", "entityRef"],
352
+ properties: {
353
+ type: {
354
+ type: "string",
355
+ enum: ["entity"]
356
+ },
357
+ entityRef: {
358
+ $ref: "#/components/schemas/EntityRef"
359
+ },
360
+ excludeEntityRef: {
361
+ $ref: "#/components/schemas/EntityRef"
362
+ }
363
+ }
364
+ },
365
+ {
366
+ type: "object",
367
+ required: ["type"],
368
+ properties: {
369
+ type: {
370
+ type: "string",
371
+ enum: ["broadcast"]
372
+ }
373
+ }
374
+ }
375
+ ]
376
+ },
377
+ NotificationSendOptions: {
378
+ type: "object",
379
+ required: ["recipients", "payload"],
380
+ properties: {
381
+ recipients: {
382
+ $ref: "#/components/schemas/NotificationRecipients"
383
+ },
384
+ payload: {
385
+ $ref: "#/components/schemas/NotificationPayload"
386
+ }
387
+ }
388
+ },
389
+ UpdateNotificationsRequest: {
390
+ type: "object",
391
+ required: ["ids"],
392
+ properties: {
393
+ ids: {
394
+ type: "array",
395
+ items: {
396
+ type: "string"
397
+ }
398
+ },
399
+ read: {
400
+ type: "boolean"
401
+ },
402
+ saved: {
403
+ type: "boolean"
404
+ }
405
+ }
406
+ },
407
+ ListNotificationsResponse: {
408
+ type: "object",
409
+ required: ["totalCount", "notifications"],
410
+ properties: {
411
+ totalCount: {
412
+ type: "integer"
413
+ },
414
+ notifications: {
415
+ type: "array",
416
+ items: {
417
+ $ref: "#/components/schemas/Notification"
418
+ }
419
+ }
420
+ }
421
+ },
422
+ GetTopicsResponse: {
423
+ type: "object",
424
+ required: ["topics"],
425
+ properties: {
426
+ topics: {
427
+ type: "array",
428
+ items: {
429
+ type: "string"
430
+ }
431
+ }
432
+ }
433
+ },
434
+ Error: {
435
+ type: "object",
436
+ properties: {
437
+ error: {
438
+ type: "object",
439
+ properties: {
440
+ name: {
441
+ type: "string"
442
+ },
443
+ message: {
444
+ type: "string"
445
+ }
446
+ },
447
+ required: ["name", "message"]
448
+ },
449
+ request: {
450
+ type: "object",
451
+ properties: {
452
+ method: {
453
+ type: "string"
454
+ },
455
+ url: {
456
+ type: "string"
457
+ }
458
+ },
459
+ required: ["method", "url"]
460
+ },
461
+ response: {
462
+ type: "object",
463
+ properties: {
464
+ statusCode: {
465
+ type: "number"
466
+ }
467
+ },
468
+ required: ["statusCode"]
469
+ }
470
+ },
471
+ required: ["error", "request", "response"]
472
+ }
473
+ },
474
+ securitySchemes: {
475
+ JWT: {
476
+ type: "http",
477
+ scheme: "bearer",
478
+ bearerFormat: "JWT"
479
+ }
480
+ }
481
+ },
482
+ paths: {
483
+ "/": {
484
+ get: {
485
+ operationId: "ListNotificationsLegacy",
486
+ deprecated: true,
487
+ description: "Deprecated alias for `GET /notifications`.",
488
+ parameters: [
489
+ {
490
+ $ref: "#/components/parameters/offset"
491
+ },
492
+ {
493
+ $ref: "#/components/parameters/limit"
494
+ },
495
+ {
496
+ $ref: "#/components/parameters/orderField"
497
+ },
498
+ {
499
+ $ref: "#/components/parameters/topic"
500
+ },
501
+ {
502
+ $ref: "#/components/parameters/search"
503
+ },
504
+ {
505
+ $ref: "#/components/parameters/read"
506
+ },
507
+ {
508
+ $ref: "#/components/parameters/saved"
509
+ },
510
+ {
511
+ $ref: "#/components/parameters/createdAfter"
512
+ },
513
+ {
514
+ $ref: "#/components/parameters/minimumSeverity"
515
+ }
516
+ ],
517
+ responses: {
518
+ "200": {
519
+ description: "A page of notifications for the current user.",
520
+ content: {
521
+ "application/json": {
522
+ schema: {
523
+ $ref: "#/components/schemas/ListNotificationsResponse"
524
+ }
525
+ }
526
+ }
527
+ },
528
+ default: {
529
+ $ref: "#/components/responses/ErrorResponse"
530
+ }
531
+ },
532
+ security: [
533
+ {},
534
+ {
535
+ JWT: []
536
+ }
537
+ ]
538
+ },
539
+ post: {
540
+ operationId: "CreateNotificationsLegacy",
541
+ deprecated: true,
542
+ description: "Deprecated alias for `POST /notifications`.",
543
+ requestBody: {
544
+ required: true,
545
+ content: {
546
+ "application/json": {
547
+ schema: {
548
+ $ref: "#/components/schemas/NotificationSendOptions"
549
+ }
550
+ }
551
+ }
552
+ },
553
+ responses: {
554
+ "200": {
555
+ description: "The notifications that were created.",
556
+ content: {
557
+ "application/json": {
558
+ schema: {
559
+ type: "array",
560
+ items: {
561
+ $ref: "#/components/schemas/Notification"
562
+ }
563
+ }
564
+ }
565
+ }
566
+ },
567
+ default: {
568
+ $ref: "#/components/responses/ErrorResponse"
569
+ }
570
+ },
571
+ security: [
572
+ {},
573
+ {
574
+ JWT: []
575
+ }
576
+ ]
577
+ }
578
+ },
579
+ "/notifications": {
580
+ get: {
581
+ operationId: "ListNotifications",
582
+ description: "List notifications for the current user.",
583
+ parameters: [
584
+ {
585
+ $ref: "#/components/parameters/offset"
586
+ },
587
+ {
588
+ $ref: "#/components/parameters/limit"
589
+ },
590
+ {
591
+ $ref: "#/components/parameters/orderField"
592
+ },
593
+ {
594
+ $ref: "#/components/parameters/topic"
595
+ },
596
+ {
597
+ $ref: "#/components/parameters/search"
598
+ },
599
+ {
600
+ $ref: "#/components/parameters/read"
601
+ },
602
+ {
603
+ $ref: "#/components/parameters/saved"
604
+ },
605
+ {
606
+ $ref: "#/components/parameters/createdAfter"
607
+ },
608
+ {
609
+ $ref: "#/components/parameters/minimumSeverity"
610
+ }
611
+ ],
612
+ responses: {
613
+ "200": {
614
+ description: "A page of notifications for the current user.",
615
+ content: {
616
+ "application/json": {
617
+ schema: {
618
+ $ref: "#/components/schemas/ListNotificationsResponse"
619
+ }
620
+ }
621
+ }
622
+ },
623
+ default: {
624
+ $ref: "#/components/responses/ErrorResponse"
625
+ }
626
+ },
627
+ security: [
628
+ {},
629
+ {
630
+ JWT: []
631
+ }
632
+ ]
633
+ },
634
+ post: {
635
+ operationId: "CreateNotifications",
636
+ description: "Send a notification to one or more recipients (service credentials required).",
637
+ requestBody: {
638
+ required: true,
639
+ content: {
640
+ "application/json": {
641
+ schema: {
642
+ $ref: "#/components/schemas/NotificationSendOptions"
643
+ }
644
+ }
645
+ }
646
+ },
647
+ responses: {
648
+ "200": {
649
+ description: "The notifications that were created.",
650
+ content: {
651
+ "application/json": {
652
+ schema: {
653
+ type: "array",
654
+ items: {
655
+ $ref: "#/components/schemas/Notification"
656
+ }
657
+ }
658
+ }
659
+ }
660
+ },
661
+ default: {
662
+ $ref: "#/components/responses/ErrorResponse"
663
+ }
664
+ },
665
+ security: [
666
+ {},
667
+ {
668
+ JWT: []
669
+ }
670
+ ]
671
+ }
672
+ },
673
+ "/update": {
674
+ post: {
675
+ operationId: "UpdateNotificationsLegacy",
676
+ deprecated: true,
677
+ description: "Deprecated alias for `POST /notifications/update`.",
678
+ requestBody: {
679
+ required: true,
680
+ content: {
681
+ "application/json": {
682
+ schema: {
683
+ $ref: "#/components/schemas/UpdateNotificationsRequest"
684
+ }
685
+ }
686
+ }
687
+ },
688
+ responses: {
689
+ "200": {
690
+ description: "The notifications that were updated.",
691
+ content: {
692
+ "application/json": {
693
+ schema: {
694
+ type: "array",
695
+ items: {
696
+ $ref: "#/components/schemas/Notification"
697
+ }
698
+ }
699
+ }
700
+ }
701
+ },
702
+ default: {
703
+ $ref: "#/components/responses/ErrorResponse"
704
+ }
705
+ },
706
+ security: [
707
+ {},
708
+ {
709
+ JWT: []
710
+ }
711
+ ]
712
+ }
713
+ },
714
+ "/notifications/update": {
715
+ post: {
716
+ operationId: "UpdateNotifications",
717
+ description: "Mark notifications as read/unread or saved/unsaved.",
718
+ requestBody: {
719
+ required: true,
720
+ content: {
721
+ "application/json": {
722
+ schema: {
723
+ $ref: "#/components/schemas/UpdateNotificationsRequest"
724
+ }
725
+ }
726
+ }
727
+ },
728
+ responses: {
729
+ "200": {
730
+ description: "The notifications that were updated.",
731
+ content: {
732
+ "application/json": {
733
+ schema: {
734
+ type: "array",
735
+ items: {
736
+ $ref: "#/components/schemas/Notification"
737
+ }
738
+ }
739
+ }
740
+ }
741
+ },
742
+ default: {
743
+ $ref: "#/components/responses/ErrorResponse"
744
+ }
745
+ },
746
+ security: [
747
+ {},
748
+ {
749
+ JWT: []
750
+ }
751
+ ]
752
+ }
753
+ },
754
+ "/status": {
755
+ get: {
756
+ operationId: "GetStatus",
757
+ description: "Get the unread/read counts for the current user.",
758
+ responses: {
759
+ "200": {
760
+ description: "The current user's notification status.",
761
+ content: {
762
+ "application/json": {
763
+ schema: {
764
+ $ref: "#/components/schemas/NotificationStatus"
765
+ }
766
+ }
767
+ }
768
+ },
769
+ default: {
770
+ $ref: "#/components/responses/ErrorResponse"
771
+ }
772
+ },
773
+ security: [
774
+ {},
775
+ {
776
+ JWT: []
777
+ }
778
+ ]
779
+ }
780
+ },
781
+ "/settings": {
782
+ get: {
783
+ operationId: "GetSettings",
784
+ description: "Get the current user's notification settings, merged with defaults.",
785
+ responses: {
786
+ "200": {
787
+ description: "Effective notification settings for the user.",
788
+ content: {
789
+ "application/json": {
790
+ schema: {
791
+ $ref: "#/components/schemas/NotificationSettings"
792
+ }
793
+ }
794
+ }
795
+ },
796
+ default: {
797
+ $ref: "#/components/responses/ErrorResponse"
798
+ }
799
+ },
800
+ security: [
801
+ {},
802
+ {
803
+ JWT: []
804
+ }
805
+ ]
806
+ },
807
+ post: {
808
+ operationId: "UpdateSettings",
809
+ description: "Update the current user's notification settings.",
810
+ requestBody: {
811
+ required: true,
812
+ content: {
813
+ "application/json": {
814
+ schema: {
815
+ $ref: "#/components/schemas/NotificationSettings"
816
+ }
817
+ }
818
+ }
819
+ },
820
+ responses: {
821
+ "200": {
822
+ description: "Effective notification settings for the user.",
823
+ content: {
824
+ "application/json": {
825
+ schema: {
826
+ $ref: "#/components/schemas/NotificationSettings"
827
+ }
828
+ }
829
+ }
830
+ },
831
+ default: {
832
+ $ref: "#/components/responses/ErrorResponse"
833
+ }
834
+ },
835
+ security: [
836
+ {},
837
+ {
838
+ JWT: []
839
+ }
840
+ ]
841
+ }
842
+ },
843
+ "/topics": {
844
+ get: {
845
+ operationId: "GetTopics",
846
+ description: "List notification topics that the user has received notifications on.",
847
+ parameters: [
848
+ {
849
+ $ref: "#/components/parameters/search"
850
+ },
851
+ {
852
+ $ref: "#/components/parameters/read"
853
+ },
854
+ {
855
+ $ref: "#/components/parameters/saved"
856
+ },
857
+ {
858
+ $ref: "#/components/parameters/createdAfter"
859
+ },
860
+ {
861
+ $ref: "#/components/parameters/minimumSeverity"
862
+ }
863
+ ],
864
+ responses: {
865
+ "200": {
866
+ description: "The list of topics.",
867
+ content: {
868
+ "application/json": {
869
+ schema: {
870
+ $ref: "#/components/schemas/GetTopicsResponse"
871
+ }
872
+ }
873
+ }
874
+ },
875
+ default: {
876
+ $ref: "#/components/responses/ErrorResponse"
877
+ }
878
+ },
879
+ security: [
880
+ {},
881
+ {
882
+ JWT: []
883
+ }
884
+ ]
885
+ }
886
+ },
887
+ "/{id}": {
888
+ get: {
889
+ operationId: "GetNotificationLegacy",
890
+ deprecated: true,
891
+ description: "Deprecated alias for `GET /notifications/{id}`.",
892
+ parameters: [
893
+ {
894
+ $ref: "#/components/parameters/notificationId"
895
+ }
896
+ ],
897
+ responses: {
898
+ "200": {
899
+ description: "The requested notification.",
900
+ content: {
901
+ "application/json": {
902
+ schema: {
903
+ $ref: "#/components/schemas/Notification"
904
+ }
905
+ }
906
+ }
907
+ },
908
+ default: {
909
+ $ref: "#/components/responses/ErrorResponse"
910
+ }
911
+ },
912
+ security: [
913
+ {},
914
+ {
915
+ JWT: []
916
+ }
917
+ ]
918
+ }
919
+ },
920
+ "/notifications/{id}": {
921
+ get: {
922
+ operationId: "GetNotification",
923
+ description: "Get a single notification by id for the current user.",
924
+ parameters: [
925
+ {
926
+ $ref: "#/components/parameters/notificationId"
927
+ }
928
+ ],
929
+ responses: {
930
+ "200": {
931
+ description: "The requested notification.",
932
+ content: {
933
+ "application/json": {
934
+ schema: {
935
+ $ref: "#/components/schemas/Notification"
936
+ }
937
+ }
938
+ }
939
+ },
940
+ default: {
941
+ $ref: "#/components/responses/ErrorResponse"
942
+ }
943
+ },
944
+ security: [
945
+ {},
946
+ {
947
+ JWT: []
948
+ }
949
+ ]
950
+ }
951
+ }
952
+ }
953
+ };
954
+ const createOpenApiRouter = async (options) => backendOpenapiUtils.createValidatedOpenApiRouterFromGeneratedEndpointMap(
955
+ spec,
956
+ options
957
+ );
958
+
959
+ exports.createOpenApiRouter = createOpenApiRouter;
960
+ exports.spec = spec;
961
+ //# sourceMappingURL=router.cjs.js.map