@open-audio-stack/core 0.1.31 → 0.1.33
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/build/classes/Manager.d.ts +3 -2
- package/build/classes/Manager.js +8 -0
- package/build/classes/Package.d.ts +4 -3
- package/build/classes/Package.js +6 -0
- package/build/helpers/package.d.ts +3 -2
- package/build/helpers/package.js +18 -15
- package/build/types/Package.d.ts +7 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Config } from './Config.js';
|
|
2
2
|
import { ConfigInterface } from '../types/Config.js';
|
|
3
3
|
import { Package } from './Package.js';
|
|
4
|
-
import { PackageVersion } from '../types/Package.js';
|
|
4
|
+
import { ManagerReport, PackageVersion } from '../types/Package.js';
|
|
5
5
|
import { RegistryPackages, RegistryType } from '../types/Registry.js';
|
|
6
6
|
import { Base } from './Base.js';
|
|
7
7
|
export declare class Manager extends Base {
|
|
@@ -12,7 +12,8 @@ export declare class Manager extends Base {
|
|
|
12
12
|
addPackage(pkg: Package): void;
|
|
13
13
|
filter(method: (pkgVersion: PackageVersion, pkg: Package) => boolean): Package[];
|
|
14
14
|
getPackage(slug: string): Package | undefined;
|
|
15
|
-
getReport():
|
|
15
|
+
getReport(): ManagerReport;
|
|
16
|
+
outputReport(): void;
|
|
16
17
|
listPackages(installed?: boolean): Package[];
|
|
17
18
|
removePackage(slug: string): void;
|
|
18
19
|
reset(): void;
|
package/build/classes/Manager.js
CHANGED
|
@@ -44,6 +44,14 @@ export class Manager extends Base {
|
|
|
44
44
|
}
|
|
45
45
|
return reports;
|
|
46
46
|
}
|
|
47
|
+
outputReport() {
|
|
48
|
+
const reports = this.getReport();
|
|
49
|
+
for (const [slug, report] of Object.entries(reports)) {
|
|
50
|
+
for (const [ver, reportVersion] of Object.entries(report)) {
|
|
51
|
+
this.logReport(`${slug}/${ver}`, reportVersion.errors, reportVersion.recs);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
47
55
|
listPackages(installed) {
|
|
48
56
|
if (installed !== undefined) {
|
|
49
57
|
const packagesFiltered = [];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PackageVersionReport, PackageVersion, PackageVersions } from '../types/Package.js';
|
|
2
2
|
import { Base } from './Base.js';
|
|
3
3
|
export declare class Package extends Base {
|
|
4
|
-
reports: Map<string,
|
|
4
|
+
reports: Map<string, PackageVersionReport>;
|
|
5
5
|
slug: string;
|
|
6
6
|
version: string;
|
|
7
7
|
versions: Map<string, PackageVersion>;
|
|
@@ -9,8 +9,9 @@ export declare class Package extends Base {
|
|
|
9
9
|
addVersion(num: string, version: PackageVersion): void;
|
|
10
10
|
removeVersion(num: string): void;
|
|
11
11
|
getReport(): {
|
|
12
|
-
[k: string]:
|
|
12
|
+
[k: string]: PackageVersionReport;
|
|
13
13
|
};
|
|
14
|
+
outputReport(): void;
|
|
14
15
|
getVersion(num: string): PackageVersion | undefined;
|
|
15
16
|
getVersionLatest(): PackageVersion | undefined;
|
|
16
17
|
getVersionOrLatest(num?: string): PackageVersion | undefined;
|
package/build/classes/Package.js
CHANGED
|
@@ -41,6 +41,12 @@ export class Package extends Base {
|
|
|
41
41
|
getReport() {
|
|
42
42
|
return Object.fromEntries(this.reports);
|
|
43
43
|
}
|
|
44
|
+
outputReport() {
|
|
45
|
+
const reports = this.getReport();
|
|
46
|
+
for (const [ver, report] of Object.entries(reports)) {
|
|
47
|
+
this.logReport(`${this.slug}/${ver}`, report.errors, report.recs);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
44
50
|
getVersion(num) {
|
|
45
51
|
return this.versions.get(num);
|
|
46
52
|
}
|
|
@@ -171,6 +171,7 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
171
171
|
changes: string;
|
|
172
172
|
description: string;
|
|
173
173
|
type: PluginType | PresetType | ProjectType;
|
|
174
|
+
url: string;
|
|
174
175
|
files: {
|
|
175
176
|
type: FileType;
|
|
176
177
|
architectures: Architecture[];
|
|
@@ -183,7 +184,6 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
183
184
|
}[];
|
|
184
185
|
url: string;
|
|
185
186
|
}[];
|
|
186
|
-
url: string;
|
|
187
187
|
image: string;
|
|
188
188
|
license: License;
|
|
189
189
|
name: string;
|
|
@@ -196,6 +196,7 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
196
196
|
changes: string;
|
|
197
197
|
description: string;
|
|
198
198
|
type: PluginType | PresetType | ProjectType;
|
|
199
|
+
url: string;
|
|
199
200
|
files: {
|
|
200
201
|
type: FileType;
|
|
201
202
|
architectures: Architecture[];
|
|
@@ -208,12 +209,12 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
208
209
|
}[];
|
|
209
210
|
url: string;
|
|
210
211
|
}[];
|
|
211
|
-
url: string;
|
|
212
212
|
image: string;
|
|
213
213
|
license: License;
|
|
214
214
|
name: string;
|
|
215
215
|
tags: string[];
|
|
216
216
|
donate?: string | undefined;
|
|
217
217
|
}>;
|
|
218
|
+
export declare const SemverValidator: z.ZodString;
|
|
218
219
|
export declare function packageRecommendations(pkgVersion: PackageVersion): PackageValidationRec[];
|
|
219
220
|
export declare function packageRecommendationsUrl(obj: PackageVersion | PluginFile | PresetFile | ProjectFile, recs: PackageValidationRec[], field: string, domain?: string): void;
|
package/build/helpers/package.js
CHANGED
|
@@ -40,36 +40,39 @@ export function packageVersionLatest(pkg) {
|
|
|
40
40
|
}
|
|
41
41
|
// This is a first version using zod library for validation.
|
|
42
42
|
// If it works well, consider updating all types to infer from Zod objects.
|
|
43
|
-
// This will remove
|
|
43
|
+
// This will remove duplication of code between types and validators.
|
|
44
44
|
export const PackageSystemValidator = z.object({
|
|
45
45
|
max: z.number().min(0).max(99).optional(),
|
|
46
46
|
min: z.number().min(0).max(99).optional(),
|
|
47
47
|
type: z.nativeEnum(SystemType),
|
|
48
48
|
});
|
|
49
49
|
export const PackageFileValidator = z.object({
|
|
50
|
-
architectures: z.nativeEnum(Architecture).array(),
|
|
50
|
+
architectures: z.nativeEnum(Architecture).array().min(1).max(Object.keys(Architecture).length),
|
|
51
51
|
sha256: z.string().length(64),
|
|
52
|
-
size: z.number().min(
|
|
53
|
-
systems: PackageSystemValidator.array(),
|
|
52
|
+
size: z.number().min(8).max(9999999999),
|
|
53
|
+
systems: PackageSystemValidator.array().min(1).max(Object.keys(SystemType).length),
|
|
54
54
|
type: z.nativeEnum(FileType),
|
|
55
|
-
url: z.string().min(
|
|
55
|
+
url: z.string().min(8).max(256).startsWith('https://'),
|
|
56
56
|
});
|
|
57
57
|
export const PackageTypeObj = { ...PluginType, ...PresetType, ...ProjectType };
|
|
58
58
|
export const PackageVersionValidator = z.object({
|
|
59
|
-
audio: z.string().min(
|
|
60
|
-
author: z.string().min(
|
|
61
|
-
changes: z.string().min(
|
|
59
|
+
audio: z.string().min(8).max(256).startsWith('https://'),
|
|
60
|
+
author: z.string().min(1).max(256),
|
|
61
|
+
changes: z.string().min(1).max(256),
|
|
62
62
|
date: z.string().datetime(),
|
|
63
|
-
description: z.string().min(
|
|
64
|
-
donate: z.optional(z.string().min(
|
|
65
|
-
files: z.array(PackageFileValidator),
|
|
66
|
-
image: z.string().min(
|
|
63
|
+
description: z.string().min(1).max(256),
|
|
64
|
+
donate: z.optional(z.string().min(8).max(256).startsWith('https://')),
|
|
65
|
+
files: z.array(PackageFileValidator).min(1).max(256),
|
|
66
|
+
image: z.string().min(8).max(256).startsWith('https://'),
|
|
67
67
|
license: z.nativeEnum(License),
|
|
68
|
-
name: z.string().min(
|
|
69
|
-
tags: z.string().min(
|
|
68
|
+
name: z.string().min(1).max(256),
|
|
69
|
+
tags: z.string().min(1).max(256).array().min(1).max(8),
|
|
70
70
|
type: z.nativeEnum(PackageTypeObj),
|
|
71
|
-
url: z.string().min(
|
|
71
|
+
url: z.string().min(8).max(256).startsWith('https://'),
|
|
72
72
|
});
|
|
73
|
+
export const SemverValidator = z
|
|
74
|
+
.string()
|
|
75
|
+
.regex(/^v?([0-9]+)\.([0-9]+)\.([0-9]+)(?:-[\w.-]+)?(?:\+[\w.-]+)?$/, 'Invalid semantic version (expected format: x.y.z or vX.Y.Z)');
|
|
73
76
|
// TODO refactor all this using a proper validation library.
|
|
74
77
|
export function packageRecommendations(pkgVersion) {
|
|
75
78
|
const recs = [];
|
package/build/types/Package.d.ts
CHANGED
|
@@ -25,10 +25,16 @@ export interface PackageBase {
|
|
|
25
25
|
tags: string[];
|
|
26
26
|
url: string;
|
|
27
27
|
}
|
|
28
|
-
export interface
|
|
28
|
+
export interface PackageVersionReport {
|
|
29
29
|
errors?: ZodIssue[];
|
|
30
30
|
recs?: PackageValidationRec[];
|
|
31
31
|
}
|
|
32
|
+
export interface PackageReport {
|
|
33
|
+
[version: string]: PackageVersionReport;
|
|
34
|
+
}
|
|
35
|
+
export interface ManagerReport {
|
|
36
|
+
[slug: string]: PackageReport;
|
|
37
|
+
}
|
|
32
38
|
export type PackageVersion = PluginInterface | PresetInterface | ProjectInterface;
|
|
33
39
|
export type PackageFile = PluginFile | PresetFile | ProjectFile;
|
|
34
40
|
export type PackageFileMap = PluginFileMap | PresetFileMap | ProjectFileMap;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-audio-stack/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
4
4
|
"description": "Open-source audio plugin management software",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"semver": "^7.6.3",
|
|
66
66
|
"slugify": "^1.6.6",
|
|
67
67
|
"tar": "^7.4.3",
|
|
68
|
-
"zod": "^3.
|
|
68
|
+
"zod": "^3.25.49"
|
|
69
69
|
},
|
|
70
70
|
"repository": {
|
|
71
71
|
"type": "git",
|