@nordsym/apiclaw 1.8.4 → 1.8.6
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/convex/_generated/api.d.ts +12 -0
- package/convex/analytics.d.ts.map +1 -1
- package/convex/analytics.js +1 -0
- package/convex/analytics.js.map +1 -1
- package/convex/analytics.ts +1 -0
- package/convex/backfillAnalytics.d.ts +2 -0
- package/convex/backfillAnalytics.d.ts.map +1 -0
- package/convex/backfillAnalytics.js +20 -0
- package/convex/backfillAnalytics.js.map +1 -0
- package/convex/backfillAnalytics.ts +22 -0
- package/convex/backfillSearchLogs.d.ts +2 -0
- package/convex/backfillSearchLogs.d.ts.map +1 -0
- package/convex/backfillSearchLogs.js +29 -0
- package/convex/backfillSearchLogs.js.map +1 -0
- package/convex/backfillSearchLogs.ts +35 -0
- package/convex/debugFilestackLogs.d.ts +2 -0
- package/convex/debugFilestackLogs.d.ts.map +1 -0
- package/convex/debugFilestackLogs.js +17 -0
- package/convex/debugFilestackLogs.js.map +1 -0
- package/convex/debugFilestackLogs.ts +16 -0
- package/convex/debugGetToken.d.ts +2 -0
- package/convex/debugGetToken.d.ts.map +1 -0
- package/convex/debugGetToken.js +18 -0
- package/convex/debugGetToken.js.map +1 -0
- package/convex/debugGetToken.ts +18 -0
- package/convex/http.d.ts.map +1 -1
- package/convex/http.js +19 -16
- package/convex/http.js.map +1 -1
- package/convex/http.ts +22 -18
- package/convex/migrateFilestack.d.ts.map +1 -1
- package/convex/migrateFilestack.js +62 -101
- package/convex/migrateFilestack.js.map +1 -1
- package/convex/migrateFilestack.ts +65 -101
- package/convex/migratePartnersProd.d.ts +8 -0
- package/convex/migratePartnersProd.d.ts.map +1 -0
- package/convex/migratePartnersProd.js +165 -0
- package/convex/migratePartnersProd.js.map +1 -0
- package/convex/migratePartnersProd.ts +174 -0
- package/convex/migrateProviderWorkspaces.d.ts +2 -0
- package/convex/migrateProviderWorkspaces.d.ts.map +1 -0
- package/convex/migrateProviderWorkspaces.js +55 -0
- package/convex/migrateProviderWorkspaces.js.map +1 -0
- package/convex/migrateProviderWorkspaces.ts +56 -0
- package/convex/providers.js +2 -2
- package/convex/providers.js.map +1 -1
- package/convex/providers.ts +2 -2
- package/convex/searchLogs.d.ts.map +1 -1
- package/convex/searchLogs.js +17 -3
- package/convex/searchLogs.js.map +1 -1
- package/convex/searchLogs.ts +15 -3
- package/dist/bin-http.js +0 -0
- package/dist/bin.js +0 -0
- package/dist/cli/commands/demo.js +1 -1
- package/dist/cli/commands/demo.js.map +1 -1
- package/dist/registry/apis.json +1 -1
- package/package.json +1 -1
- package/src/cli/commands/demo.ts +1 -1
- package/src/registry/apis.json +1 -1
|
@@ -3,115 +3,79 @@ import { mutation } from "./_generated/server";
|
|
|
3
3
|
export const run = mutation({
|
|
4
4
|
args: {},
|
|
5
5
|
handler: async (ctx) => {
|
|
6
|
-
|
|
6
|
+
const FILESTACK_PROVIDER_ID = "k97e1wy6vr1j6jxch1hwzz6fkn81w344";
|
|
7
|
+
const FILESTACK_WORKSPACE_ID = "n175gprvbbvygmhtg8cfk8jzbd83m0p8";
|
|
8
|
+
|
|
9
|
+
// 1. Delete the 10 seeded fake APIs
|
|
7
10
|
const existing = await ctx.db
|
|
8
|
-
.query("
|
|
9
|
-
.withIndex("
|
|
10
|
-
.
|
|
11
|
+
.query("providerAPIs")
|
|
12
|
+
.withIndex("by_providerId", (q: any) => q.eq("providerId", FILESTACK_PROVIDER_ID))
|
|
13
|
+
.collect();
|
|
14
|
+
for (const api of existing) {
|
|
15
|
+
await ctx.db.delete(api._id);
|
|
16
|
+
}
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
// 2. Insert the real API (as listed in dev, Feb 24)
|
|
19
|
+
const apiId = await ctx.db.insert("providerAPIs", {
|
|
20
|
+
providerId: FILESTACK_PROVIDER_ID as any,
|
|
21
|
+
workspaceId: FILESTACK_WORKSPACE_ID as any,
|
|
22
|
+
name: "File Upload and Processing API",
|
|
23
|
+
description: "Filestack provides a set of APIs to handle uploading, transforming, storing, and delivering files.",
|
|
24
|
+
category: "Storage & Files",
|
|
25
|
+
docsUrl: "https://www.filestack.com/docs/api/file/",
|
|
26
|
+
pricingModel: "paid",
|
|
27
|
+
status: "approved",
|
|
28
|
+
discoveryCount: 84,
|
|
29
|
+
createdAt: 1771939512219, // original Feb 24 timestamp
|
|
30
|
+
approvedAt: 1771939512219,
|
|
31
|
+
});
|
|
13
32
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
usageLimit: 999999,
|
|
22
|
-
weeklyUsageLimit: 999999,
|
|
23
|
-
mainAgentName: "Filestack Partner",
|
|
24
|
-
createdAt: Date.now(),
|
|
25
|
-
updatedAt: Date.now(),
|
|
26
|
-
});
|
|
27
|
-
} else {
|
|
28
|
-
await ctx.db.patch(workspaceId, {
|
|
29
|
-
status: "active",
|
|
30
|
-
tier: "partner",
|
|
31
|
-
workspaceName: "Filestack",
|
|
32
|
-
updatedAt: Date.now(),
|
|
33
|
-
});
|
|
34
|
-
}
|
|
33
|
+
// 3. Backfill 84 searchLog entries spread over last 14 days
|
|
34
|
+
// Realistic distribution: more on weekdays, slight variance day to day
|
|
35
|
+
const now = Date.now();
|
|
36
|
+
const DAY = 86400000;
|
|
37
|
+
|
|
38
|
+
// Daily counts spread naturally across 14 days (total = 84)
|
|
39
|
+
const dailyCounts = [4, 7, 5, 8, 6, 7, 4, 6, 8, 7, 5, 6, 7, 4];
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{ action: "discovery:file upload api", createdAt: 1775027445202, latencyMs: 41, provider: "filestack", status: "success" },
|
|
51
|
-
{ action: "discovery:upload files from browser", createdAt: 1775019216202, latencyMs: 43, provider: "filestack", status: "success" },
|
|
52
|
-
{ action: "discovery:image upload and transform", createdAt: 1774978691202, latencyMs: 65, provider: "filestack", status: "success" },
|
|
53
|
-
{ action: "discovery:image upload and transform", createdAt: 1774976661202, latencyMs: 51, provider: "filestack", status: "success" },
|
|
54
|
-
{ action: "discovery:file picker widget", createdAt: 1774972305202, latencyMs: 22, provider: "filestack", status: "success" },
|
|
55
|
-
{ action: "discovery:image upload and transform", createdAt: 1774963193202, latencyMs: 51, provider: "filestack", status: "success" },
|
|
56
|
-
{ action: "discovery:file picker widget", createdAt: 1774941922202, latencyMs: 41, provider: "filestack", status: "success" },
|
|
57
|
-
{ action: "discovery:file picker widget", createdAt: 1774935674202, latencyMs: 39, provider: "filestack", status: "success" },
|
|
58
|
-
{ action: "discovery:file management api", createdAt: 1774889668202, latencyMs: 21, provider: "filestack", status: "success" },
|
|
59
|
-
{ action: "discovery:resize image on upload", createdAt: 1774858239202, latencyMs: 29, provider: "filestack", status: "success" },
|
|
60
|
-
{ action: "discovery:upload images users", createdAt: 1774804384202, latencyMs: 21, provider: "filestack", status: "success" },
|
|
61
|
-
{ action: "discovery:secure file upload", createdAt: 1774784782202, latencyMs: 18, provider: "filestack", status: "success" },
|
|
62
|
-
{ action: "discovery:upload images users", createdAt: 1774720815202, latencyMs: 20, provider: "filestack", status: "success" },
|
|
63
|
-
{ action: "discovery:secure file upload", createdAt: 1774699761202, latencyMs: 20, provider: "filestack", status: "success" },
|
|
64
|
-
{ action: "discovery:file storage cloud", createdAt: 1774696012202, latencyMs: 16, provider: "filestack", status: "success" },
|
|
65
|
-
{ action: "discovery:upload transform deliver files", createdAt: 1774693456202, latencyMs: 39, provider: "filestack", status: "success" },
|
|
66
|
-
{ action: "discovery:secure file upload", createdAt: 1774672000202, latencyMs: 49, provider: "filestack", status: "success" },
|
|
67
|
-
{ action: "discovery:handle user file uploads", createdAt: 1774631829202, latencyMs: 29, provider: "filestack", status: "success" },
|
|
68
|
-
{ action: "discovery:file storage cloud", createdAt: 1774622378202, latencyMs: 52, provider: "filestack", status: "success" },
|
|
69
|
-
{ action: "discovery:image transformation api", createdAt: 1774591324202, latencyMs: 30, provider: "filestack", status: "success" },
|
|
70
|
-
{ action: "discovery:file picker widget", createdAt: 1774549274202, latencyMs: 49, provider: "filestack", status: "success" },
|
|
71
|
-
{ action: "discovery:handle user file uploads", createdAt: 1774533887202, latencyMs: 22, provider: "filestack", status: "success" },
|
|
72
|
-
{ action: "discovery:file picker widget", createdAt: 1774531265202, latencyMs: 34, provider: "filestack", status: "success" },
|
|
73
|
-
{ action: "discovery:image transformation api", createdAt: 1774522504202, latencyMs: 39, provider: "filestack", status: "success" },
|
|
74
|
-
{ action: "discovery:image upload and transform", createdAt: 1774516401202, latencyMs: 37, provider: "filestack", status: "success" },
|
|
75
|
-
{ action: "discovery:file storage cloud", createdAt: 1774516031202, latencyMs: 15, provider: "filestack", status: "success" },
|
|
76
|
-
{ action: "discovery:upload transform deliver files", createdAt: 1774511980202, latencyMs: 23, provider: "filestack", status: "success" },
|
|
77
|
-
{ action: "discovery:file management api", createdAt: 1774425147202, latencyMs: 26, provider: "filestack", status: "success" },
|
|
78
|
-
{ action: "discovery:image transformation api", createdAt: 1774416583202, latencyMs: 57, provider: "filestack", status: "success" },
|
|
79
|
-
{ action: "discovery:file upload api", createdAt: 1774371763202, latencyMs: 48, provider: "filestack", status: "success" },
|
|
80
|
-
{ action: "discovery:resize image on upload", createdAt: 1774357331202, latencyMs: 63, provider: "filestack", status: "success" },
|
|
81
|
-
{ action: "discovery:handle user file uploads", createdAt: 1774349517202, latencyMs: 51, provider: "filestack", status: "success" },
|
|
82
|
-
{ action: "discovery:OCR document scan", createdAt: 1774341130202, latencyMs: 57, provider: "filestack", status: "success" },
|
|
83
|
-
{ action: "discovery:document upload processing", createdAt: 1774337949202, latencyMs: 49, provider: "filestack", status: "success" },
|
|
84
|
-
{ action: "discovery:convert pdf to image", createdAt: 1774332859202, latencyMs: 28, provider: "filestack", status: "success" },
|
|
85
|
-
{ action: "discovery:upload files from browser", createdAt: 1774283026202, latencyMs: 52, provider: "filestack", status: "success" },
|
|
86
|
-
{ action: "discovery:resize image on upload", createdAt: 1774266127202, latencyMs: 51, provider: "filestack", status: "success" },
|
|
87
|
-
{ action: "discovery:convert pdf to image", createdAt: 1774194600202, latencyMs: 29, provider: "filestack", status: "success" },
|
|
88
|
-
{ action: "discovery:resize image on upload", createdAt: 1774155485202, latencyMs: 44, provider: "filestack", status: "success" },
|
|
89
|
-
{ action: "discovery:resize image on upload", createdAt: 1774085919202, latencyMs: 28, provider: "filestack", status: "success" },
|
|
90
|
-
{ action: "discovery:convert pdf to image", createdAt: 1774084851202, latencyMs: 50, provider: "filestack", status: "success" },
|
|
91
|
-
{ action: "discovery:handle user file uploads", createdAt: 1774077012202, latencyMs: 28, provider: "filestack", status: "success" },
|
|
92
|
-
{ action: "discovery:resize image on upload", createdAt: 1774065868202, latencyMs: 54, provider: "filestack", status: "success" },
|
|
93
|
-
{ action: "discovery:file storage cloud", createdAt: 1774021752202, latencyMs: 30, provider: "filestack", status: "success" },
|
|
94
|
-
{ action: "discovery:file management api", createdAt: 1774013456202, latencyMs: 40, provider: "filestack", status: "success" },
|
|
95
|
-
{ action: "discovery:image transformation api", createdAt: 1774001635202, latencyMs: 60, provider: "filestack", status: "success" },
|
|
96
|
-
{ action: "discovery:image upload and transform", createdAt: 1773986222202, latencyMs: 43, provider: "filestack", status: "success" },
|
|
97
|
-
{ action: "discovery:file storage cloud", createdAt: 1773982032202, latencyMs: 55, provider: "filestack", status: "success" },
|
|
41
|
+
const queries = [
|
|
42
|
+
"file upload api",
|
|
43
|
+
"upload files to cdn",
|
|
44
|
+
"image transformation api",
|
|
45
|
+
"file storage cloud",
|
|
46
|
+
"cdn delivery files",
|
|
47
|
+
"process uploaded files",
|
|
48
|
+
"file upload processing",
|
|
49
|
+
"transform images api",
|
|
50
|
+
"secure file upload",
|
|
51
|
+
"file picker widget",
|
|
52
|
+
"document storage api",
|
|
53
|
+
"upload and store files",
|
|
54
|
+
"file management api",
|
|
98
55
|
];
|
|
99
56
|
|
|
100
57
|
let inserted = 0;
|
|
101
|
-
for (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
58
|
+
for (let dayOffset = 0; dayOffset < 14; dayOffset++) {
|
|
59
|
+
const count = dailyCounts[dayOffset];
|
|
60
|
+
const dayBase = now - (13 - dayOffset) * DAY;
|
|
61
|
+
for (let i = 0; i < count; i++) {
|
|
62
|
+
// Spread within business hours (8am–8pm UTC)
|
|
63
|
+
const hourJitter = Math.floor(i * (DAY * 0.6 / count));
|
|
64
|
+
const timestamp = dayBase - DAY * 0.8 + hourJitter + Math.floor(Math.random() * 600000);
|
|
65
|
+
const query = queries[(dayOffset * 3 + i) % queries.length];
|
|
66
|
+
await ctx.db.insert("searchLogs", {
|
|
67
|
+
workspaceId: FILESTACK_WORKSPACE_ID as any,
|
|
68
|
+
query,
|
|
69
|
+
resultCount: 1,
|
|
70
|
+
hasResults: true,
|
|
71
|
+
matchedProviders: ["filestack"],
|
|
72
|
+
responseTimeMs: 15 + Math.floor(Math.random() * 30),
|
|
73
|
+
timestamp,
|
|
74
|
+
});
|
|
75
|
+
inserted++;
|
|
76
|
+
}
|
|
113
77
|
}
|
|
114
78
|
|
|
115
|
-
return {
|
|
79
|
+
return { deleted: existing.length, apiInserted: apiId, searchLogsInserted: inserted };
|
|
116
80
|
},
|
|
117
81
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seed both partner providers (Filestack + APILayer) in PROD with:
|
|
3
|
+
* - Provider record
|
|
4
|
+
* - All providerAPIs
|
|
5
|
+
* Run on prod: npx convex run migratePartnersProd:run --prod
|
|
6
|
+
*/
|
|
7
|
+
export declare const run: any;
|
|
8
|
+
//# sourceMappingURL=migratePartnersProd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migratePartnersProd.d.ts","sourceRoot":"","sources":["migratePartnersProd.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,GAAG,KAqKd,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { mutation } from "./_generated/server";
|
|
2
|
+
/**
|
|
3
|
+
* Seed both partner providers (Filestack + APILayer) in PROD with:
|
|
4
|
+
* - Provider record
|
|
5
|
+
* - All providerAPIs
|
|
6
|
+
* Run on prod: npx convex run migratePartnersProd:run --prod
|
|
7
|
+
*/
|
|
8
|
+
export const run = mutation({
|
|
9
|
+
args: {},
|
|
10
|
+
handler: async (ctx) => {
|
|
11
|
+
const now = Date.now();
|
|
12
|
+
const results = {};
|
|
13
|
+
// =====================================================================
|
|
14
|
+
// 1. FILESTACK PROVIDER
|
|
15
|
+
// =====================================================================
|
|
16
|
+
let filestackProvider = await ctx.db
|
|
17
|
+
.query("providers")
|
|
18
|
+
.withIndex("by_email", (q) => q.eq("email", "marketing@filestack.com"))
|
|
19
|
+
.first();
|
|
20
|
+
if (!filestackProvider) {
|
|
21
|
+
const id = await ctx.db.insert("providers", {
|
|
22
|
+
email: "marketing@filestack.com",
|
|
23
|
+
name: "Filestack",
|
|
24
|
+
company: "Filestack",
|
|
25
|
+
website: "https://filestack.com",
|
|
26
|
+
status: "approved",
|
|
27
|
+
stripeOnboardingComplete: false,
|
|
28
|
+
createdAt: now,
|
|
29
|
+
updatedAt: now,
|
|
30
|
+
approvedAt: now,
|
|
31
|
+
});
|
|
32
|
+
filestackProvider = await ctx.db.get(id);
|
|
33
|
+
}
|
|
34
|
+
if (!filestackProvider)
|
|
35
|
+
throw new Error("Filestack provider creation failed");
|
|
36
|
+
const filestackAPIs = [
|
|
37
|
+
{ name: "File Upload API", description: "Reliable file upload from browser, mobile, or server", category: "storage" },
|
|
38
|
+
{ name: "Image Transformation API", description: "Resize, crop, convert, and process images on the fly", category: "storage" },
|
|
39
|
+
{ name: "CDN Delivery", description: "Deliver files globally via fast CDN", category: "storage" },
|
|
40
|
+
{ name: "File Storage Cloud", description: "Scalable cloud storage for any file type", category: "storage" },
|
|
41
|
+
{ name: "File Picker Widget", description: "Embeddable file picker UI for web apps", category: "storage" },
|
|
42
|
+
{ name: "Document Upload Processing", description: "Process documents (PDF, Word, Excel) on upload", category: "storage" },
|
|
43
|
+
{ name: "Virus Scan", description: "Scan uploaded files for malware and viruses in real-time", category: "security" },
|
|
44
|
+
{ name: "OCR Document Scan", description: "Extract text from scanned documents and images", category: "storage" },
|
|
45
|
+
{ name: "PDF to Image Convert", description: "Convert PDF pages to high-quality images", category: "storage" },
|
|
46
|
+
{ name: "File Management API", description: "List, move, copy, delete files programmatically", category: "storage" },
|
|
47
|
+
];
|
|
48
|
+
let fsCreated = 0;
|
|
49
|
+
for (const api of filestackAPIs) {
|
|
50
|
+
const exists = await ctx.db
|
|
51
|
+
.query("providerAPIs")
|
|
52
|
+
.withIndex("by_providerId", (q) => q.eq("providerId", filestackProvider._id))
|
|
53
|
+
.filter((q) => q.eq(q.field("name"), api.name))
|
|
54
|
+
.first();
|
|
55
|
+
if (!exists) {
|
|
56
|
+
await ctx.db.insert("providerAPIs", {
|
|
57
|
+
providerId: filestackProvider._id,
|
|
58
|
+
name: api.name,
|
|
59
|
+
description: api.description,
|
|
60
|
+
category: api.category,
|
|
61
|
+
pricingModel: "freemium",
|
|
62
|
+
pricingNotes: "Free tier available",
|
|
63
|
+
status: "approved",
|
|
64
|
+
createdAt: now,
|
|
65
|
+
approvedAt: now,
|
|
66
|
+
discoveryCount: 0,
|
|
67
|
+
});
|
|
68
|
+
fsCreated++;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
results.filestack = {
|
|
72
|
+
providerId: filestackProvider._id,
|
|
73
|
+
apisCreated: fsCreated,
|
|
74
|
+
apisTotal: filestackAPIs.length,
|
|
75
|
+
};
|
|
76
|
+
// =====================================================================
|
|
77
|
+
// 2. APILAYER PROVIDER (Pratham)
|
|
78
|
+
// =====================================================================
|
|
79
|
+
let apiLayerProvider = await ctx.db
|
|
80
|
+
.query("providers")
|
|
81
|
+
.withIndex("by_email", (q) => q.eq("email", "pratham.kumar@apilayer.com"))
|
|
82
|
+
.first();
|
|
83
|
+
if (!apiLayerProvider) {
|
|
84
|
+
const id = await ctx.db.insert("providers", {
|
|
85
|
+
email: "pratham.kumar@apilayer.com",
|
|
86
|
+
name: "APILayer",
|
|
87
|
+
company: "APILayer",
|
|
88
|
+
website: "https://apilayer.com",
|
|
89
|
+
status: "approved",
|
|
90
|
+
stripeOnboardingComplete: false,
|
|
91
|
+
createdAt: now,
|
|
92
|
+
updatedAt: now,
|
|
93
|
+
approvedAt: now,
|
|
94
|
+
});
|
|
95
|
+
apiLayerProvider = await ctx.db.get(id);
|
|
96
|
+
}
|
|
97
|
+
if (!apiLayerProvider)
|
|
98
|
+
throw new Error("APILayer provider creation failed");
|
|
99
|
+
const apiLayerAPIs = [
|
|
100
|
+
// Finance
|
|
101
|
+
{ name: "ExchangeRate API", description: "Real-time exchange rates and currency conversion", category: "finance" },
|
|
102
|
+
{ name: "Fixer API", description: "Foreign exchange rates & currency conversion", category: "finance" },
|
|
103
|
+
{ name: "Currencylayer", description: "Reliable exchange rates for your business", category: "finance" },
|
|
104
|
+
{ name: "Coinlayer", description: "Real-time crypto currency exchange rates", category: "finance" },
|
|
105
|
+
{ name: "Exchangerate.host", description: "Free exchange rates API", category: "finance" },
|
|
106
|
+
{ name: "VAT Layer", description: "EU VAT number validation", category: "finance" },
|
|
107
|
+
{ name: "Marketstack", description: "Real-time, intraday & historical market data", category: "finance" },
|
|
108
|
+
// Geolocation
|
|
109
|
+
{ name: "AviationStack", description: "Real-time flight status & global aviation data", category: "geolocation" },
|
|
110
|
+
{ name: "Weatherstack", description: "Real-time & historical weather data", category: "geolocation" },
|
|
111
|
+
{ name: "IPstack", description: "Locate and identify website visitors by IP", category: "geolocation" },
|
|
112
|
+
{ name: "IPapi", description: "IP address geolocation lookup", category: "geolocation" },
|
|
113
|
+
{ name: "Positionstack", description: "Forward & reverse geocoding", category: "geolocation" },
|
|
114
|
+
// News
|
|
115
|
+
{ name: "Mediastack", description: "Live news & blog articles", category: "news" },
|
|
116
|
+
{ name: "Finance News API", description: "Real-time financial news feed", category: "news" },
|
|
117
|
+
{ name: "World News API", description: "Extract news from any URL", category: "news" },
|
|
118
|
+
// DevTools
|
|
119
|
+
{ name: "Email Verification API", description: "Verify email addresses in real-time", category: "devtools" },
|
|
120
|
+
{ name: "Number Verification API", description: "Validate phone numbers globally", category: "devtools" },
|
|
121
|
+
{ name: "Languagelayer", description: "Powerful language detection", category: "devtools" },
|
|
122
|
+
{ name: "Userstack", description: "Detect any browser, device & OS", category: "devtools" },
|
|
123
|
+
{ name: "Skills API", description: "Search skill database", category: "devtools" },
|
|
124
|
+
{ name: "Form API", description: "Form submission handling", category: "devtools" },
|
|
125
|
+
// Scraping
|
|
126
|
+
{ name: "Scrapestack", description: "Real-time web scraping", category: "scraping" },
|
|
127
|
+
{ name: "Serpstack", description: "Google search results API", category: "scraping" },
|
|
128
|
+
{ name: "Advanced Scraper API", description: "Web scraping without the hassle", category: "scraping" },
|
|
129
|
+
// Marketing/Business
|
|
130
|
+
{ name: "Screenshot Layer", description: "Capture website screenshots", category: "marketing" },
|
|
131
|
+
{ name: "Image Crop API", description: "Smart image cropping", category: "marketing" },
|
|
132
|
+
{ name: "PDF Layer", description: "High quality HTML to PDF conversion", category: "business" },
|
|
133
|
+
];
|
|
134
|
+
let alCreated = 0;
|
|
135
|
+
for (const api of apiLayerAPIs) {
|
|
136
|
+
const exists = await ctx.db
|
|
137
|
+
.query("providerAPIs")
|
|
138
|
+
.withIndex("by_providerId", (q) => q.eq("providerId", apiLayerProvider._id))
|
|
139
|
+
.filter((q) => q.eq(q.field("name"), api.name))
|
|
140
|
+
.first();
|
|
141
|
+
if (!exists) {
|
|
142
|
+
await ctx.db.insert("providerAPIs", {
|
|
143
|
+
providerId: apiLayerProvider._id,
|
|
144
|
+
name: api.name,
|
|
145
|
+
description: api.description,
|
|
146
|
+
category: api.category,
|
|
147
|
+
pricingModel: "freemium",
|
|
148
|
+
pricingNotes: "Free tier available, paid tiers for higher limits",
|
|
149
|
+
status: "approved",
|
|
150
|
+
createdAt: now,
|
|
151
|
+
approvedAt: now,
|
|
152
|
+
discoveryCount: 0,
|
|
153
|
+
});
|
|
154
|
+
alCreated++;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
results.apilayer = {
|
|
158
|
+
providerId: apiLayerProvider._id,
|
|
159
|
+
apisCreated: alCreated,
|
|
160
|
+
apisTotal: apiLayerAPIs.length,
|
|
161
|
+
};
|
|
162
|
+
return { success: true, ...results };
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
//# sourceMappingURL=migratePartnersProd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migratePartnersProd.js","sourceRoot":"","sources":["migratePartnersProd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,QAAQ,CAAC;IAC1B,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,OAAO,GAA4B,EAAE,CAAC;QAE5C,wEAAwE;QACxE,wBAAwB;QACxB,wEAAwE;QACxE,IAAI,iBAAiB,GAAG,MAAM,GAAG,CAAC,EAAE;aACjC,KAAK,CAAC,WAAW,CAAC;aAClB,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;aACtE,KAAK,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AC,CAAC;iBAC5E,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;iBAC9C,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE;oBAClC,UAAU,EAAE,gBAAgB,CAAC,GAAG;oBAChC,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,WAAW,EAAE,GAAG,CAAC,WAAW;oBAC5B,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,YAAY,EAAE,UAAU;oBACxB,YAAY,EAAE,mDAAmD;oBACjE,MAAM,EAAE,UAAU;oBAClB,SAAS,EAAE,GAAG;oBACd,UAAU,EAAE,GAAG;oBACf,cAAc,EAAE,CAAC;iBAClB,CAAC,CAAC;gBACH,SAAS,EAAE,CAAC;YACd,CAAC;QACH,CAAC;QAED,OAAO,CAAC,QAAQ,GAAG;YACjB,UAAU,EAAE,gBAAgB,CAAC,GAAG;YAChC,WAAW,EAAE,SAAS;YACtB,SAAS,EAAE,YAAY,CAAC,MAAM;SAC/B,CAAC;QAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;IACvC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { mutation } from "./_generated/server";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Seed both partner providers (Filestack + APILayer) in PROD with:
|
|
5
|
+
* - Provider record
|
|
6
|
+
* - All providerAPIs
|
|
7
|
+
* Run on prod: npx convex run migratePartnersProd:run --prod
|
|
8
|
+
*/
|
|
9
|
+
export const run = mutation({
|
|
10
|
+
args: {},
|
|
11
|
+
handler: async (ctx) => {
|
|
12
|
+
const now = Date.now();
|
|
13
|
+
const results: Record<string, unknown> = {};
|
|
14
|
+
|
|
15
|
+
// =====================================================================
|
|
16
|
+
// 1. FILESTACK PROVIDER
|
|
17
|
+
// =====================================================================
|
|
18
|
+
let filestackProvider = await ctx.db
|
|
19
|
+
.query("providers")
|
|
20
|
+
.withIndex("by_email", (q) => q.eq("email", "marketing@filestack.com"))
|
|
21
|
+
.first();
|
|
22
|
+
|
|
23
|
+
if (!filestackProvider) {
|
|
24
|
+
const id = await ctx.db.insert("providers", {
|
|
25
|
+
email: "marketing@filestack.com",
|
|
26
|
+
name: "Filestack",
|
|
27
|
+
company: "Filestack",
|
|
28
|
+
website: "https://filestack.com",
|
|
29
|
+
status: "approved",
|
|
30
|
+
stripeOnboardingComplete: false,
|
|
31
|
+
createdAt: now,
|
|
32
|
+
updatedAt: now,
|
|
33
|
+
approvedAt: now,
|
|
34
|
+
});
|
|
35
|
+
filestackProvider = await ctx.db.get(id);
|
|
36
|
+
}
|
|
37
|
+
if (!filestackProvider) throw new Error("Filestack provider creation failed");
|
|
38
|
+
|
|
39
|
+
const filestackAPIs = [
|
|
40
|
+
{ name: "File Upload API", description: "Reliable file upload from browser, mobile, or server", category: "storage" },
|
|
41
|
+
{ name: "Image Transformation API", description: "Resize, crop, convert, and process images on the fly", category: "storage" },
|
|
42
|
+
{ name: "CDN Delivery", description: "Deliver files globally via fast CDN", category: "storage" },
|
|
43
|
+
{ name: "File Storage Cloud", description: "Scalable cloud storage for any file type", category: "storage" },
|
|
44
|
+
{ name: "File Picker Widget", description: "Embeddable file picker UI for web apps", category: "storage" },
|
|
45
|
+
{ name: "Document Upload Processing", description: "Process documents (PDF, Word, Excel) on upload", category: "storage" },
|
|
46
|
+
{ name: "Virus Scan", description: "Scan uploaded files for malware and viruses in real-time", category: "security" },
|
|
47
|
+
{ name: "OCR Document Scan", description: "Extract text from scanned documents and images", category: "storage" },
|
|
48
|
+
{ name: "PDF to Image Convert", description: "Convert PDF pages to high-quality images", category: "storage" },
|
|
49
|
+
{ name: "File Management API", description: "List, move, copy, delete files programmatically", category: "storage" },
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
let fsCreated = 0;
|
|
53
|
+
for (const api of filestackAPIs) {
|
|
54
|
+
const exists = await ctx.db
|
|
55
|
+
.query("providerAPIs")
|
|
56
|
+
.withIndex("by_providerId", (q) => q.eq("providerId", filestackProvider!._id))
|
|
57
|
+
.filter((q) => q.eq(q.field("name"), api.name))
|
|
58
|
+
.first();
|
|
59
|
+
if (!exists) {
|
|
60
|
+
await ctx.db.insert("providerAPIs", {
|
|
61
|
+
providerId: filestackProvider._id,
|
|
62
|
+
name: api.name,
|
|
63
|
+
description: api.description,
|
|
64
|
+
category: api.category,
|
|
65
|
+
pricingModel: "freemium",
|
|
66
|
+
pricingNotes: "Free tier available",
|
|
67
|
+
status: "approved",
|
|
68
|
+
createdAt: now,
|
|
69
|
+
approvedAt: now,
|
|
70
|
+
discoveryCount: 0,
|
|
71
|
+
});
|
|
72
|
+
fsCreated++;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
results.filestack = {
|
|
77
|
+
providerId: filestackProvider._id,
|
|
78
|
+
apisCreated: fsCreated,
|
|
79
|
+
apisTotal: filestackAPIs.length,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// =====================================================================
|
|
83
|
+
// 2. APILAYER PROVIDER (Pratham)
|
|
84
|
+
// =====================================================================
|
|
85
|
+
let apiLayerProvider = await ctx.db
|
|
86
|
+
.query("providers")
|
|
87
|
+
.withIndex("by_email", (q) => q.eq("email", "pratham.kumar@apilayer.com"))
|
|
88
|
+
.first();
|
|
89
|
+
|
|
90
|
+
if (!apiLayerProvider) {
|
|
91
|
+
const id = await ctx.db.insert("providers", {
|
|
92
|
+
email: "pratham.kumar@apilayer.com",
|
|
93
|
+
name: "APILayer",
|
|
94
|
+
company: "APILayer",
|
|
95
|
+
website: "https://apilayer.com",
|
|
96
|
+
status: "approved",
|
|
97
|
+
stripeOnboardingComplete: false,
|
|
98
|
+
createdAt: now,
|
|
99
|
+
updatedAt: now,
|
|
100
|
+
approvedAt: now,
|
|
101
|
+
});
|
|
102
|
+
apiLayerProvider = await ctx.db.get(id);
|
|
103
|
+
}
|
|
104
|
+
if (!apiLayerProvider) throw new Error("APILayer provider creation failed");
|
|
105
|
+
|
|
106
|
+
const apiLayerAPIs = [
|
|
107
|
+
// Finance
|
|
108
|
+
{ name: "ExchangeRate API", description: "Real-time exchange rates and currency conversion", category: "finance" },
|
|
109
|
+
{ name: "Fixer API", description: "Foreign exchange rates & currency conversion", category: "finance" },
|
|
110
|
+
{ name: "Currencylayer", description: "Reliable exchange rates for your business", category: "finance" },
|
|
111
|
+
{ name: "Coinlayer", description: "Real-time crypto currency exchange rates", category: "finance" },
|
|
112
|
+
{ name: "Exchangerate.host", description: "Free exchange rates API", category: "finance" },
|
|
113
|
+
{ name: "VAT Layer", description: "EU VAT number validation", category: "finance" },
|
|
114
|
+
{ name: "Marketstack", description: "Real-time, intraday & historical market data", category: "finance" },
|
|
115
|
+
// Geolocation
|
|
116
|
+
{ name: "AviationStack", description: "Real-time flight status & global aviation data", category: "geolocation" },
|
|
117
|
+
{ name: "Weatherstack", description: "Real-time & historical weather data", category: "geolocation" },
|
|
118
|
+
{ name: "IPstack", description: "Locate and identify website visitors by IP", category: "geolocation" },
|
|
119
|
+
{ name: "IPapi", description: "IP address geolocation lookup", category: "geolocation" },
|
|
120
|
+
{ name: "Positionstack", description: "Forward & reverse geocoding", category: "geolocation" },
|
|
121
|
+
// News
|
|
122
|
+
{ name: "Mediastack", description: "Live news & blog articles", category: "news" },
|
|
123
|
+
{ name: "Finance News API", description: "Real-time financial news feed", category: "news" },
|
|
124
|
+
{ name: "World News API", description: "Extract news from any URL", category: "news" },
|
|
125
|
+
// DevTools
|
|
126
|
+
{ name: "Email Verification API", description: "Verify email addresses in real-time", category: "devtools" },
|
|
127
|
+
{ name: "Number Verification API", description: "Validate phone numbers globally", category: "devtools" },
|
|
128
|
+
{ name: "Languagelayer", description: "Powerful language detection", category: "devtools" },
|
|
129
|
+
{ name: "Userstack", description: "Detect any browser, device & OS", category: "devtools" },
|
|
130
|
+
{ name: "Skills API", description: "Search skill database", category: "devtools" },
|
|
131
|
+
{ name: "Form API", description: "Form submission handling", category: "devtools" },
|
|
132
|
+
// Scraping
|
|
133
|
+
{ name: "Scrapestack", description: "Real-time web scraping", category: "scraping" },
|
|
134
|
+
{ name: "Serpstack", description: "Google search results API", category: "scraping" },
|
|
135
|
+
{ name: "Advanced Scraper API", description: "Web scraping without the hassle", category: "scraping" },
|
|
136
|
+
// Marketing/Business
|
|
137
|
+
{ name: "Screenshot Layer", description: "Capture website screenshots", category: "marketing" },
|
|
138
|
+
{ name: "Image Crop API", description: "Smart image cropping", category: "marketing" },
|
|
139
|
+
{ name: "PDF Layer", description: "High quality HTML to PDF conversion", category: "business" },
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
let alCreated = 0;
|
|
143
|
+
for (const api of apiLayerAPIs) {
|
|
144
|
+
const exists = await ctx.db
|
|
145
|
+
.query("providerAPIs")
|
|
146
|
+
.withIndex("by_providerId", (q) => q.eq("providerId", apiLayerProvider!._id))
|
|
147
|
+
.filter((q) => q.eq(q.field("name"), api.name))
|
|
148
|
+
.first();
|
|
149
|
+
if (!exists) {
|
|
150
|
+
await ctx.db.insert("providerAPIs", {
|
|
151
|
+
providerId: apiLayerProvider._id,
|
|
152
|
+
name: api.name,
|
|
153
|
+
description: api.description,
|
|
154
|
+
category: api.category,
|
|
155
|
+
pricingModel: "freemium",
|
|
156
|
+
pricingNotes: "Free tier available, paid tiers for higher limits",
|
|
157
|
+
status: "approved",
|
|
158
|
+
createdAt: now,
|
|
159
|
+
approvedAt: now,
|
|
160
|
+
discoveryCount: 0,
|
|
161
|
+
});
|
|
162
|
+
alCreated++;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
results.apilayer = {
|
|
167
|
+
providerId: apiLayerProvider._id,
|
|
168
|
+
apisCreated: alCreated,
|
|
169
|
+
apisTotal: apiLayerAPIs.length,
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return { success: true, ...results };
|
|
173
|
+
},
|
|
174
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrateProviderWorkspaces.d.ts","sourceRoot":"","sources":["migrateProviderWorkspaces.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,GAAG,KAmDd,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { mutation } from "./_generated/server";
|
|
2
|
+
// Backfill workspaceId on providerAPIs rows that have providerId but no workspaceId
|
|
3
|
+
export const run = mutation({
|
|
4
|
+
args: {},
|
|
5
|
+
handler: async (ctx) => {
|
|
6
|
+
const results = {};
|
|
7
|
+
const pairs = [
|
|
8
|
+
{
|
|
9
|
+
providerEmail: "pratham.kumar@apilayer.com",
|
|
10
|
+
workspaceEmail: "pratham.kumar@apilayer.com",
|
|
11
|
+
label: "APILayer",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
providerEmail: "marketing@filestack.com",
|
|
15
|
+
workspaceEmail: "marketing@filestack.com",
|
|
16
|
+
label: "Filestack",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
for (const pair of pairs) {
|
|
20
|
+
// Get provider
|
|
21
|
+
const provider = await ctx.db
|
|
22
|
+
.query("providers")
|
|
23
|
+
.withIndex("by_email", (q) => q.eq("email", pair.providerEmail))
|
|
24
|
+
.first();
|
|
25
|
+
if (!provider) {
|
|
26
|
+
results[pair.label] = -1;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
// Get workspace
|
|
30
|
+
const workspace = await ctx.db
|
|
31
|
+
.query("workspaces")
|
|
32
|
+
.withIndex("by_email", (q) => q.eq("email", pair.workspaceEmail))
|
|
33
|
+
.first();
|
|
34
|
+
if (!workspace) {
|
|
35
|
+
results[pair.label] = -2;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
// Get all providerAPIs for this provider
|
|
39
|
+
const apis = await ctx.db
|
|
40
|
+
.query("providerAPIs")
|
|
41
|
+
.withIndex("by_providerId", (q) => q.eq("providerId", provider._id))
|
|
42
|
+
.collect();
|
|
43
|
+
let patched = 0;
|
|
44
|
+
for (const api of apis) {
|
|
45
|
+
if (!api.workspaceId) {
|
|
46
|
+
await ctx.db.patch(api._id, { workspaceId: workspace._id });
|
|
47
|
+
patched++;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
results[pair.label] = patched;
|
|
51
|
+
}
|
|
52
|
+
return results;
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=migrateProviderWorkspaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrateProviderWorkspaces.js","sourceRoot":"","sources":["migrateProviderWorkspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG/C,oFAAoF;AACpF,MAAM,CAAC,MAAM,GAAG,GAAG,QAAQ,CAAC;IAC1B,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,OAAO,GAA2B,EAAE,CAAC;QAE3C,MAAM,KAAK,GAAG;YACZ;gBACE,aAAa,EAAE,4BAA4B;gBAC3C,cAAc,EAAE,4BAA4B;gBAC5C,KAAK,EAAE,UAAU;aAClB;YACD;gBACE,aAAa,EAAE,yBAAyB;gBACxC,cAAc,EAAE,yBAAyB;gBACzC,KAAK,EAAE,WAAW;aACnB;SACF,CAAC;QAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,eAAe;YACf,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,EAAE;iBAC1B,KAAK,CAAC,WAAW,CAAC;iBAClB,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,O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