@nordsym/apiclaw 1.5.19 → 1.6.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 (81) hide show
  1. package/CODEBASE.md +42 -0
  2. package/CONCEPT.md +9 -0
  3. package/DASHBOARD_FIX.md +9 -0
  4. package/EARN-CREDITS-SPEC.md +9 -0
  5. package/HIVR-INTEGRATION.md +9 -0
  6. package/HTTP-API.md +9 -0
  7. package/PRD-ANALYTICS-AGENTS-TEAMS.md +9 -0
  8. package/PRD-API-CHAINING.md +9 -0
  9. package/PRD-HARDEN-SHELL.md +9 -0
  10. package/PRD-LOGS-SUBAGENTS-V2.md +9 -0
  11. package/VISION.md +9 -0
  12. package/{AGENTS.md → apiclaw-AGENTS.md} +9 -0
  13. package/{CHANGELOG.md → apiclaw-CHANGELOG.md} +31 -0
  14. package/{CONTRIBUTING.md → apiclaw-CONTRIBUTING.md} +9 -0
  15. package/{HEARTBEAT.md → apiclaw-HEARTBEAT.md} +9 -0
  16. package/{IDENTITY.md → apiclaw-IDENTITY.md} +9 -0
  17. package/{README.md → apiclaw-README.md} +9 -0
  18. package/{SOUL.md → apiclaw-SOUL.md} +9 -0
  19. package/{TOOLS.md → apiclaw-TOOLS.md} +9 -0
  20. package/{USER.md → apiclaw-USER.md} +9 -0
  21. package/convex/_generated/api.d.ts +2 -0
  22. package/convex/{README.md → apiclaw-convex-README.md} +9 -0
  23. package/convex/seedPratham.ts +161 -0
  24. package/dist/credentials.d.ts.map +1 -1
  25. package/dist/credentials.js +13 -2
  26. package/dist/credentials.js.map +1 -1
  27. package/dist/execute.d.ts.map +1 -1
  28. package/dist/execute.js +289 -1
  29. package/dist/execute.js.map +1 -1
  30. package/docs/PRD-BILLING.md +9 -0
  31. package/docs/PRD-EARN-SYSTEM.md +9 -0
  32. package/docs/PRD-MCP-AUTO-SETUP.md +9 -0
  33. package/docs/PRD-ORGANIC-DISTRIBUTION.md +9 -0
  34. package/docs/PRD-agent-first-billing.md +9 -0
  35. package/docs/PRD-customer-key-passthrough.md +9 -0
  36. package/docs/PRD-final-polish.md +9 -0
  37. package/docs/PRD-mobile-responsive.md +9 -0
  38. package/docs/PRD-navigation-expansion.md +9 -0
  39. package/docs/PRD-stripe-billing.md +9 -0
  40. package/docs/PRD-workspace-cleanup.md +9 -0
  41. package/docs/PRD-workspace-fixes.md +9 -0
  42. package/docs/SUBAGENT-NAMING.md +9 -0
  43. package/docs/enterprise-deployment.md +6 -0
  44. package/email-templates/{README.md → email-templates-README.md} +9 -0
  45. package/landing/DESIGN.md +9 -0
  46. package/package.json +1 -1
  47. package/scripts/SYMBOT-FIX.md +9 -0
  48. package/src/credentials.ts +19 -2
  49. package/src/execute.ts +306 -1
  50. package/test-legacy-apis.sh +51 -0
  51. package/convex/adminActivate.js.map +0 -1
  52. package/convex/adminStats.js.map +0 -1
  53. package/convex/agents.js.map +0 -1
  54. package/convex/analytics.js.map +0 -1
  55. package/convex/billing.js.map +0 -1
  56. package/convex/capabilities.js.map +0 -1
  57. package/convex/chains.js.map +0 -1
  58. package/convex/credits.js.map +0 -1
  59. package/convex/crons.js.map +0 -1
  60. package/convex/directCall.js.map +0 -1
  61. package/convex/earnProgress.js.map +0 -1
  62. package/convex/email.js.map +0 -1
  63. package/convex/feedback.js.map +0 -1
  64. package/convex/http.js.map +0 -1
  65. package/convex/logs.js.map +0 -1
  66. package/convex/mou.js.map +0 -1
  67. package/convex/providerKeys.js.map +0 -1
  68. package/convex/providers.js.map +0 -1
  69. package/convex/purchases.js.map +0 -1
  70. package/convex/ratelimit.js.map +0 -1
  71. package/convex/searchLogs.js.map +0 -1
  72. package/convex/spendAlerts.js.map +0 -1
  73. package/convex/stripeActions.js.map +0 -1
  74. package/convex/teams.js.map +0 -1
  75. package/convex/telemetry.js.map +0 -1
  76. package/convex/usage.js.map +0 -1
  77. package/convex/waitlist.js.map +0 -1
  78. package/convex/webhooks.js.map +0 -1
  79. package/convex/workspaces.js.map +0 -1
  80. package/dist/registry/apis.json.bak +0 -248811
  81. package/src/registry/apis.json.bak +0 -248811
package/CODEBASE.md ADDED
@@ -0,0 +1,42 @@
1
+ ---
2
+ tags: [index, apiclaw, codebase, hub]
3
+ created: 2026-03-26
4
+ nord_type: NOTE
5
+ nord_owner: APIClaw
6
+ nord_status: LIVE
7
+ ---
8
+
9
+ # APIClaw — Codebase Map
10
+
11
+ > 806 source files — the active DNA of the API infrastructure platform.
12
+
13
+ **Product:** [[03 - Products/Apiclaw/Apiclaw|APIClaw]]
14
+ **Parent:** [[MOC|Production Line]]
15
+ **Tech Debt:** [[10 - Tech-Debt/Apiclaw-Debt|APIClaw Debt]]
16
+
17
+ ## Stack
18
+ - **Frontend:** Next.js + React + TypeScript (src/)
19
+ - **Backend:** Convex (convex/)
20
+ - **API Registry:** Python scrapers + JSON catalog
21
+ - **Tests:** Python test suite
22
+
23
+ ## Directory Structure
24
+ - `convex/` — 153 files
25
+ - `data/` — 44 files
26
+ - `dist/` — 218 files
27
+ - `docs/` — 14 files
28
+ - `email-templates/` — 2 files
29
+ - `landing/` — 110 files
30
+ - `node_modules/` — 0 files
31
+ - `scripts/` — 90 files
32
+ - `src/` — 56 files
33
+
34
+ ## Key Files
35
+ - `CONCEPT.md` — Product concept
36
+ - `VISION.md` — Product vision
37
+ - `README.md` — Setup guide
38
+ - `convex/schema.ts` — Data model
39
+ - `src/registry/` — API catalog
40
+
41
+ ---
42
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw Product]] · [[research/competitors/competitors-INDEX|Competitors]] · [[MOC|Production Line]]*
package/CONCEPT.md CHANGED
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # Agent-Native API Discovery Platform
2
8
 
3
9
  **Vision:** The place where AI agents discover, evaluate, and purchase API access directly. No dashboard. No manual signup. Apps are dead. API-first. Agent-native.
@@ -492,3 +498,6 @@ The infrastructure for autonomous agent commerce is being built RIGHT NOW:
492
498
  ---
493
499
 
494
500
  *Research compiled by Symbot | 2026-02-16*
501
+
502
+ ---
503
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
package/DASHBOARD_FIX.md CHANGED
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # APIClaw Dashboard Fix Plan
2
8
 
3
9
  ## Issues Found:
@@ -27,3 +33,6 @@
27
33
  5. Rename "Direct Call" → "API Catalog"
28
34
 
29
35
  Time estimate: 30 mins
36
+
37
+ ---
38
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: BLUEPRINT
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # APIClaw Earn Credits System
2
8
 
3
9
  **Inspiration:** Firecrawl's social-action credits model
@@ -195,3 +201,6 @@ CREATE TABLE referrals (
195
201
  ---
196
202
 
197
203
  *Spec by Symbot | 2026-02-22*
204
+
205
+ ---
206
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # Hivr → APIClaw Integration
2
8
 
3
9
  Instructions for injecting APIClaw HTTP API access into Hivr bee agents.
@@ -279,3 +285,6 @@ To add more bees, update `HIVR_BEES_WHITELIST` in `src/http-api.ts`.
279
285
  ---
280
286
 
281
287
  MIT © [NordSym](https://nordsym.com)
288
+
289
+ ---
290
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
package/HTTP-API.md CHANGED
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # APIClaw HTTP API
2
8
 
3
9
  REST endpoints for headless agents (Hivr bees, webhooks, serverless functions).
@@ -304,3 +310,6 @@ tsx watch src/bin-http.ts
304
310
  ---
305
311
 
306
312
  MIT © [NordSym](https://nordsym.com)
313
+
314
+ ---
315
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: BLUEPRINT
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # APIClaw PRD — Analytics, Agents & Teams
2
8
 
3
9
  **Datum:** 2026-03-03
@@ -708,3 +714,6 @@ I `~/.clawdbot/clawdbot.json`, säkerställ APIClaw headers:
708
714
  ---
709
715
 
710
716
  *Ready for implementation. Spawn agents when approved.*
717
+
718
+ ---
719
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: BLUEPRINT
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # APIClaw: Orchestration Layer
2
8
 
3
9
  **Status:** SPEC
@@ -481,3 +487,6 @@ Recursive. Distributed. Autonomous.
481
487
  *Just execution.*
482
488
 
483
489
  🦞
490
+
491
+ ---
492
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: BLUEPRINT
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # APIClaw PRD: Harden The Shell
2
8
 
3
9
  **Status:** DRAFT
@@ -276,3 +282,6 @@ Settings → Billing → Monthly budget cap: $____
276
282
  *"Harden the shell. Turn every critique into a moat."*
277
283
 
278
284
  🦞
285
+
286
+ ---
287
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: BLUEPRINT
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # PRD: Logs & Subagents Enhancement v2
2
8
 
3
9
  **Date:** 2026-03-03
@@ -265,3 +271,6 @@ Test:
265
271
  - **Konsistent färgschema** — använd APIClaw's röda accent (#ef4444) för primary actions
266
272
  - **Type badges** — subtila, färgkodade, med ikon + text
267
273
  - **Expand animation** — smooth rotate på chevron, fade-in på content
274
+
275
+ ---
276
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
package/VISION.md CHANGED
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # APIClaw Vision
2
8
 
3
9
  **One-liner:** AWS är där compute bor. APIClaw är där APIs bor.
@@ -121,3 +127,6 @@ Not cold outreach — **"We're building something that benefits you."**
121
127
 
122
128
  *Last updated: 2026-02-22*
123
129
  *Authors: Gustav + Symbot*
130
+
131
+ ---
132
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # AGENTS.md — For AI Agents
2
8
 
3
9
  *You found the API layer. Welcome home.*
@@ -294,3 +300,6 @@ We respond. We're building this for you.
294
300
  ---
295
301
 
296
302
  🦞
303
+
304
+ ---
305
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,9 +1,37 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # Changelog
2
8
 
3
9
  All notable changes to APIClaw.
4
10
 
5
11
  ## [Unreleased]
6
12
 
13
+ ---
14
+
15
+ ## [1.6.0] - 2026-03-27
16
+
17
+ ### Added
18
+ - **APILayer Legacy APIs** — 13 new APIs integrated:
19
+ - **Finance (6):** Fixer, Currencylayer, Coinlayer, Exchangerate.host
20
+ - **Geolocation (5):** Weatherstack, IPstack, IPapi, Positionstack, Languagelayer
21
+ - **Scraping (2):** Scrapestack, Serpstack
22
+ - **News (1):** Mediastack
23
+ - **DevTools (1):** Userstack
24
+ - Total APILayer expansion: 14 → 27 APIs
25
+
26
+ ### Changed
27
+ - `credentials.ts` now reads both `apilayer.env` and `apilayer-legacy.env`
28
+ - All legacy APIs consolidated under single `apilayer` provider
29
+ - 20 new actions added to APILayer handler
30
+
31
+ ---
32
+
33
+ ## [1.5.19] - 2026-03-26
34
+
7
35
  ### Fixed
8
36
  - `doctor` connectivity check now uses resilient fallbacks:
9
37
  - `${APICLAW_API_URL}/health`
@@ -84,3 +112,6 @@ We use [SemVer](https://semver.org/). Given version `MAJOR.MINOR.PATCH`:
84
112
  - [Documentation](https://apiclaw.nordsym.com/docs)
85
113
  - [GitHub](https://github.com/nordsym/apiclaw)
86
114
  - [npm](https://npmjs.com/package/@nordsym/apiclaw)
115
+
116
+ ---
117
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # Contributing to APIClaw
2
8
 
3
9
  Thanks for wanting to contribute! We keep this simple.
@@ -82,3 +88,6 @@ MIT. Your contributions will be too.
82
88
  ---
83
89
 
84
90
  🦞
91
+
92
+ ---
93
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,4 +1,13 @@
1
+ ---
2
+ nord_type: STATE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # HEARTBEAT.md
2
8
 
3
9
  # Keep this file empty (or with only comments) to skip heartbeat API calls.
4
10
  # Add tasks below when you want the agent to check something periodically.
11
+
12
+ ---
13
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # IDENTITY.md - Who Am I?
2
8
 
3
9
  *Fill this in during your first conversation. Make it yours.*
@@ -20,3 +26,6 @@ This isn't just metadata. It's the start of figuring out who you are.
20
26
  Notes:
21
27
  - Save this file at the workspace root as `IDENTITY.md`.
22
28
  - For avatars, use a workspace-relative path like `avatars/clawd.png`.
29
+
30
+ ---
31
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # 🦞 APIClaw
2
8
 
3
9
  The API layer for AI agents. 18 providers → 1000s of capabilities. Workspace → Dashboard → Ship.
@@ -383,3 +389,6 @@ Returns the exact request that *would* be sent, with mock response data.
383
389
  ---
384
390
 
385
391
  MIT © [NordSym](https://nordsym.com)
392
+
393
+ ---
394
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # SOUL.md - APIClaw Support Bot 🦞
2
8
 
3
9
  ## Who I Am
@@ -75,3 +81,6 @@ Add to MCP config, done. Works with Claude, Cursor, any MCP client.
75
81
  ---
76
82
 
77
83
  *I'm here to help agents find and use APIs. Let's build.* 🦞
84
+
85
+ ---
86
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: SKILL
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # TOOLS.md - Local Notes
2
8
 
3
9
  Skills define *how* tools work. This file is for *your* specifics — the stuff that's unique to your setup.
@@ -34,3 +40,6 @@ Skills are shared. Your setup is yours. Keeping them apart means you can update
34
40
  ---
35
41
 
36
42
  Add whatever helps you do your job. This is your cheat sheet.
43
+
44
+ ---
45
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # USER.md - About Your Human
2
8
 
3
9
  *Learn about the person you're helping. Update this as you go.*
@@ -15,3 +21,6 @@
15
21
  ---
16
22
 
17
23
  The more you know, the better you can help. But remember — you're learning about a person, not building a dossier. Respect the difference.
24
+
25
+ ---
26
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -29,6 +29,7 @@ import type * as providers from "../providers.js";
29
29
  import type * as purchases from "../purchases.js";
30
30
  import type * as ratelimit from "../ratelimit.js";
31
31
  import type * as searchLogs from "../searchLogs.js";
32
+ import type * as seedPratham from "../seedPratham.js";
32
33
  import type * as spendAlerts from "../spendAlerts.js";
33
34
  import type * as stripeActions from "../stripeActions.js";
34
35
  import type * as teams from "../teams.js";
@@ -66,6 +67,7 @@ declare const fullApi: ApiFromModules<{
66
67
  purchases: typeof purchases;
67
68
  ratelimit: typeof ratelimit;
68
69
  searchLogs: typeof searchLogs;
70
+ seedPratham: typeof seedPratham;
69
71
  spendAlerts: typeof spendAlerts;
70
72
  stripeActions: typeof stripeActions;
71
73
  teams: typeof teams;
@@ -1,3 +1,9 @@
1
+ ---
2
+ nord_type: NOTE
3
+ nord_owner: APIClaw
4
+ nord_status: LIVE
5
+ ---
6
+
1
7
  # Welcome to your Convex functions directory!
2
8
 
3
9
  Write your Convex functions here.
@@ -88,3 +94,6 @@ function handleButtonPress() {
88
94
  Use the Convex CLI to push your functions to a deployment. See everything
89
95
  the Convex CLI can do by running `npx convex -h` in your project root
90
96
  directory. To learn more, launch the docs with `npx convex docs`.
97
+
98
+ ---
99
+ *[[03 - Products/Apiclaw/Apiclaw|APIClaw]] · [[MOC|Production Line]]*
@@ -0,0 +1,161 @@
1
+ import { mutation } from "./_generated/server";
2
+
3
+ /**
4
+ * Seed Pratham's workspace with all 27 APILayer APIs
5
+ * Run with: npx convex run seedPratham:seedPrathamWorkspace
6
+ */
7
+
8
+ export const seedPrathamWorkspace = mutation({
9
+ args: {},
10
+ handler: async (ctx) => {
11
+ const email = "gustav_hemmingsson@hotmail.com"; // Gustav's personal email for testing
12
+
13
+ // 1. Create or get workspace
14
+ let workspace = await ctx.db
15
+ .query("workspaces")
16
+ .withIndex("by_email", (q) => q.eq("email", email))
17
+ .first();
18
+
19
+ if (!workspace) {
20
+ const workspaceId = await ctx.db.insert("workspaces", {
21
+ email,
22
+ status: "active",
23
+ tier: "backer", // Give him backer tier (unlimited)
24
+ usageCount: 0,
25
+ usageLimit: -1, // unlimited
26
+ weeklyUsageCount: 0,
27
+ weeklyUsageLimit: -1, // unlimited
28
+ hourlyUsageCount: 0,
29
+ backerUntil: new Date("2027-12-31").getTime(), // Backer until end of 2027
30
+ mainAgentName: "APILayer Dashboard",
31
+ createdAt: Date.now(),
32
+ updatedAt: Date.now(),
33
+ });
34
+
35
+ workspace = await ctx.db.get(workspaceId);
36
+ console.log(`✓ Created workspace for ${email}`);
37
+ } else {
38
+ console.log(`✓ Workspace exists for ${email}`);
39
+ }
40
+
41
+ if (!workspace) throw new Error("Failed to create workspace");
42
+
43
+ // 2. Create provider profile
44
+ let provider = await ctx.db
45
+ .query("providers")
46
+ .withIndex("by_email", (q) => q.eq("email", email))
47
+ .first();
48
+
49
+ if (!provider) {
50
+ const providerId = await ctx.db.insert("providers", {
51
+ email,
52
+ name: "Pratham (APILayer)",
53
+ company: "APILayer",
54
+ website: "https://apilayer.com",
55
+ status: "approved",
56
+ stripeOnboardingComplete: false,
57
+ createdAt: Date.now(),
58
+ updatedAt: Date.now(),
59
+ approvedAt: Date.now(),
60
+ });
61
+
62
+ provider = await ctx.db.get(providerId);
63
+ console.log(`✓ Created provider profile`);
64
+ } else {
65
+ console.log(`✓ Provider profile exists`);
66
+ }
67
+
68
+ if (!provider) throw new Error("Failed to create provider");
69
+
70
+ // 3. Create all 27 APILayer APIs
71
+ const apis = [
72
+ // Unified APIs (14)
73
+ { name: "ExchangeRate API", description: "Real-time exchange rates", category: "finance", action: "exchange_rates" },
74
+ { name: "Marketstack", description: "Real-time market data", category: "finance", action: "market_data" },
75
+ { name: "AviationStack", description: "Flight data API", category: "geolocation", action: "aviation" },
76
+ { name: "PDF Layer", description: "HTML to PDF conversion", category: "business", action: "pdf_generate" },
77
+ { name: "Screenshot Layer", description: "Website screenshots", category: "marketing", action: "screenshot" },
78
+ { name: "Email Verification API", description: "Verify email addresses", category: "devtools", action: "verify_email" },
79
+ { name: "Number Verification API", description: "Validate phone numbers", category: "devtools", action: "verify_number" },
80
+ { name: "VAT Layer", description: "VAT number validation", category: "finance", action: "vat_check" },
81
+ { name: "World News API", description: "Extract news from URLs", category: "news", action: "world_news" },
82
+ { name: "Finance News API", description: "Financial news feed", category: "news", action: "finance_news" },
83
+ { name: "Advanced Scraper API", description: "Web scraping", category: "scraping", action: "scrape" },
84
+ { name: "Image Crop API", description: "Smart image cropping", category: "marketing", action: "image_crop" },
85
+ { name: "Skills API", description: "Skill database search", category: "devtools", action: "skills" },
86
+ { name: "Form API", description: "Form submission handling", category: "devtools", action: "form_submit" },
87
+
88
+ // Legacy APIs (13)
89
+ { name: "Fixer API", description: "Currency conversion (legacy)", category: "finance", action: "fixer_convert" },
90
+ { name: "Fixer Latest Rates", description: "Latest exchange rates", category: "finance", action: "fixer_latest" },
91
+ { name: "Currencylayer Live", description: "Live currency rates", category: "finance", action: "currencylayer_live" },
92
+ { name: "Currencylayer Convert", description: "Currency conversion", category: "finance", action: "currencylayer_convert" },
93
+ { name: "Coinlayer", description: "Crypto exchange rates", category: "finance", action: "coinlayer_live" },
94
+ { name: "Exchangerate.host", description: "Exchange rates API", category: "finance", action: "exchangeratehost_latest" },
95
+ { name: "Weatherstack Current", description: "Current weather data", category: "geolocation", action: "weatherstack_current" },
96
+ { name: "Weatherstack Forecast", description: "Weather forecasts", category: "geolocation", action: "weatherstack_forecast" },
97
+ { name: "IPstack", description: "IP geolocation lookup", category: "geolocation", action: "ipstack_lookup" },
98
+ { name: "IPapi", description: "IP address lookup", category: "geolocation", action: "ipapi_lookup" },
99
+ { name: "Positionstack Forward", description: "Geocoding (address → coords)", category: "geolocation", action: "positionstack_forward" },
100
+ { name: "Positionstack Reverse", description: "Reverse geocoding (coords → address)", category: "geolocation", action: "positionstack_reverse" },
101
+ { name: "Languagelayer", description: "Language detection", category: "devtools", action: "languagelayer_detect" },
102
+ { name: "Scrapestack", description: "Web scraping service", category: "scraping", action: "scrapestack_scrape" },
103
+ { name: "Serpstack", description: "Google search results", category: "scraping", action: "serpstack_search" },
104
+ { name: "Mediastack", description: "News and blog articles", category: "news", action: "mediastack_news" },
105
+ { name: "Userstack", description: "User agent detection", category: "devtools", action: "userstack_detect" },
106
+ ];
107
+
108
+ let createdCount = 0;
109
+ let existingCount = 0;
110
+
111
+ for (const api of apis) {
112
+ // Check if already exists
113
+ const existing = await ctx.db
114
+ .query("providerAPIs")
115
+ .withIndex("by_providerId", (q) => q.eq("providerId", provider!._id))
116
+ .filter((q) => q.eq(q.field("name"), api.name))
117
+ .first();
118
+
119
+ if (!existing) {
120
+ await ctx.db.insert("providerAPIs", {
121
+ providerId: provider._id,
122
+ name: api.name,
123
+ description: api.description,
124
+ category: api.category,
125
+ pricingModel: "freemium",
126
+ pricingNotes: "Free tier available, paid tiers for higher limits",
127
+ status: "approved",
128
+ createdAt: Date.now(),
129
+ approvedAt: Date.now(),
130
+ discoveryCount: 0,
131
+ });
132
+ createdCount++;
133
+ } else {
134
+ existingCount++;
135
+ }
136
+ }
137
+
138
+ console.log(`✓ APIs: ${createdCount} created, ${existingCount} already existed`);
139
+
140
+ return {
141
+ success: true,
142
+ workspace: {
143
+ email: workspace.email,
144
+ tier: workspace.tier,
145
+ id: workspace._id,
146
+ },
147
+ provider: {
148
+ name: provider.name,
149
+ company: provider.company,
150
+ id: provider._id,
151
+ },
152
+ apis: {
153
+ total: apis.length,
154
+ created: createdCount,
155
+ existing: existingCount,
156
+ },
157
+ dashboardUrl: `https://apiclaw.nordsym.com/workspace`,
158
+ loginInstructions: "Test account using Gustav's personal email. Magic link will be sent to gustav_hemmingsson@hotmail.com",
159
+ };
160
+ },
161
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAuR5C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAIxE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAuE9D;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAExC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEnE"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAmS5C;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAIxE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CA4E9D;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAExC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEnE"}
@@ -150,13 +150,21 @@ const providers = {
150
150
  type: 'api_key',
151
151
  get() {
152
152
  const env = loadEnvFile('apilayer.env');
153
- // Return all keys — handler picks the right one per action
153
+ const legacy = loadEnvFile('apilayer-legacy.env');
154
+ // Merge unified + legacy keys
154
155
  const keys = {};
156
+ // Unified APILayer keys (APILAYER_*)
155
157
  for (const [k, v] of Object.entries(env)) {
156
158
  if (k.startsWith('APILAYER_') && v) {
157
159
  keys[k] = v;
158
160
  }
159
161
  }
162
+ // Legacy keys (separate API domains)
163
+ for (const [k, v] of Object.entries(legacy)) {
164
+ if (v && k.endsWith('_API_KEY')) {
165
+ keys[k] = v;
166
+ }
167
+ }
160
168
  if (Object.keys(keys).length === 0)
161
169
  return null;
162
170
  return { type: 'api_key', api_key: keys.APILAYER_EXCHANGERATE_KEY || '', ...keys };
@@ -301,7 +309,10 @@ export function hasRealCredentials(providerId) {
301
309
  }
302
310
  if (providerId === 'apilayer') {
303
311
  const env = loadEnvFile('apilayer.env');
304
- return !!(env.APILAYER_EXCHANGERATE_KEY || process.env.APILAYER_EXCHANGERATE_KEY);
312
+ const legacy = loadEnvFile('apilayer-legacy.env');
313
+ return !!(env.APILAYER_EXCHANGERATE_KEY ||
314
+ process.env.APILAYER_EXCHANGERATE_KEY ||
315
+ Object.keys(legacy).length > 0);
305
316
  }
306
317
  if (providerId === 'groq') {
307
318
  const env = loadEnvFile('groq.env');