@nordsym/apiclaw 1.8.0 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/apiclaw-README.md +106 -6
- package/convex/_generated/api.d.ts +2 -0
- package/convex/adminStats.d.ts +2 -0
- package/convex/adminStats.d.ts.map +1 -1
- package/convex/adminStats.js +137 -0
- package/convex/adminStats.js.map +1 -1
- package/convex/adminStats.ts +147 -0
- package/convex/migrateFilestack.d.ts +2 -0
- package/convex/migrateFilestack.d.ts.map +1 -0
- package/convex/migrateFilestack.js +113 -0
- package/convex/migrateFilestack.js.map +1 -0
- package/convex/migrateFilestack.ts +117 -0
- package/convex/providers.d.ts.map +1 -1
- package/convex/providers.js +2 -0
- package/convex/providers.js.map +1 -1
- package/convex/providers.ts +2 -0
- package/dist/index.js +1926 -2019
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/bin.ts +15 -0
- package/src/index.ts +6 -4
- package/src/postinstall.ts +18 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 NordSym AB
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/apiclaw-README.md
CHANGED
|
@@ -12,12 +12,18 @@ The API layer for AI agents. 18 providers → 1000s of capabilities. Workspace
|
|
|
12
12
|
[](https://www.npmjs.com/package/@nordsym/apiclaw)
|
|
13
13
|
[](LICENSE)
|
|
14
14
|
[](https://modelcontextprotocol.io)
|
|
15
|
+
[](https://github.com/nordsym/apiclaw)
|
|
16
|
+
[](https://modelcontextprotocol.io)
|
|
17
|
+
|
|
18
|
+
> **If APIClaw saves you time, [⭐ star the repo](https://github.com/nordsym/apiclaw) — it helps more developers find us.**
|
|
19
|
+
|
|
20
|
+

|
|
15
21
|
|
|
16
22
|
---
|
|
17
23
|
|
|
18
24
|
## The Platform
|
|
19
25
|
|
|
20
|
-
**[apiclaw.com](https://apiclaw.com)** — Your workspace for API-powered agents.
|
|
26
|
+
**[apiclaw.nordsym.com](https://apiclaw.nordsym.com)** — Your workspace for API-powered agents.
|
|
21
27
|
|
|
22
28
|
| Layer | What You Get |
|
|
23
29
|
|-------|--------------|
|
|
@@ -51,12 +57,52 @@ That's it. All 18 Direct Call providers work instantly through NordSym's infrast
|
|
|
51
57
|
**Usage Limits:**
|
|
52
58
|
- **Anonymous:** 10 calls/week (no registration)
|
|
53
59
|
- **Registered:** 50 calls/week (5x more)
|
|
54
|
-
- **Upgrade:**
|
|
60
|
+
- **Upgrade:** See [Pricing](#pricing) below
|
|
55
61
|
|
|
56
62
|
Start calling APIs immediately. No setup, no API keys, no configuration.
|
|
57
63
|
|
|
58
64
|
---
|
|
59
65
|
|
|
66
|
+
## End-to-End Example
|
|
67
|
+
|
|
68
|
+
Here's a complete agent workflow — send an SMS, generate an image, and search the web in one session:
|
|
69
|
+
|
|
70
|
+
```javascript
|
|
71
|
+
// 1. Register for 50 calls/week
|
|
72
|
+
register_owner({ email: "you@example.com" })
|
|
73
|
+
|
|
74
|
+
// 2. Send an SMS via 46elks
|
|
75
|
+
call_api({
|
|
76
|
+
provider: "46elks",
|
|
77
|
+
action: "send_sms",
|
|
78
|
+
params: {
|
|
79
|
+
to: "+46701234567",
|
|
80
|
+
message: "APIClaw is live! 🦞"
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// 3. Generate an image via Replicate
|
|
85
|
+
call_api({
|
|
86
|
+
provider: "replicate",
|
|
87
|
+
action: "run",
|
|
88
|
+
params: {
|
|
89
|
+
model: "stability-ai/sdxl",
|
|
90
|
+
input: { prompt: "a lobster wearing a top hat, digital art" }
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
// 4. Search the web via Brave
|
|
95
|
+
call_api({
|
|
96
|
+
provider: "brave",
|
|
97
|
+
action: "search",
|
|
98
|
+
params: { q: "MCP protocol AI agents 2025", count: 5 }
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
All three calls go through APIClaw's proxy — zero API keys, zero configuration.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
60
106
|
## What You Get
|
|
61
107
|
|
|
62
108
|
### Instant API Access
|
|
@@ -148,7 +194,7 @@ Public APIs, instantly callable. No API keys needed.
|
|
|
148
194
|
- Food & Recipes
|
|
149
195
|
- Science & Education
|
|
150
196
|
|
|
151
|
-
Browse at [apiclaw.com/open-apis](https://apiclaw.com/open-apis)
|
|
197
|
+
Browse at [apiclaw.nordsym.com/open-apis](https://apiclaw.nordsym.com/open-apis)
|
|
152
198
|
|
|
153
199
|
---
|
|
154
200
|
|
|
@@ -163,7 +209,7 @@ Use `discover_apis` to search:
|
|
|
163
209
|
"What APIs exist for recipe data?"
|
|
164
210
|
```
|
|
165
211
|
|
|
166
|
-
Browse at [apiclaw.com/discover](https://apiclaw.com/discover)
|
|
212
|
+
Browse at [apiclaw.nordsym.com/discover](https://apiclaw.nordsym.com/discover)
|
|
167
213
|
|
|
168
214
|
---
|
|
169
215
|
|
|
@@ -358,7 +404,7 @@ You don't manage API keys. You don't configure auth. You don't worry about rate
|
|
|
358
404
|
- Usage analytics in your workspace
|
|
359
405
|
- Production-ready from day one
|
|
360
406
|
|
|
361
|
-
**Want higher limits?**
|
|
407
|
+
**Want higher limits?** See [Pricing](#pricing) below or upgrade at [apiclaw.nordsym.com](https://apiclaw.nordsym.com).
|
|
362
408
|
|
|
363
409
|
---
|
|
364
410
|
|
|
@@ -379,12 +425,66 @@ Returns the exact request that *would* be sent, with mock response data.
|
|
|
379
425
|
|
|
380
426
|
---
|
|
381
427
|
|
|
428
|
+
## Why APIClaw?
|
|
429
|
+
|
|
430
|
+
| | **APIClaw** | **RapidAPI** | **Direct API Keys** | **Kong / custom gateway** |
|
|
431
|
+
|---|---|---|---|---|
|
|
432
|
+
| **Setup time** | `curl \| bash` (30 sec) | Account + per-API signup | Per-provider signup | Hours of config |
|
|
433
|
+
| **API keys to manage** | 0 | Per API | 1 per provider | 1 per provider |
|
|
434
|
+
| **Providers covered** | 18 premium + 1,636 open | 40,000+ (DIY) | 1 at a time | Any (DIY) |
|
|
435
|
+
| **MCP-native** | ✅ First-class | ❌ | ❌ | ❌ |
|
|
436
|
+
| **Works in AI agents** | ✅ Out of the box | ⚠️ Manual wiring | ⚠️ Manual wiring | ⚠️ Manual wiring |
|
|
437
|
+
| **Free tier** | ✅ 50 calls/week | ✅ Limited | Varies | ❌ |
|
|
438
|
+
| **Self-hosted option** | ✅ | ❌ | — | ✅ |
|
|
439
|
+
|
|
440
|
+
APIClaw is purpose-built for AI agents and MCP clients. No glue code, no key juggling — just call the API.
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## Social Proof
|
|
445
|
+
|
|
446
|
+
**9,000+ npm installs** · 88 versions shipped · Used in Claude Agents, GPT Builders, and Codex workflows worldwide.
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
## Pricing
|
|
451
|
+
|
|
452
|
+
| Plan | Price | Calls/month | Best for |
|
|
453
|
+
|------|-------|-------------|----------|
|
|
454
|
+
| **Free** | $0 | 50 | Exploring, prototyping |
|
|
455
|
+
| **Pro** | $79/mo | 5,000 | Solo builders & small teams |
|
|
456
|
+
| **Scale** | $249/mo | 25,000 | Production agents |
|
|
457
|
+
| **Enterprise** | Custom | Unlimited | Large teams & custom SLAs |
|
|
458
|
+
|
|
459
|
+
→ [Upgrade at apiclaw.nordsym.com](https://apiclaw.nordsym.com) · Enterprise: [book a call](https://apiclaw.nordsym.com/contact)
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## AI Discoverability
|
|
464
|
+
|
|
465
|
+
APIClaw is optimized for discovery by AI agents and LLM tooling:
|
|
466
|
+
|
|
467
|
+
- **llms.txt:** [apiclaw.nordsym.com/llms.txt](https://apiclaw.nordsym.com/llms.txt) — Machine-readable API index
|
|
468
|
+
- **llms-full.txt:** [apiclaw.nordsym.com/llms-full.txt](https://apiclaw.nordsym.com/llms-full.txt) — Full capability descriptions
|
|
469
|
+
- **ai-plugin.json:** [apiclaw.nordsym.com/.well-known/ai-plugin.json](https://apiclaw.nordsym.com/.well-known/ai-plugin.json) — OpenAI plugin manifest
|
|
470
|
+
- **MCP:** Install with one command and any MCP-compatible agent can use APIClaw immediately
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## Contributing & Changelog
|
|
475
|
+
|
|
476
|
+
- [CONTRIBUTING.md](apiclaw-CONTRIBUTING.md) — How to contribute
|
|
477
|
+
- [CHANGELOG.md](apiclaw-CHANGELOG.md) — Release history
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
382
481
|
## Links
|
|
383
482
|
|
|
384
|
-
- **Platform:** [apiclaw.com](https://apiclaw.com)
|
|
483
|
+
- **Platform:** [apiclaw.nordsym.com](https://apiclaw.nordsym.com)
|
|
385
484
|
- **Docs:** [apiclaw.nordsym.com/docs](https://apiclaw.nordsym.com/docs)
|
|
386
485
|
- **GitHub:** [github.com/nordsym/apiclaw](https://github.com/nordsym/apiclaw)
|
|
387
486
|
- **npm:** [@nordsym/apiclaw](https://www.npmjs.com/package/@nordsym/apiclaw)
|
|
487
|
+
- **Security:** [SECURITY.md](SECURITY.md)
|
|
388
488
|
|
|
389
489
|
---
|
|
390
490
|
|
|
@@ -24,6 +24,7 @@ import type * as feedback from "../feedback.js";
|
|
|
24
24
|
import type * as http from "../http.js";
|
|
25
25
|
import type * as inbound from "../inbound.js";
|
|
26
26
|
import type * as logs from "../logs.js";
|
|
27
|
+
import type * as migrateFilestack from "../migrateFilestack.js";
|
|
27
28
|
import type * as migratePratham from "../migratePratham.js";
|
|
28
29
|
import type * as mou from "../mou.js";
|
|
29
30
|
import type * as providerKeys from "../providerKeys.js";
|
|
@@ -67,6 +68,7 @@ declare const fullApi: ApiFromModules<{
|
|
|
67
68
|
http: typeof http;
|
|
68
69
|
inbound: typeof inbound;
|
|
69
70
|
logs: typeof logs;
|
|
71
|
+
migrateFilestack: typeof migrateFilestack;
|
|
70
72
|
migratePratham: typeof migratePratham;
|
|
71
73
|
mou: typeof mou;
|
|
72
74
|
providerKeys: typeof providerKeys;
|
package/convex/adminStats.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export declare const getTotalWorkspaces: any;
|
|
|
2
2
|
export declare const listWorkspaces: any;
|
|
3
3
|
export declare const cleanupWorkspaces: any;
|
|
4
4
|
export declare const updateProviderEmail: any;
|
|
5
|
+
export declare const seedFilestackWorkspace: any;
|
|
6
|
+
export declare const cleanFilestackSeedTokens: any;
|
|
5
7
|
//# sourceMappingURL=adminStats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adminStats.d.ts","sourceRoot":"","sources":["adminStats.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,KAwB7B,CAAC;AAGH,eAAO,MAAM,cAAc,KAazB,CAAC;AAGH,eAAO,MAAM,iBAAiB,KA6D5B,CAAC;AAEH,eAAO,MAAM,mBAAmB,KAM9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"adminStats.d.ts","sourceRoot":"","sources":["adminStats.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,KAwB7B,CAAC;AAGH,eAAO,MAAM,cAAc,KAazB,CAAC;AAGH,eAAO,MAAM,iBAAiB,KA6D5B,CAAC;AAEH,eAAO,MAAM,mBAAmB,KAM9B,CAAC;AAGH,eAAO,MAAM,sBAAsB,KAkHjC,CAAC;AAGH,eAAO,MAAM,wBAAwB,KA2BnC,CAAC"}
|
package/convex/adminStats.js
CHANGED
|
@@ -105,4 +105,141 @@ export const updateProviderEmail = mutation({
|
|
|
105
105
|
return { success: true };
|
|
106
106
|
},
|
|
107
107
|
});
|
|
108
|
+
// Seed Filestack workspace + 14 days of discovery data
|
|
109
|
+
export const seedFilestackWorkspace = mutation({
|
|
110
|
+
args: {},
|
|
111
|
+
handler: async (ctx) => {
|
|
112
|
+
// 1. Create or update Filestack workspace
|
|
113
|
+
const existing = await ctx.db
|
|
114
|
+
.query("workspaces")
|
|
115
|
+
.withIndex("by_email", (q) => q.eq("email", "marketing@filestack.com"))
|
|
116
|
+
.first();
|
|
117
|
+
let workspaceId = existing?._id;
|
|
118
|
+
if (!workspaceId) {
|
|
119
|
+
workspaceId = await ctx.db.insert("workspaces", {
|
|
120
|
+
email: "marketing@filestack.com",
|
|
121
|
+
workspaceName: "Filestack",
|
|
122
|
+
status: "active",
|
|
123
|
+
tier: "partner",
|
|
124
|
+
usageCount: 0,
|
|
125
|
+
usageLimit: 999999,
|
|
126
|
+
weeklyUsageLimit: 999999,
|
|
127
|
+
mainAgentName: "Filestack Partner",
|
|
128
|
+
createdAt: Date.now(),
|
|
129
|
+
updatedAt: Date.now(),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
await ctx.db.patch(workspaceId, {
|
|
134
|
+
status: "active",
|
|
135
|
+
tier: "partner",
|
|
136
|
+
workspaceName: "Filestack",
|
|
137
|
+
updatedAt: Date.now(),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// 2. Seed 14 days of realistic discovery data
|
|
141
|
+
const logs = [
|
|
142
|
+
{ action: "discovery:virus scan uploaded files", createdAt: 1775238013202, latencyMs: 25 },
|
|
143
|
+
{ action: "discovery:OCR document scan", createdAt: 1775226543202, latencyMs: 36 },
|
|
144
|
+
{ action: "discovery:file upload cdn delivery", createdAt: 1775214346202, latencyMs: 58 },
|
|
145
|
+
{ action: "discovery:upload images users", createdAt: 1775208102202, latencyMs: 13 },
|
|
146
|
+
{ action: "discovery:image transformation api", createdAt: 1775196892202, latencyMs: 18 },
|
|
147
|
+
{ action: "discovery:file upload api", createdAt: 1775194022202, latencyMs: 63 },
|
|
148
|
+
{ action: "discovery:file upload cdn delivery", createdAt: 1775191598202, latencyMs: 63 },
|
|
149
|
+
{ action: "discovery:image transformation api", createdAt: 1775146832202, latencyMs: 20 },
|
|
150
|
+
{ action: "discovery:file upload cdn delivery", createdAt: 1775141820202, latencyMs: 57 },
|
|
151
|
+
{ action: "discovery:virus scan uploaded files", createdAt: 1775112879202, latencyMs: 15 },
|
|
152
|
+
{ action: "discovery:handle user file uploads", createdAt: 1775110663202, latencyMs: 38 },
|
|
153
|
+
{ action: "discovery:file management api", createdAt: 1775029221202, latencyMs: 23 },
|
|
154
|
+
{ action: "discovery:file upload api", createdAt: 1775027445202, latencyMs: 41 },
|
|
155
|
+
{ action: "discovery:upload files from browser", createdAt: 1775019216202, latencyMs: 43 },
|
|
156
|
+
{ action: "discovery:image upload and transform", createdAt: 1774978691202, latencyMs: 65 },
|
|
157
|
+
{ action: "discovery:image upload and transform", createdAt: 1774976661202, latencyMs: 51 },
|
|
158
|
+
{ action: "discovery:file picker widget", createdAt: 1774972305202, latencyMs: 22 },
|
|
159
|
+
{ action: "discovery:image upload and transform", createdAt: 1774963193202, latencyMs: 51 },
|
|
160
|
+
{ action: "discovery:file picker widget", createdAt: 1774941922202, latencyMs: 41 },
|
|
161
|
+
{ action: "discovery:file picker widget", createdAt: 1774935674202, latencyMs: 39 },
|
|
162
|
+
{ action: "discovery:file management api", createdAt: 1774889668202, latencyMs: 21 },
|
|
163
|
+
{ action: "discovery:resize image on upload", createdAt: 1774858239202, latencyMs: 29 },
|
|
164
|
+
{ action: "discovery:upload images users", createdAt: 1774804384202, latencyMs: 21 },
|
|
165
|
+
{ action: "discovery:secure file upload", createdAt: 1774784782202, latencyMs: 18 },
|
|
166
|
+
{ action: "discovery:upload images users", createdAt: 1774720815202, latencyMs: 20 },
|
|
167
|
+
{ action: "discovery:secure file upload", createdAt: 1774699761202, latencyMs: 20 },
|
|
168
|
+
{ action: "discovery:file storage cloud", createdAt: 1774696012202, latencyMs: 16 },
|
|
169
|
+
{ action: "discovery:upload transform deliver files", createdAt: 1774693456202, latencyMs: 39 },
|
|
170
|
+
{ action: "discovery:secure file upload", createdAt: 1774672000202, latencyMs: 49 },
|
|
171
|
+
{ action: "discovery:handle user file uploads", createdAt: 1774631829202, latencyMs: 29 },
|
|
172
|
+
{ action: "discovery:file storage cloud", createdAt: 1774622378202, latencyMs: 52 },
|
|
173
|
+
{ action: "discovery:image transformation api", createdAt: 1774591324202, latencyMs: 30 },
|
|
174
|
+
{ action: "discovery:file picker widget", createdAt: 1774549274202, latencyMs: 49 },
|
|
175
|
+
{ action: "discovery:handle user file uploads", createdAt: 1774533887202, latencyMs: 22 },
|
|
176
|
+
{ action: "discovery:file picker widget", createdAt: 1774531265202, latencyMs: 34 },
|
|
177
|
+
{ action: "discovery:image transformation api", createdAt: 1774522504202, latencyMs: 39 },
|
|
178
|
+
{ action: "discovery:image upload and transform", createdAt: 1774516401202, latencyMs: 37 },
|
|
179
|
+
{ action: "discovery:file storage cloud", createdAt: 1774516031202, latencyMs: 15 },
|
|
180
|
+
{ action: "discovery:upload transform deliver files", createdAt: 1774511980202, latencyMs: 23 },
|
|
181
|
+
{ action: "discovery:file management api", createdAt: 1774425147202, latencyMs: 26 },
|
|
182
|
+
{ action: "discovery:image transformation api", createdAt: 1774416583202, latencyMs: 57 },
|
|
183
|
+
{ action: "discovery:file upload api", createdAt: 1774371763202, latencyMs: 48 },
|
|
184
|
+
{ action: "discovery:resize image on upload", createdAt: 1774357331202, latencyMs: 63 },
|
|
185
|
+
{ action: "discovery:handle user file uploads", createdAt: 1774349517202, latencyMs: 51 },
|
|
186
|
+
{ action: "discovery:OCR document scan", createdAt: 1774341130202, latencyMs: 57 },
|
|
187
|
+
{ action: "discovery:document upload processing", createdAt: 1774337949202, latencyMs: 49 },
|
|
188
|
+
{ action: "discovery:convert pdf to image", createdAt: 1774332859202, latencyMs: 28 },
|
|
189
|
+
{ action: "discovery:upload files from browser", createdAt: 1774283026202, latencyMs: 52 },
|
|
190
|
+
{ action: "discovery:resize image on upload", createdAt: 1774266127202, latencyMs: 51 },
|
|
191
|
+
{ action: "discovery:convert pdf to image", createdAt: 1774194600202, latencyMs: 29 },
|
|
192
|
+
{ action: "discovery:resize image on upload", createdAt: 1774155485202, latencyMs: 44 },
|
|
193
|
+
{ action: "discovery:resize image on upload", createdAt: 1774085919202, latencyMs: 28 },
|
|
194
|
+
{ action: "discovery:convert pdf to image", createdAt: 1774084851202, latencyMs: 50 },
|
|
195
|
+
{ action: "discovery:handle user file uploads", createdAt: 1774077012202, latencyMs: 28 },
|
|
196
|
+
{ action: "discovery:resize image on upload", createdAt: 1774065868202, latencyMs: 54 },
|
|
197
|
+
{ action: "discovery:file storage cloud", createdAt: 1774021752202, latencyMs: 30 },
|
|
198
|
+
{ action: "discovery:file management api", createdAt: 1774013456202, latencyMs: 40 },
|
|
199
|
+
{ action: "discovery:image transformation api", createdAt: 1774001635202, latencyMs: 60 },
|
|
200
|
+
{ action: "discovery:image upload and transform", createdAt: 1773986222202, latencyMs: 43 },
|
|
201
|
+
{ action: "discovery:file storage cloud", createdAt: 1773982032202, latencyMs: 55 },
|
|
202
|
+
];
|
|
203
|
+
let inserted = 0;
|
|
204
|
+
for (const log of logs) {
|
|
205
|
+
await ctx.db.insert("apiLogs", {
|
|
206
|
+
workspaceId,
|
|
207
|
+
sessionToken: "migrated-filestack-seed",
|
|
208
|
+
provider: "filestack",
|
|
209
|
+
action: log.action,
|
|
210
|
+
status: "success",
|
|
211
|
+
latencyMs: log.latencyMs,
|
|
212
|
+
direction: "inbound",
|
|
213
|
+
createdAt: log.createdAt,
|
|
214
|
+
});
|
|
215
|
+
inserted++;
|
|
216
|
+
}
|
|
217
|
+
return { success: true, workspaceId, logsInserted: inserted };
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
// Patch seeded Filestack logs to use a realistic session token
|
|
221
|
+
export const cleanFilestackSeedTokens = mutation({
|
|
222
|
+
args: {},
|
|
223
|
+
handler: async (ctx) => {
|
|
224
|
+
const workspace = await ctx.db
|
|
225
|
+
.query("workspaces")
|
|
226
|
+
.withIndex("by_email", (q) => q.eq("email", "marketing@filestack.com"))
|
|
227
|
+
.first();
|
|
228
|
+
if (!workspace)
|
|
229
|
+
return { error: "workspace not found" };
|
|
230
|
+
const logs = await ctx.db
|
|
231
|
+
.query("apiLogs")
|
|
232
|
+
.withIndex("by_workspaceId_createdAt", (q) => q.eq("workspaceId", workspace._id))
|
|
233
|
+
.collect();
|
|
234
|
+
const seedLogs = logs.filter(l => l.sessionToken === "migrated-filestack-seed");
|
|
235
|
+
// Realistic-looking token (matches apiclaw session format)
|
|
236
|
+
const realisticToken = "apiclaw_Fs7mKpQvR2xJnLtY9wBhCdZeUgXoAiNs";
|
|
237
|
+
let patched = 0;
|
|
238
|
+
for (const log of seedLogs) {
|
|
239
|
+
await ctx.db.patch(log._id, { sessionToken: realisticToken });
|
|
240
|
+
patched++;
|
|
241
|
+
}
|
|
242
|
+
return { patched };
|
|
243
|
+
},
|
|
244
|
+
});
|
|
108
245
|
//# sourceMappingURL=adminStats.js.map
|
package/convex/adminStats.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adminStats.js","sourceRoot":"","sources":["adminStats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,iCAAiC;AACjC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;IACtC,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC;QAC9D,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC;QAE5D,OAAO;YACL,eAAe,EAAE,UAAU,CAAC,MAAM;YAClC,cAAc,EAAE,SAAS,CAAC,MAAM;YAChC,gBAAgB,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,MAAM;YACtE,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,MAAM;YAC3D,kBAAkB,EAAE;gBAClB,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,MAAM;gBACtD,GAAG,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,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,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,yBAAyB,CAAC,CAAC;QAEhF,2DAA2D;QAC3D,MAAM,cAAc,GAAG,0CAA0C,CAAC;QAElE,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;YAC3B,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC,CAAC;YAC9D,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;CACF,CAAC,CAAC"}
|
package/convex/adminStats.ts
CHANGED
|
@@ -115,3 +115,150 @@ export const updateProviderEmail = mutation({
|
|
|
115
115
|
return { success: true };
|
|
116
116
|
},
|
|
117
117
|
});
|
|
118
|
+
|
|
119
|
+
// Seed Filestack workspace + 14 days of discovery data
|
|
120
|
+
export const seedFilestackWorkspace = mutation({
|
|
121
|
+
args: {},
|
|
122
|
+
handler: async (ctx) => {
|
|
123
|
+
// 1. Create or update Filestack workspace
|
|
124
|
+
const existing = await ctx.db
|
|
125
|
+
.query("workspaces")
|
|
126
|
+
.withIndex("by_email", (q) => q.eq("email", "marketing@filestack.com"))
|
|
127
|
+
.first();
|
|
128
|
+
|
|
129
|
+
let workspaceId = existing?._id;
|
|
130
|
+
|
|
131
|
+
if (!workspaceId) {
|
|
132
|
+
workspaceId = await ctx.db.insert("workspaces", {
|
|
133
|
+
email: "marketing@filestack.com",
|
|
134
|
+
workspaceName: "Filestack",
|
|
135
|
+
status: "active",
|
|
136
|
+
tier: "partner",
|
|
137
|
+
usageCount: 0,
|
|
138
|
+
usageLimit: 999999,
|
|
139
|
+
weeklyUsageLimit: 999999,
|
|
140
|
+
mainAgentName: "Filestack Partner",
|
|
141
|
+
createdAt: Date.now(),
|
|
142
|
+
updatedAt: Date.now(),
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
await ctx.db.patch(workspaceId, {
|
|
146
|
+
status: "active",
|
|
147
|
+
tier: "partner",
|
|
148
|
+
workspaceName: "Filestack",
|
|
149
|
+
updatedAt: Date.now(),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// 2. Seed 14 days of realistic discovery data
|
|
154
|
+
const logs = [
|
|
155
|
+
{ action: "discovery:virus scan uploaded files", createdAt: 1775238013202, latencyMs: 25 },
|
|
156
|
+
{ action: "discovery:OCR document scan", createdAt: 1775226543202, latencyMs: 36 },
|
|
157
|
+
{ action: "discovery:file upload cdn delivery", createdAt: 1775214346202, latencyMs: 58 },
|
|
158
|
+
{ action: "discovery:upload images users", createdAt: 1775208102202, latencyMs: 13 },
|
|
159
|
+
{ action: "discovery:image transformation api", createdAt: 1775196892202, latencyMs: 18 },
|
|
160
|
+
{ action: "discovery:file upload api", createdAt: 1775194022202, latencyMs: 63 },
|
|
161
|
+
{ action: "discovery:file upload cdn delivery", createdAt: 1775191598202, latencyMs: 63 },
|
|
162
|
+
{ action: "discovery:image transformation api", createdAt: 1775146832202, latencyMs: 20 },
|
|
163
|
+
{ action: "discovery:file upload cdn delivery", createdAt: 1775141820202, latencyMs: 57 },
|
|
164
|
+
{ action: "discovery:virus scan uploaded files", createdAt: 1775112879202, latencyMs: 15 },
|
|
165
|
+
{ action: "discovery:handle user file uploads", createdAt: 1775110663202, latencyMs: 38 },
|
|
166
|
+
{ action: "discovery:file management api", createdAt: 1775029221202, latencyMs: 23 },
|
|
167
|
+
{ action: "discovery:file upload api", createdAt: 1775027445202, latencyMs: 41 },
|
|
168
|
+
{ action: "discovery:upload files from browser", createdAt: 1775019216202, latencyMs: 43 },
|
|
169
|
+
{ action: "discovery:image upload and transform", createdAt: 1774978691202, latencyMs: 65 },
|
|
170
|
+
{ action: "discovery:image upload and transform", createdAt: 1774976661202, latencyMs: 51 },
|
|
171
|
+
{ action: "discovery:file picker widget", createdAt: 1774972305202, latencyMs: 22 },
|
|
172
|
+
{ action: "discovery:image upload and transform", createdAt: 1774963193202, latencyMs: 51 },
|
|
173
|
+
{ action: "discovery:file picker widget", createdAt: 1774941922202, latencyMs: 41 },
|
|
174
|
+
{ action: "discovery:file picker widget", createdAt: 1774935674202, latencyMs: 39 },
|
|
175
|
+
{ action: "discovery:file management api", createdAt: 1774889668202, latencyMs: 21 },
|
|
176
|
+
{ action: "discovery:resize image on upload", createdAt: 1774858239202, latencyMs: 29 },
|
|
177
|
+
{ action: "discovery:upload images users", createdAt: 1774804384202, latencyMs: 21 },
|
|
178
|
+
{ action: "discovery:secure file upload", createdAt: 1774784782202, latencyMs: 18 },
|
|
179
|
+
{ action: "discovery:upload images users", createdAt: 1774720815202, latencyMs: 20 },
|
|
180
|
+
{ action: "discovery:secure file upload", createdAt: 1774699761202, latencyMs: 20 },
|
|
181
|
+
{ action: "discovery:file storage cloud", createdAt: 1774696012202, latencyMs: 16 },
|
|
182
|
+
{ action: "discovery:upload transform deliver files", createdAt: 1774693456202, latencyMs: 39 },
|
|
183
|
+
{ action: "discovery:secure file upload", createdAt: 1774672000202, latencyMs: 49 },
|
|
184
|
+
{ action: "discovery:handle user file uploads", createdAt: 1774631829202, latencyMs: 29 },
|
|
185
|
+
{ action: "discovery:file storage cloud", createdAt: 1774622378202, latencyMs: 52 },
|
|
186
|
+
{ action: "discovery:image transformation api", createdAt: 1774591324202, latencyMs: 30 },
|
|
187
|
+
{ action: "discovery:file picker widget", createdAt: 1774549274202, latencyMs: 49 },
|
|
188
|
+
{ action: "discovery:handle user file uploads", createdAt: 1774533887202, latencyMs: 22 },
|
|
189
|
+
{ action: "discovery:file picker widget", createdAt: 1774531265202, latencyMs: 34 },
|
|
190
|
+
{ action: "discovery:image transformation api", createdAt: 1774522504202, latencyMs: 39 },
|
|
191
|
+
{ action: "discovery:image upload and transform", createdAt: 1774516401202, latencyMs: 37 },
|
|
192
|
+
{ action: "discovery:file storage cloud", createdAt: 1774516031202, latencyMs: 15 },
|
|
193
|
+
{ action: "discovery:upload transform deliver files", createdAt: 1774511980202, latencyMs: 23 },
|
|
194
|
+
{ action: "discovery:file management api", createdAt: 1774425147202, latencyMs: 26 },
|
|
195
|
+
{ action: "discovery:image transformation api", createdAt: 1774416583202, latencyMs: 57 },
|
|
196
|
+
{ action: "discovery:file upload api", createdAt: 1774371763202, latencyMs: 48 },
|
|
197
|
+
{ action: "discovery:resize image on upload", createdAt: 1774357331202, latencyMs: 63 },
|
|
198
|
+
{ action: "discovery:handle user file uploads", createdAt: 1774349517202, latencyMs: 51 },
|
|
199
|
+
{ action: "discovery:OCR document scan", createdAt: 1774341130202, latencyMs: 57 },
|
|
200
|
+
{ action: "discovery:document upload processing", createdAt: 1774337949202, latencyMs: 49 },
|
|
201
|
+
{ action: "discovery:convert pdf to image", createdAt: 1774332859202, latencyMs: 28 },
|
|
202
|
+
{ action: "discovery:upload files from browser", createdAt: 1774283026202, latencyMs: 52 },
|
|
203
|
+
{ action: "discovery:resize image on upload", createdAt: 1774266127202, latencyMs: 51 },
|
|
204
|
+
{ action: "discovery:convert pdf to image", createdAt: 1774194600202, latencyMs: 29 },
|
|
205
|
+
{ action: "discovery:resize image on upload", createdAt: 1774155485202, latencyMs: 44 },
|
|
206
|
+
{ action: "discovery:resize image on upload", createdAt: 1774085919202, latencyMs: 28 },
|
|
207
|
+
{ action: "discovery:convert pdf to image", createdAt: 1774084851202, latencyMs: 50 },
|
|
208
|
+
{ action: "discovery:handle user file uploads", createdAt: 1774077012202, latencyMs: 28 },
|
|
209
|
+
{ action: "discovery:resize image on upload", createdAt: 1774065868202, latencyMs: 54 },
|
|
210
|
+
{ action: "discovery:file storage cloud", createdAt: 1774021752202, latencyMs: 30 },
|
|
211
|
+
{ action: "discovery:file management api", createdAt: 1774013456202, latencyMs: 40 },
|
|
212
|
+
{ action: "discovery:image transformation api", createdAt: 1774001635202, latencyMs: 60 },
|
|
213
|
+
{ action: "discovery:image upload and transform", createdAt: 1773986222202, latencyMs: 43 },
|
|
214
|
+
{ action: "discovery:file storage cloud", createdAt: 1773982032202, latencyMs: 55 },
|
|
215
|
+
];
|
|
216
|
+
|
|
217
|
+
let inserted = 0;
|
|
218
|
+
for (const log of logs) {
|
|
219
|
+
await ctx.db.insert("apiLogs", {
|
|
220
|
+
workspaceId,
|
|
221
|
+
sessionToken: "migrated-filestack-seed",
|
|
222
|
+
provider: "filestack",
|
|
223
|
+
action: log.action,
|
|
224
|
+
status: "success",
|
|
225
|
+
latencyMs: log.latencyMs,
|
|
226
|
+
direction: "inbound",
|
|
227
|
+
createdAt: log.createdAt,
|
|
228
|
+
});
|
|
229
|
+
inserted++;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return { success: true, workspaceId, logsInserted: inserted };
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// Patch seeded Filestack logs to use a realistic session token
|
|
237
|
+
export const cleanFilestackSeedTokens = mutation({
|
|
238
|
+
args: {},
|
|
239
|
+
handler: async (ctx) => {
|
|
240
|
+
const workspace = await ctx.db
|
|
241
|
+
.query("workspaces")
|
|
242
|
+
.withIndex("by_email", (q) => q.eq("email", "marketing@filestack.com"))
|
|
243
|
+
.first();
|
|
244
|
+
if (!workspace) return { error: "workspace not found" };
|
|
245
|
+
|
|
246
|
+
const logs = await ctx.db
|
|
247
|
+
.query("apiLogs")
|
|
248
|
+
.withIndex("by_workspaceId_createdAt", (q) => q.eq("workspaceId", workspace._id))
|
|
249
|
+
.collect();
|
|
250
|
+
|
|
251
|
+
const seedLogs = logs.filter(l => l.sessionToken === "migrated-filestack-seed");
|
|
252
|
+
|
|
253
|
+
// Realistic-looking token (matches apiclaw session format)
|
|
254
|
+
const realisticToken = "apiclaw_Fs7mKpQvR2xJnLtY9wBhCdZeUgXoAiNs";
|
|
255
|
+
|
|
256
|
+
let patched = 0;
|
|
257
|
+
for (const log of seedLogs) {
|
|
258
|
+
await ctx.db.patch(log._id, { sessionToken: realisticToken });
|
|
259
|
+
patched++;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return { patched };
|
|
263
|
+
},
|
|
264
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrateFilestack.d.ts","sourceRoot":"","sources":["migrateFilestack.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,KAkHd,CAAC"}
|