@bopen-io/messagebox-server 1.2.2 → 1.2.3
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/out/knexfile.js +25 -0
- package/out/knexfile.js.map +1 -0
- package/out/src/__tests/compose.test.js +25 -0
- package/out/src/__tests/compose.test.js.map +1 -0
- package/out/src/app.js +162 -0
- package/out/src/app.js.map +1 -0
- package/out/src/compose.js +239 -0
- package/out/src/compose.js.map +1 -0
- package/out/src/config/firebase.js +150 -0
- package/out/src/config/firebase.js.map +1 -0
- package/out/src/context.js +23 -0
- package/out/src/context.js.map +1 -0
- package/out/src/index.js +311 -0
- package/out/src/index.js.map +1 -0
- package/out/src/migrations/2022-12-28-001-initial-migration.js +28 -0
- package/out/src/migrations/2022-12-28-001-initial-migration.js.map +1 -0
- package/out/src/migrations/2023-01-17-messages-update.js +11 -0
- package/out/src/migrations/2023-01-17-messages-update.js.map +1 -0
- package/out/src/migrations/2024-03-05-001-messageID-upgrade.js +21 -0
- package/out/src/migrations/2024-03-05-001-messageID-upgrade.js.map +1 -0
- package/out/src/migrations/2025-01-31-001-notification-permissions.js +59 -0
- package/out/src/migrations/2025-01-31-001-notification-permissions.js.map +1 -0
- package/out/src/migrations/2025-01-31-002-device-registrations.js +24 -0
- package/out/src/migrations/2025-01-31-002-device-registrations.js.map +1 -0
- package/out/src/routes/__tests/acknowledgeMessage.test.js +135 -0
- package/out/src/routes/__tests/acknowledgeMessage.test.js.map +1 -0
- package/out/src/routes/__tests/listMessages.test.js +217 -0
- package/out/src/routes/__tests/listMessages.test.js.map +1 -0
- package/out/src/routes/__tests/sendMessage.test.js +313 -0
- package/out/src/routes/__tests/sendMessage.test.js.map +1 -0
- package/out/src/routes/acknowledgeMessage.js +133 -0
- package/out/src/routes/acknowledgeMessage.js.map +1 -0
- package/out/src/routes/index.js +17 -0
- package/out/src/routes/index.js.map +1 -0
- package/out/src/routes/listDevices.js +63 -0
- package/out/src/routes/listDevices.js.map +1 -0
- package/out/src/routes/listMessages.js +176 -0
- package/out/src/routes/listMessages.js.map +1 -0
- package/out/src/routes/permissions/getPermission.js +138 -0
- package/out/src/routes/permissions/getPermission.js.map +1 -0
- package/out/src/routes/permissions/getQuote.js +165 -0
- package/out/src/routes/permissions/getQuote.js.map +1 -0
- package/out/src/routes/permissions/index.js +12 -0
- package/out/src/routes/permissions/index.js.map +1 -0
- package/out/src/routes/permissions/listPermissions.js +179 -0
- package/out/src/routes/permissions/listPermissions.js.map +1 -0
- package/out/src/routes/permissions/setPermission.js +137 -0
- package/out/src/routes/permissions/setPermission.js.map +1 -0
- package/out/src/routes/registerDevice.js +139 -0
- package/out/src/routes/registerDevice.js.map +1 -0
- package/out/src/routes/sendMessage.js +438 -0
- package/out/src/routes/sendMessage.js.map +1 -0
- package/out/src/runtimeDeps.js +15 -0
- package/out/src/runtimeDeps.js.map +1 -0
- package/out/src/swagger.js +48 -0
- package/out/src/swagger.js.map +1 -0
- package/out/src/telemetry.js +134 -0
- package/out/src/telemetry.js.map +1 -0
- package/out/src/types/messagePermissions.js +2 -0
- package/out/src/types/messagePermissions.js.map +1 -0
- package/out/src/types/notifications.js +2 -0
- package/out/src/types/notifications.js.map +1 -0
- package/out/src/utils/logger.js +85 -0
- package/out/src/utils/logger.js.map +1 -0
- package/out/src/utils/messagePermissions.js +115 -0
- package/out/src/utils/messagePermissions.js.map +1 -0
- package/out/src/utils/sendFCMNotification.js +110 -0
- package/out/src/utils/sendFCMNotification.js.map +1 -0
- package/out/tsconfig.tsbuildinfo +1 -0
- package/out/types/jest.config.d.ts +4 -0
- package/out/types/jest.config.d.ts.map +1 -0
- package/out/types/jest.config.integration.d.ts +5 -0
- package/out/types/jest.config.integration.d.ts.map +1 -0
- package/out/types/knexfile.d.ts +6 -0
- package/out/types/knexfile.d.ts.map +1 -0
- package/out/types/src/__tests/compose.test.d.ts +2 -0
- package/out/types/src/__tests/compose.test.d.ts.map +1 -0
- package/out/types/src/app.d.ts +63 -0
- package/out/types/src/app.d.ts.map +1 -0
- package/out/types/src/compose.d.ts +22 -0
- package/out/types/src/compose.d.ts.map +1 -0
- package/out/types/src/config/firebase.d.ts +34 -0
- package/out/types/src/config/firebase.d.ts.map +1 -0
- package/out/types/src/context.d.ts +23 -0
- package/out/types/src/context.d.ts.map +1 -0
- package/out/types/src/index.d.ts +43 -0
- package/out/types/src/index.d.ts.map +1 -0
- package/out/types/src/migrations/2022-12-28-001-initial-migration.d.ts +4 -0
- package/out/types/src/migrations/2022-12-28-001-initial-migration.d.ts.map +1 -0
- package/out/types/src/migrations/2023-01-17-messages-update.d.ts +4 -0
- package/out/types/src/migrations/2023-01-17-messages-update.d.ts.map +1 -0
- package/out/types/src/migrations/2024-03-05-001-messageID-upgrade.d.ts +4 -0
- package/out/types/src/migrations/2024-03-05-001-messageID-upgrade.d.ts.map +1 -0
- package/out/types/src/migrations/2025-01-31-001-notification-permissions.d.ts +4 -0
- package/out/types/src/migrations/2025-01-31-001-notification-permissions.d.ts.map +1 -0
- package/out/types/src/migrations/2025-01-31-002-device-registrations.d.ts +4 -0
- package/out/types/src/migrations/2025-01-31-002-device-registrations.d.ts.map +1 -0
- package/out/types/src/routes/__tests/acknowledgeMessage.test.d.ts +2 -0
- package/out/types/src/routes/__tests/acknowledgeMessage.test.d.ts.map +1 -0
- package/out/types/src/routes/__tests/listMessages.test.d.ts +2 -0
- package/out/types/src/routes/__tests/listMessages.test.d.ts.map +1 -0
- package/out/types/src/routes/__tests/sendMessage.test.d.ts +2 -0
- package/out/types/src/routes/__tests/sendMessage.test.d.ts.map +1 -0
- package/out/types/src/routes/acknowledgeMessage.d.ts +100 -0
- package/out/types/src/routes/acknowledgeMessage.d.ts.map +1 -0
- package/out/types/src/routes/index.d.ts +11 -0
- package/out/types/src/routes/index.d.ts.map +1 -0
- package/out/types/src/routes/listDevices.d.ts +19 -0
- package/out/types/src/routes/listDevices.d.ts.map +1 -0
- package/out/types/src/routes/listMessages.d.ts +124 -0
- package/out/types/src/routes/listMessages.d.ts.map +1 -0
- package/out/types/src/routes/permissions/getPermission.d.ts +46 -0
- package/out/types/src/routes/permissions/getPermission.d.ts.map +1 -0
- package/out/types/src/routes/permissions/getQuote.d.ts +50 -0
- package/out/types/src/routes/permissions/getQuote.d.ts.map +1 -0
- package/out/types/src/routes/permissions/index.d.ts +18 -0
- package/out/types/src/routes/permissions/index.d.ts.map +1 -0
- package/out/types/src/routes/permissions/listPermissions.d.ts +106 -0
- package/out/types/src/routes/permissions/listPermissions.d.ts.map +1 -0
- package/out/types/src/routes/permissions/setPermission.d.ts +53 -0
- package/out/types/src/routes/permissions/setPermission.d.ts.map +1 -0
- package/out/types/src/routes/registerDevice.d.ts +67 -0
- package/out/types/src/routes/registerDevice.d.ts.map +1 -0
- package/out/types/src/routes/sendMessage.d.ts +140 -0
- package/out/types/src/routes/sendMessage.d.ts.map +1 -0
- package/out/types/src/runtimeDeps.d.ts +17 -0
- package/out/types/src/runtimeDeps.d.ts.map +1 -0
- package/out/types/src/swagger.d.ts +3 -0
- package/out/types/src/swagger.d.ts.map +1 -0
- package/out/types/src/telemetry.d.ts +2 -0
- package/out/types/src/telemetry.d.ts.map +1 -0
- package/out/types/src/types/messagePermissions.d.ts +15 -0
- package/out/types/src/types/messagePermissions.d.ts.map +1 -0
- package/out/types/src/types/notifications.d.ts +20 -0
- package/out/types/src/types/notifications.d.ts.map +1 -0
- package/out/types/src/utils/logger.d.ts +17 -0
- package/out/types/src/utils/logger.d.ts.map +1 -0
- package/out/types/src/utils/messagePermissions.d.ts +29 -0
- package/out/types/src/utils/messagePermissions.d.ts.map +1 -0
- package/out/types/src/utils/sendFCMNotification.d.ts +22 -0
- package/out/types/src/utils/sendFCMNotification.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Response } from 'express';
|
|
2
|
+
import { AuthRequest } from '@bsv/auth-express-middleware';
|
|
3
|
+
export interface GetQuoteRequest extends AuthRequest {
|
|
4
|
+
query: {
|
|
5
|
+
recipient: string | string[];
|
|
6
|
+
messageBox?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @swagger
|
|
11
|
+
* /permissions/quote:
|
|
12
|
+
* get:
|
|
13
|
+
* summary: Get message delivery quote(s)
|
|
14
|
+
* description: Get pricing information for sending messages to one or many recipients' message boxes
|
|
15
|
+
* tags:
|
|
16
|
+
* - Permissions
|
|
17
|
+
* parameters:
|
|
18
|
+
* - in: query
|
|
19
|
+
* name: recipient
|
|
20
|
+
* required: true
|
|
21
|
+
* schema:
|
|
22
|
+
* oneOf:
|
|
23
|
+
* - type: string
|
|
24
|
+
* - type: array
|
|
25
|
+
* items:
|
|
26
|
+
* type: string
|
|
27
|
+
* description: identityKey of the recipient, or multiple recipients by repeating the parameter (?recipient=A&recipient=B)
|
|
28
|
+
* - in: query
|
|
29
|
+
* name: messageBox
|
|
30
|
+
* required: true
|
|
31
|
+
* schema:
|
|
32
|
+
* type: string
|
|
33
|
+
* description: messageBox type
|
|
34
|
+
* responses:
|
|
35
|
+
* 200:
|
|
36
|
+
* description: Quote(s) retrieved successfully
|
|
37
|
+
* 400:
|
|
38
|
+
* description: Invalid request parameters
|
|
39
|
+
* 401:
|
|
40
|
+
* description: Authentication required
|
|
41
|
+
* 500:
|
|
42
|
+
* description: Internal server error
|
|
43
|
+
*/
|
|
44
|
+
declare const _default: {
|
|
45
|
+
type: string;
|
|
46
|
+
path: string;
|
|
47
|
+
func: (req: GetQuoteRequest, res: Response) => Promise<Response>;
|
|
48
|
+
};
|
|
49
|
+
export default _default;
|
|
50
|
+
//# sourceMappingURL=getQuote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getQuote.d.ts","sourceRoot":"","sources":["../../../../../src/routes/permissions/getQuote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAG1D,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;QAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;;gBAIiB,eAAe,OAAO,QAAQ,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAHtE,wBA+IC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const permissionRoutes: ({
|
|
2
|
+
type: string;
|
|
3
|
+
path: string;
|
|
4
|
+
func: (req: import("./setPermission.js").SetPermissionRequestType, res: import("express").Response) => Promise<import("express").Response>;
|
|
5
|
+
} | {
|
|
6
|
+
type: string;
|
|
7
|
+
path: string;
|
|
8
|
+
func: (req: import("./getPermission.js").GetPermissionRequest, res: import("express").Response) => Promise<import("express").Response>;
|
|
9
|
+
} | {
|
|
10
|
+
type: string;
|
|
11
|
+
path: string;
|
|
12
|
+
func: (req: import("./getQuote.js").GetQuoteRequest, res: import("express").Response) => Promise<import("express").Response>;
|
|
13
|
+
} | {
|
|
14
|
+
type: string;
|
|
15
|
+
path: string;
|
|
16
|
+
func: (req: import("./listPermissions.js").ListPermissionsRequest, res: import("express").Response) => Promise<import("express").Response>;
|
|
17
|
+
})[];
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/routes/permissions/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;IAK5B,CAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Response } from 'express';
|
|
2
|
+
import { AuthRequest } from '@bsv/auth-express-middleware';
|
|
3
|
+
export interface ListPermissionsRequest extends AuthRequest {
|
|
4
|
+
query: {
|
|
5
|
+
messageBox?: string;
|
|
6
|
+
limit?: string;
|
|
7
|
+
offset?: string;
|
|
8
|
+
createdAtOrder?: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @swagger
|
|
13
|
+
* /permissions/list:
|
|
14
|
+
* get:
|
|
15
|
+
* summary: List message permissions for the authenticated user
|
|
16
|
+
* description: Retrieve all permissions set by the authenticated user with optional filtering and pagination
|
|
17
|
+
* tags:
|
|
18
|
+
* - Permissions
|
|
19
|
+
* parameters:
|
|
20
|
+
* - in: query
|
|
21
|
+
* name: messageBox
|
|
22
|
+
* required: false
|
|
23
|
+
* schema:
|
|
24
|
+
* type: string
|
|
25
|
+
* description: Optional messageBox type filter (e.g., 'notifications', 'inbox')
|
|
26
|
+
* - in: query
|
|
27
|
+
* name: limit
|
|
28
|
+
* required: false
|
|
29
|
+
* schema:
|
|
30
|
+
* type: integer
|
|
31
|
+
* minimum: 1
|
|
32
|
+
* maximum: 1000
|
|
33
|
+
* default: 100
|
|
34
|
+
* description: Maximum number of permissions to return
|
|
35
|
+
* - in: query
|
|
36
|
+
* name: offset
|
|
37
|
+
* required: false
|
|
38
|
+
* schema:
|
|
39
|
+
* type: integer
|
|
40
|
+
* minimum: 0
|
|
41
|
+
* default: 0
|
|
42
|
+
* description: Number of permissions to skip for pagination
|
|
43
|
+
* - in: query
|
|
44
|
+
* name: createdAtOrder
|
|
45
|
+
* required: false
|
|
46
|
+
* schema:
|
|
47
|
+
* type: string
|
|
48
|
+
* enum: ['asc', 'desc']
|
|
49
|
+
* default: 'desc'
|
|
50
|
+
* description: Sort order for created_at date (asc=oldest first, desc=newest first)
|
|
51
|
+
* responses:
|
|
52
|
+
* 200:
|
|
53
|
+
* description: Permissions retrieved successfully
|
|
54
|
+
* content:
|
|
55
|
+
* application/json:
|
|
56
|
+
* schema:
|
|
57
|
+
* type: object
|
|
58
|
+
* properties:
|
|
59
|
+
* status:
|
|
60
|
+
* type: string
|
|
61
|
+
* example: 'success'
|
|
62
|
+
* permissions:
|
|
63
|
+
* type: array
|
|
64
|
+
* items:
|
|
65
|
+
* type: object
|
|
66
|
+
* properties:
|
|
67
|
+
* sender:
|
|
68
|
+
* type: string
|
|
69
|
+
* nullable: true
|
|
70
|
+
* description: Sender identity key (null for box-wide defaults)
|
|
71
|
+
* messageBox:
|
|
72
|
+
* type: string
|
|
73
|
+
* description: MessageBox type
|
|
74
|
+
* recipientFee:
|
|
75
|
+
* type: integer
|
|
76
|
+
* description: Fee setting (-1=block all, 0=always allow, >0=satoshi amount)
|
|
77
|
+
* created_at:
|
|
78
|
+
* type: string
|
|
79
|
+
* format: date-time
|
|
80
|
+
* updated_at:
|
|
81
|
+
* type: string
|
|
82
|
+
* format: date-time
|
|
83
|
+
* total_count:
|
|
84
|
+
* type: integer
|
|
85
|
+
* description: Total number of permissions (useful for pagination)
|
|
86
|
+
* 400:
|
|
87
|
+
* description: Invalid query parameters
|
|
88
|
+
* 401:
|
|
89
|
+
* description: Unauthorized - authentication required
|
|
90
|
+
* 500:
|
|
91
|
+
* description: Internal server error
|
|
92
|
+
*/
|
|
93
|
+
declare const _default: {
|
|
94
|
+
type: string;
|
|
95
|
+
path: string;
|
|
96
|
+
/**
|
|
97
|
+
* List message permissions for the authenticated user
|
|
98
|
+
*
|
|
99
|
+
* @param {ListPermissionsRequest} req - Authenticated request with query parameters
|
|
100
|
+
* @param {Response} res - Express response object
|
|
101
|
+
* @returns {Promise<Response>} JSON response with permissions list
|
|
102
|
+
*/
|
|
103
|
+
func: (req: ListPermissionsRequest, res: Response) => Promise<Response>;
|
|
104
|
+
};
|
|
105
|
+
export default _default;
|
|
106
|
+
//# sourceMappingURL=listPermissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listPermissions.d.ts","sourceRoot":"","sources":["../../../../../src/routes/permissions/listPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAI1D,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,KAAK,EAAE;QACL,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB,CAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;;;;IAID;;;;;;OAMG;gBACe,sBAAsB,OAAO,QAAQ,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAV7E,wBAyGC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Response } from 'express';
|
|
2
|
+
import { AuthRequest } from '@bsv/auth-express-middleware';
|
|
3
|
+
export interface SetPermissionRequestType extends AuthRequest {
|
|
4
|
+
body: {
|
|
5
|
+
sender?: string;
|
|
6
|
+
messageBox: string;
|
|
7
|
+
recipientFee: number;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @swagger
|
|
12
|
+
* /permissions/set:
|
|
13
|
+
* post:
|
|
14
|
+
* summary: Set message permission for a sender/box combination or box-wide default
|
|
15
|
+
* description: Set permission level for receiving messages. If sender is provided, sets permission for that specific sender. If sender is omitted, sets box-wide default for all senders.
|
|
16
|
+
* tags:
|
|
17
|
+
* - Permissions
|
|
18
|
+
* requestBody:
|
|
19
|
+
* required: true
|
|
20
|
+
* content:
|
|
21
|
+
* application/json:
|
|
22
|
+
* schema:
|
|
23
|
+
* type: object
|
|
24
|
+
* required:
|
|
25
|
+
* - messageBox
|
|
26
|
+
* - recipientFee
|
|
27
|
+
* properties:
|
|
28
|
+
* sender:
|
|
29
|
+
* type: string
|
|
30
|
+
* description: identityKey of the sender (optional - if omitted, sets box-wide default for all senders)
|
|
31
|
+
* messageBox:
|
|
32
|
+
* type: string
|
|
33
|
+
* description: messageBox type (e.g., 'notifications', 'inbox')
|
|
34
|
+
* recipientFee:
|
|
35
|
+
* type: integer
|
|
36
|
+
* description: Fee level (-1=blocked, 0=always allow, >0=satoshi amount required)
|
|
37
|
+
* responses:
|
|
38
|
+
* 200:
|
|
39
|
+
* description: Permission successfully set/updated
|
|
40
|
+
* 400:
|
|
41
|
+
* description: Invalid request data
|
|
42
|
+
* 401:
|
|
43
|
+
* description: Authentication required
|
|
44
|
+
* 500:
|
|
45
|
+
* description: Internal server error
|
|
46
|
+
*/
|
|
47
|
+
declare const _default: {
|
|
48
|
+
type: string;
|
|
49
|
+
path: string;
|
|
50
|
+
func: (req: SetPermissionRequestType, res: Response) => Promise<Response>;
|
|
51
|
+
};
|
|
52
|
+
export default _default;
|
|
53
|
+
//# sourceMappingURL=setPermission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setPermission.d.ts","sourceRoot":"","sources":["../../../../../src/routes/permissions/setPermission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAG1D,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,IAAI,EAAE;QACJ,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,UAAU,EAAE,MAAM,CAAA;QAClB,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;;;;gBAIiB,wBAAwB,OAAO,QAAQ,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAH/E,wBAuGC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Response } from 'express';
|
|
2
|
+
import { AuthRequest } from '@bsv/auth-express-middleware';
|
|
3
|
+
export interface RegisterDeviceRequest extends AuthRequest {
|
|
4
|
+
body: {
|
|
5
|
+
fcmToken: string;
|
|
6
|
+
deviceId?: string;
|
|
7
|
+
platform?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @swagger
|
|
12
|
+
* /registerDevice:
|
|
13
|
+
* post:
|
|
14
|
+
* summary: Register device for push notifications
|
|
15
|
+
* description: Register a device's FCM token for receiving push notifications
|
|
16
|
+
* tags:
|
|
17
|
+
* - Device
|
|
18
|
+
* requestBody:
|
|
19
|
+
* required: true
|
|
20
|
+
* content:
|
|
21
|
+
* application/json:
|
|
22
|
+
* schema:
|
|
23
|
+
* type: object
|
|
24
|
+
* required:
|
|
25
|
+
* - fcmToken
|
|
26
|
+
* properties:
|
|
27
|
+
* fcmToken:
|
|
28
|
+
* type: string
|
|
29
|
+
* description: Firebase Cloud Messaging token
|
|
30
|
+
* deviceId:
|
|
31
|
+
* type: string
|
|
32
|
+
* description: Optional device identifier
|
|
33
|
+
* platform:
|
|
34
|
+
* type: string
|
|
35
|
+
* description: Device platform (ios, android, web)
|
|
36
|
+
* enum: [ios, android, web]
|
|
37
|
+
* responses:
|
|
38
|
+
* 200:
|
|
39
|
+
* description: Device registered successfully
|
|
40
|
+
* content:
|
|
41
|
+
* application/json:
|
|
42
|
+
* schema:
|
|
43
|
+
* type: object
|
|
44
|
+
* properties:
|
|
45
|
+
* status:
|
|
46
|
+
* type: string
|
|
47
|
+
* example: success
|
|
48
|
+
* message:
|
|
49
|
+
* type: string
|
|
50
|
+
* example: Device registered successfully
|
|
51
|
+
* deviceId:
|
|
52
|
+
* type: integer
|
|
53
|
+
* description: Database ID of the registered device
|
|
54
|
+
* 400:
|
|
55
|
+
* description: Invalid request parameters
|
|
56
|
+
* 401:
|
|
57
|
+
* description: Authentication required
|
|
58
|
+
* 500:
|
|
59
|
+
* description: Internal server error
|
|
60
|
+
*/
|
|
61
|
+
declare const _default: {
|
|
62
|
+
type: string;
|
|
63
|
+
path: string;
|
|
64
|
+
func: (req: RegisterDeviceRequest, res: Response) => Promise<Response>;
|
|
65
|
+
};
|
|
66
|
+
export default _default;
|
|
67
|
+
//# sourceMappingURL=registerDevice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerDevice.d.ts","sourceRoot":"","sources":["../../../../src/routes/registerDevice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAG1D,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM,CAAA;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,CAAA;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;;;;gBAKiB,qBAAqB,OAAO,QAAQ,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAH5E,wBAyFC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file sendMessage.ts
|
|
3
|
+
* @description
|
|
4
|
+
* Route handler to send a message to another identity's messageBox.
|
|
5
|
+
* This route is used for P2P communication in the MessageBox system.
|
|
6
|
+
*
|
|
7
|
+
* It handles:
|
|
8
|
+
* - Validation of message structure
|
|
9
|
+
* - Validation of the recipient public key
|
|
10
|
+
* - MessageBox creation if one doesn't exist
|
|
11
|
+
* - Insertion of the message into the database
|
|
12
|
+
* - Deduplication based on messageId
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
import { Response } from 'express';
|
|
16
|
+
import { AtomicBEEF, Base64String, BasketStringUnder300Bytes, BooleanDefaultTrue, DescriptionString5to50Bytes, LabelStringUnder300Bytes, OutputTagStringUnder300Bytes, PositiveIntegerOrZero, PubKeyHex } from '@bsv/sdk';
|
|
17
|
+
import { AuthRequest } from '@bsv/auth-express-middleware';
|
|
18
|
+
export interface Message {
|
|
19
|
+
recipient: PubKeyHex | PubKeyHex[];
|
|
20
|
+
recipients?: PubKeyHex[];
|
|
21
|
+
messageBox: string;
|
|
22
|
+
messageId: string | string[];
|
|
23
|
+
body: string;
|
|
24
|
+
}
|
|
25
|
+
export interface Payment {
|
|
26
|
+
tx: AtomicBEEF;
|
|
27
|
+
outputs: Array<{
|
|
28
|
+
outputIndex: PositiveIntegerOrZero;
|
|
29
|
+
protocol: 'wallet payment' | 'basket insertion';
|
|
30
|
+
paymentRemittance?: {
|
|
31
|
+
derivationPrefix: Base64String;
|
|
32
|
+
derivationSuffix: Base64String;
|
|
33
|
+
senderIdentityKey: PubKeyHex;
|
|
34
|
+
customInstructions?: unknown;
|
|
35
|
+
};
|
|
36
|
+
insertionRemittance?: {
|
|
37
|
+
basket: BasketStringUnder300Bytes;
|
|
38
|
+
customInstructions?: string;
|
|
39
|
+
tags?: OutputTagStringUnder300Bytes[];
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
description: DescriptionString5to50Bytes;
|
|
43
|
+
labels?: LabelStringUnder300Bytes[];
|
|
44
|
+
seekPermission?: BooleanDefaultTrue;
|
|
45
|
+
}
|
|
46
|
+
export interface SendMessageRequest extends AuthRequest {
|
|
47
|
+
body: {
|
|
48
|
+
message?: Message;
|
|
49
|
+
payment?: Payment;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @function calculateMessagePrice
|
|
54
|
+
* @description Determines the price (in satoshis) to send a message, optionally with priority.
|
|
55
|
+
*/
|
|
56
|
+
export declare function calculateMessagePrice(message: string, priority?: boolean): number;
|
|
57
|
+
/**
|
|
58
|
+
* @openapi
|
|
59
|
+
* /sendMessage:
|
|
60
|
+
* post:
|
|
61
|
+
* summary: Send a message to a recipient’s message box
|
|
62
|
+
* description: |
|
|
63
|
+
* Inserts a message into the target recipient’s message box on the server.
|
|
64
|
+
* The recipient, message box name, and message ID must be provided.
|
|
65
|
+
* tags:
|
|
66
|
+
* - Message
|
|
67
|
+
* requestBody:
|
|
68
|
+
* required: true
|
|
69
|
+
* content:
|
|
70
|
+
* application/json:
|
|
71
|
+
* schema:
|
|
72
|
+
* type: object
|
|
73
|
+
* properties:
|
|
74
|
+
* message:
|
|
75
|
+
* type: object
|
|
76
|
+
* required:
|
|
77
|
+
* - recipient
|
|
78
|
+
* - messageBox
|
|
79
|
+
* - messageId
|
|
80
|
+
* - body
|
|
81
|
+
* properties:
|
|
82
|
+
* recipient:
|
|
83
|
+
* type: string
|
|
84
|
+
* description: Identity key of the recipient
|
|
85
|
+
* messageBox:
|
|
86
|
+
* type: string
|
|
87
|
+
* description: The name of the recipient's message box
|
|
88
|
+
* messageId:
|
|
89
|
+
* type: string
|
|
90
|
+
* description: Unique identifier for the message (usually an HMAC)
|
|
91
|
+
* body:
|
|
92
|
+
* oneOf:
|
|
93
|
+
* - type: string
|
|
94
|
+
* - type: object
|
|
95
|
+
* description: The message content
|
|
96
|
+
* responses:
|
|
97
|
+
* 200:
|
|
98
|
+
* description: Message stored successfully
|
|
99
|
+
* content:
|
|
100
|
+
* application/json:
|
|
101
|
+
* schema:
|
|
102
|
+
* type: object
|
|
103
|
+
* properties:
|
|
104
|
+
* status:
|
|
105
|
+
* type: string
|
|
106
|
+
* example: success
|
|
107
|
+
* messageId:
|
|
108
|
+
* type: string
|
|
109
|
+
* message:
|
|
110
|
+
* type: string
|
|
111
|
+
* 400:
|
|
112
|
+
* description: Invalid request or duplicate message
|
|
113
|
+
* 500:
|
|
114
|
+
* description: Internal server error
|
|
115
|
+
*/
|
|
116
|
+
/**
|
|
117
|
+
* @exports
|
|
118
|
+
* Express-compatible route definition for `/sendMessage`, used to send messages to other users.
|
|
119
|
+
* Contains metadata for auto-generation of route documentation and Swagger/OpenAPI integration.
|
|
120
|
+
*/
|
|
121
|
+
declare const _default: {
|
|
122
|
+
type: string;
|
|
123
|
+
path: string;
|
|
124
|
+
readonly knex: import("knex").Knex<any, any[]>;
|
|
125
|
+
summary: string;
|
|
126
|
+
parameters: {
|
|
127
|
+
message: {
|
|
128
|
+
recipient: string;
|
|
129
|
+
messageBox: string;
|
|
130
|
+
messageId: string;
|
|
131
|
+
body: string;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
exampleResponse: {
|
|
135
|
+
status: string;
|
|
136
|
+
};
|
|
137
|
+
func: (req: SendMessageRequest, res: Response) => Promise<Response>;
|
|
138
|
+
};
|
|
139
|
+
export default _default;
|
|
140
|
+
//# sourceMappingURL=sendMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendMessage.d.ts","sourceRoot":"","sources":["../../../../src/routes/sendMessage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EACL,UAAU,EACV,YAAY,EACZ,yBAAyB,EACzB,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,qBAAqB,EACrB,SAAS,EAEV,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAQ1D,MAAM,WAAW,OAAO;IAEtB,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,CAAA;IAClC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,UAAU,CAAA;IACd,OAAO,EAAE,KAAK,CAAC;QACb,WAAW,EAAE,qBAAqB,CAAA;QAClC,QAAQ,EAAE,gBAAgB,GAAG,kBAAkB,CAAA;QAC/C,iBAAiB,CAAC,EAAE;YAClB,gBAAgB,EAAE,YAAY,CAAA;YAC9B,gBAAgB,EAAE,YAAY,CAAA;YAC9B,iBAAiB,EAAE,SAAS,CAAA;YAK5B,kBAAkB,CAAC,EAAE,OAAO,CAAA;SAC7B,CAAA;QACD,mBAAmB,CAAC,EAAE;YACpB,MAAM,EAAE,yBAAyB,CAAA;YACjC,kBAAkB,CAAC,EAAE,MAAM,CAAA;YAC3B,IAAI,CAAC,EAAE,4BAA4B,EAAE,CAAA;SACtC,CAAA;KACF,CAAC,CAAA;IACF,WAAW,EAAE,2BAA2B,CAAA;IACxC,MAAM,CAAC,EAAE,wBAAwB,EAAE,CAAA;IACnC,cAAc,CAAC,EAAE,kBAAkB,CAAA;CACpC;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,IAAI,EAAE;QACJ,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;CACF;AAOD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAe,GAAG,MAAM,CAIxF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH;;;;GAIG;;;;;;;;;;;;;;;;;gBAgBiB,kBAAkB,OAAO,QAAQ,KAAG,OAAO,CAAC,QAAQ,CAAC;;AAfzE,wBAmXC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Injectable knex/wallet for route handlers.
|
|
3
|
+
* Binary entry and mountMessageBoxRoutes call bindMessageBoxRuntime before serving.
|
|
4
|
+
*/
|
|
5
|
+
import type { Knex } from 'knex';
|
|
6
|
+
import type { WalletInterface } from '@bsv/sdk';
|
|
7
|
+
/** Bound before serving; routes read knex/wallet from here. */
|
|
8
|
+
export declare const runtimeDeps: {
|
|
9
|
+
knex: Knex;
|
|
10
|
+
wallet?: WalletInterface;
|
|
11
|
+
};
|
|
12
|
+
export declare function bindMessageBoxRuntime(deps: {
|
|
13
|
+
knex: Knex;
|
|
14
|
+
wallet?: WalletInterface;
|
|
15
|
+
}): void;
|
|
16
|
+
export declare function getWallet(): Promise<WalletInterface>;
|
|
17
|
+
//# sourceMappingURL=runtimeDeps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeDeps.d.ts","sourceRoot":"","sources":["../../../src/runtimeDeps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,+DAA+D;AAC/D,eAAO,MAAM,WAAW,EAAE;IACxB,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,CAAC,EAAE,eAAe,CAAA;CAGzB,CAAA;AAED,wBAAgB,qBAAqB,CAAE,IAAI,EAAE;IAC3C,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,CAAC,EAAE,eAAe,CAAA;CACzB,GAAG,IAAI,CAGP;AAED,wBAAsB,SAAS,IAAK,OAAO,CAAC,eAAe,CAAC,CAK3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swagger.d.ts","sourceRoot":"","sources":["../../../src/swagger.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,wBAAgB,YAAY,CAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CAiDhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../../src/telemetry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PubKeyHex } from '@bsv/sdk';
|
|
2
|
+
export interface MessagePermission {
|
|
3
|
+
id: number;
|
|
4
|
+
recipient: PubKeyHex;
|
|
5
|
+
sender: PubKeyHex | null;
|
|
6
|
+
message_box: string;
|
|
7
|
+
recipient_fee: number;
|
|
8
|
+
created_at: Date;
|
|
9
|
+
updated_at: Date;
|
|
10
|
+
}
|
|
11
|
+
export interface FeeCalculationResult {
|
|
12
|
+
deliveryFee: number;
|
|
13
|
+
recipientFee: number;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=messagePermissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagePermissions.d.ts","sourceRoot":"","sources":["../../../../src/types/messagePermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,SAAS,GAAG,IAAI,CAAA;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,IAAI,CAAA;IAChB,UAAU,EAAE,IAAI,CAAA;CACjB;AAGD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;CACrB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PubKeyHex } from '@bsv/sdk';
|
|
2
|
+
export interface EncryptedNotificationPayload {
|
|
3
|
+
title?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface NotificationPayment {
|
|
6
|
+
amount: number;
|
|
7
|
+
recipient: PubKeyHex;
|
|
8
|
+
}
|
|
9
|
+
export interface FCMPayload {
|
|
10
|
+
title: string;
|
|
11
|
+
body: string;
|
|
12
|
+
icon?: string;
|
|
13
|
+
badge?: number;
|
|
14
|
+
data?: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
export interface SendNotificationResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
messageId: string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../../src/types/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,MAAM,WAAW,4BAA4B;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAGD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,SAAS,CAAA;CAErB;AAGD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import pino from 'pino';
|
|
2
|
+
export declare const log: pino.Logger<never, boolean>;
|
|
3
|
+
/**
|
|
4
|
+
* Backwards-compatible static facade over the structured logger. Existing
|
|
5
|
+
* Logger.log/warn/error call sites keep working but now emit structured,
|
|
6
|
+
* trace-correlated records. `enable`/`disable` toggle info/warn verbosity;
|
|
7
|
+
* errors are always emitted.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Logger {
|
|
10
|
+
private static isEnabled;
|
|
11
|
+
static enable(): void;
|
|
12
|
+
static disable(): void;
|
|
13
|
+
static log(...args: unknown[]): void;
|
|
14
|
+
static warn(...args: unknown[]): void;
|
|
15
|
+
static error(...args: unknown[]): void;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAoCvB,eAAO,MAAM,GAAG,6BAAa,CAAA;AAsB7B;;;;;GAKG;AAEH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAQ;IAEhC,MAAM,CAAC,MAAM,IAAI,IAAI;IAIrB,MAAM,CAAC,OAAO,IAAI,IAAI;IAItB,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMpC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMrC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAGvC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PubKeyHex } from '@bsv/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Fee calculation result structure
|
|
4
|
+
*/
|
|
5
|
+
export interface FeeCalculationResult {
|
|
6
|
+
delivery_fee: number;
|
|
7
|
+
recipient_fee: number;
|
|
8
|
+
total_cost: number;
|
|
9
|
+
allowed: boolean;
|
|
10
|
+
requires_payment: boolean;
|
|
11
|
+
blocked_reason?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get server delivery fee for a message box type
|
|
15
|
+
*/
|
|
16
|
+
export declare function getServerDeliveryFee(messageBox: string): Promise<number>;
|
|
17
|
+
/**
|
|
18
|
+
* Get recipient fee for a sender/messageBox combination with hierarchical fallback
|
|
19
|
+
*/
|
|
20
|
+
export declare function getRecipientFee(recipient: PubKeyHex, sender: PubKeyHex | null, messageBox: string): Promise<number>;
|
|
21
|
+
/**
|
|
22
|
+
* Set message permission for a sender/recipient/messageBox combination
|
|
23
|
+
*/
|
|
24
|
+
export declare function setMessagePermission(recipient: PubKeyHex, sender: PubKeyHex | null, messageBox: string, recipientFee: number): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Check if FCM delivery should be used for this message box
|
|
27
|
+
*/
|
|
28
|
+
export declare function shouldUseFCMDelivery(messageBox: string): boolean;
|
|
29
|
+
//# sourceMappingURL=messagePermissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagePermissions.d.ts","sourceRoot":"","sources":["../../../../src/utils/messagePermissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,gBAAgB,EAAE,OAAO,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY9E;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,GAAG,IAAI,EACxB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAoDjB;AAeD;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,SAAS,GAAG,IAAI,EACxB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,CAAC,CAyBlB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEhE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PubKeyHex } from '@bsv/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* FCM Payload interface
|
|
4
|
+
*/
|
|
5
|
+
export interface FCMPayload {
|
|
6
|
+
title: string;
|
|
7
|
+
messageId: string;
|
|
8
|
+
originator?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* FCM notification result
|
|
12
|
+
*/
|
|
13
|
+
export interface SendNotificationResult {
|
|
14
|
+
success: boolean;
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Send FCM push notification to all registered devices for a recipient
|
|
19
|
+
* Looks up FCM tokens from device_registrations table and sends to all active devices
|
|
20
|
+
*/
|
|
21
|
+
export declare function sendFCMNotification(recipient: PubKeyHex, payload: FCMPayload): Promise<SendNotificationResult>;
|
|
22
|
+
//# sourceMappingURL=sendFCMNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendFCMNotification.d.ts","sourceRoot":"","sources":["../../../../src/utils/sendFCMNotification.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,sBAAsB,CAAC,CAiHjC"}
|