@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,265 +0,0 @@
1
- import { internalMutation, mutation, query } from "./_generated/server";
2
- import { v } from "convex/values";
3
-
4
- /**
5
- * Public mutation called by MCP server (path: searchLogs:log)
6
- */
7
- export const log = mutation({
8
- args: {
9
- sessionToken: v.string(),
10
- query: v.string(),
11
- resultCount: v.number(),
12
- matchedProviders: v.optional(v.array(v.string())),
13
- responseTimeMs: v.optional(v.number()),
14
- subagentId: v.optional(v.string()),
15
- },
16
- handler: async (ctx, args) => {
17
- const session = await ctx.db
18
- .query("agentSessions")
19
- .withIndex("by_sessionToken", (q) => q.eq("sessionToken", args.sessionToken))
20
- .first();
21
- if (!session) return { success: false };
22
-
23
- await ctx.db.insert("searchLogs", {
24
- workspaceId: session.workspaceId,
25
- subagentId: args.subagentId,
26
- query: args.query,
27
- resultCount: args.resultCount,
28
- hasResults: args.resultCount > 0,
29
- matchedProviders: args.matchedProviders,
30
- responseTimeMs: args.responseTimeMs || 0,
31
- timestamp: Date.now(),
32
- });
33
- return { success: true };
34
- },
35
- });
36
-
37
- /**
38
- * Get recent searches for a workspace (path: searchLogs:getRecent)
39
- */
40
- export const getRecent = query({
41
- args: {
42
- token: v.string(),
43
- limit: v.optional(v.number()),
44
- },
45
- handler: async (ctx, { token, limit = 50 }) => {
46
- const session = await ctx.db
47
- .query("agentSessions")
48
- .withIndex("by_sessionToken", (q) => q.eq("sessionToken", token))
49
- .first();
50
- if (!session) return [];
51
-
52
- const logs = await ctx.db
53
- .query("searchLogs")
54
- .withIndex("by_workspaceId", (q) => q.eq("workspaceId", session.workspaceId))
55
- .order("desc")
56
- .take(limit);
57
-
58
- return logs.map((l) => ({
59
- id: l._id,
60
- query: l.query,
61
- resultCount: l.resultCount,
62
- hasResults: l.hasResults,
63
- matchedProviders: l.matchedProviders || [],
64
- responseTimeMs: l.responseTimeMs,
65
- timestamp: l.timestamp,
66
- subagentId: l.subagentId,
67
- }));
68
- },
69
- });
70
-
71
- // Log a search query (uses existing searchLogs table schema)
72
- export const logSearch = internalMutation({
73
- args: {
74
- query: v.string(),
75
- resultsCount: v.number(),
76
- matchedProviders: v.optional(v.array(v.string())),
77
- sessionToken: v.optional(v.string()),
78
- userAgent: v.optional(v.string()),
79
- responseTimeMs: v.optional(v.number()),
80
- },
81
- handler: async (ctx, args) => {
82
- // Try to get workspaceId from session token
83
- let workspaceId = undefined;
84
- let subagentId = undefined;
85
-
86
- if (args.sessionToken) {
87
- try {
88
- const token = args.sessionToken;
89
- const session = await ctx.db
90
- .query("agentSessions")
91
- .withIndex("by_sessionToken", (q) => q.eq("sessionToken", token))
92
- .first();
93
- if (session) {
94
- workspaceId = session.workspaceId;
95
- // No agentId in agentSessions, subagentId stays undefined
96
- }
97
- } catch (e) {
98
- // Ignore - just skip workspace linking
99
- }
100
- }
101
-
102
- // Only log if we have a workspace (existing schema requires it)
103
- if (workspaceId) {
104
- await ctx.db.insert("searchLogs", {
105
- workspaceId,
106
- subagentId,
107
- query: args.query,
108
- resultCount: args.resultsCount,
109
- hasResults: args.resultsCount > 0,
110
- matchedProviders: args.matchedProviders,
111
- responseTimeMs: args.responseTimeMs || 0,
112
- timestamp: Date.now(),
113
- });
114
- }
115
-
116
- // TODO: Also log anonymous searches somewhere (for product insights)
117
- },
118
- });
119
-
120
- // Get top search queries (for analytics)
121
- export const getTopQueries = query({
122
- args: {
123
- limit: v.optional(v.number()),
124
- since: v.optional(v.number()), // timestamp
125
- },
126
- handler: async (ctx, args) => {
127
- const limit = args.limit || 50;
128
- const since = args.since || Date.now() - 7 * 24 * 60 * 60 * 1000; // Last 7 days
129
-
130
- const logs = await ctx.db
131
- .query("searchLogs")
132
- .withIndex("by_timestamp")
133
- .filter((q) => q.gte(q.field("timestamp"), since))
134
- .collect();
135
-
136
- // Aggregate by query
137
- const queryCounts: Record<string, { count: number; avgResults: number; totalResults: number }> = {};
138
-
139
- for (const log of logs) {
140
- const q = log.query.toLowerCase().trim();
141
- if (!q) continue;
142
-
143
- if (!queryCounts[q]) {
144
- queryCounts[q] = { count: 0, avgResults: 0, totalResults: 0 };
145
- }
146
- queryCounts[q].count++;
147
- queryCounts[q].totalResults += log.resultCount;
148
- }
149
-
150
- // Calculate averages and sort
151
- const sorted = Object.entries(queryCounts)
152
- .map(([query, data]) => ({
153
- query,
154
- count: data.count,
155
- avgResults: Math.round(data.totalResults / data.count * 10) / 10,
156
- noResults: data.totalResults === 0,
157
- }))
158
- .sort((a, b) => b.count - a.count)
159
- .slice(0, limit);
160
-
161
- return {
162
- queries: sorted,
163
- totalSearches: logs.length,
164
- uniqueQueries: Object.keys(queryCounts).length,
165
- period: {
166
- since: new Date(since).toISOString(),
167
- until: new Date().toISOString(),
168
- },
169
- };
170
- },
171
- });
172
-
173
- // Get search stats for a workspace (path: searchLogs:getStats)
174
- export const getStats = query({
175
- args: {
176
- token: v.string(),
177
- hoursBack: v.optional(v.number()),
178
- },
179
- handler: async (ctx, { token, hoursBack }) => {
180
- // Try agentSessions first (MCP agent tokens)
181
- let workspaceId: any = null;
182
- const agentSession = await ctx.db
183
- .query("agentSessions")
184
- .withIndex("by_sessionToken", (q) => q.eq("sessionToken", token))
185
- .first();
186
- if (agentSession) {
187
- workspaceId = agentSession.workspaceId;
188
- } else {
189
- // Fall back to workspace magic-link sessions (legacy: table was renamed to workspaceMagicLinks)
190
- // No fallback needed — agentSessions is the only session table
191
- }
192
- if (!workspaceId) return { totalSearches: 0, zeroResultSearches: 0, avgResponseTimeMs: 0, successRate: 0, byDay: [] };
193
-
194
- const since = hoursBack ? Date.now() - hoursBack * 60 * 60 * 1000 : 0;
195
-
196
- const logs = await ctx.db
197
- .query("searchLogs")
198
- .withIndex("by_workspaceId", (q) => q.eq("workspaceId", workspaceId))
199
- .collect();
200
-
201
- const filtered = since > 0 ? logs.filter((l) => l.timestamp >= since) : logs;
202
- const totalSearches = filtered.length;
203
- const zeroResultSearches = filtered.filter((l) => !l.hasResults).length;
204
- const avgResponseTimeMs = totalSearches > 0
205
- ? Math.round(filtered.reduce((sum, l) => sum + (l.responseTimeMs || 0), 0) / totalSearches)
206
- : 0;
207
- const successRate = totalSearches > 0
208
- ? Math.round(((totalSearches - zeroResultSearches) / totalSearches) * 1000) / 10
209
- : 0;
210
-
211
- // Per-day breakdown for chart
212
- const byDayMap: Record<string, number> = {};
213
- for (const log of filtered) {
214
- const day = new Date(log.timestamp).toISOString().split("T")[0];
215
- byDayMap[day] = (byDayMap[day] || 0) + 1;
216
- }
217
- const byDay = Object.entries(byDayMap)
218
- .map(([date, searches]) => ({ date, searches }))
219
- .sort((a, b) => a.date.localeCompare(b.date));
220
-
221
- return { totalSearches, zeroResultSearches, avgResponseTimeMs, successRate, byDay };
222
- },
223
- });
224
-
225
- // Get searches with no results (API gaps)
226
- export const getZeroResultQueries = query({
227
- args: {
228
- limit: v.optional(v.number()),
229
- since: v.optional(v.number()),
230
- },
231
- handler: async (ctx, args) => {
232
- const limit = args.limit || 20;
233
- const since = args.since || Date.now() - 7 * 24 * 60 * 60 * 1000;
234
-
235
- const logs = await ctx.db
236
- .query("searchLogs")
237
- .withIndex("by_hasResults")
238
- .filter((q) =>
239
- q.and(
240
- q.eq(q.field("hasResults"), false),
241
- q.gte(q.field("timestamp"), since)
242
- )
243
- )
244
- .collect();
245
-
246
- // Aggregate
247
- const queryCounts: Record<string, number> = {};
248
- for (const log of logs) {
249
- const q = log.query.toLowerCase().trim();
250
- if (!q) continue;
251
- queryCounts[q] = (queryCounts[q] || 0) + 1;
252
- }
253
-
254
- const sorted = Object.entries(queryCounts)
255
- .map(([query, count]) => ({ query, count }))
256
- .sort((a, b) => b.count - a.count)
257
- .slice(0, limit);
258
-
259
- return {
260
- gaps: sorted,
261
- totalZeroResults: logs.length,
262
- message: "These queries returned no results - potential APIs to add",
263
- };
264
- },
265
- });
@@ -1,191 +0,0 @@
1
- import { mutation } from "./_generated/server";
2
-
3
- /**
4
- * Seed all 27 APILayer APIs for a workspace
5
- * Run with: npx convex run seedAPILayerAPIs:seedAll '{"email":"gustav_hemmingsson@hotmail.com"}'
6
- */
7
-
8
- export const cleanAndReseed = mutation({
9
- args: {},
10
- handler: async (ctx) => {
11
- const email = "gustav_hemmingsson@hotmail.com";
12
-
13
- // Find provider
14
- const provider = await ctx.db
15
- .query("providers")
16
- .withIndex("by_email", (q) => q.eq("email", email))
17
- .first();
18
-
19
- if (!provider) return { success: false, error: "Provider not found" };
20
-
21
- // Delete ALL existing providerAPIs for this provider
22
- const existing = await ctx.db
23
- .query("providerAPIs")
24
- .withIndex("by_providerId", (q) => q.eq("providerId", provider._id))
25
- .collect();
26
-
27
- for (const api of existing) {
28
- await ctx.db.delete(api._id);
29
- }
30
-
31
- // Re-insert canonical 27
32
- const canonical = [
33
- { name: "ExchangeRate API", description: "Real-time exchange rates and currency conversion", category: "finance" },
34
- { name: "Marketstack", description: "Real-time, intraday & historical market data", category: "finance" },
35
- { name: "AviationStack", description: "Real-time flight status & global aviation data", category: "geolocation" },
36
- { name: "PDF Layer", description: "High quality HTML to PDF conversion", category: "business" },
37
- { name: "Screenshot Layer", description: "Capture website screenshots", category: "marketing" },
38
- { name: "Email Verification API", description: "Verify email addresses in real-time", category: "devtools" },
39
- { name: "Number Verification API", description: "Validate phone numbers globally", category: "devtools" },
40
- { name: "VAT Layer", description: "EU VAT number validation", category: "finance" },
41
- { name: "World News API", description: "Extract news from any URL", category: "news" },
42
- { name: "Finance News API", description: "Real-time financial news feed", category: "news" },
43
- { name: "Advanced Scraper API", description: "Web scraping without the hassle", category: "scraping" },
44
- { name: "Image Crop API", description: "Smart image cropping", category: "marketing" },
45
- { name: "Skills API", description: "Search skill database", category: "devtools" },
46
- { name: "Form API", description: "Form submission handling", category: "devtools" },
47
- { name: "Fixer API", description: "Foreign exchange rates & currency conversion", category: "finance" },
48
- { name: "Currencylayer", description: "Reliable exchange rates for your business", category: "finance" },
49
- { name: "Coinlayer", description: "Real-time crypto currency exchange rates", category: "finance" },
50
- { name: "Exchangerate.host", description: "Free exchange rates API", category: "finance" },
51
- { name: "Weatherstack", description: "Real-time & historical weather data", category: "geolocation" },
52
- { name: "IPstack", description: "Locate and identify website visitors by IP", category: "geolocation" },
53
- { name: "IPapi", description: "IP address geolocation lookup", category: "geolocation" },
54
- { name: "Positionstack", description: "Forward & reverse geocoding", category: "geolocation" },
55
- { name: "Languagelayer", description: "Powerful language detection", category: "devtools" },
56
- { name: "Scrapestack", description: "Real-time web scraping", category: "scraping" },
57
- { name: "Serpstack", description: "Google search results API", category: "scraping" },
58
- { name: "Mediastack", description: "Live news & blog articles", category: "news" },
59
- { name: "Userstack", description: "Detect any browser, device & OS", category: "devtools" },
60
- ];
61
-
62
- for (const api of canonical) {
63
- await ctx.db.insert("providerAPIs", {
64
- providerId: provider._id,
65
- name: api.name,
66
- description: api.description,
67
- category: api.category,
68
- pricingModel: "freemium",
69
- pricingNotes: "Free tier available, paid tiers for higher limits",
70
- status: "approved",
71
- createdAt: Date.now(),
72
- approvedAt: Date.now(),
73
- discoveryCount: 0,
74
- });
75
- }
76
-
77
- return { success: true, deleted: existing.length, created: canonical.length };
78
- },
79
- });
80
-
81
- export const seedAll = mutation({
82
- args: {},
83
- handler: async (ctx) => {
84
- const email = "gustav_hemmingsson@hotmail.com";
85
-
86
- // 1. Create or get provider
87
- let provider = await ctx.db
88
- .query("providers")
89
- .withIndex("by_email", (q) => q.eq("email", email))
90
- .first();
91
-
92
- if (!provider) {
93
- const providerId = await ctx.db.insert("providers", {
94
- email,
95
- name: "APILayer",
96
- company: "APILayer",
97
- website: "https://apilayer.com",
98
- status: "approved",
99
- stripeOnboardingComplete: false,
100
- createdAt: Date.now(),
101
- updatedAt: Date.now(),
102
- approvedAt: Date.now(),
103
- });
104
- provider = await ctx.db.get(providerId);
105
- console.log("✓ Provider created");
106
- } else {
107
- console.log("✓ Provider exists:", provider.name);
108
- }
109
-
110
- if (!provider) throw new Error("Provider creation failed");
111
-
112
- // 2. Add all 27 APIs
113
- const apis = [
114
- // Unified APIs (14)
115
- { name: "ExchangeRate API", description: "Real-time exchange rates and currency conversion", category: "finance" },
116
- { name: "Marketstack", description: "Real-time, intraday & historical market data", category: "finance" },
117
- { name: "AviationStack", description: "Real-time flight status & global aviation data", category: "geolocation" },
118
- { name: "PDF Layer", description: "High quality HTML to PDF conversion", category: "business" },
119
- { name: "Screenshot Layer", description: "Capture website screenshots", category: "marketing" },
120
- { name: "Email Verification API", description: "Verify email addresses in real-time", category: "devtools" },
121
- { name: "Number Verification API", description: "Validate phone numbers globally", category: "devtools" },
122
- { name: "VAT Layer", description: "EU VAT number validation", category: "finance" },
123
- { name: "World News API", description: "Extract news from any URL", category: "news" },
124
- { name: "Finance News API", description: "Real-time financial news feed", category: "news" },
125
- { name: "Advanced Scraper API", description: "Web scraping without the hassle", category: "scraping" },
126
- { name: "Image Crop API", description: "Smart image cropping", category: "marketing" },
127
- { name: "Skills API", description: "Search skill database", category: "devtools" },
128
- { name: "Form API", description: "Form submission handling", category: "devtools" },
129
-
130
- // Legacy APIs (13)
131
- { name: "Fixer API", description: "Foreign exchange rates & currency conversion", category: "finance" },
132
- { name: "Currencylayer", description: "Reliable exchange rates for your business", category: "finance" },
133
- { name: "Coinlayer", description: "Real-time crypto currency exchange rates", category: "finance" },
134
- { name: "Exchangerate.host", description: "Free exchange rates API", category: "finance" },
135
- { name: "Weatherstack", description: "Real-time & historical weather data", category: "geolocation" },
136
- { name: "IPstack", description: "Locate and identify website visitors by IP", category: "geolocation" },
137
- { name: "IPapi", description: "IP address geolocation lookup", category: "geolocation" },
138
- { name: "Positionstack", description: "Forward & reverse geocoding", category: "geolocation" },
139
- { name: "Languagelayer", description: "Powerful language detection", category: "devtools" },
140
- { name: "Scrapestack", description: "Real-time web scraping", category: "scraping" },
141
- { name: "Serpstack", description: "Google search results API", category: "scraping" },
142
- { name: "Mediastack", description: "Live news & blog articles", category: "news" },
143
- { name: "Userstack", description: "Detect any browser, device & OS", category: "devtools" },
144
- ];
145
-
146
- let created = 0;
147
- let skipped = 0;
148
-
149
- for (const api of apis) {
150
- // Check if exists
151
- const existing = await ctx.db
152
- .query("providerAPIs")
153
- .withIndex("by_providerId", (q) => q.eq("providerId", provider!._id))
154
- .filter((q) => q.eq(q.field("name"), api.name))
155
- .first();
156
-
157
- if (!existing) {
158
- await ctx.db.insert("providerAPIs", {
159
- providerId: provider._id,
160
- name: api.name,
161
- description: api.description,
162
- category: api.category,
163
- pricingModel: "freemium",
164
- pricingNotes: "Free tier available, paid tiers for higher limits",
165
- status: "approved",
166
- createdAt: Date.now(),
167
- approvedAt: Date.now(),
168
- discoveryCount: 0,
169
- });
170
- console.log(`✓ ${api.name}`);
171
- created++;
172
- } else {
173
- skipped++;
174
- }
175
- }
176
-
177
- return {
178
- success: true,
179
- provider: {
180
- email: provider.email,
181
- name: provider.name,
182
- id: provider._id,
183
- },
184
- apis: {
185
- total: apis.length,
186
- created,
187
- skipped,
188
- },
189
- };
190
- },
191
- });