@haatlabs-core/notifications 0.28.0 → 0.29.1
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/dist/cjs/nest/context.d.ts +2 -0
- package/dist/cjs/nest/context.js +28 -0
- package/dist/cjs/nest/index.d.ts +4 -3
- package/dist/cjs/nest/index.js +2 -1
- package/dist/cjs/nest/notifications.controller.d.ts +15 -13
- package/dist/cjs/nest/notifications.controller.js +70 -55
- package/dist/cjs/nest/options.d.ts +41 -5
- package/dist/cjs/nest/options.js +21 -5
- package/dist/cjs/nest/stream.controller.d.ts +5 -3
- package/dist/cjs/nest/stream.controller.js +15 -10
- package/dist/cjs/nest-auth/index.d.ts +8 -0
- package/dist/cjs/nest-auth/index.js +39 -0
- package/dist/nest/context.d.ts +2 -0
- package/dist/nest/context.js +4 -0
- package/dist/nest/context.js.map +1 -0
- package/dist/nest/index.d.ts +4 -3
- package/dist/nest/index.js +5 -3
- package/dist/nest/index.js.map +1 -1
- package/dist/nest/notifications.controller.d.ts +15 -13
- package/dist/nest/notifications.controller.js +44 -29
- package/dist/nest/notifications.controller.js.map +1 -1
- package/dist/nest/options.d.ts +41 -5
- package/dist/nest/options.js +15 -3
- package/dist/nest/options.js.map +1 -1
- package/dist/nest/stream.controller.d.ts +5 -3
- package/dist/nest/stream.controller.js +13 -8
- package/dist/nest/stream.controller.js.map +1 -1
- package/dist/nest-auth/index.d.ts +8 -0
- package/dist/nest-auth/index.js +22 -0
- package/dist/nest-auth/index.js.map +1 -0
- package/package.json +28 -12
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The auth adapter for the platform's own sign-in (@haatlabs-core/nest-auth): the caller is the
|
|
3
|
+
* principal `AuthModule`'s guard signed in, with its store when it signed in from the embed.
|
|
4
|
+
*
|
|
5
|
+
* NotificationsModule.forRoot({ auth: nestAuthAdapter, … })
|
|
6
|
+
*/
|
|
7
|
+
export const nestAuthAdapter = {
|
|
8
|
+
useFactory: () => ({
|
|
9
|
+
callerOf: (context) => {
|
|
10
|
+
const principal = context.switchToHttp().getRequest().principal;
|
|
11
|
+
return principal
|
|
12
|
+
? {
|
|
13
|
+
organizationId: principal.organizationId,
|
|
14
|
+
userId: principal.userId,
|
|
15
|
+
role: principal.role,
|
|
16
|
+
storeId: principal.via === 'embedded' ? (principal.storeId ?? null) : null,
|
|
17
|
+
}
|
|
18
|
+
: null;
|
|
19
|
+
},
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nest-auth/index.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAA+B;IACzD,UAAU,EAAE,GAAsB,EAAE,CAAC,CAAC;QACpC,QAAQ,EAAE,CAAC,OAAyB,EAAE,EAAE;YACtC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAkB,CAAC,SAAS,CAAC;YAChF,OAAO,SAAS;gBACd,CAAC,CAAC;oBACE,cAAc,EAAE,SAAS,CAAC,cAAc;oBACxC,MAAM,EAAE,SAAS,CAAC,MAAM;oBACxB,IAAI,EAAE,SAAS,CAAC,IAAI;oBACpB,OAAO,EAAE,SAAS,CAAC,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;iBAC3E;gBACH,CAAC,CAAC,IAAI,CAAC;QACX,CAAC;KACF,CAAC;CACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haatlabs-core/notifications",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.1",
|
|
4
4
|
"description": "In-app notifications for NestJS apps: event registry, preferences, inbox, live stream, email and web push.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"haatlabs",
|
|
@@ -55,6 +55,16 @@
|
|
|
55
55
|
"types": "./dist/cjs/browser/index.d.ts",
|
|
56
56
|
"default": "./dist/cjs/browser/index.js"
|
|
57
57
|
}
|
|
58
|
+
},
|
|
59
|
+
"./nest-auth": {
|
|
60
|
+
"import": {
|
|
61
|
+
"types": "./dist/nest-auth/index.d.ts",
|
|
62
|
+
"default": "./dist/nest-auth/index.js"
|
|
63
|
+
},
|
|
64
|
+
"require": {
|
|
65
|
+
"types": "./dist/cjs/nest-auth/index.d.ts",
|
|
66
|
+
"default": "./dist/cjs/nest-auth/index.js"
|
|
67
|
+
}
|
|
58
68
|
}
|
|
59
69
|
},
|
|
60
70
|
"haatlabs": {
|
|
@@ -74,10 +84,11 @@
|
|
|
74
84
|
"reflect-metadata": "^0.2.2",
|
|
75
85
|
"rxjs": "^7.8.2",
|
|
76
86
|
"testcontainers": "^12.2.0",
|
|
77
|
-
"@haatlabs-core/
|
|
78
|
-
"@haatlabs-core/
|
|
79
|
-
"@haatlabs-core/
|
|
80
|
-
"@haatlabs-core/
|
|
87
|
+
"@haatlabs-core/nest-auth": "0.29.1",
|
|
88
|
+
"@haatlabs-core/queue": "0.29.1",
|
|
89
|
+
"@haatlabs-core/mailer": "0.29.1",
|
|
90
|
+
"@haatlabs-core/tsconfig": "0.29.1",
|
|
91
|
+
"@haatlabs-core/vitest-config": "0.29.1"
|
|
81
92
|
},
|
|
82
93
|
"dependencies": {
|
|
83
94
|
"@types/web-push": "^3.6.4",
|
|
@@ -85,18 +96,23 @@
|
|
|
85
96
|
"ioredis": "^6.0.0",
|
|
86
97
|
"web-push": "^4.0.0",
|
|
87
98
|
"zod": "^4.6.5",
|
|
88
|
-
"@haatlabs-core/config-core": "0.
|
|
89
|
-
"@haatlabs-core/db-core": "0.
|
|
90
|
-
"@haatlabs-core/nest-
|
|
91
|
-
"@haatlabs-core/
|
|
92
|
-
"@haatlabs-core/
|
|
93
|
-
"@haatlabs-core/errors": "0.28.0"
|
|
99
|
+
"@haatlabs-core/config-core": "0.29.1",
|
|
100
|
+
"@haatlabs-core/db-core": "0.29.1",
|
|
101
|
+
"@haatlabs-core/nest-common": "0.29.1",
|
|
102
|
+
"@haatlabs-core/logger": "0.29.1",
|
|
103
|
+
"@haatlabs-core/errors": "0.29.1"
|
|
94
104
|
},
|
|
95
105
|
"peerDependencies": {
|
|
96
106
|
"@nestjs/common": "^12.1.2",
|
|
97
107
|
"@nestjs/core": "^12.1.2",
|
|
98
108
|
"reflect-metadata": "^0.2.2",
|
|
99
|
-
"rxjs": "^7.8.2"
|
|
109
|
+
"rxjs": "^7.8.2",
|
|
110
|
+
"@haatlabs-core/nest-auth": ">=0.28.0"
|
|
111
|
+
},
|
|
112
|
+
"peerDependenciesMeta": {
|
|
113
|
+
"@haatlabs-core/nest-auth": {
|
|
114
|
+
"optional": true
|
|
115
|
+
}
|
|
100
116
|
},
|
|
101
117
|
"scripts": {
|
|
102
118
|
"build": "rm -rf dist && tsc -p tsconfig.build.json && node ../../scripts/build-cjs.mjs",
|