@larkup/marketplace 0.2.0 → 0.2.1
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/.env +6 -0
- package/.turbo/turbo-test.log +17 -0
- package/.turbo/turbo-type-check.log +4 -0
- package/CHANGELOG.md +10 -0
- package/db/dist/builtin-tools.d.ts +2 -0
- package/db/dist/builtin-tools.js +116 -0
- package/db/dist/client.d.ts +7 -0
- package/db/dist/client.js +20 -0
- package/db/dist/repo.d.ts +67 -0
- package/db/dist/repo.js +236 -0
- package/db/dist/schema/audit.d.ts +128 -0
- package/db/dist/schema/audit.js +18 -0
- package/db/dist/schema/extensions.d.ts +326 -0
- package/db/dist/schema/extensions.js +36 -0
- package/db/dist/schema/index.d.ts +5 -0
- package/db/dist/schema/index.js +5 -0
- package/db/dist/schema/installations.d.ts +93 -0
- package/db/dist/schema/installations.js +15 -0
- package/db/dist/schema/publishers.d.ts +110 -0
- package/db/dist/schema/publishers.js +12 -0
- package/db/dist/schema/versions.d.ts +127 -0
- package/db/dist/schema/versions.js +17 -0
- package/db/dist/seed.d.ts +2 -0
- package/db/dist/seed.js +31 -0
- package/db/dist/validate.d.ts +6 -0
- package/db/dist/validate.js +51 -0
- package/package.json +3 -3
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/** Immutable published extension versions. */
|
|
2
|
+
export declare const extensionVersions: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3
|
+
name: "extension_versions";
|
|
4
|
+
schema: undefined;
|
|
5
|
+
columns: {
|
|
6
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
7
|
+
name: "id";
|
|
8
|
+
tableName: "extension_versions";
|
|
9
|
+
dataType: "string";
|
|
10
|
+
columnType: "PgText";
|
|
11
|
+
data: string;
|
|
12
|
+
driverParam: string;
|
|
13
|
+
notNull: true;
|
|
14
|
+
hasDefault: false;
|
|
15
|
+
isPrimaryKey: true;
|
|
16
|
+
isAutoincrement: false;
|
|
17
|
+
hasRuntimeDefault: false;
|
|
18
|
+
enumValues: [string, ...string[]];
|
|
19
|
+
baseColumn: never;
|
|
20
|
+
identity: undefined;
|
|
21
|
+
generated: undefined;
|
|
22
|
+
}, {}, {}>;
|
|
23
|
+
extensionId: import("drizzle-orm/pg-core").PgColumn<{
|
|
24
|
+
name: "extension_id";
|
|
25
|
+
tableName: "extension_versions";
|
|
26
|
+
dataType: "string";
|
|
27
|
+
columnType: "PgText";
|
|
28
|
+
data: string;
|
|
29
|
+
driverParam: string;
|
|
30
|
+
notNull: true;
|
|
31
|
+
hasDefault: false;
|
|
32
|
+
isPrimaryKey: false;
|
|
33
|
+
isAutoincrement: false;
|
|
34
|
+
hasRuntimeDefault: false;
|
|
35
|
+
enumValues: [string, ...string[]];
|
|
36
|
+
baseColumn: never;
|
|
37
|
+
identity: undefined;
|
|
38
|
+
generated: undefined;
|
|
39
|
+
}, {}, {}>;
|
|
40
|
+
version: import("drizzle-orm/pg-core").PgColumn<{
|
|
41
|
+
name: "version";
|
|
42
|
+
tableName: "extension_versions";
|
|
43
|
+
dataType: "string";
|
|
44
|
+
columnType: "PgText";
|
|
45
|
+
data: string;
|
|
46
|
+
driverParam: string;
|
|
47
|
+
notNull: true;
|
|
48
|
+
hasDefault: false;
|
|
49
|
+
isPrimaryKey: false;
|
|
50
|
+
isAutoincrement: false;
|
|
51
|
+
hasRuntimeDefault: false;
|
|
52
|
+
enumValues: [string, ...string[]];
|
|
53
|
+
baseColumn: never;
|
|
54
|
+
identity: undefined;
|
|
55
|
+
generated: undefined;
|
|
56
|
+
}, {}, {}>;
|
|
57
|
+
manifest: import("drizzle-orm/pg-core").PgColumn<{
|
|
58
|
+
name: "manifest";
|
|
59
|
+
tableName: "extension_versions";
|
|
60
|
+
dataType: "json";
|
|
61
|
+
columnType: "PgJsonb";
|
|
62
|
+
data: unknown;
|
|
63
|
+
driverParam: unknown;
|
|
64
|
+
notNull: true;
|
|
65
|
+
hasDefault: false;
|
|
66
|
+
isPrimaryKey: false;
|
|
67
|
+
isAutoincrement: false;
|
|
68
|
+
hasRuntimeDefault: false;
|
|
69
|
+
enumValues: undefined;
|
|
70
|
+
baseColumn: never;
|
|
71
|
+
identity: undefined;
|
|
72
|
+
generated: undefined;
|
|
73
|
+
}, {}, {}>;
|
|
74
|
+
integrity: import("drizzle-orm/pg-core").PgColumn<{
|
|
75
|
+
name: "integrity";
|
|
76
|
+
tableName: "extension_versions";
|
|
77
|
+
dataType: "string";
|
|
78
|
+
columnType: "PgText";
|
|
79
|
+
data: string;
|
|
80
|
+
driverParam: string;
|
|
81
|
+
notNull: true;
|
|
82
|
+
hasDefault: false;
|
|
83
|
+
isPrimaryKey: false;
|
|
84
|
+
isAutoincrement: false;
|
|
85
|
+
hasRuntimeDefault: false;
|
|
86
|
+
enumValues: [string, ...string[]];
|
|
87
|
+
baseColumn: never;
|
|
88
|
+
identity: undefined;
|
|
89
|
+
generated: undefined;
|
|
90
|
+
}, {}, {}>;
|
|
91
|
+
publishedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
92
|
+
name: "published_by";
|
|
93
|
+
tableName: "extension_versions";
|
|
94
|
+
dataType: "string";
|
|
95
|
+
columnType: "PgText";
|
|
96
|
+
data: string;
|
|
97
|
+
driverParam: string;
|
|
98
|
+
notNull: true;
|
|
99
|
+
hasDefault: false;
|
|
100
|
+
isPrimaryKey: false;
|
|
101
|
+
isAutoincrement: false;
|
|
102
|
+
hasRuntimeDefault: false;
|
|
103
|
+
enumValues: [string, ...string[]];
|
|
104
|
+
baseColumn: never;
|
|
105
|
+
identity: undefined;
|
|
106
|
+
generated: undefined;
|
|
107
|
+
}, {}, {}>;
|
|
108
|
+
publishedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
109
|
+
name: "published_at";
|
|
110
|
+
tableName: "extension_versions";
|
|
111
|
+
dataType: "date";
|
|
112
|
+
columnType: "PgTimestamp";
|
|
113
|
+
data: Date;
|
|
114
|
+
driverParam: string;
|
|
115
|
+
notNull: true;
|
|
116
|
+
hasDefault: true;
|
|
117
|
+
isPrimaryKey: false;
|
|
118
|
+
isAutoincrement: false;
|
|
119
|
+
hasRuntimeDefault: false;
|
|
120
|
+
enumValues: undefined;
|
|
121
|
+
baseColumn: never;
|
|
122
|
+
identity: undefined;
|
|
123
|
+
generated: undefined;
|
|
124
|
+
}, {}, {}>;
|
|
125
|
+
};
|
|
126
|
+
dialect: "pg";
|
|
127
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { index, jsonb, pgTable, text, timestamp, unique } from 'drizzle-orm/pg-core';
|
|
2
|
+
import { extensions } from './extensions.js';
|
|
3
|
+
/** Immutable published extension versions. */
|
|
4
|
+
export const extensionVersions = pgTable('extension_versions', {
|
|
5
|
+
id: text('id').primaryKey(),
|
|
6
|
+
extensionId: text('extension_id')
|
|
7
|
+
.notNull()
|
|
8
|
+
.references(() => extensions.id),
|
|
9
|
+
version: text('version').notNull(),
|
|
10
|
+
manifest: jsonb('manifest').notNull(),
|
|
11
|
+
integrity: text('integrity').notNull(),
|
|
12
|
+
publishedBy: text('published_by').notNull(),
|
|
13
|
+
publishedAt: timestamp('published_at', { withTimezone: true }).notNull().defaultNow(),
|
|
14
|
+
}, (table) => [
|
|
15
|
+
unique('extension_versions_extension_version_unique').on(table.extensionId, table.version),
|
|
16
|
+
index('extension_versions_extension_id_idx').on(table.extensionId),
|
|
17
|
+
]);
|
package/db/dist/seed.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Seeds built-in Marketplace tools. */
|
|
2
|
+
import 'dotenv/config';
|
|
3
|
+
import { BUILTIN_TOOLS } from './builtin-tools.js';
|
|
4
|
+
import { getMarketplaceDb } from './client.js';
|
|
5
|
+
import { publishExtension, VersionExistsError } from './repo.js';
|
|
6
|
+
async function main() {
|
|
7
|
+
const db = getMarketplaceDb();
|
|
8
|
+
for (const manifest of BUILTIN_TOOLS) {
|
|
9
|
+
try {
|
|
10
|
+
await publishExtension(db, {
|
|
11
|
+
manifest,
|
|
12
|
+
publisherId: 'larkup',
|
|
13
|
+
publisherName: 'Larkup',
|
|
14
|
+
});
|
|
15
|
+
console.log(`seeded ${manifest.id}@${manifest.version}`);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
if (err instanceof VersionExistsError) {
|
|
19
|
+
console.log(`already seeded: ${manifest.id}@${manifest.version}`);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
throw err;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
main()
|
|
27
|
+
.then(() => process.exit(0))
|
|
28
|
+
.catch((err) => {
|
|
29
|
+
console.error(err);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Validates Marketplace tool manifests. */
|
|
2
|
+
const ID_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
3
|
+
const VERSION_PATTERN = /^\d+\.\d+\.\d+/;
|
|
4
|
+
const CATEGORIES = [
|
|
5
|
+
'media',
|
|
6
|
+
'search',
|
|
7
|
+
'analytics',
|
|
8
|
+
'integration',
|
|
9
|
+
'embedding',
|
|
10
|
+
'ai',
|
|
11
|
+
'automation',
|
|
12
|
+
'utility',
|
|
13
|
+
];
|
|
14
|
+
const PRICING = ['free', 'pro', 'enterprise'];
|
|
15
|
+
export function validateToolManifest(manifest) {
|
|
16
|
+
const errors = [];
|
|
17
|
+
if (!manifest || typeof manifest !== 'object') {
|
|
18
|
+
return { valid: false, errors: ['manifest must be an object'] };
|
|
19
|
+
}
|
|
20
|
+
const m = manifest;
|
|
21
|
+
const requireString = (key) => {
|
|
22
|
+
if (typeof m[key] !== 'string' || !m[key])
|
|
23
|
+
errors.push(`"${key}" is required`);
|
|
24
|
+
};
|
|
25
|
+
requireString('id');
|
|
26
|
+
if (typeof m.id === 'string' && !ID_PATTERN.test(m.id)) {
|
|
27
|
+
errors.push('"id" must be lowercase alphanumeric with hyphens, e.g. "video-audio"');
|
|
28
|
+
}
|
|
29
|
+
requireString('name');
|
|
30
|
+
requireString('description');
|
|
31
|
+
requireString('icon');
|
|
32
|
+
requireString('packageName');
|
|
33
|
+
requireString('installSize');
|
|
34
|
+
requireString('author');
|
|
35
|
+
if (typeof m.category !== 'string' || !CATEGORIES.includes(m.category)) {
|
|
36
|
+
errors.push(`"category" must be one of: ${CATEGORIES.join(', ')}`);
|
|
37
|
+
}
|
|
38
|
+
if (typeof m.pricing !== 'string' || !PRICING.includes(m.pricing)) {
|
|
39
|
+
errors.push(`"pricing" must be one of: ${PRICING.join(', ')}`);
|
|
40
|
+
}
|
|
41
|
+
if (typeof m.version !== 'string' || !VERSION_PATTERN.test(m.version)) {
|
|
42
|
+
errors.push('"version" must be semver, e.g. "1.0.0"');
|
|
43
|
+
}
|
|
44
|
+
if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {
|
|
45
|
+
errors.push('"capabilities" must be a non-empty array');
|
|
46
|
+
}
|
|
47
|
+
if (m.requiresSandbox !== undefined && typeof m.requiresSandbox !== 'boolean') {
|
|
48
|
+
errors.push('"requiresSandbox" must be a boolean when provided');
|
|
49
|
+
}
|
|
50
|
+
return { valid: errors.length === 0, errors };
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larkup/marketplace",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"@aws-sdk/s3-request-presigner": "^3.700.0",
|
|
26
26
|
"drizzle-orm": "^0.45.2",
|
|
27
27
|
"postgres": "^3.4.9",
|
|
28
|
-
"
|
|
28
|
+
"tsx": "^4.23.5",
|
|
29
|
+
"@larkup/core": "0.5.1"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@types/node": "^26",
|
|
32
33
|
"dotenv": "^17.4.2",
|
|
33
34
|
"drizzle-kit": "^0.31.10",
|
|
34
|
-
"tsx": "^4.23.5",
|
|
35
35
|
"typescript": "^7.0.2",
|
|
36
36
|
"vitest": "^4.1.10"
|
|
37
37
|
},
|