@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-handlers-correct.ts
DELETED
|
@@ -1,217 +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
|
-
const content = fs.readFileSync(envPath, 'utf-8');
|
|
9
|
-
const vars: Record<string, string> = {};
|
|
10
|
-
for (const line of content.split('\n')) {
|
|
11
|
-
const match = line.match(/^([^=]+)=(.*)$/);
|
|
12
|
-
if (match) {
|
|
13
|
-
vars[match[1].trim()] = match[2].trim();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return vars;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const env = loadEnv();
|
|
20
|
-
|
|
21
|
-
const tests = [
|
|
22
|
-
{
|
|
23
|
-
name: 'ExchangeRate API',
|
|
24
|
-
build: () => {
|
|
25
|
-
const url = new URL('https://api.apilayer.com/exchangerates_data/latest');
|
|
26
|
-
url.searchParams.set('base', 'USD');
|
|
27
|
-
return {
|
|
28
|
-
url: url.toString(),
|
|
29
|
-
options: { method: 'GET', headers: { 'apikey': env.APILAYER_EXCHANGERATE_KEY } }
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'AviationStack API',
|
|
35
|
-
build: () => {
|
|
36
|
-
const url = new URL('http://api.aviationstack.com/v1/flights');
|
|
37
|
-
url.searchParams.set('access_key', env.APILAYER_AVIATIONSTACK_KEY);
|
|
38
|
-
return { url: url.toString(), options: { method: 'GET' } };
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: 'ScreenshotLayer API',
|
|
43
|
-
build: () => {
|
|
44
|
-
const url = new URL('https://api.screenshotlayer.com/api/capture');
|
|
45
|
-
url.searchParams.set('url', 'https://example.com');
|
|
46
|
-
url.searchParams.set('access_key', env.APILAYER_SCREENSHOTLAYER_KEY);
|
|
47
|
-
return { url: url.toString(), options: { method: 'GET' } };
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'Number Verification API',
|
|
52
|
-
build: () => {
|
|
53
|
-
const url = new URL('https://api.apilayer.com/number_verification/validate');
|
|
54
|
-
url.searchParams.set('number', '+1234567890');
|
|
55
|
-
return {
|
|
56
|
-
url: url.toString(),
|
|
57
|
-
options: { method: 'GET', headers: { 'apikey': env.APILAYER_NUMVERIFY_KEY } }
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'Email Verification API',
|
|
63
|
-
build: () => {
|
|
64
|
-
const url = new URL('https://api.apilayer.com/email_verification/check');
|
|
65
|
-
url.searchParams.set('email', 'test@example.com');
|
|
66
|
-
return {
|
|
67
|
-
url: url.toString(),
|
|
68
|
-
options: { method: 'GET', headers: { 'apikey': env.APILAYER_EMAILVERIFY_KEY } }
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'Marketstack API',
|
|
74
|
-
build: () => {
|
|
75
|
-
const url = new URL('http://api.marketstack.com/v1/eod');
|
|
76
|
-
url.searchParams.set('access_key', env.APILAYER_MARKETSTACK_KEY);
|
|
77
|
-
url.searchParams.set('symbols', 'AAPL');
|
|
78
|
-
url.searchParams.set('limit', '10');
|
|
79
|
-
return { url: url.toString(), options: { method: 'GET' } };
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: 'VAT Layer API',
|
|
84
|
-
build: () => {
|
|
85
|
-
const url = new URL('https://apilayer.net/api/validate');
|
|
86
|
-
url.searchParams.set('access_key', env.APILAYER_VATLAYER_KEY);
|
|
87
|
-
url.searchParams.set('country_code', 'SE');
|
|
88
|
-
return { url: url.toString(), options: { method: 'GET' } };
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: 'Finance News API',
|
|
93
|
-
build: () => {
|
|
94
|
-
const url = new URL('https://api.apilayer.com/financelayer/news');
|
|
95
|
-
url.searchParams.set('limit', '5');
|
|
96
|
-
return {
|
|
97
|
-
url: url.toString(),
|
|
98
|
-
options: { method: 'GET', headers: { 'apikey': env.APILAYER_FINANCENEWS_KEY } }
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: 'Image Crop API',
|
|
104
|
-
build: () => {
|
|
105
|
-
const url = new URL('https://api.apilayer.com/smart_crop/url');
|
|
106
|
-
url.searchParams.set('url', 'https://example.com/image.jpg');
|
|
107
|
-
return {
|
|
108
|
-
url: url.toString(),
|
|
109
|
-
options: { method: 'GET', headers: { 'apikey': env.APILAYER_IMAGECROP_KEY } }
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: 'Advanced Scraper API',
|
|
115
|
-
build: () => {
|
|
116
|
-
const url = new URL('https://api.apilayer.com/adv_scraper/scraper');
|
|
117
|
-
url.searchParams.set('url', 'https://example.com');
|
|
118
|
-
return {
|
|
119
|
-
url: url.toString(),
|
|
120
|
-
options: { method: 'GET', headers: { 'apikey': env.APILAYER_SCRAPER_KEY } }
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: 'PDF Layer API',
|
|
126
|
-
build: () => {
|
|
127
|
-
const url = new URL('https://api.pdflayer.com/api');
|
|
128
|
-
return {
|
|
129
|
-
url: url.toString(),
|
|
130
|
-
options: {
|
|
131
|
-
method: 'POST',
|
|
132
|
-
headers: { 'apikey': env.APILAYER_PDFLAYER_KEY, 'Content-Type': 'application/json' },
|
|
133
|
-
body: JSON.stringify({ document_url: 'https://example.com' })
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: 'World News API',
|
|
140
|
-
build: () => {
|
|
141
|
-
const url = new URL('https://api.apilayer.com/world_news/extract-news');
|
|
142
|
-
url.searchParams.set('url', 'https://example.com');
|
|
143
|
-
url.searchParams.set('analyze', 'true');
|
|
144
|
-
return {
|
|
145
|
-
url: url.toString(),
|
|
146
|
-
options: { method: 'GET', headers: { 'apikey': env.APILAYER_WORLDNEWS_KEY } }
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
name: 'Skills API',
|
|
152
|
-
build: () => {
|
|
153
|
-
const url = new URL('https://api.apilayer.com/skills');
|
|
154
|
-
url.searchParams.set('q', 'machine learning');
|
|
155
|
-
return {
|
|
156
|
-
url: url.toString(),
|
|
157
|
-
options: { method: 'GET', headers: { 'apikey': env.APILAYER_SKILLAPI_KEY } }
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: 'Form API',
|
|
163
|
-
build: () => {
|
|
164
|
-
const url = new URL('https://api.apilayer.com/form_api/test');
|
|
165
|
-
return {
|
|
166
|
-
url: url.toString(),
|
|
167
|
-
options: {
|
|
168
|
-
method: 'POST',
|
|
169
|
-
headers: { 'apikey': env.APILAYER_FORMAPI_KEY, 'Content-Type': 'application/json' },
|
|
170
|
-
body: JSON.stringify({})
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
];
|
|
176
|
-
|
|
177
|
-
async function runTests() {
|
|
178
|
-
console.log('🧪 Testing all 14 APILayer endpoints (with correct auth)\n');
|
|
179
|
-
|
|
180
|
-
let working = 0;
|
|
181
|
-
const failed: string[] = [];
|
|
182
|
-
|
|
183
|
-
for (const test of tests) {
|
|
184
|
-
try {
|
|
185
|
-
const startTime = Date.now();
|
|
186
|
-
const { url, options } = test.build();
|
|
187
|
-
const response = await fetch(url, options);
|
|
188
|
-
const responseTime = Date.now() - startTime;
|
|
189
|
-
|
|
190
|
-
const success = response.ok;
|
|
191
|
-
if (success) {
|
|
192
|
-
working++;
|
|
193
|
-
console.log(`✅ ${test.name}: ${response.status} (${responseTime}ms)`);
|
|
194
|
-
} else {
|
|
195
|
-
console.log(`❌ ${test.name}: ${response.status} (${responseTime}ms)`);
|
|
196
|
-
failed.push(`${test.name}: ${response.status}`);
|
|
197
|
-
}
|
|
198
|
-
} catch (err) {
|
|
199
|
-
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
200
|
-
console.log(`❌ ${test.name}: ${errorMsg}`);
|
|
201
|
-
failed.push(`${test.name}: ${errorMsg}`);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
console.log('\n' + '='.repeat(60));
|
|
206
|
-
console.log('📊 FINAL RESULTS');
|
|
207
|
-
console.log('='.repeat(60));
|
|
208
|
-
console.log(`\n✅ WORKING: ${working}/14`);
|
|
209
|
-
console.log(`❌ NOT WORKING: ${14 - working}/14\n`);
|
|
210
|
-
|
|
211
|
-
if (failed.length > 0) {
|
|
212
|
-
console.log('Failed services:');
|
|
213
|
-
failed.forEach(f => console.log(` • ${f}`));
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
runTests().catch(console.error);
|
package/test-numverify-key.ts
DELETED
|
@@ -1,41 +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) vars[match[1].trim()] = match[2].trim();
|
|
12
|
-
}
|
|
13
|
-
return vars;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async function test() {
|
|
17
|
-
const env = loadEnv();
|
|
18
|
-
const key = env.APILAYER_NUMVERIFY_KEY;
|
|
19
|
-
console.log('Testing Number Verification with key:', key.substring(0, 8) + '...');
|
|
20
|
-
|
|
21
|
-
const url = new URL('https://api.apilayer.com/number_verification/validate');
|
|
22
|
-
url.searchParams.set('number', '+46701234567');
|
|
23
|
-
|
|
24
|
-
const response = await fetch(url.toString(), {
|
|
25
|
-
method: 'GET',
|
|
26
|
-
headers: { 'apikey': key },
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
console.log('Status:', response.status);
|
|
30
|
-
if (response.status === 200) {
|
|
31
|
-
console.log('✅ Number Verification NOW WORKING');
|
|
32
|
-
const data = await response.json();
|
|
33
|
-
console.log('Response:', JSON.stringify(data).substring(0, 200));
|
|
34
|
-
} else {
|
|
35
|
-
const data = await response.json();
|
|
36
|
-
console.log('❌ Still failing');
|
|
37
|
-
console.log('Error:', data);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
test().catch(console.error);
|
package/test-via-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
|
-
|
|
5
|
-
// Load credentials
|
|
6
|
-
function loadEnv(): Record<string, string> {
|
|
7
|
-
const envPath = path.join(homedir(), '.secrets', 'apilayer.env');
|
|
8
|
-
const content = fs.readFileSync(envPath, 'utf-8');
|
|
9
|
-
const vars: Record<string, string> = {};
|
|
10
|
-
for (const line of content.split('\n')) {
|
|
11
|
-
const match = line.match(/^([^=]+)=(.*)$/);
|
|
12
|
-
if (match) {
|
|
13
|
-
vars[match[1].trim()] = match[2].trim();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return vars;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const env = loadEnv();
|
|
20
|
-
|
|
21
|
-
// Import handlers directly
|
|
22
|
-
const handlers: Record<string, Record<string, any>> = {
|
|
23
|
-
apilayer: {
|
|
24
|
-
exchange_rates: async (params: any) => {
|
|
25
|
-
const key = env.APILAYER_EXCHANGERATE_KEY;
|
|
26
|
-
const url = new URL('https://api.apilayer.com/exchangerates_data/latest');
|
|
27
|
-
url.searchParams.set('base', 'USD');
|
|
28
|
-
return fetch(url.toString(), { method: 'GET', headers: { 'apikey': key } });
|
|
29
|
-
},
|
|
30
|
-
verify_number: async (params: any) => {
|
|
31
|
-
const key = env.APILAYER_NUMVERIFY_KEY;
|
|
32
|
-
const url = new URL('https://api.apilayer.com/number_verification/validate');
|
|
33
|
-
url.searchParams.set('number', '+46701234567');
|
|
34
|
-
return fetch(url.toString(), { method: 'GET', headers: { 'apikey': key } });
|
|
35
|
-
},
|
|
36
|
-
image_crop: async (params: any) => {
|
|
37
|
-
const key = env.APILAYER_IMAGECROP_KEY;
|
|
38
|
-
const url = new URL('https://api.apilayer.com/smart_crop/url');
|
|
39
|
-
url.searchParams.set('url', 'https://example.com/image.jpg');
|
|
40
|
-
return fetch(url.toString(), { method: 'GET', headers: { 'apikey': key } });
|
|
41
|
-
},
|
|
42
|
-
world_news: async (params: any) => {
|
|
43
|
-
const key = env.APILAYER_WORLDNEWS_KEY;
|
|
44
|
-
const url = new URL('https://api.apilayer.com/world_news/extract-news');
|
|
45
|
-
url.searchParams.set('url', 'https://example.com');
|
|
46
|
-
url.searchParams.set('analyze', 'true');
|
|
47
|
-
return fetch(url.toString(), { method: 'GET', headers: { 'apikey': key } });
|
|
48
|
-
},
|
|
49
|
-
skills: async (params: any) => {
|
|
50
|
-
const key = env.APILAYER_SKILLAPI_KEY;
|
|
51
|
-
const url = new URL('https://api.apilayer.com/skills');
|
|
52
|
-
url.searchParams.set('q', 'machine learning');
|
|
53
|
-
return fetch(url.toString(), { method: 'GET', headers: { 'apikey': key } });
|
|
54
|
-
},
|
|
55
|
-
form_submit: async (params: any) => {
|
|
56
|
-
const key = env.APILAYER_FORMAPI_KEY;
|
|
57
|
-
return fetch('https://api.apilayer.com/form_api/test', {
|
|
58
|
-
method: 'POST',
|
|
59
|
-
headers: { 'apikey': key, 'Content-Type': 'application/json' },
|
|
60
|
-
body: JSON.stringify({}),
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
async function testHandlers() {
|
|
67
|
-
console.log('🧪 Testing handlers directly\n');
|
|
68
|
-
|
|
69
|
-
const tests = [
|
|
70
|
-
{ name: 'Exchange Rates', action: 'exchange_rates' },
|
|
71
|
-
{ name: 'Verify Number', action: 'verify_number' },
|
|
72
|
-
{ name: 'Image Crop', action: 'image_crop' },
|
|
73
|
-
{ name: 'World News', action: 'world_news' },
|
|
74
|
-
{ name: 'Skills', action: 'skills' },
|
|
75
|
-
{ name: 'Form Submit', action: 'form_submit' },
|
|
76
|
-
];
|
|
77
|
-
|
|
78
|
-
for (const test of tests) {
|
|
79
|
-
try {
|
|
80
|
-
const handler = handlers.apilayer[test.action];
|
|
81
|
-
const startTime = Date.now();
|
|
82
|
-
const response = await handler({});
|
|
83
|
-
const responseTime = Date.now() - startTime;
|
|
84
|
-
console.log(`${response.ok ? '✅' : '❌'} ${test.name}: ${response.status} (${responseTime}ms)`);
|
|
85
|
-
} catch (err) {
|
|
86
|
-
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
87
|
-
console.log(`❌ ${test.name}: ${errorMsg}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
testHandlers().catch(console.error);
|
package/test-worldnews.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { executeAPICall } from './dist/execute.js';
|
|
2
|
-
|
|
3
|
-
const realNewsUrls = [
|
|
4
|
-
'https://www.bbc.com/news/technology-68621230',
|
|
5
|
-
'https://techcrunch.com/2024/03/15/openai-gpt-4/',
|
|
6
|
-
'https://www.reuters.com/technology/'
|
|
7
|
-
];
|
|
8
|
-
|
|
9
|
-
console.log('🔬 Testing World News API with REAL news URLs...\n');
|
|
10
|
-
|
|
11
|
-
for (const url of realNewsUrls) {
|
|
12
|
-
console.log(`Testing: ${url.substring(0, 50)}...`);
|
|
13
|
-
try {
|
|
14
|
-
const result = await executeAPICall('apilayer', 'world_news', { url });
|
|
15
|
-
|
|
16
|
-
if (result.success) {
|
|
17
|
-
console.log(`✅ Working!`);
|
|
18
|
-
console.log(` Title: ${result.data?.title || 'N/A'}`);
|
|
19
|
-
break; // One success is enough
|
|
20
|
-
} else {
|
|
21
|
-
console.log(`❌ ${result.error || 'Failed'}\n`);
|
|
22
|
-
}
|
|
23
|
-
} catch (e) {
|
|
24
|
-
console.log(`❌ ${e.message}\n`);
|
|
25
|
-
}
|
|
26
|
-
}
|