@adatechnology/notification-contracts 0.3.0 → 0.5.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/index.cjs +281 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +682 -5
- package/dist/index.d.ts +682 -5
- package/dist/index.js +261 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -49,8 +49,18 @@ type DevicePlatform = (typeof DEVICE_PLATFORM)[keyof typeof DEVICE_PLATFORM];
|
|
|
49
49
|
declare const PUSH_DRIVER: {
|
|
50
50
|
readonly EXPO: "expo";
|
|
51
51
|
readonly FCM: "fcm";
|
|
52
|
+
readonly WEBPUSH: "webpush";
|
|
52
53
|
};
|
|
53
54
|
type PushDriver = (typeof PUSH_DRIVER)[keyof typeof PUSH_DRIVER];
|
|
55
|
+
type WebPushKeys = {
|
|
56
|
+
readonly p256dh: string;
|
|
57
|
+
readonly auth: string;
|
|
58
|
+
};
|
|
59
|
+
type WebPushSubscription = {
|
|
60
|
+
readonly endpoint: string;
|
|
61
|
+
readonly keys: WebPushKeys;
|
|
62
|
+
readonly expirationTime?: number | null;
|
|
63
|
+
};
|
|
54
64
|
declare const EMAIL_DRIVER: {
|
|
55
65
|
readonly SMTP: "smtp";
|
|
56
66
|
readonly RESEND: "resend";
|
|
@@ -250,6 +260,8 @@ type SendPushParams = {
|
|
|
250
260
|
*/
|
|
251
261
|
readonly data?: Readonly<Record<string, string>>;
|
|
252
262
|
readonly badge?: number;
|
|
263
|
+
/** Assinatura Web Push (VAPID) quando o destino for web/PWA sem Firebase */
|
|
264
|
+
readonly subscription?: WebPushSubscription;
|
|
253
265
|
};
|
|
254
266
|
type SendEmailParams = {
|
|
255
267
|
readonly to: string;
|
|
@@ -320,6 +332,102 @@ type ChannelDrivers = {
|
|
|
320
332
|
readonly sms?: SmsDriverPort;
|
|
321
333
|
};
|
|
322
334
|
|
|
335
|
+
/**
|
|
336
|
+
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
337
|
+
*
|
|
338
|
+
* Contratos do Container de Serviço Push Notification dedicado (Railway).
|
|
339
|
+
* Cobre Web Push nativo (VAPID RFC 8292 sem Firebase) e Mobile Push (Expo).
|
|
340
|
+
*/
|
|
341
|
+
|
|
342
|
+
type PushNotificationPayload = {
|
|
343
|
+
readonly title: string;
|
|
344
|
+
readonly body: string;
|
|
345
|
+
readonly icon?: string;
|
|
346
|
+
readonly badge?: number;
|
|
347
|
+
readonly image?: string;
|
|
348
|
+
readonly tag?: string;
|
|
349
|
+
readonly url?: string;
|
|
350
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
351
|
+
};
|
|
352
|
+
type SendPushDirectTarget = {
|
|
353
|
+
readonly type: 'token';
|
|
354
|
+
readonly token: string;
|
|
355
|
+
readonly platform: DevicePlatform;
|
|
356
|
+
readonly driver?: PushDriver;
|
|
357
|
+
} | {
|
|
358
|
+
readonly type: 'user';
|
|
359
|
+
readonly userId: UserId;
|
|
360
|
+
} | {
|
|
361
|
+
readonly type: 'subscription';
|
|
362
|
+
readonly subscription: WebPushSubscription;
|
|
363
|
+
};
|
|
364
|
+
type SendPushDirectParams = {
|
|
365
|
+
readonly companyId: CompanyId;
|
|
366
|
+
readonly target: SendPushDirectTarget;
|
|
367
|
+
readonly notification: PushNotificationPayload;
|
|
368
|
+
readonly dedupeKey?: string;
|
|
369
|
+
};
|
|
370
|
+
type SendPushDirectResult = {
|
|
371
|
+
readonly success: boolean;
|
|
372
|
+
readonly messageId?: string;
|
|
373
|
+
readonly outcome: DeliveryAttemptResult;
|
|
374
|
+
};
|
|
375
|
+
type BroadcastPushFilter = {
|
|
376
|
+
readonly topic?: string;
|
|
377
|
+
readonly tags?: readonly string[];
|
|
378
|
+
readonly platform?: DevicePlatform;
|
|
379
|
+
};
|
|
380
|
+
type BroadcastPushParams = {
|
|
381
|
+
readonly companyId: CompanyId;
|
|
382
|
+
readonly filter?: BroadcastPushFilter;
|
|
383
|
+
readonly notification: PushNotificationPayload;
|
|
384
|
+
};
|
|
385
|
+
type BroadcastPushResult = {
|
|
386
|
+
readonly sentCount: number;
|
|
387
|
+
readonly failedCount: number;
|
|
388
|
+
readonly invalidTargetsRemoved: number;
|
|
389
|
+
};
|
|
390
|
+
type RegisterPushSubscriptionParams = {
|
|
391
|
+
readonly companyId: CompanyId;
|
|
392
|
+
readonly userId?: UserId;
|
|
393
|
+
readonly platform: DevicePlatform;
|
|
394
|
+
readonly driver: PushDriver;
|
|
395
|
+
readonly subscription: WebPushSubscription;
|
|
396
|
+
readonly appVersion?: string;
|
|
397
|
+
readonly locale?: string;
|
|
398
|
+
readonly timezone?: string;
|
|
399
|
+
readonly tags?: readonly string[];
|
|
400
|
+
};
|
|
401
|
+
type PushSubscriptionRecord = {
|
|
402
|
+
readonly id: string;
|
|
403
|
+
readonly companyId: CompanyId;
|
|
404
|
+
readonly userId?: UserId;
|
|
405
|
+
readonly platform: DevicePlatform;
|
|
406
|
+
readonly driver: PushDriver;
|
|
407
|
+
readonly endpoint: string;
|
|
408
|
+
readonly lastSeenAt: string;
|
|
409
|
+
};
|
|
410
|
+
type VapidKeys = {
|
|
411
|
+
readonly publicKey: string;
|
|
412
|
+
readonly privateKey: string;
|
|
413
|
+
/** Contato para RFC 8292: `mailto:admin@empresa.com` */
|
|
414
|
+
readonly subject: string;
|
|
415
|
+
};
|
|
416
|
+
type PushServiceContainerConfig = {
|
|
417
|
+
readonly port?: number;
|
|
418
|
+
readonly vapidKeys: VapidKeys;
|
|
419
|
+
readonly expoAccessToken?: string;
|
|
420
|
+
readonly defaultTtlSeconds?: number;
|
|
421
|
+
readonly allowedOrigins?: readonly string[];
|
|
422
|
+
};
|
|
423
|
+
interface PushServicePort {
|
|
424
|
+
getVapidPublicKey(): string;
|
|
425
|
+
send(params: SendPushDirectParams): Promise<SendPushDirectResult>;
|
|
426
|
+
broadcast(params: BroadcastPushParams): Promise<BroadcastPushResult>;
|
|
427
|
+
registerSubscription(params: RegisterPushSubscriptionParams): Promise<PushSubscriptionRecord>;
|
|
428
|
+
unregisterSubscription(companyId: CompanyId, endpointOrDeviceId: string): Promise<void>;
|
|
429
|
+
}
|
|
430
|
+
|
|
323
431
|
/**
|
|
324
432
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
325
433
|
*/
|
|
@@ -506,22 +614,23 @@ declare const registerDeviceSchema: z.ZodObject<{
|
|
|
506
614
|
driver: z.ZodNativeEnum<{
|
|
507
615
|
readonly EXPO: "expo";
|
|
508
616
|
readonly FCM: "fcm";
|
|
617
|
+
readonly WEBPUSH: "webpush";
|
|
509
618
|
}>;
|
|
510
619
|
token: z.ZodString;
|
|
511
620
|
appVersion: z.ZodOptional<z.ZodString>;
|
|
512
621
|
locale: z.ZodOptional<z.ZodString>;
|
|
513
622
|
timezone: z.ZodOptional<z.ZodString>;
|
|
514
623
|
}, "strip", z.ZodTypeAny, {
|
|
515
|
-
platform: "ios" | "android" | "web";
|
|
516
|
-
driver: "expo" | "fcm";
|
|
517
624
|
token: string;
|
|
625
|
+
platform: "ios" | "android" | "web";
|
|
626
|
+
driver: "expo" | "fcm" | "webpush";
|
|
518
627
|
locale?: string | undefined;
|
|
519
628
|
appVersion?: string | undefined;
|
|
520
629
|
timezone?: string | undefined;
|
|
521
630
|
}, {
|
|
522
|
-
platform: "ios" | "android" | "web";
|
|
523
|
-
driver: "expo" | "fcm";
|
|
524
631
|
token: string;
|
|
632
|
+
platform: "ios" | "android" | "web";
|
|
633
|
+
driver: "expo" | "fcm" | "webpush";
|
|
525
634
|
locale?: string | undefined;
|
|
526
635
|
appVersion?: string | undefined;
|
|
527
636
|
timezone?: string | undefined;
|
|
@@ -735,6 +844,509 @@ declare const deliveryWebhookSchema: z.ZodObject<{
|
|
|
735
844
|
suppressionReason?: "bounce" | "complaint" | "opt_out" | undefined;
|
|
736
845
|
}>;
|
|
737
846
|
type DeliveryWebhookBody = z.infer<typeof deliveryWebhookSchema>;
|
|
847
|
+
declare const webPushKeysSchema: z.ZodObject<{
|
|
848
|
+
p256dh: z.ZodString;
|
|
849
|
+
auth: z.ZodString;
|
|
850
|
+
}, "strip", z.ZodTypeAny, {
|
|
851
|
+
p256dh: string;
|
|
852
|
+
auth: string;
|
|
853
|
+
}, {
|
|
854
|
+
p256dh: string;
|
|
855
|
+
auth: string;
|
|
856
|
+
}>;
|
|
857
|
+
type WebPushKeysBody = z.infer<typeof webPushKeysSchema>;
|
|
858
|
+
declare const webPushSubscriptionSchema: z.ZodObject<{
|
|
859
|
+
endpoint: z.ZodString;
|
|
860
|
+
keys: z.ZodObject<{
|
|
861
|
+
p256dh: z.ZodString;
|
|
862
|
+
auth: z.ZodString;
|
|
863
|
+
}, "strip", z.ZodTypeAny, {
|
|
864
|
+
p256dh: string;
|
|
865
|
+
auth: string;
|
|
866
|
+
}, {
|
|
867
|
+
p256dh: string;
|
|
868
|
+
auth: string;
|
|
869
|
+
}>;
|
|
870
|
+
expirationTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
871
|
+
}, "strip", z.ZodTypeAny, {
|
|
872
|
+
keys: {
|
|
873
|
+
p256dh: string;
|
|
874
|
+
auth: string;
|
|
875
|
+
};
|
|
876
|
+
endpoint: string;
|
|
877
|
+
expirationTime?: number | null | undefined;
|
|
878
|
+
}, {
|
|
879
|
+
keys: {
|
|
880
|
+
p256dh: string;
|
|
881
|
+
auth: string;
|
|
882
|
+
};
|
|
883
|
+
endpoint: string;
|
|
884
|
+
expirationTime?: number | null | undefined;
|
|
885
|
+
}>;
|
|
886
|
+
type WebPushSubscriptionBody = z.infer<typeof webPushSubscriptionSchema>;
|
|
887
|
+
declare const pushNotificationPayloadSchema: z.ZodObject<{
|
|
888
|
+
title: z.ZodString;
|
|
889
|
+
body: z.ZodString;
|
|
890
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
891
|
+
badge: z.ZodOptional<z.ZodNumber>;
|
|
892
|
+
image: z.ZodOptional<z.ZodString>;
|
|
893
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
894
|
+
url: z.ZodOptional<z.ZodString>;
|
|
895
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
896
|
+
}, "strip", z.ZodTypeAny, {
|
|
897
|
+
body: string;
|
|
898
|
+
title: string;
|
|
899
|
+
icon?: string | undefined;
|
|
900
|
+
badge?: number | undefined;
|
|
901
|
+
image?: string | undefined;
|
|
902
|
+
tag?: string | undefined;
|
|
903
|
+
url?: string | undefined;
|
|
904
|
+
data?: Record<string, unknown> | undefined;
|
|
905
|
+
}, {
|
|
906
|
+
body: string;
|
|
907
|
+
title: string;
|
|
908
|
+
icon?: string | undefined;
|
|
909
|
+
badge?: number | undefined;
|
|
910
|
+
image?: string | undefined;
|
|
911
|
+
tag?: string | undefined;
|
|
912
|
+
url?: string | undefined;
|
|
913
|
+
data?: Record<string, unknown> | undefined;
|
|
914
|
+
}>;
|
|
915
|
+
type PushNotificationPayloadBody = z.infer<typeof pushNotificationPayloadSchema>;
|
|
916
|
+
declare const sendPushDirectTargetSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
917
|
+
type: z.ZodLiteral<"token">;
|
|
918
|
+
token: z.ZodString;
|
|
919
|
+
platform: z.ZodNativeEnum<{
|
|
920
|
+
readonly IOS: "ios";
|
|
921
|
+
readonly ANDROID: "android";
|
|
922
|
+
readonly WEB: "web";
|
|
923
|
+
}>;
|
|
924
|
+
driver: z.ZodOptional<z.ZodNativeEnum<{
|
|
925
|
+
readonly EXPO: "expo";
|
|
926
|
+
readonly FCM: "fcm";
|
|
927
|
+
readonly WEBPUSH: "webpush";
|
|
928
|
+
}>>;
|
|
929
|
+
}, "strip", z.ZodTypeAny, {
|
|
930
|
+
token: string;
|
|
931
|
+
type: "token";
|
|
932
|
+
platform: "ios" | "android" | "web";
|
|
933
|
+
driver?: "expo" | "fcm" | "webpush" | undefined;
|
|
934
|
+
}, {
|
|
935
|
+
token: string;
|
|
936
|
+
type: "token";
|
|
937
|
+
platform: "ios" | "android" | "web";
|
|
938
|
+
driver?: "expo" | "fcm" | "webpush" | undefined;
|
|
939
|
+
}>, z.ZodObject<{
|
|
940
|
+
type: z.ZodLiteral<"user">;
|
|
941
|
+
userId: z.ZodString;
|
|
942
|
+
}, "strip", z.ZodTypeAny, {
|
|
943
|
+
type: "user";
|
|
944
|
+
userId: string;
|
|
945
|
+
}, {
|
|
946
|
+
type: "user";
|
|
947
|
+
userId: string;
|
|
948
|
+
}>, z.ZodObject<{
|
|
949
|
+
type: z.ZodLiteral<"subscription">;
|
|
950
|
+
subscription: z.ZodObject<{
|
|
951
|
+
endpoint: z.ZodString;
|
|
952
|
+
keys: z.ZodObject<{
|
|
953
|
+
p256dh: z.ZodString;
|
|
954
|
+
auth: z.ZodString;
|
|
955
|
+
}, "strip", z.ZodTypeAny, {
|
|
956
|
+
p256dh: string;
|
|
957
|
+
auth: string;
|
|
958
|
+
}, {
|
|
959
|
+
p256dh: string;
|
|
960
|
+
auth: string;
|
|
961
|
+
}>;
|
|
962
|
+
expirationTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
963
|
+
}, "strip", z.ZodTypeAny, {
|
|
964
|
+
keys: {
|
|
965
|
+
p256dh: string;
|
|
966
|
+
auth: string;
|
|
967
|
+
};
|
|
968
|
+
endpoint: string;
|
|
969
|
+
expirationTime?: number | null | undefined;
|
|
970
|
+
}, {
|
|
971
|
+
keys: {
|
|
972
|
+
p256dh: string;
|
|
973
|
+
auth: string;
|
|
974
|
+
};
|
|
975
|
+
endpoint: string;
|
|
976
|
+
expirationTime?: number | null | undefined;
|
|
977
|
+
}>;
|
|
978
|
+
}, "strip", z.ZodTypeAny, {
|
|
979
|
+
subscription: {
|
|
980
|
+
keys: {
|
|
981
|
+
p256dh: string;
|
|
982
|
+
auth: string;
|
|
983
|
+
};
|
|
984
|
+
endpoint: string;
|
|
985
|
+
expirationTime?: number | null | undefined;
|
|
986
|
+
};
|
|
987
|
+
type: "subscription";
|
|
988
|
+
}, {
|
|
989
|
+
subscription: {
|
|
990
|
+
keys: {
|
|
991
|
+
p256dh: string;
|
|
992
|
+
auth: string;
|
|
993
|
+
};
|
|
994
|
+
endpoint: string;
|
|
995
|
+
expirationTime?: number | null | undefined;
|
|
996
|
+
};
|
|
997
|
+
type: "subscription";
|
|
998
|
+
}>]>;
|
|
999
|
+
type SendPushDirectTargetBody = z.infer<typeof sendPushDirectTargetSchema>;
|
|
1000
|
+
declare const sendPushDirectSchema: z.ZodObject<{
|
|
1001
|
+
target: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1002
|
+
type: z.ZodLiteral<"token">;
|
|
1003
|
+
token: z.ZodString;
|
|
1004
|
+
platform: z.ZodNativeEnum<{
|
|
1005
|
+
readonly IOS: "ios";
|
|
1006
|
+
readonly ANDROID: "android";
|
|
1007
|
+
readonly WEB: "web";
|
|
1008
|
+
}>;
|
|
1009
|
+
driver: z.ZodOptional<z.ZodNativeEnum<{
|
|
1010
|
+
readonly EXPO: "expo";
|
|
1011
|
+
readonly FCM: "fcm";
|
|
1012
|
+
readonly WEBPUSH: "webpush";
|
|
1013
|
+
}>>;
|
|
1014
|
+
}, "strip", z.ZodTypeAny, {
|
|
1015
|
+
token: string;
|
|
1016
|
+
type: "token";
|
|
1017
|
+
platform: "ios" | "android" | "web";
|
|
1018
|
+
driver?: "expo" | "fcm" | "webpush" | undefined;
|
|
1019
|
+
}, {
|
|
1020
|
+
token: string;
|
|
1021
|
+
type: "token";
|
|
1022
|
+
platform: "ios" | "android" | "web";
|
|
1023
|
+
driver?: "expo" | "fcm" | "webpush" | undefined;
|
|
1024
|
+
}>, z.ZodObject<{
|
|
1025
|
+
type: z.ZodLiteral<"user">;
|
|
1026
|
+
userId: z.ZodString;
|
|
1027
|
+
}, "strip", z.ZodTypeAny, {
|
|
1028
|
+
type: "user";
|
|
1029
|
+
userId: string;
|
|
1030
|
+
}, {
|
|
1031
|
+
type: "user";
|
|
1032
|
+
userId: string;
|
|
1033
|
+
}>, z.ZodObject<{
|
|
1034
|
+
type: z.ZodLiteral<"subscription">;
|
|
1035
|
+
subscription: z.ZodObject<{
|
|
1036
|
+
endpoint: z.ZodString;
|
|
1037
|
+
keys: z.ZodObject<{
|
|
1038
|
+
p256dh: z.ZodString;
|
|
1039
|
+
auth: z.ZodString;
|
|
1040
|
+
}, "strip", z.ZodTypeAny, {
|
|
1041
|
+
p256dh: string;
|
|
1042
|
+
auth: string;
|
|
1043
|
+
}, {
|
|
1044
|
+
p256dh: string;
|
|
1045
|
+
auth: string;
|
|
1046
|
+
}>;
|
|
1047
|
+
expirationTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1048
|
+
}, "strip", z.ZodTypeAny, {
|
|
1049
|
+
keys: {
|
|
1050
|
+
p256dh: string;
|
|
1051
|
+
auth: string;
|
|
1052
|
+
};
|
|
1053
|
+
endpoint: string;
|
|
1054
|
+
expirationTime?: number | null | undefined;
|
|
1055
|
+
}, {
|
|
1056
|
+
keys: {
|
|
1057
|
+
p256dh: string;
|
|
1058
|
+
auth: string;
|
|
1059
|
+
};
|
|
1060
|
+
endpoint: string;
|
|
1061
|
+
expirationTime?: number | null | undefined;
|
|
1062
|
+
}>;
|
|
1063
|
+
}, "strip", z.ZodTypeAny, {
|
|
1064
|
+
subscription: {
|
|
1065
|
+
keys: {
|
|
1066
|
+
p256dh: string;
|
|
1067
|
+
auth: string;
|
|
1068
|
+
};
|
|
1069
|
+
endpoint: string;
|
|
1070
|
+
expirationTime?: number | null | undefined;
|
|
1071
|
+
};
|
|
1072
|
+
type: "subscription";
|
|
1073
|
+
}, {
|
|
1074
|
+
subscription: {
|
|
1075
|
+
keys: {
|
|
1076
|
+
p256dh: string;
|
|
1077
|
+
auth: string;
|
|
1078
|
+
};
|
|
1079
|
+
endpoint: string;
|
|
1080
|
+
expirationTime?: number | null | undefined;
|
|
1081
|
+
};
|
|
1082
|
+
type: "subscription";
|
|
1083
|
+
}>]>;
|
|
1084
|
+
notification: z.ZodObject<{
|
|
1085
|
+
title: z.ZodString;
|
|
1086
|
+
body: z.ZodString;
|
|
1087
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1088
|
+
badge: z.ZodOptional<z.ZodNumber>;
|
|
1089
|
+
image: z.ZodOptional<z.ZodString>;
|
|
1090
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
1091
|
+
url: z.ZodOptional<z.ZodString>;
|
|
1092
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1093
|
+
}, "strip", z.ZodTypeAny, {
|
|
1094
|
+
body: string;
|
|
1095
|
+
title: string;
|
|
1096
|
+
icon?: string | undefined;
|
|
1097
|
+
badge?: number | undefined;
|
|
1098
|
+
image?: string | undefined;
|
|
1099
|
+
tag?: string | undefined;
|
|
1100
|
+
url?: string | undefined;
|
|
1101
|
+
data?: Record<string, unknown> | undefined;
|
|
1102
|
+
}, {
|
|
1103
|
+
body: string;
|
|
1104
|
+
title: string;
|
|
1105
|
+
icon?: string | undefined;
|
|
1106
|
+
badge?: number | undefined;
|
|
1107
|
+
image?: string | undefined;
|
|
1108
|
+
tag?: string | undefined;
|
|
1109
|
+
url?: string | undefined;
|
|
1110
|
+
data?: Record<string, unknown> | undefined;
|
|
1111
|
+
}>;
|
|
1112
|
+
dedupeKey: z.ZodOptional<z.ZodString>;
|
|
1113
|
+
}, "strip", z.ZodTypeAny, {
|
|
1114
|
+
target: {
|
|
1115
|
+
token: string;
|
|
1116
|
+
type: "token";
|
|
1117
|
+
platform: "ios" | "android" | "web";
|
|
1118
|
+
driver?: "expo" | "fcm" | "webpush" | undefined;
|
|
1119
|
+
} | {
|
|
1120
|
+
type: "user";
|
|
1121
|
+
userId: string;
|
|
1122
|
+
} | {
|
|
1123
|
+
subscription: {
|
|
1124
|
+
keys: {
|
|
1125
|
+
p256dh: string;
|
|
1126
|
+
auth: string;
|
|
1127
|
+
};
|
|
1128
|
+
endpoint: string;
|
|
1129
|
+
expirationTime?: number | null | undefined;
|
|
1130
|
+
};
|
|
1131
|
+
type: "subscription";
|
|
1132
|
+
};
|
|
1133
|
+
notification: {
|
|
1134
|
+
body: string;
|
|
1135
|
+
title: string;
|
|
1136
|
+
icon?: string | undefined;
|
|
1137
|
+
badge?: number | undefined;
|
|
1138
|
+
image?: string | undefined;
|
|
1139
|
+
tag?: string | undefined;
|
|
1140
|
+
url?: string | undefined;
|
|
1141
|
+
data?: Record<string, unknown> | undefined;
|
|
1142
|
+
};
|
|
1143
|
+
dedupeKey?: string | undefined;
|
|
1144
|
+
}, {
|
|
1145
|
+
target: {
|
|
1146
|
+
token: string;
|
|
1147
|
+
type: "token";
|
|
1148
|
+
platform: "ios" | "android" | "web";
|
|
1149
|
+
driver?: "expo" | "fcm" | "webpush" | undefined;
|
|
1150
|
+
} | {
|
|
1151
|
+
type: "user";
|
|
1152
|
+
userId: string;
|
|
1153
|
+
} | {
|
|
1154
|
+
subscription: {
|
|
1155
|
+
keys: {
|
|
1156
|
+
p256dh: string;
|
|
1157
|
+
auth: string;
|
|
1158
|
+
};
|
|
1159
|
+
endpoint: string;
|
|
1160
|
+
expirationTime?: number | null | undefined;
|
|
1161
|
+
};
|
|
1162
|
+
type: "subscription";
|
|
1163
|
+
};
|
|
1164
|
+
notification: {
|
|
1165
|
+
body: string;
|
|
1166
|
+
title: string;
|
|
1167
|
+
icon?: string | undefined;
|
|
1168
|
+
badge?: number | undefined;
|
|
1169
|
+
image?: string | undefined;
|
|
1170
|
+
tag?: string | undefined;
|
|
1171
|
+
url?: string | undefined;
|
|
1172
|
+
data?: Record<string, unknown> | undefined;
|
|
1173
|
+
};
|
|
1174
|
+
dedupeKey?: string | undefined;
|
|
1175
|
+
}>;
|
|
1176
|
+
type SendPushDirectBody = z.infer<typeof sendPushDirectSchema>;
|
|
1177
|
+
declare const broadcastPushFilterSchema: z.ZodObject<{
|
|
1178
|
+
topic: z.ZodOptional<z.ZodString>;
|
|
1179
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1180
|
+
platform: z.ZodOptional<z.ZodNativeEnum<{
|
|
1181
|
+
readonly IOS: "ios";
|
|
1182
|
+
readonly ANDROID: "android";
|
|
1183
|
+
readonly WEB: "web";
|
|
1184
|
+
}>>;
|
|
1185
|
+
}, "strip", z.ZodTypeAny, {
|
|
1186
|
+
platform?: "ios" | "android" | "web" | undefined;
|
|
1187
|
+
topic?: string | undefined;
|
|
1188
|
+
tags?: string[] | undefined;
|
|
1189
|
+
}, {
|
|
1190
|
+
platform?: "ios" | "android" | "web" | undefined;
|
|
1191
|
+
topic?: string | undefined;
|
|
1192
|
+
tags?: string[] | undefined;
|
|
1193
|
+
}>;
|
|
1194
|
+
type BroadcastPushFilterBody = z.infer<typeof broadcastPushFilterSchema>;
|
|
1195
|
+
declare const broadcastPushSchema: z.ZodObject<{
|
|
1196
|
+
filter: z.ZodOptional<z.ZodObject<{
|
|
1197
|
+
topic: z.ZodOptional<z.ZodString>;
|
|
1198
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1199
|
+
platform: z.ZodOptional<z.ZodNativeEnum<{
|
|
1200
|
+
readonly IOS: "ios";
|
|
1201
|
+
readonly ANDROID: "android";
|
|
1202
|
+
readonly WEB: "web";
|
|
1203
|
+
}>>;
|
|
1204
|
+
}, "strip", z.ZodTypeAny, {
|
|
1205
|
+
platform?: "ios" | "android" | "web" | undefined;
|
|
1206
|
+
topic?: string | undefined;
|
|
1207
|
+
tags?: string[] | undefined;
|
|
1208
|
+
}, {
|
|
1209
|
+
platform?: "ios" | "android" | "web" | undefined;
|
|
1210
|
+
topic?: string | undefined;
|
|
1211
|
+
tags?: string[] | undefined;
|
|
1212
|
+
}>>;
|
|
1213
|
+
notification: z.ZodObject<{
|
|
1214
|
+
title: z.ZodString;
|
|
1215
|
+
body: z.ZodString;
|
|
1216
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1217
|
+
badge: z.ZodOptional<z.ZodNumber>;
|
|
1218
|
+
image: z.ZodOptional<z.ZodString>;
|
|
1219
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
1220
|
+
url: z.ZodOptional<z.ZodString>;
|
|
1221
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1222
|
+
}, "strip", z.ZodTypeAny, {
|
|
1223
|
+
body: string;
|
|
1224
|
+
title: string;
|
|
1225
|
+
icon?: string | undefined;
|
|
1226
|
+
badge?: number | undefined;
|
|
1227
|
+
image?: string | undefined;
|
|
1228
|
+
tag?: string | undefined;
|
|
1229
|
+
url?: string | undefined;
|
|
1230
|
+
data?: Record<string, unknown> | undefined;
|
|
1231
|
+
}, {
|
|
1232
|
+
body: string;
|
|
1233
|
+
title: string;
|
|
1234
|
+
icon?: string | undefined;
|
|
1235
|
+
badge?: number | undefined;
|
|
1236
|
+
image?: string | undefined;
|
|
1237
|
+
tag?: string | undefined;
|
|
1238
|
+
url?: string | undefined;
|
|
1239
|
+
data?: Record<string, unknown> | undefined;
|
|
1240
|
+
}>;
|
|
1241
|
+
}, "strip", z.ZodTypeAny, {
|
|
1242
|
+
notification: {
|
|
1243
|
+
body: string;
|
|
1244
|
+
title: string;
|
|
1245
|
+
icon?: string | undefined;
|
|
1246
|
+
badge?: number | undefined;
|
|
1247
|
+
image?: string | undefined;
|
|
1248
|
+
tag?: string | undefined;
|
|
1249
|
+
url?: string | undefined;
|
|
1250
|
+
data?: Record<string, unknown> | undefined;
|
|
1251
|
+
};
|
|
1252
|
+
filter?: {
|
|
1253
|
+
platform?: "ios" | "android" | "web" | undefined;
|
|
1254
|
+
topic?: string | undefined;
|
|
1255
|
+
tags?: string[] | undefined;
|
|
1256
|
+
} | undefined;
|
|
1257
|
+
}, {
|
|
1258
|
+
notification: {
|
|
1259
|
+
body: string;
|
|
1260
|
+
title: string;
|
|
1261
|
+
icon?: string | undefined;
|
|
1262
|
+
badge?: number | undefined;
|
|
1263
|
+
image?: string | undefined;
|
|
1264
|
+
tag?: string | undefined;
|
|
1265
|
+
url?: string | undefined;
|
|
1266
|
+
data?: Record<string, unknown> | undefined;
|
|
1267
|
+
};
|
|
1268
|
+
filter?: {
|
|
1269
|
+
platform?: "ios" | "android" | "web" | undefined;
|
|
1270
|
+
topic?: string | undefined;
|
|
1271
|
+
tags?: string[] | undefined;
|
|
1272
|
+
} | undefined;
|
|
1273
|
+
}>;
|
|
1274
|
+
type BroadcastPushBody = z.infer<typeof broadcastPushSchema>;
|
|
1275
|
+
declare const registerPushSubscriptionSchema: z.ZodObject<{
|
|
1276
|
+
platform: z.ZodNativeEnum<{
|
|
1277
|
+
readonly IOS: "ios";
|
|
1278
|
+
readonly ANDROID: "android";
|
|
1279
|
+
readonly WEB: "web";
|
|
1280
|
+
}>;
|
|
1281
|
+
driver: z.ZodNativeEnum<{
|
|
1282
|
+
readonly EXPO: "expo";
|
|
1283
|
+
readonly FCM: "fcm";
|
|
1284
|
+
readonly WEBPUSH: "webpush";
|
|
1285
|
+
}>;
|
|
1286
|
+
subscription: z.ZodObject<{
|
|
1287
|
+
endpoint: z.ZodString;
|
|
1288
|
+
keys: z.ZodObject<{
|
|
1289
|
+
p256dh: z.ZodString;
|
|
1290
|
+
auth: z.ZodString;
|
|
1291
|
+
}, "strip", z.ZodTypeAny, {
|
|
1292
|
+
p256dh: string;
|
|
1293
|
+
auth: string;
|
|
1294
|
+
}, {
|
|
1295
|
+
p256dh: string;
|
|
1296
|
+
auth: string;
|
|
1297
|
+
}>;
|
|
1298
|
+
expirationTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1299
|
+
}, "strip", z.ZodTypeAny, {
|
|
1300
|
+
keys: {
|
|
1301
|
+
p256dh: string;
|
|
1302
|
+
auth: string;
|
|
1303
|
+
};
|
|
1304
|
+
endpoint: string;
|
|
1305
|
+
expirationTime?: number | null | undefined;
|
|
1306
|
+
}, {
|
|
1307
|
+
keys: {
|
|
1308
|
+
p256dh: string;
|
|
1309
|
+
auth: string;
|
|
1310
|
+
};
|
|
1311
|
+
endpoint: string;
|
|
1312
|
+
expirationTime?: number | null | undefined;
|
|
1313
|
+
}>;
|
|
1314
|
+
appVersion: z.ZodOptional<z.ZodString>;
|
|
1315
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
1316
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
1317
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1318
|
+
}, "strip", z.ZodTypeAny, {
|
|
1319
|
+
subscription: {
|
|
1320
|
+
keys: {
|
|
1321
|
+
p256dh: string;
|
|
1322
|
+
auth: string;
|
|
1323
|
+
};
|
|
1324
|
+
endpoint: string;
|
|
1325
|
+
expirationTime?: number | null | undefined;
|
|
1326
|
+
};
|
|
1327
|
+
platform: "ios" | "android" | "web";
|
|
1328
|
+
driver: "expo" | "fcm" | "webpush";
|
|
1329
|
+
locale?: string | undefined;
|
|
1330
|
+
appVersion?: string | undefined;
|
|
1331
|
+
timezone?: string | undefined;
|
|
1332
|
+
tags?: string[] | undefined;
|
|
1333
|
+
}, {
|
|
1334
|
+
subscription: {
|
|
1335
|
+
keys: {
|
|
1336
|
+
p256dh: string;
|
|
1337
|
+
auth: string;
|
|
1338
|
+
};
|
|
1339
|
+
endpoint: string;
|
|
1340
|
+
expirationTime?: number | null | undefined;
|
|
1341
|
+
};
|
|
1342
|
+
platform: "ios" | "android" | "web";
|
|
1343
|
+
driver: "expo" | "fcm" | "webpush";
|
|
1344
|
+
locale?: string | undefined;
|
|
1345
|
+
appVersion?: string | undefined;
|
|
1346
|
+
timezone?: string | undefined;
|
|
1347
|
+
tags?: string[] | undefined;
|
|
1348
|
+
}>;
|
|
1349
|
+
type RegisterPushSubscriptionBody = z.infer<typeof registerPushSubscriptionSchema>;
|
|
738
1350
|
|
|
739
1351
|
/**
|
|
740
1352
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
@@ -862,6 +1474,9 @@ declare const NOTIFICATION_ERROR_CODES: {
|
|
|
862
1474
|
readonly THROTTLED: "NOTIFICATION_THROTTLED";
|
|
863
1475
|
readonly CONFIG_MISSING: "NOTIFICATION_CONFIG_MISSING";
|
|
864
1476
|
readonly TEMPLATE_UNKNOWN_VARIABLE: "NOTIFICATION_TEMPLATE_UNKNOWN_VARIABLE";
|
|
1477
|
+
readonly WEBPUSH_ENCRYPTION_FAILED: "NOTIFICATION_WEBPUSH_ENCRYPTION_FAILED";
|
|
1478
|
+
readonly INVALID_VAPID_KEYS: "NOTIFICATION_INVALID_VAPID_KEYS";
|
|
1479
|
+
readonly SUBSCRIPTION_NOT_FOUND: "NOTIFICATION_SUBSCRIPTION_NOT_FOUND";
|
|
865
1480
|
};
|
|
866
1481
|
/** Busca por id, e não por identidade — o painel remove pela linha que listou. */
|
|
867
1482
|
declare class TemplateIdNotFoundError extends NotificationError {
|
|
@@ -941,6 +1556,16 @@ declare class ConfigMissingError extends NotificationError {
|
|
|
941
1556
|
readonly field: string;
|
|
942
1557
|
constructor(field: string);
|
|
943
1558
|
}
|
|
1559
|
+
declare class WebPushEncryptionError extends NotificationError {
|
|
1560
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
1561
|
+
}
|
|
1562
|
+
declare class InvalidVapidKeysError extends NotificationError {
|
|
1563
|
+
constructor(message: string);
|
|
1564
|
+
}
|
|
1565
|
+
declare class SubscriptionNotFoundError extends NotificationError {
|
|
1566
|
+
readonly endpoint: string;
|
|
1567
|
+
constructor(endpoint: string);
|
|
1568
|
+
}
|
|
944
1569
|
|
|
945
1570
|
/**
|
|
946
1571
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
@@ -1276,4 +1901,56 @@ declare function renderStandardEmail(params: {
|
|
|
1276
1901
|
readonly template: StandardEmailTemplate;
|
|
1277
1902
|
}): RenderedStandardEmail;
|
|
1278
1903
|
|
|
1279
|
-
|
|
1904
|
+
/**
|
|
1905
|
+
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
1906
|
+
*/
|
|
1907
|
+
type NotificationCalendarEvent = {
|
|
1908
|
+
readonly title: string;
|
|
1909
|
+
readonly description?: string;
|
|
1910
|
+
readonly startsAt: string | Date;
|
|
1911
|
+
readonly endsAt?: string | Date;
|
|
1912
|
+
readonly location?: string;
|
|
1913
|
+
readonly url?: string;
|
|
1914
|
+
};
|
|
1915
|
+
/**
|
|
1916
|
+
* Gera URL para adicionar evento no Google Calendar via web.
|
|
1917
|
+
*/
|
|
1918
|
+
declare function generateGoogleCalendarUrl(event: NotificationCalendarEvent): string;
|
|
1919
|
+
/**
|
|
1920
|
+
* Gera URL para adicionar evento no Outlook Web / Live.
|
|
1921
|
+
*/
|
|
1922
|
+
declare function generateOutlookCalendarUrl(event: NotificationCalendarEvent): string;
|
|
1923
|
+
/**
|
|
1924
|
+
* Gera URL para adicionar evento no Microsoft 365 / Office 365 corporativo.
|
|
1925
|
+
*/
|
|
1926
|
+
declare function generateOffice365CalendarUrl(event: NotificationCalendarEvent): string;
|
|
1927
|
+
/**
|
|
1928
|
+
* Gera URL para adicionar evento no Yahoo Calendar.
|
|
1929
|
+
*/
|
|
1930
|
+
declare function generateYahooCalendarUrl(event: NotificationCalendarEvent): string;
|
|
1931
|
+
/**
|
|
1932
|
+
* Gera Data URI com o conteúdo iCalendar (.ics).
|
|
1933
|
+
* Permite abrir diretamente no Apple Calendar (iOS / macOS) ou disparar download no navegador.
|
|
1934
|
+
*/
|
|
1935
|
+
declare function generateIcsDataUri(event: NotificationCalendarEvent, now?: Date): string;
|
|
1936
|
+
type CalendarLinks = {
|
|
1937
|
+
readonly google: string;
|
|
1938
|
+
readonly outlook: string;
|
|
1939
|
+
readonly office365: string;
|
|
1940
|
+
readonly yahoo: string;
|
|
1941
|
+
readonly icsDataUri: string;
|
|
1942
|
+
};
|
|
1943
|
+
/**
|
|
1944
|
+
* Retorna todos os links de calendário disponíveis para uma notificação/evento.
|
|
1945
|
+
*/
|
|
1946
|
+
declare function generateCalendarLinks(event: NotificationCalendarEvent): CalendarLinks;
|
|
1947
|
+
/**
|
|
1948
|
+
* Gera conteúdo RFC 5545 iCalendar (.ics).
|
|
1949
|
+
*/
|
|
1950
|
+
declare function generateIcsContent(event: NotificationCalendarEvent, now?: Date): string;
|
|
1951
|
+
/**
|
|
1952
|
+
* Extrai metadados de evento de calendário do payload de notificação, se presente.
|
|
1953
|
+
*/
|
|
1954
|
+
declare function extractCalendarEvent(payload?: Readonly<Record<string, unknown>>): NotificationCalendarEvent | undefined;
|
|
1955
|
+
|
|
1956
|
+
export { type BroadcastPushBody, type BroadcastPushFilter, type BroadcastPushFilterBody, type BroadcastPushParams, type BroadcastPushResult, type CachePort, type CalendarLinks, type ChannelDrivers, ChannelNotConfiguredError, type ClockPort, type CompanyId, ConfigMissingError, DELIVERY_STATUS, DEVICE_PLATFORM, type DeliveryAttemptResult, type DeliveryBouncedEvent, type DeliveryFailedEvent, type DeliveryReceipt, type DeliverySentEvent, type DeliveryStatus, type DeliverySummary, type DeliveryWebhookBody, type DeviceInvalidatedEvent, DeviceNotFoundError, type DevicePlatform, type DeviceRegisteredEvent, type DeviceRegistration, type DiffTemplateVariablesParams, DuplicateWebhookDeliveryError, EMAIL_ATTACHMENT_MAX_BYTES, EMAIL_ATTACHMENT_MAX_COUNT, EMAIL_DRIVER, type EmailAttachment, type EmailDriver, type EmailDriverPort, type EmailLogo, INTRUSIVE_CHANNELS, type InterpolateEmailHtmlParams, InvalidVapidKeysError, InvalidWebhookSignatureError, type ListNotificationsParams, type ListNotificationsQuery, type ListNotificationsResult, type LogMeta, type LoggerPort, type MetricsPort, NOTIFICATION_CATEGORY_HINT, NOTIFICATION_CHANNEL, NOTIFICATION_ERROR_CODES, NOTIFICATION_EVENT, NOTIFICATION_STATUS, type NotificationCalendarEvent, type NotificationCategoryPolicy, type NotificationChannel, type NotificationCreatedEvent, type NotificationDispatchedEvent, NotificationError, type NotificationEvent, type NotificationHooks, type NotificationId, type NotificationJob, NotificationNotFoundError, type NotificationPreference, type NotificationReadEvent, type NotificationStatus, type NotificationSummary, type NotificationTemplate, PREVIEW_VIEWPORT, PREVIEW_VIEWPORT_BY_CHANNEL, PUSH_DRIVER, type PreferencesUpdatedEvent, type PreviewViewport, type PreviewViewportSpec, type PushDriver, type PushDriverPort, type PushNotificationPayload, type PushNotificationPayloadBody, type PushServiceContainerConfig, type PushServicePort, type PushSubscriptionRecord, type QueuePort, type RealtimeEvent, type RealtimeNotifierPort, type RealtimeSubscription, type RecipientResolverPort, RecipientUnresolvedError, type RegisterDeviceBody, type RegisterPushSubscriptionBody, type RegisterPushSubscriptionParams, type RenderTemplateParams, type RenderedStandardEmail, type RenderedTemplate, type RenderedTemplatePreview, type ResolvedRecipient, STANDARD_EMAIL_BUILTIN_TEMPLATE, STANDARD_EMAIL_CHANNEL, STANDARD_EMAIL_HTML_MAX_BYTES, STANDARD_EMAIL_LOCALE, STANDARD_EMAIL_REQUIRED_VARIABLES, STANDARD_EMAIL_SYSTEM_HTML_VARIABLES, STANDARD_EMAIL_TEMPLATE_KEY, STANDARD_EMAIL_THEME, STANDARD_EMAIL_VARIABLES, SUPPRESSION_REASON, type SendEmailParams, type SendNotificationBody, type SendNotificationParams, type SendNotificationResult, type SendPushDirectBody, type SendPushDirectParams, type SendPushDirectResult, type SendPushDirectTarget, type SendPushDirectTargetBody, type SendPushParams, type SendSmsParams, type SendWhatsAppParams, type SendWhatsAppTemplateParams, type SmsDriverPort, type StandardEmailAssessment, type StandardEmailInput, type StandardEmailSystemHtmlVariable, type StandardEmailTemplate, SubscriptionNotFoundError, SuppressedTargetError, type SuppressionReason, TEMPLATE_CONSTRAINTS_BY_CHANNEL, TEMPLATE_VARIABLE_KIND, type TemplateConstraintCheck, type TemplateConstraintField, type TemplateConstraintLimits, TemplateIdNotFoundError, TemplateNotFoundError, type TemplateRendererPort, type TemplateVariableCatalog, type TemplateVariableDefinition, type TemplateVariableDiff, type TemplateVariableKind, ThrottledError, UnknownTemplateVariablesError, type UnsafeEmailHtmlRule, type UpdateCategoryPoliciesBody, type UpdatePreferencesBody, type UpsertTemplateBody, type UserId, type VapidKeys, WebPushEncryptionError, type WebPushKeys, type WebPushKeysBody, type WebPushSubscription, type WebPushSubscriptionBody, type WhatsAppDriverPort, type WhatsAppSendingChannel, assessStandardEmailTemplate, broadcastPushFilterSchema, broadcastPushSchema, buildInitials, buildPreviewPayload, categoryPolicyEntrySchema, checkEmailAttachment, createWhatsAppDriverFromChannel, deliveryWebhookSchema, deriveTitleFromBody, diffTemplateVariables, escapeEmailHtml, escapeTemplateHtml, extractCalendarEvent, extractTemplatePlaceholders, findUnsafeEmailHtml, generateCalendarLinks, generateGoogleCalendarUrl, generateIcsContent, generateIcsDataUri, generateOffice365CalendarUrl, generateOutlookCalendarUrl, generateYahooCalendarUrl, htmlToPlainText, interpolateEmailHtml, interpolateTemplate, listNotificationsQuerySchema, preferenceEntrySchema, pushNotificationPayloadSchema, registerDeviceSchema, registerPushSubscriptionSchema, renderEmailLogoHtml, renderEmailMarksHtml, renderStandardEmail, renderTemplate, sendNotificationSchema, sendPushDirectSchema, sendPushDirectTargetSchema, updateCategoryPoliciesSchema, updatePreferencesSchema, upsertTemplateSchema, webPushKeysSchema, webPushSubscriptionSchema };
|