@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.cjs
CHANGED
|
@@ -17,6 +17,7 @@ var ROUTES = [
|
|
|
17
17
|
name: "string"
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
|
+
effective_quiet_hours: { end: "08:00", source: "recipient", start: "22:00", timezone: "Europe/Lisbon" },
|
|
20
21
|
preferences: [{ channel: "inbox", enabled: true, key: "string", scope: "all" }],
|
|
21
22
|
quiet_hours: { end: "08:00", start: "22:00" },
|
|
22
23
|
timezone: "string",
|
|
@@ -31,6 +32,7 @@ var ROUTES = [
|
|
|
31
32
|
name: "string"
|
|
32
33
|
}
|
|
33
34
|
],
|
|
35
|
+
effective_quiet_hours: { end: "08:00", source: "recipient", start: "22:00", timezone: "Europe/Lisbon" },
|
|
34
36
|
preferences: [{ channel: "inbox", enabled: true, key: "string", scope: "all" }],
|
|
35
37
|
quiet_hours: { end: "08:00", start: "22:00" },
|
|
36
38
|
timezone: "string",
|
|
@@ -134,6 +136,16 @@ var ROUTES = [
|
|
|
134
136
|
} },
|
|
135
137
|
{ op: "notificationTypes.create", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types$/, status: 201, contentType: "application/json", body: {
|
|
136
138
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
139
|
+
batch: {
|
|
140
|
+
inbox: "collapse",
|
|
141
|
+
key: "string",
|
|
142
|
+
max_items: 1,
|
|
143
|
+
max_window_seconds: 1,
|
|
144
|
+
mode: "window",
|
|
145
|
+
schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
|
|
146
|
+
sliding: true,
|
|
147
|
+
window_seconds: 1
|
|
148
|
+
},
|
|
137
149
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
138
150
|
category_key: "string",
|
|
139
151
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -157,6 +169,16 @@ var ROUTES = [
|
|
|
157
169
|
data: [
|
|
158
170
|
{
|
|
159
171
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
172
|
+
batch: {
|
|
173
|
+
inbox: "collapse",
|
|
174
|
+
key: "string",
|
|
175
|
+
max_items: 1,
|
|
176
|
+
max_window_seconds: 1,
|
|
177
|
+
mode: "window",
|
|
178
|
+
schedule: { frequency: null, time: "09:00", weekday: null },
|
|
179
|
+
sliding: true,
|
|
180
|
+
window_seconds: 1
|
|
181
|
+
},
|
|
160
182
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
161
183
|
category_key: "string",
|
|
162
184
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -310,6 +332,12 @@ var ROUTES = [
|
|
|
310
332
|
dry_run: true,
|
|
311
333
|
plan: [
|
|
312
334
|
{
|
|
335
|
+
batch: {
|
|
336
|
+
batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
337
|
+
flush_at: "2026-01-01T00:00:00.000Z",
|
|
338
|
+
item_count: 1,
|
|
339
|
+
key: "string"
|
|
340
|
+
},
|
|
313
341
|
channel: "inbox",
|
|
314
342
|
decision: "deliver",
|
|
315
343
|
explanation: "string",
|
|
@@ -373,6 +401,7 @@ var ROUTES = [
|
|
|
373
401
|
data: [
|
|
374
402
|
{
|
|
375
403
|
attempts: 1,
|
|
404
|
+
batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
376
405
|
channel: "inbox",
|
|
377
406
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
378
407
|
device_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
@@ -472,6 +501,12 @@ var ROUTES = [
|
|
|
472
501
|
]
|
|
473
502
|
} },
|
|
474
503
|
{ op: "settings.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/settings$/, status: 200, contentType: "application/json", body: {
|
|
504
|
+
branding: {
|
|
505
|
+
accent_color: "#4f46e5",
|
|
506
|
+
logo_url: "https://example.com",
|
|
507
|
+
name: "Acme",
|
|
508
|
+
privacy_url: "https://example.com"
|
|
509
|
+
},
|
|
475
510
|
client_origins: ["https://app.example.com"],
|
|
476
511
|
default_quiet_hours: { end: "08:00", start: "22:00" },
|
|
477
512
|
default_timezone: "Europe/Lisbon",
|
|
@@ -481,6 +516,12 @@ var ROUTES = [
|
|
|
481
516
|
email_resumed_at: "2026-01-01T00:00:00.000Z"
|
|
482
517
|
} },
|
|
483
518
|
{ op: "settings.update", method: "PATCH", pattern: /^\/v1\/workspaces\/[^\/]+\/settings$/, status: 200, contentType: "application/json", body: {
|
|
519
|
+
branding: {
|
|
520
|
+
accent_color: "#4f46e5",
|
|
521
|
+
logo_url: "https://example.com",
|
|
522
|
+
name: "Acme",
|
|
523
|
+
privacy_url: "https://example.com"
|
|
524
|
+
},
|
|
484
525
|
client_origins: ["https://app.example.com"],
|
|
485
526
|
default_quiet_hours: { end: "08:00", start: "22:00" },
|
|
486
527
|
default_timezone: "Europe/Lisbon",
|
|
@@ -489,6 +530,22 @@ var ROUTES = [
|
|
|
489
530
|
email_paused_reason: "string",
|
|
490
531
|
email_resumed_at: "2026-01-01T00:00:00.000Z"
|
|
491
532
|
} },
|
|
533
|
+
{ op: "batches.list", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/batches$/, status: 200, contentType: "application/json", body: {
|
|
534
|
+
data: [
|
|
535
|
+
{
|
|
536
|
+
flush_at: "2026-01-01T00:00:00.000Z",
|
|
537
|
+
flushed_at: "2026-01-01T00:00:00.000Z",
|
|
538
|
+
id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
539
|
+
item_count: 1,
|
|
540
|
+
key: "p_42",
|
|
541
|
+
opened_at: "2026-01-01T00:00:00.000Z",
|
|
542
|
+
recipient: "user_123",
|
|
543
|
+
state: "open",
|
|
544
|
+
type: "comment.created"
|
|
545
|
+
}
|
|
546
|
+
],
|
|
547
|
+
pagination: { next_cursor: null, has_more: false }
|
|
548
|
+
} },
|
|
492
549
|
{ op: "export.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/export$/, status: 200, contentType: "application/json", body: {
|
|
493
550
|
categories: [
|
|
494
551
|
{
|
|
@@ -508,6 +565,16 @@ var ROUTES = [
|
|
|
508
565
|
notification_types: [
|
|
509
566
|
{
|
|
510
567
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
568
|
+
batch: {
|
|
569
|
+
inbox: "collapse",
|
|
570
|
+
key: "string",
|
|
571
|
+
max_items: 1,
|
|
572
|
+
max_window_seconds: 1,
|
|
573
|
+
mode: "window",
|
|
574
|
+
schedule: { frequency: null, time: "09:00", weekday: null },
|
|
575
|
+
sliding: true,
|
|
576
|
+
window_seconds: 1
|
|
577
|
+
},
|
|
511
578
|
category_key: "string",
|
|
512
579
|
critical: true,
|
|
513
580
|
default_locale: "string",
|
|
@@ -570,6 +637,16 @@ var ROUTES = [
|
|
|
570
637
|
} },
|
|
571
638
|
{ op: "notificationTypes.archive", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+\/archive$/, status: 200, contentType: "application/json", body: {
|
|
572
639
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
640
|
+
batch: {
|
|
641
|
+
inbox: "collapse",
|
|
642
|
+
key: "string",
|
|
643
|
+
max_items: 1,
|
|
644
|
+
max_window_seconds: 1,
|
|
645
|
+
mode: "window",
|
|
646
|
+
schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
|
|
647
|
+
sliding: true,
|
|
648
|
+
window_seconds: 1
|
|
649
|
+
},
|
|
573
650
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
574
651
|
category_key: "string",
|
|
575
652
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -601,9 +678,24 @@ var ROUTES = [
|
|
|
601
678
|
],
|
|
602
679
|
cross_channel_mismatches: {}
|
|
603
680
|
} },
|
|
681
|
+
{ op: "recipients.createPreferenceLink", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/preference-link$/, status: 201, contentType: "application/json", body: {
|
|
682
|
+
category_key: "string",
|
|
683
|
+
expires_at: "2026-01-01T00:00:00.000Z",
|
|
684
|
+
url: "https://api.notify.productcraft.co/v1/preferences/p1.AQ\u2026"
|
|
685
|
+
} },
|
|
604
686
|
{ op: "channels.apns.deleteCredential", method: "DELETE", pattern: /^\/v1\/workspaces\/[^\/]+\/channels\/apns\/credentials\/[^\/]+$/, status: 204, contentType: null, body: null },
|
|
605
687
|
{ op: "notificationTypes.replaceByKey", method: "PUT", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/by-key\/[^\/]+$/, status: 200, contentType: "application/json", body: {
|
|
606
688
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
689
|
+
batch: {
|
|
690
|
+
inbox: "collapse",
|
|
691
|
+
key: "string",
|
|
692
|
+
max_items: 1,
|
|
693
|
+
max_window_seconds: 1,
|
|
694
|
+
mode: "window",
|
|
695
|
+
schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
|
|
696
|
+
sliding: true,
|
|
697
|
+
window_seconds: 1
|
|
698
|
+
},
|
|
607
699
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
608
700
|
category_key: "string",
|
|
609
701
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -641,6 +733,7 @@ var ROUTES = [
|
|
|
641
733
|
url: "https://example.com"
|
|
642
734
|
} },
|
|
643
735
|
{ op: "recipients.preferences.replace", method: "PUT", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/preferences$/, status: 200, contentType: "application/json", body: {
|
|
736
|
+
effective_quiet_hours: { end: "08:00", source: "recipient", start: "22:00", timezone: "Europe/Lisbon" },
|
|
644
737
|
external_id: "string",
|
|
645
738
|
preferences: [{ channel: "inbox", enabled: true, key: "string", scope: "all" }],
|
|
646
739
|
quiet_hours: { end: "08:00", start: "22:00" },
|
|
@@ -648,6 +741,7 @@ var ROUTES = [
|
|
|
648
741
|
unsubscribed_all: true
|
|
649
742
|
} },
|
|
650
743
|
{ op: "recipients.preferences.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/preferences$/, status: 200, contentType: "application/json", body: {
|
|
744
|
+
effective_quiet_hours: { end: "08:00", source: "recipient", start: "22:00", timezone: "Europe/Lisbon" },
|
|
651
745
|
external_id: "string",
|
|
652
746
|
preferences: [{ channel: "inbox", enabled: true, key: "string", scope: "all" }],
|
|
653
747
|
quiet_hours: { end: "08:00", start: "22:00" },
|
|
@@ -655,6 +749,7 @@ var ROUTES = [
|
|
|
655
749
|
unsubscribed_all: true
|
|
656
750
|
} },
|
|
657
751
|
{ op: "recipients.preferences.update", method: "PATCH", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/preferences$/, status: 200, contentType: "application/json", body: {
|
|
752
|
+
effective_quiet_hours: { end: "08:00", source: "recipient", start: "22:00", timezone: "Europe/Lisbon" },
|
|
658
753
|
external_id: "string",
|
|
659
754
|
preferences: [{ channel: "inbox", enabled: true, key: "string", scope: "all" }],
|
|
660
755
|
quiet_hours: { end: "08:00", start: "22:00" },
|
|
@@ -709,6 +804,7 @@ var ROUTES = [
|
|
|
709
804
|
data: [
|
|
710
805
|
{
|
|
711
806
|
attempts: 1,
|
|
807
|
+
batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
712
808
|
channel: "inbox",
|
|
713
809
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
714
810
|
device: {
|
|
@@ -752,6 +848,16 @@ var ROUTES = [
|
|
|
752
848
|
} },
|
|
753
849
|
{ op: "notificationTypes.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+$/, status: 200, contentType: "application/json", body: {
|
|
754
850
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
851
|
+
batch: {
|
|
852
|
+
inbox: "collapse",
|
|
853
|
+
key: "string",
|
|
854
|
+
max_items: 1,
|
|
855
|
+
max_window_seconds: 1,
|
|
856
|
+
mode: "window",
|
|
857
|
+
schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
|
|
858
|
+
sliding: true,
|
|
859
|
+
window_seconds: 1
|
|
860
|
+
},
|
|
755
861
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
756
862
|
category_key: "string",
|
|
757
863
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -773,6 +879,16 @@ var ROUTES = [
|
|
|
773
879
|
} },
|
|
774
880
|
{ op: "notificationTypes.update", method: "PATCH", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+$/, status: 200, contentType: "application/json", body: {
|
|
775
881
|
archived_at: "2026-01-01T00:00:00.000Z",
|
|
882
|
+
batch: {
|
|
883
|
+
inbox: "collapse",
|
|
884
|
+
key: "string",
|
|
885
|
+
max_items: 1,
|
|
886
|
+
max_window_seconds: 1,
|
|
887
|
+
mode: "window",
|
|
888
|
+
schedule: { frequency: "daily", time: "09:00", weekday: "monday" },
|
|
889
|
+
sliding: true,
|
|
890
|
+
window_seconds: 1
|
|
891
|
+
},
|
|
776
892
|
category_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
777
893
|
category_key: "string",
|
|
778
894
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
@@ -929,6 +1045,31 @@ var ROUTES = [
|
|
|
929
1045
|
test: true,
|
|
930
1046
|
type: "notification.accepted"
|
|
931
1047
|
} },
|
|
1048
|
+
{ op: "batches.flush", method: "POST", pattern: /^\/v1\/workspaces\/[^\/]+\/batches\/[^\/]+\/flush$/, status: 200, contentType: "application/json", body: {
|
|
1049
|
+
batch: {
|
|
1050
|
+
deliveries: [
|
|
1051
|
+
{
|
|
1052
|
+
channel: "string",
|
|
1053
|
+
id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1054
|
+
notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1055
|
+
reason: "string",
|
|
1056
|
+
state: "string"
|
|
1057
|
+
}
|
|
1058
|
+
],
|
|
1059
|
+
flush_at: "2026-01-01T00:00:00.000Z",
|
|
1060
|
+
flushed_at: "2026-01-01T00:00:00.000Z",
|
|
1061
|
+
id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1062
|
+
item_count: 1,
|
|
1063
|
+
key: "p_42",
|
|
1064
|
+
notification_ids: ["9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b"],
|
|
1065
|
+
opened_at: "2026-01-01T00:00:00.000Z",
|
|
1066
|
+
payload: {},
|
|
1067
|
+
recipient: "user_123",
|
|
1068
|
+
state: "open",
|
|
1069
|
+
type: "comment.created"
|
|
1070
|
+
},
|
|
1071
|
+
merged: 1
|
|
1072
|
+
} },
|
|
932
1073
|
{ op: "notifications.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notifications\/[^\/]+$/, status: 200, contentType: "application/json", body: {
|
|
933
1074
|
actor: { avatar_url: "string", external_id: "string", name: "string" },
|
|
934
1075
|
caller: "string",
|
|
@@ -990,6 +1131,7 @@ var ROUTES = [
|
|
|
990
1131
|
retry_after_s: 1
|
|
991
1132
|
}
|
|
992
1133
|
],
|
|
1134
|
+
batch_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
993
1135
|
channel: "inbox",
|
|
994
1136
|
created_at: "2026-01-01T00:00:00.000Z",
|
|
995
1137
|
device_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
@@ -1070,6 +1212,28 @@ var ROUTES = [
|
|
|
1070
1212
|
unsubscribed_all: true,
|
|
1071
1213
|
updated_at: "2026-01-01T00:00:00.000Z"
|
|
1072
1214
|
} },
|
|
1215
|
+
{ op: "batches.retrieve", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/batches\/[^\/]+$/, status: 200, contentType: "application/json", body: {
|
|
1216
|
+
deliveries: [
|
|
1217
|
+
{
|
|
1218
|
+
channel: "string",
|
|
1219
|
+
id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1220
|
+
notification_id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1221
|
+
reason: "string",
|
|
1222
|
+
state: "string"
|
|
1223
|
+
}
|
|
1224
|
+
],
|
|
1225
|
+
flush_at: "2026-01-01T00:00:00.000Z",
|
|
1226
|
+
flushed_at: "2026-01-01T00:00:00.000Z",
|
|
1227
|
+
id: "9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b",
|
|
1228
|
+
item_count: 1,
|
|
1229
|
+
key: "p_42",
|
|
1230
|
+
notification_ids: ["9b2f6c1e-0d6a-4a63-9a43-2f1c3e4d5a6b"],
|
|
1231
|
+
opened_at: "2026-01-01T00:00:00.000Z",
|
|
1232
|
+
payload: {},
|
|
1233
|
+
recipient: "user_123",
|
|
1234
|
+
state: "open",
|
|
1235
|
+
type: "comment.created"
|
|
1236
|
+
} },
|
|
1073
1237
|
{ op: "recipients.devices.delete", method: "DELETE", pattern: /^\/v1\/workspaces\/[^\/]+\/recipients\/[^\/]+\/devices\/[^\/]+$/, status: 204, contentType: null, body: null },
|
|
1074
1238
|
{ op: "notificationTypes.templates.versions", method: "GET", pattern: /^\/v1\/workspaces\/[^\/]+\/notification-types\/[^\/]+\/templates\/[^\/]+\/[^\/]+\/versions$/, status: 200, contentType: "application/json", body: {
|
|
1075
1239
|
data: [{ actor: "string", body: {}, created_at: "2026-01-01T00:00:00.000Z", version: 1 }]
|