@nordsym/apiclaw 2.2.0 โ 2.3.0
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/README.md +15 -2
- package/dist/bin-http.js +0 -0
- package/dist/bin.bundled.js +79288 -0
- package/dist/gateway-client.d.ts.map +1 -1
- package/dist/gateway-client.js +24 -2
- package/dist/gateway-client.js.map +1 -1
- package/dist/index.bundled.js +61263 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
- package/.claude/settings.local.json +0 -13
- package/.env.prod +0 -1
- package/apiclaw-README.md +0 -494
- package/convex/_generated/api.d.ts +0 -145
- package/convex/_generated/api.js +0 -23
- package/convex/_generated/dataModel.d.ts +0 -60
- package/convex/_generated/server.d.ts +0 -143
- package/convex/_generated/server.js +0 -93
- package/convex/_listWorkspaces.ts +0 -13
- package/convex/adminActivate.ts +0 -53
- package/convex/adminStats.ts +0 -306
- package/convex/agents.ts +0 -939
- package/convex/analytics.ts +0 -187
- package/convex/apiKeys.ts +0 -220
- package/convex/backfillAnalytics.ts +0 -272
- package/convex/backfillSearchLogs.ts +0 -35
- package/convex/billing.ts +0 -834
- package/convex/capabilities.ts +0 -157
- package/convex/chains.ts +0 -1318
- package/convex/credits.ts +0 -211
- package/convex/crons.ts +0 -65
- package/convex/debugFilestackLogs.ts +0 -16
- package/convex/debugGetToken.ts +0 -18
- package/convex/directCall.ts +0 -713
- package/convex/earnProgress.ts +0 -753
- package/convex/email.ts +0 -329
- package/convex/feedback.ts +0 -265
- package/convex/funnel.ts +0 -431
- package/convex/guards.ts +0 -174
- package/convex/http.ts +0 -3756
- package/convex/inbound.ts +0 -32
- package/convex/logs.ts +0 -701
- package/convex/migrateFilestack.ts +0 -81
- package/convex/migratePartnersProd.ts +0 -174
- package/convex/migratePratham.ts +0 -126
- package/convex/migrateProviderWorkspaces.ts +0 -175
- package/convex/mou.ts +0 -91
- package/convex/nurture.ts +0 -355
- package/convex/providerKeys.ts +0 -289
- package/convex/providers.ts +0 -1135
- package/convex/purchases.ts +0 -183
- package/convex/ratelimit.ts +0 -104
- package/convex/schema.ts +0 -926
- package/convex/searchLogs.ts +0 -265
- package/convex/seedAPILayerAPIs.ts +0 -191
- package/convex/seedDirectCallConfigs.ts +0 -336
- package/convex/seedPratham.ts +0 -149
- package/convex/spendAlerts.ts +0 -442
- package/convex/stripeActions.ts +0 -607
- package/convex/teams.ts +0 -243
- package/convex/telemetry.ts +0 -81
- package/convex/tsconfig.json +0 -25
- package/convex/updateAPIStatus.ts +0 -44
- package/convex/usage.ts +0 -260
- package/convex/usageReports.ts +0 -357
- package/convex/waitlist.ts +0 -55
- package/convex/webhooks.ts +0 -494
- package/convex/workspaceSettings.ts +0 -143
- package/convex/workspaces.ts +0 -1331
- package/convex.json +0 -3
- package/direct-test.mjs +0 -51
- package/email-templates/filestack-provider-outreach.html +0 -162
- package/email-templates/partnership-template.html +0 -116
- package/email-templates/pratham-draft-preview.txt +0 -57
- package/email-templates/pratham-partnership-draft.html +0 -141
- package/reports/APIClaw-Session-Report-2026-04-05.pdf +0 -0
- package/reports/pipeline/PIPELINE-REPORT.json +0 -153
- package/reports/pipeline/acquire_apisguru.json +0 -17
- package/reports/pipeline/capabilities.json +0 -38
- package/reports/pipeline/discover_azure_recursive.json +0 -1551
- package/reports/pipeline/discover_github.json +0 -25
- package/reports/pipeline/discover_github_repos.json +0 -49
- package/reports/pipeline/discover_swaggerhub.json +0 -24
- package/reports/pipeline/discover_well_known.json +0 -23
- package/reports/pipeline/fetch_specs.json +0 -19
- package/reports/pipeline/generate_providers.json +0 -14
- package/reports/pipeline/match_registry.json +0 -11
- package/reports/pipeline/parse_specs.json +0 -17
- package/reports/pipeline/promote_candidates.json +0 -34
- package/reports/pipeline/validate.json +0 -30
- package/reports/pipeline/validate_smoke_details.json +0 -3835
- package/reports/session-report-2026-04-05.html +0 -433
- package/seed-apis-direct.mjs +0 -106
- package/src/access-control.ts +0 -174
- package/src/adapters/base.ts +0 -364
- package/src/adapters/claude-desktop.ts +0 -41
- package/src/adapters/cline.ts +0 -88
- package/src/adapters/continue.ts +0 -91
- package/src/adapters/cursor.ts +0 -43
- package/src/adapters/custom.ts +0 -188
- package/src/adapters/detect.ts +0 -202
- package/src/adapters/index.ts +0 -47
- package/src/adapters/windsurf.ts +0 -44
- package/src/bin-http.ts +0 -45
- package/src/bin.ts +0 -34
- package/src/capability-router.ts +0 -331
- package/src/chainExecutor.ts +0 -730
- package/src/chainResolver.test.ts +0 -246
- package/src/chainResolver.ts +0 -658
- package/src/cli/commands/demo.ts +0 -109
- package/src/cli/commands/doctor.ts +0 -435
- package/src/cli/commands/index.ts +0 -9
- package/src/cli/commands/login.ts +0 -203
- package/src/cli/commands/mcp-install.ts +0 -373
- package/src/cli/commands/restore.ts +0 -333
- package/src/cli/commands/setup.ts +0 -297
- package/src/cli/commands/uninstall.ts +0 -240
- package/src/cli/index.ts +0 -148
- package/src/cli.ts +0 -370
- package/src/confirmation.ts +0 -296
- package/src/credentials.ts +0 -455
- package/src/credits.ts +0 -329
- package/src/crypto.ts +0 -75
- package/src/discovery.ts +0 -568
- package/src/enterprise/env.ts +0 -156
- package/src/enterprise/index.ts +0 -7
- package/src/enterprise/script-generator.ts +0 -481
- package/src/execute-dynamic.ts +0 -617
- package/src/execute.ts +0 -2386
- package/src/funnel-client.ts +0 -168
- package/src/funnel.test.ts +0 -187
- package/src/gateway-client.ts +0 -192
- package/src/hivr-whitelist.ts +0 -110
- package/src/http-api.ts +0 -286
- package/src/http-server-minimal.ts +0 -154
- package/src/index.ts +0 -2702
- package/src/intelligent-gateway.ts +0 -339
- package/src/mcp-analytics.ts +0 -156
- package/src/metered.ts +0 -149
- package/src/open-apis-generated.ts +0 -157
- package/src/open-apis.ts +0 -558
- package/src/postinstall.ts +0 -40
- package/src/product-whitelist.ts +0 -246
- package/src/proxy.ts +0 -36
- package/src/registration-guard.ts +0 -117
- package/src/session.ts +0 -129
- package/src/stripe.ts +0 -497
- package/src/telemetry.ts +0 -71
- package/src/test.ts +0 -135
- package/src/types/convex-api.d.ts +0 -20
- package/src/types/convex-api.ts +0 -21
- package/src/types.ts +0 -109
- package/src/ui/colors.ts +0 -219
- package/src/ui/errors.ts +0 -394
- package/src/ui/index.ts +0 -17
- package/src/ui/prompts.ts +0 -390
- package/src/ui/spinner.ts +0 -325
- package/src/utils/backup.ts +0 -224
- package/src/utils/config.ts +0 -318
- package/src/utils/os.ts +0 -124
- package/src/utils/paths.ts +0 -203
- package/src/webhook.ts +0 -107
- package/test-10-working.cjs +0 -97
- package/test-14-final.cjs +0 -96
- 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/tsconfig.json +0 -20
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);
|
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);
|