@productcraft/notify 0.1.1 → 0.3.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/README.md +6 -5
- package/api.md +132 -7
- package/dist/index.cjs +145 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1105 -68
- package/dist/index.d.ts +1105 -68
- package/dist/index.js +145 -10
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +164 -0
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +164 -0
- package/dist/testing.js.map +1 -1
- package/manifest.json +63 -3
- package/package.json +1 -1
package/dist/testing.js
CHANGED
|
@@ -15,6 +15,7 @@ var ROUTES = [
|
|
|
15
15
|
name: "string"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
|
+
effective_quiet_hours: { end: "08:00", source: "recipient", start: "22:00", timezone: "Europe/Lisbon" },
|
|
18
19
|
preferences: [{ channel: "inbox", enabled: true, key: "string", scope: "all" }],
|
|
19
20
|
quiet_hours: { end: "08:00", start: "22:00" },
|
|
20
21
|
timezone: "string",
|
|
@@ -29,6 +30,7 @@ var ROUTES = [
|
|
|
29
30
|
name: "string"
|
|
30
31
|
}
|
|
31
32
|
],
|
|
33
|
+
effective_quiet_hours: { end: "08:00", source: "recipient", start: "22:00", timezone: "Europe/Lisbon" },
|
|
32
34
|
preferences: [{ channel: "inbox", enabled: true, key: "string", scope: "all" }],
|
|
33
35
|
quiet_hours: { end: "08:00", start: "22:00" },
|
|
34
36
|
timezone: "string",
|
|
@@ -132,6 +134,16 @@ var ROUTES = [
|
|
|
132
134
|
} },
|
|
133
135
|
{ op: "notificationTypes.create", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types$/, status: 201, contentType: "application/json", body: {
|
|
134
136
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
137
|
+
batch: {
|
|
138
|
+
inbox: "collapse",
|
|
139
|
+
key: "string",
|
|
140
|
+
max_items: 1,
|
|
141
|
+
max_window_seconds: 1,
|
|
142
|
+
mode: "window",
|
|
143
|
+
schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
|
|
144
|
+
sliding: true,
|
|
145
|
+
window_seconds: 1
|
|
146
|
+
},
|
|
135
147
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
136
148
|
category_key: "string",
|
|
137
149
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -155,6 +167,16 @@ var ROUTES = [
|
|
|
155
167
|
data: [
|
|
156
168
|
{
|
|
157
169
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
170
|
+
batch: {
|
|
171
|
+
inbox: "collapse",
|
|
172
|
+
key: "string",
|
|
173
|
+
max_items: 1,
|
|
174
|
+
max_window_seconds: 1,
|
|
175
|
+
mode: "window",
|
|
176
|
+
schedule: { frequency: null, time: "09:00", weekday: null },
|
|
177
|
+
sliding: true,
|
|
178
|
+
window_seconds: 1
|
|
179
|
+
},
|
|
158
180
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
159
181
|
category_key: "string",
|
|
160
182
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -308,6 +330,12 @@ var ROUTES = [
|
|
|
308
330
|
dry_run: true,
|
|
309
331
|
plan: [
|
|
310
332
|
{
|
|
333
|
+
batch: {
|
|
334
|
+
batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
335
|
+
flush_at: "2026-01-01T00:00:00.000Z",
|
|
336
|
+
item_count: 1,
|
|
337
|
+
key: "string"
|
|
338
|
+
},
|
|
311
339
|
channel: "inbox",
|
|
312
340
|
decision: "deliver",
|
|
313
341
|
explanation: "string",
|
|
@@ -371,6 +399,7 @@ var ROUTES = [
|
|
|
371
399
|
data: [
|
|
372
400
|
{
|
|
373
401
|
attempts: 1,
|
|
402
|
+
batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
374
403
|
channel: "inbox",
|
|
375
404
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
376
405
|
device_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
@@ -470,6 +499,12 @@ var ROUTES = [
|
|
|
470
499
|
]
|
|
471
500
|
} },
|
|
472
501
|
{ op: "settings.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/settings$/, status: 200, contentType: "application/json", body: {
|
|
502
|
+
branding: {
|
|
503
|
+
accent_color: "#4f46e5",
|
|
504
|
+
logo_url: "https://example.com",
|
|
505
|
+
name: "Acme",
|
|
506
|
+
privacy_url: "https://example.com"
|
|
507
|
+
},
|
|
473
508
|
client_origins: ["https://app.example.com"],
|
|
474
509
|
default_quiet_hours: { end: "08:00", start: "22:00" },
|
|
475
510
|
default_timezone: "Europe/Lisbon",
|
|
@@ -479,6 +514,12 @@ var ROUTES = [
|
|
|
479
514
|
email_resumed_at: "2026-01-01T00:00:00.000Z"
|
|
480
515
|
} },
|
|
481
516
|
{ op: "settings.update", method: "PATCH", pattern: /^\/v1\/workspaces\/[^\/]+\/settings$/, status: 200, contentType: "application/json", body: {
|
|
517
|
+
branding: {
|
|
518
|
+
accent_color: "#4f46e5",
|
|
519
|
+
logo_url: "https://example.com",
|
|
520
|
+
name: "Acme",
|
|
521
|
+
privacy_url: "https://example.com"
|
|
522
|
+
},
|
|
482
523
|
client_origins: ["https://app.example.com"],
|
|
483
524
|
default_quiet_hours: { end: "08:00", start: "22:00" },
|
|
484
525
|
default_timezone: "Europe/Lisbon",
|
|
@@ -487,6 +528,22 @@ var ROUTES = [
|
|
|
487
528
|
email_paused_reason: "string",
|
|
488
529
|
email_resumed_at: "2026-01-01T00:00:00.000Z"
|
|
489
530
|
} },
|
|
531
|
+
{ op: "batches.list", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/batches$/, status: 200, contentType: "application/json", body: {
|
|
532
|
+
data: [
|
|
533
|
+
{
|
|
534
|
+
flush_at: "2026-01-01T00:00:00.000Z",
|
|
535
|
+
flushed_at: "2026-01-01T00:00:00.000Z",
|
|
536
|
+
id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
537
|
+
item_count: 1,
|
|
538
|
+
key: "p_42",
|
|
539
|
+
opened_at: "2026-01-01T00:00:00.000Z",
|
|
540
|
+
recipient: "user_123",
|
|
541
|
+
state: "open",
|
|
542
|
+
type: "comment.created"
|
|
543
|
+
}
|
|
544
|
+
],
|
|
545
|
+
pagination: { next_cursor: null, has_more: false }
|
|
546
|
+
} },
|
|
490
547
|
{ op: "export.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/export$/, status: 200, contentType: "application/json", body: {
|
|
491
548
|
categories: [
|
|
492
549
|
{
|
|
@@ -506,6 +563,16 @@ var ROUTES = [
|
|
|
506
563
|
notification_types: [
|
|
507
564
|
{
|
|
508
565
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
566
|
+
batch: {
|
|
567
|
+
inbox: "collapse",
|
|
568
|
+
key: "string",
|
|
569
|
+
max_items: 1,
|
|
570
|
+
max_window_seconds: 1,
|
|
571
|
+
mode: "window",
|
|
572
|
+
schedule: { frequency: null, time: "09:00", weekday: null },
|
|
573
|
+
sliding: true,
|
|
574
|
+
window_seconds: 1
|
|
575
|
+
},
|
|
509
576
|
category_key: "string",
|
|
510
577
|
critical: true,
|
|
511
578
|
default_locale: "string",
|
|
@@ -568,6 +635,16 @@ var ROUTES = [
|
|
|
568
635
|
} },
|
|
569
636
|
{ op: "notificationTypes.archive", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+\/archive$/, status: 200, contentType: "application/json", body: {
|
|
570
637
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
638
|
+
batch: {
|
|
639
|
+
inbox: "collapse",
|
|
640
|
+
key: "string",
|
|
641
|
+
max_items: 1,
|
|
642
|
+
max_window_seconds: 1,
|
|
643
|
+
mode: "window",
|
|
644
|
+
schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
|
|
645
|
+
sliding: true,
|
|
646
|
+
window_seconds: 1
|
|
647
|
+
},
|
|
571
648
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
572
649
|
category_key: "string",
|
|
573
650
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -599,9 +676,24 @@ var ROUTES = [
|
|
|
599
676
|
],
|
|
600
677
|
cross_channel_mismatches: {}
|
|
601
678
|
} },
|
|
679
|
+
{ op: "recipients.createPreferenceLink", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/preference-link$/, status: 201, contentType: "application/json", body: {
|
|
680
|
+
category_key: "string",
|
|
681
|
+
expires_at: "2026-01-01T00:00:00.000Z",
|
|
682
|
+
url: "https://api.notify.productcraft.co/v1/preferences/p1.AQ\u2026"
|
|
683
|
+
} },
|
|
602
684
|
{ op: "channels.apns.deleteCredential", method: "DELETE", pattern: /^\/v1\/workspaces\/[^\/]+\/channels\/apns\/credentials\/[^\/]+$/, status: 204, contentType: null, body: null },
|
|
603
685
|
{ op: "notificationTypes.replaceByKey", method: "PUT", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/by-key\/[^\/]+$/, status: 200, contentType: "application/json", body: {
|
|
604
686
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
687
|
+
batch: {
|
|
688
|
+
inbox: "collapse",
|
|
689
|
+
key: "string",
|
|
690
|
+
max_items: 1,
|
|
691
|
+
max_window_seconds: 1,
|
|
692
|
+
mode: "window",
|
|
693
|
+
schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
|
|
694
|
+
sliding: true,
|
|
695
|
+
window_seconds: 1
|
|
696
|
+
},
|
|
605
697
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
606
698
|
category_key: "string",
|
|
607
699
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -639,6 +731,7 @@ var ROUTES = [
|
|
|
639
731
|
url: "https://example.com"
|
|
640
732
|
} },
|
|
641
733
|
{ op: "recipients.preferences.replace", method: "PUT", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/preferences$/, status: 200, contentType: "application/json", body: {
|
|
734
|
+
effective_quiet_hours: { end: "08:00", source: "recipient", start: "22:00", timezone: "Europe/Lisbon" },
|
|
642
735
|
external_id: "string",
|
|
643
736
|
preferences: [{ channel: "inbox", enabled: true, key: "string", scope: "all" }],
|
|
644
737
|
quiet_hours: { end: "08:00", start: "22:00" },
|
|
@@ -646,6 +739,7 @@ var ROUTES = [
|
|
|
646
739
|
unsubscribed_all: true
|
|
647
740
|
} },
|
|
648
741
|
{ op: "recipients.preferences.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/preferences$/, status: 200, contentType: "application/json", body: {
|
|
742
|
+
effective_quiet_hours: { end: "08:00", source: "recipient", start: "22:00", timezone: "Europe/Lisbon" },
|
|
649
743
|
external_id: "string",
|
|
650
744
|
preferences: [{ channel: "inbox", enabled: true, key: "string", scope: "all" }],
|
|
651
745
|
quiet_hours: { end: "08:00", start: "22:00" },
|
|
@@ -653,6 +747,7 @@ var ROUTES = [
|
|
|
653
747
|
unsubscribed_all: true
|
|
654
748
|
} },
|
|
655
749
|
{ op: "recipients.preferences.update", method: "PATCH", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/preferences$/, status: 200, contentType: "application/json", body: {
|
|
750
|
+
effective_quiet_hours: { end: "08:00", source: "recipient", start: "22:00", timezone: "Europe/Lisbon" },
|
|
656
751
|
external_id: "string",
|
|
657
752
|
preferences: [{ channel: "inbox", enabled: true, key: "string", scope: "all" }],
|
|
658
753
|
quiet_hours: { end: "08:00", start: "22:00" },
|
|
@@ -707,6 +802,7 @@ var ROUTES = [
|
|
|
707
802
|
data: [
|
|
708
803
|
{
|
|
709
804
|
attempts: 1,
|
|
805
|
+
batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
710
806
|
channel: "inbox",
|
|
711
807
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
712
808
|
device: {
|
|
@@ -750,6 +846,16 @@ var ROUTES = [
|
|
|
750
846
|
} },
|
|
751
847
|
{ op: "notificationTypes.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+$/, status: 200, contentType: "application/json", body: {
|
|
752
848
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
849
|
+
batch: {
|
|
850
|
+
inbox: "collapse",
|
|
851
|
+
key: "string",
|
|
852
|
+
max_items: 1,
|
|
853
|
+
max_window_seconds: 1,
|
|
854
|
+
mode: "window",
|
|
855
|
+
schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
|
|
856
|
+
sliding: true,
|
|
857
|
+
window_seconds: 1
|
|
858
|
+
},
|
|
753
859
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
754
860
|
category_key: "string",
|
|
755
861
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -771,6 +877,16 @@ var ROUTES = [
|
|
|
771
877
|
} },
|
|
772
878
|
{ op: "notificationTypes.update", method: "PATCH", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+$/, status: 200, contentType: "application/json", body: {
|
|
773
879
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
880
|
+
batch: {
|
|
881
|
+
inbox: "collapse",
|
|
882
|
+
key: "string",
|
|
883
|
+
max_items: 1,
|
|
884
|
+
max_window_seconds: 1,
|
|
885
|
+
mode: "window",
|
|
886
|
+
schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
|
|
887
|
+
sliding: true,
|
|
888
|
+
window_seconds: 1
|
|
889
|
+
},
|
|
774
890
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
775
891
|
category_key: "string",
|
|
776
892
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -927,6 +1043,31 @@ var ROUTES = [
|
|
|
927
1043
|
test: true,
|
|
928
1044
|
type: "notification.accepted"
|
|
929
1045
|
} },
|
|
1046
|
+
{ op: "batches.flush", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/batches\/[^\/]+\/flush$/, status: 200, contentType: "application/json", body: {
|
|
1047
|
+
batch: {
|
|
1048
|
+
deliveries: [
|
|
1049
|
+
{
|
|
1050
|
+
channel: "string",
|
|
1051
|
+
id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1052
|
+
notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1053
|
+
reason: "string",
|
|
1054
|
+
state: "string"
|
|
1055
|
+
}
|
|
1056
|
+
],
|
|
1057
|
+
flush_at: "2026-01-01T00:00:00.000Z",
|
|
1058
|
+
flushed_at: "2026-01-01T00:00:00.000Z",
|
|
1059
|
+
id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1060
|
+
item_count: 1,
|
|
1061
|
+
key: "p_42",
|
|
1062
|
+
notification_ids: ["9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b"],
|
|
1063
|
+
opened_at: "2026-01-01T00:00:00.000Z",
|
|
1064
|
+
payload: {},
|
|
1065
|
+
recipient: "user_123",
|
|
1066
|
+
state: "open",
|
|
1067
|
+
type: "comment.created"
|
|
1068
|
+
},
|
|
1069
|
+
merged: 1
|
|
1070
|
+
} },
|
|
930
1071
|
{ op: "notifications.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notifications\/[^\/]+$/, status: 200, contentType: "application/json", body: {
|
|
931
1072
|
actor: { avatar_url: "string", external_id: "string", name: "string" },
|
|
932
1073
|
caller: "string",
|
|
@@ -988,6 +1129,7 @@ var ROUTES = [
|
|
|
988
1129
|
retry_after_s: 1
|
|
989
1130
|
}
|
|
990
1131
|
],
|
|
1132
|
+
batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
991
1133
|
channel: "inbox",
|
|
992
1134
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
993
1135
|
device_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
@@ -1068,6 +1210,28 @@ var ROUTES = [
|
|
|
1068
1210
|
unsubscribed_all: true,
|
|
1069
1211
|
updated_at: "2026-01-01T00:00:00.000Z"
|
|
1070
1212
|
} },
|
|
1213
|
+
{ op: "batches.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/batches\/[^\/]+$/, status: 200, contentType: "application/json", body: {
|
|
1214
|
+
deliveries: [
|
|
1215
|
+
{
|
|
1216
|
+
channel: "string",
|
|
1217
|
+
id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1218
|
+
notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1219
|
+
reason: "string",
|
|
1220
|
+
state: "string"
|
|
1221
|
+
}
|
|
1222
|
+
],
|
|
1223
|
+
flush_at: "2026-01-01T00:00:00.000Z",
|
|
1224
|
+
flushed_at: "2026-01-01T00:00:00.000Z",
|
|
1225
|
+
id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1226
|
+
item_count: 1,
|
|
1227
|
+
key: "p_42",
|
|
1228
|
+
notification_ids: ["9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b"],
|
|
1229
|
+
opened_at: "2026-01-01T00:00:00.000Z",
|
|
1230
|
+
payload: {},
|
|
1231
|
+
recipient: "user_123",
|
|
1232
|
+
state: "open",
|
|
1233
|
+
type: "comment.created"
|
|
1234
|
+
} },
|
|
1071
1235
|
{ op: "recipients.devices.delete", method: "DELETE", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/devices\/[^\/]+$/, status: 204, contentType: null, body: null },
|
|
1072
1236
|
{ op: "notificationTypes.templates.versions", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+\/templates\/[^\/]+\/[^\/]+\/versions$/, status: 200, contentType: "application/json", body: {
|
|
1073
1237
|
data: [{ actor: "string", body: {}, created_at: "2026-01-01T00:00:00.000Z", version: 1 }]
|