powr-sdk-api 4.1.2 → 4.1.3
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.
|
@@ -35,12 +35,14 @@ const verifyToken = async (req, res, next) => {
|
|
|
35
35
|
|
|
36
36
|
// Verify JWT token
|
|
37
37
|
const decoded = jwt.verify(token, config.jwtToken);
|
|
38
|
+
console.log("🔐 JWT Token verification successful");
|
|
38
39
|
console.log("JWT Decoded user data:", JSON.stringify(decoded, null, 2));
|
|
39
40
|
req.user = {
|
|
40
41
|
powrId: decoded.userId,
|
|
41
42
|
fullName: decoded.fullName,
|
|
42
43
|
access: decoded.access
|
|
43
44
|
};
|
|
45
|
+
console.log("👤 User object set on request:", JSON.stringify(req.user, null, 2));
|
|
44
46
|
next();
|
|
45
47
|
} catch (error) {
|
|
46
48
|
console.error("Error in auth middleware:", error);
|
package/dist/routes/tools.js
CHANGED
|
@@ -83,8 +83,11 @@ router.post("/toggle", async (req, res) => {
|
|
|
83
83
|
|
|
84
84
|
// Get all available tools
|
|
85
85
|
router.get('/', async (req, res) => {
|
|
86
|
+
console.log("🔧 Tools GET request received");
|
|
87
|
+
console.log("👤 User from request:", JSON.stringify(req.user, null, 2));
|
|
86
88
|
try {
|
|
87
89
|
const tools = toolsManager.getAllTools();
|
|
90
|
+
console.log("📋 Retrieved tools:", tools.length);
|
|
88
91
|
return res.status(200).json({
|
|
89
92
|
success: true,
|
|
90
93
|
data: tools,
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
getDb
|
|
5
|
+
} = require('../services/mongo');
|
|
6
|
+
async function updateToolsSchema() {
|
|
7
|
+
try {
|
|
8
|
+
const db = await getDb();
|
|
9
|
+
|
|
10
|
+
// Update Gmail tool with proper config schema
|
|
11
|
+
await db.collection('tools').updateOne({
|
|
12
|
+
id: 'gmail'
|
|
13
|
+
}, {
|
|
14
|
+
$set: {
|
|
15
|
+
configSchema: {
|
|
16
|
+
email: {
|
|
17
|
+
label: 'Email Address',
|
|
18
|
+
type: 'email',
|
|
19
|
+
required: true,
|
|
20
|
+
placeholder: 'your-email@gmail.com',
|
|
21
|
+
description: 'Your Gmail address'
|
|
22
|
+
},
|
|
23
|
+
appPassword: {
|
|
24
|
+
label: 'App Password',
|
|
25
|
+
type: 'password',
|
|
26
|
+
required: true,
|
|
27
|
+
placeholder: '16-character app password',
|
|
28
|
+
description: 'Gmail App Password (not your regular password)'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
actions: [{
|
|
32
|
+
id: 'send-email',
|
|
33
|
+
name: 'Send Email',
|
|
34
|
+
description: 'Send an email using Gmail SMTP',
|
|
35
|
+
parameters: {
|
|
36
|
+
to: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
required: true,
|
|
39
|
+
description: 'Recipient email address'
|
|
40
|
+
},
|
|
41
|
+
subject: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
required: true,
|
|
44
|
+
description: 'Email subject'
|
|
45
|
+
},
|
|
46
|
+
body: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
required: true,
|
|
49
|
+
description: 'Email body content'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}]
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Update Slack tool with proper config schema
|
|
57
|
+
await db.collection('tools').updateOne({
|
|
58
|
+
id: 'slack'
|
|
59
|
+
}, {
|
|
60
|
+
$set: {
|
|
61
|
+
configSchema: {
|
|
62
|
+
botToken: {
|
|
63
|
+
label: 'Bot Token',
|
|
64
|
+
type: 'password',
|
|
65
|
+
required: true,
|
|
66
|
+
placeholder: 'xoxb-your-bot-token',
|
|
67
|
+
description: 'Slack Bot User OAuth Token'
|
|
68
|
+
},
|
|
69
|
+
channelId: {
|
|
70
|
+
label: 'Default Channel ID',
|
|
71
|
+
type: 'text',
|
|
72
|
+
required: false,
|
|
73
|
+
placeholder: 'C1234567890',
|
|
74
|
+
description: 'Default Slack channel ID (optional)'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
actions: [{
|
|
78
|
+
id: 'send-message',
|
|
79
|
+
name: 'Send Message',
|
|
80
|
+
description: 'Send a message to a Slack channel',
|
|
81
|
+
parameters: {
|
|
82
|
+
channel: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
required: true,
|
|
85
|
+
description: 'Channel ID or name'
|
|
86
|
+
},
|
|
87
|
+
message: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
required: true,
|
|
90
|
+
description: 'Message content'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}]
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Update GitHub tool with proper config schema
|
|
98
|
+
await db.collection('tools').updateOne({
|
|
99
|
+
id: 'github'
|
|
100
|
+
}, {
|
|
101
|
+
$set: {
|
|
102
|
+
configSchema: {
|
|
103
|
+
accessToken: {
|
|
104
|
+
label: 'Personal Access Token',
|
|
105
|
+
type: 'password',
|
|
106
|
+
required: true,
|
|
107
|
+
placeholder: 'ghp_your-token',
|
|
108
|
+
description: 'GitHub Personal Access Token'
|
|
109
|
+
},
|
|
110
|
+
username: {
|
|
111
|
+
label: 'GitHub Username',
|
|
112
|
+
type: 'text',
|
|
113
|
+
required: true,
|
|
114
|
+
placeholder: 'your-github-username',
|
|
115
|
+
description: 'Your GitHub username'
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
actions: [{
|
|
119
|
+
id: 'create-issue',
|
|
120
|
+
name: 'Create Issue',
|
|
121
|
+
description: 'Create a new issue in a repository',
|
|
122
|
+
parameters: {
|
|
123
|
+
repo: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
required: true,
|
|
126
|
+
description: 'Repository name (owner/repo)'
|
|
127
|
+
},
|
|
128
|
+
title: {
|
|
129
|
+
type: 'string',
|
|
130
|
+
required: true,
|
|
131
|
+
description: 'Issue title'
|
|
132
|
+
},
|
|
133
|
+
body: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
required: false,
|
|
136
|
+
description: 'Issue description'
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}]
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
console.log('✅ Updated tools with proper configuration schemas');
|
|
143
|
+
|
|
144
|
+
// Verify the updates
|
|
145
|
+
const tools = await db.collection('tools').find({}).toArray();
|
|
146
|
+
console.log('📋 Current tools:');
|
|
147
|
+
tools.forEach(tool => {
|
|
148
|
+
var _tool$actions;
|
|
149
|
+
console.log(` - ${tool.name}: ${((_tool$actions = tool.actions) === null || _tool$actions === void 0 ? void 0 : _tool$actions.length) || 0} actions, ${Object.keys(tool.configSchema || {}).length} config fields`);
|
|
150
|
+
});
|
|
151
|
+
} catch (error) {
|
|
152
|
+
console.error('❌ Error updating tools schema:', error);
|
|
153
|
+
} finally {
|
|
154
|
+
process.exit(0);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
updateToolsSchema();
|