@nordsym/apiclaw 1.5.16 โ 1.5.18
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 +196 -0
- package/convex/http.js.map +1 -1
- package/convex/http.ts +201 -0
- package/convex/http.ts.bak +934 -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 +0 -128
- 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 +4 -6
- 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 +0 -136
- 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/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-direct-endpoints.ts
DELETED
|
@@ -1,174 +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
|
-
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);
|
package/test-exact-endpoints.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
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);
|
package/test-full-routing.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
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);
|