@open-audio-stack/core 0.1.32 → 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.
@@ -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;
@@ -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 duplicatation of code between types and validators.
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(0).max(9999999999),
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(0).max(256).startsWith('https://'),
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(0).max(256).startsWith('https://'),
60
- author: z.string().min(0).max(256),
61
- changes: z.string().min(0).max(256),
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(0).max(256),
64
- donate: z.optional(z.string().min(0).max(256).startsWith('https://')),
65
- files: z.array(PackageFileValidator),
66
- image: z.string().min(0).max(256).startsWith('https://'),
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(0).max(256),
69
- tags: z.string().min(0).max(256).array(),
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(0).max(256).startsWith('https://'),
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-audio-stack/core",
3
- "version": "0.1.32",
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.23.8"
68
+ "zod": "^3.25.49"
69
69
  },
70
70
  "repository": {
71
71
  "type": "git",