@open-audio-stack/core 0.1.35 → 0.1.37

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.
@@ -1,5 +1,5 @@
1
1
  import * as semver from 'semver';
2
- import { packageErrors, packageRecommendations } from '../helpers/package.js';
2
+ import { packageErrors, packageIsVerified, packageRecommendations } from '../helpers/package.js';
3
3
  import { isValidSlug } from '../helpers/utils.js';
4
4
  import { Base } from './Base.js';
5
5
  export class Package extends Base {
@@ -29,6 +29,7 @@ export class Package extends Base {
29
29
  this.reports.set(num, report);
30
30
  if (errors.length > 0)
31
31
  return this.log(`Package ${version.name} version ${num} errors`, errors);
32
+ version.verified = packageIsVerified(this.slug, version);
32
33
  this.versions.set(num, version);
33
34
  this.version = this.latestVersion();
34
35
  }
@@ -218,4 +218,6 @@ export declare const PackageVersionValidator: z.ZodObject<{
218
218
  export declare const SemverValidator: z.ZodString;
219
219
  export declare function packageRecommendations(pkgVersion: PackageVersion): PackageValidationRec[];
220
220
  export declare function packageRecommendationsUrl(obj: PackageVersion | PluginFile | PresetFile | ProjectFile, recs: PackageValidationRec[], field: string, domain?: string): void;
221
- export declare function packageToYaml(pkgVersion: PackageVersion): string;
221
+ export declare function packageJsToYaml(pkgVersion: PackageVersion): string;
222
+ export declare function packageYamlToJs(pkgYaml: string): PackageVersion;
223
+ export declare function packageIsVerified(slug: string, pkgVersion: PackageVersion): boolean;
@@ -194,6 +194,22 @@ export function packageRecommendationsUrl(obj, recs, field, domain) {
194
194
  });
195
195
  }
196
196
  }
197
- export function packageToYaml(pkgVersion) {
197
+ export function packageJsToYaml(pkgVersion) {
198
198
  return yaml.dump(pkgVersion, { lineWidth: -1 });
199
199
  }
200
+ export function packageYamlToJs(pkgYaml) {
201
+ return yaml.load(pkgYaml);
202
+ }
203
+ export function packageIsVerified(slug, pkgVersion) {
204
+ const org = slug.split('/')[0];
205
+ let verified = true;
206
+ pkgVersion.files.forEach(file => {
207
+ const url = file.url.toLowerCase();
208
+ const root = url.startsWith('https://github.com/') ? 'https://github.com/' + org + '/' : `https://${org}.`;
209
+ if (!url.startsWith(root)) {
210
+ verified = false;
211
+ return;
212
+ }
213
+ });
214
+ return verified;
215
+ }
@@ -24,6 +24,7 @@ export interface PackageBase {
24
24
  name: string;
25
25
  tags: string[];
26
26
  url: string;
27
+ verified?: boolean;
27
28
  }
28
29
  export interface PackageVersionReport {
29
30
  errors?: ZodIssue[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-audio-stack/core",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
4
4
  "description": "Open-source audio plugin management software",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",