@nordsym/apiclaw 1.5.17 → 1.5.19
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/convex/http.js.map +1 -1
- package/convex/http.ts +516 -0
- package/dist/analytics.d.ts +0 -4
- package/dist/analytics.d.ts.map +1 -1
- package/dist/analytics.js +0 -1
- package/dist/analytics.js.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/cli/commands/mcp-install.d.ts.map +1 -1
- package/dist/cli/commands/mcp-install.js +8 -87
- package/dist/cli/commands/mcp-install.js.map +1 -1
- package/dist/cli/index.js +0 -7
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +38 -43
- package/dist/credentials.js.map +1 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +82 -191
- package/dist/discovery.js.map +1 -1
- package/dist/http-api.d.ts.map +1 -1
- package/dist/http-api.js +33 -17
- package/dist/http-api.js.map +1 -1
- package/dist/proxy.js +1 -1
- package/dist/proxy.js.map +1 -1
- package/landing/next-env.d.ts +0 -1
- package/landing/src/app/api/auth/magic-link/route.ts +1 -1
- package/landing/src/app/auth/verify/page.tsx +0 -6
- package/landing/src/app/dashboard/verify/page.tsx +0 -6
- package/landing/src/app/join/page.tsx +0 -6
- package/landing/src/app/layout.tsx +2 -2
- package/landing/src/app/login/page.tsx +1 -1
- package/landing/src/app/mou/[partnerId]/page.tsx +0 -6
- package/landing/src/app/page.tsx +18 -39
- package/landing/src/app/providers/dashboard/[apiId]/actions/[actionId]/edit/page.tsx +0 -6
- package/landing/src/app/providers/dashboard/[apiId]/actions/new/page.tsx +0 -5
- package/landing/src/app/providers/dashboard/[apiId]/actions/page.tsx +0 -5
- package/landing/src/app/providers/dashboard/[apiId]/direct-call/page.tsx +1 -6
- package/landing/src/app/providers/dashboard/[apiId]/page.tsx +0 -5
- package/landing/src/app/providers/dashboard/[apiId]/test/page.tsx +0 -5
- package/landing/src/app/providers/dashboard/layout.tsx +6 -6
- package/landing/src/app/providers/dashboard/login/page.tsx +1 -1
- package/landing/src/app/providers/dashboard/page.tsx +1 -1
- package/landing/src/app/providers/dashboard/verify/page.tsx +0 -6
- package/landing/src/app/providers/layout.tsx +1 -1
- package/landing/src/app/upgrade/page.tsx +0 -6
- package/landing/src/app/workspace/page.tsx +0 -6
- package/landing/src/components/HeroTabs.tsx +2 -2
- package/landing/src/components/{Workspace.tsx → ProviderDashboard.tsx} +2 -2
- package/landing/src/components/VideoDemo.tsx +10 -21
- package/landing/src/lib/mock-data.ts +1 -1
- package/landing/src/lib/stats.json +1 -1
- package/package.json +3 -8
- package/src/analytics.ts +0 -5
- package/src/bin.ts +1 -1
- package/src/cli/commands/mcp-install.ts +8 -90
- package/src/cli/index.ts +0 -8
- package/src/credentials.ts +39 -44
- package/src/discovery.ts +82 -191
- package/src/http-api.ts +34 -18
- package/src/proxy.ts +1 -1
- package/APILAYER_STATUS_2026-03-24.md +0 -38
- package/CHANGELOG-WHITELIST-V2.md +0 -269
- package/HIVR-WHITELIST-STATUS.md +0 -205
- package/HIVR-WHITELIST.md +0 -148
- package/TERMINOLOGY-AUDIT.md +0 -99
- package/TERMINOLOGY-FIXED.md +0 -74
- package/VIDEO-DEMO-GUIDE.md +0 -82
- package/WHITELIST-ARCHITECTURE.md +0 -379
- package/api/discover.ts +0 -71
- package/api/health.ts +0 -20
- package/convex/adminActivate.d.ts +0 -3
- package/convex/adminActivate.js +0 -47
- package/convex/adminStats.d.ts +0 -3
- package/convex/adminStats.js +0 -42
- package/convex/agents.d.ts +0 -54
- package/convex/agents.js +0 -499
- package/convex/analytics.d.ts +0 -5
- package/convex/analytics.js +0 -166
- package/convex/billing.d.ts +0 -88
- package/convex/billing.js +0 -655
- package/convex/capabilities.d.ts +0 -9
- package/convex/capabilities.js +0 -145
- package/convex/chains.d.ts +0 -67
- package/convex/chains.js +0 -1042
- package/convex/credits.d.ts +0 -25
- package/convex/credits.js +0 -186
- package/convex/crons.d.ts +0 -3
- package/convex/crons.js +0 -17
- package/convex/directCall.d.ts +0 -72
- package/convex/directCall.js +0 -627
- package/convex/earnProgress.d.ts +0 -58
- package/convex/earnProgress.js +0 -649
- package/convex/email.d.ts +0 -14
- package/convex/email.js +0 -300
- package/convex/feedback.d.ts +0 -7
- package/convex/feedback.js +0 -227
- package/convex/http.d.ts +0 -3
- package/convex/http.js +0 -910
- package/convex/logs.d.ts +0 -38
- package/convex/logs.js +0 -487
- package/convex/mou.d.ts +0 -6
- package/convex/mou.js +0 -82
- package/convex/providerKeys.d.ts +0 -31
- package/convex/providerKeys.js +0 -257
- package/convex/providers.d.ts +0 -29
- package/convex/providers.js +0 -756
- package/convex/purchases.d.ts +0 -7
- package/convex/purchases.js +0 -157
- package/convex/ratelimit.d.ts +0 -4
- package/convex/ratelimit.js +0 -91
- package/convex/searchLogs.d.ts +0 -4
- package/convex/searchLogs.js +0 -129
- package/convex/spendAlerts.d.ts +0 -36
- package/convex/spendAlerts.js +0 -380
- package/convex/stripeActions.d.ts +0 -19
- package/convex/stripeActions.js +0 -411
- package/convex/teams.d.ts +0 -21
- package/convex/teams.js +0 -215
- package/convex/telemetry.d.ts +0 -4
- package/convex/telemetry.js +0 -74
- package/convex/usage.d.ts +0 -27
- package/convex/usage.js +0 -229
- package/convex/waitlist.d.ts +0 -4
- package/convex/waitlist.js +0 -49
- package/convex/webhooks.d.ts +0 -12
- package/convex/webhooks.js +0 -410
- package/convex/workspaces.d.ts +0 -29
- package/convex/workspaces.js +0 -880
- package/direct-test.mjs +0 -51
- package/dist/access-control.d.ts +0 -45
- package/dist/access-control.d.ts.map +0 -1
- package/dist/access-control.js +0 -142
- package/dist/access-control.js.map +0 -1
- package/dist/chain-types.d.ts +0 -187
- package/dist/chain-types.d.ts.map +0 -1
- package/dist/chain-types.js +0 -33
- package/dist/chain-types.js.map +0 -1
- package/dist/convex/adminActivate.js +0 -46
- package/dist/convex/adminStats.js +0 -41
- package/dist/convex/agents.js +0 -498
- package/dist/convex/analytics.js +0 -165
- package/dist/convex/billing.js +0 -654
- package/dist/convex/capabilities.js +0 -144
- package/dist/convex/chains.js +0 -1041
- package/dist/convex/credits.js +0 -185
- package/dist/convex/crons.js +0 -16
- package/dist/convex/directCall.js +0 -626
- package/dist/convex/earnProgress.js +0 -648
- package/dist/convex/email.js +0 -299
- package/dist/convex/feedback.js +0 -226
- package/dist/convex/http.js +0 -909
- package/dist/convex/logs.js +0 -486
- package/dist/convex/mou.js +0 -81
- package/dist/convex/providerKeys.js +0 -256
- package/dist/convex/providers.js +0 -755
- package/dist/convex/purchases.js +0 -156
- package/dist/convex/ratelimit.js +0 -90
- package/dist/convex/schema.js +0 -709
- package/dist/convex/searchLogs.js +0 -128
- package/dist/convex/spendAlerts.js +0 -379
- package/dist/convex/stripeActions.js +0 -410
- package/dist/convex/teams.js +0 -214
- package/dist/convex/telemetry.js +0 -73
- package/dist/convex/usage.js +0 -228
- package/dist/convex/waitlist.js +0 -48
- package/dist/convex/webhooks.js +0 -409
- package/dist/convex/workspaces.js +0 -879
- package/dist/hivr-whitelist.d.ts +0 -18
- package/dist/hivr-whitelist.d.ts.map +0 -1
- package/dist/hivr-whitelist.js +0 -95
- package/dist/hivr-whitelist.js.map +0 -1
- package/dist/http-server-minimal.d.ts +0 -7
- package/dist/http-server-minimal.d.ts.map +0 -1
- package/dist/http-server-minimal.js +0 -126
- package/dist/http-server-minimal.js.map +0 -1
- package/dist/product-whitelist.d.ts +0 -37
- package/dist/product-whitelist.d.ts.map +0 -1
- package/dist/product-whitelist.js +0 -203
- package/dist/product-whitelist.js.map +0 -1
- package/dist/src/analytics.js +0 -129
- package/dist/src/bin.js +0 -17
- package/dist/src/capability-router.js +0 -240
- package/dist/src/chainExecutor.js +0 -451
- package/dist/src/chainResolver.js +0 -518
- package/dist/src/cli/commands/doctor.js +0 -324
- package/dist/src/cli/commands/mcp-install.js +0 -255
- package/dist/src/cli/commands/restore.js +0 -259
- package/dist/src/cli/commands/setup.js +0 -205
- package/dist/src/cli/commands/uninstall.js +0 -188
- package/dist/src/cli/index.js +0 -111
- package/dist/src/cli.js +0 -302
- package/dist/src/confirmation.js +0 -240
- package/dist/src/credentials.js +0 -357
- package/dist/src/credits.js +0 -260
- package/dist/src/crypto.js +0 -66
- package/dist/src/discovery.js +0 -504
- package/dist/src/enterprise/env.js +0 -123
- package/dist/src/enterprise/script-generator.js +0 -460
- package/dist/src/execute-dynamic.js +0 -473
- package/dist/src/execute.js +0 -1727
- package/dist/src/index.js +0 -2062
- package/dist/src/metered.js +0 -80
- package/dist/src/open-apis.js +0 -276
- package/dist/src/proxy.js +0 -28
- package/dist/src/session.js +0 -86
- package/dist/src/stripe.js +0 -407
- package/dist/src/telemetry.js +0 -49
- package/dist/src/types.js +0 -2
- package/dist/src/utils/backup.js +0 -181
- package/dist/src/utils/config.js +0 -220
- package/dist/src/utils/os.js +0 -105
- package/dist/src/utils/paths.js +0 -159
- package/landing/pages/api/discover.ts +0 -43
- package/landing/pages/api/health.ts +0 -20
- package/scripts/test-whitelist-v2.sh +0 -128
- package/src/access-control.ts +0 -174
- package/src/hivr-whitelist.ts +0 -110
- package/src/http-server-minimal.ts +0 -154
- package/src/product-whitelist.ts +0 -246
- package/test-actual-handlers.ts +0 -92
- package/test-apilayer-all-14.ts +0 -249
- package/test-apilayer-fixed.ts +0 -248
- package/test-direct-endpoints.ts +0 -174
- package/test-exact-endpoints.ts +0 -144
- package/test-final.ts +0 -83
- package/test-full-routing.ts +0 -100
- package/test-handlers-correct.ts +0 -217
- package/test-numverify-key.ts +0 -41
- package/test-via-handlers.ts +0 -92
- package/test-worldnews.mjs +0 -26
package/test-actual-handlers.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { homedir } from 'os';
|
|
4
|
-
import { executeAPICall } from './src/execute.js';
|
|
5
|
-
|
|
6
|
-
interface TestResult {
|
|
7
|
-
name: string;
|
|
8
|
-
success: boolean;
|
|
9
|
-
error?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Load credentials
|
|
13
|
-
function loadEnv(): Record<string, string> {
|
|
14
|
-
const envPath = path.join(homedir(), '.secrets', 'apilayer.env');
|
|
15
|
-
const content = fs.readFileSync(envPath, 'utf-8');
|
|
16
|
-
const vars: Record<string, string> = {};
|
|
17
|
-
for (const line of content.split('\n')) {
|
|
18
|
-
const match = line.match(/^([^=]+)=(.*)$/);
|
|
19
|
-
if (match) {
|
|
20
|
-
vars[match[1].trim()] = match[2].trim();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return vars;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const env = loadEnv();
|
|
27
|
-
|
|
28
|
-
const tests: Array<{ name: string; action: string; params: Record<string, unknown> }> = [
|
|
29
|
-
{ name: 'ExchangeRate API', action: 'exchange_rates', params: {} },
|
|
30
|
-
{ name: 'AviationStack API', action: 'aviation', params: {} },
|
|
31
|
-
{ name: 'ScreenshotLayer API', action: 'screenshot', params: { url: 'https://example.com' } },
|
|
32
|
-
{ name: 'Number Verification API', action: 'verify_number', params: { number: '+46701234567' } },
|
|
33
|
-
{ name: 'Email Verification API', action: 'verify_email', params: { email: 'test@example.com' } },
|
|
34
|
-
{ name: 'Marketstack API', action: 'market_data', params: { symbols: 'AAPL' } },
|
|
35
|
-
{ name: 'VAT Layer API', action: 'vat_check', params: { vat_number: 'SE556012345601' } },
|
|
36
|
-
{ name: 'Finance News API', action: 'finance_news', params: { tickers: 'AAPL' } },
|
|
37
|
-
{ name: 'Image Crop API', action: 'image_crop', params: { url: 'https://example.com/image.jpg' } },
|
|
38
|
-
{ name: 'Advanced Scraper API', action: 'scrape', params: { url: 'https://example.com' } },
|
|
39
|
-
{ name: 'PDF Generate API', action: 'pdf_generate', params: { document_url: 'https://example.com' } },
|
|
40
|
-
{ name: 'World News API', action: 'world_news', params: { url: 'https://example.com' } },
|
|
41
|
-
{ name: 'Skills API', action: 'skills', params: { q: 'machine learning' } },
|
|
42
|
-
{ name: 'Form API', action: 'form_submit', params: { endpoint: 'test' } },
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
async function runTests() {
|
|
46
|
-
console.log('🧪 Testing all 14 APILayer handlers via executeAPICall()\n');
|
|
47
|
-
|
|
48
|
-
const results: TestResult[] = [];
|
|
49
|
-
let working = 0;
|
|
50
|
-
|
|
51
|
-
for (const test of tests) {
|
|
52
|
-
try {
|
|
53
|
-
const result = await executeAPICall('apilayer', test.action, test.params);
|
|
54
|
-
const success = result.success === true;
|
|
55
|
-
|
|
56
|
-
if (success) {
|
|
57
|
-
working++;
|
|
58
|
-
console.log(`✅ ${test.name}`);
|
|
59
|
-
} else {
|
|
60
|
-
console.log(`❌ ${test.name}: ${result.error || 'unknown error'}`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
results.push({
|
|
64
|
-
name: test.name,
|
|
65
|
-
success,
|
|
66
|
-
error: result.error,
|
|
67
|
-
});
|
|
68
|
-
} catch (err) {
|
|
69
|
-
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
70
|
-
console.log(`❌ ${test.name}: ${errorMsg}`);
|
|
71
|
-
results.push({
|
|
72
|
-
name: test.name,
|
|
73
|
-
success: false,
|
|
74
|
-
error: errorMsg,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
console.log('\n' + '='.repeat(60));
|
|
80
|
-
console.log('📊 FINAL RESULTS');
|
|
81
|
-
console.log('='.repeat(60));
|
|
82
|
-
console.log(`\n✅ WORKING: ${working}/14`);
|
|
83
|
-
console.log(`❌ NOT WORKING: ${14 - working}/14\n`);
|
|
84
|
-
|
|
85
|
-
const failed = results.filter(r => !r.success);
|
|
86
|
-
if (failed.length > 0) {
|
|
87
|
-
console.log('Failed services:');
|
|
88
|
-
failed.forEach(r => console.log(` • ${r.name}: ${r.error}`));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
runTests().catch(console.error);
|
package/test-apilayer-all-14.ts
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
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
|
-
status: number | string;
|
|
9
|
-
success: boolean;
|
|
10
|
-
error?: string;
|
|
11
|
-
responseTime: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const results: TestResult[] = [];
|
|
15
|
-
|
|
16
|
-
// Load credentials
|
|
17
|
-
function loadEnvFile(): Record<string, string> {
|
|
18
|
-
const envPath = path.join(homedir(), '.secrets', 'apilayer.env');
|
|
19
|
-
if (!fs.existsSync(envPath)) {
|
|
20
|
-
console.error(`❌ No credentials file at ${envPath}`);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const content = fs.readFileSync(envPath, 'utf-8');
|
|
25
|
-
const vars: Record<string, string> = {};
|
|
26
|
-
for (const line of content.split('\n')) {
|
|
27
|
-
const match = line.match(/^([^=]+)=(.*)$/);
|
|
28
|
-
if (match) {
|
|
29
|
-
vars[match[1].trim()] = match[2].trim().replace(/^['""]|["'"]$/g, '');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return vars;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const env = loadEnvFile();
|
|
36
|
-
|
|
37
|
-
// Test configurations - ALL 14 APIs
|
|
38
|
-
const tests = [
|
|
39
|
-
{
|
|
40
|
-
name: 'ExchangeRate API',
|
|
41
|
-
url: (key: string) => `https://api.apilayer.com/exchangerate?apikey=${key}`,
|
|
42
|
-
key: env.APILAYER_EXCHANGERATE_KEY,
|
|
43
|
-
method: 'GET',
|
|
44
|
-
authType: 'query'
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'AviationStack API',
|
|
48
|
-
url: (key: string) => `https://api.apilayer.com/aviationstack?access_key=${key}`,
|
|
49
|
-
key: env.APILAYER_AVIATIONSTACK_KEY,
|
|
50
|
-
method: 'GET',
|
|
51
|
-
authType: 'query'
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: 'PDF Layer API',
|
|
55
|
-
url: (key: string) => `https://api.apilayer.com/pdf?url=https://example.com`,
|
|
56
|
-
key: env.APILAYER_PDFLAYER_KEY,
|
|
57
|
-
method: 'GET',
|
|
58
|
-
authType: 'header'
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: 'Screenshot Layer API',
|
|
62
|
-
url: (key: string) => `https://api.apilayer.com/screenshot?url=https://example.com&access_key=${key}`,
|
|
63
|
-
key: env.APILAYER_SCREENSHOTLAYER_KEY,
|
|
64
|
-
method: 'GET',
|
|
65
|
-
authType: 'query'
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: 'SkillAPI',
|
|
69
|
-
url: (key: string) => `https://api.promptapi.com/skills?q=test`,
|
|
70
|
-
key: env.APILAYER_SKILLAPI_KEY,
|
|
71
|
-
method: 'GET',
|
|
72
|
-
authType: 'header',
|
|
73
|
-
domain: 'promptapi.com'
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: 'Image Crop API',
|
|
77
|
-
url: (key: string) => `https://api.apilayer.com/crop?url=https://example.com/image.jpg`,
|
|
78
|
-
key: env.APILAYER_IMAGECROP_KEY,
|
|
79
|
-
method: 'GET',
|
|
80
|
-
authType: 'header'
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: 'Form API',
|
|
84
|
-
url: (key: string) => `https://api.apilayer.com/form`,
|
|
85
|
-
key: env.APILAYER_FORMAPI_KEY,
|
|
86
|
-
method: 'POST',
|
|
87
|
-
authType: 'header',
|
|
88
|
-
body: 'Test Form'
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: 'Number Verification API',
|
|
92
|
-
url: (key: string) => `https://api.apilayer.com/validate?number=1234567890&access_key=${key}`,
|
|
93
|
-
key: env.APILAYER_NUMVERIFY_KEY,
|
|
94
|
-
method: 'GET',
|
|
95
|
-
authType: 'query'
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
name: 'Email Verification API',
|
|
99
|
-
url: (key: string) => `https://api.apilayer.com/check?email=test@example.com&access_key=${key}`,
|
|
100
|
-
key: env.APILAYER_EMAILVERIFY_KEY,
|
|
101
|
-
method: 'GET',
|
|
102
|
-
authType: 'query'
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: 'Marketstack API',
|
|
106
|
-
url: (key: string) => `https://api.apilayer.com/eod?symbols=AAPL&access_key=${key}`,
|
|
107
|
-
key: env.APILAYER_MARKETSTACK_KEY,
|
|
108
|
-
method: 'GET',
|
|
109
|
-
authType: 'query'
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: 'World News API',
|
|
113
|
-
url: (key: string) => `https://api.apilayer.com/worldnews?keywords=test`,
|
|
114
|
-
key: env.APILAYER_WORLDNEWS_KEY,
|
|
115
|
-
method: 'GET',
|
|
116
|
-
authType: 'header'
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: 'Advanced Scraper API',
|
|
120
|
-
url: (key: string) => `https://api.apilayer.com/scraper?url=https://example.com`,
|
|
121
|
-
key: env.APILAYER_SCRAPER_KEY,
|
|
122
|
-
method: 'GET',
|
|
123
|
-
authType: 'header'
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: 'Finance News API',
|
|
127
|
-
url: (key: string) => `https://api.apilayer.com/news?limit=5`,
|
|
128
|
-
key: env.APILAYER_FINANCENEWS_KEY,
|
|
129
|
-
method: 'GET',
|
|
130
|
-
authType: 'header'
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: 'VAT Layer API',
|
|
134
|
-
url: (key: string) => `https://api.apilayer.com/validate?country_code=SE&access_key=${key}`,
|
|
135
|
-
key: env.APILAYER_VATLAYER_KEY,
|
|
136
|
-
method: 'GET',
|
|
137
|
-
authType: 'query'
|
|
138
|
-
}
|
|
139
|
-
];
|
|
140
|
-
|
|
141
|
-
async function runTests() {
|
|
142
|
-
console.log('🧪 Testing all 14 APILayer services...\n');
|
|
143
|
-
|
|
144
|
-
for (const test of tests) {
|
|
145
|
-
if (!test.key) {
|
|
146
|
-
results.push({
|
|
147
|
-
name: test.name,
|
|
148
|
-
endpoint: 'N/A',
|
|
149
|
-
status: 'NO KEY',
|
|
150
|
-
success: false,
|
|
151
|
-
responseTime: 0
|
|
152
|
-
});
|
|
153
|
-
console.log(`❌ ${test.name}: NO API KEY FOUND`);
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
try {
|
|
158
|
-
const startTime = Date.now();
|
|
159
|
-
const url = test.url(test.key);
|
|
160
|
-
|
|
161
|
-
const headers: Record<string, string> = {
|
|
162
|
-
'Content-Type': 'application/json'
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
// Add API key as header if needed
|
|
166
|
-
if (test.authType === 'header') {
|
|
167
|
-
headers['apikey'] = test.key;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const options: RequestInit = {
|
|
171
|
-
method: test.method,
|
|
172
|
-
headers
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
if (test.body) {
|
|
176
|
-
options.body = test.body;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const response = await fetch(url, options);
|
|
180
|
-
const responseTime = Date.now() - startTime;
|
|
181
|
-
|
|
182
|
-
let success = false;
|
|
183
|
-
let error: string | undefined;
|
|
184
|
-
|
|
185
|
-
if (response.ok) {
|
|
186
|
-
success = true;
|
|
187
|
-
console.log(`✅ ${test.name}: ${response.status} (${responseTime}ms)`);
|
|
188
|
-
} else {
|
|
189
|
-
let errorMsg = `HTTP ${response.status}`;
|
|
190
|
-
try {
|
|
191
|
-
const body = await response.json();
|
|
192
|
-
if (body.message) {
|
|
193
|
-
errorMsg += ` - ${body.message}`;
|
|
194
|
-
}
|
|
195
|
-
} catch {
|
|
196
|
-
// body not JSON
|
|
197
|
-
}
|
|
198
|
-
error = errorMsg;
|
|
199
|
-
console.log(`❌ ${test.name}: ${errorMsg} (${responseTime}ms)`);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
results.push({
|
|
203
|
-
name: test.name,
|
|
204
|
-
endpoint: url.split('?')[0],
|
|
205
|
-
status: response.status,
|
|
206
|
-
success,
|
|
207
|
-
error,
|
|
208
|
-
responseTime
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
} catch (err) {
|
|
212
|
-
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
213
|
-
console.log(`❌ ${test.name}: ${errorMsg}`);
|
|
214
|
-
|
|
215
|
-
results.push({
|
|
216
|
-
name: test.name,
|
|
217
|
-
endpoint: 'N/A',
|
|
218
|
-
status: 'ERROR',
|
|
219
|
-
success: false,
|
|
220
|
-
error: errorMsg,
|
|
221
|
-
responseTime: 0
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// Summary
|
|
227
|
-
console.log('\n' + '='.repeat(60));
|
|
228
|
-
console.log('📊 SUMMARY');
|
|
229
|
-
console.log('='.repeat(60));
|
|
230
|
-
|
|
231
|
-
const working = results.filter(r => r.success);
|
|
232
|
-
const failed = results.filter(r => !r.success);
|
|
233
|
-
|
|
234
|
-
console.log(`\n✅ Working (${working.length}):`);
|
|
235
|
-
working.forEach(r => {
|
|
236
|
-
console.log(` • ${r.name}`);
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
if (failed.length > 0) {
|
|
240
|
-
console.log(`\n❌ Failed (${failed.length}):`);
|
|
241
|
-
failed.forEach(r => {
|
|
242
|
-
console.log(` • ${r.name}: ${r.error}`);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
console.log(`\n📈 Success rate: ${working.length}/${results.length} (${Math.round(working.length / results.length * 100)}%)`);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
runTests().catch(console.error);
|
package/test-apilayer-fixed.ts
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
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
|
-
status: number | string;
|
|
9
|
-
success: boolean;
|
|
10
|
-
error?: string;
|
|
11
|
-
responseTime: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const results: TestResult[] = [];
|
|
15
|
-
|
|
16
|
-
// Load credentials
|
|
17
|
-
function loadEnvFile(): Record<string, string> {
|
|
18
|
-
const envPath = path.join(homedir(), '.secrets', 'apilayer.env');
|
|
19
|
-
if (!fs.existsSync(envPath)) {
|
|
20
|
-
console.error(`❌ No credentials file at ${envPath}`);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const content = fs.readFileSync(envPath, 'utf-8');
|
|
25
|
-
const vars: Record<string, string> = {};
|
|
26
|
-
for (const line of content.split('\n')) {
|
|
27
|
-
const match = line.match(/^([^=]+)=(.*)$/);
|
|
28
|
-
if (match) {
|
|
29
|
-
vars[match[1].trim()] = match[2].trim().replace(/^['""]|["'"]$/g, '');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return vars;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const env = loadEnvFile();
|
|
36
|
-
|
|
37
|
-
// ALL 14 APIs with CORRECTED endpoints from user documentation
|
|
38
|
-
const tests = [
|
|
39
|
-
// ✅ 7 KNOWN WORKING (from previous tests)
|
|
40
|
-
{
|
|
41
|
-
name: 'ExchangeRate API',
|
|
42
|
-
url: (key: string) => `https://api.apilayer.com/exchangerate?apikey=${key}`,
|
|
43
|
-
key: env.APILAYER_EXCHANGERATE_KEY,
|
|
44
|
-
method: 'GET'
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: 'AviationStack API',
|
|
48
|
-
url: (key: string) => `https://api.apilayer.com/aviationstack?access_key=${key}`,
|
|
49
|
-
key: env.APILAYER_AVIATIONSTACK_KEY,
|
|
50
|
-
method: 'GET'
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: 'ScreenshotLayer API',
|
|
54
|
-
url: (key: string) => `https://api.apilayer.com/screenshot?url=https://example.com&access_key=${key}`,
|
|
55
|
-
key: env.APILAYER_SCREENSHOTLAYER_KEY,
|
|
56
|
-
method: 'GET'
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: 'Number Verification API',
|
|
60
|
-
url: (key: string) => `https://api.apilayer.com/validate?number=1234567890&access_key=${key}`,
|
|
61
|
-
key: env.APILAYER_NUMVERIFY_KEY,
|
|
62
|
-
method: 'GET'
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: 'Email Verification API',
|
|
66
|
-
url: (key: string) => `https://api.apilayer.com/check?email=test@example.com&access_key=${key}`,
|
|
67
|
-
key: env.APILAYER_EMAILVERIFY_KEY,
|
|
68
|
-
method: 'GET'
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: 'Marketstack API',
|
|
72
|
-
url: (key: string) => `https://api.apilayer.com/eod?symbols=AAPL&access_key=${key}`,
|
|
73
|
-
key: env.APILAYER_MARKETSTACK_KEY,
|
|
74
|
-
method: 'GET'
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: 'VAT Layer API',
|
|
78
|
-
url: (key: string) => `https://api.apilayer.com/validate?country_code=SE&access_key=${key}`,
|
|
79
|
-
key: env.APILAYER_VATLAYER_KEY,
|
|
80
|
-
method: 'GET'
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
// 🔧 4 PREVIOUSLY FAILED - NOW WITH CORRECTED ENDPOINTS from user documentation
|
|
84
|
-
{
|
|
85
|
-
name: 'Image Crop API',
|
|
86
|
-
url: (key: string) => `https://api.apilayer.com/crop?url=https://example.com/image.jpg`,
|
|
87
|
-
key: env.APILAYER_IMAGECROP_KEY,
|
|
88
|
-
method: 'GET',
|
|
89
|
-
authType: 'header'
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: 'Form API',
|
|
93
|
-
url: (key: string) => `https://api.apilayer.com/form`,
|
|
94
|
-
key: env.APILAYER_FORMAPI_KEY,
|
|
95
|
-
method: 'POST',
|
|
96
|
-
authType: 'header',
|
|
97
|
-
body: 'Test Form'
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: 'Advanced Scraper API',
|
|
101
|
-
url: (key: string) => `https://api.apilayer.com/scraper?url=https://example.com`,
|
|
102
|
-
key: env.APILAYER_SCRAPER_KEY,
|
|
103
|
-
method: 'GET',
|
|
104
|
-
authType: 'header'
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: 'Finance News API',
|
|
108
|
-
url: (key: string) => `https://api.apilayer.com/news?limit=5`,
|
|
109
|
-
key: env.APILAYER_FINANCENEWS_KEY,
|
|
110
|
-
method: 'GET',
|
|
111
|
-
authType: 'header'
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
// ❌ 3 AUTH FAILURES (investigating)
|
|
115
|
-
{
|
|
116
|
-
name: 'PDF Layer API',
|
|
117
|
-
url: (key: string) => `https://api.apilayer.com/pdf?url=https://example.com`,
|
|
118
|
-
key: env.APILAYER_PDFLAYER_KEY,
|
|
119
|
-
method: 'GET',
|
|
120
|
-
authType: 'header'
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
name: 'SkillAPI',
|
|
124
|
-
url: (key: string) => `https://api.promptapi.com/skills?q=test`,
|
|
125
|
-
key: env.APILAYER_SKILLAPI_KEY,
|
|
126
|
-
method: 'GET',
|
|
127
|
-
authType: 'header'
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'World News API',
|
|
131
|
-
url: (key: string) => `https://api.apilayer.com/worldnews?keywords=test`,
|
|
132
|
-
key: env.APILAYER_WORLDNEWS_KEY,
|
|
133
|
-
method: 'GET',
|
|
134
|
-
authType: 'header'
|
|
135
|
-
}
|
|
136
|
-
];
|
|
137
|
-
|
|
138
|
-
async function runTests() {
|
|
139
|
-
console.log('🧪 Testing all 14 APILayer services (WITH CORRECTED ENDPOINTS)\n');
|
|
140
|
-
|
|
141
|
-
for (const test of tests) {
|
|
142
|
-
if (!test.key) {
|
|
143
|
-
results.push({
|
|
144
|
-
name: test.name,
|
|
145
|
-
endpoint: 'N/A',
|
|
146
|
-
status: 'NO KEY',
|
|
147
|
-
success: false,
|
|
148
|
-
responseTime: 0
|
|
149
|
-
});
|
|
150
|
-
console.log(`❌ ${test.name}: NO API KEY FOUND`);
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
try {
|
|
155
|
-
const startTime = Date.now();
|
|
156
|
-
const url = test.url(test.key);
|
|
157
|
-
|
|
158
|
-
const headers: Record<string, string> = {
|
|
159
|
-
'Content-Type': 'application/json'
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// Add API key as header if needed
|
|
163
|
-
const authType = (test as any).authType || 'query';
|
|
164
|
-
if (authType === 'header') {
|
|
165
|
-
headers['apikey'] = test.key;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const options: RequestInit = {
|
|
169
|
-
method: test.method,
|
|
170
|
-
headers
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
if ((test as any).body) {
|
|
174
|
-
options.body = (test as any).body;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const response = await fetch(url, options);
|
|
178
|
-
const responseTime = Date.now() - startTime;
|
|
179
|
-
|
|
180
|
-
let success = false;
|
|
181
|
-
let error: string | undefined;
|
|
182
|
-
|
|
183
|
-
if (response.ok) {
|
|
184
|
-
success = true;
|
|
185
|
-
console.log(`✅ ${test.name}: ${response.status} (${responseTime}ms)`);
|
|
186
|
-
} else {
|
|
187
|
-
let errorMsg = `HTTP ${response.status}`;
|
|
188
|
-
try {
|
|
189
|
-
const body = await response.json();
|
|
190
|
-
if (body.message) {
|
|
191
|
-
errorMsg += ` - ${body.message}`;
|
|
192
|
-
}
|
|
193
|
-
} catch {
|
|
194
|
-
// body not JSON
|
|
195
|
-
}
|
|
196
|
-
error = errorMsg;
|
|
197
|
-
console.log(`❌ ${test.name}: ${errorMsg} (${responseTime}ms)`);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
results.push({
|
|
201
|
-
name: test.name,
|
|
202
|
-
endpoint: url.split('?')[0],
|
|
203
|
-
status: response.status,
|
|
204
|
-
success,
|
|
205
|
-
error,
|
|
206
|
-
responseTime
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
} catch (err) {
|
|
210
|
-
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
211
|
-
console.log(`❌ ${test.name}: ${errorMsg}`);
|
|
212
|
-
|
|
213
|
-
results.push({
|
|
214
|
-
name: test.name,
|
|
215
|
-
endpoint: 'N/A',
|
|
216
|
-
status: 'ERROR',
|
|
217
|
-
success: false,
|
|
218
|
-
error: errorMsg,
|
|
219
|
-
responseTime: 0
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Summary
|
|
225
|
-
console.log('\n' + '='.repeat(60));
|
|
226
|
-
console.log('📊 FINAL STATUS');
|
|
227
|
-
console.log('='.repeat(60));
|
|
228
|
-
|
|
229
|
-
const working = results.filter(r => r.success);
|
|
230
|
-
const failed = results.filter(r => !r.success);
|
|
231
|
-
|
|
232
|
-
console.log(`\n✅ WORKING (${working.length}/14):`);
|
|
233
|
-
working.forEach(r => {
|
|
234
|
-
console.log(` • ${r.name}`);
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
if (failed.length > 0) {
|
|
238
|
-
console.log(`\n❌ NOT WORKING (${failed.length}/14):`);
|
|
239
|
-
failed.forEach(r => {
|
|
240
|
-
console.log(` • ${r.name}: ${r.error}`);
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
console.log(`\n📈 Success rate: ${working.length}/14 (${Math.round(working.length / results.length * 100)}%)`);
|
|
245
|
-
console.log('\n💾 Ready for Pratham meeting: ' + (working.length >= 10 ? '✅ YES' : '❌ NO'));
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
runTests().catch(console.error);
|