@productcraft/notify 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/testing.cjs CHANGED
@@ -135,7 +135,18 @@ var ROUTES = [
135
135
  ]
136
136
  } },
137
137
  { op: "notificationTypes.create", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types$/, status: 201, contentType: "application/json", body: {
138
+ approval: { default_expires_in_seconds: 1, reason: "optional", timeout_outcome: "expired" },
138
139
  archived_at: "2026-01-01T00:00:00.000Z",
140
+ batch: {
141
+ inbox: "collapse",
142
+ key: "string",
143
+ max_items: 1,
144
+ max_window_seconds: 1,
145
+ mode: "window",
146
+ schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
147
+ sliding: true,
148
+ window_seconds: 1
149
+ },
139
150
  category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
140
151
  category_key: "string",
141
152
  created_at: "2026-01-01T00:00:00.000Z",
@@ -158,7 +169,18 @@ var ROUTES = [
158
169
  { op: "notificationTypes.list", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types$/, status: 200, contentType: "application/json", body: {
159
170
  data: [
160
171
  {
172
+ approval: { default_expires_in_seconds: 1, reason: "optional", timeout_outcome: "expired" },
161
173
  archived_at: "2026-01-01T00:00:00.000Z",
174
+ batch: {
175
+ inbox: "collapse",
176
+ key: "string",
177
+ max_items: 1,
178
+ max_window_seconds: 1,
179
+ mode: "window",
180
+ schedule: { frequency: null, time: "09:00", weekday: null },
181
+ sliding: true,
182
+ window_seconds: 1
183
+ },
162
184
  category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
163
185
  category_key: "string",
164
186
  created_at: "2026-01-01T00:00:00.000Z",
@@ -280,6 +302,23 @@ var ROUTES = [
280
302
  ],
281
303
  pagination: { next_cursor: null, has_more: false }
282
304
  } },
305
+ { op: "me.approvals.decide", method: "POST", pattern: /^\/v1\/client\/approvals\/[^\/]+\/decision$/, status: 200, contentType: "application/json", body: {
306
+ approvers: ["string"],
307
+ body: "string",
308
+ created_at: "2026-01-01T00:00:00.000Z",
309
+ decided_at: "2026-01-01T00:00:00.000Z",
310
+ decided_by: "string",
311
+ decided_via: "inbox",
312
+ expires_at: "2026-01-01T00:00:00.000Z",
313
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
314
+ metadata: {},
315
+ notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
316
+ reason: "string",
317
+ requester: { id: "string", kind: "agent", name: "string" },
318
+ status: "pending",
319
+ title: "string",
320
+ type: "deploy.approval"
321
+ } },
283
322
  { op: "notifications.list", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notifications$/, status: 200, contentType: "application/json", body: {
284
323
  data: [
285
324
  {
@@ -312,6 +351,12 @@ var ROUTES = [
312
351
  dry_run: true,
313
352
  plan: [
314
353
  {
354
+ batch: {
355
+ batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
356
+ flush_at: "2026-01-01T00:00:00.000Z",
357
+ item_count: 1,
358
+ key: "string"
359
+ },
315
360
  channel: "inbox",
316
361
  decision: "deliver",
317
362
  explanation: "string",
@@ -375,6 +420,7 @@ var ROUTES = [
375
420
  data: [
376
421
  {
377
422
  attempts: 1,
423
+ batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
378
424
  channel: "inbox",
379
425
  created_at: "2026-01-01T00:00:00.000Z",
380
426
  device_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
@@ -445,6 +491,45 @@ var ROUTES = [
445
491
  ],
446
492
  pagination: { next_cursor: null, has_more: false }
447
493
  } },
494
+ { op: "approvals.create", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/approvals$/, status: 200, contentType: "application/json", body: {
495
+ approvers: ["string"],
496
+ body: "string",
497
+ created_at: "2026-01-01T00:00:00.000Z",
498
+ decided_at: "2026-01-01T00:00:00.000Z",
499
+ decided_by: "string",
500
+ decided_via: "inbox",
501
+ expires_at: "2026-01-01T00:00:00.000Z",
502
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
503
+ metadata: {},
504
+ notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
505
+ reason: "string",
506
+ requester: { id: "string", kind: "agent", name: "string" },
507
+ status: "pending",
508
+ title: "string",
509
+ type: "deploy.approval"
510
+ } },
511
+ { op: "approvals.list", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/approvals$/, status: 200, contentType: "application/json", body: {
512
+ data: [
513
+ {
514
+ approvers: ["string"],
515
+ body: "string",
516
+ created_at: "2026-01-01T00:00:00.000Z",
517
+ decided_at: "2026-01-01T00:00:00.000Z",
518
+ decided_by: "string",
519
+ decided_via: "inbox",
520
+ expires_at: "2026-01-01T00:00:00.000Z",
521
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
522
+ metadata: {},
523
+ notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
524
+ reason: "string",
525
+ requester: { id: "string", kind: "agent", name: "string" },
526
+ status: "pending",
527
+ title: "string",
528
+ type: "deploy.approval"
529
+ }
530
+ ],
531
+ pagination: { next_cursor: null, has_more: false }
532
+ } },
448
533
  { op: "channels.list", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/channels$/, status: 200, contentType: "application/json", body: {
449
534
  data: [
450
535
  {
@@ -474,6 +559,12 @@ var ROUTES = [
474
559
  ]
475
560
  } },
476
561
  { op: "settings.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/settings$/, status: 200, contentType: "application/json", body: {
562
+ branding: {
563
+ accent_color: "#4f46e5",
564
+ logo_url: "https://example.com",
565
+ name: "Acme",
566
+ privacy_url: "https://example.com"
567
+ },
477
568
  client_origins: ["https://app.example.com"],
478
569
  default_quiet_hours: { end: "08:00", start: "22:00" },
479
570
  default_timezone: "Europe/Lisbon",
@@ -483,6 +574,12 @@ var ROUTES = [
483
574
  email_resumed_at: "2026-01-01T00:00:00.000Z"
484
575
  } },
485
576
  { op: "settings.update", method: "PATCH", pattern: /^\/v1\/workspaces\/[^\/]+\/settings$/, status: 200, contentType: "application/json", body: {
577
+ branding: {
578
+ accent_color: "#4f46e5",
579
+ logo_url: "https://example.com",
580
+ name: "Acme",
581
+ privacy_url: "https://example.com"
582
+ },
486
583
  client_origins: ["https://app.example.com"],
487
584
  default_quiet_hours: { end: "08:00", start: "22:00" },
488
585
  default_timezone: "Europe/Lisbon",
@@ -491,6 +588,22 @@ var ROUTES = [
491
588
  email_paused_reason: "string",
492
589
  email_resumed_at: "2026-01-01T00:00:00.000Z"
493
590
  } },
591
+ { op: "batches.list", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/batches$/, status: 200, contentType: "application/json", body: {
592
+ data: [
593
+ {
594
+ flush_at: "2026-01-01T00:00:00.000Z",
595
+ flushed_at: "2026-01-01T00:00:00.000Z",
596
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
597
+ item_count: 1,
598
+ key: "p_42",
599
+ opened_at: "2026-01-01T00:00:00.000Z",
600
+ recipient: "user_123",
601
+ state: "open",
602
+ type: "comment.created"
603
+ }
604
+ ],
605
+ pagination: { next_cursor: null, has_more: false }
606
+ } },
494
607
  { op: "export.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/export$/, status: 200, contentType: "application/json", body: {
495
608
  categories: [
496
609
  {
@@ -509,7 +622,18 @@ var ROUTES = [
509
622
  exported_at: "2026-01-01T00:00:00.000Z",
510
623
  notification_types: [
511
624
  {
625
+ approval: { default_expires_in_seconds: 1, reason: "optional", timeout_outcome: "expired" },
512
626
  archived_at: "2026-01-01T00:00:00.000Z",
627
+ batch: {
628
+ inbox: "collapse",
629
+ key: "string",
630
+ max_items: 1,
631
+ max_window_seconds: 1,
632
+ mode: "window",
633
+ schedule: { frequency: null, time: "09:00", weekday: null },
634
+ sliding: true,
635
+ window_seconds: 1
636
+ },
513
637
  category_key: "string",
514
638
  critical: true,
515
639
  default_locale: "string",
@@ -530,6 +654,23 @@ var ROUTES = [
530
654
  email_enabled: true
531
655
  }
532
656
  } },
657
+ { op: "me.approvals.retrieve", method: "GET", pattern: /^\/v1\/client\/approvals\/[^\/]+$/, status: 200, contentType: "application/json", body: {
658
+ approvers: ["string"],
659
+ body: "string",
660
+ created_at: "2026-01-01T00:00:00.000Z",
661
+ decided_at: "2026-01-01T00:00:00.000Z",
662
+ decided_by: "string",
663
+ decided_via: "inbox",
664
+ expires_at: "2026-01-01T00:00:00.000Z",
665
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
666
+ metadata: {},
667
+ notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
668
+ reason: "string",
669
+ requester: { id: "string", kind: "agent", name: "string" },
670
+ status: "pending",
671
+ title: "string",
672
+ type: "deploy.approval"
673
+ } },
533
674
  { op: "stats.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/stats$/, status: 200, contentType: "application/json", body: {
534
675
  data: [
535
676
  {
@@ -571,7 +712,18 @@ var ROUTES = [
571
712
  url: "https://api.acme.com/webhooks"
572
713
  } },
573
714
  { op: "notificationTypes.archive", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+\/archive$/, status: 200, contentType: "application/json", body: {
715
+ approval: { default_expires_in_seconds: 1, reason: "optional", timeout_outcome: "expired" },
574
716
  archived_at: "2026-01-01T00:00:00.000Z",
717
+ batch: {
718
+ inbox: "collapse",
719
+ key: "string",
720
+ max_items: 1,
721
+ max_window_seconds: 1,
722
+ mode: "window",
723
+ schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
724
+ sliding: true,
725
+ window_seconds: 1
726
+ },
575
727
  category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
576
728
  category_key: "string",
577
729
  created_at: "2026-01-01T00:00:00.000Z",
@@ -603,9 +755,25 @@ var ROUTES = [
603
755
  ],
604
756
  cross_channel_mismatches: {}
605
757
  } },
758
+ { op: "recipients.createPreferenceLink", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/preference-link$/, status: 201, contentType: "application/json", body: {
759
+ category_key: "string",
760
+ expires_at: "2026-01-01T00:00:00.000Z",
761
+ url: "https://api.notify.productcraft.co/v1/preferences/p1.AQ\u2026"
762
+ } },
606
763
  { op: "channels.apns.deleteCredential", method: "DELETE", pattern: /^\/v1\/workspaces\/[^\/]+\/channels\/apns\/credentials\/[^\/]+$/, status: 204, contentType: null, body: null },
607
764
  { op: "notificationTypes.replaceByKey", method: "PUT", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/by-key\/[^\/]+$/, status: 200, contentType: "application/json", body: {
765
+ approval: { default_expires_in_seconds: 1, reason: "optional", timeout_outcome: "expired" },
608
766
  archived_at: "2026-01-01T00:00:00.000Z",
767
+ batch: {
768
+ inbox: "collapse",
769
+ key: "string",
770
+ max_items: 1,
771
+ max_window_seconds: 1,
772
+ mode: "window",
773
+ schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
774
+ sliding: true,
775
+ window_seconds: 1
776
+ },
609
777
  category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
610
778
  category_key: "string",
611
779
  created_at: "2026-01-01T00:00:00.000Z",
@@ -714,6 +882,7 @@ var ROUTES = [
714
882
  data: [
715
883
  {
716
884
  attempts: 1,
885
+ batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
717
886
  channel: "inbox",
718
887
  created_at: "2026-01-01T00:00:00.000Z",
719
888
  device: {
@@ -755,8 +924,36 @@ var ROUTES = [
755
924
  ],
756
925
  pagination: { next_cursor: null, has_more: false }
757
926
  } },
927
+ { op: "approvals.recordDecision", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/approvals\/[^\/]+\/decision$/, status: 200, contentType: "application/json", body: {
928
+ approvers: ["string"],
929
+ body: "string",
930
+ created_at: "2026-01-01T00:00:00.000Z",
931
+ decided_at: "2026-01-01T00:00:00.000Z",
932
+ decided_by: "string",
933
+ decided_via: "inbox",
934
+ expires_at: "2026-01-01T00:00:00.000Z",
935
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
936
+ metadata: {},
937
+ notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
938
+ reason: "string",
939
+ requester: { id: "string", kind: "agent", name: "string" },
940
+ status: "pending",
941
+ title: "string",
942
+ type: "deploy.approval"
943
+ } },
758
944
  { op: "notificationTypes.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+$/, status: 200, contentType: "application/json", body: {
945
+ approval: { default_expires_in_seconds: 1, reason: "optional", timeout_outcome: "expired" },
759
946
  archived_at: "2026-01-01T00:00:00.000Z",
947
+ batch: {
948
+ inbox: "collapse",
949
+ key: "string",
950
+ max_items: 1,
951
+ max_window_seconds: 1,
952
+ mode: "window",
953
+ schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
954
+ sliding: true,
955
+ window_seconds: 1
956
+ },
760
957
  category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
761
958
  category_key: "string",
762
959
  created_at: "2026-01-01T00:00:00.000Z",
@@ -777,7 +974,18 @@ var ROUTES = [
777
974
  version: 1
778
975
  } },
779
976
  { op: "notificationTypes.update", method: "PATCH", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+$/, status: 200, contentType: "application/json", body: {
977
+ approval: { default_expires_in_seconds: 1, reason: "optional", timeout_outcome: "expired" },
780
978
  archived_at: "2026-01-01T00:00:00.000Z",
979
+ batch: {
980
+ inbox: "collapse",
981
+ key: "string",
982
+ max_items: 1,
983
+ max_window_seconds: 1,
984
+ mode: "window",
985
+ schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
986
+ sliding: true,
987
+ window_seconds: 1
988
+ },
781
989
  category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
782
990
  category_key: "string",
783
991
  created_at: "2026-01-01T00:00:00.000Z",
@@ -872,6 +1080,23 @@ var ROUTES = [
872
1080
  updated_at: "2026-01-01T00:00:00.000Z",
873
1081
  url: "https://api.acme.com/webhooks"
874
1082
  } },
1083
+ { op: "approvals.cancel", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/approvals\/[^\/]+\/cancel$/, status: 200, contentType: "application/json", body: {
1084
+ approvers: ["string"],
1085
+ body: "string",
1086
+ created_at: "2026-01-01T00:00:00.000Z",
1087
+ decided_at: "2026-01-01T00:00:00.000Z",
1088
+ decided_by: "string",
1089
+ decided_via: "inbox",
1090
+ expires_at: "2026-01-01T00:00:00.000Z",
1091
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
1092
+ metadata: {},
1093
+ notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
1094
+ reason: "string",
1095
+ requester: { id: "string", kind: "agent", name: "string" },
1096
+ status: "pending",
1097
+ title: "string",
1098
+ type: "deploy.approval"
1099
+ } },
875
1100
  { op: "recipients.inbox.list", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/inbox$/, status: 200, contentType: "application/json", body: {
876
1101
  counts: { unread: 1, unseen: 1 },
877
1102
  data: [
@@ -934,6 +1159,31 @@ var ROUTES = [
934
1159
  test: true,
935
1160
  type: "notification.accepted"
936
1161
  } },
1162
+ { op: "batches.flush", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/batches\/[^\/]+\/flush$/, status: 200, contentType: "application/json", body: {
1163
+ batch: {
1164
+ deliveries: [
1165
+ {
1166
+ channel: "string",
1167
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
1168
+ notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
1169
+ reason: "string",
1170
+ state: "string"
1171
+ }
1172
+ ],
1173
+ flush_at: "2026-01-01T00:00:00.000Z",
1174
+ flushed_at: "2026-01-01T00:00:00.000Z",
1175
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
1176
+ item_count: 1,
1177
+ key: "p_42",
1178
+ notification_ids: ["9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b"],
1179
+ opened_at: "2026-01-01T00:00:00.000Z",
1180
+ payload: {},
1181
+ recipient: "user_123",
1182
+ state: "open",
1183
+ type: "comment.created"
1184
+ },
1185
+ merged: 1
1186
+ } },
937
1187
  { op: "notifications.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notifications\/[^\/]+$/, status: 200, contentType: "application/json", body: {
938
1188
  actor: { avatar_url: "string", external_id: "string", name: "string" },
939
1189
  caller: "string",
@@ -995,6 +1245,7 @@ var ROUTES = [
995
1245
  retry_after_s: 1
996
1246
  }
997
1247
  ],
1248
+ batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
998
1249
  channel: "inbox",
999
1250
  created_at: "2026-01-01T00:00:00.000Z",
1000
1251
  device_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
@@ -1075,6 +1326,46 @@ var ROUTES = [
1075
1326
  unsubscribed_all: true,
1076
1327
  updated_at: "2026-01-01T00:00:00.000Z"
1077
1328
  } },
1329
+ { op: "approvals.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/approvals\/[^\/]+$/, status: 200, contentType: "application/json", body: {
1330
+ approvers: ["string"],
1331
+ body: "string",
1332
+ created_at: "2026-01-01T00:00:00.000Z",
1333
+ decided_at: "2026-01-01T00:00:00.000Z",
1334
+ decided_by: "string",
1335
+ decided_via: "inbox",
1336
+ events: [{ actor: "string", at: "2026-01-01T00:00:00.000Z", detail: {}, kind: "decided" }],
1337
+ expires_at: "2026-01-01T00:00:00.000Z",
1338
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
1339
+ metadata: {},
1340
+ notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
1341
+ reason: "string",
1342
+ requester: { id: "string", kind: "agent", name: "string" },
1343
+ status: "pending",
1344
+ title: "string",
1345
+ type: "deploy.approval"
1346
+ } },
1347
+ { op: "batches.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/batches\/[^\/]+$/, status: 200, contentType: "application/json", body: {
1348
+ deliveries: [
1349
+ {
1350
+ channel: "string",
1351
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
1352
+ notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
1353
+ reason: "string",
1354
+ state: "string"
1355
+ }
1356
+ ],
1357
+ flush_at: "2026-01-01T00:00:00.000Z",
1358
+ flushed_at: "2026-01-01T00:00:00.000Z",
1359
+ id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
1360
+ item_count: 1,
1361
+ key: "p_42",
1362
+ notification_ids: ["9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b"],
1363
+ opened_at: "2026-01-01T00:00:00.000Z",
1364
+ payload: {},
1365
+ recipient: "user_123",
1366
+ state: "open",
1367
+ type: "comment.created"
1368
+ } },
1078
1369
  { op: "recipients.devices.delete", method: "DELETE", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/devices\/[^\/]+$/, status: 204, contentType: null, body: null },
1079
1370
  { op: "notificationTypes.templates.versions", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+\/templates\/[^\/]+\/[^\/]+\/versions$/, status: 200, contentType: "application/json", body: {
1080
1371
  data: [{ actor: "string", body: {}, created_at: "2026-01-01T00:00:00.000Z", version: 1 }]