@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.
Files changed (228) hide show
  1. package/convex/http.js.map +1 -1
  2. package/convex/http.ts +516 -0
  3. package/dist/analytics.d.ts +0 -4
  4. package/dist/analytics.d.ts.map +1 -1
  5. package/dist/analytics.js +0 -1
  6. package/dist/analytics.js.map +1 -1
  7. package/dist/bin.js +1 -1
  8. package/dist/cli/commands/mcp-install.d.ts.map +1 -1
  9. package/dist/cli/commands/mcp-install.js +8 -87
  10. package/dist/cli/commands/mcp-install.js.map +1 -1
  11. package/dist/cli/index.js +0 -7
  12. package/dist/credentials.d.ts.map +1 -1
  13. package/dist/credentials.js +38 -43
  14. package/dist/credentials.js.map +1 -1
  15. package/dist/discovery.d.ts.map +1 -1
  16. package/dist/discovery.js +82 -191
  17. package/dist/discovery.js.map +1 -1
  18. package/dist/http-api.d.ts.map +1 -1
  19. package/dist/http-api.js +33 -17
  20. package/dist/http-api.js.map +1 -1
  21. package/dist/proxy.js +1 -1
  22. package/dist/proxy.js.map +1 -1
  23. package/landing/next-env.d.ts +0 -1
  24. package/landing/src/app/api/auth/magic-link/route.ts +1 -1
  25. package/landing/src/app/auth/verify/page.tsx +0 -6
  26. package/landing/src/app/dashboard/verify/page.tsx +0 -6
  27. package/landing/src/app/join/page.tsx +0 -6
  28. package/landing/src/app/layout.tsx +2 -2
  29. package/landing/src/app/login/page.tsx +1 -1
  30. package/landing/src/app/mou/[partnerId]/page.tsx +0 -6
  31. package/landing/src/app/page.tsx +18 -39
  32. package/landing/src/app/providers/dashboard/[apiId]/actions/[actionId]/edit/page.tsx +0 -6
  33. package/landing/src/app/providers/dashboard/[apiId]/actions/new/page.tsx +0 -5
  34. package/landing/src/app/providers/dashboard/[apiId]/actions/page.tsx +0 -5
  35. package/landing/src/app/providers/dashboard/[apiId]/direct-call/page.tsx +1 -6
  36. package/landing/src/app/providers/dashboard/[apiId]/page.tsx +0 -5
  37. package/landing/src/app/providers/dashboard/[apiId]/test/page.tsx +0 -5
  38. package/landing/src/app/providers/dashboard/layout.tsx +6 -6
  39. package/landing/src/app/providers/dashboard/login/page.tsx +1 -1
  40. package/landing/src/app/providers/dashboard/page.tsx +1 -1
  41. package/landing/src/app/providers/dashboard/verify/page.tsx +0 -6
  42. package/landing/src/app/providers/layout.tsx +1 -1
  43. package/landing/src/app/upgrade/page.tsx +0 -6
  44. package/landing/src/app/workspace/page.tsx +0 -6
  45. package/landing/src/components/HeroTabs.tsx +2 -2
  46. package/landing/src/components/{Workspace.tsx โ†’ ProviderDashboard.tsx} +2 -2
  47. package/landing/src/components/VideoDemo.tsx +10 -21
  48. package/landing/src/lib/mock-data.ts +1 -1
  49. package/landing/src/lib/stats.json +1 -1
  50. package/package.json +3 -8
  51. package/src/analytics.ts +0 -5
  52. package/src/bin.ts +1 -1
  53. package/src/cli/commands/mcp-install.ts +8 -90
  54. package/src/cli/index.ts +0 -8
  55. package/src/credentials.ts +39 -44
  56. package/src/discovery.ts +82 -191
  57. package/src/http-api.ts +34 -18
  58. package/src/proxy.ts +1 -1
  59. package/APILAYER_STATUS_2026-03-24.md +0 -38
  60. package/CHANGELOG-WHITELIST-V2.md +0 -269
  61. package/HIVR-WHITELIST-STATUS.md +0 -205
  62. package/HIVR-WHITELIST.md +0 -148
  63. package/TERMINOLOGY-AUDIT.md +0 -99
  64. package/TERMINOLOGY-FIXED.md +0 -74
  65. package/VIDEO-DEMO-GUIDE.md +0 -82
  66. package/WHITELIST-ARCHITECTURE.md +0 -379
  67. package/api/discover.ts +0 -71
  68. package/api/health.ts +0 -20
  69. package/convex/adminActivate.d.ts +0 -3
  70. package/convex/adminActivate.js +0 -47
  71. package/convex/adminStats.d.ts +0 -3
  72. package/convex/adminStats.js +0 -42
  73. package/convex/agents.d.ts +0 -54
  74. package/convex/agents.js +0 -499
  75. package/convex/analytics.d.ts +0 -5
  76. package/convex/analytics.js +0 -166
  77. package/convex/billing.d.ts +0 -88
  78. package/convex/billing.js +0 -655
  79. package/convex/capabilities.d.ts +0 -9
  80. package/convex/capabilities.js +0 -145
  81. package/convex/chains.d.ts +0 -67
  82. package/convex/chains.js +0 -1042
  83. package/convex/credits.d.ts +0 -25
  84. package/convex/credits.js +0 -186
  85. package/convex/crons.d.ts +0 -3
  86. package/convex/crons.js +0 -17
  87. package/convex/directCall.d.ts +0 -72
  88. package/convex/directCall.js +0 -627
  89. package/convex/earnProgress.d.ts +0 -58
  90. package/convex/earnProgress.js +0 -649
  91. package/convex/email.d.ts +0 -14
  92. package/convex/email.js +0 -300
  93. package/convex/feedback.d.ts +0 -7
  94. package/convex/feedback.js +0 -227
  95. package/convex/http.d.ts +0 -3
  96. package/convex/http.js +0 -910
  97. package/convex/logs.d.ts +0 -38
  98. package/convex/logs.js +0 -487
  99. package/convex/mou.d.ts +0 -6
  100. package/convex/mou.js +0 -82
  101. package/convex/providerKeys.d.ts +0 -31
  102. package/convex/providerKeys.js +0 -257
  103. package/convex/providers.d.ts +0 -29
  104. package/convex/providers.js +0 -756
  105. package/convex/purchases.d.ts +0 -7
  106. package/convex/purchases.js +0 -157
  107. package/convex/ratelimit.d.ts +0 -4
  108. package/convex/ratelimit.js +0 -91
  109. package/convex/searchLogs.d.ts +0 -4
  110. package/convex/searchLogs.js +0 -129
  111. package/convex/spendAlerts.d.ts +0 -36
  112. package/convex/spendAlerts.js +0 -380
  113. package/convex/stripeActions.d.ts +0 -19
  114. package/convex/stripeActions.js +0 -411
  115. package/convex/teams.d.ts +0 -21
  116. package/convex/teams.js +0 -215
  117. package/convex/telemetry.d.ts +0 -4
  118. package/convex/telemetry.js +0 -74
  119. package/convex/usage.d.ts +0 -27
  120. package/convex/usage.js +0 -229
  121. package/convex/waitlist.d.ts +0 -4
  122. package/convex/waitlist.js +0 -49
  123. package/convex/webhooks.d.ts +0 -12
  124. package/convex/webhooks.js +0 -410
  125. package/convex/workspaces.d.ts +0 -29
  126. package/convex/workspaces.js +0 -880
  127. package/direct-test.mjs +0 -51
  128. package/dist/access-control.d.ts +0 -45
  129. package/dist/access-control.d.ts.map +0 -1
  130. package/dist/access-control.js +0 -142
  131. package/dist/access-control.js.map +0 -1
  132. package/dist/chain-types.d.ts +0 -187
  133. package/dist/chain-types.d.ts.map +0 -1
  134. package/dist/chain-types.js +0 -33
  135. package/dist/chain-types.js.map +0 -1
  136. package/dist/convex/adminActivate.js +0 -46
  137. package/dist/convex/adminStats.js +0 -41
  138. package/dist/convex/agents.js +0 -498
  139. package/dist/convex/analytics.js +0 -165
  140. package/dist/convex/billing.js +0 -654
  141. package/dist/convex/capabilities.js +0 -144
  142. package/dist/convex/chains.js +0 -1041
  143. package/dist/convex/credits.js +0 -185
  144. package/dist/convex/crons.js +0 -16
  145. package/dist/convex/directCall.js +0 -626
  146. package/dist/convex/earnProgress.js +0 -648
  147. package/dist/convex/email.js +0 -299
  148. package/dist/convex/feedback.js +0 -226
  149. package/dist/convex/http.js +0 -909
  150. package/dist/convex/logs.js +0 -486
  151. package/dist/convex/mou.js +0 -81
  152. package/dist/convex/providerKeys.js +0 -256
  153. package/dist/convex/providers.js +0 -755
  154. package/dist/convex/purchases.js +0 -156
  155. package/dist/convex/ratelimit.js +0 -90
  156. package/dist/convex/schema.js +0 -709
  157. package/dist/convex/searchLogs.js +0 -128
  158. package/dist/convex/spendAlerts.js +0 -379
  159. package/dist/convex/stripeActions.js +0 -410
  160. package/dist/convex/teams.js +0 -214
  161. package/dist/convex/telemetry.js +0 -73
  162. package/dist/convex/usage.js +0 -228
  163. package/dist/convex/waitlist.js +0 -48
  164. package/dist/convex/webhooks.js +0 -409
  165. package/dist/convex/workspaces.js +0 -879
  166. package/dist/hivr-whitelist.d.ts +0 -18
  167. package/dist/hivr-whitelist.d.ts.map +0 -1
  168. package/dist/hivr-whitelist.js +0 -95
  169. package/dist/hivr-whitelist.js.map +0 -1
  170. package/dist/http-server-minimal.d.ts +0 -7
  171. package/dist/http-server-minimal.d.ts.map +0 -1
  172. package/dist/http-server-minimal.js +0 -126
  173. package/dist/http-server-minimal.js.map +0 -1
  174. package/dist/product-whitelist.d.ts +0 -37
  175. package/dist/product-whitelist.d.ts.map +0 -1
  176. package/dist/product-whitelist.js +0 -203
  177. package/dist/product-whitelist.js.map +0 -1
  178. package/dist/src/analytics.js +0 -129
  179. package/dist/src/bin.js +0 -17
  180. package/dist/src/capability-router.js +0 -240
  181. package/dist/src/chainExecutor.js +0 -451
  182. package/dist/src/chainResolver.js +0 -518
  183. package/dist/src/cli/commands/doctor.js +0 -324
  184. package/dist/src/cli/commands/mcp-install.js +0 -255
  185. package/dist/src/cli/commands/restore.js +0 -259
  186. package/dist/src/cli/commands/setup.js +0 -205
  187. package/dist/src/cli/commands/uninstall.js +0 -188
  188. package/dist/src/cli/index.js +0 -111
  189. package/dist/src/cli.js +0 -302
  190. package/dist/src/confirmation.js +0 -240
  191. package/dist/src/credentials.js +0 -357
  192. package/dist/src/credits.js +0 -260
  193. package/dist/src/crypto.js +0 -66
  194. package/dist/src/discovery.js +0 -504
  195. package/dist/src/enterprise/env.js +0 -123
  196. package/dist/src/enterprise/script-generator.js +0 -460
  197. package/dist/src/execute-dynamic.js +0 -473
  198. package/dist/src/execute.js +0 -1727
  199. package/dist/src/index.js +0 -2062
  200. package/dist/src/metered.js +0 -80
  201. package/dist/src/open-apis.js +0 -276
  202. package/dist/src/proxy.js +0 -28
  203. package/dist/src/session.js +0 -86
  204. package/dist/src/stripe.js +0 -407
  205. package/dist/src/telemetry.js +0 -49
  206. package/dist/src/types.js +0 -2
  207. package/dist/src/utils/backup.js +0 -181
  208. package/dist/src/utils/config.js +0 -220
  209. package/dist/src/utils/os.js +0 -105
  210. package/dist/src/utils/paths.js +0 -159
  211. package/landing/pages/api/discover.ts +0 -43
  212. package/landing/pages/api/health.ts +0 -20
  213. package/scripts/test-whitelist-v2.sh +0 -128
  214. package/src/access-control.ts +0 -174
  215. package/src/hivr-whitelist.ts +0 -110
  216. package/src/http-server-minimal.ts +0 -154
  217. package/src/product-whitelist.ts +0 -246
  218. package/test-actual-handlers.ts +0 -92
  219. package/test-apilayer-all-14.ts +0 -249
  220. package/test-apilayer-fixed.ts +0 -248
  221. package/test-direct-endpoints.ts +0 -174
  222. package/test-exact-endpoints.ts +0 -144
  223. package/test-final.ts +0 -83
  224. package/test-full-routing.ts +0 -100
  225. package/test-handlers-correct.ts +0 -217
  226. package/test-numverify-key.ts +0 -41
  227. package/test-via-handlers.ts +0 -92
  228. package/test-worldnews.mjs +0 -26
@@ -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);
@@ -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);
@@ -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);