@teamvortexsoftware/vortex-fastify-5-sdk 0.4.0 → 0.4.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/README.md +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -1
- package/dist/handlers/invitations.d.ts +1 -0
- package/dist/handlers/invitations.d.ts.map +1 -1
- package/dist/handlers/invitations.js +74 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/routes.d.ts +6 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +17 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -85,6 +85,7 @@ Your app automatically gets these API routes:
|
|
|
85
85
|
| `/api/vortex/invitations/accept` | POST | Accept multiple invitations |
|
|
86
86
|
| `/api/vortex/invitations/:id` | GET/DELETE | Get or delete specific invitation |
|
|
87
87
|
| `/api/vortex/invitations/:id/reinvite` | POST | Resend invitation |
|
|
88
|
+
| `/api/vortex/invitation-actions/sync-internal-invitation` | POST | Sync internal invitation action |
|
|
88
89
|
| `/api/vortex/invitations/by-group/:type/:id` | GET/DELETE | Group-based operations |
|
|
89
90
|
|
|
90
91
|
## 🛠️ Setup Options
|
package/dist/config.d.ts
CHANGED
|
@@ -27,6 +27,12 @@ export interface AuthenticatedUser {
|
|
|
27
27
|
export interface InvitationResource {
|
|
28
28
|
invitationId: string;
|
|
29
29
|
}
|
|
30
|
+
export interface SyncInternalInvitationResource {
|
|
31
|
+
creatorId: string;
|
|
32
|
+
targetValue: string;
|
|
33
|
+
action: string;
|
|
34
|
+
componentId: string;
|
|
35
|
+
}
|
|
30
36
|
export interface InvitationTargetResource {
|
|
31
37
|
invitationIds: string[];
|
|
32
38
|
target?: {
|
|
@@ -48,6 +54,7 @@ export interface AccessControlHook<T = unknown> {
|
|
|
48
54
|
}
|
|
49
55
|
export type InvitationAccessHook = AccessControlHook<InvitationResource>;
|
|
50
56
|
export type InvitationTargetAccessHook = AccessControlHook<InvitationTargetResource>;
|
|
57
|
+
export type SyncInternalInvitationAccessHook = AccessControlHook<SyncInternalInvitationResource>;
|
|
51
58
|
export type GroupAccessHook = AccessControlHook<GroupResource>;
|
|
52
59
|
export type BasicAccessHook = AccessControlHook<void>;
|
|
53
60
|
export interface VortexConfig {
|
|
@@ -61,6 +68,7 @@ export interface VortexConfig {
|
|
|
61
68
|
canAccessInvitationsByGroup?: GroupAccessHook;
|
|
62
69
|
canDeleteInvitationsByGroup?: GroupAccessHook;
|
|
63
70
|
canReinvite?: InvitationAccessHook;
|
|
71
|
+
canSyncInternalInvitation?: SyncInternalInvitationAccessHook;
|
|
64
72
|
}
|
|
65
73
|
export declare function configureVortex(config: VortexConfig): void;
|
|
66
74
|
export declare function configureVortexAsync(configPromiseOrConfig: Promise<VortexConfig> | VortexConfig): void | Promise<void>;
|
|
@@ -79,5 +87,6 @@ export declare function createAllowAllAccessControl(): {
|
|
|
79
87
|
canAccessInvitationsByGroup: () => Promise<boolean>;
|
|
80
88
|
canDeleteInvitationsByGroup: () => Promise<boolean>;
|
|
81
89
|
canReinvite: () => Promise<boolean>;
|
|
90
|
+
canSyncInternalInvitation: () => Promise<boolean>;
|
|
82
91
|
};
|
|
83
92
|
//# sourceMappingURL=config.d.ts.map
|
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,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB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,7 @@ function getVortexConfig() {
|
|
|
113
113
|
}
|
|
114
114
|
// Copy hooks from template if they exist
|
|
115
115
|
if (configTemplate) {
|
|
116
|
-
return [2 /*return*/, __assign(__assign({}, baseConfig), { authenticateUser: configTemplate.authenticateUser, canAccessInvitationsByTarget: configTemplate.canAccessInvitationsByTarget, canAccessInvitation: configTemplate.canAccessInvitation, canDeleteInvitation: configTemplate.canDeleteInvitation, canAcceptInvitations: configTemplate.canAcceptInvitations, canAccessInvitationsByGroup: configTemplate.canAccessInvitationsByGroup, canDeleteInvitationsByGroup: configTemplate.canDeleteInvitationsByGroup, canReinvite: configTemplate.canReinvite })];
|
|
116
|
+
return [2 /*return*/, __assign(__assign({}, baseConfig), { authenticateUser: configTemplate.authenticateUser, canAccessInvitationsByTarget: configTemplate.canAccessInvitationsByTarget, canAccessInvitation: configTemplate.canAccessInvitation, canDeleteInvitation: configTemplate.canDeleteInvitation, canAcceptInvitations: configTemplate.canAcceptInvitations, canAccessInvitationsByGroup: configTemplate.canAccessInvitationsByGroup, canDeleteInvitationsByGroup: configTemplate.canDeleteInvitationsByGroup, canReinvite: configTemplate.canReinvite, canSyncInternalInvitation: configTemplate.canSyncInternalInvitation })];
|
|
117
117
|
}
|
|
118
118
|
return [2 /*return*/, baseConfig];
|
|
119
119
|
}
|
|
@@ -164,5 +164,6 @@ function createAllowAllAccessControl() {
|
|
|
164
164
|
canAccessInvitationsByGroup: allowAll,
|
|
165
165
|
canDeleteInvitationsByGroup: allowAll,
|
|
166
166
|
canReinvite: allowAll,
|
|
167
|
+
canSyncInternalInvitation: allowAll,
|
|
167
168
|
};
|
|
168
169
|
}
|
|
@@ -5,5 +5,6 @@ export declare function handleRevokeInvitation(request: FastifyRequest, reply: F
|
|
|
5
5
|
export declare function handleAcceptInvitations(request: FastifyRequest, reply: FastifyReply): Promise<never>;
|
|
6
6
|
export declare function handleGetInvitationsByGroup(request: FastifyRequest, reply: FastifyReply): Promise<never>;
|
|
7
7
|
export declare function handleDeleteInvitationsByGroup(request: FastifyRequest, reply: FastifyReply): Promise<never>;
|
|
8
|
+
export declare function handleSyncInternalInvitation(request: FastifyRequest, reply: FastifyReply): Promise<never>;
|
|
8
9
|
export declare function handleReinvite(request: FastifyRequest, reply: FastifyReply): Promise<never>;
|
|
9
10
|
//# sourceMappingURL=invitations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["../../src/handlers/invitations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvD,wBAAsB,4BAA4B,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAuC9F;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAiCrF;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBA+BxF;AAED,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAgFzF;AAED,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAqC7F;AAED,wBAAsB,8BAA8B,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAqChG;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBA+BhF"}
|
|
1
|
+
{"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["../../src/handlers/invitations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvD,wBAAsB,4BAA4B,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAuC9F;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAiCrF;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBA+BxF;AAED,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAgFzF;AAED,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAqC7F;AAED,wBAAsB,8BAA8B,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAqChG;AAED,wBAAsB,4BAA4B,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBAoD9F;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,kBA+BhF"}
|
|
@@ -42,6 +42,7 @@ exports.handleRevokeInvitation = handleRevokeInvitation;
|
|
|
42
42
|
exports.handleAcceptInvitations = handleAcceptInvitations;
|
|
43
43
|
exports.handleGetInvitationsByGroup = handleGetInvitationsByGroup;
|
|
44
44
|
exports.handleDeleteInvitationsByGroup = handleDeleteInvitationsByGroup;
|
|
45
|
+
exports.handleSyncInternalInvitation = handleSyncInternalInvitation;
|
|
45
46
|
exports.handleReinvite = handleReinvite;
|
|
46
47
|
var vortex_node_22_sdk_1 = require("@teamvortexsoftware/vortex-node-22-sdk");
|
|
47
48
|
var config_1 = require("../config");
|
|
@@ -394,9 +395,79 @@ function handleDeleteInvitationsByGroup(request, reply) {
|
|
|
394
395
|
});
|
|
395
396
|
});
|
|
396
397
|
}
|
|
398
|
+
function handleSyncInternalInvitation(request, reply) {
|
|
399
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
400
|
+
var body, creatorId, targetValue, action, componentId, config, user, hasAccess, vortex, result, error_7;
|
|
401
|
+
return __generator(this, function (_a) {
|
|
402
|
+
switch (_a.label) {
|
|
403
|
+
case 0:
|
|
404
|
+
_a.trys.push([0, 8, , 9]);
|
|
405
|
+
if (request.method !== 'POST') {
|
|
406
|
+
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'Method not allowed', 405)];
|
|
407
|
+
}
|
|
408
|
+
return [4 /*yield*/, (0, utils_1.parseRequestBody)(request)];
|
|
409
|
+
case 1:
|
|
410
|
+
body = _a.sent();
|
|
411
|
+
creatorId = body.creatorId, targetValue = body.targetValue, action = body.action, componentId = body.componentId;
|
|
412
|
+
if (!creatorId || typeof creatorId !== 'string') {
|
|
413
|
+
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'creatorId is required and must be a string', 400)];
|
|
414
|
+
}
|
|
415
|
+
if (!targetValue || typeof targetValue !== 'string') {
|
|
416
|
+
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'targetValue is required and must be a string', 400)];
|
|
417
|
+
}
|
|
418
|
+
if (!action || !['accepted', 'declined'].includes(action)) {
|
|
419
|
+
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'action is required and must be "accepted" or "declined"', 400)];
|
|
420
|
+
}
|
|
421
|
+
if (!componentId || typeof componentId !== 'string') {
|
|
422
|
+
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'componentId is required and must be a string', 400)];
|
|
423
|
+
}
|
|
424
|
+
return [4 /*yield*/, (0, config_1.getVortexConfig)()];
|
|
425
|
+
case 2:
|
|
426
|
+
config = _a.sent();
|
|
427
|
+
return [4 /*yield*/, (0, config_1.authenticateRequest)(request, reply)];
|
|
428
|
+
case 3:
|
|
429
|
+
user = _a.sent();
|
|
430
|
+
if (!config.canSyncInternalInvitation) return [3 /*break*/, 5];
|
|
431
|
+
return [4 /*yield*/, config.canSyncInternalInvitation(request, reply, user, {
|
|
432
|
+
creatorId: (0, utils_1.sanitizeInput)(creatorId),
|
|
433
|
+
targetValue: (0, utils_1.sanitizeInput)(targetValue),
|
|
434
|
+
action: action,
|
|
435
|
+
componentId: (0, utils_1.sanitizeInput)(componentId),
|
|
436
|
+
})];
|
|
437
|
+
case 4:
|
|
438
|
+
hasAccess = _a.sent();
|
|
439
|
+
if (!hasAccess) {
|
|
440
|
+
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'Access denied', 403)];
|
|
441
|
+
}
|
|
442
|
+
return [3 /*break*/, 6];
|
|
443
|
+
case 5:
|
|
444
|
+
if (!user) {
|
|
445
|
+
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'Access denied. Configure access control hooks for invitation endpoints.', 403)];
|
|
446
|
+
}
|
|
447
|
+
_a.label = 6;
|
|
448
|
+
case 6:
|
|
449
|
+
vortex = new vortex_node_22_sdk_1.Vortex(config.apiKey);
|
|
450
|
+
return [4 /*yield*/, vortex.syncInternalInvitation({
|
|
451
|
+
creatorId: (0, utils_1.sanitizeInput)(creatorId),
|
|
452
|
+
targetValue: (0, utils_1.sanitizeInput)(targetValue),
|
|
453
|
+
action: action,
|
|
454
|
+
componentId: (0, utils_1.sanitizeInput)(componentId),
|
|
455
|
+
})];
|
|
456
|
+
case 7:
|
|
457
|
+
result = _a.sent();
|
|
458
|
+
return [2 /*return*/, (0, utils_1.createApiResponse)(reply, result)];
|
|
459
|
+
case 8:
|
|
460
|
+
error_7 = _a.sent();
|
|
461
|
+
console.error('Error in handleSyncInternalInvitation:', error_7);
|
|
462
|
+
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'An error occurred while processing your request', 500)];
|
|
463
|
+
case 9: return [2 /*return*/];
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
}
|
|
397
468
|
function handleReinvite(request, reply) {
|
|
398
469
|
return __awaiter(this, void 0, void 0, function () {
|
|
399
|
-
var invitationId, sanitizedId, config, user, hasAccess, vortex, invitation,
|
|
470
|
+
var invitationId, sanitizedId, config, user, hasAccess, vortex, invitation, error_8;
|
|
400
471
|
return __generator(this, function (_a) {
|
|
401
472
|
switch (_a.label) {
|
|
402
473
|
case 0:
|
|
@@ -435,8 +506,8 @@ function handleReinvite(request, reply) {
|
|
|
435
506
|
invitation = _a.sent();
|
|
436
507
|
return [2 /*return*/, (0, utils_1.createApiResponse)(reply, invitation)];
|
|
437
508
|
case 7:
|
|
438
|
-
|
|
439
|
-
console.error('Error in handleReinvite:',
|
|
509
|
+
error_8 = _a.sent();
|
|
510
|
+
console.error('Error in handleReinvite:', error_8);
|
|
440
511
|
return [2 /*return*/, (0, utils_1.createErrorResponse)(reply, 'An error occurred while processing your request', 500)];
|
|
441
512
|
case 8: return [2 /*return*/];
|
|
442
513
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { configureVortex, configureVortexAsync, configureVortexLazy, getVortexConfig, authenticateRequest, createAllowAllAccessControl } from './config';
|
|
2
|
-
export type { VortexConfig, AuthenticatedUser, AccessControlHook, InvitationResource, InvitationTargetResource, GroupResource, InvitationAccessHook, InvitationTargetAccessHook, GroupAccessHook, BasicAccessHook } from './config';
|
|
2
|
+
export type { VortexConfig, AuthenticatedUser, AccessControlHook, InvitationResource, InvitationTargetResource, SyncInternalInvitationResource, GroupResource, InvitationAccessHook, InvitationTargetAccessHook, SyncInternalInvitationAccessHook, GroupAccessHook, BasicAccessHook } from './config';
|
|
3
3
|
export { createVortexJwtRoute, createVortexInvitationsRoute, createVortexInvitationRoute, createVortexInvitationsAcceptRoute, createVortexInvitationsByGroupRoute, createVortexReinviteRoute, createVortexRoutes, vortexPlugin, registerVortexRoutes, VORTEX_ROUTES, createVortexApiPath, } from './routes';
|
|
4
4
|
export type { VortexPluginOptions } from './routes';
|
|
5
5
|
export { handleJwtGeneration, } from './handlers/jwt';
|
|
6
|
-
export { handleGetInvitationsByTarget, handleGetInvitation, handleRevokeInvitation, handleAcceptInvitations, handleGetInvitationsByGroup, handleDeleteInvitationsByGroup, handleReinvite, } from './handlers/invitations';
|
|
6
|
+
export { handleGetInvitationsByTarget, handleGetInvitation, handleRevokeInvitation, handleAcceptInvitations, handleGetInvitationsByGroup, handleDeleteInvitationsByGroup, handleReinvite, handleSyncInternalInvitation, } from './handlers/invitations';
|
|
7
7
|
export { createApiResponse, createErrorResponse, parseRequestBody, getQueryParam, getRouteParam, validateRequiredFields, sanitizeInput, } from './utils';
|
|
8
8
|
export * from '@teamvortexsoftware/vortex-node-22-sdk';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,eAAe,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACzJ,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,oBAAoB,EACpB,0BAA0B,EAC1B,eAAe,EACf,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,2BAA2B,EAC3B,kCAAkC,EAClC,mCAAmC,EACnC,yBAAyB,EACzB,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EACL,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,EAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,eAAe,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACzJ,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,8BAA8B,EAC9B,aAAa,EACb,oBAAoB,EACpB,0BAA0B,EAC1B,gCAAgC,EAChC,eAAe,EACf,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,2BAA2B,EAC3B,kCAAkC,EAClC,mCAAmC,EACnC,yBAAyB,EACzB,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EACL,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,EAC9B,cAAc,EACd,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,cAAc,wCAAwC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.sanitizeInput = exports.validateRequiredFields = exports.getRouteParam = exports.getQueryParam = exports.parseRequestBody = exports.createErrorResponse = exports.createApiResponse = exports.handleReinvite = exports.handleDeleteInvitationsByGroup = exports.handleGetInvitationsByGroup = exports.handleAcceptInvitations = exports.handleRevokeInvitation = exports.handleGetInvitation = exports.handleGetInvitationsByTarget = exports.handleJwtGeneration = exports.createVortexApiPath = exports.VORTEX_ROUTES = exports.registerVortexRoutes = exports.vortexPlugin = exports.createVortexRoutes = exports.createVortexReinviteRoute = exports.createVortexInvitationsByGroupRoute = exports.createVortexInvitationsAcceptRoute = exports.createVortexInvitationRoute = exports.createVortexInvitationsRoute = exports.createVortexJwtRoute = exports.createAllowAllAccessControl = exports.authenticateRequest = exports.getVortexConfig = exports.configureVortexLazy = exports.configureVortexAsync = exports.configureVortex = void 0;
|
|
17
|
+
exports.sanitizeInput = exports.validateRequiredFields = exports.getRouteParam = exports.getQueryParam = exports.parseRequestBody = exports.createErrorResponse = exports.createApiResponse = exports.handleSyncInternalInvitation = exports.handleReinvite = exports.handleDeleteInvitationsByGroup = exports.handleGetInvitationsByGroup = exports.handleAcceptInvitations = exports.handleRevokeInvitation = exports.handleGetInvitation = exports.handleGetInvitationsByTarget = exports.handleJwtGeneration = exports.createVortexApiPath = exports.VORTEX_ROUTES = exports.registerVortexRoutes = exports.vortexPlugin = exports.createVortexRoutes = exports.createVortexReinviteRoute = exports.createVortexInvitationsByGroupRoute = exports.createVortexInvitationsAcceptRoute = exports.createVortexInvitationRoute = exports.createVortexInvitationsRoute = exports.createVortexJwtRoute = exports.createAllowAllAccessControl = exports.authenticateRequest = exports.getVortexConfig = exports.configureVortexLazy = exports.configureVortexAsync = exports.configureVortex = void 0;
|
|
18
18
|
var config_1 = require("./config");
|
|
19
19
|
Object.defineProperty(exports, "configureVortex", { enumerable: true, get: function () { return config_1.configureVortex; } });
|
|
20
20
|
Object.defineProperty(exports, "configureVortexAsync", { enumerable: true, get: function () { return config_1.configureVortexAsync; } });
|
|
@@ -44,6 +44,7 @@ Object.defineProperty(exports, "handleAcceptInvitations", { enumerable: true, ge
|
|
|
44
44
|
Object.defineProperty(exports, "handleGetInvitationsByGroup", { enumerable: true, get: function () { return invitations_1.handleGetInvitationsByGroup; } });
|
|
45
45
|
Object.defineProperty(exports, "handleDeleteInvitationsByGroup", { enumerable: true, get: function () { return invitations_1.handleDeleteInvitationsByGroup; } });
|
|
46
46
|
Object.defineProperty(exports, "handleReinvite", { enumerable: true, get: function () { return invitations_1.handleReinvite; } });
|
|
47
|
+
Object.defineProperty(exports, "handleSyncInternalInvitation", { enumerable: true, get: function () { return invitations_1.handleSyncInternalInvitation; } });
|
|
47
48
|
var utils_1 = require("./utils");
|
|
48
49
|
Object.defineProperty(exports, "createApiResponse", { enumerable: true, get: function () { return utils_1.createApiResponse; } });
|
|
49
50
|
Object.defineProperty(exports, "createErrorResponse", { enumerable: true, get: function () { return utils_1.createErrorResponse; } });
|
package/dist/routes.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const VORTEX_ROUTES: {
|
|
|
10
10
|
readonly INVITATIONS_ACCEPT: "/invitations/accept";
|
|
11
11
|
readonly INVITATIONS_BY_GROUP: "/invitations/by-group/:groupType/:groupId";
|
|
12
12
|
readonly INVITATION_REINVITE: "/invitations/:invitationId/reinvite";
|
|
13
|
+
readonly SYNC_INTERNAL_INVITATION: "/invitation-actions/sync-internal-invitation";
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* Utility to create the full API path based on base URL
|
|
@@ -45,6 +46,10 @@ export declare function createVortexInvitationsByGroupRoute(): {
|
|
|
45
46
|
* Creates individual route handlers for reinvite endpoint
|
|
46
47
|
*/
|
|
47
48
|
export declare function createVortexReinviteRoute(): (request: FastifyRequest, reply: FastifyReply) => Promise<never>;
|
|
49
|
+
/**
|
|
50
|
+
* Creates individual route handlers for sync internal invitation endpoint
|
|
51
|
+
*/
|
|
52
|
+
export declare function createVortexSyncInternalInvitationRoute(): (request: FastifyRequest, reply: FastifyReply) => Promise<never>;
|
|
48
53
|
/**
|
|
49
54
|
* Creates all Vortex routes for manual registration
|
|
50
55
|
* This provides individual handlers that can be attached to specific routes
|
|
@@ -62,6 +67,7 @@ export declare function createVortexRoutes(): {
|
|
|
62
67
|
delete: (request: FastifyRequest, reply: FastifyReply) => Promise<never>;
|
|
63
68
|
};
|
|
64
69
|
invitationReinvite: (request: FastifyRequest, reply: FastifyReply) => Promise<never>;
|
|
70
|
+
syncInternalInvitation: (request: FastifyRequest, reply: FastifyReply) => Promise<never>;
|
|
65
71
|
};
|
|
66
72
|
/**
|
|
67
73
|
* Creates a Fastify plugin with all Vortex routes configured
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAa5F;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;CAQhB,CAAC;AAEX;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,OAAO,aAAa,GAAG,MAAM,CAE9F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,KACZ,SAAS,cAAc,EAAE,OAAO,YAAY,oBAGnE;AAED;;GAEG;AACH,wBAAgB,4BAA4B,KACpB,SAAS,cAAc,EAAE,OAAO,YAAY,oBAGnE;AAED;;GAEG;AACH,wBAAgB,2BAA2B;mBAEV,cAAc,SAAS,YAAY;sBAGhC,cAAc,SAAS,YAAY;EAItE;AAED;;GAEG;AACH,wBAAgB,kCAAkC,KAC1B,SAAS,cAAc,EAAE,OAAO,YAAY,oBAGnE;AAED;;GAEG;AACH,wBAAgB,mCAAmC;mBAElB,cAAc,SAAS,YAAY;sBAGhC,cAAc,SAAS,YAAY;EAItE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,KACjB,SAAS,cAAc,EAAE,OAAO,YAAY,oBAGnE;AAED;;GAEG;AACH,wBAAgB,uCAAuC,KAC/B,SAAS,cAAc,EAAE,OAAO,YAAY,oBAGnE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB;mBAzED,cAAc,SAAS,YAAY;2BASnC,cAAc,SAAS,YAAY;;uBAUnC,cAAc,SAAS,YAAY;0BAGhC,cAAc,SAAS,YAAY;;iCAUtC,cAAc,SAAS,YAAY;;uBAUnC,cAAc,SAAS,YAAY;0BAGhC,cAAc,SAAS,YAAY;;kCAUtC,cAAc,SAAS,YAAY;sCASnC,cAAc,SAAS,YAAY;EAmBnE;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,EAAE,kBAe1B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,GAAE,MAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAcpH;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/routes.js
CHANGED
|
@@ -44,6 +44,7 @@ exports.createVortexInvitationRoute = createVortexInvitationRoute;
|
|
|
44
44
|
exports.createVortexInvitationsAcceptRoute = createVortexInvitationsAcceptRoute;
|
|
45
45
|
exports.createVortexInvitationsByGroupRoute = createVortexInvitationsByGroupRoute;
|
|
46
46
|
exports.createVortexReinviteRoute = createVortexReinviteRoute;
|
|
47
|
+
exports.createVortexSyncInternalInvitationRoute = createVortexSyncInternalInvitationRoute;
|
|
47
48
|
exports.createVortexRoutes = createVortexRoutes;
|
|
48
49
|
exports.registerVortexRoutes = registerVortexRoutes;
|
|
49
50
|
var jwt_1 = require("./handlers/jwt");
|
|
@@ -59,6 +60,7 @@ exports.VORTEX_ROUTES = {
|
|
|
59
60
|
INVITATIONS_ACCEPT: '/invitations/accept',
|
|
60
61
|
INVITATIONS_BY_GROUP: '/invitations/by-group/:groupType/:groupId',
|
|
61
62
|
INVITATION_REINVITE: '/invitations/:invitationId/reinvite',
|
|
63
|
+
SYNC_INTERNAL_INVITATION: '/invitation-actions/sync-internal-invitation',
|
|
62
64
|
};
|
|
63
65
|
/**
|
|
64
66
|
* Utility to create the full API path based on base URL
|
|
@@ -156,6 +158,18 @@ function createVortexReinviteRoute() {
|
|
|
156
158
|
});
|
|
157
159
|
};
|
|
158
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Creates individual route handlers for sync internal invitation endpoint
|
|
163
|
+
*/
|
|
164
|
+
function createVortexSyncInternalInvitationRoute() {
|
|
165
|
+
return function (request, reply) {
|
|
166
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
167
|
+
return __generator(this, function (_a) {
|
|
168
|
+
return [2 /*return*/, (0, invitations_1.handleSyncInternalInvitation)(request, reply)];
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
}
|
|
159
173
|
/**
|
|
160
174
|
* Creates all Vortex routes for manual registration
|
|
161
175
|
* This provides individual handlers that can be attached to specific routes
|
|
@@ -168,6 +182,7 @@ function createVortexRoutes() {
|
|
|
168
182
|
invitationsAccept: createVortexInvitationsAcceptRoute(),
|
|
169
183
|
invitationsByGroup: createVortexInvitationsByGroupRoute(),
|
|
170
184
|
invitationReinvite: createVortexReinviteRoute(),
|
|
185
|
+
syncInternalInvitation: createVortexSyncInternalInvitationRoute(),
|
|
171
186
|
};
|
|
172
187
|
}
|
|
173
188
|
/**
|
|
@@ -197,6 +212,7 @@ var vortexPlugin = function vortexPlugin(fastify) {
|
|
|
197
212
|
fastify.get(exports.VORTEX_ROUTES.INVITATIONS_BY_GROUP, routes.invitationsByGroup.get);
|
|
198
213
|
fastify.delete(exports.VORTEX_ROUTES.INVITATIONS_BY_GROUP, routes.invitationsByGroup.delete);
|
|
199
214
|
fastify.post(exports.VORTEX_ROUTES.INVITATION_REINVITE, routes.invitationReinvite);
|
|
215
|
+
fastify.post(exports.VORTEX_ROUTES.SYNC_INTERNAL_INVITATION, routes.syncInternalInvitation);
|
|
200
216
|
return [2 /*return*/];
|
|
201
217
|
});
|
|
202
218
|
});
|
|
@@ -233,6 +249,7 @@ function registerVortexRoutes(fastify_1) {
|
|
|
233
249
|
fastify.get("".concat(cleanBasePath).concat(exports.VORTEX_ROUTES.INVITATIONS_BY_GROUP), routes.invitationsByGroup.get);
|
|
234
250
|
fastify.delete("".concat(cleanBasePath).concat(exports.VORTEX_ROUTES.INVITATIONS_BY_GROUP), routes.invitationsByGroup.delete);
|
|
235
251
|
fastify.post("".concat(cleanBasePath).concat(exports.VORTEX_ROUTES.INVITATION_REINVITE), routes.invitationReinvite);
|
|
252
|
+
fastify.post("".concat(cleanBasePath).concat(exports.VORTEX_ROUTES.SYNC_INTERNAL_INVITATION), routes.syncInternalInvitation);
|
|
236
253
|
return [2 /*return*/];
|
|
237
254
|
});
|
|
238
255
|
});
|
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.4.
|
|
5
|
+
"version": "0.4.1",
|
|
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.8.
|
|
41
|
+
"@teamvortexsoftware/vortex-node-22-sdk": "^0.8.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"fastify": ">=5.0.0"
|