@credo-ts/didcomm-push-notifications 0.0.1 → 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/build/fcm/index.d.ts +2 -2
- package/build/fcm/index.js +2 -2
- package/build/fcm/index.js.map +1 -1
- package/package.json +1 -1
- package/build/fcm/PushNotificationsFcmApi.d.ts +0 -40
- package/build/fcm/PushNotificationsFcmApi.js +0 -75
- package/build/fcm/PushNotificationsFcmApi.js.map +0 -1
- package/build/fcm/PushNotificationsFcmModule.d.ts +0 -10
- package/build/fcm/PushNotificationsFcmModule.js +0 -31
- package/build/fcm/PushNotificationsFcmModule.js.map +0 -1
- package/build/fcm/errors/PushNotificationsFcmProblemReportError.d.ts +0 -19
- package/build/fcm/errors/PushNotificationsFcmProblemReportError.js +0 -18
- package/build/fcm/errors/PushNotificationsFcmProblemReportError.js.map +0 -1
- package/build/fcm/errors/PushNotificationsFcmProblemReportReason.d.ts +0 -11
- package/build/fcm/errors/PushNotificationsFcmProblemReportReason.js +0 -13
- package/build/fcm/errors/PushNotificationsFcmProblemReportReason.js.map +0 -1
- package/build/fcm/handlers/PushNotificationsFcmDeviceInfoHandler.d.ts +0 -13
- package/build/fcm/handlers/PushNotificationsFcmDeviceInfoHandler.js +0 -18
- package/build/fcm/handlers/PushNotificationsFcmDeviceInfoHandler.js.map +0 -1
- package/build/fcm/handlers/PushNotificationsFcmProblemReportHandler.d.ts +0 -13
- package/build/fcm/handlers/PushNotificationsFcmProblemReportHandler.js +0 -18
- package/build/fcm/handlers/PushNotificationsFcmProblemReportHandler.js.map +0 -1
- package/build/fcm/handlers/PushNotificationsFcmSetDeviceInfoHandler.d.ts +0 -17
- package/build/fcm/handlers/PushNotificationsFcmSetDeviceInfoHandler.js +0 -20
- package/build/fcm/handlers/PushNotificationsFcmSetDeviceInfoHandler.js.map +0 -1
- package/build/fcm/messages/PushNotificationsFcmDeviceInfoMessage.d.ts +0 -20
- package/build/fcm/messages/PushNotificationsFcmDeviceInfoMessage.js +0 -48
- package/build/fcm/messages/PushNotificationsFcmDeviceInfoMessage.js.map +0 -1
- package/build/fcm/messages/PushNotificationsFcmGetDeviceInfoMessage.d.ts +0 -15
- package/build/fcm/messages/PushNotificationsFcmGetDeviceInfoMessage.js +0 -30
- package/build/fcm/messages/PushNotificationsFcmGetDeviceInfoMessage.js.map +0 -1
- package/build/fcm/messages/PushNotificationsFcmProblemReportMessage.d.ts +0 -11
- package/build/fcm/messages/PushNotificationsFcmProblemReportMessage.js +0 -26
- package/build/fcm/messages/PushNotificationsFcmProblemReportMessage.js.map +0 -1
- package/build/fcm/messages/PushNotificationsFcmSetDeviceInfoMessage.d.ts +0 -18
- package/build/fcm/messages/PushNotificationsFcmSetDeviceInfoMessage.js +0 -46
- package/build/fcm/messages/PushNotificationsFcmSetDeviceInfoMessage.js.map +0 -1
- package/build/fcm/models/FcmDeviceInfo.d.ts +0 -4
- package/build/fcm/models/FcmDeviceInfo.js +0 -2
- package/build/fcm/models/FcmDeviceInfo.js.map +0 -1
- package/build/fcm/models/PushNotificationsFcmRole.d.ts +0 -10
- package/build/fcm/models/PushNotificationsFcmRole.js +0 -12
- package/build/fcm/models/PushNotificationsFcmRole.js.map +0 -1
- package/build/fcm/repository/PushNotificationsFcmRecord.d.ts +0 -26
- package/build/fcm/repository/PushNotificationsFcmRecord.js +0 -23
- package/build/fcm/repository/PushNotificationsFcmRecord.js.map +0 -1
- package/build/fcm/repository/PushNotificationsFcmRepository.d.ts +0 -5
- package/build/fcm/repository/PushNotificationsFcmRepository.js +0 -26
- package/build/fcm/repository/PushNotificationsFcmRepository.js.map +0 -1
- package/build/fcm/services/PushNotificationsFcmService.d.ts +0 -19
- package/build/fcm/services/PushNotificationsFcmService.js +0 -93
- package/build/fcm/services/PushNotificationsFcmService.js.map +0 -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
|
-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,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"}
|
package/build/fcm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { DidCommPushNotificationsFcmApi
|
|
2
|
-
export { DidCommPushNotificationsFcmModule
|
|
1
|
+
export { DidCommPushNotificationsFcmApi } from './DidCommPushNotificationsFcmApi.js';
|
|
2
|
+
export { DidCommPushNotificationsFcmModule } from './DidCommPushNotificationsFcmModule.js';
|
|
3
3
|
export * from './messages/index.js';
|
|
4
4
|
export * from './models/index.js';
|
|
5
5
|
export * from './repository/index.js';
|
package/build/fcm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { DidCommPushNotificationsFcmApi
|
|
2
|
-
export { DidCommPushNotificationsFcmModule
|
|
1
|
+
export { DidCommPushNotificationsFcmApi } from './DidCommPushNotificationsFcmApi.js';
|
|
2
|
+
export { DidCommPushNotificationsFcmModule } from './DidCommPushNotificationsFcmModule.js';
|
|
3
3
|
export * from './messages/index.js';
|
|
4
4
|
export * from './models/index.js';
|
|
5
5
|
export * from './repository/index.js';
|
package/build/fcm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fcm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fcm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAA;AACpF,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAA;AAC1F,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { AgentContext } from '@credo-ts/core';
|
|
2
|
-
import { DidCommConnectionService, DidCommMessageSender } from '@credo-ts/didcomm';
|
|
3
|
-
import type { FcmDeviceInfo } from './models/index.js';
|
|
4
|
-
import { PushNotificationsFcmRecord } from './repository/PushNotificationsFcmRecord.js';
|
|
5
|
-
import { PushNotificationsFcmService } from './services/PushNotificationsFcmService.js';
|
|
6
|
-
export declare class PushNotificationsFcmApi {
|
|
7
|
-
private messageSender;
|
|
8
|
-
private pushNotificationsService;
|
|
9
|
-
private connectionService;
|
|
10
|
-
private agentContext;
|
|
11
|
-
constructor(messageSender: DidCommMessageSender, pushNotificationsService: PushNotificationsFcmService, connectionService: DidCommConnectionService, agentContext: AgentContext);
|
|
12
|
-
/**
|
|
13
|
-
* Sends the requested fcm device info (token) to another agent via a `connectionId`
|
|
14
|
-
* Response for `push-notifications-fcm/get-device-info`
|
|
15
|
-
*
|
|
16
|
-
* @param connectionId The connection ID string
|
|
17
|
-
* @param threadId get-device-info message ID
|
|
18
|
-
* @param deviceInfo The FCM device info
|
|
19
|
-
* @returns Promise<void>
|
|
20
|
-
*/
|
|
21
|
-
deviceInfo(options: {
|
|
22
|
-
connectionId: string;
|
|
23
|
-
threadId: string;
|
|
24
|
-
deviceInfo: FcmDeviceInfo;
|
|
25
|
-
}): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Get push notification record by `connectionId`
|
|
28
|
-
*
|
|
29
|
-
* @param connectionId The connection ID string
|
|
30
|
-
* @returns Promise<PushNotificationsFcmRecord>
|
|
31
|
-
*/
|
|
32
|
-
getPushNotificationRecordByConnectionId(connectionId: string): Promise<PushNotificationsFcmRecord>;
|
|
33
|
-
/**
|
|
34
|
-
* Find push notification record by `connectionId`
|
|
35
|
-
*
|
|
36
|
-
* @param connectionId The connection ID string
|
|
37
|
-
* @returns Promise<PushNotificationsFcmRecord | null>
|
|
38
|
-
*/
|
|
39
|
-
findPushNotificationRecordByConnectionId(connectionId: string): Promise<PushNotificationsFcmRecord | null>;
|
|
40
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { AgentContext, injectable } from '@credo-ts/core';
|
|
11
|
-
import { DidCommConnectionService, DidCommMessageHandlerRegistry, DidCommMessageSender, DidCommOutboundMessageContext, } from '@credo-ts/didcomm';
|
|
12
|
-
import { PushNotificationsFcmDeviceInfoHandler, PushNotificationsFcmProblemReportHandler, PushNotificationsFcmSetDeviceInfoHandler, } from './handlers/index.js';
|
|
13
|
-
import { PushNotificationsFcmService } from './services/PushNotificationsFcmService.js';
|
|
14
|
-
let PushNotificationsFcmApi = class PushNotificationsFcmApi {
|
|
15
|
-
constructor(messageSender, pushNotificationsService, connectionService, agentContext) {
|
|
16
|
-
this.messageSender = messageSender;
|
|
17
|
-
this.pushNotificationsService = pushNotificationsService;
|
|
18
|
-
this.connectionService = connectionService;
|
|
19
|
-
this.agentContext = agentContext;
|
|
20
|
-
this.agentContext
|
|
21
|
-
.resolve(DidCommMessageHandlerRegistry)
|
|
22
|
-
.registerMessageHandlers([
|
|
23
|
-
new PushNotificationsFcmSetDeviceInfoHandler(this.pushNotificationsService),
|
|
24
|
-
new PushNotificationsFcmDeviceInfoHandler(),
|
|
25
|
-
new PushNotificationsFcmProblemReportHandler(),
|
|
26
|
-
]);
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Sends the requested fcm device info (token) to another agent via a `connectionId`
|
|
30
|
-
* Response for `push-notifications-fcm/get-device-info`
|
|
31
|
-
*
|
|
32
|
-
* @param connectionId The connection ID string
|
|
33
|
-
* @param threadId get-device-info message ID
|
|
34
|
-
* @param deviceInfo The FCM device info
|
|
35
|
-
* @returns Promise<void>
|
|
36
|
-
*/
|
|
37
|
-
async deviceInfo(options) {
|
|
38
|
-
const { connectionId, threadId, deviceInfo } = options;
|
|
39
|
-
const connection = await this.connectionService.getById(this.agentContext, connectionId);
|
|
40
|
-
connection.assertReady();
|
|
41
|
-
const message = this.pushNotificationsService.createDeviceInfo({ threadId, deviceInfo });
|
|
42
|
-
const outbound = new DidCommOutboundMessageContext(message, {
|
|
43
|
-
agentContext: this.agentContext,
|
|
44
|
-
connection: connection,
|
|
45
|
-
});
|
|
46
|
-
await this.messageSender.sendMessage(outbound);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Get push notification record by `connectionId`
|
|
50
|
-
*
|
|
51
|
-
* @param connectionId The connection ID string
|
|
52
|
-
* @returns Promise<PushNotificationsFcmRecord>
|
|
53
|
-
*/
|
|
54
|
-
async getPushNotificationRecordByConnectionId(connectionId) {
|
|
55
|
-
return this.pushNotificationsService.getPushNotificationRecordByConnectionId(this.agentContext, connectionId);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Find push notification record by `connectionId`
|
|
59
|
-
*
|
|
60
|
-
* @param connectionId The connection ID string
|
|
61
|
-
* @returns Promise<PushNotificationsFcmRecord | null>
|
|
62
|
-
*/
|
|
63
|
-
async findPushNotificationRecordByConnectionId(connectionId) {
|
|
64
|
-
return this.pushNotificationsService.findPushNotificationRecordByConnectionId(this.agentContext, connectionId);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
PushNotificationsFcmApi = __decorate([
|
|
68
|
-
injectable(),
|
|
69
|
-
__metadata("design:paramtypes", [DidCommMessageSender,
|
|
70
|
-
PushNotificationsFcmService,
|
|
71
|
-
DidCommConnectionService,
|
|
72
|
-
AgentContext])
|
|
73
|
-
], PushNotificationsFcmApi);
|
|
74
|
-
export { PushNotificationsFcmApi };
|
|
75
|
-
//# sourceMappingURL=PushNotificationsFcmApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmApi.js","sourceRoot":"","sources":["../../src/fcm/PushNotificationsFcmApi.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,qCAAqC,EACrC,wCAAwC,EACxC,wCAAwC,GACzC,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAA;AAGhF,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAMlC,YACE,aAAmC,EACnC,wBAAqD,EACrD,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,wCAAwC,CAAC,IAAI,CAAC,wBAAwB,CAAC;YAC3E,IAAI,qCAAqC,EAAE;YAC3C,IAAI,wCAAwC,EAAE;SAC/C,CAAC,CAAA;IACN,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,UAAU,CAAC,OAA8E;QACpG,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;QACtD,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,gBAAgB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAA;QAExF,MAAM,QAAQ,GAAG,IAAI,6BAA6B,CAAC,OAAO,EAAE;YAC1D,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,UAAU,EAAE,UAAU;SACvB,CAAC,CAAA;QACF,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAChD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,uCAAuC,CAAC,YAAoB;QACvE,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;AApEY,uBAAuB;IADnC,UAAU,EAAE;qCAQM,oBAAoB;QACT,2BAA2B;QAClC,wBAAwB;QAC7B,YAAY;GAVjB,uBAAuB,CAoEnC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AgentContext, DependencyManager, Module } from '@credo-ts/core';
|
|
2
|
-
import { PushNotificationsFcmApi } from './PushNotificationsFcmApi.js';
|
|
3
|
-
/**
|
|
4
|
-
* Module that exposes push notification get and set functionality
|
|
5
|
-
*/
|
|
6
|
-
export declare class PushNotificationsFcmModule implements Module {
|
|
7
|
-
readonly api: typeof PushNotificationsFcmApi;
|
|
8
|
-
register(dependencyManager: DependencyManager): void;
|
|
9
|
-
initialize(agentContext: AgentContext): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { DidCommFeatureRegistry, DidCommProtocol } from '@credo-ts/didcomm';
|
|
2
|
-
import { PushNotificationsFcmRole } from './models/index.js';
|
|
3
|
-
import { PushNotificationsFcmApi } from './PushNotificationsFcmApi.js';
|
|
4
|
-
import { PushNotificationsFcmRepository } from './repository/index.js';
|
|
5
|
-
import { PushNotificationsFcmService } from './services/PushNotificationsFcmService.js';
|
|
6
|
-
/**
|
|
7
|
-
* Module that exposes push notification get and set functionality
|
|
8
|
-
*/
|
|
9
|
-
export class PushNotificationsFcmModule {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.api = PushNotificationsFcmApi;
|
|
12
|
-
}
|
|
13
|
-
register(dependencyManager) {
|
|
14
|
-
// Api
|
|
15
|
-
dependencyManager.registerContextScoped(PushNotificationsFcmApi);
|
|
16
|
-
// Services
|
|
17
|
-
dependencyManager.registerSingleton(PushNotificationsFcmService);
|
|
18
|
-
// Repository
|
|
19
|
-
dependencyManager.registerSingleton(PushNotificationsFcmRepository);
|
|
20
|
-
}
|
|
21
|
-
async initialize(agentContext) {
|
|
22
|
-
// Feature Registry
|
|
23
|
-
const featureRegistry = agentContext.dependencyManager.resolve(DidCommFeatureRegistry);
|
|
24
|
-
// Feature Registry
|
|
25
|
-
featureRegistry.register(new DidCommProtocol({
|
|
26
|
-
id: 'https://didcomm.org/push-notifications-fcm/1.0',
|
|
27
|
-
roles: [PushNotificationsFcmRole.Sender, PushNotificationsFcmRole.Receiver],
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=PushNotificationsFcmModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmModule.js","sourceRoot":"","sources":["../../src/fcm/PushNotificationsFcmModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAA;AAEvF;;GAEG;AACH,MAAM,OAAO,0BAA0B;IAAvC;QACkB,QAAG,GAAG,uBAAuB,CAAA;IAyB/C,CAAC;IAvBQ,QAAQ,CAAC,iBAAoC;QAClD,MAAM;QACN,iBAAiB,CAAC,qBAAqB,CAAC,uBAAuB,CAAC,CAAA;QAEhE,WAAW;QACX,iBAAiB,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,CAAA;QAEhE,aAAa;QACb,iBAAiB,CAAC,iBAAiB,CAAC,8BAA8B,CAAC,CAAA;IACrE,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,YAA0B;QAChD,mBAAmB;QACnB,MAAM,eAAe,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAA;QAEtF,mBAAmB;QACnB,eAAe,CAAC,QAAQ,CACtB,IAAI,eAAe,CAAC;YAClB,EAAE,EAAE,gDAAgD;YACpD,KAAK,EAAE,CAAC,wBAAwB,CAAC,MAAM,EAAE,wBAAwB,CAAC,QAAQ,CAAC;SAC5E,CAAC,CACH,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { DidCommProblemReportErrorOptions } from '@credo-ts/didcomm';
|
|
2
|
-
import { DidCommProblemReportError } from '@credo-ts/didcomm';
|
|
3
|
-
import { PushNotificationsFcmProblemReportMessage } from '../messages/index.js';
|
|
4
|
-
import type { PushNotificationsFcmProblemReportReason } from './PushNotificationsFcmProblemReportReason.js';
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
interface PushNotificationsFcmProblemReportErrorOptions extends DidCommProblemReportErrorOptions {
|
|
9
|
-
problemCode: PushNotificationsFcmProblemReportReason;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export declare class PushNotificationsFcmProblemReportError extends DidCommProblemReportError {
|
|
15
|
-
message: string;
|
|
16
|
-
problemReport: PushNotificationsFcmProblemReportMessage;
|
|
17
|
-
constructor(message: string, { problemCode }: PushNotificationsFcmProblemReportErrorOptions);
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DidCommProblemReportError } from '@credo-ts/didcomm';
|
|
2
|
-
import { PushNotificationsFcmProblemReportMessage } from '../messages/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export class PushNotificationsFcmProblemReportError extends DidCommProblemReportError {
|
|
7
|
-
constructor(message, { problemCode }) {
|
|
8
|
-
super(message, { problemCode });
|
|
9
|
-
this.message = message;
|
|
10
|
-
this.problemReport = new PushNotificationsFcmProblemReportMessage({
|
|
11
|
-
description: {
|
|
12
|
-
en: message,
|
|
13
|
-
code: problemCode,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=PushNotificationsFcmProblemReportError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmProblemReportError.js","sourceRoot":"","sources":["../../../src/fcm/errors/PushNotificationsFcmProblemReportError.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAC7D,OAAO,EAAE,wCAAwC,EAAE,MAAM,sBAAsB,CAAA;AAU/E;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,yBAAyB;IAGnF,YACS,OAAe,EACtB,EAAE,WAAW,EAAiD;QAE9D,KAAK,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,CAAC,CAAA;QAHxB,YAAO,GAAP,OAAO,CAAQ;QAItB,IAAI,CAAC,aAAa,GAAG,IAAI,wCAAwC,CAAC;YAChE,WAAW,EAAE;gBACX,EAAE,EAAE,OAAO;gBACX,IAAI,EAAE,WAAW;aAClB;SACF,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Push Notification FCM errors discussed in RFC 0734.
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#set-device-info
|
|
5
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#device-info
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare enum PushNotificationsFcmProblemReportReason {
|
|
9
|
-
MissingValue = "missing-value",
|
|
10
|
-
NotRegistered = "not-registered-for-push-notifications"
|
|
11
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Push Notification FCM errors discussed in RFC 0734.
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#set-device-info
|
|
5
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#device-info
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export var PushNotificationsFcmProblemReportReason;
|
|
9
|
-
(function (PushNotificationsFcmProblemReportReason) {
|
|
10
|
-
PushNotificationsFcmProblemReportReason["MissingValue"] = "missing-value";
|
|
11
|
-
PushNotificationsFcmProblemReportReason["NotRegistered"] = "not-registered-for-push-notifications";
|
|
12
|
-
})(PushNotificationsFcmProblemReportReason || (PushNotificationsFcmProblemReportReason = {}));
|
|
13
|
-
//# sourceMappingURL=PushNotificationsFcmProblemReportReason.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmProblemReportReason.js","sourceRoot":"","sources":["../../../src/fcm/errors/PushNotificationsFcmProblemReportReason.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,uCAGX;AAHD,WAAY,uCAAuC;IACjD,yEAA8B,CAAA;IAC9B,kGAAuD,CAAA;AACzD,CAAC,EAHW,uCAAuC,KAAvC,uCAAuC,QAGlD"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm';
|
|
2
|
-
import { PushNotificationsFcmDeviceInfoMessage } from '../messages/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Handler for incoming fcm push notification device info messages
|
|
5
|
-
*/
|
|
6
|
-
export declare class PushNotificationsFcmDeviceInfoHandler implements DidCommMessageHandler {
|
|
7
|
-
supportedMessages: (typeof PushNotificationsFcmDeviceInfoMessage)[];
|
|
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<PushNotificationsFcmDeviceInfoHandler>): Promise<undefined>;
|
|
13
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { PushNotificationsFcmDeviceInfoMessage } from '../messages/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Handler for incoming fcm push notification device info messages
|
|
4
|
-
*/
|
|
5
|
-
export class PushNotificationsFcmDeviceInfoHandler {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.supportedMessages = [PushNotificationsFcmDeviceInfoMessage];
|
|
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=PushNotificationsFcmDeviceInfoHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmDeviceInfoHandler.js","sourceRoot":"","sources":["../../../src/fcm/handlers/PushNotificationsFcmDeviceInfoHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qCAAqC,EAAE,MAAM,sBAAsB,CAAA;AAE5E;;GAEG;AACH,MAAM,OAAO,qCAAqC;IAAlD;QACS,sBAAiB,GAAG,CAAC,qCAAqC,CAAC,CAAA;IAUpE,CAAC;IARC;;;OAGG;IACI,KAAK,CAAC,MAAM,CAAC,cAA0F;QAC5G,cAAc,CAAC,qBAAqB,EAAE,CAAA;QACtC,OAAO,SAAS,CAAA;IAClB,CAAC;CACF"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm';
|
|
2
|
-
import { PushNotificationsFcmProblemReportMessage } from '../messages/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Handler for incoming push notification problem report messages
|
|
5
|
-
*/
|
|
6
|
-
export declare class PushNotificationsFcmProblemReportHandler implements DidCommMessageHandler {
|
|
7
|
-
supportedMessages: (typeof PushNotificationsFcmProblemReportMessage)[];
|
|
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<PushNotificationsFcmProblemReportHandler>): Promise<undefined>;
|
|
13
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { PushNotificationsFcmProblemReportMessage } from '../messages/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Handler for incoming push notification problem report messages
|
|
4
|
-
*/
|
|
5
|
-
export class PushNotificationsFcmProblemReportHandler {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.supportedMessages = [PushNotificationsFcmProblemReportMessage];
|
|
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=PushNotificationsFcmProblemReportHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmProblemReportHandler.js","sourceRoot":"","sources":["../../../src/fcm/handlers/PushNotificationsFcmProblemReportHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wCAAwC,EAAE,MAAM,sBAAsB,CAAA;AAE/E;;GAEG;AACH,MAAM,OAAO,wCAAwC;IAArD;QACS,sBAAiB,GAAG,CAAC,wCAAwC,CAAC,CAAA;IAUvE,CAAC;IARC;;;OAGG;IACI,KAAK,CAAC,MAAM,CAAC,cAA6F;QAC/G,cAAc,CAAC,qBAAqB,EAAE,CAAA;QACtC,OAAO,SAAS,CAAA;IAClB,CAAC;CACF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { DidCommMessageHandler, DidCommMessageHandlerInboundMessage } from '@credo-ts/didcomm';
|
|
2
|
-
import { PushNotificationsFcmSetDeviceInfoMessage } from '../messages/index.js';
|
|
3
|
-
import type { PushNotificationsFcmService } from '../services/PushNotificationsFcmService.js';
|
|
4
|
-
/**
|
|
5
|
-
* Handler for incoming push notification device info messages
|
|
6
|
-
*/
|
|
7
|
-
export declare class PushNotificationsFcmSetDeviceInfoHandler implements DidCommMessageHandler {
|
|
8
|
-
private pushNotificationsFcmService;
|
|
9
|
-
supportedMessages: (typeof PushNotificationsFcmSetDeviceInfoMessage)[];
|
|
10
|
-
constructor(pushNotificationsFcmService: PushNotificationsFcmService);
|
|
11
|
-
/**
|
|
12
|
-
/* Only perform checks about message fields
|
|
13
|
-
/*
|
|
14
|
-
/* The result can be hooked into through the generic message processed event
|
|
15
|
-
*/
|
|
16
|
-
handle(inboundMessage: DidCommMessageHandlerInboundMessage<PushNotificationsFcmSetDeviceInfoHandler>): Promise<undefined>;
|
|
17
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PushNotificationsFcmSetDeviceInfoMessage } from '../messages/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Handler for incoming push notification device info messages
|
|
4
|
-
*/
|
|
5
|
-
export class PushNotificationsFcmSetDeviceInfoHandler {
|
|
6
|
-
constructor(pushNotificationsFcmService) {
|
|
7
|
-
this.supportedMessages = [PushNotificationsFcmSetDeviceInfoMessage];
|
|
8
|
-
this.pushNotificationsFcmService = pushNotificationsFcmService;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
/* Only perform checks about message fields
|
|
12
|
-
/*
|
|
13
|
-
/* The result can be hooked into through the generic message processed event
|
|
14
|
-
*/
|
|
15
|
-
async handle(inboundMessage) {
|
|
16
|
-
await this.pushNotificationsFcmService.processSetDeviceInfo(inboundMessage);
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=PushNotificationsFcmSetDeviceInfoHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmSetDeviceInfoHandler.js","sourceRoot":"","sources":["../../../src/fcm/handlers/PushNotificationsFcmSetDeviceInfoHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wCAAwC,EAAE,MAAM,sBAAsB,CAAA;AAG/E;;GAEG;AACH,MAAM,OAAO,wCAAwC;IAInD,YAAmB,2BAAwD;QAFpE,sBAAiB,GAAG,CAAC,wCAAwC,CAAC,CAAA;QAGnE,IAAI,CAAC,2BAA2B,GAAG,2BAA2B,CAAA;IAChE,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,cAA6F;QAC/G,MAAM,IAAI,CAAC,2BAA2B,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAA;QAC3E,OAAO,SAAS,CAAA;IAClB,CAAC;CACF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { DidCommMessage } from '@credo-ts/didcomm';
|
|
2
|
-
import type { FcmDeviceInfo } from '../models/index.js';
|
|
3
|
-
interface PushNotificationsFcmDeviceInfoOptions extends FcmDeviceInfo {
|
|
4
|
-
id?: string;
|
|
5
|
-
threadId: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Message to send the fcm device information from another agent for push notifications
|
|
9
|
-
* This is used as a response for the `get-device-info` message
|
|
10
|
-
*
|
|
11
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#device-info
|
|
12
|
-
*/
|
|
13
|
-
export declare class PushNotificationsFcmDeviceInfoMessage extends DidCommMessage {
|
|
14
|
-
constructor(options: PushNotificationsFcmDeviceInfoOptions);
|
|
15
|
-
deviceToken: string | null;
|
|
16
|
-
devicePlatform: string | null;
|
|
17
|
-
static readonly type: import("@credo-ts/didcomm").ParsedMessageType;
|
|
18
|
-
readonly type: string;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { DidCommMessage, IsValidMessageType, parseMessageType } from '@credo-ts/didcomm';
|
|
11
|
-
import { Expose } from 'class-transformer';
|
|
12
|
-
import { IsString, ValidateIf } from 'class-validator';
|
|
13
|
-
/**
|
|
14
|
-
* Message to send the fcm device information from another agent for push notifications
|
|
15
|
-
* This is used as a response for the `get-device-info` message
|
|
16
|
-
*
|
|
17
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#device-info
|
|
18
|
-
*/
|
|
19
|
-
export class PushNotificationsFcmDeviceInfoMessage extends DidCommMessage {
|
|
20
|
-
constructor(options) {
|
|
21
|
-
super();
|
|
22
|
-
this.type = PushNotificationsFcmDeviceInfoMessage.type.messageTypeUri;
|
|
23
|
-
if (options) {
|
|
24
|
-
this.id = options.id ?? this.generateId();
|
|
25
|
-
this.setThread({ threadId: options.threadId });
|
|
26
|
-
this.deviceToken = options.deviceToken;
|
|
27
|
-
this.devicePlatform = options.devicePlatform;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
PushNotificationsFcmDeviceInfoMessage.type = parseMessageType('https://didcomm.org/push-notifications-fcm/1.0/device-info');
|
|
32
|
-
__decorate([
|
|
33
|
-
Expose({ name: 'device_token' }),
|
|
34
|
-
IsString(),
|
|
35
|
-
ValidateIf((_, value) => value !== null),
|
|
36
|
-
__metadata("design:type", Object)
|
|
37
|
-
], PushNotificationsFcmDeviceInfoMessage.prototype, "deviceToken", void 0);
|
|
38
|
-
__decorate([
|
|
39
|
-
Expose({ name: 'device_platform' }),
|
|
40
|
-
IsString(),
|
|
41
|
-
ValidateIf((_, value) => value !== null),
|
|
42
|
-
__metadata("design:type", Object)
|
|
43
|
-
], PushNotificationsFcmDeviceInfoMessage.prototype, "devicePlatform", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
IsValidMessageType(PushNotificationsFcmDeviceInfoMessage.type),
|
|
46
|
-
__metadata("design:type", Object)
|
|
47
|
-
], PushNotificationsFcmDeviceInfoMessage.prototype, "type", void 0);
|
|
48
|
-
//# sourceMappingURL=PushNotificationsFcmDeviceInfoMessage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmDeviceInfoMessage.js","sourceRoot":"","sources":["../../../src/fcm/messages/PushNotificationsFcmDeviceInfoMessage.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAQtD;;;;;GAKG;AACH,MAAM,OAAO,qCAAsC,SAAQ,cAAc;IACvE,YAAmB,OAA8C;QAC/D,KAAK,EAAE,CAAA;QAuBO,SAAI,GAAG,qCAAqC,CAAC,IAAI,CAAC,cAAc,CAAA;QArB9E,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAA;YACzC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;YAC9C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;YACtC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;QAC9C,CAAC;IACH,CAAC;;AAYsB,0CAAI,GAAG,gBAAgB,CAAC,4DAA4D,CAAC,AAAjF,CAAiF;AAPrG;IAHN,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAChC,QAAQ,EAAE;IACV,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;;0EACP;AAK3B;IAHN,MAAM,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;IACnC,QAAQ,EAAE;IACV,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;;6EACJ;AAKrB;IADf,kBAAkB,CAAC,qCAAqC,CAAC,IAAI,CAAC;;mEACiB"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DidCommMessage } from '@credo-ts/didcomm';
|
|
2
|
-
interface PushNotificationsFcmGetDeviceInfoOptions {
|
|
3
|
-
id?: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Message to get fcm the device information from another agent for push notifications
|
|
7
|
-
*
|
|
8
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#get-device-info
|
|
9
|
-
*/
|
|
10
|
-
export declare class PushNotificationsFcmGetDeviceInfoMessage extends DidCommMessage {
|
|
11
|
-
constructor(options: PushNotificationsFcmGetDeviceInfoOptions);
|
|
12
|
-
static readonly type: import("@credo-ts/didcomm").ParsedMessageType;
|
|
13
|
-
readonly type: string;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { DidCommMessage, IsValidMessageType, parseMessageType } from '@credo-ts/didcomm';
|
|
11
|
-
/**
|
|
12
|
-
* Message to get fcm the device information from another agent for push notifications
|
|
13
|
-
*
|
|
14
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#get-device-info
|
|
15
|
-
*/
|
|
16
|
-
export class PushNotificationsFcmGetDeviceInfoMessage extends DidCommMessage {
|
|
17
|
-
constructor(options) {
|
|
18
|
-
super();
|
|
19
|
-
this.type = PushNotificationsFcmGetDeviceInfoMessage.type.messageTypeUri;
|
|
20
|
-
if (options) {
|
|
21
|
-
this.id = options.id ?? this.generateId();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
PushNotificationsFcmGetDeviceInfoMessage.type = parseMessageType('https://didcomm.org/push-notifications-fcm/1.0/get-device-info');
|
|
26
|
-
__decorate([
|
|
27
|
-
IsValidMessageType(PushNotificationsFcmGetDeviceInfoMessage.type),
|
|
28
|
-
__metadata("design:type", Object)
|
|
29
|
-
], PushNotificationsFcmGetDeviceInfoMessage.prototype, "type", void 0);
|
|
30
|
-
//# sourceMappingURL=PushNotificationsFcmGetDeviceInfoMessage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmGetDeviceInfoMessage.js","sourceRoot":"","sources":["../../../src/fcm/messages/PushNotificationsFcmGetDeviceInfoMessage.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAMxF;;;;GAIG;AACH,MAAM,OAAO,wCAAyC,SAAQ,cAAc;IAC1E,YAAmB,OAAiD;QAClE,KAAK,EAAE,CAAA;QASO,SAAI,GAAG,wCAAwC,CAAC,IAAI,CAAC,cAAc,CAAA;QAPjF,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAA;QAC3C,CAAC;IACH,CAAC;;AACsB,6CAAI,GAAG,gBAAgB,CAAC,gEAAgE,CAAC,AAArF,CAAqF;AAGhG;IADf,kBAAkB,CAAC,wCAAwC,CAAC,IAAI,CAAC;;sEACiB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DidCommProblemReportMessageOptions } from '@credo-ts/didcomm';
|
|
2
|
-
import { DidCommProblemReportMessage } from '@credo-ts/didcomm';
|
|
3
|
-
export type PushNotificationsFcmProblemReportMessageOptions = DidCommProblemReportMessageOptions;
|
|
4
|
-
/**
|
|
5
|
-
* @see https://github.com/hyperledger/aries-rfcs/blob/main/features/0035-report-problem/README.md
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare class PushNotificationsFcmProblemReportMessage extends DidCommProblemReportMessage {
|
|
9
|
-
readonly type: string;
|
|
10
|
-
static readonly type: import("@credo-ts/didcomm").ParsedMessageType;
|
|
11
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { DidCommProblemReportMessage, IsValidMessageType, parseMessageType } from '@credo-ts/didcomm';
|
|
11
|
-
/**
|
|
12
|
-
* @see https://github.com/hyperledger/aries-rfcs/blob/main/features/0035-report-problem/README.md
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export class PushNotificationsFcmProblemReportMessage extends DidCommProblemReportMessage {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this.type = PushNotificationsFcmProblemReportMessage.type.messageTypeUri;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
PushNotificationsFcmProblemReportMessage.type = parseMessageType('https://didcomm.org/push-notifications-fcm/1.0/problem-report');
|
|
22
|
-
__decorate([
|
|
23
|
-
IsValidMessageType(PushNotificationsFcmProblemReportMessage.type),
|
|
24
|
-
__metadata("design:type", Object)
|
|
25
|
-
], PushNotificationsFcmProblemReportMessage.prototype, "type", void 0);
|
|
26
|
-
//# sourceMappingURL=PushNotificationsFcmProblemReportMessage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmProblemReportMessage.js","sourceRoot":"","sources":["../../../src/fcm/messages/PushNotificationsFcmProblemReportMessage.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAIrG;;;GAGG;AACH,MAAM,OAAO,wCAAyC,SAAQ,2BAA2B;IAAzF;;QAEkB,SAAI,GAAG,wCAAwC,CAAC,IAAI,CAAC,cAAc,CAAA;IAErF,CAAC;;AADwB,6CAAI,GAAG,gBAAgB,CAAC,+DAA+D,CAAC,AAApF,CAAoF;AAD/F;IADf,kBAAkB,CAAC,wCAAwC,CAAC,IAAI,CAAC;;sEACiB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DidCommMessage } from '@credo-ts/didcomm';
|
|
2
|
-
import type { FcmDeviceInfo } from '../models/index.js';
|
|
3
|
-
interface PushNotificationsFcmSetDeviceInfoOptions extends FcmDeviceInfo {
|
|
4
|
-
id?: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Message to set the fcm device information at another agent for push notifications
|
|
8
|
-
*
|
|
9
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#set-device-info
|
|
10
|
-
*/
|
|
11
|
-
export declare class PushNotificationsFcmSetDeviceInfoMessage extends DidCommMessage {
|
|
12
|
-
constructor(options: PushNotificationsFcmSetDeviceInfoOptions);
|
|
13
|
-
deviceToken: string | null;
|
|
14
|
-
devicePlatform: string | null;
|
|
15
|
-
static readonly type: import("@credo-ts/didcomm").ParsedMessageType;
|
|
16
|
-
readonly type: string;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { DidCommMessage, IsValidMessageType, parseMessageType } from '@credo-ts/didcomm';
|
|
11
|
-
import { Expose } from 'class-transformer';
|
|
12
|
-
import { IsString, ValidateIf } from 'class-validator';
|
|
13
|
-
/**
|
|
14
|
-
* Message to set the fcm device information at another agent for push notifications
|
|
15
|
-
*
|
|
16
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#set-device-info
|
|
17
|
-
*/
|
|
18
|
-
export class PushNotificationsFcmSetDeviceInfoMessage extends DidCommMessage {
|
|
19
|
-
constructor(options) {
|
|
20
|
-
super();
|
|
21
|
-
this.type = PushNotificationsFcmSetDeviceInfoMessage.type.messageTypeUri;
|
|
22
|
-
if (options) {
|
|
23
|
-
this.id = options.id ?? this.generateId();
|
|
24
|
-
this.deviceToken = options.deviceToken;
|
|
25
|
-
this.devicePlatform = options.devicePlatform;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
PushNotificationsFcmSetDeviceInfoMessage.type = parseMessageType('https://didcomm.org/push-notifications-fcm/1.0/set-device-info');
|
|
30
|
-
__decorate([
|
|
31
|
-
Expose({ name: 'device_token' }),
|
|
32
|
-
IsString(),
|
|
33
|
-
ValidateIf((_, value) => value !== null),
|
|
34
|
-
__metadata("design:type", Object)
|
|
35
|
-
], PushNotificationsFcmSetDeviceInfoMessage.prototype, "deviceToken", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
Expose({ name: 'device_platform' }),
|
|
38
|
-
IsString(),
|
|
39
|
-
ValidateIf((_, value) => value !== null),
|
|
40
|
-
__metadata("design:type", Object)
|
|
41
|
-
], PushNotificationsFcmSetDeviceInfoMessage.prototype, "devicePlatform", void 0);
|
|
42
|
-
__decorate([
|
|
43
|
-
IsValidMessageType(PushNotificationsFcmSetDeviceInfoMessage.type),
|
|
44
|
-
__metadata("design:type", Object)
|
|
45
|
-
], PushNotificationsFcmSetDeviceInfoMessage.prototype, "type", void 0);
|
|
46
|
-
//# sourceMappingURL=PushNotificationsFcmSetDeviceInfoMessage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmSetDeviceInfoMessage.js","sourceRoot":"","sources":["../../../src/fcm/messages/PushNotificationsFcmSetDeviceInfoMessage.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAOtD;;;;GAIG;AACH,MAAM,OAAO,wCAAyC,SAAQ,cAAc;IAC1E,YAAmB,OAAiD;QAClE,KAAK,EAAE,CAAA;QAsBO,SAAI,GAAG,wCAAwC,CAAC,IAAI,CAAC,cAAc,CAAA;QApBjF,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAA;YACzC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;YACtC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;QAC9C,CAAC;IACH,CAAC;;AAYsB,6CAAI,GAAG,gBAAgB,CAAC,gEAAgE,CAAC,AAArF,CAAqF;AAPzG;IAHN,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAChC,QAAQ,EAAE;IACV,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;;6EACP;AAK3B;IAHN,MAAM,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;IACnC,QAAQ,EAAE;IACV,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;;gFACJ;AAKrB;IADf,kBAAkB,CAAC,wCAAwC,CAAC,IAAI,CAAC;;sEACiB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FcmDeviceInfo.js","sourceRoot":"","sources":["../../../src/fcm/models/FcmDeviceInfo.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Push Notification FCM roles based on the flow defined in RFC 0734.
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#roles
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare enum PushNotificationsFcmRole {
|
|
8
|
-
Sender = "notification-sender",
|
|
9
|
-
Receiver = "notification-receiver"
|
|
10
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Push Notification FCM roles based on the flow defined in RFC 0734.
|
|
3
|
-
*
|
|
4
|
-
* @see https://github.com/hyperledger/aries-rfcs/tree/main/features/0734-push-notifications-fcm#roles
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export var PushNotificationsFcmRole;
|
|
8
|
-
(function (PushNotificationsFcmRole) {
|
|
9
|
-
PushNotificationsFcmRole["Sender"] = "notification-sender";
|
|
10
|
-
PushNotificationsFcmRole["Receiver"] = "notification-receiver";
|
|
11
|
-
})(PushNotificationsFcmRole || (PushNotificationsFcmRole = {}));
|
|
12
|
-
//# sourceMappingURL=PushNotificationsFcmRole.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmRole.js","sourceRoot":"","sources":["../../../src/fcm/models/PushNotificationsFcmRole.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAClC,0DAA8B,CAAA;IAC9B,8DAAkC,CAAA;AACpC,CAAC,EAHW,wBAAwB,KAAxB,wBAAwB,QAGnC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { TagsBase } from '@credo-ts/core';
|
|
2
|
-
import { BaseRecord } from '@credo-ts/core';
|
|
3
|
-
export type DefaultPushNotificationsFcmTags = {
|
|
4
|
-
connectionId: string;
|
|
5
|
-
};
|
|
6
|
-
export type CustomPushNotificationsFcmTags = TagsBase;
|
|
7
|
-
export interface PushNotificationsFcmStorageProps {
|
|
8
|
-
id?: string;
|
|
9
|
-
deviceToken: string | null;
|
|
10
|
-
devicePlatform: string | null;
|
|
11
|
-
connectionId: string;
|
|
12
|
-
tags?: CustomPushNotificationsFcmTags;
|
|
13
|
-
firebaseProjectId?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare class PushNotificationsFcmRecord extends BaseRecord<DefaultPushNotificationsFcmTags, CustomPushNotificationsFcmTags> {
|
|
16
|
-
deviceToken: string | null;
|
|
17
|
-
devicePlatform: string | null;
|
|
18
|
-
connectionId: string;
|
|
19
|
-
firebaseProjectId?: string;
|
|
20
|
-
static readonly type = "PushNotificationsFcmRecord";
|
|
21
|
-
readonly type = "PushNotificationsFcmRecord";
|
|
22
|
-
constructor(props: PushNotificationsFcmStorageProps);
|
|
23
|
-
getTags(): {
|
|
24
|
-
connectionId: string;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BaseRecord, utils } from '@credo-ts/core';
|
|
2
|
-
export class PushNotificationsFcmRecord extends BaseRecord {
|
|
3
|
-
constructor(props) {
|
|
4
|
-
super();
|
|
5
|
-
this.type = PushNotificationsFcmRecord.type;
|
|
6
|
-
if (props) {
|
|
7
|
-
this.id = props.id ?? utils.uuid();
|
|
8
|
-
this.devicePlatform = props.devicePlatform;
|
|
9
|
-
this.deviceToken = props.deviceToken;
|
|
10
|
-
this.connectionId = props.connectionId;
|
|
11
|
-
this.firebaseProjectId = props.firebaseProjectId;
|
|
12
|
-
this._tags = props.tags ?? {};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
getTags() {
|
|
16
|
-
return {
|
|
17
|
-
...this._tags,
|
|
18
|
-
connectionId: this.connectionId,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
PushNotificationsFcmRecord.type = 'PushNotificationsFcmRecord';
|
|
23
|
-
//# sourceMappingURL=PushNotificationsFcmRecord.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmRecord.js","sourceRoot":"","sources":["../../../src/fcm/repository/PushNotificationsFcmRecord.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAiBlD,MAAM,OAAO,0BAA2B,SAAQ,UAG/C;IAQC,YAAmB,KAAuC;QACxD,KAAK,EAAE,CAAA;QAHO,SAAI,GAAG,0BAA0B,CAAC,IAAI,CAAA;QAKpD,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,IAAI,EAAE,CAAA;YAClC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAA;YAC1C,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAA;YACpC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAA;YACtC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAA;YAChD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE,CAAA;QAC/B,CAAC;IACH,CAAC;IAEM,OAAO;QACZ,OAAO;YACL,GAAG,IAAI,CAAC,KAAK;YACb,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAA;IACH,CAAC;;AArBsB,+BAAI,GAAG,4BAA4B,AAA/B,CAA+B"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { EventEmitter, Repository, type StorageService } from '@credo-ts/core';
|
|
2
|
-
import { PushNotificationsFcmRecord } from './PushNotificationsFcmRecord.js';
|
|
3
|
-
export declare class PushNotificationsFcmRepository extends Repository<PushNotificationsFcmRecord> {
|
|
4
|
-
constructor(storageService: StorageService<PushNotificationsFcmRecord>, eventEmitter: EventEmitter);
|
|
5
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
-
};
|
|
13
|
-
import { EventEmitter, InjectionSymbols, inject, injectable, Repository } from '@credo-ts/core';
|
|
14
|
-
import { PushNotificationsFcmRecord } from './PushNotificationsFcmRecord.js';
|
|
15
|
-
let PushNotificationsFcmRepository = class PushNotificationsFcmRepository extends Repository {
|
|
16
|
-
constructor(storageService, eventEmitter) {
|
|
17
|
-
super(PushNotificationsFcmRecord, storageService, eventEmitter);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
PushNotificationsFcmRepository = __decorate([
|
|
21
|
-
injectable(),
|
|
22
|
-
__param(0, inject(InjectionSymbols.StorageService)),
|
|
23
|
-
__metadata("design:paramtypes", [Object, EventEmitter])
|
|
24
|
-
], PushNotificationsFcmRepository);
|
|
25
|
-
export { PushNotificationsFcmRepository };
|
|
26
|
-
//# sourceMappingURL=PushNotificationsFcmRepository.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmRepository.js","sourceRoot":"","sources":["../../../src/fcm/repository/PushNotificationsFcmRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAuB,MAAM,gBAAgB,CAAA;AAEpH,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAGrE,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,UAAsC;IACxF,YAC2C,cAA0D,EACnG,YAA0B;QAE1B,KAAK,CAAC,0BAA0B,EAAE,cAAc,EAAE,YAAY,CAAC,CAAA;IACjE,CAAC;CACF,CAAA;AAPY,8BAA8B;IAD1C,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAA;6CAC1B,YAAY;GAHjB,8BAA8B,CAO1C"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AgentContext, Logger } from '@credo-ts/core';
|
|
2
|
-
import { DidCommInboundMessageContext } from '@credo-ts/didcomm';
|
|
3
|
-
import { PushNotificationsFcmDeviceInfoMessage, PushNotificationsFcmGetDeviceInfoMessage, PushNotificationsFcmSetDeviceInfoMessage } from '../messages/index.js';
|
|
4
|
-
import type { FcmDeviceInfo } from '../models/FcmDeviceInfo.js';
|
|
5
|
-
import { PushNotificationsFcmRecord, PushNotificationsFcmRepository } from '../repository/index.js';
|
|
6
|
-
export declare class PushNotificationsFcmService {
|
|
7
|
-
private pushNotificationsFcmRepository;
|
|
8
|
-
private logger;
|
|
9
|
-
constructor(pushNotificationsFcmRepository: PushNotificationsFcmRepository, logger: Logger);
|
|
10
|
-
createSetDeviceInfo(deviceInfo: FcmDeviceInfo): PushNotificationsFcmSetDeviceInfoMessage;
|
|
11
|
-
createGetDeviceInfo(): PushNotificationsFcmGetDeviceInfoMessage;
|
|
12
|
-
createDeviceInfo(options: {
|
|
13
|
-
threadId: string;
|
|
14
|
-
deviceInfo: FcmDeviceInfo;
|
|
15
|
-
}): PushNotificationsFcmDeviceInfoMessage;
|
|
16
|
-
processSetDeviceInfo(messageContext: DidCommInboundMessageContext<PushNotificationsFcmSetDeviceInfoMessage>): Promise<void>;
|
|
17
|
-
getPushNotificationRecordByConnectionId(agentContext: AgentContext, connectionId: string): Promise<PushNotificationsFcmRecord>;
|
|
18
|
-
findPushNotificationRecordByConnectionId(agentContext: AgentContext, connectionId: string): Promise<PushNotificationsFcmRecord | null>;
|
|
19
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
-
};
|
|
13
|
-
import { CredoError, InjectionSymbols, inject, injectable } from '@credo-ts/core';
|
|
14
|
-
import { PushNotificationsFcmProblemReportError, PushNotificationsFcmProblemReportReason } from '../errors/index.js';
|
|
15
|
-
import { PushNotificationsFcmDeviceInfoMessage, PushNotificationsFcmGetDeviceInfoMessage, PushNotificationsFcmSetDeviceInfoMessage } from '../messages/index.js';
|
|
16
|
-
import { PushNotificationsFcmRecord, PushNotificationsFcmRepository } from '../repository/index.js';
|
|
17
|
-
let PushNotificationsFcmService = class PushNotificationsFcmService {
|
|
18
|
-
constructor(pushNotificationsFcmRepository, logger) {
|
|
19
|
-
this.pushNotificationsFcmRepository = pushNotificationsFcmRepository;
|
|
20
|
-
this.logger = logger;
|
|
21
|
-
}
|
|
22
|
-
createSetDeviceInfo(deviceInfo) {
|
|
23
|
-
if ((deviceInfo.deviceToken === null && deviceInfo.devicePlatform !== null) ||
|
|
24
|
-
(deviceInfo.deviceToken !== null && deviceInfo.devicePlatform === null))
|
|
25
|
-
throw new CredoError('Both or none of deviceToken and devicePlatform must be null');
|
|
26
|
-
return new PushNotificationsFcmSetDeviceInfoMessage(deviceInfo);
|
|
27
|
-
}
|
|
28
|
-
createGetDeviceInfo() {
|
|
29
|
-
return new PushNotificationsFcmGetDeviceInfoMessage({});
|
|
30
|
-
}
|
|
31
|
-
createDeviceInfo(options) {
|
|
32
|
-
const { threadId, deviceInfo } = options;
|
|
33
|
-
if ((deviceInfo.deviceToken === null && deviceInfo.devicePlatform !== null) ||
|
|
34
|
-
(deviceInfo.deviceToken !== null && deviceInfo.devicePlatform === null))
|
|
35
|
-
throw new CredoError('Both or none of deviceToken and devicePlatform must be null');
|
|
36
|
-
return new PushNotificationsFcmDeviceInfoMessage({
|
|
37
|
-
threadId,
|
|
38
|
-
deviceToken: deviceInfo.deviceToken,
|
|
39
|
-
devicePlatform: deviceInfo.devicePlatform,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
async processSetDeviceInfo(messageContext) {
|
|
43
|
-
const { message, agentContext } = messageContext;
|
|
44
|
-
if ((message.deviceToken === null && message.devicePlatform !== null) ||
|
|
45
|
-
(message.deviceToken !== null && message.devicePlatform === null)) {
|
|
46
|
-
throw new PushNotificationsFcmProblemReportError('Both or none of deviceToken and devicePlatform must be null', {
|
|
47
|
-
problemCode: PushNotificationsFcmProblemReportReason.MissingValue,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
const connection = messageContext.assertReadyConnection();
|
|
51
|
-
let pushNotificationsFcmRecord = await this.pushNotificationsFcmRepository.findSingleByQuery(agentContext, {
|
|
52
|
-
connectionId: connection.id,
|
|
53
|
-
});
|
|
54
|
-
if (pushNotificationsFcmRecord) {
|
|
55
|
-
if (pushNotificationsFcmRecord.deviceToken === message.deviceToken) {
|
|
56
|
-
this.logger.debug(`Device token is same for connection ${connection.id}. So skipping update`);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
// Update the record with new device token
|
|
60
|
-
pushNotificationsFcmRecord.deviceToken = message.deviceToken;
|
|
61
|
-
// Reset project in case the firebase project might have changed
|
|
62
|
-
pushNotificationsFcmRecord.firebaseProjectId = undefined;
|
|
63
|
-
this.logger.debug(`Device token changed for connection ${connection.id}. Updating record`);
|
|
64
|
-
await this.pushNotificationsFcmRepository.update(agentContext, pushNotificationsFcmRecord);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
this.logger.debug(`No device info found for connection ${connection.id}. So creating new record`);
|
|
68
|
-
pushNotificationsFcmRecord = new PushNotificationsFcmRecord({
|
|
69
|
-
connectionId: connection.id,
|
|
70
|
-
deviceToken: message.deviceToken,
|
|
71
|
-
devicePlatform: message.devicePlatform,
|
|
72
|
-
});
|
|
73
|
-
await this.pushNotificationsFcmRepository.save(agentContext, pushNotificationsFcmRecord);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async getPushNotificationRecordByConnectionId(agentContext, connectionId) {
|
|
77
|
-
return await this.pushNotificationsFcmRepository.getSingleByQuery(agentContext, {
|
|
78
|
-
connectionId,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
async findPushNotificationRecordByConnectionId(agentContext, connectionId) {
|
|
82
|
-
return await this.pushNotificationsFcmRepository.findSingleByQuery(agentContext, {
|
|
83
|
-
connectionId,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
PushNotificationsFcmService = __decorate([
|
|
88
|
-
injectable(),
|
|
89
|
-
__param(1, inject(InjectionSymbols.Logger)),
|
|
90
|
-
__metadata("design:paramtypes", [PushNotificationsFcmRepository, Object])
|
|
91
|
-
], PushNotificationsFcmService);
|
|
92
|
-
export { PushNotificationsFcmService };
|
|
93
|
-
//# sourceMappingURL=PushNotificationsFcmService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PushNotificationsFcmService.js","sourceRoot":"","sources":["../../../src/fcm/services/PushNotificationsFcmService.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEjF,OAAO,EAAE,sCAAsC,EAAE,uCAAuC,EAAE,MAAM,oBAAoB,CAAA;AACpH,OAAO,EAAE,qCAAqC,EAAE,wCAAwC,EAAE,wCAAwC,EAAE,MAAM,sBAAsB,CAAA;AAEhK,OAAO,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAA;AAG5F,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAItC,YACE,8BAA8D,EAC7B,MAAc;QAE/C,IAAI,CAAC,8BAA8B,GAAG,8BAA8B,CAAA;QACpE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,mBAAmB,CAAC,UAAyB;QAClD,IACE,CAAC,UAAU,CAAC,WAAW,KAAK,IAAI,IAAI,UAAU,CAAC,cAAc,KAAK,IAAI,CAAC;YACvE,CAAC,UAAU,CAAC,WAAW,KAAK,IAAI,IAAI,UAAU,CAAC,cAAc,KAAK,IAAI,CAAC;YAEvE,MAAM,IAAI,UAAU,CAAC,6DAA6D,CAAC,CAAA;QAErF,OAAO,IAAI,wCAAwC,CAAC,UAAU,CAAC,CAAA;IACjE,CAAC;IAEM,mBAAmB;QACxB,OAAO,IAAI,wCAAwC,CAAC,EAAE,CAAC,CAAA;IACzD,CAAC;IAEM,gBAAgB,CAAC,OAAwD;QAC9E,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;QACxC,IACE,CAAC,UAAU,CAAC,WAAW,KAAK,IAAI,IAAI,UAAU,CAAC,cAAc,KAAK,IAAI,CAAC;YACvE,CAAC,UAAU,CAAC,WAA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