@credo-ts/didcomm-push-notifications 0.0.2-alpha-20251223113700 → 0.0.2-alpha-20251223125919
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/build/fcm/DidCommPushNotificationsFcmApi.d.ts +20 -0
- package/build/fcm/DidCommPushNotificationsFcmApi.js +38 -2
- package/build/fcm/DidCommPushNotificationsFcmApi.js.map +1 -1
- package/build/fcm/handlers/DidCommPushNotificationsFcmGetDeviceInfoHandler.d.ts +13 -0
- package/build/fcm/handlers/DidCommPushNotificationsFcmGetDeviceInfoHandler.js +18 -0
- package/build/fcm/handlers/DidCommPushNotificationsFcmGetDeviceInfoHandler.js.map +1 -0
- package/build/fcm/handlers/index.d.ts +1 -0
- package/build/fcm/handlers/index.js +1 -0
- package/build/fcm/handlers/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,17 @@ export declare class DidCommPushNotificationsFcmApi {
|
|
|
9
9
|
private connectionService;
|
|
10
10
|
private agentContext;
|
|
11
11
|
constructor(messageSender: DidCommMessageSender, pushNotificationsService: DidCommPushNotificationsFcmService, connectionService: DidCommConnectionService, agentContext: AgentContext);
|
|
12
|
+
/**
|
|
13
|
+
* Sends a set request with the fcm device info (token) to another agent via a `connectionId`
|
|
14
|
+
*
|
|
15
|
+
* @param connectionId The connection ID string
|
|
16
|
+
* @param deviceInfo The FCM device info
|
|
17
|
+
* @returns Promise<void>
|
|
18
|
+
*/
|
|
19
|
+
setDeviceInfo(options: {
|
|
20
|
+
connectionId: string;
|
|
21
|
+
deviceInfo: DidCommFcmDeviceInfo;
|
|
22
|
+
}): Promise<void>;
|
|
12
23
|
/**
|
|
13
24
|
* Sends the requested fcm device info (token) to another agent via a `connectionId`
|
|
14
25
|
* Response for `push-notifications-fcm/get-device-info`
|
|
@@ -23,6 +34,15 @@ export declare class DidCommPushNotificationsFcmApi {
|
|
|
23
34
|
threadId: string;
|
|
24
35
|
deviceInfo: DidCommFcmDeviceInfo;
|
|
25
36
|
}): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the fcm device info (token) from another agent via the `connectionId`
|
|
39
|
+
*
|
|
40
|
+
* @param connectionId The connection ID string
|
|
41
|
+
* @returns Promise<void>
|
|
42
|
+
*/
|
|
43
|
+
getDeviceInfo(options: {
|
|
44
|
+
connectionId: string;
|
|
45
|
+
}): Promise<void>;
|
|
26
46
|
/**
|
|
27
47
|
* Get push notification record by `connectionId`
|
|
28
48
|
*
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { AgentContext, injectable } from '@credo-ts/core';
|
|
11
11
|
import { DidCommConnectionService, DidCommMessageHandlerRegistry, DidCommMessageSender, DidCommOutboundMessageContext, } from '@credo-ts/didcomm';
|
|
12
|
-
import { DidCommPushNotificationsFcmDeviceInfoHandler, DidCommPushNotificationsFcmProblemReportHandler, DidCommPushNotificationsFcmSetDeviceInfoHandler, } from './handlers/index.js';
|
|
12
|
+
import { DidCommPushNotificationsFcmDeviceInfoHandler, DidCommPushNotificationsFcmGetDeviceInfoHandler, DidCommPushNotificationsFcmProblemReportHandler, DidCommPushNotificationsFcmSetDeviceInfoHandler, } from './handlers/index.js';
|
|
13
13
|
import { DidCommPushNotificationsFcmService } from './services/DidCommPushNotificationsFcmService.js';
|
|
14
14
|
let DidCommPushNotificationsFcmApi = class DidCommPushNotificationsFcmApi {
|
|
15
15
|
constructor(messageSender, pushNotificationsService, connectionService, agentContext) {
|
|
@@ -21,10 +21,29 @@ let DidCommPushNotificationsFcmApi = class DidCommPushNotificationsFcmApi {
|
|
|
21
21
|
.resolve(DidCommMessageHandlerRegistry)
|
|
22
22
|
.registerMessageHandlers([
|
|
23
23
|
new DidCommPushNotificationsFcmSetDeviceInfoHandler(this.pushNotificationsService),
|
|
24
|
+
new DidCommPushNotificationsFcmGetDeviceInfoHandler(),
|
|
24
25
|
new DidCommPushNotificationsFcmDeviceInfoHandler(),
|
|
25
26
|
new DidCommPushNotificationsFcmProblemReportHandler(),
|
|
26
27
|
]);
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Sends a set request with the fcm device info (token) to another agent via a `connectionId`
|
|
31
|
+
*
|
|
32
|
+
* @param connectionId The connection ID string
|
|
33
|
+
* @param deviceInfo The FCM device info
|
|
34
|
+
* @returns Promise<void>
|
|
35
|
+
*/
|
|
36
|
+
async setDeviceInfo(options) {
|
|
37
|
+
const { connectionId, deviceInfo } = options;
|
|
38
|
+
const connection = await this.connectionService.getById(this.agentContext, connectionId);
|
|
39
|
+
connection.assertReady();
|
|
40
|
+
const message = this.pushNotificationsService.createSetDeviceInfo(deviceInfo);
|
|
41
|
+
const outbound = new DidCommOutboundMessageContext(message, {
|
|
42
|
+
agentContext: this.agentContext,
|
|
43
|
+
connection,
|
|
44
|
+
});
|
|
45
|
+
await this.messageSender.sendMessage(outbound);
|
|
46
|
+
}
|
|
28
47
|
/**
|
|
29
48
|
* Sends the requested fcm device info (token) to another agent via a `connectionId`
|
|
30
49
|
* Response for `push-notifications-fcm/get-device-info`
|
|
@@ -41,7 +60,24 @@ let DidCommPushNotificationsFcmApi = class DidCommPushNotificationsFcmApi {
|
|
|
41
60
|
const message = this.pushNotificationsService.createDeviceInfo({ threadId, deviceInfo });
|
|
42
61
|
const outbound = new DidCommOutboundMessageContext(message, {
|
|
43
62
|
agentContext: this.agentContext,
|
|
44
|
-
connection
|
|
63
|
+
connection,
|
|
64
|
+
});
|
|
65
|
+
await this.messageSender.sendMessage(outbound);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Gets the fcm device info (token) from another agent via the `connectionId`
|
|
69
|
+
*
|
|
70
|
+
* @param connectionId The connection ID string
|
|
71
|
+
* @returns Promise<void>
|
|
72
|
+
*/
|
|
73
|
+
async getDeviceInfo(options) {
|
|
74
|
+
const { connectionId } = options;
|
|
75
|
+
const connection = await this.connectionService.getById(this.agentContext, connectionId);
|
|
76
|
+
connection.assertReady();
|
|
77
|
+
const message = this.pushNotificationsService.createGetDeviceInfo();
|
|
78
|
+
const outbound = new DidCommOutboundMessageContext(message, {
|
|
79
|
+
agentContext: this.agentContext,
|
|
80
|
+
connection,
|
|
45
81
|
});
|
|
46
82
|
await this.messageSender.sendMessage(outbound);
|
|
47
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidCommPushNotificationsFcmApi.js","sourceRoot":"","sources":["../../src/fcm/DidCommPushNotificationsFcmApi.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,4CAA4C,EAC5C,+CAA+C,EAC/C,+CAA+C,GAChD,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,kCAAkC,EAAE,MAAM,kDAAkD,CAAA;AAG9F,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAMzC,YACE,aAAmC,EACnC,wBAA4D,EAC5D,iBAA2C,EAC3C,YAA0B;QAE1B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,wBAAwB,GAAG,wBAAwB,CAAA;QACxD,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;QAC1C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAEhC,IAAI,CAAC,YAAY;aACd,OAAO,CAAC,6BAA6B,CAAC;aACtC,uBAAuB,CAAC;YACvB,IAAI,+CAA+C,CAAC,IAAI,CAAC,wBAAwB,CAAC;YAClF,IAAI,4CAA4C,EAAE;YAClD,IAAI,+CAA+C,EAAE;SACtD,CAAC,CAAA;IACN,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,UAAU,CAAC,OAAqF;QAC3G,MAAM,EAAE,YAAY,E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C,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAChD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,aAAa,CAAC,OAAiC;QAC1D,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAA;QAChC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;QACxF,UAAU,CAAC,WAAW,EAAE,CAAA;QAExB,MAAM,OAAO,GAAG,IAAI,CAAC,wBAAwB,CAAC,mBAAmB,EAAE,CAAA;QAEnE,MAAM,QAAQ,GAAG,IAAI,6BAA6B,CAAC,OAAO,EAAE;YAC1D,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,UAAU;SACX,CAAC,CAAA;QACF,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAChD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,uCAAuC,CAClD,YAAoB;QAEpB,OAAO,IAAI,CAAC,wBAAwB,CAAC,uCAAuC,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;IAC/G,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,wCAAwC,CAAC,YAAoB;QACxE,OAAO,IAAI,CAAC,wBAAwB,CAAC,wCAAwC,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;IAChH,CAAC;CACF,CAAA;AAhHY,8BAA8B;IAD1C,UAAU,EAAE;qCAQM,oBAAoB;QACT,kCAAkC;QACzC,wBAAwB;QAC7B,YAAY;GAVjB,8BAA8B,CAgH1C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm';
|
|
2
|
+
import { DidCommPushNotificationsFcmGetDeviceInfoMessage } from '../messages/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Handler for incoming push notification device info messages
|
|
5
|
+
*/
|
|
6
|
+
export declare class DidCommPushNotificationsFcmGetDeviceInfoHandler implements DidCommMessageHandler {
|
|
7
|
+
supportedMessages: (typeof DidCommPushNotificationsFcmGetDeviceInfoMessage)[];
|
|
8
|
+
/**
|
|
9
|
+
/* We don't really need to do anything with this at the moment
|
|
10
|
+
/* The result can be hooked into through the generic message processed event
|
|
11
|
+
*/
|
|
12
|
+
handle(inboundMessage: DidCommMessageHandlerInboundMessage<DidCommPushNotificationsFcmGetDeviceInfoHandler>): Promise<undefined>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DidCommPushNotificationsFcmGetDeviceInfoMessage } from '../messages/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handler for incoming push notification device info messages
|
|
4
|
+
*/
|
|
5
|
+
export class DidCommPushNotificationsFcmGetDeviceInfoHandler {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.supportedMessages = [DidCommPushNotificationsFcmGetDeviceInfoMessage];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
/* We don't really need to do anything with this at the moment
|
|
11
|
+
/* The result can be hooked into through the generic message processed event
|
|
12
|
+
*/
|
|
13
|
+
async handle(inboundMessage) {
|
|
14
|
+
inboundMessage.assertReadyConnection();
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=DidCommPushNotificationsFcmGetDeviceInfoHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DidCommPushNotificationsFcmGetDeviceInfoHandler.js","sourceRoot":"","sources":["../../../src/fcm/handlers/DidCommPushNotificationsFcmGetDeviceInfoHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,+CAA+C,EAAE,MAAM,sBAAsB,CAAA;AAEtF;;GAEG;AACH,MAAM,OAAO,+CAA+C;IAA5D;QACS,sBAAiB,GAAG,CAAC,+CAA+C,CAAC,CAAA;IAY9E,CAAC;IAVC;;;OAGG;IACI,KAAK,CAAC,MAAM,CACjB,cAAoG;QAEpG,cAAc,CAAC,qBAAqB,EAAE,CAAA;QACtC,OAAO,SAAS,CAAA;IAClB,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { DidCommPushNotificationsFcmDeviceInfoHandler } from './DidCommPushNotificationsFcmDeviceInfoHandler.js';
|
|
2
|
+
export { DidCommPushNotificationsFcmGetDeviceInfoHandler } from './DidCommPushNotificationsFcmGetDeviceInfoHandler.js';
|
|
2
3
|
export { DidCommPushNotificationsFcmProblemReportHandler } from './DidCommPushNotificationsFcmProblemReportHandler.js';
|
|
3
4
|
export { DidCommPushNotificationsFcmSetDeviceInfoHandler } from './DidCommPushNotificationsFcmSetDeviceInfoHandler.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { DidCommPushNotificationsFcmDeviceInfoHandler } from './DidCommPushNotificationsFcmDeviceInfoHandler.js';
|
|
2
|
+
export { DidCommPushNotificationsFcmGetDeviceInfoHandler } from './DidCommPushNotificationsFcmGetDeviceInfoHandler.js';
|
|
2
3
|
export { DidCommPushNotificationsFcmProblemReportHandler } from './DidCommPushNotificationsFcmProblemReportHandler.js';
|
|
3
4
|
export { DidCommPushNotificationsFcmSetDeviceInfoHandler } from './DidCommPushNotificationsFcmSetDeviceInfoHandler.js';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fcm/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4CAA4C,EAAE,MAAM,mDAAmD,CAAA;AAChH,OAAO,EAAE,+CAA+C,EAAE,MAAM,sDAAsD,CAAA;AACtH,OAAO,EAAE,+CAA+C,EAAE,MAAM,sDAAsD,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fcm/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4CAA4C,EAAE,MAAM,mDAAmD,CAAA;AAChH,OAAO,EAAE,+CAA+C,EAAE,MAAM,sDAAsD,CAAA;AACtH,OAAO,EAAE,+CAA+C,EAAE,MAAM,sDAAsD,CAAA;AACtH,OAAO,EAAE,+CAA+C,EAAE,MAAM,sDAAsD,CAAA"}
|