react-native-notify-kit 10.4.7 → 10.4.9

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.
Files changed (46) hide show
  1. package/README.md +4 -0
  2. package/android/src/main/kotlin/io/invertase/notifee/NotifeeReactUtils.kt +679 -7
  3. package/android/src/test/java/io/invertase/notifee/NotifeeReactUtilsPendingEventsTest.java +1025 -0
  4. package/dist/NotifeeApiModule.d.ts +7 -2
  5. package/dist/NotifeeApiModule.js +34 -15
  6. package/dist/NotifeeApiModule.js.map +1 -1
  7. package/dist/fcm/reconstructNotification.js +3 -2
  8. package/dist/fcm/reconstructNotification.js.map +1 -1
  9. package/dist/fcm/types.d.ts +5 -4
  10. package/dist/types/Module.d.ts +11 -2
  11. package/dist/version.d.ts +1 -1
  12. package/dist/version.js +1 -1
  13. package/package.json +1 -1
  14. package/src/NotifeeApiModule.ts +44 -17
  15. package/src/fcm/reconstructNotification.ts +5 -3
  16. package/src/fcm/types.ts +5 -4
  17. package/src/types/Module.ts +12 -2
  18. package/src/version.ts +1 -1
  19. package/server/dist/android.d.ts +0 -8
  20. package/server/dist/android.d.ts.map +0 -1
  21. package/server/dist/android.js +0 -20
  22. package/server/dist/android.js.map +0 -1
  23. package/server/dist/buildPayload.d.ts +0 -3
  24. package/server/dist/buildPayload.d.ts.map +0 -1
  25. package/server/dist/buildPayload.js +0 -82
  26. package/server/dist/buildPayload.js.map +0 -1
  27. package/server/dist/index.d.ts +0 -6
  28. package/server/dist/index.d.ts.map +0 -1
  29. package/server/dist/index.js +0 -12
  30. package/server/dist/index.js.map +0 -1
  31. package/server/dist/ios.d.ts +0 -11
  32. package/server/dist/ios.d.ts.map +0 -1
  33. package/server/dist/ios.js +0 -61
  34. package/server/dist/ios.js.map +0 -1
  35. package/server/dist/serialize.d.ts +0 -11
  36. package/server/dist/serialize.d.ts.map +0 -1
  37. package/server/dist/serialize.js +0 -32
  38. package/server/dist/serialize.js.map +0 -1
  39. package/server/dist/types.d.ts +0 -2
  40. package/server/dist/types.d.ts.map +0 -1
  41. package/server/dist/types.js +0 -3
  42. package/server/dist/types.js.map +0 -1
  43. package/server/dist/validation.d.ts +0 -3
  44. package/server/dist/validation.d.ts.map +0 -1
  45. package/server/dist/validation.js +0 -101
  46. package/server/dist/validation.js.map +0 -1
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildNotifyKitPayload = buildNotifyKitPayload;
4
- const android_1 = require("./android");
5
- const ios_1 = require("./ios");
6
- const serialize_1 = require("./serialize");
7
- const validation_1 = require("./validation");
8
- const SIZE_WARN_THRESHOLD_BYTES = 3500;
9
- const PREFIX = '[react-native-notify-kit/server]';
10
- function buildNotifyKitPayload(input) {
11
- (0, validation_1.validateInput)(input);
12
- const { notification } = input;
13
- const options = input.options ?? {};
14
- const collapseKey = options.collapseKey ?? notification.id ?? undefined;
15
- let expiration;
16
- if (options.ttl !== undefined) {
17
- expiration = String(Math.floor(Date.now() / 1000) + options.ttl);
18
- }
19
- const notifeeOptions = (0, serialize_1.serializeNotifeeOptions)({
20
- title: notification.title,
21
- body: notification.body,
22
- ...(notification.android !== undefined ? { android: notification.android } : {}),
23
- ...(notification.ios !== undefined ? { ios: notification.ios } : {}),
24
- });
25
- const notifeeData = (0, serialize_1.serializeData)(notification.data);
26
- // Android path: top-level `data` carries `notification.data` keys verbatim
27
- // plus `notifee_options`. `notifee_data` is intentionally NOT duplicated here —
28
- // the client can read the original keys directly from `data`. iOS NSE still
29
- // receives `notifee_data` inside `apns.payload` because APNs does not expose
30
- // arbitrary top-level keys to the extension.
31
- const data = {
32
- ...(notification.data ?? {}),
33
- notifee_options: notifeeOptions,
34
- };
35
- const android = (0, android_1.buildAndroidPayload)(input, {
36
- ...(collapseKey !== undefined ? { collapseKey } : {}),
37
- ...(options.ttl !== undefined ? { ttlSeconds: options.ttl } : {}),
38
- });
39
- const apns = (0, ios_1.buildIosApnsPayload)(input, {
40
- notifeeOptions,
41
- ...(notifeeData !== undefined ? { notifeeData } : {}),
42
- ...(collapseKey !== undefined ? { collapseKey } : {}),
43
- ...(expiration !== undefined ? { expiration } : {}),
44
- });
45
- // Build the FCM-bound payload first (without sizeBytes — that's metadata for
46
- // the caller, not part of the wire format).
47
- const fcmPayload = {
48
- data,
49
- android,
50
- apns,
51
- };
52
- if (input.token !== undefined) {
53
- fcmPayload.token = input.token;
54
- }
55
- else if (input.topic !== undefined) {
56
- fcmPayload.topic = input.topic;
57
- }
58
- else if (input.condition !== undefined) {
59
- fcmPayload.condition = input.condition;
60
- }
61
- // FCM's 4 KB limit is measured in UTF-8 bytes, not JS code units, so emoji
62
- // and non-ASCII characters consume more than one byte each. Deviation from
63
- // the spec's literal `JSON.stringify(output).length` to avoid underestimating
64
- // payload size under such characters. sizeBytes measures the FCM-relevant
65
- // fields only (excludes the sizeBytes field itself).
66
- const sizeBytes = Buffer.byteLength(JSON.stringify(fcmPayload), 'utf8');
67
- if (sizeBytes > SIZE_WARN_THRESHOLD_BYTES) {
68
- console.warn(`${PREFIX} Payload size ${sizeBytes} bytes approaches FCM 4KB limit. Consider reducing notifee_options.`);
69
- }
70
- // Attach sizeBytes as non-enumerable so JSON.stringify and object spread
71
- // never include it — consumers can safely pass the output directly to
72
- // admin.messaging().send() without stripping metadata fields.
73
- const output = { ...fcmPayload };
74
- Object.defineProperty(output, 'sizeBytes', {
75
- value: sizeBytes,
76
- enumerable: false,
77
- writable: false,
78
- configurable: false,
79
- });
80
- return output;
81
- }
82
- //# sourceMappingURL=buildPayload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildPayload.js","sourceRoot":"","sources":["../src/buildPayload.ts"],"names":[],"mappings":";;AASA,sDAiFC;AA1FD,uCAAgD;AAChD,+BAA4C;AAC5C,2CAAqE;AAErE,6CAA6C;AAE7C,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,MAAM,GAAG,kCAAkC,CAAC;AAElD,SAAgB,qBAAqB,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CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;IACxE,IAAI,SAAS,GAAG,yBAAyB,EAAE,CAAC;QAC1C,OAAO,CAAC,IAAI,CACV,GAAG,MAAM,iBAAiB,SAAS,qEAAqE,CACzG,CAAC;IACJ,CAAC;IAED,yEAAyE;IACzE,sEAAsE;IACtE,8DAA8D;IAC9D,MAAM,MAAM,GAAG,EAAE,GAAG,UAAU,EAA4B,CAAC;IAC3D,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE;QACzC,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,6 +0,0 @@
1
- export { buildNotifyKitPayload } from './buildPayload';
2
- export { buildIosApnsPayload } from './ios';
3
- export { buildAndroidPayload } from './android';
4
- export { serializeNotifeeOptions } from './serialize';
5
- export type { NotifyKitPayloadInput, NotifyKitPayloadOutput, NotifyKitNotification, NotifyKitOptions, NotifyKitAndroidConfig, NotifyKitIosConfig, } from './types';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeNotifeeOptions = exports.buildAndroidPayload = exports.buildIosApnsPayload = exports.buildNotifyKitPayload = void 0;
4
- var buildPayload_1 = require("./buildPayload");
5
- Object.defineProperty(exports, "buildNotifyKitPayload", { enumerable: true, get: function () { return buildPayload_1.buildNotifyKitPayload; } });
6
- var ios_1 = require("./ios");
7
- Object.defineProperty(exports, "buildIosApnsPayload", { enumerable: true, get: function () { return ios_1.buildIosApnsPayload; } });
8
- var android_1 = require("./android");
9
- Object.defineProperty(exports, "buildAndroidPayload", { enumerable: true, get: function () { return android_1.buildAndroidPayload; } });
10
- var serialize_1 = require("./serialize");
11
- Object.defineProperty(exports, "serializeNotifeeOptions", { enumerable: true, get: function () { return serialize_1.serializeNotifeeOptions; } });
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AAA9C,qHAAA,qBAAqB,OAAA;AAC9B,6BAA4C;AAAnC,0GAAA,mBAAmB,OAAA;AAC5B,qCAAgD;AAAvC,8GAAA,mBAAmB,OAAA;AAC5B,yCAAsD;AAA7C,oHAAA,uBAAuB,OAAA"}
@@ -1,11 +0,0 @@
1
- import type { ApnsInterruptionLevel, NotifyKitApnsOutput, NotifyKitIosInterruptionLevel, NotifyKitPayloadInput } from './types';
2
- export declare function toApnsInterruptionLevel(level: NotifyKitIosInterruptionLevel): ApnsInterruptionLevel;
3
- type BuildIosContext = {
4
- notifeeOptions: string;
5
- notifeeData?: string;
6
- collapseKey?: string;
7
- expiration?: string;
8
- };
9
- export declare function buildIosApnsPayload(input: NotifyKitPayloadInput, context: BuildIosContext): NotifyKitApnsOutput;
10
- export {};
11
- //# sourceMappingURL=ios.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../src/ios.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAGrB,mBAAmB,EACnB,6BAA6B,EAG7B,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAWjB,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,6BAA6B,GACnC,qBAAqB,CAQvB;AAED,KAAK,eAAe,GAAG;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,qBAAqB,EAC5B,OAAO,EAAE,eAAe,GACvB,mBAAmB,CA6CrB"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toApnsInterruptionLevel = toApnsInterruptionLevel;
4
- exports.buildIosApnsPayload = buildIosApnsPayload;
5
- const INTERRUPTION_LEVEL_MAP = {
6
- passive: 'passive',
7
- active: 'active',
8
- timeSensitive: 'time-sensitive',
9
- critical: 'critical',
10
- };
11
- const PREFIX = '[react-native-notify-kit/server]';
12
- function toApnsInterruptionLevel(level) {
13
- const mapped = INTERRUPTION_LEVEL_MAP[level];
14
- if (mapped === undefined) {
15
- throw new Error(`${PREFIX} Validation: invalid interruptionLevel '${String(level)}'. Expected one of: passive, active, timeSensitive, critical`);
16
- }
17
- return mapped;
18
- }
19
- function buildIosApnsPayload(input, context) {
20
- const notification = input.notification;
21
- const options = input.options ?? {};
22
- const ios = notification.ios;
23
- const headers = {
24
- 'apns-push-type': 'alert',
25
- 'apns-priority': '10',
26
- };
27
- if (context.collapseKey !== undefined) {
28
- headers['apns-collapse-id'] = context.collapseKey;
29
- }
30
- if (context.expiration !== undefined) {
31
- headers['apns-expiration'] = context.expiration;
32
- }
33
- const aps = {
34
- alert: { title: notification.title, body: notification.body },
35
- 'mutable-content': 1,
36
- };
37
- if (ios?.sound !== undefined) {
38
- aps.sound = ios.sound;
39
- }
40
- if (ios?.categoryId !== undefined) {
41
- aps.category = ios.categoryId;
42
- }
43
- if (ios?.threadId !== undefined) {
44
- aps['thread-id'] = ios.threadId;
45
- }
46
- if (ios?.interruptionLevel !== undefined) {
47
- aps['interruption-level'] = toApnsInterruptionLevel(ios.interruptionLevel);
48
- }
49
- if (options.iosBadgeCount !== undefined) {
50
- aps.badge = options.iosBadgeCount;
51
- }
52
- const payload = {
53
- aps,
54
- notifee_options: context.notifeeOptions,
55
- };
56
- if (context.notifeeData !== undefined) {
57
- payload.notifee_data = context.notifeeData;
58
- }
59
- return { headers, payload };
60
- }
61
- //# sourceMappingURL=ios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ios.js","sourceRoot":"","sources":["../src/ios.ts"],"names":[],"mappings":";;AAoBA,0DAUC;AASD,kDAgDC;AA5ED,MAAM,sBAAsB,GAAiE;IAC3F,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,gBAAgB;IAC/B,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,MAAM,MAAM,GAAG,kCAAkC,CAAC;AAElD,SAAgB,uBAAuB,CACrC,KAAoC;IAEpC,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAsC,CAAC,CAAC;IAC9E,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,2CAA2C,MAAM,CAAC,KAAK,CAAC,8DAA8D,CAChI,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AASD,SAAgB,mBAAmB,CACjC,KAA4B,EAC5B,OAAwB;IAExB,MAAM,YAAY,GAA0B,KAAK,CAAC,YAAY,CAAC;IAC/D,MAAM,OAAO,GAAqB,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;IACtD,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC;IAE7B,MAAM,OAAO,GAAyB;QACpC,gBAAgB,EAAE,OAAO;QACzB,eAAe,EAAE,IAAI;KACtB,CAAC;IACF,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WAAW,CAAC;IAC7C,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { NotifyKitAndroidConfig, NotifyKitIosConfig } from './types';
2
- type SerializeInput = {
3
- title: string;
4
- body: string;
5
- android?: NotifyKitAndroidConfig;
6
- ios?: NotifyKitIosConfig;
7
- };
8
- export declare function serializeNotifeeOptions(input: SerializeInput): string;
9
- export declare function serializeData(data?: Record<string, string>): string | undefined;
10
- export {};
11
- //# sourceMappingURL=serialize.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAA4B,MAAM,SAAS,CAAC;AAEpG,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,GAAG,CAAC,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAIF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAgBrE;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAS/E"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeNotifeeOptions = serializeNotifeeOptions;
4
- exports.serializeData = serializeData;
5
- const PREFIX = '[react-native-notify-kit/server]';
6
- function serializeNotifeeOptions(input) {
7
- const payload = { _v: 1, title: input.title, body: input.body };
8
- if (input.android !== undefined) {
9
- payload.android = input.android;
10
- }
11
- if (input.ios !== undefined) {
12
- payload.ios = input.ios;
13
- }
14
- try {
15
- return JSON.stringify(payload);
16
- }
17
- catch (e) {
18
- const detail = e instanceof Error ? `: ${e.message}` : `: ${String(e)}`;
19
- throw new Error(`${PREFIX} Serialization: notifee_options contains circular references or non-serializable values. Check for circular object references in android/ios config${detail}`);
20
- }
21
- }
22
- function serializeData(data) {
23
- if (!data) {
24
- return undefined;
25
- }
26
- const keys = Object.keys(data);
27
- if (keys.length === 0) {
28
- return undefined;
29
- }
30
- return JSON.stringify(data);
31
- }
32
- //# sourceMappingURL=serialize.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialize.js","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":";;AAWA,0DAgBC;AAED,sCASC;AA7BD,MAAM,MAAM,GAAG,kCAAkC,CAAC;AAElD,SAAgB,uBAAuB,CAAC,KAAqB;IAC3D,MAAM,OAAO,GAA6B,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1F,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAClC,CAAC;IACD,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IAC1B,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,sJAAsJ,MAAM,EAAE,CACxK,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAgB,aAAa,CAAC,IAA6B;IACzD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
@@ -1,2 +0,0 @@
1
- export type { NotifyKitPressAction, NotifyKitAndroidAction, NotifyKitAndroidStyle, NotifyKitAndroidConfig, NotifyKitIosAttachment, NotifyKitIosInterruptionLevel, NotifyKitIosConfig, NotifyKitNotification, NotifyKitOptions, NotifyKitPayloadInput, ApnsInterruptionLevel, NotifyKitAndroidOutput, NotifyKitApnsAps, NotifyKitApnsHeaders, NotifyKitApnsPayload, NotifyKitApnsOutput, NotifyKitPayloadOutput, SerializedNotifeeOptions, } from '../../src/internal/fcmContract';
2
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,gCAAgC,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import type { NotifyKitPayloadInput } from './types';
2
- export declare function validateInput(input: NotifyKitPayloadInput): void;
3
- //# sourceMappingURL=validation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAarD,wBAAgB,aAAa,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAwHhE"}
@@ -1,101 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateInput = validateInput;
4
- const PREFIX = '[react-native-notify-kit/server]';
5
- const RESERVED_DATA_KEYS = ['notifee_options', 'notifee_data'];
6
- function err(category, message) {
7
- return new Error(`${PREFIX} ${category}: ${message}`);
8
- }
9
- function isNonEmptyString(value) {
10
- return typeof value === 'string' && value.length > 0;
11
- }
12
- function validateInput(input) {
13
- if (input === null || typeof input !== 'object') {
14
- throw err('Validation', 'input must be an object');
15
- }
16
- const routingCount = (input.token !== undefined ? 1 : 0) +
17
- (input.topic !== undefined ? 1 : 0) +
18
- (input.condition !== undefined ? 1 : 0);
19
- if (routingCount !== 1) {
20
- throw err('Routing', `exactly one of 'token', 'topic', or 'condition' must be provided. Got: ${routingCount}`);
21
- }
22
- if (input.token !== undefined && !isNonEmptyString(input.token)) {
23
- throw err('Routing', "'token' must be a non-empty string");
24
- }
25
- if (input.topic !== undefined && !isNonEmptyString(input.topic)) {
26
- throw err('Routing', "'topic' must be a non-empty string");
27
- }
28
- if (input.condition !== undefined && !isNonEmptyString(input.condition)) {
29
- throw err('Routing', "'condition' must be a non-empty string");
30
- }
31
- const { notification } = input;
32
- if (notification === null || typeof notification !== 'object') {
33
- throw err('Validation', "'notification' is required and must be an object");
34
- }
35
- if (notification.id !== undefined && !isNonEmptyString(notification.id)) {
36
- throw err('Validation', 'notification.id must be a non-empty string when provided');
37
- }
38
- if (!isNonEmptyString(notification.title)) {
39
- throw err('Validation', 'notification.title is required and must be a non-empty string');
40
- }
41
- if (!isNonEmptyString(notification.body)) {
42
- throw err('Validation', 'notification.body is required and must be a non-empty string');
43
- }
44
- if (notification.data !== undefined) {
45
- if (notification.data === null || typeof notification.data !== 'object') {
46
- throw err('Validation', "'notification.data' must be an object");
47
- }
48
- for (const reserved of RESERVED_DATA_KEYS) {
49
- if (Object.prototype.hasOwnProperty.call(notification.data, reserved)) {
50
- throw err('Validation', "'notifee_options' and 'notifee_data' are reserved keys and cannot be used in notification.data");
51
- }
52
- }
53
- for (const [key, value] of Object.entries(notification.data)) {
54
- if (typeof value !== 'string') {
55
- throw err('Validation', `FCM data values must be strings. Got ${typeof value} for key '${key}'. Use JSON.stringify() if you need to pass complex values.`);
56
- }
57
- }
58
- }
59
- const attachments = notification.ios?.attachments;
60
- if (attachments !== undefined) {
61
- if (!Array.isArray(attachments)) {
62
- throw err('iOS', "'notification.ios.attachments' must be an array");
63
- }
64
- for (const attachment of attachments) {
65
- if (attachment === null ||
66
- typeof attachment !== 'object' ||
67
- typeof attachment.url !== 'string') {
68
- throw err('iOS', "each attachment must be an object with a string 'url' field");
69
- }
70
- if (!attachment.url.startsWith('https://')) {
71
- throw err('iOS', `iOS attachments require https:// URLs. Got: ${attachment.url}`);
72
- }
73
- }
74
- }
75
- if (input.options !== undefined) {
76
- const { options } = input;
77
- if (options === null || typeof options !== 'object') {
78
- throw err('Validation', "'options' must be an object");
79
- }
80
- if (options.androidPriority !== undefined &&
81
- options.androidPriority !== 'high' &&
82
- options.androidPriority !== 'normal') {
83
- throw err('Validation', `'options.androidPriority' must be 'high' or 'normal'. Got: ${String(options.androidPriority)}`);
84
- }
85
- if (options.iosBadgeCount !== undefined &&
86
- (typeof options.iosBadgeCount !== 'number' ||
87
- !Number.isFinite(options.iosBadgeCount) ||
88
- options.iosBadgeCount < 0 ||
89
- !Number.isInteger(options.iosBadgeCount))) {
90
- throw err('Validation', "'options.iosBadgeCount' must be a non-negative integer");
91
- }
92
- if (options.ttl !== undefined &&
93
- (typeof options.ttl !== 'number' || !Number.isInteger(options.ttl) || options.ttl <= 0)) {
94
- throw err('Validation', `options.ttl must be a positive integer (seconds). Got: ${String(options.ttl)}`);
95
- }
96
- if (options.collapseKey !== undefined && !isNonEmptyString(options.collapseKey)) {
97
- throw err('Validation', "'options.collapseKey' must be a non-empty string");
98
- }
99
- }
100
- }
101
- //# sourceMappingURL=validation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":";;AAaA,sCAwHC;AAnID,MAAM,MAAM,GAAG,kCAAkC,CAAC;AAClD,MAAM,kBAAkB,GAAG,CAAC,iBAAiB,EAAE,cAAc,CAAU,CAAC;AAExE,SAAS,GAAG,CAAC,QAAgB,EAAE,OAAe;IAC5C,OAAO,IAAI,KAAK,CAAC,GAAG,MAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,SAAgB,aAAa,CAAC,KAA4B;IACxD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,GAAG,CAAC,YAAY,EAAE,yBAAyB,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,YAAY,GAChB,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1C,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,GAA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