@sodikinnaa/smart-report-plugin 2100.9.0 → 2100.9.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/index.js +31 -8
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -2
- package/src/index.ts +19 -3
- package/tsconfig.cjs.json +9 -0
- package/tsconfig.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.activate = exports.register = void 0;
|
|
1
7
|
/**
|
|
2
8
|
* Smart Report MCP Plugin for OpenClaw
|
|
3
9
|
*/
|
|
4
|
-
|
|
10
|
+
const axios_1 = __importDefault(require("axios"));
|
|
5
11
|
const PLUGIN_ID = 'smart-report-plugin';
|
|
6
12
|
const API_BASE = 'https://member.smartreport.my.id/api/mcp';
|
|
7
13
|
async function callMcp(api, method, params = {}) {
|
|
@@ -10,7 +16,7 @@ async function callMcp(api, method, params = {}) {
|
|
|
10
16
|
if (!token) {
|
|
11
17
|
throw new Error('API Token not found. Please run "openclaw smart-auth <token>" first.');
|
|
12
18
|
}
|
|
13
|
-
const response = await
|
|
19
|
+
const response = await axios_1.default.post(API_BASE, {
|
|
14
20
|
jsonrpc: '2.0',
|
|
15
21
|
method: method,
|
|
16
22
|
params: params,
|
|
@@ -30,7 +36,7 @@ async function callMcp(api, method, params = {}) {
|
|
|
30
36
|
const plugin = {
|
|
31
37
|
id: PLUGIN_ID,
|
|
32
38
|
name: "Smart Report Integration",
|
|
33
|
-
version: "2100.9.
|
|
39
|
+
version: "2100.9.1",
|
|
34
40
|
register(api) {
|
|
35
41
|
// 1. CLI Commands
|
|
36
42
|
api.registerCli(({ program }) => {
|
|
@@ -38,8 +44,23 @@ const plugin = {
|
|
|
38
44
|
.command('smart-auth <token>')
|
|
39
45
|
.description('Set API Token for Smart Report integration')
|
|
40
46
|
.action(async (token) => {
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
process.stdout.write('🔍 Verifying token and fetching company info...');
|
|
48
|
+
try {
|
|
49
|
+
// Temporarily set token to verify
|
|
50
|
+
api.config.apiToken = token;
|
|
51
|
+
const companyInfo = await callMcp(api, 'company/info', {});
|
|
52
|
+
await api.saveConfig({
|
|
53
|
+
apiToken: token,
|
|
54
|
+
companyName: companyInfo.name,
|
|
55
|
+
companyDomain: companyInfo.domain
|
|
56
|
+
});
|
|
57
|
+
console.log(`\r✅ Authenticated for: ${companyInfo.name} (${companyInfo.domain})`);
|
|
58
|
+
console.log(' Smart Report API Token saved successfully.');
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
console.error(`\r❌ Authentication failed: ${err.message}`);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
43
64
|
});
|
|
44
65
|
}, { commands: ['smart-auth'] });
|
|
45
66
|
// 2. Resources
|
|
@@ -161,6 +182,8 @@ const plugin = {
|
|
|
161
182
|
});
|
|
162
183
|
}
|
|
163
184
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
185
|
+
const register = (api) => plugin.register(api);
|
|
186
|
+
exports.register = register;
|
|
187
|
+
const activate = (api) => plugin.register(api);
|
|
188
|
+
exports.activate = activate;
|
|
189
|
+
exports.default = plugin;
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "smart-report-plugin",
|
|
3
3
|
"name": "Smart Report Integration",
|
|
4
|
-
"version": "2100.9.
|
|
4
|
+
"version": "2100.9.1",
|
|
5
5
|
"description": "Integration plugin for Smart Report and AI Analytics with Daily Dashboard and Dynamic Guides",
|
|
6
6
|
"entrypoint": "./dist/index.js",
|
|
7
7
|
"skills": [
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sodikinnaa/smart-report-plugin",
|
|
3
|
-
"version": "2100.9.
|
|
3
|
+
"version": "2100.9.1",
|
|
4
4
|
"description": "OpenClaw plugin for Smart Report system integration with Daily Dashboard",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
|
-
"type": "module",
|
|
8
7
|
"types": "dist/index.d.ts",
|
|
9
8
|
"scripts": {
|
|
10
9
|
"build": "tsc && node scripts/audit-sync.js",
|
package/src/index.ts
CHANGED
|
@@ -37,7 +37,7 @@ async function callMcp(api: any, method: string, params: any = {}) {
|
|
|
37
37
|
const plugin: any = {
|
|
38
38
|
id: PLUGIN_ID,
|
|
39
39
|
name: "Smart Report Integration",
|
|
40
|
-
version: "2100.9.
|
|
40
|
+
version: "2100.9.1",
|
|
41
41
|
|
|
42
42
|
register(api: any) {
|
|
43
43
|
// 1. CLI Commands
|
|
@@ -46,8 +46,24 @@ const plugin: any = {
|
|
|
46
46
|
.command('smart-auth <token>')
|
|
47
47
|
.description('Set API Token for Smart Report integration')
|
|
48
48
|
.action(async (token: string) => {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
process.stdout.write('🔍 Verifying token and fetching company info...');
|
|
50
|
+
try {
|
|
51
|
+
// Temporarily set token to verify
|
|
52
|
+
api.config.apiToken = token;
|
|
53
|
+
const companyInfo = await callMcp(api, 'company/info', {});
|
|
54
|
+
|
|
55
|
+
await api.saveConfig({
|
|
56
|
+
apiToken: token,
|
|
57
|
+
companyName: companyInfo.name,
|
|
58
|
+
companyDomain: companyInfo.domain
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
console.log(`\r✅ Authenticated for: ${companyInfo.name} (${companyInfo.domain})`);
|
|
62
|
+
console.log(' Smart Report API Token saved successfully.');
|
|
63
|
+
} catch (err: any) {
|
|
64
|
+
console.error(`\r❌ Authentication failed: ${err.message}`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
51
67
|
});
|
|
52
68
|
}, { commands: ['smart-auth'] });
|
|
53
69
|
|
package/tsconfig.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ESNext",
|
|
4
|
-
"module": "
|
|
4
|
+
"module": "CommonJS",
|
|
5
5
|
"lib": ["ESNext"],
|
|
6
6
|
"declaration": true,
|
|
7
7
|
"outDir": "./dist",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"esModuleInterop": true,
|
|
10
10
|
"skipLibCheck": true,
|
|
11
11
|
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"moduleResolution": "
|
|
12
|
+
"moduleResolution": "Node"
|
|
13
13
|
},
|
|
14
14
|
"include": ["src/**/*"]
|
|
15
15
|
}
|