Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : ORIX App Universe8 * File : src/models/app.ts9 * Module : models10 * Repository : https://git.spboucher.ai/orix-spboucher-ai11 * Project Website : https://www.orixlab.dev12 * Created : 2026-11-2113 * Last Modified : 2026-11-2114 *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: support@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 : None specified (no license file in this repository)34 *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 { z } from "zod";4445/** Localized string: English and French-Canadian. */46export const L = z.object({ en: z.string(), fr: z.string() });47export type L = z.infer<typeof L>;4849import { CATEGORIES, CHANNELS, DEVICES, PLATFORMS, STATUSES } from "./constants";50export * from "./constants";5152export const Screenshot = z.object({53 file: z.string().regex(/^(u\/)?[A-Za-z0-9._-]+\.(png|jpe?g|webp)$/),54 device: z.enum(DEVICES),55 appearance: z.enum(["light", "dark"]).default("light"),56 caption: L,57 hero: z.boolean().optional(),58});59export type Screenshot = z.infer<typeof Screenshot>;6061/** Result of the last server-side check of a public TestFlight invitation. */62export const LinkCheck = z.object({ at: z.string(), result: z.enum(["open", "full", "closed", "unknown", "error"]), detail: z.string().optional() });6364export const Distribution = z.object({65 channel: z.enum(CHANNELS),66 /** public = anyone may use `url`; internal = exists but restricted; none = nothing yet. */67 state: z.enum(["public", "internal", "none"]),68 url: z.string().url().nullable(),69 note: L.optional(),70 check: LinkCheck.optional(),71});72export type Distribution = z.infer<typeof Distribution>;7374export const ReleaseNote = z.object({75 version: z.string(), build: z.string().nullable().optional(), date: z.string(),76 channel: z.string(), notes: z.array(L),77});7879export const AppDoc = z.object({80 slug: z.string().regex(/^[a-z][a-z0-9-]{1,30}$/),81 name: z.string().min(1),82 order: z.number().int(),83 featured: z.boolean().optional(),84 category: z.enum(CATEGORIES),85 platforms: z.array(z.enum(PLATFORMS)).min(1),86 status: z.enum(STATUSES),87 /** Status on one platform when it differs from `status` (an app released for Mac whose iPhone version is still to come). */88 platformStatus: z.partialRecord(z.enum(PLATFORMS), z.enum(STATUSES)).optional(),89 accent: z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable(),90 icon: z.string().nullable(),91 repo: z.object({ name: z.string().nullable(), visibility: z.enum(["public", "private", "none"]) }),92 bundleId: z.string().nullable(),93 version: z.string().nullable(),94 build: z.string().nullable().optional(),95 minOS: z.record(z.string(), z.string()),96 architectures: z.array(z.string()),97 downloadSize: z.object({ bytes: z.number(), source: z.string() }).nullable(),98 tagline: L, summary: L, description: L,99 features: z.array(z.object({ title: L, body: L })),100 deepDives: z.array(z.object({ title: L, body: L, screenshot: z.string().nullable().optional() })),101 specs: z.object({ offline: L, permissions: z.array(L), languages: z.array(z.string()), dependencies: L.optional() }),102 privacy: z.object({ summary: L, points: z.array(L) }),103 faq: z.array(z.object({ q: L, a: L })),104 screenshots: z.array(Screenshot),105 distribution: z.array(Distribution),106 verification: z.object({ testedOnDevice: z.boolean(), tests: L.optional(), notes: L }),107 releases: z.array(ReleaseNote),108 seo: z.object({ title: L.optional(), description: L.optional() }).optional(),109 evidence: z.array(z.string()).optional(),110});111export type AppDoc = z.infer<typeof AppDoc>;112113/** Fields the catalog requires before an application may be published. */114export function publishProblems(a: AppDoc): string[] {115 const p: string[] = [];116 for (const k of ["tagline", "summary", "description"] as const) for (const l of ["en", "fr"] as const) if (!a[k][l].trim()) p.push(`${k}.${l} is empty`);117 if (a.screenshots.filter((s) => s.hero).length > 1) p.push("more than one hero screenshot");118 for (const d of a.distribution) {119 if (d.state === "public" && !d.url) p.push(`${d.channel}: public without a URL`);120 if (d.channel === "testflight" && d.url && !/^https:\/\/testflight\.apple\.com\/join\/[A-Za-z0-9]{6,12}$/.test(d.url)) p.push("testflight: not a public invitation URL");121 }122 if (a.status === "available" && !a.version) p.push("available without a version");123 return p;124}125