@nordsym/apiclaw 1.5.10 โ†’ 1.5.12

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.
Files changed (48) hide show
  1. package/APILAYER_STATUS_2026-03-24.md +38 -0
  2. package/TERMINOLOGY-AUDIT.md +99 -0
  3. package/TERMINOLOGY-FIXED.md +74 -0
  4. package/VIDEO-DEMO-GUIDE.md +82 -0
  5. package/direct-test.mjs +51 -0
  6. package/dist/cli/commands/mcp-install.d.ts.map +1 -1
  7. package/dist/cli/commands/mcp-install.js +55 -40
  8. package/dist/cli/commands/mcp-install.js.map +1 -1
  9. package/dist/credentials.d.ts.map +1 -1
  10. package/dist/credentials.js +128 -0
  11. package/dist/credentials.js.map +1 -1
  12. package/dist/discovery.d.ts.map +1 -1
  13. package/dist/discovery.js +191 -82
  14. package/dist/discovery.js.map +1 -1
  15. package/dist/execute.d.ts.map +1 -1
  16. package/dist/execute.js +53 -24
  17. package/dist/execute.js.map +1 -1
  18. package/email-templates/README.md +104 -0
  19. package/email-templates/partnership-template.html +116 -0
  20. package/landing/src/app/api/auth/magic-link/route.ts +1 -1
  21. package/landing/src/app/layout.tsx +2 -2
  22. package/landing/src/app/login/page.tsx +1 -1
  23. package/landing/src/app/page.tsx +39 -18
  24. package/landing/src/app/providers/dashboard/[apiId]/direct-call/page.tsx +1 -1
  25. package/landing/src/app/providers/dashboard/login/page.tsx +1 -1
  26. package/landing/src/app/providers/dashboard/page.tsx +1 -1
  27. package/landing/src/app/providers/layout.tsx +1 -1
  28. package/landing/src/components/HeroTabs.tsx +2 -2
  29. package/landing/src/components/VideoDemo.tsx +94 -0
  30. package/landing/src/components/{ProviderDashboard.tsx โ†’ Workspace.tsx} +2 -2
  31. package/landing/src/lib/mock-data.ts +1 -1
  32. package/landing/src/lib/stats.json +1 -1
  33. package/package.json +1 -1
  34. package/src/cli/commands/mcp-install.ts +14 -4
  35. package/src/credentials.ts +136 -0
  36. package/src/discovery.ts +191 -82
  37. package/src/execute.ts +49 -22
  38. package/test-actual-handlers.ts +92 -0
  39. package/test-apilayer-all-14.ts +249 -0
  40. package/test-apilayer-fixed.ts +248 -0
  41. package/test-direct-endpoints.ts +174 -0
  42. package/test-exact-endpoints.ts +144 -0
  43. package/test-final.ts +83 -0
  44. package/test-full-routing.ts +100 -0
  45. package/test-handlers-correct.ts +217 -0
  46. package/test-numverify-key.ts +41 -0
  47. package/test-via-handlers.ts +92 -0
  48. package/test-worldnews.mjs +26 -0
@@ -0,0 +1,174 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { homedir } from 'os';
4
+
5
+ interface TestResult {
6
+ name: string;
7
+ endpoint: string;
8
+ method: string;
9
+ status: number | string;
10
+ success: boolean;
11
+ responseTime: number;
12
+ }
13
+
14
+ // Load credentials
15
+ function loadEnv(): Record<string, string> {
16
+ const envPath = path.join(homedir(), '.secrets', 'apilayer.env');
17
+ const content = fs.readFileSync(envPath, 'utf-8');
18
+ const vars: Record<string, string> = {};
19
+ for (const line of content.split('\n')) {
20
+ const match = line.match(/^([^=]+)=(.*)$/);
21
+ if (match) {
22
+ vars[match[1].trim()] = match[2].trim();
23
+ }
24
+ }
25
+ return vars;
26
+ }
27
+
28
+ const env = loadEnv();
29
+
30
+ const tests = [
31
+ {
32
+ name: 'ExchangeRate API',
33
+ url: `https://api.apilayer.com/exchangerates_data?apikey=${env.APILAYER_EXCHANGERATE_KEY}`,
34
+ method: 'GET',
35
+ },
36
+ {
37
+ name: 'AviationStack API',
38
+ url: `https://api.apilayer.com/aviationstack?access_key=${env.APILAYER_AVIATIONSTACK_KEY}`,
39
+ method: 'GET',
40
+ },
41
+ {
42
+ name: 'ScreenshotLayer API',
43
+ url: `https://api.screenshotlayer.com/api?url=https://example.com&access_key=${env.APILAYER_SCREENSHOTLAYER_KEY}`,
44
+ method: 'GET',
45
+ },
46
+ {
47
+ name: 'Number Verification API',
48
+ url: `https://api.apilayer.com/validate?number=1234567890&access_key=${env.APILAYER_NUMVERIFY_KEY}`,
49
+ method: 'GET',
50
+ },
51
+ {
52
+ name: 'Email Verification API',
53
+ url: `https://api.apilayer.com/check?email=test@example.com&access_key=${env.APILAYER_EMAILVERIFY_KEY}`,
54
+ method: 'GET',
55
+ },
56
+ {
57
+ name: 'Marketstack API',
58
+ url: `https://api.marketstack.com/v1/eod?symbols=AAPL&access_key=${env.APILAYER_MARKETSTACK_KEY}`,
59
+ method: 'GET',
60
+ },
61
+ {
62
+ name: 'VAT Layer API',
63
+ url: `https://apilayer.net/api/validate?country_code=SE&access_key=${env.APILAYER_VATLAYER_KEY}`,
64
+ method: 'GET',
65
+ },
66
+ {
67
+ name: 'Finance News API',
68
+ url: `https://api.apilayer.com/financelayer/news?apikey=${env.APILAYER_FINANCENEWS_KEY}`,
69
+ method: 'GET',
70
+ },
71
+ {
72
+ name: 'Image Crop API',
73
+ url: `https://api.apilayer.com/smart_crop/url?apikey=${env.APILAYER_IMAGECROP_KEY}`,
74
+ method: 'GET',
75
+ },
76
+ {
77
+ name: 'Advanced Scraper API',
78
+ url: `https://api.apilayer.com/adv_scraper/scraper?url=https://example.com&apikey=${env.APILAYER_SCRAPER_KEY}`,
79
+ method: 'GET',
80
+ },
81
+ {
82
+ name: 'PDF Layer API',
83
+ url: `https://api.pdflayer.com/api`,
84
+ method: 'POST',
85
+ headers: { 'apikey': env.APILAYER_PDFLAYER_KEY },
86
+ body: JSON.stringify({ document_url: 'https://example.com' }),
87
+ },
88
+ {
89
+ name: 'World News API',
90
+ url: `https://api.apilayer.com/world_news/extract-news?url=https://example.com&apikey=${env.APILAYER_WORLDNEWS_KEY}`,
91
+ method: 'GET',
92
+ },
93
+ {
94
+ name: 'Skills API',
95
+ url: `https://api.apilayer.com/skills?q=machine%20learning&apikey=${env.APILAYER_SKILLAPI_KEY}`,
96
+ method: 'GET',
97
+ },
98
+ {
99
+ name: 'Form API',
100
+ url: `https://api.apilayer.com/form_api/test`,
101
+ method: 'POST',
102
+ headers: { 'apikey': env.APILAYER_FORMAPI_KEY },
103
+ body: JSON.stringify({}),
104
+ },
105
+ ];
106
+
107
+ async function runTests() {
108
+ console.log('๐Ÿงช Testing all 14 APILayer endpoints\n');
109
+
110
+ const results: TestResult[] = [];
111
+ let working = 0;
112
+
113
+ for (const test of tests) {
114
+ try {
115
+ const startTime = Date.now();
116
+ const options: RequestInit = {
117
+ method: test.method,
118
+ headers: {
119
+ 'Content-Type': 'application/json',
120
+ ...(test.headers || {}),
121
+ },
122
+ };
123
+
124
+ if ((test as any).body) {
125
+ options.body = (test as any).body;
126
+ }
127
+
128
+ const response = await fetch((test as any).url, options);
129
+ const responseTime = Date.now() - startTime;
130
+
131
+ const success = response.ok;
132
+ if (success) {
133
+ working++;
134
+ console.log(`โœ… ${test.name}: ${response.status} (${responseTime}ms)`);
135
+ } else {
136
+ console.log(`โŒ ${test.name}: ${response.status} (${responseTime}ms)`);
137
+ }
138
+
139
+ results.push({
140
+ name: test.name,
141
+ endpoint: (test as any).url.split('?')[0],
142
+ method: test.method,
143
+ status: response.status,
144
+ success,
145
+ responseTime,
146
+ });
147
+ } catch (err) {
148
+ const errorMsg = err instanceof Error ? err.message : String(err);
149
+ console.log(`โŒ ${test.name}: ${errorMsg}`);
150
+ results.push({
151
+ name: test.name,
152
+ endpoint: 'ERROR',
153
+ method: test.method,
154
+ status: 'ERROR',
155
+ success: false,
156
+ responseTime: 0,
157
+ });
158
+ }
159
+ }
160
+
161
+ console.log('\n' + '='.repeat(60));
162
+ console.log('๐Ÿ“Š FINAL RESULTS');
163
+ console.log('='.repeat(60));
164
+ console.log(`\nโœ… WORKING: ${working}/14`);
165
+ console.log(`โŒ NOT WORKING: ${14 - working}/14\n`);
166
+
167
+ const failed = results.filter(r => !r.success);
168
+ if (failed.length > 0) {
169
+ console.log('Failed services:');
170
+ failed.forEach(r => console.log(` โ€ข ${r.name}: ${r.status}`));
171
+ }
172
+ }
173
+
174
+ runTests().catch(console.error);
@@ -0,0 +1,144 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { homedir } from 'os';
4
+
5
+ function loadEnv(): Record<string, string> {
6
+ const envPath = path.join(homedir(), '.secrets', 'apilayer.env');
7
+ const content = fs.readFileSync(envPath, 'utf-8');
8
+ const vars: Record<string, string> = {};
9
+ for (const line of content.split('\n')) {
10
+ const match = line.match(/^([^=]+)=(.*)$/);
11
+ if (match) {
12
+ vars[match[1].trim()] = match[2].trim().replace(/^['\"]|[\"']$/g, '');
13
+ }
14
+ }
15
+ return vars;
16
+ }
17
+
18
+ const env = loadEnv();
19
+
20
+ const tests = [
21
+ {
22
+ name: 'ExchangeRate API',
23
+ url: (key: string) => `https://api.apilayer.com/exchangerate?apikey=${key}`,
24
+ key: env.APILAYER_EXCHANGERATE_KEY,
25
+ method: 'GET'
26
+ },
27
+ {
28
+ name: 'AviationStack API',
29
+ url: (key: string) => `https://api.apilayer.com/aviationstack?access_key=${key}`,
30
+ key: env.APILAYER_AVIATIONSTACK_KEY,
31
+ method: 'GET'
32
+ },
33
+ {
34
+ name: 'ScreenshotLayer API',
35
+ url: (key: string) => `https://api.apilayer.com/screenshot?url=https://example.com&access_key=${key}`,
36
+ key: env.APILAYER_SCREENSHOTLAYER_KEY,
37
+ method: 'GET'
38
+ },
39
+ {
40
+ name: 'Number Verification API',
41
+ url: (key: string) => `https://api.apilayer.com/validate?number=1234567890&access_key=${key}`,
42
+ key: env.APILAYER_NUMVERIFY_KEY,
43
+ method: 'GET'
44
+ },
45
+ {
46
+ name: 'Email Verification API',
47
+ url: (key: string) => `https://api.apilayer.com/check?email=test@example.com&access_key=${key}`,
48
+ key: env.APILAYER_EMAILVERIFY_KEY,
49
+ method: 'GET'
50
+ },
51
+ {
52
+ name: 'Marketstack API',
53
+ url: (key: string) => `https://api.apilayer.com/eod?symbols=AAPL&access_key=${key}`,
54
+ key: env.APILAYER_MARKETSTACK_KEY,
55
+ method: 'GET'
56
+ },
57
+ {
58
+ name: 'VAT Layer API',
59
+ url: (key: string) => `https://api.apilayer.com/validate?country_code=SE&access_key=${key}`,
60
+ key: env.APILAYER_VATLAYER_KEY,
61
+ method: 'GET'
62
+ },
63
+ {
64
+ name: 'Finance News API',
65
+ url: (key: string) => `https://api.apilayer.com/financelayer/news?limit=5&apikey=${key}`,
66
+ key: env.APILAYER_FINANCENEWS_KEY,
67
+ method: 'GET'
68
+ },
69
+ {
70
+ name: 'Image Crop API',
71
+ url: (key: string) => `https://api.apilayer.com/smart_crop/url?apikey=${key}`,
72
+ key: env.APILAYER_IMAGECROP_KEY,
73
+ method: 'GET'
74
+ },
75
+ {
76
+ name: 'Advanced Scraper API',
77
+ url: (key: string) => `https://api.apilayer.com/adv_scraper/scraper?url=https://example.com&apikey=${key}`,
78
+ key: env.APILAYER_SCRAPER_KEY,
79
+ method: 'GET'
80
+ },
81
+ {
82
+ name: 'PDF Layer API',
83
+ url: (key: string) => `https://api.pdflayer.com/api`,
84
+ key: env.APILAYER_PDFLAYER_KEY,
85
+ method: 'POST'
86
+ },
87
+ {
88
+ name: 'World News API',
89
+ url: (key: string) => `https://api.apilayer.com/world_news/extract-news?url=https://example.com&apikey=${key}`,
90
+ key: env.APILAYER_WORLDNEWS_KEY,
91
+ method: 'GET'
92
+ },
93
+ {
94
+ name: 'Skills API',
95
+ url: (key: string) => `https://api.apilayer.com/skills?q=test&apikey=${key}`,
96
+ key: env.APILAYER_SKILLAPI_KEY,
97
+ method: 'GET'
98
+ },
99
+ {
100
+ name: 'Form API',
101
+ url: (key: string) => `https://api.apilayer.com/form_api/test?apikey=${key}`,
102
+ key: env.APILAYER_FORMAPI_KEY,
103
+ method: 'POST'
104
+ },
105
+ ];
106
+
107
+ async function runTests() {
108
+ console.log('๐Ÿงช Testing exact endpoints from execute.ts\n');
109
+
110
+ let working = 0;
111
+ const failed: string[] = [];
112
+
113
+ for (const test of tests) {
114
+ try {
115
+ const startTime = Date.now();
116
+ const url = test.url(test.key);
117
+ const options: RequestInit = {
118
+ method: test.method,
119
+ headers: { 'Content-Type': 'application/json' }
120
+ };
121
+
122
+ const response = await fetch(url, options);
123
+ const responseTime = Date.now() - startTime;
124
+
125
+ if (response.ok) {
126
+ working++;
127
+ console.log(`โœ… ${test.name}: ${response.status} (${responseTime}ms)`);
128
+ } else {
129
+ console.log(`โŒ ${test.name}: ${response.status} (${responseTime}ms)`);
130
+ failed.push(`${test.name}: ${response.status}`);
131
+ }
132
+ } catch (err) {
133
+ const errorMsg = err instanceof Error ? err.message : String(err);
134
+ console.log(`โŒ ${test.name}: ${errorMsg}`);
135
+ failed.push(`${test.name}: ${errorMsg}`);
136
+ }
137
+ }
138
+
139
+ console.log('\n' + '='.repeat(60));
140
+ console.log(`โœ… WORKING: ${working}/14`);
141
+ console.log(`โŒ NOT WORKING: ${14 - working}/14\n`);
142
+ }
143
+
144
+ runTests().catch(console.error);
package/test-final.ts ADDED
@@ -0,0 +1,83 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { homedir } from 'os';
4
+
5
+ function loadEnv(): Record<string, string> {
6
+ const envPath = path.join(homedir(), '.secrets', 'apilayer.env');
7
+ const content = fs.readFileSync(envPath, 'utf-8');
8
+ const vars: Record<string, string> = {};
9
+ for (const line of content.split('\n')) {
10
+ const match = line.match(/^([^=]+)=(.*)$/);
11
+ if (match) {
12
+ vars[match[1].trim()] = match[2].trim().replace(/^['\"]|[\"']$/g, '');
13
+ }
14
+ }
15
+ return vars;
16
+ }
17
+
18
+ const env = loadEnv();
19
+
20
+ const tests = [
21
+ { name: 'ExchangeRate API', key: 'APILAYER_EXCHANGERATE_KEY', url: 'https://api.apilayer.com/exchangerates_data/latest?base=USD' },
22
+ { name: 'AviationStack API', key: 'APILAYER_AVIATIONSTACK_KEY', url: 'http://api.aviationstack.com/v1/flights' },
23
+ { name: 'ScreenshotLayer API', key: 'APILAYER_SCREENSHOTLAYER_KEY', url: 'https://api.screenshotlayer.com/api/capture?url=https://example.com' },
24
+ { name: 'Number Verification API', key: 'APILAYER_NUMVERIFY_KEY', url: 'https://api.apilayer.com/number_verification/validate?number=+1234567890' },
25
+ { name: 'Email Verification API', key: 'APILAYER_EMAILVERIFY_KEY', url: 'https://api.apilayer.com/email_verification/check?email=test@example.com' },
26
+ { name: 'Marketstack API', key: 'APILAYER_MARKETSTACK_KEY', url: 'http://api.marketstack.com/v1/eod?symbols=AAPL' },
27
+ { name: 'VAT Layer API', key: 'APILAYER_VATLAYER_KEY', url: 'https://apilayer.net/api/validate?country_code=SE' },
28
+ { name: 'Finance News API', key: 'APILAYER_FINANCENEWS_KEY', url: 'https://api.apilayer.com/financelayer/news' },
29
+ { name: 'Image Crop API', key: 'APILAYER_IMAGECROP_KEY', url: 'https://api.apilayer.com/smart_crop/url' },
30
+ { name: 'Advanced Scraper API', key: 'APILAYER_SCRAPER_KEY', url: 'https://api.apilayer.com/adv_scraper/scraper?url=https://example.com' },
31
+ { name: 'PDF Layer API', key: 'APILAYER_PDFLAYER_KEY', url: 'https://api.pdflayer.com/api', method: 'POST' },
32
+ { name: 'World News API', key: 'APILAYER_WORLDNEWS_KEY', url: 'https://api.apilayer.com/world_news/extract-news?url=https://example.com' },
33
+ { name: 'Skills API', key: 'APILAYER_SKILLAPI_KEY', url: 'https://api.apilayer.com/skills?q=test' },
34
+ { name: 'Form API', key: 'APILAYER_FORMAPI_KEY', url: 'https://api.apilayer.com/form_api/test', method: 'POST' },
35
+ ];
36
+
37
+ async function runTests() {
38
+ console.log('๐Ÿงช Testing all 14 APILayer services\n');
39
+
40
+ let working = 0;
41
+ const failed: string[] = [];
42
+
43
+ for (const test of tests) {
44
+ try {
45
+ const startTime = Date.now();
46
+ const key = env[test.key as keyof typeof env];
47
+ if (!key) {
48
+ console.log(`โŒ ${test.name}: NO KEY`);
49
+ failed.push(`${test.name}: NO KEY`);
50
+ continue;
51
+ }
52
+
53
+ const sep = test.url.includes('?') ? '&' : '?';
54
+ const keyParam = test.key.includes('MARKETSTACK') || test.key.includes('AVIATIONSTACK') ? 'access_key' : 'apikey';
55
+ const fullUrl = `${test.url}${sep}${keyParam}=${key}`;
56
+
57
+ const options: RequestInit = {
58
+ method: test.method || 'GET',
59
+ };
60
+
61
+ const response = await fetch(fullUrl, options);
62
+ const responseTime = Date.now() - startTime;
63
+
64
+ if (response.ok) {
65
+ working++;
66
+ console.log(`โœ… ${test.name}: ${response.status} (${responseTime}ms)`);
67
+ } else {
68
+ console.log(`โŒ ${test.name}: ${response.status} (${responseTime}ms)`);
69
+ failed.push(`${test.name}: ${response.status}`);
70
+ }
71
+ } catch (err) {
72
+ const errorMsg = err instanceof Error ? err.message : String(err);
73
+ console.log(`โŒ ${test.name}: ${errorMsg}`);
74
+ failed.push(`${test.name}: ${errorMsg}`);
75
+ }
76
+ }
77
+
78
+ console.log('\n' + '='.repeat(60));
79
+ console.log(`โœ… WORKING: ${working}/14`);
80
+ console.log(`โŒ NOT WORKING: ${14 - working}/14\n`);
81
+ }
82
+
83
+ runTests().catch(console.error);
@@ -0,0 +1,100 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { homedir } from 'os';
4
+
5
+ // Load credentials
6
+ function loadEnv(): Record<string, string> {
7
+ const envPath = path.join(homedir(), '.secrets', 'apilayer.env');
8
+ try {
9
+ const content = fs.readFileSync(envPath, 'utf-8');
10
+ const vars: Record<string, string> = {};
11
+ for (const line of content.split('\n')) {
12
+ const match = line.match(/^([^=]+)=(.*)$/);
13
+ if (match) {
14
+ vars[match[1].trim()] = match[2].trim();
15
+ }
16
+ }
17
+ return vars;
18
+ } catch {
19
+ console.error('Failed to load credentials');
20
+ return {};
21
+ }
22
+ }
23
+
24
+ const env = loadEnv();
25
+
26
+ // Manual test of the 5 failing services
27
+ async function testFailing() {
28
+ console.log('Testing 5 problematic services:\n');
29
+
30
+ const tests = [
31
+ {
32
+ name: 'Number Verification',
33
+ url: 'https://api.apilayer.com/number_verification/validate',
34
+ params: { number: '+46701234567' },
35
+ key: env.APILAYER_NUMVERIFY_KEY,
36
+ },
37
+ {
38
+ name: 'Image Crop',
39
+ url: 'https://api.apilayer.com/smart_crop/url',
40
+ params: { url: 'https://example.com/image.jpg' },
41
+ key: env.APILAYER_IMAGECROP_KEY,
42
+ },
43
+ {
44
+ name: 'World News',
45
+ url: 'https://api.apilayer.com/world_news/extract-news',
46
+ params: { url: 'https://example.com', analyze: 'true' },
47
+ key: env.APILAYER_WORLDNEWS_KEY,
48
+ },
49
+ {
50
+ name: 'Skills',
51
+ url: 'https://api.apilayer.com/skills',
52
+ params: { q: 'machine learning' },
53
+ key: env.APILAYER_SKILLAPI_KEY,
54
+ },
55
+ {
56
+ name: 'Form API',
57
+ url: 'https://api.apilayer.com/form_api/test',
58
+ params: {},
59
+ key: env.APILAYER_FORMAPI_KEY,
60
+ },
61
+ ];
62
+
63
+ for (const test of tests) {
64
+ // Build URL with params
65
+ const url = new URL(test.url);
66
+ Object.entries(test.params).forEach(([k, v]) => {
67
+ url.searchParams.set(k, String(v));
68
+ });
69
+
70
+ try {
71
+ const response = await fetch(url.toString(), {
72
+ method: test.url.includes('form_api') ? 'POST' : 'GET',
73
+ headers: {
74
+ 'apikey': test.key,
75
+ 'Content-Type': 'application/json',
76
+ },
77
+ ...(test.url.includes('form_api') && { body: JSON.stringify({}) }),
78
+ });
79
+
80
+ const status = response.status;
81
+ const headers = response.headers;
82
+ const contentType = headers.get('content-type');
83
+
84
+ console.log(`${status === 200 ? 'โœ…' : 'โŒ'} ${test.name}: ${status}`);
85
+ if (status !== 200) {
86
+ try {
87
+ const data = await response.json();
88
+ console.log(` Error: ${JSON.stringify(data).substring(0, 100)}`);
89
+ } catch {
90
+ const text = await response.text();
91
+ console.log(` Response: ${text.substring(0, 100)}`);
92
+ }
93
+ }
94
+ } catch (err) {
95
+ console.log(`โŒ ${test.name}: ${err instanceof Error ? err.message : String(err)}`);
96
+ }
97
+ }
98
+ }
99
+
100
+ testFailing().catch(console.error);