@bridgething/catalog 0.1.0

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.
@@ -0,0 +1,17 @@
1
+ import { type CatalogAppListing, type InstalledWebapp } from './resolve.ts';
2
+ import type { MergedCatalog } from './sources.ts';
3
+ import type { InstallCount, SourceCatalog } from './types.ts';
4
+ export type StoreListings = {
5
+ vouched: CatalogAppListing[];
6
+ community: CatalogAppListing[];
7
+ sourceNames: Record<string, string>;
8
+ };
9
+ export declare function blendStoreListings(args: {
10
+ catalogs: SourceCatalog[];
11
+ merged: MergedCatalog[];
12
+ installed: InstalledWebapp[];
13
+ deviceLibVersion: string | null;
14
+ installs: InstallCount[];
15
+ subscribed: string[];
16
+ }): StoreListings;
17
+ //# sourceMappingURL=blend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blend.d.ts","sourceRoot":"","sources":["../src/blend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,GAAG,aAAa,CA2BhB"}
package/dist/blend.js ADDED
@@ -0,0 +1,27 @@
1
+ import { aggregate } from "./resolve.js";
2
+ export function blendStoreListings(args) {
3
+ const subscribed = new Set(args.subscribed);
4
+ const extras = args.merged.filter(entry => !subscribed.has(entry.url));
5
+ const communityUrls = new Set(extras.filter(entry => !entry.official && !entry.attested).map(entry => entry.url));
6
+ const asSource = (entry) => ({ url: entry.url, catalog: entry.catalog });
7
+ const orderedCatalogs = [
8
+ ...args.catalogs,
9
+ ...extras.filter(entry => !communityUrls.has(entry.url)).map(asSource),
10
+ ...extras.filter(entry => communityUrls.has(entry.url)).map(asSource),
11
+ ];
12
+ const listings = aggregate({
13
+ orderedCatalogs,
14
+ installed: args.installed,
15
+ deviceLibVersion: args.deviceLibVersion,
16
+ installs: args.installs,
17
+ });
18
+ const sourceNames = {};
19
+ for (const { url, catalog } of orderedCatalogs)
20
+ sourceNames[url] = catalog.repo.name;
21
+ return {
22
+ vouched: listings.filter(listing => !communityUrls.has(listing.sourceUrl)),
23
+ community: listings.filter(listing => communityUrls.has(listing.sourceUrl)),
24
+ sourceNames,
25
+ };
26
+ }
27
+ //# sourceMappingURL=blend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blend.js","sourceRoot":"","sources":["../src/blend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgD,MAAM,cAAc,CAAC;AAUvF,MAAM,UAAU,kBAAkB,CAAC,IAOlC;IACC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACvE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC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C,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC3E,WAAW;KACZ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ // generated by packages/catalog/scripts/compile-validator.ts from schema.v1.json; do not edit.
2
+
3
+ export type SchemaError = { instancePath: string; message?: string };
4
+
5
+ declare const validate: ((data: unknown) => boolean) & { errors?: SchemaError[] | null };
6
+ export default validate;