@teamvortexsoftware/vortex-fastify-5-sdk 0.0.8 → 0.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 +21 -0
- package/dist/config.d.ts +3 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/handlers/invitations.js +2 -2
- package/dist/handlers/jwt.d.ts.map +1 -1
- package/dist/handlers/jwt.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Drop-in Fastify integration for Vortex invitations and JWT functionality. Get up and running in under 2 minutes!
|
|
4
4
|
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### Invitation Delivery Types
|
|
8
|
+
|
|
9
|
+
Vortex supports multiple delivery methods for invitations:
|
|
10
|
+
|
|
11
|
+
- **`email`** - Email invitations sent by Vortex (includes reminders and nudges)
|
|
12
|
+
- **`phone`** - Phone invitations sent by the user/customer
|
|
13
|
+
- **`share`** - Shareable invitation links for social sharing
|
|
14
|
+
- **`internal`** - Internal invitations managed entirely by your application
|
|
15
|
+
- No email/SMS communication triggered by Vortex
|
|
16
|
+
- Target value can be any customer-defined identifier (UUID, string, number)
|
|
17
|
+
- Useful for in-app invitation flows where you handle the delivery
|
|
18
|
+
- Example use case: In-app notifications, dashboard invites, etc.
|
|
19
|
+
|
|
5
20
|
## 🚀 Quick Start
|
|
6
21
|
|
|
7
22
|
```bash
|
|
@@ -31,6 +46,8 @@ configureVortex({
|
|
|
31
46
|
? {
|
|
32
47
|
userId: user.id,
|
|
33
48
|
userEmail: user.email,
|
|
49
|
+
userName: user.userName, // Optional: user's display name
|
|
50
|
+
userAvatarUrl: user.userAvatarUrl, // Optional: user's avatar URL
|
|
34
51
|
adminScopes: user.isAdmin ? ['autojoin'] : [], // Optional: grant admin capabilities
|
|
35
52
|
}
|
|
36
53
|
: null;
|
|
@@ -143,6 +160,8 @@ configureVortex({
|
|
|
143
160
|
? {
|
|
144
161
|
userId: user.id,
|
|
145
162
|
userEmail: user.email,
|
|
163
|
+
userName: user.userName, // Optional: user's display name
|
|
164
|
+
userAvatarUrl: user.userAvatarUrl, // Optional: user's avatar URL
|
|
146
165
|
adminScopes: user.isAdmin ? ['autojoin'] : [], // Optional: grant admin capabilities
|
|
147
166
|
}
|
|
148
167
|
: null;
|
|
@@ -194,6 +213,8 @@ configureVortexLazy(async () => ({
|
|
|
194
213
|
? {
|
|
195
214
|
userId: user.id,
|
|
196
215
|
userEmail: user.email,
|
|
216
|
+
userName: user.userName, // Optional: user's display name
|
|
217
|
+
userAvatarUrl: user.userAvatarUrl, // Optional: user's avatar URL
|
|
197
218
|
adminScopes: (await checkUserAdminStatus(user.id)) ? ['autojoin'] : [],
|
|
198
219
|
}
|
|
199
220
|
: null;
|
package/dist/config.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ import { FastifyRequest, FastifyReply } from 'fastify';
|
|
|
2
2
|
export interface AuthenticatedUser {
|
|
3
3
|
userId: string;
|
|
4
4
|
userEmail?: string;
|
|
5
|
+
userName?: string;
|
|
6
|
+
userAvatarUrl?: string;
|
|
5
7
|
adminScopes?: string[];
|
|
6
8
|
identifiers?: {
|
|
7
|
-
type: 'email' | '
|
|
9
|
+
type: 'email' | 'phone';
|
|
8
10
|
value: string;
|
|
9
11
|
}[];
|
|
10
12
|
groups?: {
|
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,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAGvB,WAAW,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,GAAG,
|
|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,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,CAwC7D;AAGD,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAczH;AAED;;;GAGG;AACH,wBAAgB,2BAA2B;;;;;;;;EAY1C"}
|
|
@@ -239,8 +239,8 @@ function handleAcceptInvitations(request, reply) {
|
|
|
239
239
|
if (!targetObj.type || !targetObj.value) {
|
|
240
240
|
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'target must have type and value properties', 400)];
|
|
241
241
|
}
|
|
242
|
-
if (!['email', 'username', 'phoneNumber', '
|
|
243
|
-
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'target.type must be email, username, phoneNumber, or
|
|
242
|
+
if (!['email', 'username', 'phoneNumber', 'phone'].includes(targetObj.type)) {
|
|
243
|
+
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'target.type must be email, username, phoneNumber, or phone', 400)];
|
|
244
244
|
}
|
|
245
245
|
acceptData = {
|
|
246
246
|
type: targetObj.type,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/handlers/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvD,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/handlers/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvD,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAkDrF"}
|
package/dist/handlers/jwt.js
CHANGED
|
@@ -79,7 +79,7 @@ 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({ id: authenticatedUser.userId, email: authenticatedUser.userEmail }, (authenticatedUser.adminScopes && authenticatedUser.adminScopes.length > 0 && {
|
|
82
|
+
user: __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
84
|
})),
|
|
85
85
|
};
|
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.0
|
|
5
|
+
"version": "0.3.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.6.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"fastify": ">=5.0.0"
|