@teamvortexsoftware/vortex-fastify-5-sdk 0.2.0 → 0.4.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 +6 -0
- package/dist/config.d.ts +8 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/handlers/jwt.d.ts.map +1 -1
- package/dist/handlers/jwt.js +3 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -46,6 +46,8 @@ configureVortex({
|
|
|
46
46
|
? {
|
|
47
47
|
userId: user.id,
|
|
48
48
|
userEmail: user.email,
|
|
49
|
+
userName: user.userName, // Optional: user's display name
|
|
50
|
+
userAvatarUrl: user.userAvatarUrl, // Optional: user's avatar URL
|
|
49
51
|
adminScopes: user.isAdmin ? ['autojoin'] : [], // Optional: grant admin capabilities
|
|
50
52
|
}
|
|
51
53
|
: null;
|
|
@@ -158,6 +160,8 @@ configureVortex({
|
|
|
158
160
|
? {
|
|
159
161
|
userId: user.id,
|
|
160
162
|
userEmail: user.email,
|
|
163
|
+
userName: user.userName, // Optional: user's display name
|
|
164
|
+
userAvatarUrl: user.userAvatarUrl, // Optional: user's avatar URL
|
|
161
165
|
adminScopes: user.isAdmin ? ['autojoin'] : [], // Optional: grant admin capabilities
|
|
162
166
|
}
|
|
163
167
|
: null;
|
|
@@ -209,6 +213,8 @@ configureVortexLazy(async () => ({
|
|
|
209
213
|
? {
|
|
210
214
|
userId: user.id,
|
|
211
215
|
userEmail: user.email,
|
|
216
|
+
userName: user.userName, // Optional: user's display name
|
|
217
|
+
userAvatarUrl: user.userAvatarUrl, // Optional: user's avatar URL
|
|
212
218
|
adminScopes: (await checkUserAdminStatus(user.id)) ? ['autojoin'] : [],
|
|
213
219
|
}
|
|
214
220
|
: null;
|
package/dist/config.d.ts
CHANGED
|
@@ -2,9 +2,15 @@ import { FastifyRequest, FastifyReply } from 'fastify';
|
|
|
2
2
|
export interface AuthenticatedUser {
|
|
3
3
|
userId: string;
|
|
4
4
|
userEmail?: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
userName?: string;
|
|
6
|
+
userAvatarUrl?: string;
|
|
7
7
|
adminScopes?: string[];
|
|
8
|
+
/**
|
|
9
|
+
* Optional list of allowed email domains for invitation restrictions.
|
|
10
|
+
* When present, email invitations will only be allowed to addresses
|
|
11
|
+
* matching one of these domains (e.g., ['acme.com', 'acme.org']).
|
|
12
|
+
*/
|
|
13
|
+
allowedEmailDomains?: string[];
|
|
8
14
|
identifiers?: {
|
|
9
15
|
type: 'email' | 'phone';
|
|
10
16
|
value: string;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAG/B,WAAW,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3D,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EA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"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvD,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAqDrF"}
|
package/dist/handlers/jwt.js
CHANGED
|
@@ -79,8 +79,10 @@ function handleJwtGeneration(request, reply) {
|
|
|
79
79
|
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'Invalid user format: must provide userId and userEmail', 500)];
|
|
80
80
|
}
|
|
81
81
|
jwtParams = {
|
|
82
|
-
user: __assign(__assign(__assign({ id: authenticatedUser.userId, email: authenticatedUser.userEmail }, (authenticatedUser.
|
|
82
|
+
user: __assign(__assign(__assign(__assign({ id: authenticatedUser.userId, email: authenticatedUser.userEmail }, (authenticatedUser.userName && { userName: authenticatedUser.userName })), (authenticatedUser.userAvatarUrl && { userAvatarUrl: authenticatedUser.userAvatarUrl })), (authenticatedUser.adminScopes && authenticatedUser.adminScopes.length > 0 && {
|
|
83
83
|
adminScopes: authenticatedUser.adminScopes
|
|
84
|
+
})), (authenticatedUser.allowedEmailDomains && authenticatedUser.allowedEmailDomains.length > 0 && {
|
|
85
|
+
allowedEmailDomains: authenticatedUser.allowedEmailDomains
|
|
84
86
|
})),
|
|
85
87
|
};
|
|
86
88
|
// Add attributes if present
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@teamvortexsoftware/vortex-fastify-5-sdk",
|
|
3
3
|
"description": "Drop-in Fastify module for Vortex API integration",
|
|
4
4
|
"author": "@teamvortexsoftware",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.4.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"typescript-eslint": "8.50.1"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@teamvortexsoftware/vortex-node-22-sdk": "^0.
|
|
41
|
+
"@teamvortexsoftware/vortex-node-22-sdk": "^0.8.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"fastify": ">=5.0.0"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"build:prod": "pnpm run distclean && turbo run build --filter=@teamvortexsoftware/vortex-fastify-5-sdk && mkdir -p dist.d/prod && mv dist dist.d/prod && echo && echo 'Build in ./dist.d/prod'",
|
|
51
51
|
"prepublish:prod": "cp ./LICENSE ./README.md ./dist.d/prod/ && NODE_SDK_VERSION=$(jq -r '.version' ../vortex-node-22-sdk/package.json) && jq --arg nodeVer \"^$NODE_SDK_VERSION\" 'del(.devDependencies.\"@teamvortexsoftware/eslint-config\") | del(.devDependencies.\"@teamvortexsoftware/typescript-config\") | .dependencies.\"@teamvortexsoftware/vortex-node-22-sdk\" = $nodeVer | del(.scripts.prepack)' ./package.json > ./dist.d/prod/package.json",
|
|
52
52
|
"publish:prod": "pnpm run prepublish:prod && pnpm publish --access public ./dist.d/prod",
|
|
53
|
-
"check-types": "
|
|
53
|
+
"check-types": "tsgo --noEmit",
|
|
54
54
|
"distclean": "rm -rf ./dist ./dist.d",
|
|
55
55
|
"clean": "rm -rf ./dist",
|
|
56
56
|
"dev": "",
|