@quanticjs/notification-bff 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -0
- package/dist/NotificationEngineClient.d.ts +20 -0
- package/dist/NotificationEngineClient.d.ts.map +1 -0
- package/dist/NotificationEngineClient.js +100 -0
- package/dist/NotificationEngineClient.js.map +1 -0
- package/dist/NotificationProxyController.d.ts +28 -0
- package/dist/NotificationProxyController.d.ts.map +1 -0
- package/dist/NotificationProxyController.js +169 -0
- package/dist/NotificationProxyController.js.map +1 -0
- package/dist/NotificationProxyModule.d.ts +20 -0
- package/dist/NotificationProxyModule.d.ts.map +1 -0
- package/dist/NotificationProxyModule.js +78 -0
- package/dist/NotificationProxyModule.js.map +1 -0
- package/dist/commands/mark-all-read.handler.d.ts +16 -0
- package/dist/commands/mark-all-read.handler.d.ts.map +1 -0
- package/dist/commands/mark-all-read.handler.js +47 -0
- package/dist/commands/mark-all-read.handler.js.map +1 -0
- package/dist/commands/mark-notification-read.handler.d.ts +18 -0
- package/dist/commands/mark-notification-read.handler.d.ts.map +1 -0
- package/dist/commands/mark-notification-read.handler.js +43 -0
- package/dist/commands/mark-notification-read.handler.js.map +1 -0
- package/dist/commands/update-notification-settings.handler.d.ts +17 -0
- package/dist/commands/update-notification-settings.handler.d.ts.map +1 -0
- package/dist/commands/update-notification-settings.handler.js +42 -0
- package/dist/commands/update-notification-settings.handler.js.map +1 -0
- package/dist/engine-result.d.ts +18 -0
- package/dist/engine-result.d.ts.map +1 -0
- package/dist/engine-result.js +61 -0
- package/dist/engine-result.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces.d.ts +41 -0
- package/dist/interfaces.d.ts.map +1 -0
- package/dist/interfaces.js +6 -0
- package/dist/interfaces.js.map +1 -0
- package/dist/queries/count-unread.handler.d.ts +16 -0
- package/dist/queries/count-unread.handler.d.ts.map +1 -0
- package/dist/queries/count-unread.handler.js +47 -0
- package/dist/queries/count-unread.handler.js.map +1 -0
- package/dist/queries/get-notification-settings.handler.d.ts +17 -0
- package/dist/queries/get-notification-settings.handler.d.ts.map +1 -0
- package/dist/queries/get-notification-settings.handler.js +40 -0
- package/dist/queries/get-notification-settings.handler.js.map +1 -0
- package/dist/queries/list-notifications.handler.d.ts +21 -0
- package/dist/queries/list-notifications.handler.d.ts.map +1 -0
- package/dist/queries/list-notifications.handler.js +53 -0
- package/dist/queries/list-notifications.handler.js.map +1 -0
- package/package.json +28 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MarkNotificationReadHandler = exports.MarkNotificationReadCommand = void 0;
|
|
13
|
+
const cqrs_1 = require("@nestjs/cqrs");
|
|
14
|
+
const NotificationEngineClient_1 = require("../NotificationEngineClient");
|
|
15
|
+
const engine_result_1 = require("../engine-result");
|
|
16
|
+
/**
|
|
17
|
+
* Mark a single notification read (proxied). Addressed by id and user-scoped by
|
|
18
|
+
* the engine (another user's / another app's id 404s), so no app scope applied.
|
|
19
|
+
*/
|
|
20
|
+
class MarkNotificationReadCommand {
|
|
21
|
+
authorization;
|
|
22
|
+
id;
|
|
23
|
+
constructor(authorization, id) {
|
|
24
|
+
this.authorization = authorization;
|
|
25
|
+
this.id = id;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.MarkNotificationReadCommand = MarkNotificationReadCommand;
|
|
29
|
+
let MarkNotificationReadHandler = class MarkNotificationReadHandler {
|
|
30
|
+
engine;
|
|
31
|
+
constructor(engine) {
|
|
32
|
+
this.engine = engine;
|
|
33
|
+
}
|
|
34
|
+
async execute(command) {
|
|
35
|
+
return (0, engine_result_1.toResult)(await this.engine.forward('POST', `/notifications/${encodeURIComponent(command.id)}/read`, command.authorization));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.MarkNotificationReadHandler = MarkNotificationReadHandler;
|
|
39
|
+
exports.MarkNotificationReadHandler = MarkNotificationReadHandler = __decorate([
|
|
40
|
+
(0, cqrs_1.CommandHandler)(MarkNotificationReadCommand),
|
|
41
|
+
__metadata("design:paramtypes", [NotificationEngineClient_1.NotificationEngineClient])
|
|
42
|
+
], MarkNotificationReadHandler);
|
|
43
|
+
//# sourceMappingURL=mark-notification-read.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mark-notification-read.handler.js","sourceRoot":"","sources":["../../src/commands/mark-notification-read.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAA+D;AAE/D,0EAAuE;AACvE,oDAA4C;AAE5C;;;GAGG;AACH,MAAa,2BAA2B;IAE3B;IACA;IAFX,YACW,aAAiC,EACjC,EAAU;QADV,kBAAa,GAAb,aAAa,CAAoB;QACjC,OAAE,GAAF,EAAE,CAAQ;IAClB,CAAC;CACL;AALD,kEAKC;AAGM,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAGT;IAA7B,YAA6B,MAAgC;QAAhC,WAAM,GAAN,MAAM,CAA0B;IAAG,CAAC;IAEjE,KAAK,CAAC,OAAO,CAAC,OAAoC;QAChD,OAAO,IAAA,wBAAQ,EACb,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACvB,MAAM,EACN,kBAAkB,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EACvD,OAAO,CAAC,aAAa,CACtB,CACF,CAAC;IACJ,CAAC;CACF,CAAA;AAdY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,qBAAc,EAAC,2BAA2B,CAAC;qCAIL,mDAAwB;GAHlD,2BAA2B,CAcvC","sourcesContent":["import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';\nimport { Result } from '@quanticjs/core';\nimport { NotificationEngineClient } from '../NotificationEngineClient';\nimport { toResult } from '../engine-result';\n\n/**\n * Mark a single notification read (proxied). Addressed by id and user-scoped by\n * the engine (another user's / another app's id 404s), so no app scope applied.\n */\nexport class MarkNotificationReadCommand {\n constructor(\n readonly authorization: string | undefined,\n readonly id: string,\n ) {}\n}\n\n@CommandHandler(MarkNotificationReadCommand)\nexport class MarkNotificationReadHandler\n implements ICommandHandler<MarkNotificationReadCommand>\n{\n constructor(private readonly engine: NotificationEngineClient) {}\n\n async execute(command: MarkNotificationReadCommand): Promise<Result<unknown>> {\n return toResult(\n await this.engine.forward(\n 'POST',\n `/notifications/${encodeURIComponent(command.id)}/read`,\n command.authorization,\n ),\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ICommandHandler } from '@nestjs/cqrs';
|
|
2
|
+
import { Result } from '@quanticjs/core';
|
|
3
|
+
import { NotificationEngineClient } from '../NotificationEngineClient';
|
|
4
|
+
import type { NotificationSettingsPath } from '../queries/get-notification-settings.handler';
|
|
5
|
+
/** Upsert a settings document (preferences / quiet-hours / frequency-cap) — engine enforces admin where required. */
|
|
6
|
+
export declare class UpdateNotificationSettingsCommand {
|
|
7
|
+
readonly authorization: string | undefined;
|
|
8
|
+
readonly path: NotificationSettingsPath;
|
|
9
|
+
readonly body: unknown;
|
|
10
|
+
constructor(authorization: string | undefined, path: NotificationSettingsPath, body: unknown);
|
|
11
|
+
}
|
|
12
|
+
export declare class UpdateNotificationSettingsHandler implements ICommandHandler<UpdateNotificationSettingsCommand> {
|
|
13
|
+
private readonly engine;
|
|
14
|
+
constructor(engine: NotificationEngineClient);
|
|
15
|
+
execute(command: UpdateNotificationSettingsCommand): Promise<Result<unknown>>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=update-notification-settings.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-notification-settings.handler.d.ts","sourceRoot":"","sources":["../../src/commands/update-notification-settings.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAE7F,qHAAqH;AACrH,qBAAa,iCAAiC;IAE1C,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS;IAC1C,QAAQ,CAAC,IAAI,EAAE,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,OAAO;gBAFb,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,IAAI,EAAE,wBAAwB,EAC9B,IAAI,EAAE,OAAO;CAEzB;AAED,qBACa,iCACX,YAAW,eAAe,CAAC,iCAAiC,CAAC;IAEjD,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,wBAAwB;IAEvD,OAAO,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CAUpF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateNotificationSettingsHandler = exports.UpdateNotificationSettingsCommand = void 0;
|
|
13
|
+
const cqrs_1 = require("@nestjs/cqrs");
|
|
14
|
+
const NotificationEngineClient_1 = require("../NotificationEngineClient");
|
|
15
|
+
const engine_result_1 = require("../engine-result");
|
|
16
|
+
/** Upsert a settings document (preferences / quiet-hours / frequency-cap) — engine enforces admin where required. */
|
|
17
|
+
class UpdateNotificationSettingsCommand {
|
|
18
|
+
authorization;
|
|
19
|
+
path;
|
|
20
|
+
body;
|
|
21
|
+
constructor(authorization, path, body) {
|
|
22
|
+
this.authorization = authorization;
|
|
23
|
+
this.path = path;
|
|
24
|
+
this.body = body;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.UpdateNotificationSettingsCommand = UpdateNotificationSettingsCommand;
|
|
28
|
+
let UpdateNotificationSettingsHandler = class UpdateNotificationSettingsHandler {
|
|
29
|
+
engine;
|
|
30
|
+
constructor(engine) {
|
|
31
|
+
this.engine = engine;
|
|
32
|
+
}
|
|
33
|
+
async execute(command) {
|
|
34
|
+
return (0, engine_result_1.toResult)(await this.engine.forward('PUT', `/notifications/${command.path}`, command.authorization, command.body));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.UpdateNotificationSettingsHandler = UpdateNotificationSettingsHandler;
|
|
38
|
+
exports.UpdateNotificationSettingsHandler = UpdateNotificationSettingsHandler = __decorate([
|
|
39
|
+
(0, cqrs_1.CommandHandler)(UpdateNotificationSettingsCommand),
|
|
40
|
+
__metadata("design:paramtypes", [NotificationEngineClient_1.NotificationEngineClient])
|
|
41
|
+
], UpdateNotificationSettingsHandler);
|
|
42
|
+
//# sourceMappingURL=update-notification-settings.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-notification-settings.handler.js","sourceRoot":"","sources":["../../src/commands/update-notification-settings.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAA+D;AAE/D,0EAAuE;AACvE,oDAA4C;AAG5C,qHAAqH;AACrH,MAAa,iCAAiC;IAEjC;IACA;IACA;IAHX,YACW,aAAiC,EACjC,IAA8B,EAC9B,IAAa;QAFb,kBAAa,GAAb,aAAa,CAAoB;QACjC,SAAI,GAAJ,IAAI,CAA0B;QAC9B,SAAI,GAAJ,IAAI,CAAS;IACrB,CAAC;CACL;AAND,8EAMC;AAGM,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IAGf;IAA7B,YAA6B,MAAgC;QAAhC,WAAM,GAAN,MAAM,CAA0B;IAAG,CAAC;IAEjE,KAAK,CAAC,OAAO,CAAC,OAA0C;QACtD,OAAO,IAAA,wBAAQ,EACb,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,OAAO,CAAC,IAAI,EAAE,EAChC,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,IAAI,CACb,CACF,CAAC;IACJ,CAAC;CACF,CAAA;AAfY,8EAAiC;4CAAjC,iCAAiC;IAD7C,IAAA,qBAAc,EAAC,iCAAiC,CAAC;qCAIX,mDAAwB;GAHlD,iCAAiC,CAe7C","sourcesContent":["import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';\nimport { Result } from '@quanticjs/core';\nimport { NotificationEngineClient } from '../NotificationEngineClient';\nimport { toResult } from '../engine-result';\nimport type { NotificationSettingsPath } from '../queries/get-notification-settings.handler';\n\n/** Upsert a settings document (preferences / quiet-hours / frequency-cap) — engine enforces admin where required. */\nexport class UpdateNotificationSettingsCommand {\n constructor(\n readonly authorization: string | undefined,\n readonly path: NotificationSettingsPath,\n readonly body: unknown,\n ) {}\n}\n\n@CommandHandler(UpdateNotificationSettingsCommand)\nexport class UpdateNotificationSettingsHandler\n implements ICommandHandler<UpdateNotificationSettingsCommand>\n{\n constructor(private readonly engine: NotificationEngineClient) {}\n\n async execute(command: UpdateNotificationSettingsCommand): Promise<Result<unknown>> {\n return toResult(\n await this.engine.forward(\n 'PUT',\n `/notifications/${command.path}`,\n command.authorization,\n command.body,\n ),\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Result } from '@quanticjs/core';
|
|
2
|
+
import type { ProxiedResponse } from './NotificationEngineClient';
|
|
3
|
+
import type { NotificationProxyOptions } from './interfaces';
|
|
4
|
+
/**
|
|
5
|
+
* Map a proxied notification-engine response onto a `Result` so the CQRS
|
|
6
|
+
* pipeline + `ResultInterceptor` produce the HTTP response. 2xx bodies pass
|
|
7
|
+
* through as the success value (the frontend sees the engine's exact shape);
|
|
8
|
+
* engine error statuses map to the framework's `ErrorType` problem-details.
|
|
9
|
+
*/
|
|
10
|
+
export declare function toResult<T = unknown>(res: ProxiedResponse): Result<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Apply this app's scope to a feed path. Per-app mode forces `appId=<appId>`
|
|
13
|
+
* (server-authoritative, overriding any client value); shell mode sends no
|
|
14
|
+
* `appId` (all apps for the user). A client-supplied `appId` is always stripped
|
|
15
|
+
* — the browser cannot widen or narrow the app scope.
|
|
16
|
+
*/
|
|
17
|
+
export declare function scopedFeedPath(options: NotificationProxyOptions, base: string, query?: Record<string, string>): string;
|
|
18
|
+
//# sourceMappingURL=engine-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-result.d.ts","sourceRoot":"","sources":["../src/engine-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,eAAe,GAAG,MAAM,CAAC,CAAC,CAAC,CAyBrE;AAUD;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,wBAAwB,EACjC,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACjC,MAAM,CAQR"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toResult = toResult;
|
|
4
|
+
exports.scopedFeedPath = scopedFeedPath;
|
|
5
|
+
const core_1 = require("@quanticjs/core");
|
|
6
|
+
/**
|
|
7
|
+
* Map a proxied notification-engine response onto a `Result` so the CQRS
|
|
8
|
+
* pipeline + `ResultInterceptor` produce the HTTP response. 2xx bodies pass
|
|
9
|
+
* through as the success value (the frontend sees the engine's exact shape);
|
|
10
|
+
* engine error statuses map to the framework's `ErrorType` problem-details.
|
|
11
|
+
*/
|
|
12
|
+
function toResult(res) {
|
|
13
|
+
const { status, body } = res;
|
|
14
|
+
if (status >= 200 && status < 300)
|
|
15
|
+
return core_1.Result.success(body);
|
|
16
|
+
const detail = extractDetail(body) ?? 'Notification request failed';
|
|
17
|
+
switch (status) {
|
|
18
|
+
case 400:
|
|
19
|
+
return core_1.Result.failure(core_1.ErrorType.ValidationError, detail);
|
|
20
|
+
case 401:
|
|
21
|
+
return core_1.Result.failure(core_1.ErrorType.Unauthorized, detail);
|
|
22
|
+
case 403:
|
|
23
|
+
return core_1.Result.failure(core_1.ErrorType.Forbidden, detail);
|
|
24
|
+
case 404:
|
|
25
|
+
return core_1.Result.failure(core_1.ErrorType.NotFound, detail);
|
|
26
|
+
case 409:
|
|
27
|
+
return core_1.Result.failure(core_1.ErrorType.Conflict, detail);
|
|
28
|
+
case 422:
|
|
29
|
+
return core_1.Result.failure(core_1.ErrorType.UnprocessableEntity, detail);
|
|
30
|
+
case 429:
|
|
31
|
+
return core_1.Result.failure(core_1.ErrorType.RateLimited, detail);
|
|
32
|
+
case 503:
|
|
33
|
+
return core_1.Result.failure(core_1.ErrorType.ServiceUnavailable, detail);
|
|
34
|
+
default:
|
|
35
|
+
return core_1.Result.failure(core_1.ErrorType.InternalError, detail);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function extractDetail(body) {
|
|
39
|
+
if (body && typeof body === 'object') {
|
|
40
|
+
const d = body.detail ?? body.message;
|
|
41
|
+
if (typeof d === 'string')
|
|
42
|
+
return d;
|
|
43
|
+
}
|
|
44
|
+
return typeof body === 'string' && body ? body : null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Apply this app's scope to a feed path. Per-app mode forces `appId=<appId>`
|
|
48
|
+
* (server-authoritative, overriding any client value); shell mode sends no
|
|
49
|
+
* `appId` (all apps for the user). A client-supplied `appId` is always stripped
|
|
50
|
+
* — the browser cannot widen or narrow the app scope.
|
|
51
|
+
*/
|
|
52
|
+
function scopedFeedPath(options, base, query = {}) {
|
|
53
|
+
const params = new URLSearchParams(query);
|
|
54
|
+
params.delete('appId');
|
|
55
|
+
if (!options.unified && options.appId) {
|
|
56
|
+
params.set('appId', options.appId);
|
|
57
|
+
}
|
|
58
|
+
const qs = params.toString();
|
|
59
|
+
return qs ? `${base}?${qs}` : base;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=engine-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-result.js","sourceRoot":"","sources":["../src/engine-result.ts"],"names":[],"mappings":";;AAUA,4BAyBC;AAgBD,wCAYC;AA/DD,0CAAoD;AAIpD;;;;;GAKG;AACH,SAAgB,QAAQ,CAAc,GAAoB;IACxD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC;IAC7B,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;QAAE,OAAO,aAAM,CAAC,OAAO,CAAC,IAAS,CAAC,CAAC;IAEpE,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,6BAA6B,CAAC;IACpE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,GAAG;YACN,OAAO,aAAM,CAAC,OAAO,CAAC,gBAAS,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QAC3D,KAAK,GAAG;YACN,OAAO,aAAM,CAAC,OAAO,CAAC,gBAAS,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACxD,KAAK,GAAG;YACN,OAAO,aAAM,CAAC,OAAO,CAAC,gBAAS,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACrD,KAAK,GAAG;YACN,OAAO,aAAM,CAAC,OAAO,CAAC,gBAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpD,KAAK,GAAG;YACN,OAAO,aAAM,CAAC,OAAO,CAAC,gBAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpD,KAAK,GAAG;YACN,OAAO,aAAM,CAAC,OAAO,CAAC,gBAAS,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;QAC/D,KAAK,GAAG;YACN,OAAO,aAAM,CAAC,OAAO,CAAC,gBAAS,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACvD,KAAK,GAAG;YACN,OAAO,aAAM,CAAC,OAAO,CAAC,gBAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QAC9D;YACE,OAAO,aAAM,CAAC,OAAO,CAAC,gBAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,IAAa;IAClC,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACrC,MAAM,CAAC,GAAI,IAAgC,CAAC,MAAM,IAAK,IAAgC,CAAC,OAAO,CAAC;QAChG,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAC5B,OAAiC,EACjC,IAAY,EACZ,QAAgC,EAAE;IAElC,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IACD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC7B,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACrC,CAAC","sourcesContent":["import { ErrorType, Result } from '@quanticjs/core';\nimport type { ProxiedResponse } from './NotificationEngineClient';\nimport type { NotificationProxyOptions } from './interfaces';\n\n/**\n * Map a proxied notification-engine response onto a `Result` so the CQRS\n * pipeline + `ResultInterceptor` produce the HTTP response. 2xx bodies pass\n * through as the success value (the frontend sees the engine's exact shape);\n * engine error statuses map to the framework's `ErrorType` problem-details.\n */\nexport function toResult<T = unknown>(res: ProxiedResponse): Result<T> {\n const { status, body } = res;\n if (status >= 200 && status < 300) return Result.success(body as T);\n\n const detail = extractDetail(body) ?? 'Notification request failed';\n switch (status) {\n case 400:\n return Result.failure(ErrorType.ValidationError, detail);\n case 401:\n return Result.failure(ErrorType.Unauthorized, detail);\n case 403:\n return Result.failure(ErrorType.Forbidden, detail);\n case 404:\n return Result.failure(ErrorType.NotFound, detail);\n case 409:\n return Result.failure(ErrorType.Conflict, detail);\n case 422:\n return Result.failure(ErrorType.UnprocessableEntity, detail);\n case 429:\n return Result.failure(ErrorType.RateLimited, detail);\n case 503:\n return Result.failure(ErrorType.ServiceUnavailable, detail);\n default:\n return Result.failure(ErrorType.InternalError, detail);\n }\n}\n\nfunction extractDetail(body: unknown): string | null {\n if (body && typeof body === 'object') {\n const d = (body as Record<string, unknown>).detail ?? (body as Record<string, unknown>).message;\n if (typeof d === 'string') return d;\n }\n return typeof body === 'string' && body ? body : null;\n}\n\n/**\n * Apply this app's scope to a feed path. Per-app mode forces `appId=<appId>`\n * (server-authoritative, overriding any client value); shell mode sends no\n * `appId` (all apps for the user). A client-supplied `appId` is always stripped\n * — the browser cannot widen or narrow the app scope.\n */\nexport function scopedFeedPath(\n options: NotificationProxyOptions,\n base: string,\n query: Record<string, string> = {},\n): string {\n const params = new URLSearchParams(query);\n params.delete('appId');\n if (!options.unified && options.appId) {\n params.set('appId', options.appId);\n }\n const qs = params.toString();\n return qs ? `${base}?${qs}` : base;\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { NotificationProxyModule } from './NotificationProxyModule';
|
|
2
|
+
export { NotificationProxyController } from './NotificationProxyController';
|
|
3
|
+
export { NotificationEngineClient, type ProxiedResponse } from './NotificationEngineClient';
|
|
4
|
+
export { NOTIFICATION_PROXY_OPTIONS, type NotificationProxyOptions } from './interfaces';
|
|
5
|
+
export { toResult, scopedFeedPath } from './engine-result';
|
|
6
|
+
export { ListNotificationsQuery, ListNotificationsHandler } from './queries/list-notifications.handler';
|
|
7
|
+
export { CountUnreadQuery, CountUnreadHandler } from './queries/count-unread.handler';
|
|
8
|
+
export { GetNotificationSettingsQuery, GetNotificationSettingsHandler, type NotificationSettingsPath, } from './queries/get-notification-settings.handler';
|
|
9
|
+
export { MarkNotificationReadCommand, MarkNotificationReadHandler, } from './commands/mark-notification-read.handler';
|
|
10
|
+
export { MarkAllNotificationsReadCommand, MarkAllNotificationsReadHandler, } from './commands/mark-all-read.handler';
|
|
11
|
+
export { UpdateNotificationSettingsCommand, UpdateNotificationSettingsHandler, } from './commands/update-notification-settings.handler';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,0BAA0B,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AACxG,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,iCAAiC,EACjC,iCAAiC,GAClC,MAAM,iDAAiD,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateNotificationSettingsHandler = exports.UpdateNotificationSettingsCommand = exports.MarkAllNotificationsReadHandler = exports.MarkAllNotificationsReadCommand = exports.MarkNotificationReadHandler = exports.MarkNotificationReadCommand = exports.GetNotificationSettingsHandler = exports.GetNotificationSettingsQuery = exports.CountUnreadHandler = exports.CountUnreadQuery = exports.ListNotificationsHandler = exports.ListNotificationsQuery = exports.scopedFeedPath = exports.toResult = exports.NOTIFICATION_PROXY_OPTIONS = exports.NotificationEngineClient = exports.NotificationProxyController = exports.NotificationProxyModule = void 0;
|
|
4
|
+
var NotificationProxyModule_1 = require("./NotificationProxyModule");
|
|
5
|
+
Object.defineProperty(exports, "NotificationProxyModule", { enumerable: true, get: function () { return NotificationProxyModule_1.NotificationProxyModule; } });
|
|
6
|
+
var NotificationProxyController_1 = require("./NotificationProxyController");
|
|
7
|
+
Object.defineProperty(exports, "NotificationProxyController", { enumerable: true, get: function () { return NotificationProxyController_1.NotificationProxyController; } });
|
|
8
|
+
var NotificationEngineClient_1 = require("./NotificationEngineClient");
|
|
9
|
+
Object.defineProperty(exports, "NotificationEngineClient", { enumerable: true, get: function () { return NotificationEngineClient_1.NotificationEngineClient; } });
|
|
10
|
+
var interfaces_1 = require("./interfaces");
|
|
11
|
+
Object.defineProperty(exports, "NOTIFICATION_PROXY_OPTIONS", { enumerable: true, get: function () { return interfaces_1.NOTIFICATION_PROXY_OPTIONS; } });
|
|
12
|
+
var engine_result_1 = require("./engine-result");
|
|
13
|
+
Object.defineProperty(exports, "toResult", { enumerable: true, get: function () { return engine_result_1.toResult; } });
|
|
14
|
+
Object.defineProperty(exports, "scopedFeedPath", { enumerable: true, get: function () { return engine_result_1.scopedFeedPath; } });
|
|
15
|
+
// Queries
|
|
16
|
+
var list_notifications_handler_1 = require("./queries/list-notifications.handler");
|
|
17
|
+
Object.defineProperty(exports, "ListNotificationsQuery", { enumerable: true, get: function () { return list_notifications_handler_1.ListNotificationsQuery; } });
|
|
18
|
+
Object.defineProperty(exports, "ListNotificationsHandler", { enumerable: true, get: function () { return list_notifications_handler_1.ListNotificationsHandler; } });
|
|
19
|
+
var count_unread_handler_1 = require("./queries/count-unread.handler");
|
|
20
|
+
Object.defineProperty(exports, "CountUnreadQuery", { enumerable: true, get: function () { return count_unread_handler_1.CountUnreadQuery; } });
|
|
21
|
+
Object.defineProperty(exports, "CountUnreadHandler", { enumerable: true, get: function () { return count_unread_handler_1.CountUnreadHandler; } });
|
|
22
|
+
var get_notification_settings_handler_1 = require("./queries/get-notification-settings.handler");
|
|
23
|
+
Object.defineProperty(exports, "GetNotificationSettingsQuery", { enumerable: true, get: function () { return get_notification_settings_handler_1.GetNotificationSettingsQuery; } });
|
|
24
|
+
Object.defineProperty(exports, "GetNotificationSettingsHandler", { enumerable: true, get: function () { return get_notification_settings_handler_1.GetNotificationSettingsHandler; } });
|
|
25
|
+
// Commands
|
|
26
|
+
var mark_notification_read_handler_1 = require("./commands/mark-notification-read.handler");
|
|
27
|
+
Object.defineProperty(exports, "MarkNotificationReadCommand", { enumerable: true, get: function () { return mark_notification_read_handler_1.MarkNotificationReadCommand; } });
|
|
28
|
+
Object.defineProperty(exports, "MarkNotificationReadHandler", { enumerable: true, get: function () { return mark_notification_read_handler_1.MarkNotificationReadHandler; } });
|
|
29
|
+
var mark_all_read_handler_1 = require("./commands/mark-all-read.handler");
|
|
30
|
+
Object.defineProperty(exports, "MarkAllNotificationsReadCommand", { enumerable: true, get: function () { return mark_all_read_handler_1.MarkAllNotificationsReadCommand; } });
|
|
31
|
+
Object.defineProperty(exports, "MarkAllNotificationsReadHandler", { enumerable: true, get: function () { return mark_all_read_handler_1.MarkAllNotificationsReadHandler; } });
|
|
32
|
+
var update_notification_settings_handler_1 = require("./commands/update-notification-settings.handler");
|
|
33
|
+
Object.defineProperty(exports, "UpdateNotificationSettingsCommand", { enumerable: true, get: function () { return update_notification_settings_handler_1.UpdateNotificationSettingsCommand; } });
|
|
34
|
+
Object.defineProperty(exports, "UpdateNotificationSettingsHandler", { enumerable: true, get: function () { return update_notification_settings_handler_1.UpdateNotificationSettingsHandler; } });
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAChC,6EAA4E;AAAnE,0IAAA,2BAA2B,OAAA;AACpC,uEAA4F;AAAnF,oIAAA,wBAAwB,OAAA;AACjC,2CAAyF;AAAhF,wHAAA,0BAA0B,OAAA;AACnC,iDAA2D;AAAlD,yGAAA,QAAQ,OAAA;AAAE,+GAAA,cAAc,OAAA;AAEjC,UAAU;AACV,mFAAwG;AAA/F,oIAAA,sBAAsB,OAAA;AAAE,sIAAA,wBAAwB,OAAA;AACzD,uEAAsF;AAA7E,wHAAA,gBAAgB,OAAA;AAAE,0HAAA,kBAAkB,OAAA;AAC7C,iGAIqD;AAHnD,iJAAA,4BAA4B,OAAA;AAC5B,mJAAA,8BAA8B,OAAA;AAIhC,WAAW;AACX,4FAGmD;AAFjD,6IAAA,2BAA2B,OAAA;AAC3B,6IAAA,2BAA2B,OAAA;AAE7B,0EAG0C;AAFxC,wIAAA,+BAA+B,OAAA;AAC/B,wIAAA,+BAA+B,OAAA;AAEjC,wGAGyD;AAFvD,yJAAA,iCAAiC,OAAA;AACjC,yJAAA,iCAAiC,OAAA","sourcesContent":["export { NotificationProxyModule } from './NotificationProxyModule';\nexport { NotificationProxyController } from './NotificationProxyController';\nexport { NotificationEngineClient, type ProxiedResponse } from './NotificationEngineClient';\nexport { NOTIFICATION_PROXY_OPTIONS, type NotificationProxyOptions } from './interfaces';\nexport { toResult, scopedFeedPath } from './engine-result';\n\n// Queries\nexport { ListNotificationsQuery, ListNotificationsHandler } from './queries/list-notifications.handler';\nexport { CountUnreadQuery, CountUnreadHandler } from './queries/count-unread.handler';\nexport {\n GetNotificationSettingsQuery,\n GetNotificationSettingsHandler,\n type NotificationSettingsPath,\n} from './queries/get-notification-settings.handler';\n\n// Commands\nexport {\n MarkNotificationReadCommand,\n MarkNotificationReadHandler,\n} from './commands/mark-notification-read.handler';\nexport {\n MarkAllNotificationsReadCommand,\n MarkAllNotificationsReadHandler,\n} from './commands/mark-all-read.handler';\nexport {\n UpdateNotificationSettingsCommand,\n UpdateNotificationSettingsHandler,\n} from './commands/update-notification-settings.handler';\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** DI token for the resolved, validated proxy options. */
|
|
2
|
+
export declare const NOTIFICATION_PROXY_OPTIONS = "NOTIFICATION_PROXY_OPTIONS";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for {@link NotificationProxyModule}.
|
|
5
|
+
*
|
|
6
|
+
* Exactly one mode must be chosen — there is deliberately NO implicit
|
|
7
|
+
* "unscoped" default, so a misconfigured app can never silently expose every
|
|
8
|
+
* app's notifications:
|
|
9
|
+
*
|
|
10
|
+
* - **Per-app** (`{ appId: 'delivery-hub' }`): the BFF server-authoritatively
|
|
11
|
+
* stamps `appId=<appId>` on every feed read/mutation and strips any
|
|
12
|
+
* client-supplied `appId`. The bell shows only this app's notifications.
|
|
13
|
+
*
|
|
14
|
+
* - **Shell / unified** (`{ unified: true }`, optionally with an `appId`
|
|
15
|
+
* identity label e.g. `{ appId: 'shell', unified: true }`): the BFF sends
|
|
16
|
+
* NO `appId` filter, so the engine returns the caller's notifications across
|
|
17
|
+
* ALL apps. This is still strictly user-scoped — the engine derives the
|
|
18
|
+
* recipient from the verified token (`requireCurrentUser()`), never from the
|
|
19
|
+
* request — so a shell user only ever sees their OWN notifications.
|
|
20
|
+
*/
|
|
21
|
+
export interface NotificationProxyOptions {
|
|
22
|
+
/**
|
|
23
|
+
* This app's registered application slug (must match a row in the engine's
|
|
24
|
+
* application registry). Required for per-app mode; in shell mode it is an
|
|
25
|
+
* optional identity label only and does NOT narrow the feed.
|
|
26
|
+
*/
|
|
27
|
+
appId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Shell mode: surface the caller's notifications across every app. Mutually
|
|
30
|
+
* exclusive in intent with per-app scoping — set this ONLY on a shell/portal.
|
|
31
|
+
* The feed remains user-scoped by the token; this widens the *app* scope, not
|
|
32
|
+
* the *user* scope.
|
|
33
|
+
*/
|
|
34
|
+
unified?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Override the notification engine base URL. Defaults to
|
|
37
|
+
* `process.env.NOTIFICATION_ENGINE_URL` then `http://notification-engine:3000`.
|
|
38
|
+
*/
|
|
39
|
+
engineBaseUrl?: string;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AAEvE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NOTIFICATION_PROXY_OPTIONS = void 0;
|
|
4
|
+
/** DI token for the resolved, validated proxy options. */
|
|
5
|
+
exports.NOTIFICATION_PROXY_OPTIONS = 'NOTIFICATION_PROXY_OPTIONS';
|
|
6
|
+
//# sourceMappingURL=interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;AAAA,0DAA0D;AAC7C,QAAA,0BAA0B,GAAG,4BAA4B,CAAC","sourcesContent":["/** DI token for the resolved, validated proxy options. */\nexport const NOTIFICATION_PROXY_OPTIONS = 'NOTIFICATION_PROXY_OPTIONS';\n\n/**\n * Configuration for {@link NotificationProxyModule}.\n *\n * Exactly one mode must be chosen — there is deliberately NO implicit\n * \"unscoped\" default, so a misconfigured app can never silently expose every\n * app's notifications:\n *\n * - **Per-app** (`{ appId: 'delivery-hub' }`): the BFF server-authoritatively\n * stamps `appId=<appId>` on every feed read/mutation and strips any\n * client-supplied `appId`. The bell shows only this app's notifications.\n *\n * - **Shell / unified** (`{ unified: true }`, optionally with an `appId`\n * identity label e.g. `{ appId: 'shell', unified: true }`): the BFF sends\n * NO `appId` filter, so the engine returns the caller's notifications across\n * ALL apps. This is still strictly user-scoped — the engine derives the\n * recipient from the verified token (`requireCurrentUser()`), never from the\n * request — so a shell user only ever sees their OWN notifications.\n */\nexport interface NotificationProxyOptions {\n /**\n * This app's registered application slug (must match a row in the engine's\n * application registry). Required for per-app mode; in shell mode it is an\n * optional identity label only and does NOT narrow the feed.\n */\n appId?: string;\n\n /**\n * Shell mode: surface the caller's notifications across every app. Mutually\n * exclusive in intent with per-app scoping — set this ONLY on a shell/portal.\n * The feed remains user-scoped by the token; this widens the *app* scope, not\n * the *user* scope.\n */\n unified?: boolean;\n\n /**\n * Override the notification engine base URL. Defaults to\n * `process.env.NOTIFICATION_ENGINE_URL` then `http://notification-engine:3000`.\n */\n engineBaseUrl?: string;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IQueryHandler } from '@nestjs/cqrs';
|
|
2
|
+
import { Result } from '@quanticjs/core';
|
|
3
|
+
import { NotificationEngineClient } from '../NotificationEngineClient';
|
|
4
|
+
import { type NotificationProxyOptions } from '../interfaces';
|
|
5
|
+
/** Unread count for the caller (proxied), scoped to this app (or all apps in shell mode). */
|
|
6
|
+
export declare class CountUnreadQuery {
|
|
7
|
+
readonly authorization: string | undefined;
|
|
8
|
+
constructor(authorization: string | undefined);
|
|
9
|
+
}
|
|
10
|
+
export declare class CountUnreadHandler implements IQueryHandler<CountUnreadQuery> {
|
|
11
|
+
private readonly engine;
|
|
12
|
+
private readonly options;
|
|
13
|
+
constructor(engine: NotificationEngineClient, options: NotificationProxyOptions);
|
|
14
|
+
execute(query: CountUnreadQuery): Promise<Result<unknown>>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=count-unread.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"count-unread.handler.d.ts","sourceRoot":"","sources":["../../src/queries/count-unread.handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAA8B,KAAK,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG1F,6FAA6F;AAC7F,qBAAa,gBAAgB;IACf,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS;gBAAjC,aAAa,EAAE,MAAM,GAAG,SAAS;CACvD;AAED,qBACa,kBAAmB,YAAW,aAAa,CAAC,gBAAgB,CAAC;IAEtE,OAAO,CAAC,QAAQ,CAAC,MAAM;IACa,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAD3C,MAAM,EAAE,wBAAwB,EACI,OAAO,EAAE,wBAAwB;IAGlF,OAAO,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CAIjE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CountUnreadHandler = exports.CountUnreadQuery = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const cqrs_1 = require("@nestjs/cqrs");
|
|
18
|
+
const NotificationEngineClient_1 = require("../NotificationEngineClient");
|
|
19
|
+
const interfaces_1 = require("../interfaces");
|
|
20
|
+
const engine_result_1 = require("../engine-result");
|
|
21
|
+
/** Unread count for the caller (proxied), scoped to this app (or all apps in shell mode). */
|
|
22
|
+
class CountUnreadQuery {
|
|
23
|
+
authorization;
|
|
24
|
+
constructor(authorization) {
|
|
25
|
+
this.authorization = authorization;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.CountUnreadQuery = CountUnreadQuery;
|
|
29
|
+
let CountUnreadHandler = class CountUnreadHandler {
|
|
30
|
+
engine;
|
|
31
|
+
options;
|
|
32
|
+
constructor(engine, options) {
|
|
33
|
+
this.engine = engine;
|
|
34
|
+
this.options = options;
|
|
35
|
+
}
|
|
36
|
+
async execute(query) {
|
|
37
|
+
const path = (0, engine_result_1.scopedFeedPath)(this.options, '/notifications/unread-count');
|
|
38
|
+
return (0, engine_result_1.toResult)(await this.engine.forward('GET', path, query.authorization));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.CountUnreadHandler = CountUnreadHandler;
|
|
42
|
+
exports.CountUnreadHandler = CountUnreadHandler = __decorate([
|
|
43
|
+
(0, cqrs_1.QueryHandler)(CountUnreadQuery),
|
|
44
|
+
__param(1, (0, common_1.Inject)(interfaces_1.NOTIFICATION_PROXY_OPTIONS)),
|
|
45
|
+
__metadata("design:paramtypes", [NotificationEngineClient_1.NotificationEngineClient, Object])
|
|
46
|
+
], CountUnreadHandler);
|
|
47
|
+
//# sourceMappingURL=count-unread.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"count-unread.handler.js","sourceRoot":"","sources":["../../src/queries/count-unread.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwC;AACxC,uCAA2D;AAE3D,0EAAuE;AACvE,8CAA0F;AAC1F,oDAA4D;AAE5D,6FAA6F;AAC7F,MAAa,gBAAgB;IACN;IAArB,YAAqB,aAAiC;QAAjC,kBAAa,GAAb,aAAa,CAAoB;IAAG,CAAC;CAC3D;AAFD,4CAEC;AAGM,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAEV;IACoC;IAFvD,YACmB,MAAgC,EACI,OAAiC;QADrE,WAAM,GAAN,MAAM,CAA0B;QACI,YAAO,GAAP,OAAO,CAA0B;IACrF,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAAuB;QACnC,MAAM,IAAI,GAAG,IAAA,8BAAc,EAAC,IAAI,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAC;QACzE,OAAO,IAAA,wBAAQ,EAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/E,CAAC;CACF,CAAA;AAVY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAY,EAAC,gBAAgB,CAAC;IAI1B,WAAA,IAAA,eAAM,EAAC,uCAA0B,CAAC,CAAA;qCADV,mDAAwB;GAFxC,kBAAkB,CAU9B","sourcesContent":["import { Inject } from '@nestjs/common';\nimport { IQueryHandler, QueryHandler } from '@nestjs/cqrs';\nimport { Result } from '@quanticjs/core';\nimport { NotificationEngineClient } from '../NotificationEngineClient';\nimport { NOTIFICATION_PROXY_OPTIONS, type NotificationProxyOptions } from '../interfaces';\nimport { scopedFeedPath, toResult } from '../engine-result';\n\n/** Unread count for the caller (proxied), scoped to this app (or all apps in shell mode). */\nexport class CountUnreadQuery {\n constructor(readonly authorization: string | undefined) {}\n}\n\n@QueryHandler(CountUnreadQuery)\nexport class CountUnreadHandler implements IQueryHandler<CountUnreadQuery> {\n constructor(\n private readonly engine: NotificationEngineClient,\n @Inject(NOTIFICATION_PROXY_OPTIONS) private readonly options: NotificationProxyOptions,\n ) {}\n\n async execute(query: CountUnreadQuery): Promise<Result<unknown>> {\n const path = scopedFeedPath(this.options, '/notifications/unread-count');\n return toResult(await this.engine.forward('GET', path, query.authorization));\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IQueryHandler } from '@nestjs/cqrs';
|
|
2
|
+
import { Result } from '@quanticjs/core';
|
|
3
|
+
import { NotificationEngineClient } from '../NotificationEngineClient';
|
|
4
|
+
/** Allowed settings sub-paths (allowlisted to prevent path traversal). */
|
|
5
|
+
export type NotificationSettingsPath = 'preferences' | 'config/quiet-hours' | 'config/frequency-cap';
|
|
6
|
+
/** Read a settings document (preferences / quiet-hours / frequency-cap) — not app-scoped. */
|
|
7
|
+
export declare class GetNotificationSettingsQuery {
|
|
8
|
+
readonly authorization: string | undefined;
|
|
9
|
+
readonly path: NotificationSettingsPath;
|
|
10
|
+
constructor(authorization: string | undefined, path: NotificationSettingsPath);
|
|
11
|
+
}
|
|
12
|
+
export declare class GetNotificationSettingsHandler implements IQueryHandler<GetNotificationSettingsQuery> {
|
|
13
|
+
private readonly engine;
|
|
14
|
+
constructor(engine: NotificationEngineClient);
|
|
15
|
+
execute(query: GetNotificationSettingsQuery): Promise<Result<unknown>>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=get-notification-settings.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-notification-settings.handler.d.ts","sourceRoot":"","sources":["../../src/queries/get-notification-settings.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,0EAA0E;AAC1E,MAAM,MAAM,wBAAwB,GAChC,aAAa,GACb,oBAAoB,GACpB,sBAAsB,CAAC;AAE3B,6FAA6F;AAC7F,qBAAa,4BAA4B;IAErC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS;IAC1C,QAAQ,CAAC,IAAI,EAAE,wBAAwB;gBAD9B,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,IAAI,EAAE,wBAAwB;CAE1C;AAED,qBACa,8BACX,YAAW,aAAa,CAAC,4BAA4B,CAAC;IAE1C,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,wBAAwB;IAEvD,OAAO,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CAK7E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GetNotificationSettingsHandler = exports.GetNotificationSettingsQuery = void 0;
|
|
13
|
+
const cqrs_1 = require("@nestjs/cqrs");
|
|
14
|
+
const NotificationEngineClient_1 = require("../NotificationEngineClient");
|
|
15
|
+
const engine_result_1 = require("../engine-result");
|
|
16
|
+
/** Read a settings document (preferences / quiet-hours / frequency-cap) — not app-scoped. */
|
|
17
|
+
class GetNotificationSettingsQuery {
|
|
18
|
+
authorization;
|
|
19
|
+
path;
|
|
20
|
+
constructor(authorization, path) {
|
|
21
|
+
this.authorization = authorization;
|
|
22
|
+
this.path = path;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.GetNotificationSettingsQuery = GetNotificationSettingsQuery;
|
|
26
|
+
let GetNotificationSettingsHandler = class GetNotificationSettingsHandler {
|
|
27
|
+
engine;
|
|
28
|
+
constructor(engine) {
|
|
29
|
+
this.engine = engine;
|
|
30
|
+
}
|
|
31
|
+
async execute(query) {
|
|
32
|
+
return (0, engine_result_1.toResult)(await this.engine.forward('GET', `/notifications/${query.path}`, query.authorization));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.GetNotificationSettingsHandler = GetNotificationSettingsHandler;
|
|
36
|
+
exports.GetNotificationSettingsHandler = GetNotificationSettingsHandler = __decorate([
|
|
37
|
+
(0, cqrs_1.QueryHandler)(GetNotificationSettingsQuery),
|
|
38
|
+
__metadata("design:paramtypes", [NotificationEngineClient_1.NotificationEngineClient])
|
|
39
|
+
], GetNotificationSettingsHandler);
|
|
40
|
+
//# sourceMappingURL=get-notification-settings.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-notification-settings.handler.js","sourceRoot":"","sources":["../../src/queries/get-notification-settings.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAA2D;AAE3D,0EAAuE;AACvE,oDAA4C;AAQ5C,6FAA6F;AAC7F,MAAa,4BAA4B;IAE5B;IACA;IAFX,YACW,aAAiC,EACjC,IAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAoB;QACjC,SAAI,GAAJ,IAAI,CAA0B;IACtC,CAAC;CACL;AALD,oEAKC;AAGM,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAGZ;IAA7B,YAA6B,MAAgC;QAAhC,WAAM,GAAN,MAAM,CAA0B;IAAG,CAAC;IAEjE,KAAK,CAAC,OAAO,CAAC,KAAmC;QAC/C,OAAO,IAAA,wBAAQ,EACb,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,kBAAkB,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,aAAa,CAAC,CACtF,CAAC;IACJ,CAAC;CACF,CAAA;AAVY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAY,EAAC,4BAA4B,CAAC;qCAIJ,mDAAwB;GAHlD,8BAA8B,CAU1C","sourcesContent":["import { IQueryHandler, QueryHandler } from '@nestjs/cqrs';\nimport { Result } from '@quanticjs/core';\nimport { NotificationEngineClient } from '../NotificationEngineClient';\nimport { toResult } from '../engine-result';\n\n/** Allowed settings sub-paths (allowlisted to prevent path traversal). */\nexport type NotificationSettingsPath =\n | 'preferences'\n | 'config/quiet-hours'\n | 'config/frequency-cap';\n\n/** Read a settings document (preferences / quiet-hours / frequency-cap) — not app-scoped. */\nexport class GetNotificationSettingsQuery {\n constructor(\n readonly authorization: string | undefined,\n readonly path: NotificationSettingsPath,\n ) {}\n}\n\n@QueryHandler(GetNotificationSettingsQuery)\nexport class GetNotificationSettingsHandler\n implements IQueryHandler<GetNotificationSettingsQuery>\n{\n constructor(private readonly engine: NotificationEngineClient) {}\n\n async execute(query: GetNotificationSettingsQuery): Promise<Result<unknown>> {\n return toResult(\n await this.engine.forward('GET', `/notifications/${query.path}`, query.authorization),\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IQueryHandler } from '@nestjs/cqrs';
|
|
2
|
+
import { Result } from '@quanticjs/core';
|
|
3
|
+
import { NotificationEngineClient } from '../NotificationEngineClient';
|
|
4
|
+
import { type NotificationProxyOptions } from '../interfaces';
|
|
5
|
+
/**
|
|
6
|
+
* List the caller's notifications (proxied). `authorization` carries the caller's
|
|
7
|
+
* bearer token to forward to the engine — the deliberate BFF credential-forwarding
|
|
8
|
+
* exception to "no auth in queries"; the engine resolves the user from it.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ListNotificationsQuery {
|
|
11
|
+
readonly authorization: string | undefined;
|
|
12
|
+
readonly query: Record<string, string>;
|
|
13
|
+
constructor(authorization: string | undefined, query: Record<string, string>);
|
|
14
|
+
}
|
|
15
|
+
export declare class ListNotificationsHandler implements IQueryHandler<ListNotificationsQuery> {
|
|
16
|
+
private readonly engine;
|
|
17
|
+
private readonly options;
|
|
18
|
+
constructor(engine: NotificationEngineClient, options: NotificationProxyOptions);
|
|
19
|
+
execute(query: ListNotificationsQuery): Promise<Result<unknown>>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=list-notifications.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-notifications.handler.d.ts","sourceRoot":"","sources":["../../src/queries/list-notifications.handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAA8B,KAAK,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG1F;;;;GAIG;AACH,qBAAa,sBAAsB;IAE/B,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;gBAD7B,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAEzC;AAED,qBACa,wBAAyB,YAAW,aAAa,CAAC,sBAAsB,CAAC;IAElF,OAAO,CAAC,QAAQ,CAAC,MAAM;IACa,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAD3C,MAAM,EAAE,wBAAwB,EACI,OAAO,EAAE,wBAAwB;IAGlF,OAAO,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CAIvE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ListNotificationsHandler = exports.ListNotificationsQuery = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const cqrs_1 = require("@nestjs/cqrs");
|
|
18
|
+
const NotificationEngineClient_1 = require("../NotificationEngineClient");
|
|
19
|
+
const interfaces_1 = require("../interfaces");
|
|
20
|
+
const engine_result_1 = require("../engine-result");
|
|
21
|
+
/**
|
|
22
|
+
* List the caller's notifications (proxied). `authorization` carries the caller's
|
|
23
|
+
* bearer token to forward to the engine — the deliberate BFF credential-forwarding
|
|
24
|
+
* exception to "no auth in queries"; the engine resolves the user from it.
|
|
25
|
+
*/
|
|
26
|
+
class ListNotificationsQuery {
|
|
27
|
+
authorization;
|
|
28
|
+
query;
|
|
29
|
+
constructor(authorization, query) {
|
|
30
|
+
this.authorization = authorization;
|
|
31
|
+
this.query = query;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ListNotificationsQuery = ListNotificationsQuery;
|
|
35
|
+
let ListNotificationsHandler = class ListNotificationsHandler {
|
|
36
|
+
engine;
|
|
37
|
+
options;
|
|
38
|
+
constructor(engine, options) {
|
|
39
|
+
this.engine = engine;
|
|
40
|
+
this.options = options;
|
|
41
|
+
}
|
|
42
|
+
async execute(query) {
|
|
43
|
+
const path = (0, engine_result_1.scopedFeedPath)(this.options, '/notifications', query.query);
|
|
44
|
+
return (0, engine_result_1.toResult)(await this.engine.forward('GET', path, query.authorization));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
exports.ListNotificationsHandler = ListNotificationsHandler;
|
|
48
|
+
exports.ListNotificationsHandler = ListNotificationsHandler = __decorate([
|
|
49
|
+
(0, cqrs_1.QueryHandler)(ListNotificationsQuery),
|
|
50
|
+
__param(1, (0, common_1.Inject)(interfaces_1.NOTIFICATION_PROXY_OPTIONS)),
|
|
51
|
+
__metadata("design:paramtypes", [NotificationEngineClient_1.NotificationEngineClient, Object])
|
|
52
|
+
], ListNotificationsHandler);
|
|
53
|
+
//# sourceMappingURL=list-notifications.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-notifications.handler.js","sourceRoot":"","sources":["../../src/queries/list-notifications.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwC;AACxC,uCAA2D;AAE3D,0EAAuE;AACvE,8CAA0F;AAC1F,oDAA4D;AAE5D;;;;GAIG;AACH,MAAa,sBAAsB;IAEtB;IACA;IAFX,YACW,aAAiC,EACjC,KAA6B;QAD7B,kBAAa,GAAb,aAAa,CAAoB;QACjC,UAAK,GAAL,KAAK,CAAwB;IACrC,CAAC;CACL;AALD,wDAKC;AAGM,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEhB;IACoC;IAFvD,YACmB,MAAgC,EACI,OAAiC;QADrE,WAAM,GAAN,MAAM,CAA0B;QACI,YAAO,GAAP,OAAO,CAA0B;IACrF,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAA6B;QACzC,MAAM,IAAI,GAAG,IAAA,8BAAc,EAAC,IAAI,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACzE,OAAO,IAAA,wBAAQ,EAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/E,CAAC;CACF,CAAA;AAVY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAY,EAAC,sBAAsB,CAAC;IAIhC,WAAA,IAAA,eAAM,EAAC,uCAA0B,CAAC,CAAA;qCADV,mDAAwB;GAFxC,wBAAwB,CAUpC","sourcesContent":["import { Inject } from '@nestjs/common';\nimport { IQueryHandler, QueryHandler } from '@nestjs/cqrs';\nimport { Result } from '@quanticjs/core';\nimport { NotificationEngineClient } from '../NotificationEngineClient';\nimport { NOTIFICATION_PROXY_OPTIONS, type NotificationProxyOptions } from '../interfaces';\nimport { scopedFeedPath, toResult } from '../engine-result';\n\n/**\n * List the caller's notifications (proxied). `authorization` carries the caller's\n * bearer token to forward to the engine — the deliberate BFF credential-forwarding\n * exception to \"no auth in queries\"; the engine resolves the user from it.\n */\nexport class ListNotificationsQuery {\n constructor(\n readonly authorization: string | undefined,\n readonly query: Record<string, string>,\n ) {}\n}\n\n@QueryHandler(ListNotificationsQuery)\nexport class ListNotificationsHandler implements IQueryHandler<ListNotificationsQuery> {\n constructor(\n private readonly engine: NotificationEngineClient,\n @Inject(NOTIFICATION_PROXY_OPTIONS) private readonly options: NotificationProxyOptions,\n ) {}\n\n async execute(query: ListNotificationsQuery): Promise<Result<unknown>> {\n const path = scopedFeedPath(this.options, '/notifications', query.query);\n return toResult(await this.engine.forward('GET', path, query.authorization));\n }\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quanticjs/notification-bff",
|
|
3
|
+
"version": "8.3.0",
|
|
4
|
+
"description": "Server-authoritative BFF proxy to the standalone notification engine — per-app scoping or shell (unified) mode.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc -p tsconfig.json",
|
|
12
|
+
"lint": "eslint src",
|
|
13
|
+
"test": "jest",
|
|
14
|
+
"test:cov": "jest --coverage",
|
|
15
|
+
"clean": "rm -rf dist"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@nestjs/common": "^11.0.0",
|
|
19
|
+
"@nestjs/core": "^11.0.0",
|
|
20
|
+
"@quanticjs/core": "~8.3.0"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/quanticjs/quanticjs-backend.git",
|
|
25
|
+
"directory": "packages/notification-bff"
|
|
26
|
+
},
|
|
27
|
+
"license": "UNLICENSED"
|
|
28
|
+
}
|