@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.
Files changed (176) hide show
  1. package/README.md +15 -2
  2. package/dist/bin-http.js +0 -0
  3. package/dist/bin.bundled.js +79288 -0
  4. package/dist/gateway-client.d.ts.map +1 -1
  5. package/dist/gateway-client.js +24 -2
  6. package/dist/gateway-client.js.map +1 -1
  7. package/dist/index.bundled.js +61263 -0
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/package.json +7 -2
  11. package/.claude/settings.local.json +0 -13
  12. package/.env.prod +0 -1
  13. package/apiclaw-README.md +0 -494
  14. package/convex/_generated/api.d.ts +0 -145
  15. package/convex/_generated/api.js +0 -23
  16. package/convex/_generated/dataModel.d.ts +0 -60
  17. package/convex/_generated/server.d.ts +0 -143
  18. package/convex/_generated/server.js +0 -93
  19. package/convex/_listWorkspaces.ts +0 -13
  20. package/convex/adminActivate.ts +0 -53
  21. package/convex/adminStats.ts +0 -306
  22. package/convex/agents.ts +0 -939
  23. package/convex/analytics.ts +0 -187
  24. package/convex/apiKeys.ts +0 -220
  25. package/convex/backfillAnalytics.ts +0 -272
  26. package/convex/backfillSearchLogs.ts +0 -35
  27. package/convex/billing.ts +0 -834
  28. package/convex/capabilities.ts +0 -157
  29. package/convex/chains.ts +0 -1318
  30. package/convex/credits.ts +0 -211
  31. package/convex/crons.ts +0 -65
  32. package/convex/debugFilestackLogs.ts +0 -16
  33. package/convex/debugGetToken.ts +0 -18
  34. package/convex/directCall.ts +0 -713
  35. package/convex/earnProgress.ts +0 -753
  36. package/convex/email.ts +0 -329
  37. package/convex/feedback.ts +0 -265
  38. package/convex/funnel.ts +0 -431
  39. package/convex/guards.ts +0 -174
  40. package/convex/http.ts +0 -3756
  41. package/convex/inbound.ts +0 -32
  42. package/convex/logs.ts +0 -701
  43. package/convex/migrateFilestack.ts +0 -81
  44. package/convex/migratePartnersProd.ts +0 -174
  45. package/convex/migratePratham.ts +0 -126
  46. package/convex/migrateProviderWorkspaces.ts +0 -175
  47. package/convex/mou.ts +0 -91
  48. package/convex/nurture.ts +0 -355
  49. package/convex/providerKeys.ts +0 -289
  50. package/convex/providers.ts +0 -1135
  51. package/convex/purchases.ts +0 -183
  52. package/convex/ratelimit.ts +0 -104
  53. package/convex/schema.ts +0 -926
  54. package/convex/searchLogs.ts +0 -265
  55. package/convex/seedAPILayerAPIs.ts +0 -191
  56. package/convex/seedDirectCallConfigs.ts +0 -336
  57. package/convex/seedPratham.ts +0 -149
  58. package/convex/spendAlerts.ts +0 -442
  59. package/convex/stripeActions.ts +0 -607
  60. package/convex/teams.ts +0 -243
  61. package/convex/telemetry.ts +0 -81
  62. package/convex/tsconfig.json +0 -25
  63. package/convex/updateAPIStatus.ts +0 -44
  64. package/convex/usage.ts +0 -260
  65. package/convex/usageReports.ts +0 -357
  66. package/convex/waitlist.ts +0 -55
  67. package/convex/webhooks.ts +0 -494
  68. package/convex/workspaceSettings.ts +0 -143
  69. package/convex/workspaces.ts +0 -1331
  70. package/convex.json +0 -3
  71. package/direct-test.mjs +0 -51
  72. package/email-templates/filestack-provider-outreach.html +0 -162
  73. package/email-templates/partnership-template.html +0 -116
  74. package/email-templates/pratham-draft-preview.txt +0 -57
  75. package/email-templates/pratham-partnership-draft.html +0 -141
  76. package/reports/APIClaw-Session-Report-2026-04-05.pdf +0 -0
  77. package/reports/pipeline/PIPELINE-REPORT.json +0 -153
  78. package/reports/pipeline/acquire_apisguru.json +0 -17
  79. package/reports/pipeline/capabilities.json +0 -38
  80. package/reports/pipeline/discover_azure_recursive.json +0 -1551
  81. package/reports/pipeline/discover_github.json +0 -25
  82. package/reports/pipeline/discover_github_repos.json +0 -49
  83. package/reports/pipeline/discover_swaggerhub.json +0 -24
  84. package/reports/pipeline/discover_well_known.json +0 -23
  85. package/reports/pipeline/fetch_specs.json +0 -19
  86. package/reports/pipeline/generate_providers.json +0 -14
  87. package/reports/pipeline/match_registry.json +0 -11
  88. package/reports/pipeline/parse_specs.json +0 -17
  89. package/reports/pipeline/promote_candidates.json +0 -34
  90. package/reports/pipeline/validate.json +0 -30
  91. package/reports/pipeline/validate_smoke_details.json +0 -3835
  92. package/reports/session-report-2026-04-05.html +0 -433
  93. package/seed-apis-direct.mjs +0 -106
  94. package/src/access-control.ts +0 -174
  95. package/src/adapters/base.ts +0 -364
  96. package/src/adapters/claude-desktop.ts +0 -41
  97. package/src/adapters/cline.ts +0 -88
  98. package/src/adapters/continue.ts +0 -91
  99. package/src/adapters/cursor.ts +0 -43
  100. package/src/adapters/custom.ts +0 -188
  101. package/src/adapters/detect.ts +0 -202
  102. package/src/adapters/index.ts +0 -47
  103. package/src/adapters/windsurf.ts +0 -44
  104. package/src/bin-http.ts +0 -45
  105. package/src/bin.ts +0 -34
  106. package/src/capability-router.ts +0 -331
  107. package/src/chainExecutor.ts +0 -730
  108. package/src/chainResolver.test.ts +0 -246
  109. package/src/chainResolver.ts +0 -658
  110. package/src/cli/commands/demo.ts +0 -109
  111. package/src/cli/commands/doctor.ts +0 -435
  112. package/src/cli/commands/index.ts +0 -9
  113. package/src/cli/commands/login.ts +0 -203
  114. package/src/cli/commands/mcp-install.ts +0 -373
  115. package/src/cli/commands/restore.ts +0 -333
  116. package/src/cli/commands/setup.ts +0 -297
  117. package/src/cli/commands/uninstall.ts +0 -240
  118. package/src/cli/index.ts +0 -148
  119. package/src/cli.ts +0 -370
  120. package/src/confirmation.ts +0 -296
  121. package/src/credentials.ts +0 -455
  122. package/src/credits.ts +0 -329
  123. package/src/crypto.ts +0 -75
  124. package/src/discovery.ts +0 -568
  125. package/src/enterprise/env.ts +0 -156
  126. package/src/enterprise/index.ts +0 -7
  127. package/src/enterprise/script-generator.ts +0 -481
  128. package/src/execute-dynamic.ts +0 -617
  129. package/src/execute.ts +0 -2386
  130. package/src/funnel-client.ts +0 -168
  131. package/src/funnel.test.ts +0 -187
  132. package/src/gateway-client.ts +0 -192
  133. package/src/hivr-whitelist.ts +0 -110
  134. package/src/http-api.ts +0 -286
  135. package/src/http-server-minimal.ts +0 -154
  136. package/src/index.ts +0 -2702
  137. package/src/intelligent-gateway.ts +0 -339
  138. package/src/mcp-analytics.ts +0 -156
  139. package/src/metered.ts +0 -149
  140. package/src/open-apis-generated.ts +0 -157
  141. package/src/open-apis.ts +0 -558
  142. package/src/postinstall.ts +0 -40
  143. package/src/product-whitelist.ts +0 -246
  144. package/src/proxy.ts +0 -36
  145. package/src/registration-guard.ts +0 -117
  146. package/src/session.ts +0 -129
  147. package/src/stripe.ts +0 -497
  148. package/src/telemetry.ts +0 -71
  149. package/src/test.ts +0 -135
  150. package/src/types/convex-api.d.ts +0 -20
  151. package/src/types/convex-api.ts +0 -21
  152. package/src/types.ts +0 -109
  153. package/src/ui/colors.ts +0 -219
  154. package/src/ui/errors.ts +0 -394
  155. package/src/ui/index.ts +0 -17
  156. package/src/ui/prompts.ts +0 -390
  157. package/src/ui/spinner.ts +0 -325
  158. package/src/utils/backup.ts +0 -224
  159. package/src/utils/config.ts +0 -318
  160. package/src/utils/os.ts +0 -124
  161. package/src/utils/paths.ts +0 -203
  162. package/src/webhook.ts +0 -107
  163. package/test-10-working.cjs +0 -97
  164. package/test-14-final.cjs +0 -96
  165. package/test-actual-handlers.ts +0 -92
  166. package/test-apilayer-all-14.ts +0 -249
  167. package/test-apilayer-fixed.ts +0 -248
  168. package/test-direct-endpoints.ts +0 -174
  169. package/test-exact-endpoints.ts +0 -144
  170. package/test-final.ts +0 -83
  171. package/test-full-routing.ts +0 -100
  172. package/test-handlers-correct.ts +0 -217
  173. package/test-numverify-key.ts +0 -41
  174. package/test-via-handlers.ts +0 -92
  175. package/test-worldnews.mjs +0 -26
  176. package/tsconfig.json +0 -20
@@ -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);
@@ -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);
@@ -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);