SPB Git

Repository Public

index.ts 3.2 KB 81 lines typescript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : agentilab-web8 * File             : lib/catalog/index.ts9 * Module           : Catalog10 * Repository       : https://git.spboucher.ai/agentilab-web11 * Project Website  : Not specified12 * Created          : 2026-12-0513 * Last Modified    : 2026-12-0514 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: contact@spboucher.ai23 * Development      : dev@spboucher.ai24 * Support          : support@spboucher.ai25 * Security/Admin   : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License          : Proprietary34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import { brands } from '@/content/public/brands';44import { products } from '@/content/public/products';45import { technologies } from '@/content/public/technologies';46import { milestones } from '@/content/public/milestones';47import { contactChannels } from '@/content/public/contact';48import type { Brand, BrandId, ContactChannel, PublicProduct } from './types';49import { validateCatalog } from './validate';5051// Validation au chargement du module : un catalogue invalide fait échouer le build.52const errors = validateCatalog({ brands, products, technologies, milestones, channels: contactChannels });53if (errors.length > 0) {54  throw new Error(`Catalogue invalide (${errors.length}) :\n- ${errors.join('\n- ')}`);55}5657/** Produits publiés, sans leurs champs internes. */58export const publishedProducts: PublicProduct[] = products59  .filter((product) => product.publish && product.status !== 'unverified')60  .map((product) => {61    const copy: Partial<typeof product> = { ...product };62    delete copy.evidenceRef;63    delete copy.publish;64    return copy as PublicProduct;65  });6667export function productsOf(brandId: BrandId): PublicProduct[] {68  return publishedProducts.filter((product) => product.brandId === brandId);69}7071export function brand(id: BrandId): Brand {72  const found = brands.find((b) => b.id === id);73  if (!found) throw new Error(`Marque inconnue : ${id}`);74  return found;75}7677/** Seuls les canaux dont la réception a été constatée sont affichables. */78export const verifiedChannels: ContactChannel[] = contactChannels.filter((channel) => channel.verified);7980export { brands, technologies, milestones };81
Files main
Menu

Theme