@shard-for-obsidian/lib 0.3.1 → 0.3.3
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/dist/marketplace/index.d.ts +2 -0
- package/dist/marketplace/index.d.ts.map +1 -1
- package/dist/marketplace/index.js +2 -0
- package/dist/marketplace/oci-to-markdown.d.ts +20 -0
- package/dist/marketplace/oci-to-markdown.d.ts.map +1 -0
- package/dist/marketplace/oci-to-markdown.js +48 -0
- package/dist/marketplace/version-grouping.d.ts +30 -0
- package/dist/marketplace/version-grouping.d.ts.map +1 -0
- package/dist/marketplace/version-grouping.js +51 -0
- package/dist/oci/tags.d.ts +1 -0
- package/dist/oci/tags.d.ts.map +1 -1
- package/dist/oci/tags.js +3 -0
- package/dist/schemas/annotations.d.ts +5 -1
- package/dist/schemas/annotations.d.ts.map +1 -1
- package/dist/schemas/annotations.js +4 -2
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/marketplace.d.ts +78 -26
- package/dist/schemas/marketplace.d.ts.map +1 -1
- package/dist/schemas/marketplace.js +6 -2
- package/dist/schemas/transforms.d.ts +3 -10
- package/dist/schemas/transforms.d.ts.map +1 -1
- package/dist/schemas/transforms.js +11 -23
- package/package.json +3 -1
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { MarketplaceClient, DEFAULT_MARKETPLACE_URL, type MarketplaceClientOptions, } from "./client.js";
|
|
2
|
+
export { ociAnnotationsToFrontmatter, type PluginFrontmatter } from './oci-to-markdown.js';
|
|
3
|
+
export { groupVersionsBySha, sortTagsByPriority, type RawVersion, type GroupedVersion, } from './version-grouping.js';
|
|
2
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/marketplace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/marketplace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,2BAA2B,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE3F,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,GACpB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frontmatter structure for marketplace markdown files
|
|
3
|
+
*/
|
|
4
|
+
export interface PluginFrontmatter {
|
|
5
|
+
id: string;
|
|
6
|
+
registryUrl: string;
|
|
7
|
+
name: string;
|
|
8
|
+
author: string;
|
|
9
|
+
description: string;
|
|
10
|
+
license?: string;
|
|
11
|
+
minObsidianVersion?: string;
|
|
12
|
+
authorUrl?: string;
|
|
13
|
+
repository?: string;
|
|
14
|
+
tags?: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Transform OCI annotations to markdown frontmatter structure
|
|
18
|
+
*/
|
|
19
|
+
export declare function ociAnnotationsToFrontmatter(annotations: Record<string, string>, registryUrl: string): PluginFrontmatter;
|
|
20
|
+
//# sourceMappingURL=oci-to-markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oci-to-markdown.d.ts","sourceRoot":"","sources":["../../src/marketplace/oci-to-markdown.ts"],"names":[],"mappings":"AAqBA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,WAAW,EAAE,MAAM,GAClB,iBAAiB,CA2BnB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Schema for OCI manifest annotations from Shard packages
|
|
4
|
+
*/
|
|
5
|
+
const OciAnnotationsSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
'org.opencontainers.image.title': z.string().optional(),
|
|
8
|
+
'org.opencontainers.image.description': z.string().optional(),
|
|
9
|
+
'org.opencontainers.image.created': z.string().optional(),
|
|
10
|
+
'org.opencontainers.image.source': z.string().optional(),
|
|
11
|
+
'org.opencontainers.image.licenses': z.string().optional(),
|
|
12
|
+
'vnd.obsidianmd.plugin.id': z.string(),
|
|
13
|
+
'vnd.obsidianmd.plugin.name': z.string(),
|
|
14
|
+
'vnd.obsidianmd.plugin.author': z.string(),
|
|
15
|
+
'vnd.obsidianmd.plugin.description': z.string(),
|
|
16
|
+
'vnd.obsidianmd.plugin.source': z.string().optional(),
|
|
17
|
+
'vnd.obsidianmd.plugin.min-app-version': z.string().optional(),
|
|
18
|
+
})
|
|
19
|
+
.passthrough();
|
|
20
|
+
/**
|
|
21
|
+
* Transform OCI annotations to markdown frontmatter structure
|
|
22
|
+
*/
|
|
23
|
+
export function ociAnnotationsToFrontmatter(annotations, registryUrl) {
|
|
24
|
+
// Validate input
|
|
25
|
+
const validated = OciAnnotationsSchema.parse(annotations);
|
|
26
|
+
// Build frontmatter object
|
|
27
|
+
const frontmatter = {
|
|
28
|
+
id: validated['vnd.obsidianmd.plugin.id'],
|
|
29
|
+
name: validated['vnd.obsidianmd.plugin.name'],
|
|
30
|
+
author: validated['vnd.obsidianmd.plugin.author'],
|
|
31
|
+
description: validated['vnd.obsidianmd.plugin.description'],
|
|
32
|
+
registryUrl,
|
|
33
|
+
};
|
|
34
|
+
// Add optional fields
|
|
35
|
+
if (validated['vnd.obsidianmd.plugin.source']) {
|
|
36
|
+
frontmatter.repository = validated['vnd.obsidianmd.plugin.source'];
|
|
37
|
+
}
|
|
38
|
+
else if (validated['org.opencontainers.image.source']) {
|
|
39
|
+
frontmatter.repository = validated['org.opencontainers.image.source'];
|
|
40
|
+
}
|
|
41
|
+
if (validated['org.opencontainers.image.licenses']) {
|
|
42
|
+
frontmatter.license = validated['org.opencontainers.image.licenses'];
|
|
43
|
+
}
|
|
44
|
+
if (validated['vnd.obsidianmd.plugin.min-app-version']) {
|
|
45
|
+
frontmatter.minObsidianVersion = validated['vnd.obsidianmd.plugin.min-app-version'];
|
|
46
|
+
}
|
|
47
|
+
return frontmatter;
|
|
48
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version information before grouping
|
|
3
|
+
*/
|
|
4
|
+
export interface RawVersion {
|
|
5
|
+
tag: string;
|
|
6
|
+
sha: string;
|
|
7
|
+
publishedAt: string;
|
|
8
|
+
size: number;
|
|
9
|
+
annotations: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Version information after grouping by SHA
|
|
13
|
+
*/
|
|
14
|
+
export interface GroupedVersion {
|
|
15
|
+
sha: string;
|
|
16
|
+
canonicalTag: string;
|
|
17
|
+
additionalTags: string[];
|
|
18
|
+
publishedAt: string;
|
|
19
|
+
size: number;
|
|
20
|
+
annotations: Record<string, string>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Sort tags by priority: full semver > partial semver > other
|
|
24
|
+
*/
|
|
25
|
+
export declare function sortTagsByPriority(tags: string[]): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Group versions by SHA digest, selecting canonical tag
|
|
28
|
+
*/
|
|
29
|
+
export declare function groupVersionsBySha(versions: RawVersion[]): GroupedVersion[];
|
|
30
|
+
//# sourceMappingURL=version-grouping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-grouping.d.ts","sourceRoot":"","sources":["../../src/marketplace/version-grouping.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAY3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,cAAc,EAAE,CA6C3E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sort tags by priority: full semver > partial semver > other
|
|
3
|
+
*/
|
|
4
|
+
export function sortTagsByPriority(tags) {
|
|
5
|
+
return tags.sort((a, b) => {
|
|
6
|
+
// Full semver (X.Y.Z) has highest priority
|
|
7
|
+
const aIsFullSemver = /^\d+\.\d+\.\d+/.test(a);
|
|
8
|
+
const bIsFullSemver = /^\d+\.\d+\.\d+/.test(b);
|
|
9
|
+
if (aIsFullSemver && !bIsFullSemver)
|
|
10
|
+
return -1;
|
|
11
|
+
if (!aIsFullSemver && bIsFullSemver)
|
|
12
|
+
return 1;
|
|
13
|
+
// Both same type: lexicographic comparison (numeric-aware, descending)
|
|
14
|
+
return b.localeCompare(a, undefined, { numeric: true });
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Group versions by SHA digest, selecting canonical tag
|
|
19
|
+
*/
|
|
20
|
+
export function groupVersionsBySha(versions) {
|
|
21
|
+
// Build map of SHA -> version data
|
|
22
|
+
const versionMap = new Map();
|
|
23
|
+
for (const version of versions) {
|
|
24
|
+
const existing = versionMap.get(version.sha);
|
|
25
|
+
if (existing) {
|
|
26
|
+
existing.tags.push(version.tag);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
versionMap.set(version.sha, {
|
|
30
|
+
tags: [version.tag],
|
|
31
|
+
publishedAt: version.publishedAt,
|
|
32
|
+
size: version.size,
|
|
33
|
+
annotations: version.annotations,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Convert to grouped versions with canonical tag selection
|
|
38
|
+
const grouped = Array.from(versionMap.entries()).map(([sha, data]) => {
|
|
39
|
+
const sorted = sortTagsByPriority(data.tags);
|
|
40
|
+
return {
|
|
41
|
+
sha,
|
|
42
|
+
canonicalTag: sorted[0],
|
|
43
|
+
additionalTags: sorted.slice(1),
|
|
44
|
+
publishedAt: data.publishedAt,
|
|
45
|
+
size: data.size,
|
|
46
|
+
annotations: data.annotations,
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
// Sort grouped versions by canonical tag (descending)
|
|
50
|
+
return grouped.sort((a, b) => sortTagsByPriority([a.canonicalTag, b.canonicalTag])[0] === a.canonicalTag ? -1 : 1);
|
|
51
|
+
}
|
package/dist/oci/tags.d.ts
CHANGED
package/dist/oci/tags.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/oci/tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAyED;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,MAAM,EAAE,CAAC,CAsCnB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/oci/tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAyED;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,MAAM,EAAE,CAAC,CAsCnB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,WAAW,CAAC,CAyDtB"}
|
package/dist/oci/tags.js
CHANGED
|
@@ -121,12 +121,15 @@ export async function queryTagMetadata(opts) {
|
|
|
121
121
|
throw new Error(`Failed to query tag metadata: ${response.status} ${response.statusText}`);
|
|
122
122
|
}
|
|
123
123
|
const manifest = (await response.json());
|
|
124
|
+
// Extract digest from Docker-Content-Digest header
|
|
125
|
+
const digest = response.headers.get("docker-content-digest") || "";
|
|
124
126
|
// Extract metadata
|
|
125
127
|
const publishedAt = manifest.created || new Date().toISOString();
|
|
126
128
|
const layerSizes = manifest.layers?.map((l) => l.size) || [];
|
|
127
129
|
const size = layerSizes.reduce((sum, s) => sum + s, 0);
|
|
128
130
|
const annotations = manifest.annotations || {};
|
|
129
131
|
return {
|
|
132
|
+
digest,
|
|
130
133
|
publishedAt,
|
|
131
134
|
size,
|
|
132
135
|
annotations,
|
|
@@ -14,7 +14,7 @@ export declare const PluginAnnotationsSchema: z.ZodObject<{
|
|
|
14
14
|
"vnd.obsidianmd.plugin.description": z.ZodString;
|
|
15
15
|
/** Plugin author */
|
|
16
16
|
"vnd.obsidianmd.plugin.author": z.ZodString;
|
|
17
|
-
/**
|
|
17
|
+
/** Source URL (e.g., https://github.com/owner/repo) */
|
|
18
18
|
"vnd.obsidianmd.plugin.source": z.ZodString;
|
|
19
19
|
/** Publication timestamp (ISO 8601) */
|
|
20
20
|
"vnd.obsidianmd.plugin.published-at": z.ZodString;
|
|
@@ -34,6 +34,8 @@ export declare const PluginAnnotationsSchema: z.ZodObject<{
|
|
|
34
34
|
"org.opencontainers.image.source": z.ZodString;
|
|
35
35
|
/** OCI standard: Plugin title */
|
|
36
36
|
"org.opencontainers.image.title": z.ZodString;
|
|
37
|
+
/** OCI standard: Plugin description */
|
|
38
|
+
"org.opencontainers.image.description": z.ZodOptional<z.ZodString>;
|
|
37
39
|
/** OCI standard: Creation timestamp (RFC 3339) */
|
|
38
40
|
"org.opencontainers.image.created": z.ZodString;
|
|
39
41
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -53,6 +55,7 @@ export declare const PluginAnnotationsSchema: z.ZodObject<{
|
|
|
53
55
|
"vnd.obsidianmd.plugin.funding-url"?: string | undefined;
|
|
54
56
|
"vnd.obsidianmd.plugin.converted"?: string | undefined;
|
|
55
57
|
"vnd.obsidianmd.plugin.author-url"?: string | undefined;
|
|
58
|
+
"org.opencontainers.image.description"?: string | undefined;
|
|
56
59
|
}, {
|
|
57
60
|
"org.opencontainers.image.title": string;
|
|
58
61
|
"vnd.obsidianmd.plugin.id": string;
|
|
@@ -70,6 +73,7 @@ export declare const PluginAnnotationsSchema: z.ZodObject<{
|
|
|
70
73
|
"vnd.obsidianmd.plugin.funding-url"?: string | undefined;
|
|
71
74
|
"vnd.obsidianmd.plugin.converted"?: string | undefined;
|
|
72
75
|
"vnd.obsidianmd.plugin.author-url"?: string | undefined;
|
|
76
|
+
"org.opencontainers.image.description"?: string | undefined;
|
|
73
77
|
}>;
|
|
74
78
|
/**
|
|
75
79
|
* Inferred TypeScript type from schema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/schemas/annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IAClC,gBAAgB;;IAEhB,mBAAmB;;IAEnB,qBAAqB;;IAErB,yBAAyB;;IAEzB,oBAAoB;;IAEpB,
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/schemas/annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IAClC,gBAAgB;;IAEhB,mBAAmB;;IAEnB,qBAAqB;;IAErB,yBAAyB;;IAEzB,oBAAoB;;IAEpB,uDAAuD;;IAEvD,uCAAuC;;IAEvC,iEAAiE;;IAEjE,gEAAgE;;IAEhE,oEAAoE;;IAEpE,wDAAwD;;IAExD,iBAAiB;;IAEjB,mDAAmD;;IAEnD,sCAAsC;;IAEtC,iCAAiC;;IAEjC,uCAAuC;;IAEvC,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAElD,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -14,8 +14,8 @@ export const PluginAnnotationsSchema = z.object({
|
|
|
14
14
|
"vnd.obsidianmd.plugin.description": z.string(),
|
|
15
15
|
/** Plugin author */
|
|
16
16
|
"vnd.obsidianmd.plugin.author": z.string(),
|
|
17
|
-
/**
|
|
18
|
-
"vnd.obsidianmd.plugin.source": z.string().
|
|
17
|
+
/** Source URL (e.g., https://github.com/owner/repo) */
|
|
18
|
+
"vnd.obsidianmd.plugin.source": z.string().url(),
|
|
19
19
|
/** Publication timestamp (ISO 8601) */
|
|
20
20
|
"vnd.obsidianmd.plugin.published-at": z.string().datetime(),
|
|
21
21
|
/** Plugin introduction from community-plugins.json (required) */
|
|
@@ -34,6 +34,8 @@ export const PluginAnnotationsSchema = z.object({
|
|
|
34
34
|
"org.opencontainers.image.source": z.string().url(),
|
|
35
35
|
/** OCI standard: Plugin title */
|
|
36
36
|
"org.opencontainers.image.title": z.string(),
|
|
37
|
+
/** OCI standard: Plugin description */
|
|
38
|
+
"org.opencontainers.image.description": z.string().optional(),
|
|
37
39
|
/** OCI standard: Creation timestamp (RFC 3339) */
|
|
38
40
|
"org.opencontainers.image.created": z.string().datetime(),
|
|
39
41
|
});
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ObsidianManifestSchema, type ObsidianManifest } from "./manifest.js";
|
|
2
2
|
export { PluginAnnotationsSchema, type PluginAnnotations, } from "./annotations.js";
|
|
3
3
|
export { PluginVersionSchema, MarketplacePluginSchema, MarketplaceIndexSchema, CachedMarketplaceDataSchema, type PluginVersion, type MarketplacePlugin, type MarketplaceIndex, type CachedMarketplaceData, } from "./marketplace.js";
|
|
4
|
-
export {
|
|
4
|
+
export { repoToGitHubUrl, ghcrUrlToGitHubRepo, manifestToAnnotations, manifestToAnnotationsLegacy, annotationsToMarketplacePlugin, type CommunityPluginMetadata, } from "./transforms.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,2BAA2B,EAC3B,8BAA8B,EAC9B,KAAK,uBAAuB,GAC7B,MAAM,iBAAiB,CAAC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -3,4 +3,4 @@ export { ObsidianManifestSchema } from "./manifest.js";
|
|
|
3
3
|
export { PluginAnnotationsSchema, } from "./annotations.js";
|
|
4
4
|
export { PluginVersionSchema, MarketplacePluginSchema, MarketplaceIndexSchema, CachedMarketplaceDataSchema, } from "./marketplace.js";
|
|
5
5
|
// Transform utilities
|
|
6
|
-
export {
|
|
6
|
+
export { repoToGitHubUrl, ghcrUrlToGitHubRepo, manifestToAnnotations, manifestToAnnotationsLegacy, annotationsToMarketplacePlugin, } from "./transforms.js";
|
|
@@ -3,8 +3,12 @@ import { z } from "zod";
|
|
|
3
3
|
* Plugin version information from OCI registry
|
|
4
4
|
*/
|
|
5
5
|
export declare const PluginVersionSchema: z.ZodObject<{
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/** Canonical version tag (highest priority) */
|
|
7
|
+
canonicalTag: z.ZodString;
|
|
8
|
+
/** Additional tags pointing to same SHA */
|
|
9
|
+
additionalTags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
/** SHA digest */
|
|
11
|
+
sha: z.ZodString;
|
|
8
12
|
/** Publication timestamp (ISO 8601) */
|
|
9
13
|
publishedAt: z.ZodString;
|
|
10
14
|
/** Size in bytes */
|
|
@@ -14,13 +18,17 @@ export declare const PluginVersionSchema: z.ZodObject<{
|
|
|
14
18
|
}, "strip", z.ZodTypeAny, {
|
|
15
19
|
size: number;
|
|
16
20
|
annotations: Record<string, string>;
|
|
17
|
-
|
|
21
|
+
canonicalTag: string;
|
|
22
|
+
sha: string;
|
|
18
23
|
publishedAt: string;
|
|
24
|
+
additionalTags?: string[] | undefined;
|
|
19
25
|
}, {
|
|
20
26
|
size: number;
|
|
21
27
|
annotations: Record<string, string>;
|
|
22
|
-
|
|
28
|
+
canonicalTag: string;
|
|
29
|
+
sha: string;
|
|
23
30
|
publishedAt: string;
|
|
31
|
+
additionalTags?: string[] | undefined;
|
|
24
32
|
}>;
|
|
25
33
|
/**
|
|
26
34
|
* Marketplace plugin information
|
|
@@ -51,8 +59,12 @@ export declare const MarketplacePluginSchema: z.ZodObject<{
|
|
|
51
59
|
introduction: z.ZodOptional<z.ZodString>;
|
|
52
60
|
/** Available versions from OCI */
|
|
53
61
|
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
54
|
-
/**
|
|
55
|
-
|
|
62
|
+
/** Canonical version tag (highest priority) */
|
|
63
|
+
canonicalTag: z.ZodString;
|
|
64
|
+
/** Additional tags pointing to same SHA */
|
|
65
|
+
additionalTags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
66
|
+
/** SHA digest */
|
|
67
|
+
sha: z.ZodString;
|
|
56
68
|
/** Publication timestamp (ISO 8601) */
|
|
57
69
|
publishedAt: z.ZodString;
|
|
58
70
|
/** Size in bytes */
|
|
@@ -62,13 +74,17 @@ export declare const MarketplacePluginSchema: z.ZodObject<{
|
|
|
62
74
|
}, "strip", z.ZodTypeAny, {
|
|
63
75
|
size: number;
|
|
64
76
|
annotations: Record<string, string>;
|
|
65
|
-
|
|
77
|
+
canonicalTag: string;
|
|
78
|
+
sha: string;
|
|
66
79
|
publishedAt: string;
|
|
80
|
+
additionalTags?: string[] | undefined;
|
|
67
81
|
}, {
|
|
68
82
|
size: number;
|
|
69
83
|
annotations: Record<string, string>;
|
|
70
|
-
|
|
84
|
+
canonicalTag: string;
|
|
85
|
+
sha: string;
|
|
71
86
|
publishedAt: string;
|
|
87
|
+
additionalTags?: string[] | undefined;
|
|
72
88
|
}>, "many">>;
|
|
73
89
|
}, "strip", z.ZodTypeAny, {
|
|
74
90
|
id: string;
|
|
@@ -85,8 +101,10 @@ export declare const MarketplacePluginSchema: z.ZodObject<{
|
|
|
85
101
|
versions?: {
|
|
86
102
|
size: number;
|
|
87
103
|
annotations: Record<string, string>;
|
|
88
|
-
|
|
104
|
+
canonicalTag: string;
|
|
105
|
+
sha: string;
|
|
89
106
|
publishedAt: string;
|
|
107
|
+
additionalTags?: string[] | undefined;
|
|
90
108
|
}[] | undefined;
|
|
91
109
|
}, {
|
|
92
110
|
id: string;
|
|
@@ -103,8 +121,10 @@ export declare const MarketplacePluginSchema: z.ZodObject<{
|
|
|
103
121
|
versions?: {
|
|
104
122
|
size: number;
|
|
105
123
|
annotations: Record<string, string>;
|
|
106
|
-
|
|
124
|
+
canonicalTag: string;
|
|
125
|
+
sha: string;
|
|
107
126
|
publishedAt: string;
|
|
127
|
+
additionalTags?: string[] | undefined;
|
|
108
128
|
}[] | undefined;
|
|
109
129
|
}>;
|
|
110
130
|
/**
|
|
@@ -137,8 +157,12 @@ export declare const MarketplaceIndexSchema: z.ZodObject<{
|
|
|
137
157
|
introduction: z.ZodOptional<z.ZodString>;
|
|
138
158
|
/** Available versions from OCI */
|
|
139
159
|
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
140
|
-
/**
|
|
141
|
-
|
|
160
|
+
/** Canonical version tag (highest priority) */
|
|
161
|
+
canonicalTag: z.ZodString;
|
|
162
|
+
/** Additional tags pointing to same SHA */
|
|
163
|
+
additionalTags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
164
|
+
/** SHA digest */
|
|
165
|
+
sha: z.ZodString;
|
|
142
166
|
/** Publication timestamp (ISO 8601) */
|
|
143
167
|
publishedAt: z.ZodString;
|
|
144
168
|
/** Size in bytes */
|
|
@@ -148,13 +172,17 @@ export declare const MarketplaceIndexSchema: z.ZodObject<{
|
|
|
148
172
|
}, "strip", z.ZodTypeAny, {
|
|
149
173
|
size: number;
|
|
150
174
|
annotations: Record<string, string>;
|
|
151
|
-
|
|
175
|
+
canonicalTag: string;
|
|
176
|
+
sha: string;
|
|
152
177
|
publishedAt: string;
|
|
178
|
+
additionalTags?: string[] | undefined;
|
|
153
179
|
}, {
|
|
154
180
|
size: number;
|
|
155
181
|
annotations: Record<string, string>;
|
|
156
|
-
|
|
182
|
+
canonicalTag: string;
|
|
183
|
+
sha: string;
|
|
157
184
|
publishedAt: string;
|
|
185
|
+
additionalTags?: string[] | undefined;
|
|
158
186
|
}>, "many">>;
|
|
159
187
|
}, "strip", z.ZodTypeAny, {
|
|
160
188
|
id: string;
|
|
@@ -171,8 +199,10 @@ export declare const MarketplaceIndexSchema: z.ZodObject<{
|
|
|
171
199
|
versions?: {
|
|
172
200
|
size: number;
|
|
173
201
|
annotations: Record<string, string>;
|
|
174
|
-
|
|
202
|
+
canonicalTag: string;
|
|
203
|
+
sha: string;
|
|
175
204
|
publishedAt: string;
|
|
205
|
+
additionalTags?: string[] | undefined;
|
|
176
206
|
}[] | undefined;
|
|
177
207
|
}, {
|
|
178
208
|
id: string;
|
|
@@ -189,8 +219,10 @@ export declare const MarketplaceIndexSchema: z.ZodObject<{
|
|
|
189
219
|
versions?: {
|
|
190
220
|
size: number;
|
|
191
221
|
annotations: Record<string, string>;
|
|
192
|
-
|
|
222
|
+
canonicalTag: string;
|
|
223
|
+
sha: string;
|
|
193
224
|
publishedAt: string;
|
|
225
|
+
additionalTags?: string[] | undefined;
|
|
194
226
|
}[] | undefined;
|
|
195
227
|
}>, "many">;
|
|
196
228
|
/** Generation timestamp (ISO 8601) */
|
|
@@ -211,8 +243,10 @@ export declare const MarketplaceIndexSchema: z.ZodObject<{
|
|
|
211
243
|
versions?: {
|
|
212
244
|
size: number;
|
|
213
245
|
annotations: Record<string, string>;
|
|
214
|
-
|
|
246
|
+
canonicalTag: string;
|
|
247
|
+
sha: string;
|
|
215
248
|
publishedAt: string;
|
|
249
|
+
additionalTags?: string[] | undefined;
|
|
216
250
|
}[] | undefined;
|
|
217
251
|
}[];
|
|
218
252
|
generatedAt: string;
|
|
@@ -232,8 +266,10 @@ export declare const MarketplaceIndexSchema: z.ZodObject<{
|
|
|
232
266
|
versions?: {
|
|
233
267
|
size: number;
|
|
234
268
|
annotations: Record<string, string>;
|
|
235
|
-
|
|
269
|
+
canonicalTag: string;
|
|
270
|
+
sha: string;
|
|
236
271
|
publishedAt: string;
|
|
272
|
+
additionalTags?: string[] | undefined;
|
|
237
273
|
}[] | undefined;
|
|
238
274
|
}[];
|
|
239
275
|
generatedAt: string;
|
|
@@ -268,8 +304,12 @@ export declare const CachedMarketplaceDataSchema: z.ZodObject<{
|
|
|
268
304
|
introduction: z.ZodOptional<z.ZodString>;
|
|
269
305
|
/** Available versions from OCI */
|
|
270
306
|
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
271
|
-
/**
|
|
272
|
-
|
|
307
|
+
/** Canonical version tag (highest priority) */
|
|
308
|
+
canonicalTag: z.ZodString;
|
|
309
|
+
/** Additional tags pointing to same SHA */
|
|
310
|
+
additionalTags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
311
|
+
/** SHA digest */
|
|
312
|
+
sha: z.ZodString;
|
|
273
313
|
/** Publication timestamp (ISO 8601) */
|
|
274
314
|
publishedAt: z.ZodString;
|
|
275
315
|
/** Size in bytes */
|
|
@@ -279,13 +319,17 @@ export declare const CachedMarketplaceDataSchema: z.ZodObject<{
|
|
|
279
319
|
}, "strip", z.ZodTypeAny, {
|
|
280
320
|
size: number;
|
|
281
321
|
annotations: Record<string, string>;
|
|
282
|
-
|
|
322
|
+
canonicalTag: string;
|
|
323
|
+
sha: string;
|
|
283
324
|
publishedAt: string;
|
|
325
|
+
additionalTags?: string[] | undefined;
|
|
284
326
|
}, {
|
|
285
327
|
size: number;
|
|
286
328
|
annotations: Record<string, string>;
|
|
287
|
-
|
|
329
|
+
canonicalTag: string;
|
|
330
|
+
sha: string;
|
|
288
331
|
publishedAt: string;
|
|
332
|
+
additionalTags?: string[] | undefined;
|
|
289
333
|
}>, "many">>;
|
|
290
334
|
}, "strip", z.ZodTypeAny, {
|
|
291
335
|
id: string;
|
|
@@ -302,8 +346,10 @@ export declare const CachedMarketplaceDataSchema: z.ZodObject<{
|
|
|
302
346
|
versions?: {
|
|
303
347
|
size: number;
|
|
304
348
|
annotations: Record<string, string>;
|
|
305
|
-
|
|
349
|
+
canonicalTag: string;
|
|
350
|
+
sha: string;
|
|
306
351
|
publishedAt: string;
|
|
352
|
+
additionalTags?: string[] | undefined;
|
|
307
353
|
}[] | undefined;
|
|
308
354
|
}, {
|
|
309
355
|
id: string;
|
|
@@ -320,8 +366,10 @@ export declare const CachedMarketplaceDataSchema: z.ZodObject<{
|
|
|
320
366
|
versions?: {
|
|
321
367
|
size: number;
|
|
322
368
|
annotations: Record<string, string>;
|
|
323
|
-
|
|
369
|
+
canonicalTag: string;
|
|
370
|
+
sha: string;
|
|
324
371
|
publishedAt: string;
|
|
372
|
+
additionalTags?: string[] | undefined;
|
|
325
373
|
}[] | undefined;
|
|
326
374
|
}>, "many">;
|
|
327
375
|
/** Fetch timestamp (Unix epoch milliseconds) */
|
|
@@ -342,8 +390,10 @@ export declare const CachedMarketplaceDataSchema: z.ZodObject<{
|
|
|
342
390
|
versions?: {
|
|
343
391
|
size: number;
|
|
344
392
|
annotations: Record<string, string>;
|
|
345
|
-
|
|
393
|
+
canonicalTag: string;
|
|
394
|
+
sha: string;
|
|
346
395
|
publishedAt: string;
|
|
396
|
+
additionalTags?: string[] | undefined;
|
|
347
397
|
}[] | undefined;
|
|
348
398
|
}[];
|
|
349
399
|
fetchedAt: number;
|
|
@@ -363,8 +413,10 @@ export declare const CachedMarketplaceDataSchema: z.ZodObject<{
|
|
|
363
413
|
versions?: {
|
|
364
414
|
size: number;
|
|
365
415
|
annotations: Record<string, string>;
|
|
366
|
-
|
|
416
|
+
canonicalTag: string;
|
|
417
|
+
sha: string;
|
|
367
418
|
publishedAt: string;
|
|
419
|
+
additionalTags?: string[] | undefined;
|
|
368
420
|
}[] | undefined;
|
|
369
421
|
}[];
|
|
370
422
|
fetchedAt: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../../src/schemas/marketplace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAC9B,
|
|
1
|
+
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../../src/schemas/marketplace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAC9B,+CAA+C;;IAE/C,2CAA2C;;IAE3C,iBAAiB;;IAEjB,uCAAuC;;IAEvC,oBAAoB;;IAEpB,+BAA+B;;;;;;;;;;;;;;;;EAE/B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IAElC,gBAAgB;;IAEhB,kDAAkD;;IAIlD,mBAAmB;;IAEnB,oBAAoB;;IAEpB,yBAAyB;;IAIzB,yBAAyB;;IAEzB,wCAAwC;;IAExC,iBAAiB;;IAIjB,6DAA6D;;IAE7D,oBAAoB;;IAIpB,oCAAoC;;IAEpC,kCAAkC;;QAlDlC,+CAA+C;;QAE/C,2CAA2C;;QAE3C,iBAAiB;;QAEjB,uCAAuC;;QAEvC,oBAAoB;;QAEpB,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0C/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;IACjC,sBAAsB;;QAtCtB,gBAAgB;;QAEhB,kDAAkD;;QAIlD,mBAAmB;;QAEnB,oBAAoB;;QAEpB,yBAAyB;;QAIzB,yBAAyB;;QAEzB,wCAAwC;;QAExC,iBAAiB;;QAIjB,6DAA6D;;QAE7D,oBAAoB;;QAIpB,oCAAoC;;QAEpC,kCAAkC;;YAlDlC,+CAA+C;;YAE/C,2CAA2C;;YAE3C,iBAAiB;;YAEjB,uCAAuC;;YAEvC,oBAAoB;;YAEpB,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkD/B,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B;IACtC,sBAAsB;;QAhDtB,gBAAgB;;QAEhB,kDAAkD;;QAIlD,mBAAmB;;QAEnB,oBAAoB;;QAEpB,yBAAyB;;QAIzB,yBAAyB;;QAEzB,wCAAwC;;QAExC,iBAAiB;;QAIjB,6DAA6D;;QAE7D,oBAAoB;;QAIpB,oCAAoC;;QAEpC,kCAAkC;;YAlDlC,+CAA+C;;YAE/C,2CAA2C;;YAE3C,iBAAiB;;YAEjB,uCAAuC;;YAEvC,oBAAoB;;YAEpB,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4D/B,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEhD,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -3,8 +3,12 @@ import { z } from "zod";
|
|
|
3
3
|
* Plugin version information from OCI registry
|
|
4
4
|
*/
|
|
5
5
|
export const PluginVersionSchema = z.object({
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/** Canonical version tag (highest priority) */
|
|
7
|
+
canonicalTag: z.string(),
|
|
8
|
+
/** Additional tags pointing to same SHA */
|
|
9
|
+
additionalTags: z.array(z.string()).optional(),
|
|
10
|
+
/** SHA digest */
|
|
11
|
+
sha: z.string(),
|
|
8
12
|
/** Publication timestamp (ISO 8601) */
|
|
9
13
|
publishedAt: z.string(),
|
|
10
14
|
/** Size in bytes */
|
|
@@ -2,19 +2,12 @@ import type { ObsidianManifest } from "./manifest.js";
|
|
|
2
2
|
import type { PluginAnnotations } from "./annotations.js";
|
|
3
3
|
import type { MarketplacePlugin } from "./marketplace.js";
|
|
4
4
|
/**
|
|
5
|
-
* Convert GitHub repo format to
|
|
5
|
+
* Convert GitHub repo format to GitHub URL
|
|
6
6
|
* @param repo - Repository in "owner/repo" format
|
|
7
|
-
* @returns VCS URL in "git+https://github.com/owner/repo.git" format
|
|
8
|
-
* @throws Error if repo format is invalid
|
|
9
|
-
*/
|
|
10
|
-
export declare function repoToVcsUrl(repo: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Extract GitHub URL from VCS URL
|
|
13
|
-
* @param vcsUrl - VCS URL in "git+https://..." format
|
|
14
7
|
* @returns GitHub URL in "https://github.com/owner/repo" format
|
|
15
|
-
* @throws Error if
|
|
8
|
+
* @throws Error if repo format is invalid
|
|
16
9
|
*/
|
|
17
|
-
export declare function
|
|
10
|
+
export declare function repoToGitHubUrl(repo: string): string;
|
|
18
11
|
/**
|
|
19
12
|
* Extract GitHub repository URL from GHCR registry URL
|
|
20
13
|
* @param registryUrl - GHCR URL (e.g., "ghcr.io/owner/repo/path")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../src/schemas/transforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../src/schemas/transforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAc/D;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,iBAAiB,CAAC,CA+B5B;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,gBAAgB,EAC1B,eAAe,EAAE,uBAAuB,EACxC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAiCnB;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,iBAAiB,EAC9B,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAyBnB"}
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Convert GitHub repo format to
|
|
2
|
+
* Convert GitHub repo format to GitHub URL
|
|
3
3
|
* @param repo - Repository in "owner/repo" format
|
|
4
|
-
* @returns
|
|
4
|
+
* @returns GitHub URL in "https://github.com/owner/repo" format
|
|
5
5
|
* @throws Error if repo format is invalid
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
7
|
+
export function repoToGitHubUrl(repo) {
|
|
8
8
|
if (!repo.includes("/")) {
|
|
9
9
|
throw new Error(`Invalid repo format: ${repo}. Expected "owner/repo"`);
|
|
10
10
|
}
|
|
11
|
-
return `
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Extract GitHub URL from VCS URL
|
|
15
|
-
* @param vcsUrl - VCS URL in "git+https://..." format
|
|
16
|
-
* @returns GitHub URL in "https://github.com/owner/repo" format
|
|
17
|
-
* @throws Error if VCS URL format is invalid
|
|
18
|
-
*/
|
|
19
|
-
export function vcsUrlToGitHubUrl(vcsUrl) {
|
|
20
|
-
if (!vcsUrl.startsWith("git+")) {
|
|
21
|
-
throw new Error(`Invalid VCS URL format: ${vcsUrl}. Expected "git+https://..."`);
|
|
22
|
-
}
|
|
23
|
-
// Remove "git+" prefix and optional ".git" suffix
|
|
24
|
-
const url = vcsUrl.slice(4).replace(/\.git$/, "");
|
|
25
|
-
return url;
|
|
11
|
+
return `https://github.com/${repo}`;
|
|
26
12
|
}
|
|
27
13
|
/**
|
|
28
14
|
* Extract GitHub repository URL from GHCR registry URL
|
|
@@ -55,8 +41,9 @@ export function manifestToAnnotationsLegacy(manifest, ownerRepo, registryUrl) {
|
|
|
55
41
|
"vnd.obsidianmd.plugin.name": manifest.name,
|
|
56
42
|
"vnd.obsidianmd.plugin.version": manifest.version,
|
|
57
43
|
"vnd.obsidianmd.plugin.description": manifest.description,
|
|
44
|
+
"org.opencontainers.image.description": manifest.description,
|
|
58
45
|
"vnd.obsidianmd.plugin.author": manifest.author,
|
|
59
|
-
"vnd.obsidianmd.plugin.source":
|
|
46
|
+
"vnd.obsidianmd.plugin.source": repoToGitHubUrl(ownerRepo),
|
|
60
47
|
"vnd.obsidianmd.plugin.is-desktop-only": String(manifest.isDesktopOnly ?? false),
|
|
61
48
|
"vnd.obsidianmd.plugin.min-app-version": manifest.minAppVersion,
|
|
62
49
|
"org.opencontainers.image.source": ghcrUrlToGitHubRepo(registryUrl),
|
|
@@ -92,10 +79,11 @@ export function manifestToAnnotations(manifest, communityPlugin, registryUrl, pu
|
|
|
92
79
|
"vnd.obsidianmd.plugin.name": manifest.name,
|
|
93
80
|
"vnd.obsidianmd.plugin.version": manifest.version,
|
|
94
81
|
"vnd.obsidianmd.plugin.description": manifest.description,
|
|
82
|
+
"org.opencontainers.image.description": manifest.description,
|
|
95
83
|
"vnd.obsidianmd.plugin.author": manifest.author,
|
|
96
|
-
"vnd.obsidianmd.plugin.source":
|
|
84
|
+
"vnd.obsidianmd.plugin.source": repoToGitHubUrl(communityPlugin.repo),
|
|
97
85
|
"vnd.obsidianmd.plugin.published-at": publishedAt,
|
|
98
|
-
"vnd.obsidianmd.plugin.introduction": communityPlugin.
|
|
86
|
+
"vnd.obsidianmd.plugin.introduction": communityPlugin.description,
|
|
99
87
|
"vnd.obsidianmd.plugin.is-desktop-only": String(manifest.isDesktopOnly ?? false),
|
|
100
88
|
"vnd.obsidianmd.plugin.min-app-version": manifest.minAppVersion,
|
|
101
89
|
"org.opencontainers.image.source": ghcrUrlToGitHubRepo(registryUrl),
|
|
@@ -139,10 +127,10 @@ export function annotationsToMarketplacePlugin(annotations, registryUrl) {
|
|
|
139
127
|
plugin.minObsidianVersion =
|
|
140
128
|
annotations["vnd.obsidianmd.plugin.min-app-version"];
|
|
141
129
|
}
|
|
142
|
-
//
|
|
130
|
+
// Source is already a GitHub URL
|
|
143
131
|
const source = annotations["vnd.obsidianmd.plugin.source"];
|
|
144
132
|
if (source) {
|
|
145
|
-
plugin.repository =
|
|
133
|
+
plugin.repository = source;
|
|
146
134
|
}
|
|
147
135
|
return plugin;
|
|
148
136
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shard-for-obsidian/lib",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core library for Shard plugin management",
|
|
6
6
|
"author": "Andrew Gillis",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"zod": "^3.24.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
42
43
|
"@vitest/ui": "^4.0.18",
|
|
43
44
|
"vitest": "^4.0.18"
|
|
44
45
|
},
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"ts-check": "tsc --noEmit",
|
|
49
50
|
"lint": "eslint .",
|
|
50
51
|
"test": "vitest run",
|
|
52
|
+
"test:coverage": "vitest run --coverage",
|
|
51
53
|
"test:watch": "vitest",
|
|
52
54
|
"test:ui": "vitest --ui"
|
|
53
55
|
}
|